[WRTjs] Refactor popup
[platform/framework/web/chromium-efl.git] / wrt / src / browser / wrt_web_view_delegate.cc
1 /*
2  * Copyright (c) 2019 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  *    Licensed under the Apache License, Version 2.0 (the "License");
5  *    you may not use this file except in compliance with the License.
6  *    You may obtain a copy of the License at
7  *
8  *        http://www.apache.org/licenses/LICENSE-2.0
9  *
10  *    Unless required by applicable law or agreed to in writing, software
11  *    distributed under the License is distributed on an "AS IS" BASIS,
12  *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  *    See the License for the specific language governing permissions and
14  *    limitations under the License.
15  */
16
17 #include "wrt/src/browser/wrt_web_view_delegate.h"
18
19 #include "wrt/src/browser/wrt_native_window.h"
20 #include "wrt/src/browser/wrt_web_contents.h"
21
22 namespace wrt {
23
24 WRTWebViewDelegate::WRTWebViewDelegate(WRTWebContents* web_contents)
25     : wrt_web_contents_(web_contents) {}
26
27 WRTWebViewDelegate::~WRTWebViewDelegate() {}
28
29 void WRTWebViewDelegate::ShowPopupMenu(
30     content::RenderFrameHost* render_frame_host,
31     const gfx::Rect& bounds,
32     int item_height,
33     double item_font_size,
34     int selected_item,
35     std::vector<blink::mojom::MenuItemPtr> items,
36     bool right_aligned,
37     bool allow_multiple_selection) {
38   wrt_web_contents_->ShowPopupMenuImpl(std::move(items), selected_item,
39                                        allow_multiple_selection, bounds,
40                                        item_font_size);
41 }
42
43 void WRTWebViewDelegate::HidePopupMenu() {
44   wrt_web_contents_->HidePopupMenuImpl();
45 }
46
47 void WRTWebViewDelegate::CancelContextMenu(int request_id) {
48   wrt_web_contents_->HideContextMenu();
49 }
50
51 void WRTWebViewDelegate::HandleZoomGesture(blink::WebGestureEvent& event) {
52   NOTIMPLEMENTED();
53 }
54
55 bool WRTWebViewDelegate::UseKeyPadWithoutUserAction() {
56   return wrt_web_contents_->UseKeyPadWithoutUserAction();
57 }
58
59 void WRTWebViewDelegate::ShowContextMenu(
60     const content::ContextMenuParams& params) {
61   wrt_web_contents_->ShowContextMenu(params);
62 }
63
64 void WRTWebViewDelegate::OrientationLock(
65     device::mojom::ScreenOrientationLockType) {
66   NOTIMPLEMENTED();
67 }
68
69 void WRTWebViewDelegate::OrientationUnlock() {
70   NOTIMPLEMENTED();
71 }
72
73 void WRTWebViewDelegate::OpenDateTimeDialog(
74     ui::TextInputType dialog_type,
75     double dialog_value,
76     content::DateTimeChooserEfl* date_time_chooser) {
77   wrt_input_picker_.reset(
78       new WRTInputPicker(wrt_web_contents_->web_contents(),
79                          wrt::WRTNativeWindow::GetTopWindow(),
80                          date_time_chooser));
81   wrt_input_picker_->ShowDatePicker(dialog_type, dialog_value);
82 }
83
84 void WRTWebViewDelegate::OnOverscrolled(
85     const gfx::Vector2dF& accumulated_overscroll,
86     const gfx::Vector2dF& latest_overscroll_delta) {
87   NOTIMPLEMENTED();
88 }
89
90 bool WRTWebViewDelegate::ImePanelEnabled() const {
91   return wrt_web_contents_->ImePanelEnabled();
92 }
93
94 bool WRTWebViewDelegate::ImeHandleKeyEventEnabled() const {
95   return true;
96 }
97
98 bool WRTWebViewDelegate::UseFloatingUI() const {
99   return wrt_web_contents_->UseFloatingUI();
100 }
101
102 } // namespace wrt