Append command line for renderer in NativeWindow.
authorCheng Zhao <zcbenz@gmail.com>
Thu, 6 Mar 2014 02:40:10 +0000 (10:40 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Thu, 6 Mar 2014 02:40:10 +0000 (10:40 +0800)
browser/atom_browser_client.cc
browser/native_window.cc
browser/native_window.h

index ffe81f1..1942479 100644 (file)
@@ -4,13 +4,11 @@
 
 #include "browser/atom_browser_client.h"
 
-#include "base/command_line.h"
 #include "browser/atom_browser_context.h"
 #include "browser/atom_browser_main_parts.h"
 #include "browser/native_window.h"
 #include "browser/net/atom_url_request_context_getter.h"
 #include "browser/window_list.h"
-#include "common/options_switches.h"
 #include "content/public/browser/render_process_host.h"
 #include "content/public/browser/site_instance.h"
 #include "content/public/browser/web_contents.h"
@@ -105,10 +103,8 @@ void AtomBrowserClient::AppendExtraCommandLineSwitches(
       window = *iter;
   }
 
-  // Append --node-integration to renderer process.
   if (window != NULL)
-    command_line->AppendSwitchASCII(switches::kNodeIntegration,
-                                    window->node_integration());
+    window->AppendExtraCommandLineSwitches(command_line, child_process_id);
 
   dying_render_process_ = NULL;
 }
index 8377739..f617233 100644 (file)
@@ -6,6 +6,7 @@
 
 #include <string>
 
+#include "base/command_line.h"
 #include "base/file_util.h"
 #include "base/prefs/pref_service.h"
 #include "base/message_loop/message_loop.h"
@@ -311,6 +312,13 @@ content::WebContents* NativeWindow::GetDevToolsWebContents() const {
   return inspectable_web_contents()->devtools_web_contents();
 }
 
+void NativeWindow::AppendExtraCommandLineSwitches(CommandLine* command_line,
+                                                  int child_process_id) {
+  // Append --node-integration to renderer process.
+  command_line->AppendSwitchASCII(switches::kNodeIntegration,
+                                  node_integration_);
+}
+
 void NativeWindow::NotifyWindowClosed() {
   if (is_closed_)
     return;
index af763dd..efd319c 100644 (file)
@@ -19,6 +19,8 @@
 #include "vendor/brightray/browser/inspectable_web_contents_delegate.h"
 #include "vendor/brightray/browser/inspectable_web_contents_impl.h"
 
+class CommandLine;
+
 namespace base {
 class DictionaryValue;
 class ListValue;
@@ -160,6 +162,10 @@ class NativeWindow : public brightray::DefaultWebContentsDelegate,
   content::WebContents* GetWebContents() const;
   content::WebContents* GetDevToolsWebContents() const;
 
+  // Called when renderer process is going to be started.
+  void AppendExtraCommandLineSwitches(CommandLine* command_line,
+                                      int child_process_id);
+
   void AddObserver(NativeWindowObserver* obs) {
     observers_.AddObserver(obs);
   }
@@ -169,7 +175,6 @@ class NativeWindow : public brightray::DefaultWebContentsDelegate,
   }
 
   bool has_frame() const { return has_frame_; }
-  std::string node_integration() const { return node_integration_; }
 
   void set_has_dialog_attached(bool has_dialog_attached) {
     has_dialog_attached_ = has_dialog_attached;