web_contents_view_guest.cc revision eb525c5499e34cc9c4b825d6d9e75bb07cc06ace
12a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// Copyright (c) 2012 The Chromium Authors. All rights reserved. 22a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be 32a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// found in the LICENSE file. 42a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 52a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "content/browser/web_contents/web_contents_view_guest.h" 62a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 72a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "build/build_config.h" 8c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)#include "content/browser/browser_plugin/browser_plugin_embedder.h" 92a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "content/browser/browser_plugin/browser_plugin_guest.h" 102a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "content/browser/renderer_host/render_view_host_factory.h" 112a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "content/browser/renderer_host/render_view_host_impl.h" 122a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "content/browser/renderer_host/render_widget_host_view_guest.h" 132a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "content/browser/web_contents/interstitial_page_impl.h" 142a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "content/browser/web_contents/web_contents_impl.h" 15c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)#include "content/common/drag_messages.h" 162a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "content/public/browser/web_contents_delegate.h" 177d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)#include "content/public/common/context_menu_params.h" 18eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch#include "content/public/common/drop_data.h" 192a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "ui/gfx/image/image_skia.h" 202a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "ui/gfx/point.h" 212a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "ui/gfx/rect.h" 222a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "ui/gfx/size.h" 232a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 242a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)using WebKit::WebDragOperation; 252a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)using WebKit::WebDragOperationsMask; 262a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 272a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)namespace content { 282a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 292a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)WebContentsViewGuest::WebContentsViewGuest( 302a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) WebContentsImpl* web_contents, 312a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) BrowserPluginGuest* guest, 327d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) WebContentsViewPort* platform_view, 337d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) RenderViewHostDelegateView* platform_view_delegate_view) 342a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) : web_contents_(web_contents), 352a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) guest_(guest), 367d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) platform_view_(platform_view), 377d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) platform_view_delegate_view_(platform_view_delegate_view) { 382a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)} 392a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 402a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)WebContentsViewGuest::~WebContentsViewGuest() { 412a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)} 422a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 432a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)gfx::NativeView WebContentsViewGuest::GetNativeView() const { 44c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) return platform_view_->GetNativeView(); 452a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)} 462a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 472a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)gfx::NativeView WebContentsViewGuest::GetContentNativeView() const { 482a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) RenderWidgetHostView* rwhv = web_contents_->GetRenderWidgetHostView(); 492a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) if (!rwhv) 502a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) return NULL; 512a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) return rwhv->GetNativeView(); 522a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)} 532a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 542a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)gfx::NativeWindow WebContentsViewGuest::GetTopLevelNativeWindow() const { 552a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) return guest_->embedder_web_contents()->GetView()->GetTopLevelNativeWindow(); 562a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)} 572a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 582a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)void WebContentsViewGuest::GetContainerBounds(gfx::Rect* out) const { 597d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) // We need embedder container's bounds to calculate our bounds. 607d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) guest_->embedder_web_contents()->GetView()->GetContainerBounds(out); 617d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) gfx::Point guest_coordinates = guest_->GetScreenCoordinates(gfx::Point()); 627d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) out->Offset(guest_coordinates.x(), guest_coordinates.y()); 637d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) out->set_size(size_); 642a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)} 652a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 662a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)void WebContentsViewGuest::SizeContents(const gfx::Size& size) { 67c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) size_ = size; 68c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) RenderWidgetHostView* rwhv = web_contents_->GetRenderWidgetHostView(); 69c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) if (rwhv) 70c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) rwhv->SetSize(size); 712a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)} 722a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 732a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)void WebContentsViewGuest::SetInitialFocus() { 742a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) platform_view_->SetInitialFocus(); 752a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)} 762a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 772a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)gfx::Rect WebContentsViewGuest::GetViewBounds() const { 78c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) return gfx::Rect(size_); 792a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)} 802a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 812a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#if defined(OS_MACOSX) 822a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)void WebContentsViewGuest::SetAllowOverlappingViews(bool overlapping) { 832a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) platform_view_->SetAllowOverlappingViews(overlapping); 842a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)} 857d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) 867d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)bool WebContentsViewGuest::GetAllowOverlappingViews() const { 877d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) return platform_view_->GetAllowOverlappingViews(); 887d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)} 892a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#endif 902a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 912a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)void WebContentsViewGuest::CreateView(const gfx::Size& initial_size, 922a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) gfx::NativeView context) { 932a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) platform_view_->CreateView(initial_size, context); 94c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) size_ = initial_size; 952a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)} 962a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 972a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)RenderWidgetHostView* WebContentsViewGuest::CreateViewForWidget( 982a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) RenderWidgetHost* render_widget_host) { 992a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) if (render_widget_host->GetView()) { 1002a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // During testing, the view will already be set up in most cases to the 1012a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // test view, so we don't want to clobber it with a real one. To verify that 1022a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // this actually is happening (and somebody isn't accidentally creating the 1032a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // view twice), we check for the RVH Factory, which will be set when we're 1042a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // making special ones (which go along with the special views). 1052a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) DCHECK(RenderViewHostFactory::has_factory()); 1062a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) return render_widget_host->GetView(); 1072a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) } 1082a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 1092a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) RenderWidgetHostView* platform_widget = NULL; 1102a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) platform_widget = platform_view_->CreateViewForWidget(render_widget_host); 1112a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 1122a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) RenderWidgetHostView* view = new RenderWidgetHostViewGuest( 1132a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) render_widget_host, 1142a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) guest_, 1152a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) platform_widget); 1162a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 1172a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) return view; 1182a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)} 1192a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 1202a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)RenderWidgetHostView* WebContentsViewGuest::CreateViewForPopupWidget( 1212a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) RenderWidgetHost* render_widget_host) { 1222a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) return RenderWidgetHostViewPort::CreateViewForWidget(render_widget_host); 1232a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)} 1242a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 1252a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)void WebContentsViewGuest::SetPageTitle(const string16& title) { 1262a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)} 1272a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 1282a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)void WebContentsViewGuest::RenderViewCreated(RenderViewHost* host) { 1292a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) platform_view_->RenderViewCreated(host); 1302a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)} 1312a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 1322a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)void WebContentsViewGuest::RenderViewSwappedIn(RenderViewHost* host) { 1332a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) platform_view_->RenderViewSwappedIn(host); 1342a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)} 1352a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 1362a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)void WebContentsViewGuest::SetOverscrollControllerEnabled(bool enabled) { 1372a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // This should never override the setting of the embedder view. 1382a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)} 1392a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 1402a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#if defined(OS_MACOSX) 1412a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)bool WebContentsViewGuest::IsEventTracking() const { 1422a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) return false; 1432a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)} 1442a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 1452a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)void WebContentsViewGuest::CloseTabAfterEventTracking() { 1462a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)} 1472a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#endif 1482a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 1492a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)WebContents* WebContentsViewGuest::web_contents() { 1502a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) return web_contents_; 1512a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)} 1522a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 1532a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)void WebContentsViewGuest::RestoreFocus() { 1542a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) platform_view_->RestoreFocus(); 1552a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)} 1562a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 1572a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)void WebContentsViewGuest::OnTabCrashed(base::TerminationStatus status, 1582a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) int error_code) { 1592a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)} 1602a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 1612a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)void WebContentsViewGuest::Focus() { 1622a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) platform_view_->Focus(); 1632a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)} 1642a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 1652a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)void WebContentsViewGuest::StoreFocus() { 1662a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) platform_view_->StoreFocus(); 1672a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)} 1682a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 169eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen MurdochDropData* WebContentsViewGuest::GetDropData() const { 1702a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) NOTIMPLEMENTED(); 1712a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) return NULL; 1722a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)} 1732a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 1742a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)void WebContentsViewGuest::UpdateDragCursor(WebDragOperation operation) { 175c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) RenderViewHostImpl* embedder_render_view_host = 176c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) static_cast<RenderViewHostImpl*>( 177c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) guest_->embedder_web_contents()->GetRenderViewHost()); 178c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) CHECK(embedder_render_view_host); 179c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) RenderViewHostDelegateView* view = 180c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) embedder_render_view_host->GetDelegate()->GetDelegateView(); 181c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) if (view) 182c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) view->UpdateDragCursor(operation); 1832a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)} 1842a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 1852a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)void WebContentsViewGuest::GotFocus() { 1862a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)} 1872a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 1882a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)void WebContentsViewGuest::TakeFocus(bool reverse) { 1892a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)} 1902a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 1917d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)void WebContentsViewGuest::ShowContextMenu(const ContextMenuParams& params) { 1927d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) platform_view_delegate_view_->ShowContextMenu(params); 1932a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)} 1942a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 1952a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)void WebContentsViewGuest::ShowPopupMenu(const gfx::Rect& bounds, 1962a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) int item_height, 1972a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) double item_font_size, 1982a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) int selected_item, 1992a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) const std::vector<WebMenuItem>& items, 2002a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) bool right_aligned, 2012a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) bool allow_multiple_selection) { 2022a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // External popup menus are only used on Mac and Android. 2032a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) NOTIMPLEMENTED(); 2042a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)} 2052a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 2062a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)void WebContentsViewGuest::StartDragging( 207eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch const DropData& drop_data, 2082a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) WebDragOperationsMask ops, 2092a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) const gfx::ImageSkia& image, 2102a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) const gfx::Vector2d& image_offset, 2112a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) const DragEventSourceInfo& event_info) { 212c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) WebContentsImpl* embedder_web_contents = guest_->embedder_web_contents(); 213c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) embedder_web_contents->GetBrowserPluginEmbedder()->StartDrag(guest_); 214c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) RenderViewHostImpl* embedder_render_view_host = 215c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) static_cast<RenderViewHostImpl*>( 216c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) embedder_web_contents->GetRenderViewHost()); 217c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) CHECK(embedder_render_view_host); 218c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) RenderViewHostDelegateView* view = 219c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) embedder_render_view_host->GetDelegate()->GetDelegateView(); 220c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) if (view) 221c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) view->StartDragging(drop_data, ops, image, image_offset, event_info); 222c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) else 223c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) embedder_web_contents->SystemDragEnded(); 2242a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)} 2252a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 2262a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)} // namespace content 227