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.
5 #ifndef CHROME_BROWSER_UI_GTK_TABS_TAB_STRIP_MENU_CONTROLLER_H_
6 #define CHROME_BROWSER_UI_GTK_TABS_TAB_STRIP_MENU_CONTROLLER_H_
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"
23 // Controls the context menu of a specific tab. It is created every time a right
24 // click occurs on a tab.
25 class TabStripMenuController
: public ui::SimpleMenuModel::Delegate
,
26 public MenuGtk::Delegate
{
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
);
37 // Overridden from ui::SimpleMenuModel::Delegate:
38 virtual bool IsCommandIdChecked(int command_id
) const OVERRIDE
;
39 virtual bool IsCommandIdEnabled(int command_id
) const OVERRIDE
;
40 virtual bool GetAcceleratorForCommandId(
42 ui::Accelerator
* accelerator
) OVERRIDE
;
43 virtual void ExecuteCommand(int command_id
, int event_flags
) OVERRIDE
;
45 // Overridden from MenuGtk::Delegate:
46 virtual GtkWidget
* GetImageForCommandId(int command_id
) const OVERRIDE
;
49 scoped_ptr
<MenuGtk
> menu_
;
51 // Weak pointer to the tab for which the context menu was brought up for. Set
52 // to NULL when the menu is canceled.
58 DISALLOW_COPY_AND_ASSIGN(TabStripMenuController
);
61 #endif // CHROME_BROWSER_UI_GTK_TABS_TAB_STRIP_MENU_CONTROLLER_H_