diff --git a/src/common/shell_switches.cc b/src/common/shell_switches.cc index 2a60cb715f..92810c73e3 100644 --- a/src/common/shell_switches.cc +++ b/src/common/shell_switches.cc @@ -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"; @@ -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 diff --git a/src/common/shell_switches.h b/src/common/shell_switches.h index 2d25bc2a9f..4676d37b93 100644 --- a/src/common/shell_switches.h +++ b/src/common/shell_switches.h @@ -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_ diff --git a/src/shell_content_browser_client.cc b/src/shell_content_browser_client.cc index 9c8f51d485..f1f4dbe9ce 100644 --- a/src/shell_content_browser_client.cc +++ b/src/shell_content_browser_client.cc @@ -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