Index: chrome/browser/ui/views/toolbar/wrench_menu.h |
diff --git a/chrome/browser/ui/views/toolbar/wrench_menu.h b/chrome/browser/ui/views/toolbar/wrench_menu.h |
index 6108547badca3ffcad92a2c916bf01ea605f92b9..b49dea7a669729ba50cb7a1a555f89c2cda749ec 100644 |
--- a/chrome/browser/ui/views/toolbar/wrench_menu.h |
+++ b/chrome/browser/ui/views/toolbar/wrench_menu.h |
@@ -37,10 +37,16 @@ class WrenchMenu : public views::MenuDelegate, |
public BaseBookmarkModelObserver, |
public content::NotificationObserver { |
public: |
- // TODO: remove |use_new_menu| and |supports_new_separators|. |
- WrenchMenu(Browser* browser, |
- bool use_new_menu, |
- bool supports_new_separators); |
+ enum RunFlags { |
+ // TODO: remove |USE_NEW_MENU| and |SUPPORTS_NEW_SEPARATORS|. |
+ USE_NEW_MENU = 1 << 0, |
+ SUPPORTS_NEW_SEPARATORS = 1 << 1, |
+ |
+ // Indicates that the menu was opened for a drag-and-drop operation. |
+ FOR_DROP = 1 << 2, |
+ }; |
+ |
+ WrenchMenu(Browser* browser, int run_flags); |
virtual ~WrenchMenu(); |
void Init(ui::MenuModel* model); |
@@ -48,10 +54,14 @@ class WrenchMenu : public views::MenuDelegate, |
// Shows the menu relative to the specified view. |
void RunMenu(views::MenuButton* host); |
+ // Closes the menu if it is open, otherwise does nothing. |
+ void CloseMenu(); |
+ |
// Whether the menu is currently visible to the user. |
bool IsShowing(); |
- bool use_new_menu() const { return use_new_menu_; } |
+ bool use_new_menu() const { return (run_flags_ & USE_NEW_MENU) != 0; } |
+ bool for_drop() const { return (run_flags_ & FOR_DROP) != 0; } |
void AddObserver(WrenchMenuObserver* observer); |
void RemoveObserver(WrenchMenuObserver* observer); |
@@ -111,6 +121,10 @@ class WrenchMenu : public views::MenuDelegate, |
typedef std::pair<ui::MenuModel*,int> Entry; |
typedef std::map<int,Entry> CommandIDToEntry; |
+ bool supports_new_separators() const { |
+ return (run_flags_ & SUPPORTS_NEW_SEPARATORS) != 0; |
+ } |
+ |
// Populates |parent| with all the child menus in |model|. Recursively invokes |
// |PopulateMenu| for any submenu. |
void PopulateMenu(views::MenuItemView* parent, |
@@ -177,9 +191,8 @@ class WrenchMenu : public views::MenuDelegate, |
content::NotificationRegistrar registrar_; |
- const bool use_new_menu_; |
- |
- const bool supports_new_separators_; |
+ // The bit mask of RunFlags. |
+ const int run_flags_; |
ObserverList<WrenchMenuObserver> observer_list_; |