| 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> |
| 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/linked_ptr.h" | 17 #include "base/memory/linked_ptr.h" |
| 18 #include "base/timer/timer.h" | 18 #include "base/timer/timer.h" |
| 19 #include "build/build_config.h" | 19 #include "build/build_config.h" |
| 20 #include "ui/events/event.h" | 20 #include "ui/events/event.h" |
| 21 #include "ui/events/event_constants.h" | 21 #include "ui/events/event_constants.h" |
| 22 #include "ui/events/platform/platform_event_dispatcher.h" | 22 #include "ui/events/platform/platform_event_dispatcher.h" |
| 23 #include "ui/views/controls/button/menu_button.h" | 23 #include "ui/views/controls/button/menu_button.h" |
| 24 #include "ui/views/controls/menu/menu_config.h" | 24 #include "ui/views/controls/menu/menu_config.h" |
| 25 #include "ui/views/controls/menu/menu_delegate.h" | 25 #include "ui/views/controls/menu/menu_delegate.h" |
| 26 #include "ui/views/widget/widget_observer.h" | 26 #include "ui/views/widget/widget_observer.h" |
| 27 | 27 |
| 28 #if defined(USE_AURA) |
| 29 namespace aura { |
| 30 namespace client { |
| 31 class ActivationChangeObserver; |
| 32 } // namespace client |
| 33 } // namespace aura |
| 34 #endif // defined(USE_AURA) |
| 35 |
| 28 namespace ui { | 36 namespace ui { |
| 29 class OSExchangeData; | 37 class OSExchangeData; |
| 30 class ScopedEventDispatcher; | 38 class ScopedEventDispatcher; |
| 31 } | 39 } |
| 32 namespace views { | 40 namespace views { |
| 33 | 41 |
| 34 class MenuButton; | 42 class MenuButton; |
| 35 class MenuHostRootView; | 43 class MenuHostRootView; |
| 36 class MenuItemView; | 44 class MenuItemView; |
| 37 class MenuMessageLoop; | 45 class MenuMessageLoop; |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 311 // Key processing. | 319 // Key processing. |
| 312 void OnKeyDown(ui::KeyboardCode key_code); | 320 void OnKeyDown(ui::KeyboardCode key_code); |
| 313 | 321 |
| 314 // Creates a MenuController. If |blocking| is true a nested message loop is | 322 // Creates a MenuController. If |blocking| is true a nested message loop is |
| 315 // started in |Run|. | 323 // started in |Run|. |
| 316 MenuController(bool blocking, | 324 MenuController(bool blocking, |
| 317 internal::MenuControllerDelegate* delegate); | 325 internal::MenuControllerDelegate* delegate); |
| 318 | 326 |
| 319 ~MenuController() override; | 327 ~MenuController() override; |
| 320 | 328 |
| 321 // Runs the platform specific bits of the message loop. If |nested_menu| is | 329 // 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 | 330 void RunMessageLoop(); |
| 323 // menu). | |
| 324 void RunMessageLoop(bool nested_menu); | |
| 325 | 331 |
| 326 // Invokes AcceleratorPressed() on the hot tracked view if there is one. | 332 // Invokes AcceleratorPressed() on the hot tracked view if there is one. |
| 327 // Returns true if AcceleratorPressed() was invoked. | 333 // Returns true if AcceleratorPressed() was invoked. |
| 328 bool SendAcceleratorToHotTrackedView(); | 334 bool SendAcceleratorToHotTrackedView(); |
| 329 | 335 |
| 330 void UpdateInitialLocation(const gfx::Rect& bounds, | 336 void UpdateInitialLocation(const gfx::Rect& bounds, |
| 331 MenuAnchorPosition position, | 337 MenuAnchorPosition position, |
| 332 bool context_menu); | 338 bool context_menu); |
| 333 | 339 |
| 334 // Invoked when the user accepts the selected item. This is only used | 340 // 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 | 699 // pressed), subsequent events (like dragging) should also go to it, even if |
| 694 // the mouse is no longer over the view. | 700 // the mouse is no longer over the view. |
| 695 MenuHostRootView* current_mouse_event_target_; | 701 MenuHostRootView* current_mouse_event_target_; |
| 696 | 702 |
| 697 // A mask of the EventFlags for the mouse buttons currently pressed. | 703 // A mask of the EventFlags for the mouse buttons currently pressed. |
| 698 int current_mouse_pressed_state_; | 704 int current_mouse_pressed_state_; |
| 699 | 705 |
| 700 std::unique_ptr<MenuMessageLoop> message_loop_; | 706 std::unique_ptr<MenuMessageLoop> message_loop_; |
| 701 | 707 |
| 702 #if defined(USE_AURA) | 708 #if defined(USE_AURA) |
| 709 std::unique_ptr<aura::client::ActivationChangeObserver> |
| 710 activation_change_observer_; |
| 703 std::unique_ptr<MenuKeyEventHandler> key_event_handler_; | 711 std::unique_ptr<MenuKeyEventHandler> key_event_handler_; |
| 704 #endif | 712 #endif |
| 705 | 713 |
| 706 DISALLOW_COPY_AND_ASSIGN(MenuController); | 714 DISALLOW_COPY_AND_ASSIGN(MenuController); |
| 707 }; | 715 }; |
| 708 | 716 |
| 709 } // namespace views | 717 } // namespace views |
| 710 | 718 |
| 711 #endif // UI_VIEWS_CONTROLS_MENU_MENU_CONTROLLER_H_ | 719 #endif // UI_VIEWS_CONTROLS_MENU_MENU_CONTROLLER_H_ |
| OLD | NEW |