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

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

Issue 2433933007: Fix opening App Menu after Bookmarks Drag (Closed)
Patch Set: Fix additional drag shutdown orders Created 4 years, 2 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 | « no previous file | 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 29996dc50595c0d6e40e1c74da790c5840ca7d2c..7281b18a38ce8528e1459f182c0bc37fe674af0d 100644
--- a/ui/views/controls/menu/menu_controller.cc
+++ b/ui/views/controls/menu/menu_controller.cc
@@ -537,8 +537,14 @@ void MenuController::Cancel(ExitType type) {
// teardown of the platform specific drag-and-drop Widget. Do not shutdown
// while dragging, leave the Widget hidden until drag-and-drop has completed,
// at which point all menus will be destroyed.
+ //
+ // If |type| is EXIT_ALL we update the state of the menu to not showing. So
+ // that during the completion of a drag we are not incorrectly reporting the
+ // visual state.
if (!drag_in_progress_)
ExitAsyncRun();
+ else if (type == EXIT_ALL)
+ showing_ = false;
}
void MenuController::AddNestedDelegate(
@@ -1021,11 +1027,23 @@ void MenuController::OnDragComplete(bool should_close) {
// the event target.
current_mouse_pressed_state_ = 0;
current_mouse_event_target_ = nullptr;
- if (showing_ && should_close && GetActiveInstance() == this) {
- CloseAllNestedMenus();
- Cancel(EXIT_ALL);
- } else if (async_run_) {
- ExitAsyncRun();
+
+ // Only attempt to close if the MenuHost said to.
+ if (should_close) {
+ if (showing_) {
+ // Close showing widgets.
+ if (GetActiveInstance() == this) {
+ CloseAllNestedMenus();
+ Cancel(EXIT_ALL);
+ }
+ // The above may have deleted us. If not perform a full shutdown.
+ if (GetActiveInstance() == this)
+ ExitAsyncRun();
+ } else if (exit_type_ == EXIT_ALL) {
+ // We may have been canceled during the drag. If so we still need to fully
+ // shutdown.
+ ExitAsyncRun();
+ }
}
}
« no previous file with comments | « no previous file | ui/views/controls/menu/menu_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698