Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(322)

Unified Diff: chrome/browser/ui/views/toolbar/wrench_menu.h

Issue 413323002: Resubmit: Open the WrenchMenu on mouseover when dragging a browser action (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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_;

Powered by Google App Engine
This is Rietveld 408576698