Append command line for renderer in NativeWindow.

This commit is contained in:
Cheng Zhao 2014-03-06 10:40:10 +08:00
parent 1b3e6bdb92
commit 686493e8ec
3 changed files with 15 additions and 6 deletions

View 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;
}

View 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;

View 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;