OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2011 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_TABS_TAB_STRIP_MENU_CONTROLLER_H_ | |
6 #define CHROME_BROWSER_UI_GTK_TABS_TAB_STRIP_MENU_CONTROLLER_H_ | |
7 | |
8 #include "base/memory/scoped_ptr.h" | |
9 #include "chrome/browser/ui/gtk/menu_gtk.h" | |
10 #include "chrome/browser/ui/tabs/tab_menu_model.h" | |
11 | |
12 class TabGtk; | |
13 class TabStripModel; | |
14 | |
15 namespace gfx { | |
16 class Point; | |
17 } | |
18 | |
19 namespace ui { | |
20 class Accelerator; | |
21 } | |
22 | |
23 // Controls the context menu of a specific tab. It is created in every a time | |
James Hawkins
2011/06/01 18:20:40
s/in //
dpapad
2011/06/01 18:30:49
Done.
| |
24 // right click occurs on a tab. | |
25 class TabStripMenuController : public ui::SimpleMenuModel::Delegate, | |
26 public MenuGtk::Delegate { | |
27 public: | |
28 // |tab| is the tab for which this menu is created. |model| is the | |
29 // TabStripModel where this tab belongs to. |index| is the index of |tab| | |
30 // within the tab strip. | |
31 TabStripMenuController(TabGtk* tab, TabStripModel* model, int index); | |
32 virtual ~TabStripMenuController() {} | |
33 void RunMenu(const gfx::Point& point, guint32 event_time); | |
34 void Cancel(); | |
35 | |
36 private: | |
37 // Overridden from ui::SimpleMenuModel::Delegate: | |
38 virtual bool IsCommandIdChecked(int command_id) const; | |
39 virtual bool IsCommandIdEnabled(int command_id) const; | |
40 virtual bool GetAcceleratorForCommandId(int command_id, | |
41 ui::Accelerator* accelerator); | |
42 virtual void ExecuteCommand(int command_id); | |
43 | |
44 // Overridden from MenuGtk::Delegate: | |
45 GtkWidget* GetImageForCommandId(int command_id) const; | |
46 | |
47 // The context menu. | |
48 scoped_ptr<MenuGtk> menu_; | |
49 | |
50 // Weak pointer to the tab for which the context menu was brought up for. Set | |
51 // to NULL when the menu is canceled. | |
52 TabGtk* tab_; | |
53 | |
54 // The model. | |
55 TabMenuModel model_; | |
56 | |
57 DISALLOW_COPY_AND_ASSIGN(TabStripMenuController); | |
58 }; | |
59 | |
60 #endif // CHROME_BROWSER_UI_GTK_TABS_TAB_STRIP_MENU_CONTROLLER_H_ | |
OLD | NEW |