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

Side by Side Diff: components/guest_view/renderer/guest_view_request.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 unified diff | Download patch
« no previous file with comments | « no previous file | extensions/renderer/guest_view/guest_view_internal_custom_bindings.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/guest_view/renderer/guest_view_request.h" 5 #include "components/guest_view/renderer/guest_view_request.h"
6 6
7 #include "components/guest_view/common/guest_view_messages.h" 7 #include "components/guest_view/common/guest_view_messages.h"
8 #include "components/guest_view/renderer/guest_view_container.h" 8 #include "components/guest_view/renderer/guest_view_container.h"
9 #include "content/public/renderer/render_frame.h" 9 #include "content/public/renderer/render_frame.h"
10 #include "content/public/renderer/render_view.h" 10 #include "content/public/renderer/render_view.h"
11 #include "third_party/WebKit/public/web/WebLocalFrame.h" 11 #include "third_party/WebKit/public/web/WebLocalFrame.h"
12 #include "third_party/WebKit/public/web/WebRemoteFrame.h"
12 #include "third_party/WebKit/public/web/WebScopedMicrotaskSuppression.h" 13 #include "third_party/WebKit/public/web/WebScopedMicrotaskSuppression.h"
13 #include "third_party/WebKit/public/web/WebView.h" 14 #include "third_party/WebKit/public/web/WebView.h"
14 15
15 namespace guest_view { 16 namespace guest_view {
16 17
17 GuestViewRequest::GuestViewRequest(GuestViewContainer* container, 18 GuestViewRequest::GuestViewRequest(GuestViewContainer* container,
18 v8::Local<v8::Function> callback, 19 v8::Local<v8::Function> callback,
19 v8::Isolate* isolate) 20 v8::Isolate* isolate)
20 : container_(container), 21 : container_(container),
21 callback_(isolate, callback), 22 callback_(isolate, callback),
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 return; 82 return;
82 83
83 content::RenderView* guest_proxy_render_view = 84 content::RenderView* guest_proxy_render_view =
84 content::RenderView::FromRoutingID(base::get<1>(param)); 85 content::RenderView::FromRoutingID(base::get<1>(param));
85 // TODO(fsamuel): Should we be reporting an error to JavaScript or DCHECKing? 86 // TODO(fsamuel): Should we be reporting an error to JavaScript or DCHECKing?
86 if (!guest_proxy_render_view) 87 if (!guest_proxy_render_view)
87 return; 88 return;
88 89
89 v8::HandleScope handle_scope(isolate()); 90 v8::HandleScope handle_scope(isolate());
90 blink::WebFrame* frame = guest_proxy_render_view->GetWebView()->mainFrame(); 91 blink::WebFrame* frame = guest_proxy_render_view->GetWebView()->mainFrame();
91 v8::Local<v8::Value> window = frame->mainWorldScriptContext()->Global(); 92 // TODO(lazyboy,nasko): The WebLocalFrame branch is not used when running
93 // on top of out-of-process iframes. Remove it once the code is converted.
94 v8::Local<v8::Value> window;
95 if (frame->isWebLocalFrame()) {
96 window = frame->mainWorldScriptContext()->Global();
97 } else {
98 window =
99 frame->toWebRemoteFrame()->deprecatedMainWorldScriptContext()->Global();
100 }
92 101
93 const int argc = 1; 102 const int argc = 1;
94 scoped_ptr<v8::Local<v8::Value>[]> argv(new v8::Local<v8::Value>[argc]); 103 scoped_ptr<v8::Local<v8::Value>[]> argv(new v8::Local<v8::Value>[argc]);
95 argv[0] = window; 104 argv[0] = window;
96 105
97 // Call the AttachGuest API's callback with the guest proxy as the first 106 // Call the AttachGuest API's callback with the guest proxy as the first
98 // parameter. 107 // parameter.
99 ExecuteCallbackIfAvailable(argc, argv.Pass()); 108 ExecuteCallbackIfAvailable(argc, argv.Pass());
100 } 109 }
101 110
(...skipping 12 matching lines...) Expand all
114 return; 123 return;
115 124
116 container()->render_frame()->DetachGuest(container()->element_instance_id()); 125 container()->render_frame()->DetachGuest(container()->element_instance_id());
117 } 126 }
118 127
119 void GuestViewDetachRequest::HandleResponse(const IPC::Message& message) { 128 void GuestViewDetachRequest::HandleResponse(const IPC::Message& message) {
120 ExecuteCallbackIfAvailable(0 /* argc */, nullptr); 129 ExecuteCallbackIfAvailable(0 /* argc */, nullptr);
121 } 130 }
122 131
123 } // namespace guest_view 132 } // namespace guest_view
OLDNEW
« no previous file with comments | « no previous file | extensions/renderer/guest_view/guest_view_internal_custom_bindings.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698