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

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

Issue 10703145: Merge 144625 - Close any open menus on activation changes. (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1180/src/
Patch Set: Created 8 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
« no previous file with comments | « ui/views/controls/menu/menu_controller.h ('k') | ui/views/widget/widget.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
===================================================================
--- ui/views/controls/menu/menu_controller.cc (revision 146181)
+++ ui/views/controls/menu/menu_controller.cc (working copy)
@@ -26,10 +26,12 @@
#include "ui/views/widget/widget.h"
#if defined(USE_AURA)
+#include "ui/aura/client/activation_client.h"
#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"
+#include "ui/aura/window.h"
#endif
using base::Time;
@@ -325,8 +327,17 @@
DCHECK_LE(message_loop_depth_, 2);
#if defined(USE_AURA)
root_window_ = parent->GetNativeWindow()->GetRootWindow();
+
+ // Observe activation changes to close the window if another window is
+ // activated (crbug.com/131027).
+ if (!nested_menu)
+ aura::client::GetActivationClient(root_window_)->AddObserver(this);
+
aura::client::GetDispatcherClient(root_window_)->
RunWithDispatcher(this, parent->GetNativeWindow(), true);
+
+ if (!nested_menu)
+ aura::client::GetActivationClient(root_window_)->RemoveObserver(this);
#else
{
MessageLoopForUI* loop = MessageLoopForUI::current();
@@ -698,11 +709,6 @@
StopScrolling();
}
-void MenuController::OnWidgetActivationChanged() {
- if (!drag_in_progress_)
- Cancel(EXIT_ALL);
-}
-
void MenuController::UpdateSubmenuSelection(SubmenuView* submenu) {
if (submenu->IsShowing()) {
gfx::Point point = gfx::Screen::GetCursorScreenPoint();
@@ -2122,4 +2128,12 @@
}
}
+#if defined(USE_AURA)
+void MenuController::OnWindowActivated(aura::Window* active,
+ aura::Window* old_active) {
+ if (!drag_in_progress_)
+ Cancel(EXIT_ALL);
+}
+#endif
+
} // namespace views
« no previous file with comments | « ui/views/controls/menu/menu_controller.h ('k') | ui/views/widget/widget.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698