| 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 0ff715be719e98ba7dde29fe2a95e2871f8cfe7a..feda07e9cdf690ac7dcff7948b3f2c26780b90c3 100644
|
| --- a/ui/views/controls/menu/menu_controller.cc
|
| +++ b/ui/views/controls/menu/menu_controller.cc
|
| @@ -27,10 +27,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;
|
| @@ -326,8 +328,17 @@ MenuItemView* MenuController::Run(Widget* parent,
|
| 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();
|
| @@ -699,11 +710,6 @@ void MenuController::OnDragExitedScrollButton(SubmenuView* source) {
|
| 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();
|
| @@ -2124,4 +2130,12 @@ void MenuController::HandleMouseLocation(SubmenuView* source,
|
| }
|
| }
|
|
|
| +#if defined(USE_AURA)
|
| +void MenuController::OnWindowActivated(aura::Window* active,
|
| + aura::Window* old_active) {
|
| + if (!drag_in_progress_)
|
| + Cancel(EXIT_ALL);
|
| +}
|
| +#endif
|
| +
|
| } // namespace views
|
|
|