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

Unified Diff: views/controls/menu/menu_controller.h

Issue 1664001: Fixes possible crash if the window hosting a menu was closed while the (Closed)
Patch Set: Incorporated review feedback Created 10 years, 8 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
« no previous file with comments | « views/controls/button/menu_button.cc ('k') | views/controls/menu/menu_controller.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: views/controls/menu/menu_controller.h
diff --git a/views/controls/menu/menu_controller.h b/views/controls/menu/menu_controller.h
index f8a459afefd8ddacc1257621971a0148361127bf..d6518be34943f88b679672e698edc7725b50bcac 100644
--- a/views/controls/menu/menu_controller.h
+++ b/views/controls/menu/menu_controller.h
@@ -38,6 +38,22 @@ class MenuController : public MessageLoopForUI::Dispatcher {
friend class MenuHostRootView;
friend class MenuItemView;
+ // Enumeration of how the menu should exit.
+ enum ExitType {
+ // Don't exit.
+ EXIT_NONE,
+
+ // All menus, including nested, should be exited.
+ EXIT_ALL,
+
+ // Only the outermost menu should be exited.
+ EXIT_OUTERMOST,
+
+ // This is set if the menu is being closed as the result of one of the menus
+ // being destroyed.
+ EXIT_DESTROYED
+ };
+
// If a menu is currently active, this returns the controller for it.
static MenuController* GetActiveInstance();
@@ -66,12 +82,12 @@ class MenuController : public MessageLoopForUI::Dispatcher {
bool open_submenu,
bool update_immediately);
- // Cancels the current Run. If all is true, any nested loops are canceled
- // as well. This immediately hides all menus.
- void Cancel(bool all);
+ // Cancels the current Run. See ExitType for a description of what happens
+ // with the various parameters.
+ void Cancel(ExitType type);
- // An alternative to Cancel(true) that can be used with a OneShotTimer.
- void CancelAll() { return Cancel(true); }
+ // An alternative to Cancel(EXIT_ALL) that can be used with a OneShotTimer.
+ void CancelAll() { Cancel(EXIT_ALL); }
// Various events, forwarded from the submenu.
//
@@ -98,18 +114,6 @@ class MenuController : public MessageLoopForUI::Dispatcher {
void OnDragExitedScrollButton(SubmenuView* source);
private:
- // Enumeration of how the menu should exit.
- enum ExitType {
- // Don't exit.
- EXIT_NONE,
-
- // All menus, including nested, should be exited.
- EXIT_ALL,
-
- // Only the outermost menu should be exited.
- EXIT_OUTERMOST
- };
-
class MenuScrollTask;
// Tracks selection information.
« no previous file with comments | « views/controls/button/menu_button.cc ('k') | views/controls/menu/menu_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698