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

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

Issue 2427893003: Fix wrong cast in ExtensionsGuestViewContainer. (Closed)
Patch Set: 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
« no previous file with comments | « extensions/renderer/guest_view/extensions_guest_view_container.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 static_cast<guest_view::IframeGuestViewContainer*>(
253 guest_view::GuestViewContainer::FromID(element_instance_id)); 253 guest_view::GuestViewContainer::FromID(element_instance_id));
meacer 2016/10/18 19:41:53 Can you also remove this cast? It's not really nec
lfg 2016/10/19 19:18:40 Done.
254 // This is the first time we hear about the |element_instance_id|. 254 // This is the first time we hear about the |element_instance_id|.
255 DCHECK(!guest_view_container); 255 DCHECK(!guest_view_container);
256 // The <webview> element's GC takes ownership of |guest_view_container|. 256 // The <webview> element's GC takes ownership of |guest_view_container|.
257 guest_view_container = 257 guest_view_container =
258 new guest_view::IframeGuestViewContainer(embedder_parent_frame); 258 new guest_view::IframeGuestViewContainer(embedder_parent_frame);
259 guest_view_container->SetElementInstanceID(element_instance_id); 259 guest_view_container->SetElementInstanceID(element_instance_id);
260 260
261 std::unique_ptr<guest_view::GuestViewRequest> request( 261 std::unique_ptr<guest_view::GuestViewRequest> request(
262 new guest_view::GuestViewAttachIframeRequest( 262 new guest_view::GuestViewAttachIframeRequest(
263 guest_view_container, render_frame->GetRoutingID(), guest_instance_id, 263 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. 375 // There are two parameters.
376 CHECK(args.Length() == 2); 376 CHECK(args.Length() == 2);
377 // Element Instance ID. 377 // Element Instance ID.
378 CHECK(args[0]->IsInt32()); 378 CHECK(args[0]->IsInt32());
379 // Callback function. 379 // Callback function.
380 CHECK(args[1]->IsFunction()); 380 CHECK(args[1]->IsFunction());
381 381
382 int element_instance_id = args[0]->Int32Value(); 382 int element_instance_id = args[0]->Int32Value();
383 // An element instance ID uniquely identifies a ExtensionsGuestViewContainer 383 // An element instance ID uniquely identifies a ExtensionsGuestViewContainer
384 // within a RenderView. 384 // within a RenderView.
385 auto* guest_view_container = static_cast<ExtensionsGuestViewContainer*>( 385 auto* guest_view_container =
386 guest_view::GuestViewContainer::FromID(element_instance_id)); 386 guest_view::GuestViewContainer::FromID(element_instance_id);
387 if (!guest_view_container) 387 if (!guest_view_container)
388 return; 388 return;
389 389
390 guest_view_container->RegisterElementResizeCallback( 390 guest_view_container->RegisterElementResizeCallback(
391 args[1].As<v8::Function>(), args.GetIsolate()); 391 args[1].As<v8::Function>(), args.GetIsolate());
392 392
393 args.GetReturnValue().Set(v8::Boolean::New(context()->isolate(), true)); 393 args.GetReturnValue().Set(v8::Boolean::New(context()->isolate(), true));
394 } 394 }
395 395
396 void GuestViewInternalCustomBindings::RegisterView( 396 void GuestViewInternalCustomBindings::RegisterView(
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
429 const v8::FunctionCallbackInfo<v8::Value>& args) { 429 const v8::FunctionCallbackInfo<v8::Value>& args) {
430 // Gesture is required to request fullscreen. 430 // Gesture is required to request fullscreen.
431 blink::WebScopedUserGesture user_gesture; 431 blink::WebScopedUserGesture user_gesture;
432 CHECK_EQ(args.Length(), 1); 432 CHECK_EQ(args.Length(), 1);
433 CHECK(args[0]->IsFunction()); 433 CHECK(args[0]->IsFunction());
434 v8::Local<v8::Value> no_args; 434 v8::Local<v8::Value> no_args;
435 context()->CallFunction(v8::Local<v8::Function>::Cast(args[0]), 0, &no_args); 435 context()->CallFunction(v8::Local<v8::Function>::Cast(args[0]), 0, &no_args);
436 } 436 }
437 437
438 } // namespace extensions 438 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/renderer/guest_view/extensions_guest_view_container.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698