if (zoom_factor_ != 1.0)
command_line->AppendSwitchASCII(switches::kZoomFactor,
base::DoubleToString(zoom_factor_));
+
+ if (web_preferences_.IsEmpty())
+ return;
+
+ // This set of options are not availabe in WebPreferences, so we have to pass
+ // them via command line and enable them in renderer procss.
+ bool b;
+ std::string web_runtime_features;
+ mate::Dictionary web_preferences(web_preferences_.isolate(),
+ web_preferences_.NewHandle());
+ for (int i = 0; i < switches::kWebRuntimeFeaturesFlagsSize; ++i) {
+ const char* feature_flag = switches::kWebRuntimeFeaturesFlags[i];
+ if (web_preferences.Get(feature_flag, &b))
+ command_line->AppendSwitchASCII(feature_flag, b ? "true" : "false");
+ }
}
void NativeWindow::OverrideWebkitPrefs(const GURL& url, WebPreferences* prefs) {
#include "third_party/WebKit/public/web/WebDocument.h"
#include "third_party/WebKit/public/web/WebFrame.h"
#include "third_party/WebKit/public/web/WebKit.h"
+#include "third_party/WebKit/public/web/WebRuntimeFeatures.h"
#include "atom/common/node_includes.h"
const char* kSecurityDisable = "disable";
const char* kSecurityEnableNodeIntegration = "enable-node-integration";
+bool IsSwitchEnabled(base::CommandLine* command_line,
+ const char* switch_string,
+ bool* enabled) {
+ std::string value = command_line->GetSwitchValueASCII(switch_string);
+ if (value == "true")
+ *enabled = true;
+ else if (value == "false")
+ *enabled = false;
+ else
+ return false;
+ return true;
+}
+
// Helper class to forward the WillReleaseScriptContext message to the client.
class AtomRenderFrameObserver : public content::RenderFrameObserver {
public:
}
void AtomRendererClient::WebKitInitialized() {
+ EnableWebRuntimeFeatures();
+
if (!IsNodeBindingEnabled())
return;
return true;
}
+void AtomRendererClient::EnableWebRuntimeFeatures() {
+ base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
+ bool b;
+ if (IsSwitchEnabled(command_line, switches::kExperimentalFeatures, &b))
+ blink::WebRuntimeFeatures::enableExperimentalFeatures(b);
+ if (IsSwitchEnabled(command_line, switches::kExperimentalCanvasFeatures, &b))
+ blink::WebRuntimeFeatures::enableExperimentalCanvasFeatures(b);
+ if (IsSwitchEnabled(command_line, switches::kSubpixelFontScaling, &b))
+ blink::WebRuntimeFeatures::enableSubpixelFontScaling(b);
+ if (IsSwitchEnabled(command_line, switches::kOverlayScrollbars, &b))
+ blink::WebRuntimeFeatures::enableOverlayScrollbars(b);
+ if (IsSwitchEnabled(command_line, switches::kOverlayFullscreenVideo, &b))
+ blink::WebRuntimeFeatures::enableOverlayFullscreenVideo(b);
+ if (IsSwitchEnabled(command_line, switches::kSharedWorker, &b))
+ blink::WebRuntimeFeatures::enableSharedWorker(b);
+}
+
} // namespace atom