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

Side by Side Diff: ui/views/controls/menu/menu_controller.h

Issue 2654093005: Fix MenuRunner Releasing (Closed)
Patch Set: Clarification and renaming Created 3 years, 10 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 unified diff | Download patch
« no previous file with comments | « no previous file | ui/views/controls/menu/menu_controller.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef UI_VIEWS_CONTROLS_MENU_MENU_CONTROLLER_H_ 5 #ifndef UI_VIEWS_CONTROLS_MENU_MENU_CONTROLLER_H_
6 #define UI_VIEWS_CONTROLS_MENU_MENU_CONTROLLER_H_ 6 #define UI_VIEWS_CONTROLS_MENU_MENU_CONTROLLER_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <list> 10 #include <list>
11 #include <memory> 11 #include <memory>
12 #include <set> 12 #include <set>
13 #include <vector> 13 #include <vector>
14 14
15 #include "base/compiler_specific.h" 15 #include "base/compiler_specific.h"
16 #include "base/macros.h" 16 #include "base/macros.h"
17 #include "base/memory/weak_ptr.h"
17 #include "base/timer/timer.h" 18 #include "base/timer/timer.h"
18 #include "build/build_config.h" 19 #include "build/build_config.h"
19 #include "ui/events/event.h" 20 #include "ui/events/event.h"
20 #include "ui/events/event_constants.h" 21 #include "ui/events/event_constants.h"
21 #include "ui/events/platform/platform_event_dispatcher.h" 22 #include "ui/events/platform/platform_event_dispatcher.h"
22 #include "ui/views/controls/button/menu_button.h" 23 #include "ui/views/controls/button/menu_button.h"
23 #include "ui/views/controls/menu/menu_config.h" 24 #include "ui/views/controls/menu/menu_config.h"
24 #include "ui/views/controls/menu/menu_delegate.h" 25 #include "ui/views/controls/menu/menu_delegate.h"
25 #include "ui/views/widget/widget_observer.h" 26 #include "ui/views/widget/widget_observer.h"
26 27
(...skipping 22 matching lines...) Expand all
49 namespace test { 50 namespace test {
50 class MenuControllerTest; 51 class MenuControllerTest;
51 class MenuControllerTestApi; 52 class MenuControllerTestApi;
52 } 53 }
53 54
54 // MenuController ------------------------------------------------------------- 55 // MenuController -------------------------------------------------------------
55 56
56 // MenuController is used internally by the various menu classes to manage 57 // MenuController is used internally by the various menu classes to manage
57 // showing, selecting and drag/drop for menus. All relevant events are 58 // showing, selecting and drag/drop for menus. All relevant events are
58 // forwarded to the MenuController from SubmenuView and MenuHost. 59 // forwarded to the MenuController from SubmenuView and MenuHost.
59 class VIEWS_EXPORT MenuController : public WidgetObserver { 60 class VIEWS_EXPORT MenuController
61 : public base::SupportsWeakPtr<MenuController>,
62 public WidgetObserver {
60 public: 63 public:
61 // Enumeration of how the menu should exit. 64 // Enumeration of how the menu should exit.
62 enum ExitType { 65 enum ExitType {
63 // Don't exit. 66 // Don't exit.
64 EXIT_NONE, 67 EXIT_NONE,
65 68
66 // All menus, including nested, should be exited. 69 // All menus, including nested, should be exited.
67 EXIT_ALL, 70 EXIT_ALL,
68 71
69 // Only the outermost menu should be exited. 72 // Only the outermost menu should be exited.
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 182
180 // Update the submenu's selection based on the current mouse location 183 // Update the submenu's selection based on the current mouse location
181 void UpdateSubmenuSelection(SubmenuView* source); 184 void UpdateSubmenuSelection(SubmenuView* source);
182 185
183 // WidgetObserver overrides: 186 // WidgetObserver overrides:
184 void OnWidgetDestroying(Widget* widget) override; 187 void OnWidgetDestroying(Widget* widget) override;
185 188
186 // Only used for testing. 189 // Only used for testing.
187 bool IsCancelAllTimerRunningForTest(); 190 bool IsCancelAllTimerRunningForTest();
188 191
192 // Only used for testing. Clears |state_| and |pending_state_| without
193 // notifying any menu items.
194 void ClearStateForTest();
195
189 // Only used for testing. 196 // Only used for testing.
190 static void TurnOffMenuSelectionHoldForTest(); 197 static void TurnOffMenuSelectionHoldForTest();
191 198
192 private: 199 private:
193 friend class internal::MenuRunnerImpl; 200 friend class internal::MenuRunnerImpl;
194 friend class test::MenuControllerTest; 201 friend class test::MenuControllerTest;
195 friend class test::MenuControllerTestApi; 202 friend class test::MenuControllerTestApi;
196 friend class MenuHostRootView; 203 friend class MenuHostRootView;
197 friend class MenuItemView; 204 friend class MenuItemView;
198 friend class SubmenuView; 205 friend class SubmenuView;
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after
698 #if defined(USE_AURA) 705 #if defined(USE_AURA)
699 std::unique_ptr<MenuPreTargetHandler> menu_pre_target_handler_; 706 std::unique_ptr<MenuPreTargetHandler> menu_pre_target_handler_;
700 #endif 707 #endif
701 708
702 DISALLOW_COPY_AND_ASSIGN(MenuController); 709 DISALLOW_COPY_AND_ASSIGN(MenuController);
703 }; 710 };
704 711
705 } // namespace views 712 } // namespace views
706 713
707 #endif // UI_VIEWS_CONTROLS_MENU_MENU_CONTROLLER_H_ 714 #endif // UI_VIEWS_CONTROLS_MENU_MENU_CONTROLLER_H_
OLDNEW
« no previous file with comments | « no previous file | ui/views/controls/menu/menu_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698