[WRTjs] Refactor popup
[platform/framework/web/chromium-efl.git] / wrt / src / browser / wrt_context_menu_controller.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_CONTEXT_MENU_CONTROLLER_H_
18 #define BROWSER_WRT_CONTEXT_MENU_CONTROLLER_H_
19
20 #include "tizen_src/chromium_impl/content/browser/context_menu/context_menu_controller_base.h"
21 #include "ui/gfx/geometry/rect.h"
22
23 namespace content {
24 class RenderViewHost;
25 }
26
27 namespace wrt {
28
29 class WRTWebContents;
30
31 class WRTContextMenuController
32     : public content::ContextMenuControllerBase {
33  public:
34   explicit WRTContextMenuController(
35       content::WebContents& web_contents, WRTWebContents* wrt_web_contents);
36   virtual ~WRTContextMenuController() override {}
37
38   WRTContextMenuController(const WRTContextMenuController&) = delete;
39   WRTContextMenuController& operator=(const WRTContextMenuController&) = delete;
40
41   bool PopulateAndShowContextMenu(const content::ContextMenuParams& params);
42
43  private:
44   // ContextMenuControllerBase
45   Evas_Object* ewk_view() override;
46   void MenuItemSelected(content::ContextMenuItemEfl* menu_item) override;
47
48   void AddItemToProposedList(Ewk_Context_Menu_Item_Type item,
49                              Ewk_Context_Menu_Item_Tag option,
50                              const std::string& title,
51                              const std::string& image_url = std::string(),
52                              const std::string& link_url = std::string(),
53                              const std::string& icon_path = std::string());
54   void GetProposedContextMenu();
55   void SelectFocusedLink();
56   void GetSelectionRange(gfx::Rect* left, gfx::Rect* right);
57   void MoveCaret(const gfx::Point& point);
58   void EnterDragState();
59
60   WRTWebContents* wrt_web_contents_;
61 };
62
63 } // namespace wrt
64
65 #endif // BROWSER_WRT_CONTEXT_MENU_CONTROLLER_H_