Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(71)

Unified Diff: extensions/renderer/guest_view/mime_handler_view/mime_handler_view_container.cc

Issue 1335023004: Prepare MimeHanderViewContainer for removing swapped out RenderFrame. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add a TODO. Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/renderer/guest_view/mime_handler_view/mime_handler_view_container.cc
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 e3512823efa7592462c504a7f775375966b1bd41..7d34c7593fd543e3aac9af7f4ea2c21f9c1fdb9f 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),
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698