]> khamidou — GitHub mirrors - electron.git/commitdiff
Add "plugins" attribute for <webview>
authorCheng Zhao <zcbenz@gmail.com>
Wed, 5 Nov 2014 06:59:28 +0000 (14:59 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Wed, 5 Nov 2014 06:59:28 +0000 (14:59 +0800)
atom/browser/atom_browser_client.cc
atom/browser/lib/guest-view-manager.coffee
atom/browser/web_view/web_view_manager.cc
atom/browser/web_view/web_view_manager.h
atom/browser/web_view/web_view_renderer_state.h
atom/renderer/lib/web-view.coffee

index f197cc4a1fb333ec73414995d4c03866f113bd5a..0ae8bfed6742869a820609cf91a6181a69e4e247 100644 (file)
@@ -154,6 +154,8 @@ void AtomBrowserClient::AppendExtraCommandLineSwitches(
       command_line->AppendSwitchASCII(
           switches::kNodeIntegration,
           info.node_integration ? "true" : "false");
+      if (info.plugins)
+        command_line->AppendSwitch(switches::kEnablePlugins);
     }
   }
 
index b2827ad54d0f193b2513015aae1c6eb47aebb1e1..bec53ef30f2c3fb10ac2eef077fe052fd9305a1f 100644 (file)
@@ -33,7 +33,7 @@ createGuest = (embedder, params) ->
     guestInstanceId: id
     storagePartitionId: params.storagePartitionId
   guestInstances[id] = {guest, embedder}
-  webViewManager.addGuest id, embedder, guest, params.nodeIntegration
+  webViewManager.addGuest id, embedder, guest, params.nodeIntegration, params.plugins
 
   # Destroy guest when the embedder is gone.
   embedder.once 'render-view-deleted', ->
index 05692841c8ca291d1dee98ab1d6112957c6d897f..88a1bdb2f7b2aaaaea68ea3a7f803b903eb7d74c 100644 (file)
@@ -43,11 +43,12 @@ WebViewManager::~WebViewManager() {
 void WebViewManager::AddGuest(int guest_instance_id,
                               content::WebContents* embedder,
                               content::WebContents* web_contents,
-                              bool node_integration) {
+                              bool node_integration,
+                              bool plugins) {
   web_contents_map_[guest_instance_id] = { web_contents, embedder };
 
   WebViewRendererState::WebViewInfo web_view_info = {
-    guest_instance_id, node_integration
+    guest_instance_id, node_integration, plugins
   };
   content::BrowserThread::PostTask(
       content::BrowserThread::IO,
index 855026b1a46210339970d5a27e24332fd1817fc9..f00e5a6607f0ec3dbfd3571b9f29b3c81b3c8688 100644 (file)
@@ -23,7 +23,8 @@ class WebViewManager : public content::BrowserPluginGuestManager {
   void AddGuest(int guest_instance_id,
                 content::WebContents* embedder,
                 content::WebContents* web_contents,
-                bool node_integration);
+                bool node_integration,
+                bool plugins);
   void RemoveGuest(int guest_instance_id);
 
  protected:
index 4186a6de95a70cc1be77ed6a582a1fd3f29b106d..2de8308a9d4e5fd316f278b663bc4e70f4ee2ccc 100644 (file)
@@ -22,6 +22,7 @@ class WebViewRendererState {
   struct WebViewInfo {
     int guest_instance_id;
     bool node_integration;
+    bool plugins;
   };
 
   static WebViewRendererState* GetInstance();
index 781a712a11eb5127b3058dd1afea02eb33f9408e..456ce931f15ed1964766d5735acef3a43b97ee95 100644 (file)
@@ -20,6 +20,7 @@ WEB_VIEW_ATTRIBUTE_MINHEIGHT = 'minheight'
 WEB_VIEW_ATTRIBUTE_MINWIDTH = 'minwidth'
 WEB_VIEW_ATTRIBUTE_PARTITION = 'partition'
 WEB_VIEW_ATTRIBUTE_NODEINTEGRATION = 'nodeintegration'
+WEB_VIEW_ATTRIBUTE_PLUGINS = 'plugins'
 AUTO_SIZE_ATTRIBUTES = [
   WEB_VIEW_ATTRIBUTE_AUTOSIZE,
   WEB_VIEW_ATTRIBUTE_MAXHEIGHT,
@@ -377,6 +378,7 @@ class WebView
     params =
       storagePartitionId: storagePartitionId
       nodeIntegration: @webviewNode.hasAttribute WEB_VIEW_ATTRIBUTE_NODEINTEGRATION
+      plugins: @webviewNode.hasAttribute WEB_VIEW_ATTRIBUTE_PLUGINS
     guestViewInternal.createGuest 'webview', params, (guestInstanceId) =>
       @pendingGuestCreation = false
       unless @elementAttached