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

Side by Side Diff: extensions/renderer/guest_view/mime_handler_view/mime_handler_view_container.cc

Issue 861073004: Use the main world script context for mime handler postMessage. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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 | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "extensions/renderer/guest_view/mime_handler_view/mime_handler_view_con tainer.h" 5 #include "extensions/renderer/guest_view/mime_handler_view/mime_handler_view_con tainer.h"
6 6
7 #include <map> 7 #include <map>
8 #include <set> 8 #include <set>
9 9
10 #include "content/public/renderer/render_frame.h" 10 #include "content/public/renderer/render_frame.h"
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 196
197 content::RenderView* guest_proxy_render_view = 197 content::RenderView* guest_proxy_render_view =
198 content::RenderView::FromRoutingID(guest_proxy_routing_id_); 198 content::RenderView::FromRoutingID(guest_proxy_routing_id_);
199 if (!guest_proxy_render_view) 199 if (!guest_proxy_render_view)
200 return; 200 return;
201 blink::WebFrame* guest_proxy_frame = 201 blink::WebFrame* guest_proxy_frame =
202 guest_proxy_render_view->GetWebView()->mainFrame(); 202 guest_proxy_render_view->GetWebView()->mainFrame();
203 if (!guest_proxy_frame) 203 if (!guest_proxy_frame)
204 return; 204 return;
205 205
206 v8::Context::Scope context_scope(
207 render_frame()->GetWebFrame()->mainWorldScriptContext());
206 v8::Local<v8::Object> guest_proxy_window = 208 v8::Local<v8::Object> guest_proxy_window =
207 guest_proxy_frame->mainWorldScriptContext()->Global(); 209 guest_proxy_frame->mainWorldScriptContext()->Global();
208 gin::Dictionary window_object(isolate, guest_proxy_window); 210 gin::Dictionary window_object(isolate, guest_proxy_window);
209 v8::Handle<v8::Function> post_message; 211 v8::Handle<v8::Function> post_message;
210 if (!window_object.Get(std::string(kPostMessageName), &post_message)) 212 if (!window_object.Get(std::string(kPostMessageName), &post_message))
211 return; 213 return;
212 214
213 v8::Handle<v8::Value> args[] = { 215 v8::Handle<v8::Value> args[] = {
214 message, 216 message,
215 // Post the message to any domain inside the browser plugin. The embedder 217 // Post the message to any domain inside the browser plugin. The embedder
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 289
288 if (!render_frame()) 290 if (!render_frame())
289 return; 291 return;
290 292
291 render_frame()->Send(new ExtensionHostMsg_CreateMimeHandlerViewGuest( 293 render_frame()->Send(new ExtensionHostMsg_CreateMimeHandlerViewGuest(
292 render_frame()->GetRoutingID(), view_id_, element_instance_id(), 294 render_frame()->GetRoutingID(), view_id_, element_instance_id(),
293 element_size_)); 295 element_size_));
294 } 296 }
295 297
296 } // namespace extensions 298 } // namespace extensions
OLDNEW
« 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