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 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 // TODO(lazyboy,nasko): The WebLocalFrame branch is not used when running |
346 // on top of out-of-process iframes. Remove it once the code is converted. | 346 // on top of out-of-process iframes. Remove it once the code is converted. |
347 v8::Local<v8::Value> window; | 347 v8::Local<v8::Value> window; |
348 if (frame->IsWebLocalFrame()) { | 348 if (frame->IsWebLocalFrame()) { |
349 window = frame->MainWorldScriptContext()->Global(); | 349 window = frame->ToWebLocalFrame()->MainWorldScriptContext()->Global(); |
dcheng
2017/06/06 19:57:17
Perhaps we should provide a WebFrame getter to get
Łukasz Anforowicz
2017/06/07 20:35:07
Yes - thank you for noticing this cleanup opportun
| |
350 } else { | 350 } else { |
351 window = frame->ToWebRemoteFrame()->GlobalProxy(); | 351 window = frame->ToWebRemoteFrame()->GlobalProxy(); |
352 } | 352 } |
353 args.GetReturnValue().Set(window); | 353 args.GetReturnValue().Set(window); |
354 } | 354 } |
355 | 355 |
356 void GuestViewInternalCustomBindings::GetViewFromID( | 356 void GuestViewInternalCustomBindings::GetViewFromID( |
357 const v8::FunctionCallbackInfo<v8::Value>& args) { | 357 const v8::FunctionCallbackInfo<v8::Value>& args) { |
358 // Default to returning null. | 358 // Default to returning null. |
359 args.GetReturnValue().SetNull(); | 359 args.GetReturnValue().SetNull(); |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
458 // EnterFullscreen() and do it directly rather than having a generic "run with | 458 // EnterFullscreen() and do it directly rather than having a generic "run with |
459 // user gesture" function. | 459 // user gesture" function. |
460 blink::WebScopedUserGesture user_gesture(context()->web_frame()); | 460 blink::WebScopedUserGesture user_gesture(context()->web_frame()); |
461 CHECK_EQ(args.Length(), 1); | 461 CHECK_EQ(args.Length(), 1); |
462 CHECK(args[0]->IsFunction()); | 462 CHECK(args[0]->IsFunction()); |
463 context()->SafeCallFunction( | 463 context()->SafeCallFunction( |
464 v8::Local<v8::Function>::Cast(args[0]), 0, nullptr); | 464 v8::Local<v8::Function>::Cast(args[0]), 0, nullptr); |
465 } | 465 } |
466 | 466 |
467 } // namespace extensions | 467 } // namespace extensions |
OLD | NEW |