Chromium Code Reviews| Index: ui/views/controls/menu/menu_controller.h |
| diff --git a/ui/views/controls/menu/menu_controller.h b/ui/views/controls/menu/menu_controller.h |
| index 16ac2d4bd9c3a746d667f5c2c41e45d186e6fe61..7c7c1e912c23886f137ceef2d8e3140a1ae71b2b 100644 |
| --- a/ui/views/controls/menu/menu_controller.h |
| +++ b/ui/views/controls/menu/menu_controller.h |
| @@ -102,6 +102,15 @@ class VIEWS_EXPORT MenuController |
| // is no drag in progress. |
| bool did_initiate_drag() const { return did_initiate_drag_; } |
| + bool preserve_current_gesture_for_owner() const { |
| + return preserve_current_gesture_for_owner_; |
| + } |
| + |
| + void set_preserve_current_gesture_for_owner( |
| + bool preserve_current_gesture_for_owner) { |
| + preserve_current_gesture_for_owner_ = preserve_current_gesture_for_owner; |
| + } |
| + |
| // Returns the owner of child windows. |
| // WARNING: this may be NULL. |
| Widget* owner() { return owner_; } |
| @@ -560,14 +569,14 @@ class VIEWS_EXPORT MenuController |
| bool blocking_run_; |
| // If true, we're showing. |
| - bool showing_; |
| + bool showing_ = false; |
| // Indicates what to exit. |
| - ExitType exit_type_; |
| + ExitType exit_type_ = EXIT_NONE; |
| // Whether we did a capture. We do a capture only if we're blocking and |
| // the mouse was down when Run. |
| - bool did_capture_; |
| + bool did_capture_ = false; |
| // As the user drags the mouse around pending_state_ changes immediately. |
| // When the user stops moving/dragging the mouse (or clicks the mouse) |
| @@ -579,10 +588,10 @@ class VIEWS_EXPORT MenuController |
| State state_; |
| // If the user accepted the selection, this is the result. |
| - MenuItemView* result_; |
| + MenuItemView* result_ = nullptr; |
| // The event flags when the user selected the menu. |
| - int accept_event_flags_; |
| + int accept_event_flags_ = 0; |
| // If not empty, it means we're nested. When Run is invoked from within |
| // Run, the current state (state_) is pushed onto menu_stack_. This allows |
| @@ -607,35 +616,35 @@ class VIEWS_EXPORT MenuController |
| base::OneShotTimer cancel_all_timer_; |
| // Drop target. |
| - MenuItemView* drop_target_; |
| - MenuDelegate::DropPosition drop_position_; |
| + MenuItemView* drop_target_ = nullptr; |
| + MenuDelegate::DropPosition drop_position_ = MenuDelegate::DROP_UNKNOWN; |
| // Owner of child windows. |
| // WARNING: this may be NULL. |
| - Widget* owner_; |
| + Widget* owner_ = nullptr; |
| // Indicates a possible drag operation. |
| - bool possible_drag_; |
| + bool possible_drag_ = false; |
| // True when drag operation is in progress. |
| - bool drag_in_progress_; |
| + bool drag_in_progress_ = false; |
| // True when the drag operation in progress was initiated by the |
| // MenuController for a child MenuItemView (as opposed to initiated separately |
| // by a child View). |
| - bool did_initiate_drag_; |
| + bool did_initiate_drag_ = false; |
| // Location the mouse was pressed at. Used to detect d&d. |
| gfx::Point press_pt_; |
| // We get a slew of drag updated messages as the mouse is over us. To avoid |
| // continually processing whether we can drop, we cache the coordinates. |
| - bool valid_drop_coordinates_; |
| + bool valid_drop_coordinates_ = false; |
| gfx::Point drop_pt_; |
| - int last_drop_operation_; |
| + int last_drop_operation_ = MenuDelegate::DROP_UNKNOWN; |
| // If true, we're in the middle of invoking ShowAt on a submenu. |
| - bool showing_submenu_; |
| + bool showing_submenu_ = false; |
| // Task for scrolling the menu. If non-null indicates a scroll is currently |
| // underway. |
| @@ -649,7 +658,7 @@ class VIEWS_EXPORT MenuController |
| const int active_mouse_view_id_; |
| // Current hot tracked child button if any. |
| - CustomButton* hot_button_; |
| + CustomButton* hot_button_ = nullptr; |
| internal::MenuControllerDelegate* delegate_; |
| @@ -665,19 +674,25 @@ class VIEWS_EXPORT MenuController |
| // Controls behavior differences between a combobox and other types of menu |
| // (like a context menu). |
| - bool is_combobox_; |
| + bool is_combobox_ = false; |
| + |
| + // Whether the menu |owner_| needs gesture events. When set to true menu |
|
msw
2017/06/01 20:24:27
nit: "true, the menu"
minch1
2017/06/23 23:13:03
Done.
|
| + // will help preserve the gesture events of the |owner_| and then |
| + // MenuController will forward the gesture events to |owner_| if |
| + // no |ET_GESTURE_END| event been captured. |
| + bool preserve_current_gesture_for_owner_ = false; |
|
msw
2017/06/01 20:24:28
nit: sorry to bikeshed, but how about "send_gestur
minch1
2017/06/23 23:13:03
Done.
|
| // Set to true if the menu item was selected by touch. |
| - bool item_selected_by_touch_; |
| + bool item_selected_by_touch_ = false; |
| // During mouse event handling, this is the RootView to forward mouse events |
| // to. We need this, because if we forward one event to it (e.g., mouse |
| // pressed), subsequent events (like dragging) should also go to it, even if |
| // the mouse is no longer over the view. |
| - MenuHostRootView* current_mouse_event_target_; |
| + MenuHostRootView* current_mouse_event_target_ = nullptr; |
| // A mask of the EventFlags for the mouse buttons currently pressed. |
| - int current_mouse_pressed_state_; |
| + int current_mouse_pressed_state_ = 0; |
| #if defined(USE_AURA) |
| std::unique_ptr<MenuPreTargetHandler> menu_pre_target_handler_; |