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 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
340 if (!view) | 340 if (!view) |
341 return; | 341 return; |
342 | 342 |
343 blink::WebFrame* frame = view->GetWebView()->mainFrame(); | 343 blink::WebFrame* frame = view->GetWebView()->mainFrame(); |
344 // TODO(lazyboy,nasko): The WebLocalFrame branch is not used when running | 344 // TODO(lazyboy,nasko): The WebLocalFrame branch is not used when running |
345 // on top of out-of-process iframes. Remove it once the code is converted. | 345 // on top of out-of-process iframes. Remove it once the code is converted. |
346 v8::Local<v8::Value> window; | 346 v8::Local<v8::Value> window; |
347 if (frame->isWebLocalFrame()) { | 347 if (frame->isWebLocalFrame()) { |
348 window = frame->mainWorldScriptContext()->Global(); | 348 window = frame->mainWorldScriptContext()->Global(); |
349 } else { | 349 } else { |
350 window = | 350 window = frame->toWebRemoteFrame()->globalProxy(); |
351 frame->toWebRemoteFrame()->deprecatedMainWorldScriptContext()->Global(); | |
352 } | 351 } |
353 args.GetReturnValue().Set(window); | 352 args.GetReturnValue().Set(window); |
354 } | 353 } |
355 | 354 |
356 void GuestViewInternalCustomBindings::GetViewFromID( | 355 void GuestViewInternalCustomBindings::GetViewFromID( |
357 const v8::FunctionCallbackInfo<v8::Value>& args) { | 356 const v8::FunctionCallbackInfo<v8::Value>& args) { |
358 // Default to returning null. | 357 // Default to returning null. |
359 args.GetReturnValue().SetNull(); | 358 args.GetReturnValue().SetNull(); |
360 // There is one argument. | 359 // There is one argument. |
361 CHECK(args.Length() == 1); | 360 CHECK(args.Length() == 1); |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
458 // EnterFullscreen() and do it directly rather than having a generic "run with | 457 // EnterFullscreen() and do it directly rather than having a generic "run with |
459 // user gesture" function. | 458 // user gesture" function. |
460 blink::WebScopedUserGesture user_gesture(context()->web_frame()); | 459 blink::WebScopedUserGesture user_gesture(context()->web_frame()); |
461 CHECK_EQ(args.Length(), 1); | 460 CHECK_EQ(args.Length(), 1); |
462 CHECK(args[0]->IsFunction()); | 461 CHECK(args[0]->IsFunction()); |
463 context()->SafeCallFunction( | 462 context()->SafeCallFunction( |
464 v8::Local<v8::Function>::Cast(args[0]), 0, nullptr); | 463 v8::Local<v8::Function>::Cast(args[0]), 0, nullptr); |
465 } | 464 } |
466 | 465 |
467 } // namespace extensions | 466 } // namespace extensions |
OLD | NEW |