Insert node integration for all main frames

This commit is contained in:
Cheng Zhao 2015-08-31 21:59:13 +08:00
parent 9ecc4bcb7d
commit ebedb60684
2 changed files with 3 additions and 9 deletions

View file

@ -109,8 +109,7 @@ class AtomRenderFrameObserver : public content::RenderFrameObserver {
AtomRendererClient::AtomRendererClient() AtomRendererClient::AtomRendererClient()
: node_bindings_(NodeBindings::Create(false)), : node_bindings_(NodeBindings::Create(false)),
atom_bindings_(new AtomBindings), atom_bindings_(new AtomBindings) {
main_frame_(nullptr) {
} }
AtomRendererClient::~AtomRendererClient() { AtomRendererClient::~AtomRendererClient() {
@ -185,12 +184,10 @@ bool AtomRendererClient::OverrideCreatePlugin(
void AtomRendererClient::DidCreateScriptContext( void AtomRendererClient::DidCreateScriptContext(
blink::WebFrame* frame, blink::WebFrame* frame,
v8::Handle<v8::Context> context) { v8::Handle<v8::Context> context) {
if (main_frame_) // Only insert node integration for the main frame.
if (frame->parent())
return; return;
// The first web frame is the main frame.
main_frame_ = frame;
// Give the node loop a run to make sure everything is ready. // Give the node loop a run to make sure everything is ready.
node_bindings_->RunMessageLoop(); node_bindings_->RunMessageLoop();

View file

@ -64,9 +64,6 @@ class AtomRendererClient : public content::ContentRendererClient,
scoped_ptr<NodeBindings> node_bindings_; scoped_ptr<NodeBindings> node_bindings_;
scoped_ptr<AtomBindings> atom_bindings_; scoped_ptr<AtomBindings> atom_bindings_;
// The main frame.
blink::WebFrame* main_frame_;
DISALLOW_COPY_AND_ASSIGN(AtomRendererClient); DISALLOW_COPY_AND_ASSIGN(AtomRendererClient);
}; };