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 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 491 bool (*match_function)(MenuItemView* menu, base::char16 mnemonic)); | 491 bool (*match_function)(MenuItemView* menu, base::char16 mnemonic)); |
| 492 | 492 |
| 493 // Selects or accepts the appropriate menu item based on |details|. | 493 // Selects or accepts the appropriate menu item based on |details|. |
| 494 void AcceptOrSelect(MenuItemView* parent, const SelectByCharDetails& details); | 494 void AcceptOrSelect(MenuItemView* parent, const SelectByCharDetails& details); |
| 495 | 495 |
| 496 // Selects by mnemonic, and if that doesn't work tries the first character of | 496 // Selects by mnemonic, and if that doesn't work tries the first character of |
| 497 // the title. | 497 // the title. |
| 498 void SelectByChar(base::char16 key); | 498 void SelectByChar(base::char16 key); |
| 499 | 499 |
| 500 // For Windows and Aura we repost an event which dismisses the |source| menu. | 500 // For Windows and Aura we repost an event which dismisses the |source| menu. |
| 501 // The menu is also canceled dependent on the target of the event. The event | 501 // The menu is also canceled dependent on the target of the event. The event |
|
Peter Kasting
2016/02/24 02:04:49
Nit: is also canceled dependent -> may also be can
varkha
2016/02/24 05:52:10
Done.
| |
| 502 // is then reprocessed to cause its result if the menu had not been present. | 502 // is then reprocessed to cause its result if the menu had not been present. |
|
Peter Kasting
2016/02/24 02:04:49
Nit: The event is then reprocessed to cause its re
varkha
2016/02/24 05:52:10
Done.
| |
| 503 // On non-aura Windows, a new mouse event is generated and posted to | 503 // On non-aura Windows, a new mouse event is generated and posted to |
| 504 // the window (if there is one) at the location of the event. On | 504 // the window (if there is one) at the location of the event. On |
| 505 // aura, the event is reposted on the RootWindow. | 505 // aura, the event is reposted on the RootWindow. |
| 506 void RepostEventAndCancel(SubmenuView* source, const ui::LocatedEvent* event); | 506 void RepostEventAndCancel(SubmenuView* source, const ui::LocatedEvent* event); |
| 507 | 507 |
| 508 // Sets the drop target to new_item. | 508 // Sets the drop target to new_item. |
| 509 void SetDropMenuItem(MenuItemView* new_item, | 509 void SetDropMenuItem(MenuItemView* new_item, |
| 510 MenuDelegate::DropPosition position); | 510 MenuDelegate::DropPosition position); |
| 511 | 511 |
| 512 // Starts/stops scrolling as appropriate. part gives the part the mouse is | 512 // Starts/stops scrolling as appropriate. part gives the part the mouse is |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 550 void ExitAsyncRun(); | 550 void ExitAsyncRun(); |
| 551 | 551 |
| 552 // Performs the teardown of the menu launched by Run(). The selected item is | 552 // Performs the teardown of the menu launched by Run(). The selected item is |
| 553 // returned. | 553 // returned. |
| 554 MenuItemView* ExitMenuRun(); | 554 MenuItemView* ExitMenuRun(); |
| 555 | 555 |
| 556 // Handles the mouse location event on the submenu |source|. | 556 // Handles the mouse location event on the submenu |source|. |
| 557 void HandleMouseLocation(SubmenuView* source, | 557 void HandleMouseLocation(SubmenuView* source, |
| 558 const gfx::Point& mouse_location); | 558 const gfx::Point& mouse_location); |
| 559 | 559 |
| 560 // Updates the current |hot_button_| and its hot tracked state. | |
| 561 void SetHotTrackedButton(CustomButton* hot_button); | |
| 562 | |
| 563 // Sets hot-tracked state to the first focusable descendant view of |item|. | |
| 564 void SetInitialHotTrackedView(MenuItemView* item, | |
| 565 SelectionIncrementDirectionType direction); | |
| 566 | |
| 560 // The active instance. | 567 // The active instance. |
| 561 static MenuController* active_instance_; | 568 static MenuController* active_instance_; |
| 562 | 569 |
| 563 // If true, Run blocks. If false, Run doesn't block and this is used for | 570 // If true, Run blocks. If false, Run doesn't block and this is used for |
| 564 // drag and drop. Note that the semantics for drag and drop are slightly | 571 // drag and drop. Note that the semantics for drag and drop are slightly |
| 565 // different: cancel timer is kicked off any time the drag moves outside the | 572 // different: cancel timer is kicked off any time the drag moves outside the |
| 566 // menu, mouse events do nothing... | 573 // menu, mouse events do nothing... |
| 567 bool blocking_run_; | 574 bool blocking_run_; |
| 568 | 575 |
| 569 // If true, we're showing. | 576 // If true, we're showing. |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 648 // underway. | 655 // underway. |
| 649 scoped_ptr<MenuScrollTask> scroll_task_; | 656 scoped_ptr<MenuScrollTask> scroll_task_; |
| 650 | 657 |
| 651 // The lock to keep the menu button pressed while a menu is visible. | 658 // The lock to keep the menu button pressed while a menu is visible. |
| 652 scoped_ptr<MenuButton::PressedLock> pressed_lock_; | 659 scoped_ptr<MenuButton::PressedLock> pressed_lock_; |
| 653 | 660 |
| 654 // ViewStorage id used to store the view mouse drag events are forwarded to. | 661 // ViewStorage id used to store the view mouse drag events are forwarded to. |
| 655 // See UpdateActiveMouseView() for details. | 662 // See UpdateActiveMouseView() for details. |
| 656 const int active_mouse_view_id_; | 663 const int active_mouse_view_id_; |
| 657 | 664 |
| 665 // Current hot tracked view if any. | |
| 666 CustomButton* hot_button_; | |
| 667 | |
| 658 internal::MenuControllerDelegate* delegate_; | 668 internal::MenuControllerDelegate* delegate_; |
| 659 | 669 |
| 660 // How deep we are in nested message loops. This should be at most 2 (when | 670 // How deep we are in nested message loops. This should be at most 2 (when |
| 661 // showing a context menu from a menu). | 671 // showing a context menu from a menu). |
| 662 int message_loop_depth_; | 672 int message_loop_depth_; |
| 663 | 673 |
| 664 // The timestamp of the event which closed the menu - or 0 otherwise. | 674 // The timestamp of the event which closed the menu - or 0 otherwise. |
| 665 base::TimeDelta closing_event_time_; | 675 base::TimeDelta closing_event_time_; |
| 666 | 676 |
| 667 // Time when the menu is first shown. | 677 // Time when the menu is first shown. |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 696 #if defined(USE_AURA) | 706 #if defined(USE_AURA) |
| 697 scoped_ptr<MenuKeyEventHandler> key_event_handler_; | 707 scoped_ptr<MenuKeyEventHandler> key_event_handler_; |
| 698 #endif | 708 #endif |
| 699 | 709 |
| 700 DISALLOW_COPY_AND_ASSIGN(MenuController); | 710 DISALLOW_COPY_AND_ASSIGN(MenuController); |
| 701 }; | 711 }; |
| 702 | 712 |
| 703 } // namespace views | 713 } // namespace views |
| 704 | 714 |
| 705 #endif // UI_VIEWS_CONTROLS_MENU_MENU_CONTROLLER_H_ | 715 #endif // UI_VIEWS_CONTROLS_MENU_MENU_CONTROLLER_H_ |
| OLD | NEW |