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

Side by Side Diff: extensions/renderer/guest_view/guest_view_internal_custom_bindings.cc

Issue 2427893003: Fix wrong cast in ExtensionsGuestViewContainer. (Closed)
Patch Set: update deps Created 4 years, 2 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
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/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 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 DCHECK(parent_frame); 242 DCHECK(parent_frame);
243 DCHECK(parent_frame->isWebLocalFrame()); 243 DCHECK(parent_frame->isWebLocalFrame());
244 244
245 content::RenderFrame* embedder_parent_frame = 245 content::RenderFrame* embedder_parent_frame =
246 content::RenderFrame::FromWebFrame(parent_frame); 246 content::RenderFrame::FromWebFrame(parent_frame);
247 247
248 // Create a GuestViewContainer if it does not exist. 248 // Create a GuestViewContainer if it does not exist.
249 // An element instance ID uniquely identifies an IframeGuestViewContainer 249 // An element instance ID uniquely identifies an IframeGuestViewContainer
250 // within a RenderView. 250 // within a RenderView.
251 auto* guest_view_container = 251 auto* guest_view_container =
252 static_cast<guest_view::IframeGuestViewContainer*>( 252 guest_view::GuestViewContainer::FromID(element_instance_id);
253 guest_view::GuestViewContainer::FromID(element_instance_id));
254 // This is the first time we hear about the |element_instance_id|. 253 // This is the first time we hear about the |element_instance_id|.
255 DCHECK(!guest_view_container); 254 DCHECK(!guest_view_container);
256 // The <webview> element's GC takes ownership of |guest_view_container|. 255 // The <webview> element's GC takes ownership of |guest_view_container|.
257 guest_view_container = 256 guest_view_container =
258 new guest_view::IframeGuestViewContainer(embedder_parent_frame); 257 new guest_view::IframeGuestViewContainer(embedder_parent_frame);
259 guest_view_container->SetElementInstanceID(element_instance_id); 258 guest_view_container->SetElementInstanceID(element_instance_id);
260 259
261 std::unique_ptr<guest_view::GuestViewRequest> request( 260 std::unique_ptr<guest_view::GuestViewRequest> request(
262 new guest_view::GuestViewAttachIframeRequest( 261 new guest_view::GuestViewAttachIframeRequest(
263 guest_view_container, render_frame->GetRoutingID(), guest_instance_id, 262 guest_view_container, render_frame->GetRoutingID(), guest_instance_id,
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 // There are two parameters. 374 // There are two parameters.
376 CHECK(args.Length() == 2); 375 CHECK(args.Length() == 2);
377 // Element Instance ID. 376 // Element Instance ID.
378 CHECK(args[0]->IsInt32()); 377 CHECK(args[0]->IsInt32());
379 // Callback function. 378 // Callback function.
380 CHECK(args[1]->IsFunction()); 379 CHECK(args[1]->IsFunction());
381 380
382 int element_instance_id = args[0]->Int32Value(); 381 int element_instance_id = args[0]->Int32Value();
383 // An element instance ID uniquely identifies a ExtensionsGuestViewContainer 382 // An element instance ID uniquely identifies a ExtensionsGuestViewContainer
384 // within a RenderView. 383 // within a RenderView.
385 auto* guest_view_container = static_cast<ExtensionsGuestViewContainer*>( 384 auto* guest_view_container =
386 guest_view::GuestViewContainer::FromID(element_instance_id)); 385 guest_view::GuestViewContainer::FromID(element_instance_id);
387 if (!guest_view_container) 386 if (!guest_view_container)
388 return; 387 return;
389 388
390 guest_view_container->RegisterElementResizeCallback( 389 guest_view_container->RegisterElementResizeCallback(
391 args[1].As<v8::Function>(), args.GetIsolate()); 390 args[1].As<v8::Function>(), args.GetIsolate());
392 391
393 args.GetReturnValue().Set(v8::Boolean::New(context()->isolate(), true)); 392 args.GetReturnValue().Set(v8::Boolean::New(context()->isolate(), true));
394 } 393 }
395 394
396 void GuestViewInternalCustomBindings::RegisterView( 395 void GuestViewInternalCustomBindings::RegisterView(
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
429 const v8::FunctionCallbackInfo<v8::Value>& args) { 428 const v8::FunctionCallbackInfo<v8::Value>& args) {
430 // Gesture is required to request fullscreen. 429 // Gesture is required to request fullscreen.
431 blink::WebScopedUserGesture user_gesture; 430 blink::WebScopedUserGesture user_gesture;
432 CHECK_EQ(args.Length(), 1); 431 CHECK_EQ(args.Length(), 1);
433 CHECK(args[0]->IsFunction()); 432 CHECK(args[0]->IsFunction());
434 v8::Local<v8::Value> no_args; 433 v8::Local<v8::Value> no_args;
435 context()->CallFunction(v8::Local<v8::Function>::Cast(args[0]), 0, &no_args); 434 context()->CallFunction(v8::Local<v8::Function>::Cast(args[0]), 0, &no_args);
436 } 435 }
437 436
438 } // namespace extensions 437 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698