Skip to content

Commit

Permalink
Add webkit switches: 'plugin', 'java' and 'page-cache'.
Browse files Browse the repository at this point in the history
  • Loading branch information
zcbenz committed Oct 14, 2012
1 parent b7746e3 commit ee02052
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 8 deletions.
15 changes: 10 additions & 5 deletions src/common/shell_switches.cc
Expand Up @@ -37,11 +37,11 @@ const char kUrl[] = "url";
// Set current working directory
const char kWorkingDirectory[] = "working-directory";

const char kmMain[] = "main";
const char kmName[] = "name";
const char kmWebkit[] = "webkit";
const char kmNodejs[] = "nodejs";
const char kmWindow[] = "window";
const char kmMain[] = "main";
const char kmName[] = "name";
const char kmWebkit[] = "webkit";
const char kmNodejs[] = "nodejs";
const char kmWindow[] = "window";

const char kmTitle[] = "title";
const char kmToolbar[] = "toolbar";
Expand All @@ -61,4 +61,9 @@ const char kmResizable[] = "resizable";
const char kmFullscreen[] = "fullscreen";
const char kmAsDesktop[] = "as_desktop";

const char kmWebgl[] = "webgl";
const char kmJava[] = "java";
const char kmPlugin[] = "plugin";
const char kmPageCache[] = "page-cache";

} // namespace switches
5 changes: 5 additions & 0 deletions src/common/shell_switches.h
Expand Up @@ -40,6 +40,11 @@ extern const char kmResizable[];
extern const char kmAsDesktop[];
extern const char kmFullscreen[];

extern const char kmWebgl[];
extern const char kmJava[];
extern const char kmPlugin[];
extern const char kmPageCache[];

} // namespace switches

#endif // CONTENT_NW_SRC_SHELL_SWITCHES_H_
13 changes: 10 additions & 3 deletions src/shell_content_browser_client.cc
Expand Up @@ -114,16 +114,23 @@ void ShellContentBrowserClient::OverrideWebkitPrefs(
RenderViewHost* render_view_host,
const GURL& url,
webkit_glue::WebPreferences* prefs) {
nw::Package* package = shell_browser_main_parts()->package();

// Disable web security
prefs->web_security_enabled = false;
prefs->allow_file_access_from_file_urls = true;

// Disable plugins to speed up (TODO provide flag to enable them)
// Disable plugins and cache by default
prefs->plugins_enabled = false;
prefs->java_enabled = false;

// No caches
prefs->uses_page_cache = false;

base::DictionaryValue* webkit;
if (package->root()->GetDictionary(switches::kmWebkit, &webkit)) {
webkit->GetBoolean(switches::kmJava, &prefs->java_enabled);
webkit->GetBoolean(switches::kmPlugin, &prefs->plugins_enabled);
webkit->GetBoolean(switches::kmPageCache, &prefs->uses_page_cache);
}
}

} // namespace content

0 comments on commit ee02052

Please sign in to comment.