Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(789)

Unified Diff: ui/views/controls/menu/menu_controller.h

Issue 2876203003: Make shelf item can be dragged when context menu is opened.
Patch Set: Add widget observer for |owner_| in MenuHost. Created 3 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/shelf/shelf_view.cc ('k') | ui/views/controls/menu/menu_controller.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 2a58d296567008c0443478a6b55a7c31556f288f..1fb212a00525b0dd40da8781cf9ac7a9b71631f7 100644
--- a/ui/views/controls/menu/menu_controller.h
+++ b/ui/views/controls/menu/menu_controller.h
@@ -103,6 +103,14 @@ class VIEWS_EXPORT MenuController
// is no drag in progress.
bool did_initiate_drag() const { return did_initiate_drag_; }
+ bool send_gesture_events_to_owner() const {
+ return send_gesture_events_to_owner_;
+ }
+
+ void set_send_gesture_events_to_owner(bool send_gesture_events_to_owner) {
+ send_gesture_events_to_owner_ = send_gesture_events_to_owner;
+ }
+
// Returns the owner of child windows.
// WARNING: this may be NULL.
Widget* owner() { return owner_; }
@@ -557,14 +565,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)
@@ -576,10 +584,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
@@ -604,35 +612,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.
@@ -646,7 +654,7 @@ class VIEWS_EXPORT MenuController
std::unique_ptr<ViewTracker> active_mouse_view_tracker_;
// Current hot tracked child button if any.
- Button* hot_button_;
+ Button* hot_button_ = nullptr;
internal::MenuControllerDelegate* delegate_;
@@ -662,19 +670,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, the menu
+ // 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 send_gesture_events_to_owner_ = false;
// 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_;
« no previous file with comments | « ash/shelf/shelf_view.cc ('k') | ui/views/controls/menu/menu_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698