| OLD | NEW |
| 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> |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 | 33 |
| 34 class MenuButton; | 34 class MenuButton; |
| 35 class MenuHostRootView; | 35 class MenuHostRootView; |
| 36 class MenuItemView; | 36 class MenuItemView; |
| 37 class MenuMessageLoop; | 37 class MenuMessageLoop; |
| 38 class MouseEvent; | 38 class MouseEvent; |
| 39 class SubmenuView; | 39 class SubmenuView; |
| 40 class View; | 40 class View; |
| 41 | 41 |
| 42 #if defined(USE_AURA) | 42 #if defined(USE_AURA) |
| 43 class MenuKeyEventHandler; | 43 class MenuPreTargetHandler; |
| 44 #endif | 44 #endif |
| 45 | 45 |
| 46 namespace internal { | 46 namespace internal { |
| 47 class MenuControllerDelegate; | 47 class MenuControllerDelegate; |
| 48 class MenuRunnerImpl; | 48 class MenuRunnerImpl; |
| 49 } | 49 } |
| 50 | 50 |
| 51 namespace test { | 51 namespace test { |
| 52 class MenuControllerTest; | 52 class MenuControllerTest; |
| 53 class MenuControllerTestApi; | 53 class MenuControllerTestApi; |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 // Only used for testing. | 188 // Only used for testing. |
| 189 bool IsCancelAllTimerRunningForTest(); | 189 bool IsCancelAllTimerRunningForTest(); |
| 190 | 190 |
| 191 // Only used for testing. | 191 // Only used for testing. |
| 192 static void TurnOffMenuSelectionHoldForTest(); | 192 static void TurnOffMenuSelectionHoldForTest(); |
| 193 | 193 |
| 194 private: | 194 private: |
| 195 friend class internal::MenuRunnerImpl; | 195 friend class internal::MenuRunnerImpl; |
| 196 friend class test::MenuControllerTest; | 196 friend class test::MenuControllerTest; |
| 197 friend class test::MenuControllerTestApi; | 197 friend class test::MenuControllerTestApi; |
| 198 friend class MenuKeyEventHandler; | |
| 199 friend class MenuHostRootView; | 198 friend class MenuHostRootView; |
| 200 friend class MenuItemView; | 199 friend class MenuItemView; |
| 201 friend class SubmenuView; | 200 friend class SubmenuView; |
| 202 | 201 |
| 203 class MenuScrollTask; | 202 class MenuScrollTask; |
| 204 | 203 |
| 205 struct SelectByCharDetails; | 204 struct SelectByCharDetails; |
| 206 | 205 |
| 207 // Values supplied to SetSelection. | 206 // Values supplied to SetSelection. |
| 208 enum SetSelectionTypes { | 207 enum SetSelectionTypes { |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 311 // Key processing. | 310 // Key processing. |
| 312 void OnKeyDown(ui::KeyboardCode key_code); | 311 void OnKeyDown(ui::KeyboardCode key_code); |
| 313 | 312 |
| 314 // Creates a MenuController. If |blocking| is true a nested message loop is | 313 // Creates a MenuController. If |blocking| is true a nested message loop is |
| 315 // started in |Run|. | 314 // started in |Run|. |
| 316 MenuController(bool blocking, | 315 MenuController(bool blocking, |
| 317 internal::MenuControllerDelegate* delegate); | 316 internal::MenuControllerDelegate* delegate); |
| 318 | 317 |
| 319 ~MenuController() override; | 318 ~MenuController() override; |
| 320 | 319 |
| 321 // Runs the platform specific bits of the message loop. If |nested_menu| is | 320 // Runs the platform specific bits of the message loop. |
| 322 // true we're being asked to run a menu from within a menu (eg a context | 321 void RunMessageLoop(); |
| 323 // menu). | |
| 324 void RunMessageLoop(bool nested_menu); | |
| 325 | 322 |
| 326 // Invokes AcceleratorPressed() on the hot tracked view if there is one. | 323 // Invokes AcceleratorPressed() on the hot tracked view if there is one. |
| 327 // Returns true if AcceleratorPressed() was invoked. | 324 // Returns true if AcceleratorPressed() was invoked. |
| 328 bool SendAcceleratorToHotTrackedView(); | 325 bool SendAcceleratorToHotTrackedView(); |
| 329 | 326 |
| 330 void UpdateInitialLocation(const gfx::Rect& bounds, | 327 void UpdateInitialLocation(const gfx::Rect& bounds, |
| 331 MenuAnchorPosition position, | 328 MenuAnchorPosition position, |
| 332 bool context_menu); | 329 bool context_menu); |
| 333 | 330 |
| 334 // Invoked when the user accepts the selected item. This is only used | 331 // Invoked when the user accepts the selected item. This is only used |
| (...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 693 // pressed), subsequent events (like dragging) should also go to it, even if | 690 // pressed), subsequent events (like dragging) should also go to it, even if |
| 694 // the mouse is no longer over the view. | 691 // the mouse is no longer over the view. |
| 695 MenuHostRootView* current_mouse_event_target_; | 692 MenuHostRootView* current_mouse_event_target_; |
| 696 | 693 |
| 697 // A mask of the EventFlags for the mouse buttons currently pressed. | 694 // A mask of the EventFlags for the mouse buttons currently pressed. |
| 698 int current_mouse_pressed_state_; | 695 int current_mouse_pressed_state_; |
| 699 | 696 |
| 700 std::unique_ptr<MenuMessageLoop> message_loop_; | 697 std::unique_ptr<MenuMessageLoop> message_loop_; |
| 701 | 698 |
| 702 #if defined(USE_AURA) | 699 #if defined(USE_AURA) |
| 703 std::unique_ptr<MenuKeyEventHandler> key_event_handler_; | 700 std::unique_ptr<MenuPreTargetHandler> menu_pre_target_handler_; |
| 704 #endif | 701 #endif |
| 705 | 702 |
| 706 DISALLOW_COPY_AND_ASSIGN(MenuController); | 703 DISALLOW_COPY_AND_ASSIGN(MenuController); |
| 707 }; | 704 }; |
| 708 | 705 |
| 709 } // namespace views | 706 } // namespace views |
| 710 | 707 |
| 711 #endif // UI_VIEWS_CONTROLS_MENU_MENU_CONTROLLER_H_ | 708 #endif // UI_VIEWS_CONTROLS_MENU_MENU_CONTROLLER_H_ |
| OLD | NEW |