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_CONTEXT_MENU_CONTROLLER_H_ |
| 6 #define CHROME_BROWSER_UI_GTK_TABS_CONTEXT_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 class ContextMenuController : public ui::SimpleMenuModel::Delegate, |
| 24 public MenuGtk::Delegate { |
| 25 public: |
| 26 ContextMenuController(TabGtk* tab, TabStripModel* model, int index); |
| 27 virtual ~ContextMenuController() {} |
| 28 void RunMenu(const gfx::Point& point, guint32 event_time); |
| 29 void Cancel(); |
| 30 |
| 31 private: |
| 32 // Overridden from ui::SimpleMenuModel::Delegate: |
| 33 virtual bool IsCommandIdChecked(int command_id) const; |
| 34 virtual bool IsCommandIdEnabled(int command_id) const; |
| 35 virtual bool GetAcceleratorForCommandId(int command_id, |
| 36 ui::Accelerator* accelerator); |
| 37 virtual void ExecuteCommand(int command_id); |
| 38 |
| 39 GtkWidget* GetImageForCommandId(int command_id) const; |
| 40 |
| 41 // The context menu. |
| 42 scoped_ptr<MenuGtk> menu_; |
| 43 |
| 44 // The Tab the context menu was brought up for. Set to NULL when the menu |
| 45 // is canceled. |
| 46 TabGtk* tab_; |
| 47 |
| 48 // The model. |
| 49 TabMenuModel model_; |
| 50 |
| 51 DISALLOW_COPY_AND_ASSIGN(ContextMenuController); |
| 52 }; |
| 53 |
| 54 #endif // CHROME_BROWSER_UI_GTK_TABS_CONTEXT_MENU_CONTROLLER_H_ |
OLD | NEW |