Chromium Code Reviews| Index: ui/views/controls/menu/menu_message_loop_aura.cc |
| diff --git a/ui/views/controls/menu/menu_message_loop_aura.cc b/ui/views/controls/menu/menu_message_loop_aura.cc |
| index 3ed33281aa6f43e8b99a301acb33af9aef39515f..5e18c33176306f82e1b6d34cfe28adb138d14cbc 100644 |
| --- a/ui/views/controls/menu/menu_message_loop_aura.cc |
| +++ b/ui/views/controls/menu/menu_message_loop_aura.cc |
| @@ -10,7 +10,6 @@ |
| #include "base/run_loop.h" |
| #include "ui/aura/client/screen_position_client.h" |
| -#include "ui/aura/env.h" |
| #include "ui/aura/window.h" |
| #include "ui/aura/window_event_dispatcher.h" |
| #include "ui/aura/window_tree_host.h" |
| @@ -18,6 +17,7 @@ |
| #include "ui/events/platform/platform_event_source.h" |
| #include "ui/events/platform/scoped_event_dispatcher.h" |
| #include "ui/views/controls/menu/menu_controller.h" |
| +#include "ui/views/controls/menu/menu_event_handler.h" |
|
sky
2015/09/09 15:44:52
Shouldn't this be in the not win section below? Sa
afakhry
2015/09/09 20:21:33
Done.
|
| #include "ui/views/widget/widget.h" |
| #include "ui/wm/public/activation_change_observer.h" |
| #include "ui/wm/public/activation_client.h" |
| @@ -103,7 +103,7 @@ MenuMessageLoop* MenuMessageLoop::Create() { |
| return new MenuMessageLoopAura; |
| } |
| -MenuMessageLoopAura::MenuMessageLoopAura() : owner_(NULL) { |
| +MenuMessageLoopAura::MenuMessageLoopAura() : owner_(nullptr) { |
| } |
| MenuMessageLoopAura::~MenuMessageLoopAura() { |
| @@ -157,29 +157,25 @@ void MenuMessageLoopAura::Run(MenuController* controller, |
| run_loop.Run(); |
| } |
| #else |
| - internal::MenuEventDispatcher event_dispatcher(controller); |
| - scoped_ptr<ui::ScopedEventDispatcher> dispatcher_override; |
| - if (ui::PlatformEventSource::GetInstance()) { |
| - dispatcher_override = |
| - ui::PlatformEventSource::GetInstance()->OverrideDispatcher( |
| - &event_dispatcher); |
| - } |
| + scoped_ptr<ActivationChangeObserverImpl> observer; |
| if (root) { |
| - scoped_ptr<ActivationChangeObserverImpl> observer; |
| if (!nested_menu) |
| observer.reset(new ActivationChangeObserverImpl(controller, root)); |
| - aura::client::DispatcherRunLoop run_loop( |
| - aura::client::GetDispatcherClient(root), NULL); |
| - message_loop_quit_ = run_loop.QuitClosure(); |
| - run_loop.Run(); |
| - } else { |
| - base::MessageLoopForUI* loop = base::MessageLoopForUI::current(); |
| - base::MessageLoop::ScopedNestableTaskAllower allow(loop); |
| - base::RunLoop run_loop; |
| - message_loop_quit_ = run_loop.QuitClosure(); |
| - run_loop.Run(); |
| } |
| -#endif |
| + |
| + scoped_ptr<MenuEventHandler> menu_event_filter; |
| + if (!nested_menu) { |
| + // No need to recreate the MenuEventHandler for every nested menu. |
|
sky
2015/09/09 15:44:52
Again, this is documenting the code not the why.
afakhry
2015/09/09 20:21:33
Done.
|
| + menu_event_filter.reset(new MenuEventHandler); |
| + } |
| + |
| + base::MessageLoopForUI* loop = base::MessageLoopForUI::current(); |
| + base::MessageLoop::ScopedNestableTaskAllower allow(loop); |
| + base::RunLoop run_loop; |
| + message_loop_quit_ = run_loop.QuitClosure(); |
| + |
| + run_loop.Run(); |
| +#endif // defined(OS_WIN) |
| } |
| void MenuMessageLoopAura::QuitNow() { |