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

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

Issue 378333003: Allow menus to stay open during a child view's drag and drop (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 5 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
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 d5b5a84e8f1b707fee0e9cf27f48c8fd0dc5d789..58fab32fce6df30deb5420f8dc5977c5b5e6ba97 100644
--- a/ui/views/controls/menu/menu_controller.cc
+++ b/ui/views/controls/menu/menu_controller.cc
@@ -793,6 +793,18 @@ void MenuController::UpdateSubmenuSelection(SubmenuView* submenu) {
}
}
+void MenuController::OnDragWillStart() {
sky 2014/07/14 15:19:05 Position should match that of header.
Devlin 2014/07/16 16:00:45 Whoops! Done.
+ drag_in_progress_ = true;
sky 2014/07/14 15:19:05 Before this add a DCHECK(!drag_in_progress_).
Devlin 2014/07/16 16:00:45 Done.
+}
+
+void MenuController::OnDragComplete(bool should_close) {
+ drag_in_progress_ = false;
sky 2014/07/14 15:19:05 And DCHECK(drag_in_progress_)
Devlin 2014/07/16 16:00:45 Done.
+ if (GetActiveInstance() == this && showing_ && should_close) {
sky 2014/07/14 15:19:05 move the showing_ and should_close checks first.
Devlin 2014/07/16 16:00:45 Done.
+ CloseAllNestedMenus();
+ Cancel(EXIT_ALL);
+ }
+}
+
void MenuController::OnWidgetDestroying(Widget* widget) {
DCHECK_EQ(owner_, widget);
owner_->RemoveObserver(this);
@@ -970,19 +982,9 @@ void MenuController::StartDrag(SubmenuView* source,
&data);
StopScrolling();
int drag_ops = item->GetDelegate()->GetDragOperations(item);
- drag_in_progress_ = true;
// TODO(varunjain): Properly determine and send DRAG_EVENT_SOURCE below.
item->GetWidget()->RunShellDrag(NULL, data, widget_loc, drag_ops,
ui::DragDropTypes::DRAG_EVENT_SOURCE_MOUSE);
- drag_in_progress_ = false;
-
- if (GetActiveInstance() == this) {
- if (showing_) {
- // We're still showing, close all menus.
- CloseAllNestedMenus();
- Cancel(EXIT_ALL);
- } // else case, drop was on us.
- } // else case, someone canceled us, don't do anything
}
bool MenuController::OnKeyDown(ui::KeyboardCode key_code) {

Powered by Google App Engine
This is Rietveld 408576698