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

Side by Side Diff: content/browser/browser_plugin/browser_plugin_guest.cc

Issue 334923002: Remove ContentBrowserClient::GuestWebContentsAttached (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@remove_adview
Patch Set: Hopefully fixed tests Created 6 years, 6 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/browser/browser_plugin/browser_plugin_guest.h" 5 #include "content/browser/browser_plugin/browser_plugin_guest.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 // Enable input method for guest if it's enabled for the embedder. 219 // Enable input method for guest if it's enabled for the embedder.
220 if (static_cast<RenderViewHostImpl*>( 220 if (static_cast<RenderViewHostImpl*>(
221 embedder_web_contents_->GetRenderViewHost())->input_method_active()) { 221 embedder_web_contents_->GetRenderViewHost())->input_method_active()) {
222 RenderViewHostImpl* guest_rvh = static_cast<RenderViewHostImpl*>( 222 RenderViewHostImpl* guest_rvh = static_cast<RenderViewHostImpl*>(
223 GetWebContents()->GetRenderViewHost()); 223 GetWebContents()->GetRenderViewHost());
224 guest_rvh->SetInputMethodActive(true); 224 guest_rvh->SetInputMethodActive(true);
225 } 225 }
226 226
227 // Inform the embedder of the guest's attachment. 227 // Inform the embedder of the guest's attachment.
228 SendMessageToEmbedder(new BrowserPluginMsg_Attach_ACK(instance_id_)); 228 SendMessageToEmbedder(new BrowserPluginMsg_Attach_ACK(instance_id_));
229
230 if (delegate_) {
231 delegate_->DidAttach(extra_params);
232 has_render_view_ = true;
233 }
234 } 229 }
235 230
236 BrowserPluginGuest::~BrowserPluginGuest() { 231 BrowserPluginGuest::~BrowserPluginGuest() {
237 } 232 }
238 233
239 // static 234 // static
240 BrowserPluginGuest* BrowserPluginGuest::Create( 235 BrowserPluginGuest* BrowserPluginGuest::Create(
241 int instance_id, 236 int instance_id,
242 SiteInstance* guest_site_instance, 237 SiteInstance* guest_site_instance,
243 WebContentsImpl* web_contents, 238 WebContentsImpl* web_contents,
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
480 return handled; 475 return handled;
481 } 476 }
482 477
483 void BrowserPluginGuest::Attach( 478 void BrowserPluginGuest::Attach(
484 WebContentsImpl* embedder_web_contents, 479 WebContentsImpl* embedder_web_contents,
485 const BrowserPluginHostMsg_Attach_Params& params, 480 const BrowserPluginHostMsg_Attach_Params& params,
486 const base::DictionaryValue& extra_params) { 481 const base::DictionaryValue& extra_params) {
487 if (attached()) 482 if (attached())
488 return; 483 return;
489 484
485 if (delegate_)
486 delegate_->WillAttach(embedder_web_contents, extra_params);
487
490 // If a RenderView has already been created for this new window, then we need 488 // If a RenderView has already been created for this new window, then we need
491 // to initialize the browser-side state now so that the RenderFrameHostManager 489 // to initialize the browser-side state now so that the RenderFrameHostManager
492 // does not create a new RenderView on navigation. 490 // does not create a new RenderView on navigation.
493 if (has_render_view_) { 491 if (has_render_view_) {
494 static_cast<RenderViewHostImpl*>( 492 static_cast<RenderViewHostImpl*>(
495 GetWebContents()->GetRenderViewHost())->Init(); 493 GetWebContents()->GetRenderViewHost())->Init();
496 WebContentsViewGuest* new_view = 494 WebContentsViewGuest* new_view =
497 static_cast<WebContentsViewGuest*>(GetWebContents()->GetView()); 495 static_cast<WebContentsViewGuest*>(GetWebContents()->GetView());
498 new_view->CreateViewForWidget(web_contents()->GetRenderViewHost()); 496 new_view->CreateViewForWidget(web_contents()->GetRenderViewHost());
499 } 497 }
500 498
501 Initialize(params, embedder_web_contents, extra_params); 499 Initialize(params, embedder_web_contents, extra_params);
502 500
503 SendQueuedMessages(); 501 SendQueuedMessages();
504 502
503 if (delegate_)
504 delegate_->DidAttach();
505
505 RecordAction(base::UserMetricsAction("BrowserPlugin.Guest.Attached")); 506 RecordAction(base::UserMetricsAction("BrowserPlugin.Guest.Attached"));
506 } 507 }
507 508
508 void BrowserPluginGuest::OnCompositorFrameSwappedACK( 509 void BrowserPluginGuest::OnCompositorFrameSwappedACK(
509 int instance_id, 510 int instance_id,
510 const FrameHostMsg_CompositorFrameSwappedACK_Params& params) { 511 const FrameHostMsg_CompositorFrameSwappedACK_Params& params) {
511 RenderWidgetHostImpl::SendSwapCompositorFrameAck(params.producing_route_id, 512 RenderWidgetHostImpl::SendSwapCompositorFrameAck(params.producing_route_id,
512 params.output_surface_id, 513 params.output_surface_id,
513 params.producing_host_id, 514 params.producing_host_id,
514 params.ack); 515 params.ack);
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
894 void BrowserPluginGuest::OnImeCompositionRangeChanged( 895 void BrowserPluginGuest::OnImeCompositionRangeChanged(
895 const gfx::Range& range, 896 const gfx::Range& range,
896 const std::vector<gfx::Rect>& character_bounds) { 897 const std::vector<gfx::Rect>& character_bounds) {
897 static_cast<RenderWidgetHostViewBase*>( 898 static_cast<RenderWidgetHostViewBase*>(
898 web_contents()->GetRenderWidgetHostView())->ImeCompositionRangeChanged( 899 web_contents()->GetRenderWidgetHostView())->ImeCompositionRangeChanged(
899 range, character_bounds); 900 range, character_bounds);
900 } 901 }
901 #endif 902 #endif
902 903
903 } // namespace content 904 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/browser_plugin/browser_plugin_guest.h ('k') | content/public/browser/browser_plugin_guest_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698