[WRTjs] Refactor popup
[platform/framework/web/chromium-efl.git] / wrt / src / browser / wrt_web_view_delegate.h
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 #ifndef BROWSER_WRT_WEB_VIEW_DELEGATE_H_
18 #define BROWSER_WRT_WEB_VIEW_DELEGATE_H_
19
20 #include "tizen_src/chromium_impl/content/public/browser/webview_delegate.h"
21 #include "wrt/src/browser/wrt_input_picker.h"
22
23 namespace wrt {
24
25 class WRTWebContents;
26
27 class WRTWebViewDelegate : public content::WebViewDelegate {
28  public:
29   WRTWebViewDelegate(WRTWebContents* web_contents);
30   ~WRTWebViewDelegate();
31
32   WRTWebViewDelegate(const WRTWebViewDelegate&) = delete;
33   WRTWebViewDelegate& operator=(const WRTWebViewDelegate&) = delete;
34
35  private:
36   // content::WebViewDelegate
37   bool WebContentsCreateAsync(WebContentsCreateCallback) override {
38     return false;
39   }
40
41   void ShowPopupMenu(content::RenderFrameHost* render_frame_host,
42                      const gfx::Rect& bounds,
43                      int item_height,
44                      double item_font_size,
45                      int selected_item,
46                      std::vector<blink::mojom::MenuItemPtr> items,
47                      bool right_aligned,
48                      bool allow_multiple_selection) override;
49   void HidePopupMenu() override;
50   void CancelContextMenu(int request_id) override;
51   void HandleZoomGesture(blink::WebGestureEvent& event) override;
52   bool UseKeyPadWithoutUserAction() override;
53   void ShowContextMenu(const content::ContextMenuParams& params) override;
54   void OrientationLock(device::mojom::ScreenOrientationLockType) override;
55   void OrientationUnlock() override;
56   void OpenDateTimeDialog(
57       ui::TextInputType dialog_type,
58       double dialog_value,
59       content::DateTimeChooserEfl* date_time_chooser) override;
60   void OnOverscrolled(const gfx::Vector2dF& accumulated_overscroll,
61                       const gfx::Vector2dF& latest_overscroll_delta) override;
62   bool ImePanelEnabled() const override;
63   bool ImeHandleKeyEventEnabled() const override;
64   bool UseFloatingUI() const override;
65
66   WRTWebContents* wrt_web_contents_;
67   std::unique_ptr<WRTInputPicker> wrt_input_picker_;
68 };
69
70 }  // namespace wrt
71
72 #endif  // BROWSER_WRT_WEB_VIEW_DELEGATE_H_