Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / xwalk / runtime / browser / android / xwalk_web_contents_view_delegate.cc
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Copyright (c) 2014 Intel Corporation. All rights reserved.
3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file.
5
6 #include "xwalk/runtime/browser/android/xwalk_web_contents_view_delegate.h"
7
8 #include "base/command_line.h"
9 #include "content/public/browser/android/content_view_core.h"
10 #include "content/public/browser/web_contents.h"
11 #include "content/public/browser/web_contents_view.h"
12 #include "content/public/common/context_menu_params.h"
13
14 namespace xwalk {
15
16 XWalkWebContentsViewDelegate::XWalkWebContentsViewDelegate(
17     content::WebContents* web_contents)
18     : web_contents_(web_contents) {
19 }
20
21 XWalkWebContentsViewDelegate::~XWalkWebContentsViewDelegate() {
22 }
23
24 void XWalkWebContentsViewDelegate::ShowContextMenu(
25     content::RenderFrameHost* render_frame_host,
26     const content::ContextMenuParams& params) {
27   if (params.is_editable && params.selection_text.empty()) {
28     content::ContentViewCore* content_view_core =
29         content::ContentViewCore::FromWebContents(web_contents_);
30     if (content_view_core) {
31       content_view_core->ShowPastePopup(params.selection_start.x(),
32                                         params.selection_start.y());
33     }
34   }
35 }
36
37 content::WebDragDestDelegate*
38     XWalkWebContentsViewDelegate::GetDragDestDelegate() {
39   return NULL;
40 }
41
42 }  // namespace xwalk