web_contents_view_guest.cc revision 7d4cd473f85ac64c3747c96c277f9e506a0d2246
164aef3a54999496fd1de4f5aa5b019e4c03b3836Behdad Esfahbod// Copyright (c) 2012 The Chromium Authors. All rights reserved.
22409d5f8d7dd8b535ce5ea29e933f7db27d33793Behdad Esfahbod// Use of this source code is governed by a BSD-style license that can be
3cad3821f3d5b68d490b0728bd37bd57428ec809cBehdad Esfahbod// found in the LICENSE file.
464aef3a54999496fd1de4f5aa5b019e4c03b3836Behdad Esfahbod
5c755cb3e3ac55156d0d2ec05adea7a650b97cc41Behdad Esfahbod#include "content/browser/web_contents/web_contents_view_guest.h"
664aef3a54999496fd1de4f5aa5b019e4c03b3836Behdad Esfahbod
764aef3a54999496fd1de4f5aa5b019e4c03b3836Behdad Esfahbod#include "build/build_config.h"
864aef3a54999496fd1de4f5aa5b019e4c03b3836Behdad Esfahbod#include "content/browser/browser_plugin/browser_plugin_embedder.h"
964aef3a54999496fd1de4f5aa5b019e4c03b3836Behdad Esfahbod#include "content/browser/browser_plugin/browser_plugin_guest.h"
1064aef3a54999496fd1de4f5aa5b019e4c03b3836Behdad Esfahbod#include "content/browser/renderer_host/render_view_host_factory.h"
1164aef3a54999496fd1de4f5aa5b019e4c03b3836Behdad Esfahbod#include "content/browser/renderer_host/render_view_host_impl.h"
1264aef3a54999496fd1de4f5aa5b019e4c03b3836Behdad Esfahbod#include "content/browser/renderer_host/render_widget_host_view_guest.h"
1364aef3a54999496fd1de4f5aa5b019e4c03b3836Behdad Esfahbod#include "content/browser/web_contents/interstitial_page_impl.h"
1464aef3a54999496fd1de4f5aa5b019e4c03b3836Behdad Esfahbod#include "content/browser/web_contents/web_contents_impl.h"
1564aef3a54999496fd1de4f5aa5b019e4c03b3836Behdad Esfahbod#include "content/common/drag_messages.h"
1664aef3a54999496fd1de4f5aa5b019e4c03b3836Behdad Esfahbod#include "content/public/browser/web_contents_delegate.h"
1764aef3a54999496fd1de4f5aa5b019e4c03b3836Behdad Esfahbod#include "content/public/common/context_menu_params.h"
1864aef3a54999496fd1de4f5aa5b019e4c03b3836Behdad Esfahbod#include "ui/gfx/image/image_skia.h"
1964aef3a54999496fd1de4f5aa5b019e4c03b3836Behdad Esfahbod#include "ui/gfx/point.h"
2064aef3a54999496fd1de4f5aa5b019e4c03b3836Behdad Esfahbod#include "ui/gfx/rect.h"
2164aef3a54999496fd1de4f5aa5b019e4c03b3836Behdad Esfahbod#include "ui/gfx/size.h"
2264aef3a54999496fd1de4f5aa5b019e4c03b3836Behdad Esfahbod#include "webkit/common/webdropdata.h"
2364aef3a54999496fd1de4f5aa5b019e4c03b3836Behdad Esfahbod
2464aef3a54999496fd1de4f5aa5b019e4c03b3836Behdad Esfahbodusing WebKit::WebDragOperation;
2564aef3a54999496fd1de4f5aa5b019e4c03b3836Behdad Esfahbodusing WebKit::WebDragOperationsMask;
262409d5f8d7dd8b535ce5ea29e933f7db27d33793Behdad Esfahbod
2764aef3a54999496fd1de4f5aa5b019e4c03b3836Behdad Esfahbodnamespace content {
2864aef3a54999496fd1de4f5aa5b019e4c03b3836Behdad Esfahbod
29d1c9eb458c843215da8df84b596bfae51fee135bBehdad EsfahbodWebContentsViewGuest::WebContentsViewGuest(
30d1c9eb458c843215da8df84b596bfae51fee135bBehdad Esfahbod    WebContentsImpl* web_contents,
31d1c9eb458c843215da8df84b596bfae51fee135bBehdad Esfahbod    BrowserPluginGuest* guest,
32d1c9eb458c843215da8df84b596bfae51fee135bBehdad Esfahbod    WebContentsViewPort* platform_view,
338dd1c8b8d6797d899d0f5b0a8015886bf6520ca2Behdad Esfahbod    RenderViewHostDelegateView* platform_view_delegate_view)
348dd1c8b8d6797d899d0f5b0a8015886bf6520ca2Behdad Esfahbod    : web_contents_(web_contents),
358dd1c8b8d6797d899d0f5b0a8015886bf6520ca2Behdad Esfahbod      guest_(guest),
365c5bc96216c9ad58243eb3ed27b253e237f08ebeBehdad Esfahbod      platform_view_(platform_view),
37acdba3f90b232fc12fcb200dca2584481b339118Behdad Esfahbod      platform_view_delegate_view_(platform_view_delegate_view) {
38acdba3f90b232fc12fcb200dca2584481b339118Behdad Esfahbod}
39acdba3f90b232fc12fcb200dca2584481b339118Behdad Esfahbod
40acdba3f90b232fc12fcb200dca2584481b339118Behdad EsfahbodWebContentsViewGuest::~WebContentsViewGuest() {
41acdba3f90b232fc12fcb200dca2584481b339118Behdad Esfahbod}
42acdba3f90b232fc12fcb200dca2584481b339118Behdad Esfahbod
43acdba3f90b232fc12fcb200dca2584481b339118Behdad Esfahbodgfx::NativeView WebContentsViewGuest::GetNativeView() const {
445c5bc96216c9ad58243eb3ed27b253e237f08ebeBehdad Esfahbod  return platform_view_->GetNativeView();
45acdba3f90b232fc12fcb200dca2584481b339118Behdad Esfahbod}
46902ab866f2d2edc3a71c1203065e6ddf49e5b431Behdad Esfahbod
47acdba3f90b232fc12fcb200dca2584481b339118Behdad Esfahbodgfx::NativeView WebContentsViewGuest::GetContentNativeView() const {
48902ab866f2d2edc3a71c1203065e6ddf49e5b431Behdad Esfahbod  RenderWidgetHostView* rwhv = web_contents_->GetRenderWidgetHostView();
49902ab866f2d2edc3a71c1203065e6ddf49e5b431Behdad Esfahbod  if (!rwhv)
50902ab866f2d2edc3a71c1203065e6ddf49e5b431Behdad Esfahbod    return NULL;
51902ab866f2d2edc3a71c1203065e6ddf49e5b431Behdad Esfahbod  return rwhv->GetNativeView();
52902ab866f2d2edc3a71c1203065e6ddf49e5b431Behdad Esfahbod}
53902ab866f2d2edc3a71c1203065e6ddf49e5b431Behdad Esfahbod
54902ab866f2d2edc3a71c1203065e6ddf49e5b431Behdad Esfahbodgfx::NativeWindow WebContentsViewGuest::GetTopLevelNativeWindow() const {
55902ab866f2d2edc3a71c1203065e6ddf49e5b431Behdad Esfahbod  return guest_->embedder_web_contents()->GetView()->GetTopLevelNativeWindow();
56902ab866f2d2edc3a71c1203065e6ddf49e5b431Behdad Esfahbod}
57902ab866f2d2edc3a71c1203065e6ddf49e5b431Behdad Esfahbod
58902ab866f2d2edc3a71c1203065e6ddf49e5b431Behdad Esfahbodvoid WebContentsViewGuest::GetContainerBounds(gfx::Rect* out) const {
59902ab866f2d2edc3a71c1203065e6ddf49e5b431Behdad Esfahbod  // We need embedder container's bounds to calculate our bounds.
60902ab866f2d2edc3a71c1203065e6ddf49e5b431Behdad Esfahbod  guest_->embedder_web_contents()->GetView()->GetContainerBounds(out);
61902ab866f2d2edc3a71c1203065e6ddf49e5b431Behdad Esfahbod  gfx::Point guest_coordinates = guest_->GetScreenCoordinates(gfx::Point());
62902ab866f2d2edc3a71c1203065e6ddf49e5b431Behdad Esfahbod  out->Offset(guest_coordinates.x(), guest_coordinates.y());
63902ab866f2d2edc3a71c1203065e6ddf49e5b431Behdad Esfahbod  out->set_size(size_);
64cc4c096a7e08ae96b3030fe27f871ce5b797f370Behdad Esfahbod}
65902ab866f2d2edc3a71c1203065e6ddf49e5b431Behdad Esfahbod
66cc4c096a7e08ae96b3030fe27f871ce5b797f370Behdad Esfahbodvoid WebContentsViewGuest::SizeContents(const gfx::Size& size) {
678dd1c8b8d6797d899d0f5b0a8015886bf6520ca2Behdad Esfahbod  size_ = size;
68902ab866f2d2edc3a71c1203065e6ddf49e5b431Behdad Esfahbod  RenderWidgetHostView* rwhv = web_contents_->GetRenderWidgetHostView();
69902ab866f2d2edc3a71c1203065e6ddf49e5b431Behdad Esfahbod  if (rwhv)
7037191ede7583fdb864db32a8f4d90956657926c7Behdad Esfahbod    rwhv->SetSize(size);
7137191ede7583fdb864db32a8f4d90956657926c7Behdad Esfahbod}
72902ab866f2d2edc3a71c1203065e6ddf49e5b431Behdad Esfahbod
73590d55cbb9e21ef74dfd88eee51fd0a763958cd2Behdad Esfahbodvoid WebContentsViewGuest::SetInitialFocus() {
74590d55cbb9e21ef74dfd88eee51fd0a763958cd2Behdad Esfahbod  platform_view_->SetInitialFocus();
758e4bb3cacc269ed32187aaaeaa166c64f41a0418Behdad Esfahbod}
768e4bb3cacc269ed32187aaaeaa166c64f41a0418Behdad Esfahbod
778e4bb3cacc269ed32187aaaeaa166c64f41a0418Behdad Esfahbodgfx::Rect WebContentsViewGuest::GetViewBounds() const {
788e4bb3cacc269ed32187aaaeaa166c64f41a0418Behdad Esfahbod  return gfx::Rect(size_);
798e4bb3cacc269ed32187aaaeaa166c64f41a0418Behdad Esfahbod}
808e4bb3cacc269ed32187aaaeaa166c64f41a0418Behdad Esfahbod
818e4bb3cacc269ed32187aaaeaa166c64f41a0418Behdad Esfahbod#if defined(OS_MACOSX)
828e4bb3cacc269ed32187aaaeaa166c64f41a0418Behdad Esfahbodvoid WebContentsViewGuest::SetAllowOverlappingViews(bool overlapping) {
838e4bb3cacc269ed32187aaaeaa166c64f41a0418Behdad Esfahbod  platform_view_->SetAllowOverlappingViews(overlapping);
848e4bb3cacc269ed32187aaaeaa166c64f41a0418Behdad Esfahbod}
858e4bb3cacc269ed32187aaaeaa166c64f41a0418Behdad Esfahbod
868e4bb3cacc269ed32187aaaeaa166c64f41a0418Behdad Esfahbodbool WebContentsViewGuest::GetAllowOverlappingViews() const {
878e4bb3cacc269ed32187aaaeaa166c64f41a0418Behdad Esfahbod  return platform_view_->GetAllowOverlappingViews();
888e4bb3cacc269ed32187aaaeaa166c64f41a0418Behdad Esfahbod}
898e4bb3cacc269ed32187aaaeaa166c64f41a0418Behdad Esfahbod#endif
908e4bb3cacc269ed32187aaaeaa166c64f41a0418Behdad Esfahbod
91590d55cbb9e21ef74dfd88eee51fd0a763958cd2Behdad Esfahbodvoid WebContentsViewGuest::CreateView(const gfx::Size& initial_size,
928e4bb3cacc269ed32187aaaeaa166c64f41a0418Behdad Esfahbod                                      gfx::NativeView context) {
93133eeba6a32769ec1a7520e7c8a0d2eb1ad986f8Behdad Esfahbod  platform_view_->CreateView(initial_size, context);
94d3b30be378c1dec0259a626d9a408bb9ca1b71acBehdad Esfahbod  size_ = initial_size;
954188096a7722f09ffa9319986c0286071da10a27Behdad Esfahbod}
960ead481a5a8623103565fd7d924666e7342278ddBehdad Esfahbod
977691a154e50f8c8c77bbd94787686262955bf5d4Jonathan KewRenderWidgetHostView* WebContentsViewGuest::CreateViewForWidget(
981132a7dd0ecf1c425078e39e5471330bace42659Behdad Esfahbod    RenderWidgetHost* render_widget_host) {
99590d55cbb9e21ef74dfd88eee51fd0a763958cd2Behdad Esfahbod  if (render_widget_host->GetView()) {
100e30ebd2794b37bd8ec716a258d5cb017fb1dfadcBehdad Esfahbod    // During testing, the view will already be set up in most cases to the
10106b192c458010c847362d809673209c87ea29949Behdad Esfahbod    // test view, so we don't want to clobber it with a real one. To verify that
10206b192c458010c847362d809673209c87ea29949Behdad Esfahbod    // this actually is happening (and somebody isn't accidentally creating the
10383f34677bcbc6bb194940407b0fcb23575650e3dBehdad Esfahbod    // view twice), we check for the RVH Factory, which will be set when we're
104e30ebd2794b37bd8ec716a258d5cb017fb1dfadcBehdad Esfahbod    // making special ones (which go along with the special views).
105e30ebd2794b37bd8ec716a258d5cb017fb1dfadcBehdad Esfahbod    DCHECK(RenderViewHostFactory::has_factory());
106e30ebd2794b37bd8ec716a258d5cb017fb1dfadcBehdad Esfahbod    return render_widget_host->GetView();
107e30ebd2794b37bd8ec716a258d5cb017fb1dfadcBehdad Esfahbod  }
10883f34677bcbc6bb194940407b0fcb23575650e3dBehdad Esfahbod
1098e4bb3cacc269ed32187aaaeaa166c64f41a0418Behdad Esfahbod  RenderWidgetHostView* platform_widget = NULL;
1100090dc0f67b553d2f6eaaedc289c0956ade09ef6Behdad Esfahbod  platform_widget = platform_view_->CreateViewForWidget(render_widget_host);
1115e88aa66822ba64324b4428c9ffbe06a43b4f310Behdad Esfahbod
1124bf90f648313e35d21b427a956aa1fe762bae757Behdad Esfahbod  RenderWidgetHostView* view = new RenderWidgetHostViewGuest(
1134bf90f648313e35d21b427a956aa1fe762bae757Behdad Esfahbod      render_widget_host,
114ff44f88df2c46920f3ec2384ef321a4c7bb0f6efBehdad Esfahbod      guest_,
115ff44f88df2c46920f3ec2384ef321a4c7bb0f6efBehdad Esfahbod      platform_widget);
116ff44f88df2c46920f3ec2384ef321a4c7bb0f6efBehdad Esfahbod
117ff44f88df2c46920f3ec2384ef321a4c7bb0f6efBehdad Esfahbod  return view;
118ff44f88df2c46920f3ec2384ef321a4c7bb0f6efBehdad Esfahbod}
1194bf90f648313e35d21b427a956aa1fe762bae757Behdad Esfahbod
12039a840ae65327b173e6eb1bb291e235a8305d7a1Behdad EsfahbodRenderWidgetHostView* WebContentsViewGuest::CreateViewForPopupWidget(
1214c9fe88d30036340fe592bcbc375049b84602b8bBehdad Esfahbod    RenderWidgetHost* render_widget_host) {
12239a840ae65327b173e6eb1bb291e235a8305d7a1Behdad Esfahbod  return RenderWidgetHostViewPort::CreateViewForWidget(render_widget_host);
12339a840ae65327b173e6eb1bb291e235a8305d7a1Behdad Esfahbod}
12439a840ae65327b173e6eb1bb291e235a8305d7a1Behdad Esfahbod
12539a840ae65327b173e6eb1bb291e235a8305d7a1Behdad Esfahbodvoid WebContentsViewGuest::SetPageTitle(const string16& title) {
1264bf90f648313e35d21b427a956aa1fe762bae757Behdad Esfahbod}
1274bf90f648313e35d21b427a956aa1fe762bae757Behdad Esfahbod
1284bf90f648313e35d21b427a956aa1fe762bae757Behdad Esfahbodvoid WebContentsViewGuest::RenderViewCreated(RenderViewHost* host) {
1294bf90f648313e35d21b427a956aa1fe762bae757Behdad Esfahbod  platform_view_->RenderViewCreated(host);
130fe28b997fbbeb2cfeab62ac453993ccffe3e6719Behdad Esfahbod}
13138a83019e6a7f4aa47662fd557344f62ae001abeBehdad Esfahbod
132ff44f88df2c46920f3ec2384ef321a4c7bb0f6efBehdad Esfahbodvoid WebContentsViewGuest::RenderViewSwappedIn(RenderViewHost* host) {
133ff44f88df2c46920f3ec2384ef321a4c7bb0f6efBehdad Esfahbod  platform_view_->RenderViewSwappedIn(host);
1348e4bb3cacc269ed32187aaaeaa166c64f41a0418Behdad Esfahbod}
1358e4bb3cacc269ed32187aaaeaa166c64f41a0418Behdad Esfahbod
136cd361c3cbe4a288e3019b9a029f44e4c5f24436cBehdad Esfahbodvoid WebContentsViewGuest::SetOverscrollControllerEnabled(bool enabled) {
1378e4bb3cacc269ed32187aaaeaa166c64f41a0418Behdad Esfahbod  // This should never override the setting of the embedder view.
1384bf90f648313e35d21b427a956aa1fe762bae757Behdad Esfahbod}
1398e4bb3cacc269ed32187aaaeaa166c64f41a0418Behdad Esfahbod
1404c9fe88d30036340fe592bcbc375049b84602b8bBehdad Esfahbod#if defined(OS_MACOSX)
1418e4bb3cacc269ed32187aaaeaa166c64f41a0418Behdad Esfahbodbool WebContentsViewGuest::IsEventTracking() const {
1428e4bb3cacc269ed32187aaaeaa166c64f41a0418Behdad Esfahbod  return false;
1438e4bb3cacc269ed32187aaaeaa166c64f41a0418Behdad Esfahbod}
1446cb8c3493019e1497921666fc268cb81943f9f1fBehdad Esfahbod
1451a64f6e19a4b483e278c85e4941107be2f71b0a4Behdad Esfahbodvoid WebContentsViewGuest::CloseTabAfterEventTracking() {
1461a64f6e19a4b483e278c85e4941107be2f71b0a4Behdad Esfahbod}
14734fb5521a5fbb6b95ceff4bbac42a62628bc9f31Behdad Esfahbod#endif
14834fb5521a5fbb6b95ceff4bbac42a62628bc9f31Behdad Esfahbod
14934fb5521a5fbb6b95ceff4bbac42a62628bc9f31Behdad EsfahbodWebContents* WebContentsViewGuest::web_contents() {
1506cb8c3493019e1497921666fc268cb81943f9f1fBehdad Esfahbod  return web_contents_;
15100bec2c969555e76c3f84650a1d3c45308e585adBehdad Esfahbod}
15200bec2c969555e76c3f84650a1d3c45308e585adBehdad Esfahbod
153d02985ec5a24c659a0a133cc6bc103f1d76bcb29Behdad Esfahbodvoid WebContentsViewGuest::RestoreFocus() {
154fa2673c1ee954ddbbfbfca7cced7b839d7776fc0Behdad Esfahbod  platform_view_->RestoreFocus();
15521fdcee00125b6e1c09f0bed3064d16ccd3a7a5dBehdad Esfahbod}
1565e88aa66822ba64324b4428c9ffbe06a43b4f310Behdad Esfahbod
15762879eebd9965179af8602ba29ac0a64a739b757Behdad Esfahbodvoid WebContentsViewGuest::OnTabCrashed(base::TerminationStatus status,
15854e6f6c588a164f7de62ff88b3eff4f25adb8f17Behdad Esfahbod                                        int error_code) {
15954e6f6c588a164f7de62ff88b3eff4f25adb8f17Behdad Esfahbod}
16054e6f6c588a164f7de62ff88b3eff4f25adb8f17Behdad Esfahbod
16154e6f6c588a164f7de62ff88b3eff4f25adb8f17Behdad Esfahbodvoid WebContentsViewGuest::Focus() {
16254e6f6c588a164f7de62ff88b3eff4f25adb8f17Behdad Esfahbod  platform_view_->Focus();
16354e6f6c588a164f7de62ff88b3eff4f25adb8f17Behdad Esfahbod}
16454e6f6c588a164f7de62ff88b3eff4f25adb8f17Behdad Esfahbod
16554e6f6c588a164f7de62ff88b3eff4f25adb8f17Behdad Esfahbodvoid WebContentsViewGuest::StoreFocus() {
16654e6f6c588a164f7de62ff88b3eff4f25adb8f17Behdad Esfahbod  platform_view_->StoreFocus();
16754e6f6c588a164f7de62ff88b3eff4f25adb8f17Behdad Esfahbod}
16854e6f6c588a164f7de62ff88b3eff4f25adb8f17Behdad Esfahbod
16954e6f6c588a164f7de62ff88b3eff4f25adb8f17Behdad EsfahbodWebDropData* WebContentsViewGuest::GetDropData() const {
17054e6f6c588a164f7de62ff88b3eff4f25adb8f17Behdad Esfahbod  NOTIMPLEMENTED();
17154e6f6c588a164f7de62ff88b3eff4f25adb8f17Behdad Esfahbod  return NULL;
17254e6f6c588a164f7de62ff88b3eff4f25adb8f17Behdad Esfahbod}
17354e6f6c588a164f7de62ff88b3eff4f25adb8f17Behdad Esfahbod
17454e6f6c588a164f7de62ff88b3eff4f25adb8f17Behdad Esfahbodvoid WebContentsViewGuest::UpdateDragCursor(WebDragOperation operation) {
17554e6f6c588a164f7de62ff88b3eff4f25adb8f17Behdad Esfahbod  RenderViewHostImpl* embedder_render_view_host =
17654e6f6c588a164f7de62ff88b3eff4f25adb8f17Behdad Esfahbod      static_cast<RenderViewHostImpl*>(
17754e6f6c588a164f7de62ff88b3eff4f25adb8f17Behdad Esfahbod          guest_->embedder_web_contents()->GetRenderViewHost());
17854e6f6c588a164f7de62ff88b3eff4f25adb8f17Behdad Esfahbod  CHECK(embedder_render_view_host);
17954e6f6c588a164f7de62ff88b3eff4f25adb8f17Behdad Esfahbod  RenderViewHostDelegateView* view =
18054e6f6c588a164f7de62ff88b3eff4f25adb8f17Behdad Esfahbod      embedder_render_view_host->GetDelegate()->GetDelegateView();
18154e6f6c588a164f7de62ff88b3eff4f25adb8f17Behdad Esfahbod  if (view)
18254e6f6c588a164f7de62ff88b3eff4f25adb8f17Behdad Esfahbod    view->UpdateDragCursor(operation);
18354e6f6c588a164f7de62ff88b3eff4f25adb8f17Behdad Esfahbod}
18454e6f6c588a164f7de62ff88b3eff4f25adb8f17Behdad Esfahbod
18554e6f6c588a164f7de62ff88b3eff4f25adb8f17Behdad Esfahbodvoid WebContentsViewGuest::GotFocus() {
18654e6f6c588a164f7de62ff88b3eff4f25adb8f17Behdad Esfahbod}
18754e6f6c588a164f7de62ff88b3eff4f25adb8f17Behdad Esfahbod
18854e6f6c588a164f7de62ff88b3eff4f25adb8f17Behdad Esfahbodvoid WebContentsViewGuest::TakeFocus(bool reverse) {
18954e6f6c588a164f7de62ff88b3eff4f25adb8f17Behdad Esfahbod}
19054e6f6c588a164f7de62ff88b3eff4f25adb8f17Behdad Esfahbod
19154e6f6c588a164f7de62ff88b3eff4f25adb8f17Behdad Esfahbodvoid WebContentsViewGuest::ShowContextMenu(const ContextMenuParams& params) {
19254e6f6c588a164f7de62ff88b3eff4f25adb8f17Behdad Esfahbod  platform_view_delegate_view_->ShowContextMenu(params);
19354e6f6c588a164f7de62ff88b3eff4f25adb8f17Behdad Esfahbod}
19454e6f6c588a164f7de62ff88b3eff4f25adb8f17Behdad Esfahbod
19554e6f6c588a164f7de62ff88b3eff4f25adb8f17Behdad Esfahbodvoid WebContentsViewGuest::ShowPopupMenu(const gfx::Rect& bounds,
19654e6f6c588a164f7de62ff88b3eff4f25adb8f17Behdad Esfahbod                                         int item_height,
19754e6f6c588a164f7de62ff88b3eff4f25adb8f17Behdad Esfahbod                                         double item_font_size,
19854e6f6c588a164f7de62ff88b3eff4f25adb8f17Behdad Esfahbod                                         int selected_item,
19954e6f6c588a164f7de62ff88b3eff4f25adb8f17Behdad Esfahbod                                         const std::vector<WebMenuItem>& items,
20054e6f6c588a164f7de62ff88b3eff4f25adb8f17Behdad Esfahbod                                         bool right_aligned,
20154e6f6c588a164f7de62ff88b3eff4f25adb8f17Behdad Esfahbod                                         bool allow_multiple_selection) {
20254e6f6c588a164f7de62ff88b3eff4f25adb8f17Behdad Esfahbod  // External popup menus are only used on Mac and Android.
20354e6f6c588a164f7de62ff88b3eff4f25adb8f17Behdad Esfahbod  NOTIMPLEMENTED();
20454e6f6c588a164f7de62ff88b3eff4f25adb8f17Behdad Esfahbod}
20554e6f6c588a164f7de62ff88b3eff4f25adb8f17Behdad Esfahbod
20654e6f6c588a164f7de62ff88b3eff4f25adb8f17Behdad Esfahbodvoid WebContentsViewGuest::StartDragging(
20754e6f6c588a164f7de62ff88b3eff4f25adb8f17Behdad Esfahbod    const WebDropData& drop_data,
20854e6f6c588a164f7de62ff88b3eff4f25adb8f17Behdad Esfahbod    WebDragOperationsMask ops,
20954e6f6c588a164f7de62ff88b3eff4f25adb8f17Behdad Esfahbod    const gfx::ImageSkia& image,
21054e6f6c588a164f7de62ff88b3eff4f25adb8f17Behdad Esfahbod    const gfx::Vector2d& image_offset,
21154e6f6c588a164f7de62ff88b3eff4f25adb8f17Behdad Esfahbod    const DragEventSourceInfo& event_info) {
21254e6f6c588a164f7de62ff88b3eff4f25adb8f17Behdad Esfahbod  WebContentsImpl* embedder_web_contents = guest_->embedder_web_contents();
21354e6f6c588a164f7de62ff88b3eff4f25adb8f17Behdad Esfahbod  embedder_web_contents->GetBrowserPluginEmbedder()->StartDrag(guest_);
21454e6f6c588a164f7de62ff88b3eff4f25adb8f17Behdad Esfahbod  RenderViewHostImpl* embedder_render_view_host =
21554e6f6c588a164f7de62ff88b3eff4f25adb8f17Behdad Esfahbod      static_cast<RenderViewHostImpl*>(
21654e6f6c588a164f7de62ff88b3eff4f25adb8f17Behdad Esfahbod          embedder_web_contents->GetRenderViewHost());
21754e6f6c588a164f7de62ff88b3eff4f25adb8f17Behdad Esfahbod  CHECK(embedder_render_view_host);
21854e6f6c588a164f7de62ff88b3eff4f25adb8f17Behdad Esfahbod  RenderViewHostDelegateView* view =
21954e6f6c588a164f7de62ff88b3eff4f25adb8f17Behdad Esfahbod      embedder_render_view_host->GetDelegate()->GetDelegateView();
22054e6f6c588a164f7de62ff88b3eff4f25adb8f17Behdad Esfahbod  if (view)
22154e6f6c588a164f7de62ff88b3eff4f25adb8f17Behdad Esfahbod    view->StartDragging(drop_data, ops, image, image_offset, event_info);
22254e6f6c588a164f7de62ff88b3eff4f25adb8f17Behdad Esfahbod  else
22354e6f6c588a164f7de62ff88b3eff4f25adb8f17Behdad Esfahbod    embedder_web_contents->SystemDragEnded();
22454e6f6c588a164f7de62ff88b3eff4f25adb8f17Behdad Esfahbod}
22554e6f6c588a164f7de62ff88b3eff4f25adb8f17Behdad Esfahbod
22654e6f6c588a164f7de62ff88b3eff4f25adb8f17Behdad Esfahbod}  // namespace content
22754e6f6c588a164f7de62ff88b3eff4f25adb8f17Behdad Esfahbod