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 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 if (!view) | 313 if (!view) |
314 return; | 314 return; |
315 | 315 |
316 blink::WebFrame* frame = view->GetWebView()->mainFrame(); | 316 blink::WebFrame* frame = view->GetWebView()->mainFrame(); |
317 // TODO(lazyboy,nasko): The WebLocalFrame branch is not used when running | 317 // TODO(lazyboy,nasko): The WebLocalFrame branch is not used when running |
318 // on top of out-of-process iframes. Remove it once the code is converted. | 318 // on top of out-of-process iframes. Remove it once the code is converted. |
319 v8::Local<v8::Value> window; | 319 v8::Local<v8::Value> window; |
320 if (frame->isWebLocalFrame()) { | 320 if (frame->isWebLocalFrame()) { |
321 window = frame->mainWorldScriptContext()->Global(); | 321 window = frame->mainWorldScriptContext()->Global(); |
322 } else { | 322 } else { |
323 window = | 323 window = frame->toWebRemoteFrame()->globalProxy(); |
324 frame->toWebRemoteFrame()->deprecatedMainWorldScriptContext()->Global(); | |
325 } | 324 } |
326 args.GetReturnValue().Set(window); | 325 args.GetReturnValue().Set(window); |
327 } | 326 } |
328 | 327 |
329 void GuestViewInternalCustomBindings::GetViewFromID( | 328 void GuestViewInternalCustomBindings::GetViewFromID( |
330 const v8::FunctionCallbackInfo<v8::Value>& args) { | 329 const v8::FunctionCallbackInfo<v8::Value>& args) { |
331 // Default to returning null. | 330 // Default to returning null. |
332 args.GetReturnValue().SetNull(); | 331 args.GetReturnValue().SetNull(); |
333 // There is one argument. | 332 // There is one argument. |
334 CHECK(args.Length() == 1); | 333 CHECK(args.Length() == 1); |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
431 // EnterFullscreen() and do it directly rather than having a generic "run with | 430 // EnterFullscreen() and do it directly rather than having a generic "run with |
432 // user gesture" function. | 431 // user gesture" function. |
433 blink::WebScopedUserGesture user_gesture(context()->web_frame()); | 432 blink::WebScopedUserGesture user_gesture(context()->web_frame()); |
434 CHECK_EQ(args.Length(), 1); | 433 CHECK_EQ(args.Length(), 1); |
435 CHECK(args[0]->IsFunction()); | 434 CHECK(args[0]->IsFunction()); |
436 context()->SafeCallFunction( | 435 context()->SafeCallFunction( |
437 v8::Local<v8::Function>::Cast(args[0]), 0, nullptr); | 436 v8::Local<v8::Function>::Cast(args[0]), 0, nullptr); |
438 } | 437 } |
439 | 438 |
440 } // namespace extensions | 439 } // namespace extensions |
OLD | NEW |