f4433aa91fb029c65c2fa148b8a93dcf5635bd64
[platform/framework/web/chromium-efl.git] / tizen_src / ewk / efl_integration / web_contents_view_delegate_ewk.cc
1 // Copyright 2015 Samsung Electronics. 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.
4
5 #include "web_contents_view_delegate_ewk.h"
6
7 #include "eweb_view.h"
8
9 WebContentsViewDelegateEwk::WebContentsViewDelegateEwk(EWebView* wv)
10     : web_view_(wv) {
11 }
12
13 // Note: WebContentsViewDelegate::ShowContextMenu is the hook called
14 // by chromium in response to either a long press gesture (in case of
15 // touch-based input event is the source) or a right button mouse click
16 // (in case source is mouse-based).
17 // For the former, EWK apps enter selection mode, whereas for the
18 // later, context menu is shown right way.
19 void WebContentsViewDelegateEwk::ShowContextMenu(
20     content::RenderFrameHost& render_frame_host,
21     const content::ContextMenuParams& params) {
22   if (params.source_type == ui::MENU_SOURCE_TOUCH) {
23     CHECK(web_view_->TouchEventsEnabled());
24     web_view_->HandleLongPressGesture(params);
25   } else {
26     web_view_->ShowContextMenu(params);
27   }
28 }
29
30 void WebContentsViewDelegateEwk::OnSelectionRectReceived(
31     const gfx::Rect& selection_rect) const {
32   web_view_->OnSelectionRectReceived(selection_rect);
33 }