OLD | NEW |
---|---|
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/guest_view_internal_custom_bindings.h" | 5 #include "extensions/renderer/guest_view/guest_view_internal_custom_bindings.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
335 | 335 |
336 int view_id = args[0]->Int32Value(); | 336 int view_id = args[0]->Int32Value(); |
337 if (view_id == MSG_ROUTING_NONE) | 337 if (view_id == MSG_ROUTING_NONE) |
338 return; | 338 return; |
339 | 339 |
340 content::RenderView* view = content::RenderView::FromRoutingID(view_id); | 340 content::RenderView* view = content::RenderView::FromRoutingID(view_id); |
341 if (!view) | 341 if (!view) |
342 return; | 342 return; |
343 | 343 |
344 blink::WebFrame* frame = view->GetWebView()->MainFrame(); | 344 blink::WebFrame* frame = view->GetWebView()->MainFrame(); |
345 // TODO(lazyboy,nasko): The WebLocalFrame branch is not used when running | 345 v8::Local<v8::Value> window = frame->GlobalProxy(); |
346 // on top of out-of-process iframes. Remove it once the code is converted. | |
Devlin
2017/06/09 18:56:40
Is isolate extensions sufficient for this, or does
| |
347 v8::Local<v8::Value> window; | |
348 if (frame->IsWebLocalFrame()) { | |
349 window = frame->MainWorldScriptContext()->Global(); | |
350 } else { | |
351 window = frame->ToWebRemoteFrame()->GlobalProxy(); | |
352 } | |
353 args.GetReturnValue().Set(window); | 346 args.GetReturnValue().Set(window); |
354 } | 347 } |
355 | 348 |
356 void GuestViewInternalCustomBindings::GetViewFromID( | 349 void GuestViewInternalCustomBindings::GetViewFromID( |
357 const v8::FunctionCallbackInfo<v8::Value>& args) { | 350 const v8::FunctionCallbackInfo<v8::Value>& args) { |
358 // Default to returning null. | 351 // Default to returning null. |
359 args.GetReturnValue().SetNull(); | 352 args.GetReturnValue().SetNull(); |
360 // There is one argument. | 353 // There is one argument. |
361 CHECK(args.Length() == 1); | 354 CHECK(args.Length() == 1); |
362 // The view ID. | 355 // The view ID. |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
458 // EnterFullscreen() and do it directly rather than having a generic "run with | 451 // EnterFullscreen() and do it directly rather than having a generic "run with |
459 // user gesture" function. | 452 // user gesture" function. |
460 blink::WebScopedUserGesture user_gesture(context()->web_frame()); | 453 blink::WebScopedUserGesture user_gesture(context()->web_frame()); |
461 CHECK_EQ(args.Length(), 1); | 454 CHECK_EQ(args.Length(), 1); |
462 CHECK(args[0]->IsFunction()); | 455 CHECK(args[0]->IsFunction()); |
463 context()->SafeCallFunction( | 456 context()->SafeCallFunction( |
464 v8::Local<v8::Function>::Cast(args[0]), 0, nullptr); | 457 v8::Local<v8::Function>::Cast(args[0]), 0, nullptr); |
465 } | 458 } |
466 | 459 |
467 } // namespace extensions | 460 } // namespace extensions |
OLD | NEW |