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

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

Issue 10388056: Fixes drag and drop crash. The problem was when I made (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 7 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') | no next file » | 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 01ace1fbe55a547d2cec03882076cf95c2d693bb..6f439944e6943b94e2f77433eb2f3aaf32fed8cf 100644
--- a/ui/views/controls/menu/menu_controller.cc
+++ b/ui/views/controls/menu/menu_controller.cc
@@ -27,6 +27,7 @@
#if defined(USE_AURA)
#include "ui/aura/client/dispatcher_client.h"
+#include "ui/aura/client/drag_drop_client.h"
#include "ui/aura/env.h"
#include "ui/aura/root_window.h"
#endif
@@ -320,9 +321,9 @@ MenuItemView* MenuController::Run(Widget* parent,
message_loop_depth_++;
DCHECK_LE(message_loop_depth_, 2);
#if defined(USE_AURA)
- aura::client::GetDispatcherClient(
- parent->GetNativeWindow()->GetRootWindow())->
- RunWithDispatcher(this, parent->GetNativeWindow(), true);
+ root_window_ = parent->GetNativeWindow()->GetRootWindow();
+ aura::client::GetDispatcherClient(root_window_)->
+ RunWithDispatcher(this, parent->GetNativeWindow(), true);
#else
{
MessageLoopForUI* loop = MessageLoopForUI::current();
@@ -1025,6 +1026,9 @@ MenuController::MenuController(bool blocking,
drop_target_(NULL),
drop_position_(MenuDelegate::DROP_UNKNOWN),
owner_(NULL),
+#if defined(USE_AURA)
+ root_window_(NULL),
+#endif
possible_drag_(false),
drag_in_progress_(false),
valid_drop_coordinates_(false),
@@ -1990,7 +1994,18 @@ void MenuController::SetExitType(ExitType type) {
//
// It's safe to invoke QuitNow multiple times, it only effects the current
// loop.
- if (exit_type_ != EXIT_NONE && message_loop_depth_)
+ bool quit_now = exit_type_ != EXIT_NONE && message_loop_depth_;
+
+#if defined(USE_AURA)
+ // On aura drag and drop runs a nested messgae loop too. If drag and drop is
+ // active and we quit we would prematurely cancel drag and drop, which we
+ // don't want.
+ if (aura::client::GetDragDropClient(root_window_) &&
+ aura::client::GetDragDropClient(root_window_)->IsDragDropInProgress())
+ quit_now = false;
+#endif
+
+ if (quit_now)
MessageLoop::current()->QuitNow();
}
« no previous file with comments | « ui/views/controls/menu/menu_controller.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698