Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / ui / gtk / tab_contents / render_view_context_menu_gtk.h
1 // Copyright (c) 2012 The Chromium Authors. 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 #ifndef CHROME_BROWSER_UI_GTK_TAB_CONTENTS_RENDER_VIEW_CONTEXT_MENU_GTK_H_
6 #define CHROME_BROWSER_UI_GTK_TAB_CONTENTS_RENDER_VIEW_CONTEXT_MENU_GTK_H_
7
8 #include "base/compiler_specific.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "chrome/browser/tab_contents/render_view_context_menu.h"
11 #include "chrome/browser/ui/gtk/menu_gtk.h"
12 #include "ui/gfx/point.h"
13
14 namespace content {
15 class RenderWidgetHostView;
16 struct ContextMenuParams;
17 }
18
19 class RenderViewContextMenuGtk : public RenderViewContextMenu,
20                                  public MenuGtk::Delegate {
21  public:
22   RenderViewContextMenuGtk(content::RenderFrameHost* render_frame_host,
23                            const content::ContextMenuParams& params,
24                            content::RenderWidgetHostView* view);
25
26   virtual ~RenderViewContextMenuGtk();
27
28   // Show the menu at the given location.
29   void Popup(const gfx::Point& point);
30
31   // Menu::Delegate implementation ---------------------------------------------
32   virtual bool AlwaysShowIconForCmd(int command_id) const OVERRIDE;
33
34   // SimpleMenuModel::Delegate implementation.
35   virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE;
36   virtual bool IsCommandIdChecked(int command_id) const OVERRIDE;
37   virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE;
38
39   // RenderViewContextMenuDelegate implementation ------------------------------
40   virtual void UpdateMenuItem(int command_id,
41                               bool enabled,
42                               bool hidden,
43                               const base::string16& title) OVERRIDE;
44
45  protected:
46   // RenderViewContextMenu implementation --------------------------------------
47   virtual void PlatformInit() OVERRIDE;
48   virtual void PlatformCancel() OVERRIDE;
49   // TODO(port): implement.
50   virtual bool GetAcceleratorForCommandId(
51       int command_id,
52       ui::Accelerator* accelerator) OVERRIDE;
53   virtual void AppendPlatformEditableItems() OVERRIDE;
54
55  private:
56   // Adds writing direction submenu.
57   void AppendBidiSubMenu();
58
59   // Model for the BiDi input submenu.
60   ui::SimpleMenuModel bidi_submenu_model_;
61
62   scoped_ptr<MenuGtk> menu_gtk_;
63   uint32_t triggering_event_time_;
64 };
65
66 #endif  // CHROME_BROWSER_UI_GTK_TAB_CONTENTS_RENDER_VIEW_CONTEXT_MENU_GTK_H_