1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "content/shell/browser/shell_web_contents_view_delegate.h"
7 #include "base/command_line.h"
8 #include "content/public/browser/android/content_view_core.h"
9 #include "content/public/browser/web_contents.h"
10 #include "content/public/browser/web_contents_view.h"
11 #include "content/public/common/context_menu_params.h"
12 #include "content/shell/browser/shell_web_contents_view_delegate_creator.h"
16 WebContentsViewDelegate
* CreateShellWebContentsViewDelegate(
17 WebContents
* web_contents
) {
18 return new ShellWebContentsViewDelegate(web_contents
);
22 ShellWebContentsViewDelegate::ShellWebContentsViewDelegate(
23 WebContents
* web_contents
)
24 : web_contents_(web_contents
) {
27 ShellWebContentsViewDelegate::~ShellWebContentsViewDelegate() {
30 void ShellWebContentsViewDelegate::ShowContextMenu(
31 RenderFrameHost
* render_frame_host
,
32 const ContextMenuParams
& params
) {
33 if (params
.is_editable
&& params
.selection_text
.empty()) {
34 content::ContentViewCore
* content_view_core
=
35 ContentViewCore::FromWebContents(web_contents_
);
36 if (content_view_core
) {
37 content_view_core
->ShowPastePopup(params
.selection_start
.x(),
38 params
.selection_start
.y());
43 WebDragDestDelegate
* ShellWebContentsViewDelegate::GetDragDestDelegate() {
47 } // namespace content