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:
Aleksei Kuzmin 2017-08-22 02:09:28 +03:00 committed by Cheng Zhao
parent 61797b7802
commit e4d9e12ee5
5 changed files with 13 additions and 9 deletions

View file

@ -84,10 +84,10 @@ AtomRenderViewObserver::AtomRenderViewObserver(
AtomRenderViewObserver::~AtomRenderViewObserver() {
}
void AtomRenderViewObserver::EmitIPCEvent(blink::WebFrame* frame,
void AtomRenderViewObserver::EmitIPCEvent(blink::WebLocalFrame* frame,
const base::string16& channel,
const base::ListValue& args) {
if (!frame || frame->IsWebRemoteFrame())
if (!frame)
return;
v8::Isolate* isolate = blink::MainThreadIsolate();
@ -163,13 +163,15 @@ void AtomRenderViewObserver::OnBrowserMessage(bool send_to_all,
return;
}
EmitIPCEvent(frame, channel, args);
EmitIPCEvent(frame->ToWebLocalFrame(), channel, args);
// Also send the message to all sub-frames.
if (send_to_all) {
for (blink::WebFrame* child = frame->FirstChild(); child;
child = child->NextSibling())
EmitIPCEvent(child, channel, args);
if (child->IsWebLocalFrame()) {
EmitIPCEvent(child->ToWebLocalFrame(), channel, args);
}
}
}

View file

@ -8,6 +8,7 @@
#include "base/strings/string16.h"
#include "content/public/renderer/render_view_observer.h"
#include "third_party/WebKit/public/web/WebFrame.h"
#include "third_party/WebKit/public/web/WebLocalFrame.h"
namespace base {
class ListValue;
@ -25,7 +26,7 @@ class AtomRenderViewObserver : public content::RenderViewObserver {
protected:
virtual ~AtomRenderViewObserver();
virtual void EmitIPCEvent(blink::WebFrame* frame,
virtual void EmitIPCEvent(blink::WebLocalFrame* frame,
const base::string16& channel,
const base::ListValue& args);

View file

@ -107,10 +107,10 @@ class AtomSandboxedRenderViewObserver : public AtomRenderViewObserver {
}
protected:
void EmitIPCEvent(blink::WebFrame* frame,
void EmitIPCEvent(blink::WebLocalFrame* frame,
const base::string16& channel,
const base::ListValue& args) override {
if (!frame || frame->IsWebRemoteFrame())
if (!frame)
return;
auto isolate = blink::MainThreadIsolate();

View file

@ -217,7 +217,7 @@ void RendererClientBase::AddSupportedKeySystems(
}
v8::Local<v8::Context> RendererClientBase::GetContext(
blink::WebFrame* frame, v8::Isolate* isolate) {
blink::WebLocalFrame* frame, v8::Isolate* isolate) {
if (isolated_world())
return frame->WorldScriptContext(isolate, World::ISOLATED_WORLD);
else

View file

@ -9,6 +9,7 @@
#include <vector>
#include "content/public/renderer/content_renderer_client.h"
#include "third_party/WebKit/public/web/WebLocalFrame.h"
namespace atom {
@ -30,7 +31,7 @@ class RendererClientBase : public content::ContentRendererClient {
// Get the context that the Electron API is running in.
v8::Local<v8::Context> GetContext(
blink::WebFrame* frame, v8::Isolate* isolate);
blink::WebLocalFrame* frame, v8::Isolate* isolate);
protected:
void AddRenderBindings(v8::Isolate* isolate,