| 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 "build/build_config.h" | 8 #include "build/build_config.h" |
| 9 | 9 |
| 10 #include <list> | 10 #include <list> |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 #include "ui/views/controls/menu/menu_delegate.h" | 23 #include "ui/views/controls/menu/menu_delegate.h" |
| 24 #include "ui/views/widget/widget_observer.h" | 24 #include "ui/views/widget/widget_observer.h" |
| 25 | 25 |
| 26 namespace base { | 26 namespace base { |
| 27 class MessagePumpDispatcher; | 27 class MessagePumpDispatcher; |
| 28 } | 28 } |
| 29 namespace gfx { | 29 namespace gfx { |
| 30 class Screen; | 30 class Screen; |
| 31 } | 31 } |
| 32 namespace ui { | 32 namespace ui { |
| 33 class NativeTheme; | |
| 34 class OSExchangeData; | 33 class OSExchangeData; |
| 35 class ScopedEventDispatcher; | 34 class ScopedEventDispatcher; |
| 36 } | 35 } |
| 37 namespace views { | 36 namespace views { |
| 38 | 37 |
| 39 class MenuButton; | 38 class MenuButton; |
| 40 class MenuHostRootView; | 39 class MenuHostRootView; |
| 41 class MenuItemView; | 40 class MenuItemView; |
| 42 class MenuMessageLoop; | 41 class MenuMessageLoop; |
| 43 class MouseEvent; | 42 class MouseEvent; |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 296 | 295 |
| 297 void SetSelectionOnPointerDown(SubmenuView* source, | 296 void SetSelectionOnPointerDown(SubmenuView* source, |
| 298 const ui::LocatedEvent& event); | 297 const ui::LocatedEvent& event); |
| 299 void StartDrag(SubmenuView* source, const gfx::Point& location); | 298 void StartDrag(SubmenuView* source, const gfx::Point& location); |
| 300 | 299 |
| 301 // Key processing. | 300 // Key processing. |
| 302 void OnKeyDown(ui::KeyboardCode key_code); | 301 void OnKeyDown(ui::KeyboardCode key_code); |
| 303 | 302 |
| 304 // Creates a MenuController. If |blocking| is true a nested message loop is | 303 // Creates a MenuController. If |blocking| is true a nested message loop is |
| 305 // started in |Run|. | 304 // started in |Run|. |
| 306 MenuController(ui::NativeTheme* theme, | 305 MenuController(bool blocking, |
| 307 bool blocking, | |
| 308 internal::MenuControllerDelegate* delegate); | 306 internal::MenuControllerDelegate* delegate); |
| 309 | 307 |
| 310 ~MenuController() override; | 308 ~MenuController() override; |
| 311 | 309 |
| 312 // Runs the platform specific bits of the message loop. If |nested_menu| is | 310 // Runs the platform specific bits of the message loop. If |nested_menu| is |
| 313 // true we're being asked to run a menu from within a menu (eg a context | 311 // true we're being asked to run a menu from within a menu (eg a context |
| 314 // menu). | 312 // menu). |
| 315 void RunMessageLoop(bool nested_menu); | 313 void RunMessageLoop(bool nested_menu); |
| 316 | 314 |
| 317 // Invokes AcceleratorPressed() on the hot tracked view if there is one. | 315 // Invokes AcceleratorPressed() on the hot tracked view if there is one. |
| (...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 629 // ViewStorage id used to store the view mouse drag events are forwarded to. | 627 // ViewStorage id used to store the view mouse drag events are forwarded to. |
| 630 // See UpdateActiveMouseView() for details. | 628 // See UpdateActiveMouseView() for details. |
| 631 const int active_mouse_view_id_; | 629 const int active_mouse_view_id_; |
| 632 | 630 |
| 633 internal::MenuControllerDelegate* delegate_; | 631 internal::MenuControllerDelegate* delegate_; |
| 634 | 632 |
| 635 // How deep we are in nested message loops. This should be at most 2 (when | 633 // How deep we are in nested message loops. This should be at most 2 (when |
| 636 // showing a context menu from a menu). | 634 // showing a context menu from a menu). |
| 637 int message_loop_depth_; | 635 int message_loop_depth_; |
| 638 | 636 |
| 639 views::MenuConfig menu_config_; | |
| 640 | |
| 641 // The timestamp of the event which closed the menu - or 0 otherwise. | 637 // The timestamp of the event which closed the menu - or 0 otherwise. |
| 642 base::TimeDelta closing_event_time_; | 638 base::TimeDelta closing_event_time_; |
| 643 | 639 |
| 644 // Time when the menu is first shown. | 640 // Time when the menu is first shown. |
| 645 base::TimeTicks menu_start_time_; | 641 base::TimeTicks menu_start_time_; |
| 646 | 642 |
| 647 // If a mouse press triggered this menu, this will have its location (in | 643 // If a mouse press triggered this menu, this will have its location (in |
| 648 // screen coordinates). Otherwise this will be (0, 0). | 644 // screen coordinates). Otherwise this will be (0, 0). |
| 649 gfx::Point menu_start_mouse_press_loc_; | 645 gfx::Point menu_start_mouse_press_loc_; |
| 650 | 646 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 665 int current_mouse_pressed_state_; | 661 int current_mouse_pressed_state_; |
| 666 | 662 |
| 667 scoped_ptr<MenuMessageLoop> message_loop_; | 663 scoped_ptr<MenuMessageLoop> message_loop_; |
| 668 | 664 |
| 669 DISALLOW_COPY_AND_ASSIGN(MenuController); | 665 DISALLOW_COPY_AND_ASSIGN(MenuController); |
| 670 }; | 666 }; |
| 671 | 667 |
| 672 } // namespace views | 668 } // namespace views |
| 673 | 669 |
| 674 #endif // UI_VIEWS_CONTROLS_MENU_MENU_CONTROLLER_H_ | 670 #endif // UI_VIEWS_CONTROLS_MENU_MENU_CONTROLLER_H_ |
| OLD | NEW |