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

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

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 | « ui/views/controls/menu/menu_controller.h ('k') | ui/views/controls/menu/menu_controller_unittest.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.cc
diff --git a/ui/views/controls/menu/menu_controller.cc b/ui/views/controls/menu/menu_controller.cc
index 9c0a30130cdc9406170648e7926926233b8659f2..2d308911c3c998bff0279d4f552fdb64dd34d9cc 100644
--- a/ui/views/controls/menu/menu_controller.cc
+++ b/ui/views/controls/menu/menu_controller.cc
@@ -778,6 +778,19 @@ bool MenuController::OnMouseWheel(SubmenuView* source,
void MenuController::OnGestureEvent(SubmenuView* source,
ui::GestureEvent* event) {
+#if !defined(OS_MACOSX)
+ if (send_gesture_events_to_owner()) {
+ DCHECK(owner());
+ event->ConvertLocationToTarget(source->GetWidget()->GetNativeWindow(),
+ owner()->GetNativeWindow());
+ owner()->OnGestureEvent(event);
+ // Reset |send_gesture_events_to_owner_| when the first gesture ends.
+ if (event->type() == ui::ET_GESTURE_END)
+ send_gesture_events_to_owner_ = false;
+ return;
+ }
+#endif // !defined(OS_MACOSX)
+
MenuHostRootView* root_view = GetRootView(source, event->location());
if (root_view) {
// Reset hot-tracking if a different view is getting a touch event.
@@ -829,7 +842,7 @@ void MenuController::OnGestureEvent(SubmenuView* source,
}
if (event->stopped_propagation())
- return;
+ return;
if (!part.submenu)
return;
@@ -1386,27 +1399,8 @@ void MenuController::OnKeyDown(ui::KeyboardCode key_code) {
MenuController::MenuController(bool blocking,
internal::MenuControllerDelegate* delegate)
: blocking_run_(blocking),
- showing_(false),
- exit_type_(EXIT_NONE),
- did_capture_(false),
- result_(NULL),
- accept_event_flags_(0),
- drop_target_(NULL),
- drop_position_(MenuDelegate::DROP_UNKNOWN),
- owner_(NULL),
- possible_drag_(false),
- drag_in_progress_(false),
- did_initiate_drag_(false),
- valid_drop_coordinates_(false),
- last_drop_operation_(MenuDelegate::DROP_UNKNOWN),
- showing_submenu_(false),
active_mouse_view_tracker_(base::MakeUnique<ViewTracker>()),
- hot_button_(nullptr),
- delegate_(delegate),
- is_combobox_(false),
- item_selected_by_touch_(false),
- current_mouse_event_target_(nullptr),
- current_mouse_pressed_state_(0) {
+ delegate_(delegate) {
delegate_stack_.push_back(delegate_);
active_instance_ = this;
}
« no previous file with comments | « ui/views/controls/menu/menu_controller.h ('k') | ui/views/controls/menu/menu_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698