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

Unified Diff: extensions/renderer/guest_view/guest_view_internal_custom_bindings.cc

Issue 1337283003: Prepare GuestView for removing swapped out RenderFrame. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added TODO comments. 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 | « components/guest_view/renderer/guest_view_request.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/renderer/guest_view/guest_view_internal_custom_bindings.cc
diff --git a/extensions/renderer/guest_view/guest_view_internal_custom_bindings.cc b/extensions/renderer/guest_view/guest_view_internal_custom_bindings.cc
index 7eb129236551ca24185357a5af7054915f95d7a7..ee243bf6922e528e5461ab0762d662a64929378b 100644
--- a/extensions/renderer/guest_view/guest_view_internal_custom_bindings.cc
+++ b/extensions/renderer/guest_view/guest_view_internal_custom_bindings.cc
@@ -24,6 +24,7 @@
#include "extensions/renderer/script_context.h"
#include "third_party/WebKit/public/web/WebFrame.h"
#include "third_party/WebKit/public/web/WebLocalFrame.h"
+#include "third_party/WebKit/public/web/WebRemoteFrame.h"
#include "third_party/WebKit/public/web/WebScopedUserGesture.h"
#include "third_party/WebKit/public/web/WebView.h"
#include "v8/include/v8.h"
@@ -314,7 +315,15 @@ void GuestViewInternalCustomBindings::GetContentWindow(
return;
blink::WebFrame* frame = view->GetWebView()->mainFrame();
- v8::Local<v8::Value> window = 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::Value> window;
+ if (frame->isWebLocalFrame()) {
+ window = frame->mainWorldScriptContext()->Global();
+ } else {
+ window =
+ frame->toWebRemoteFrame()->deprecatedMainWorldScriptContext()->Global();
+ }
args.GetReturnValue().Set(window);
}
« no previous file with comments | « components/guest_view/renderer/guest_view_request.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698