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 <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <list> | 10 #include <list> |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 114 void Cancel(ExitType type); | 114 void Cancel(ExitType type); |
| 115 | 115 |
| 116 // An alternative to Cancel(EXIT_ALL) that can be used with a OneShotTimer. | 116 // An alternative to Cancel(EXIT_ALL) that can be used with a OneShotTimer. |
| 117 void CancelAll() { Cancel(EXIT_ALL); } | 117 void CancelAll() { Cancel(EXIT_ALL); } |
| 118 | 118 |
| 119 // When is_nested_run() this will add a delegate to the stack. The most recent | 119 // When is_nested_run() this will add a delegate to the stack. The most recent |
| 120 // delegate will be notified. It will be removed upon the exiting of the | 120 // delegate will be notified. It will be removed upon the exiting of the |
| 121 // nested menu. Ownership is not taken. | 121 // nested menu. Ownership is not taken. |
| 122 void AddNestedDelegate(internal::MenuControllerDelegate* delegate); | 122 void AddNestedDelegate(internal::MenuControllerDelegate* delegate); |
| 123 | 123 |
| 124 static void SetDoCancel(bool do_cancel) { do_cancel_ = do_cancel; } | |
| 125 | |
| 126 static bool DoCancel() { return do_cancel_; } | |
| 127 | |
| 124 // Returns the current exit type. This returns a value other than EXIT_NONE if | 128 // Returns the current exit type. This returns a value other than EXIT_NONE if |
| 125 // the menu is being canceled. | 129 // the menu is being canceled. |
| 126 ExitType exit_type() const { return exit_type_; } | 130 ExitType exit_type() const { return exit_type_; } |
| 127 | 131 |
| 128 // Returns the time from the event which closed the menu - or 0. | 132 // Returns the time from the event which closed the menu - or 0. |
| 129 base::TimeTicks closing_event_time() const { return closing_event_time_; } | 133 base::TimeTicks closing_event_time() const { return closing_event_time_; } |
| 130 | 134 |
| 131 void set_is_combobox(bool is_combobox) { is_combobox_ = is_combobox; } | 135 void set_is_combobox(bool is_combobox) { is_combobox_ = is_combobox; } |
| 132 | 136 |
| 133 // Various events, forwarded from the submenu. | 137 // Various events, forwarded from the submenu. |
| (...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 660 base::TimeTicks menu_start_time_; | 664 base::TimeTicks menu_start_time_; |
| 661 | 665 |
| 662 // If a mouse press triggered this menu, this will have its location (in | 666 // If a mouse press triggered this menu, this will have its location (in |
| 663 // screen coordinates). Otherwise this will be (0, 0). | 667 // screen coordinates). Otherwise this will be (0, 0). |
| 664 gfx::Point menu_start_mouse_press_loc_; | 668 gfx::Point menu_start_mouse_press_loc_; |
| 665 | 669 |
| 666 // Controls behavior differences between a combobox and other types of menu | 670 // Controls behavior differences between a combobox and other types of menu |
| 667 // (like a context menu). | 671 // (like a context menu). |
| 668 bool is_combobox_; | 672 bool is_combobox_; |
| 669 | 673 |
| 674 // In order to make item can be dragged after context menu is opened. Cannot | |
| 675 // cancel existing touch events. | |
|
xiyuan
2017/05/15 19:20:52
Can we make the document from the perspective of m
minch1
2017/05/16 22:13:39
Done.
| |
| 676 static bool do_cancel_; | |
|
xiyuan
2017/05/15 19:20:52
Why this needs to be static? We already have a sta
minch1
2017/05/15 22:16:34
But in shelf_view.cc where where we want to set th
xiyuan
2017/05/15 22:41:10
How about adding a new MenuRunner::RunTypes mask a
minch1
2017/05/16 22:13:39
Done.
| |
| 677 | |
| 670 // Set to true if the menu item was selected by touch. | 678 // Set to true if the menu item was selected by touch. |
| 671 bool item_selected_by_touch_; | 679 bool item_selected_by_touch_; |
| 672 | 680 |
| 673 // During mouse event handling, this is the RootView to forward mouse events | 681 // During mouse event handling, this is the RootView to forward mouse events |
| 674 // to. We need this, because if we forward one event to it (e.g., mouse | 682 // to. We need this, because if we forward one event to it (e.g., mouse |
| 675 // pressed), subsequent events (like dragging) should also go to it, even if | 683 // pressed), subsequent events (like dragging) should also go to it, even if |
| 676 // the mouse is no longer over the view. | 684 // the mouse is no longer over the view. |
| 677 MenuHostRootView* current_mouse_event_target_; | 685 MenuHostRootView* current_mouse_event_target_; |
| 678 | 686 |
| 679 // A mask of the EventFlags for the mouse buttons currently pressed. | 687 // A mask of the EventFlags for the mouse buttons currently pressed. |
| 680 int current_mouse_pressed_state_; | 688 int current_mouse_pressed_state_; |
| 681 | 689 |
| 682 #if defined(USE_AURA) | 690 #if defined(USE_AURA) |
| 683 std::unique_ptr<MenuPreTargetHandler> menu_pre_target_handler_; | 691 std::unique_ptr<MenuPreTargetHandler> menu_pre_target_handler_; |
| 684 #endif | 692 #endif |
| 685 | 693 |
| 686 DISALLOW_COPY_AND_ASSIGN(MenuController); | 694 DISALLOW_COPY_AND_ASSIGN(MenuController); |
| 687 }; | 695 }; |
| 688 | 696 |
| 689 } // namespace views | 697 } // namespace views |
| 690 | 698 |
| 691 #endif // UI_VIEWS_CONTROLS_MENU_MENU_CONTROLLER_H_ | 699 #endif // UI_VIEWS_CONTROLS_MENU_MENU_CONTROLLER_H_ |
| OLD | NEW |