diff options
author | nasko <nasko@chromium.org> | 2015-09-14 11:39:41 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-09-14 18:40:39 +0000 |
commit | 5c749f3a0fad10de6b56d49351f9b99907f16750 (patch) | |
tree | 01b45a7b124721fd471dbac524a906ba725b2044 /extensions/renderer/guest_view | |
parent | b86e5ec19000673ba632555964e1976182415864 (diff) | |
download | chromium_src-5c749f3a0fad10de6b56d49351f9b99907f16750.zip chromium_src-5c749f3a0fad10de6b56d49351f9b99907f16750.tar.gz chromium_src-5c749f3a0fad10de6b56d49351f9b99907f16750.tar.bz2 |
Prepare MimeHanderViewContainer for removing swapped out RenderFrame.
The current implementation of MimeHanderViewContainer is dependent on
the usage of swapped out RenderFrame for the out-of-process component.
Since swapped out state is going away, this CL removes this dependency.
Credit goes to dcheng@, who found the simplest solution.
BUG=357747
Review URL: https://codereview.chromium.org/1335023004
Cr-Commit-Position: refs/heads/master@{#348666}
Diffstat (limited to 'extensions/renderer/guest_view')
-rw-r--r-- | extensions/renderer/guest_view/mime_handler_view/mime_handler_view_container.cc | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/extensions/renderer/guest_view/mime_handler_view/mime_handler_view_container.cc b/extensions/renderer/guest_view/mime_handler_view/mime_handler_view_container.cc index e351282..7d34c75 100644 --- a/extensions/renderer/guest_view/mime_handler_view/mime_handler_view_container.cc +++ b/extensions/renderer/guest_view/mime_handler_view/mime_handler_view_container.cc @@ -23,6 +23,7 @@ #include "gin/wrappable.h" #include "third_party/WebKit/public/web/WebDocument.h" #include "third_party/WebKit/public/web/WebLocalFrame.h" +#include "third_party/WebKit/public/web/WebRemoteFrame.h" #include "third_party/WebKit/public/web/WebView.h" namespace extensions { @@ -235,8 +236,18 @@ void MimeHandlerViewContainer::PostMessage(v8::Isolate* isolate, v8::Context::Scope context_scope( render_frame()->GetWebFrame()->mainWorldScriptContext()); - v8::Local<v8::Object> guest_proxy_window = - guest_proxy_frame->mainWorldScriptContext()->Global(); + + // TODO(lazyboy,nasko): The WebLocalFrame branch is not used when running + // on top of out-of-process iframes. Remove it once the code is converted. + v8::Local<v8::Object> guest_proxy_window; + if (guest_proxy_frame->isWebLocalFrame()) { + guest_proxy_window = + guest_proxy_frame->mainWorldScriptContext()->Global(); + } else { + guest_proxy_window = guest_proxy_frame->toWebRemoteFrame() + ->deprecatedMainWorldScriptContext() + ->Global(); + } gin::Dictionary window_object(isolate, guest_proxy_window); v8::Local<v8::Function> post_message; if (!window_object.Get(std::string(kPostMessageName), &post_message)) @@ -247,7 +258,7 @@ void MimeHandlerViewContainer::PostMessage(v8::Isolate* isolate, // Post the message to any domain inside the browser plugin. The embedder // should already know what is embedded. gin::StringToV8(isolate, "*")}; - guest_proxy_frame->callFunctionEvenIfScriptDisabled( + render_frame()->GetWebFrame()->callFunctionEvenIfScriptDisabled( post_message.As<v8::Function>(), guest_proxy_window, arraysize(args), |