diff --git a/atom/browser/web_contents_preferences.cc b/atom/browser/web_contents_preferences.cc index 92b89de614ed..03003a563a19 100644 --- a/atom/browser/web_contents_preferences.cc +++ b/atom/browser/web_contents_preferences.cc @@ -10,6 +10,7 @@ #include "atom/common/options_switches.h" #include "base/command_line.h" #include "base/strings/string_number_conversions.h" +#include "content/public/common/content_switches.h" #include "content/public/common/web_preferences.h" #include "native_mate/dictionary.h" #include "net/base/filename_util.h" @@ -22,22 +23,6 @@ DEFINE_WEB_CONTENTS_USER_DATA_KEY(atom::WebContentsPreferences); namespace atom { -namespace { - -// Array of available web runtime features. -struct FeaturePair { - const char* name; - const char* cmd; -}; -FeaturePair kWebRuntimeFeatures[] = { - { options::kExperimentalFeatures, - switches::kExperimentalFeatures }, - { options::kExperimentalCanvasFeatures, - switches::kExperimentalCanvasFeatures }, -}; - -} // namespace - WebContentsPreferences::WebContentsPreferences( content::WebContents* web_contents, const mate::Dictionary& web_preferences) { @@ -79,13 +64,12 @@ void WebContentsPreferences::AppendExtraCommandLineSwitches( if (web_preferences.GetBoolean("plugins", &b) && b) command_line->AppendSwitch(switches::kEnablePlugins); - // This set of options are not availabe in WebPreferences, so we have to pass - // them via command line and enable them in renderer procss. - for (size_t i = 0; i < arraysize(kWebRuntimeFeatures); ++i) { - const auto& feature = kWebRuntimeFeatures[i]; - if (web_preferences.GetBoolean(feature.name, &b)) - command_line->AppendSwitchASCII(feature.cmd, b ? "true" : "false"); - } + // Experimental flags. + if (web_preferences.GetBoolean(options::kExperimentalFeatures, &b) && b) + command_line->AppendSwitch( + ::switches::kEnableExperimentalWebPlatformFeatures); + if (web_preferences.GetBoolean(options::kExperimentalCanvasFeatures, &b) && b) + command_line->AppendSwitch(::switches::kEnableExperimentalCanvasFeatures); // Check if we have node integration specified. bool node_integration = true; diff --git a/atom/common/options_switches.cc b/atom/common/options_switches.cc index 776113cb1011..a62af41e16ca 100644 --- a/atom/common/options_switches.cc +++ b/atom/common/options_switches.cc @@ -136,8 +136,6 @@ const char kPreloadScript[] = "preload"; const char kPreloadURL[] = "preload-url"; const char kNodeIntegration[] = "node-integration"; const char kGuestInstanceID[] = "guest-instance-id"; -const char kExperimentalFeatures[] = "experimental-features"; -const char kExperimentalCanvasFeatures[] = "experimental-canvas-features"; const char kOpenerID[] = "opener-id"; // Widevine options diff --git a/atom/common/options_switches.h b/atom/common/options_switches.h index f22d35df1871..ef860b6aeacc 100644 --- a/atom/common/options_switches.h +++ b/atom/common/options_switches.h @@ -74,8 +74,6 @@ extern const char kPreloadScript[]; extern const char kPreloadURL[]; extern const char kNodeIntegration[]; extern const char kGuestInstanceID[]; -extern const char kExperimentalFeatures[]; -extern const char kExperimentalCanvasFeatures[]; extern const char kOpenerID[]; extern const char kWidevineCdmPath[]; diff --git a/atom/renderer/atom_renderer_client.cc b/atom/renderer/atom_renderer_client.cc index 31336f3bab47..d9c364c3733f 100644 --- a/atom/renderer/atom_renderer_client.cc +++ b/atom/renderer/atom_renderer_client.cc @@ -41,11 +41,6 @@ namespace atom { namespace { -bool IsSwitchEnabled(base::CommandLine* command_line, - const char* switch_string) { - return command_line->GetSwitchValueASCII(switch_string) == "true"; -} - // Helper class to forward the messages to the client. class AtomRenderFrameObserver : public content::RenderFrameObserver { public: @@ -95,8 +90,6 @@ AtomRendererClient::~AtomRendererClient() { } void AtomRendererClient::WebKitInitialized() { - EnableWebRuntimeFeatures(); - blink::WebCustomElement::addEmbedderCustomElementName("webview"); blink::WebCustomElement::addEmbedderCustomElementName("browserplugin"); @@ -210,15 +203,6 @@ content::BrowserPluginDelegate* AtomRendererClient::CreateBrowserPluginDelegate( } } -void AtomRendererClient::EnableWebRuntimeFeatures() { - base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); - - if (IsSwitchEnabled(command_line, switches::kExperimentalFeatures)) - blink::WebRuntimeFeatures::enableExperimentalFeatures(true); - if (IsSwitchEnabled(command_line, switches::kExperimentalCanvasFeatures)) - blink::WebRuntimeFeatures::enableExperimentalCanvasFeatures(true); -} - void AtomRendererClient::AddKeySystems( std::vector* key_systems) { AddChromeKeySystems(key_systems); diff --git a/atom/renderer/atom_renderer_client.h b/atom/renderer/atom_renderer_client.h index d99e83f79aa0..beeeb9d530b0 100644 --- a/atom/renderer/atom_renderer_client.h +++ b/atom/renderer/atom_renderer_client.h @@ -58,8 +58,6 @@ class AtomRendererClient : public content::ContentRendererClient, const GURL& original_url) override; void AddKeySystems(std::vector* key_systems) override; - void EnableWebRuntimeFeatures(); - scoped_ptr node_bindings_; scoped_ptr atom_bindings_;