Use blink::WebLocalFrame instead of blink::WebFrame
Move GetDocument method from WebFrame to WebLocalFrame. https://codereview.chromium.org/2928033002 Move MainWorldScriptContext accessor/method from WebFrame to WebLocalFrame. https://codereview.chromium.org/2923053002
This commit is contained in:
parent
61797b7802
commit
e4d9e12ee5
5 changed files with 13 additions and 9 deletions
|
@ -84,10 +84,10 @@ AtomRenderViewObserver::AtomRenderViewObserver(
|
||||||
AtomRenderViewObserver::~AtomRenderViewObserver() {
|
AtomRenderViewObserver::~AtomRenderViewObserver() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void AtomRenderViewObserver::EmitIPCEvent(blink::WebFrame* frame,
|
void AtomRenderViewObserver::EmitIPCEvent(blink::WebLocalFrame* frame,
|
||||||
const base::string16& channel,
|
const base::string16& channel,
|
||||||
const base::ListValue& args) {
|
const base::ListValue& args) {
|
||||||
if (!frame || frame->IsWebRemoteFrame())
|
if (!frame)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
v8::Isolate* isolate = blink::MainThreadIsolate();
|
v8::Isolate* isolate = blink::MainThreadIsolate();
|
||||||
|
@ -163,13 +163,15 @@ void AtomRenderViewObserver::OnBrowserMessage(bool send_to_all,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
EmitIPCEvent(frame, channel, args);
|
EmitIPCEvent(frame->ToWebLocalFrame(), channel, args);
|
||||||
|
|
||||||
// Also send the message to all sub-frames.
|
// Also send the message to all sub-frames.
|
||||||
if (send_to_all) {
|
if (send_to_all) {
|
||||||
for (blink::WebFrame* child = frame->FirstChild(); child;
|
for (blink::WebFrame* child = frame->FirstChild(); child;
|
||||||
child = child->NextSibling())
|
child = child->NextSibling())
|
||||||
EmitIPCEvent(child, channel, args);
|
if (child->IsWebLocalFrame()) {
|
||||||
|
EmitIPCEvent(child->ToWebLocalFrame(), channel, args);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
#include "base/strings/string16.h"
|
#include "base/strings/string16.h"
|
||||||
#include "content/public/renderer/render_view_observer.h"
|
#include "content/public/renderer/render_view_observer.h"
|
||||||
#include "third_party/WebKit/public/web/WebFrame.h"
|
#include "third_party/WebKit/public/web/WebFrame.h"
|
||||||
|
#include "third_party/WebKit/public/web/WebLocalFrame.h"
|
||||||
|
|
||||||
namespace base {
|
namespace base {
|
||||||
class ListValue;
|
class ListValue;
|
||||||
|
@ -25,7 +26,7 @@ class AtomRenderViewObserver : public content::RenderViewObserver {
|
||||||
protected:
|
protected:
|
||||||
virtual ~AtomRenderViewObserver();
|
virtual ~AtomRenderViewObserver();
|
||||||
|
|
||||||
virtual void EmitIPCEvent(blink::WebFrame* frame,
|
virtual void EmitIPCEvent(blink::WebLocalFrame* frame,
|
||||||
const base::string16& channel,
|
const base::string16& channel,
|
||||||
const base::ListValue& args);
|
const base::ListValue& args);
|
||||||
|
|
||||||
|
|
|
@ -107,10 +107,10 @@ class AtomSandboxedRenderViewObserver : public AtomRenderViewObserver {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void EmitIPCEvent(blink::WebFrame* frame,
|
void EmitIPCEvent(blink::WebLocalFrame* frame,
|
||||||
const base::string16& channel,
|
const base::string16& channel,
|
||||||
const base::ListValue& args) override {
|
const base::ListValue& args) override {
|
||||||
if (!frame || frame->IsWebRemoteFrame())
|
if (!frame)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
auto isolate = blink::MainThreadIsolate();
|
auto isolate = blink::MainThreadIsolate();
|
||||||
|
|
|
@ -217,7 +217,7 @@ void RendererClientBase::AddSupportedKeySystems(
|
||||||
}
|
}
|
||||||
|
|
||||||
v8::Local<v8::Context> RendererClientBase::GetContext(
|
v8::Local<v8::Context> RendererClientBase::GetContext(
|
||||||
blink::WebFrame* frame, v8::Isolate* isolate) {
|
blink::WebLocalFrame* frame, v8::Isolate* isolate) {
|
||||||
if (isolated_world())
|
if (isolated_world())
|
||||||
return frame->WorldScriptContext(isolate, World::ISOLATED_WORLD);
|
return frame->WorldScriptContext(isolate, World::ISOLATED_WORLD);
|
||||||
else
|
else
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "content/public/renderer/content_renderer_client.h"
|
#include "content/public/renderer/content_renderer_client.h"
|
||||||
|
#include "third_party/WebKit/public/web/WebLocalFrame.h"
|
||||||
|
|
||||||
namespace atom {
|
namespace atom {
|
||||||
|
|
||||||
|
@ -30,7 +31,7 @@ class RendererClientBase : public content::ContentRendererClient {
|
||||||
|
|
||||||
// Get the context that the Electron API is running in.
|
// Get the context that the Electron API is running in.
|
||||||
v8::Local<v8::Context> GetContext(
|
v8::Local<v8::Context> GetContext(
|
||||||
blink::WebFrame* frame, v8::Isolate* isolate);
|
blink::WebLocalFrame* frame, v8::Isolate* isolate);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void AddRenderBindings(v8::Isolate* isolate,
|
void AddRenderBindings(v8::Isolate* isolate,
|
||||||
|
|
Loading…
Reference in a new issue