2 * Copyright (c) 2019 Samsung Electronics Co., Ltd All Rights Reserved
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 #include "wrt/src/browser/wrt_web_view_delegate.h"
19 #include "wrt/src/browser/wrt_native_window.h"
20 #include "wrt/src/browser/wrt_web_contents.h"
24 WRTWebViewDelegate::WRTWebViewDelegate(WRTWebContents* web_contents)
25 : wrt_web_contents_(web_contents) {}
27 WRTWebViewDelegate::~WRTWebViewDelegate() {}
29 void WRTWebViewDelegate::ShowPopupMenu(
30 content::RenderFrameHost* render_frame_host,
31 const gfx::Rect& bounds,
33 double item_font_size,
35 std::vector<blink::mojom::MenuItemPtr> items,
37 bool allow_multiple_selection) {
38 wrt_web_contents_->ShowPopupMenuImpl(std::move(items), selected_item,
39 allow_multiple_selection, bounds,
43 void WRTWebViewDelegate::HidePopupMenu() {
44 wrt_web_contents_->HidePopupMenuImpl();
47 void WRTWebViewDelegate::CancelContextMenu(int request_id) {
48 wrt_web_contents_->HideContextMenu();
51 void WRTWebViewDelegate::HandleZoomGesture(blink::WebGestureEvent& event) {
55 bool WRTWebViewDelegate::UseKeyPadWithoutUserAction() {
56 return wrt_web_contents_->UseKeyPadWithoutUserAction();
59 void WRTWebViewDelegate::ShowContextMenu(
60 const content::ContextMenuParams& params) {
61 wrt_web_contents_->ShowContextMenu(params);
64 void WRTWebViewDelegate::OrientationLock(
65 device::mojom::ScreenOrientationLockType) {
69 void WRTWebViewDelegate::OrientationUnlock() {
73 void WRTWebViewDelegate::OpenDateTimeDialog(
74 ui::TextInputType dialog_type,
76 content::DateTimeChooserEfl* date_time_chooser) {
77 wrt_input_picker_.reset(
78 new WRTInputPicker(wrt_web_contents_->web_contents(),
79 wrt::WRTNativeWindow::GetTopWindow(),
81 wrt_input_picker_->ShowDatePicker(dialog_type, dialog_value);
84 void WRTWebViewDelegate::OnOverscrolled(
85 const gfx::Vector2dF& accumulated_overscroll,
86 const gfx::Vector2dF& latest_overscroll_delta) {
90 bool WRTWebViewDelegate::ImePanelEnabled() const {
91 return wrt_web_contents_->ImePanelEnabled();
94 bool WRTWebViewDelegate::ImeHandleKeyEventEnabled() const {
98 bool WRTWebViewDelegate::UseFloatingUI() const {
99 return wrt_web_contents_->UseFloatingUI();