Chromium Code Reviews| 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 <stddef.h> | 10 #include <stddef.h> |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 228 // Direction for IncrementSelection and FindInitialSelectableMenuItem. | 228 // Direction for IncrementSelection and FindInitialSelectableMenuItem. |
| 229 enum SelectionIncrementDirectionType { | 229 enum SelectionIncrementDirectionType { |
| 230 // Navigate the menu up. | 230 // Navigate the menu up. |
| 231 INCREMENT_SELECTION_UP, | 231 INCREMENT_SELECTION_UP, |
| 232 | 232 |
| 233 // Navigate the menu down. | 233 // Navigate the menu down. |
| 234 INCREMENT_SELECTION_DOWN, | 234 INCREMENT_SELECTION_DOWN, |
| 235 }; | 235 }; |
| 236 | 236 |
| 237 // Tracks selection information. | 237 // Tracks selection information. |
| 238 struct State { | 238 struct State { |
|
sky
2016/03/08 16:45:37
This struct is meant to track state related to run
varkha
2016/03/23 21:16:01
Done.
| |
| 239 State(); | 239 State(); |
| 240 State(const State& other); | 240 State(const State& other); |
| 241 ~State(); | 241 ~State(); |
| 242 | 242 |
| 243 // The selected menu item. | 243 // The selected menu item. |
| 244 MenuItemView* item; | 244 MenuItemView* item; |
| 245 | 245 |
| 246 // If item has a submenu this indicates if the submenu is showing. | 246 // If item has a submenu this indicates if the submenu is showing. |
| 247 bool submenu_open; | 247 bool submenu_open; |
| 248 | 248 |
| (...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 551 MenuItemView* ExitMenuRun(); | 551 MenuItemView* ExitMenuRun(); |
| 552 | 552 |
| 553 // Handles the mouse location event on the submenu |source|. | 553 // Handles the mouse location event on the submenu |source|. |
| 554 void HandleMouseLocation(SubmenuView* source, | 554 void HandleMouseLocation(SubmenuView* source, |
| 555 const gfx::Point& mouse_location); | 555 const gfx::Point& mouse_location); |
| 556 | 556 |
| 557 // Sets hot-tracked state to the first focusable descendant view of |item|. | 557 // Sets hot-tracked state to the first focusable descendant view of |item|. |
| 558 void SetInitialHotTrackedView(MenuItemView* item, | 558 void SetInitialHotTrackedView(MenuItemView* item, |
| 559 SelectionIncrementDirectionType direction); | 559 SelectionIncrementDirectionType direction); |
| 560 | 560 |
| 561 // Updates the current |hot_button_| and its hot tracked state. | |
| 562 void SetHotTrackedButton(CustomButton* hot_button); | |
| 563 | |
| 564 // The active instance. | 561 // The active instance. |
| 565 static MenuController* active_instance_; | 562 static MenuController* active_instance_; |
| 566 | 563 |
| 567 // If true, Run blocks. If false, Run doesn't block and this is used for | 564 // If true, Run blocks. If false, Run doesn't block and this is used for |
| 568 // drag and drop. Note that the semantics for drag and drop are slightly | 565 // drag and drop. Note that the semantics for drag and drop are slightly |
| 569 // different: cancel timer is kicked off any time the drag moves outside the | 566 // different: cancel timer is kicked off any time the drag moves outside the |
| 570 // menu, mouse events do nothing... | 567 // menu, mouse events do nothing... |
| 571 bool blocking_run_; | 568 bool blocking_run_; |
| 572 | 569 |
| 573 // If true, we're showing. | 570 // If true, we're showing. |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 652 // underway. | 649 // underway. |
| 653 scoped_ptr<MenuScrollTask> scroll_task_; | 650 scoped_ptr<MenuScrollTask> scroll_task_; |
| 654 | 651 |
| 655 // The lock to keep the menu button pressed while a menu is visible. | 652 // The lock to keep the menu button pressed while a menu is visible. |
| 656 scoped_ptr<MenuButton::PressedLock> pressed_lock_; | 653 scoped_ptr<MenuButton::PressedLock> pressed_lock_; |
| 657 | 654 |
| 658 // ViewStorage id used to store the view mouse drag events are forwarded to. | 655 // ViewStorage id used to store the view mouse drag events are forwarded to. |
| 659 // See UpdateActiveMouseView() for details. | 656 // See UpdateActiveMouseView() for details. |
| 660 const int active_mouse_view_id_; | 657 const int active_mouse_view_id_; |
| 661 | 658 |
| 662 // Current hot tracked child button if any. | |
| 663 CustomButton* hot_button_; | |
| 664 | |
| 665 internal::MenuControllerDelegate* delegate_; | 659 internal::MenuControllerDelegate* delegate_; |
| 666 | 660 |
| 667 // How deep we are in nested message loops. This should be at most 2 (when | 661 // How deep we are in nested message loops. This should be at most 2 (when |
| 668 // showing a context menu from a menu). | 662 // showing a context menu from a menu). |
| 669 int message_loop_depth_; | 663 int message_loop_depth_; |
| 670 | 664 |
| 671 // The timestamp of the event which closed the menu - or 0 otherwise. | 665 // The timestamp of the event which closed the menu - or 0 otherwise. |
| 672 base::TimeDelta closing_event_time_; | 666 base::TimeDelta closing_event_time_; |
| 673 | 667 |
| 674 // Time when the menu is first shown. | 668 // Time when the menu is first shown. |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 703 #if defined(USE_AURA) | 697 #if defined(USE_AURA) |
| 704 scoped_ptr<MenuKeyEventHandler> key_event_handler_; | 698 scoped_ptr<MenuKeyEventHandler> key_event_handler_; |
| 705 #endif | 699 #endif |
| 706 | 700 |
| 707 DISALLOW_COPY_AND_ASSIGN(MenuController); | 701 DISALLOW_COPY_AND_ASSIGN(MenuController); |
| 708 }; | 702 }; |
| 709 | 703 |
| 710 } // namespace views | 704 } // namespace views |
| 711 | 705 |
| 712 #endif // UI_VIEWS_CONTROLS_MENU_MENU_CONTROLLER_H_ | 706 #endif // UI_VIEWS_CONTROLS_MENU_MENU_CONTROLLER_H_ |
| OLD | NEW |