| Index: ui/views/controls/menu/menu_message_loop_mac.cc
|
| diff --git a/ui/views/controls/menu/menu_message_loop_mac.cc b/ui/views/controls/menu/menu_message_loop_mac.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..4310e9cc3804605a107a0b7e4eaa987f13090727
|
| --- /dev/null
|
| +++ b/ui/views/controls/menu/menu_message_loop_mac.cc
|
| @@ -0,0 +1,55 @@
|
| +// Copyright 2014 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "ui/views/controls/menu/menu_message_loop_mac.h"
|
| +
|
| +#include "base/message_loop/message_loop.h"
|
| +#include "base/run_loop.h"
|
| +
|
| +namespace views {
|
| +
|
| +// static
|
| +MenuMessageLoop* MenuMessageLoop::Create() {
|
| + return new MenuMessageLoopMac;
|
| +}
|
| +
|
| +MenuMessageLoopMac::MenuMessageLoopMac()
|
| + : message_loop_depth_(0) {
|
| +}
|
| +
|
| +MenuMessageLoopMac::~MenuMessageLoopMac() {}
|
| +
|
| +void MenuMessageLoopMac::RepostEventToWindow(const ui::LocatedEvent& event,
|
| + gfx::NativeWindow window,
|
| + gfx::Point screen_loc) OVERRIDE;
|
| + NOTIMPLEMENTED();
|
| +}
|
| +
|
| +void MenuMessageLoopMac::Run(MenuController* controller,
|
| + Widget* owner,
|
| + bool nested_menu) {
|
| + message_loop_depth_++;
|
| + DCHECK_LE(mesage_loop_depth_, 2);
|
| +
|
| + base::MessageLoopForUI* loop = base::MessageLoopForUI::current();
|
| + base::MessageLoop::ScopedNestableTaskAllower allow(loop);
|
| + base::RunLoop run_loop;
|
| + run_loop.Run();
|
| +
|
| + message_loop_depth_--;
|
| +}
|
| +
|
| +bool MenuMessageLoopMac::ShouldQuitNow() const {
|
| + return true;
|
| +}
|
| +
|
| +void MenuMessageLoopMac::QuitNow() {
|
| + base::MessageLoop::current()->QuitNow();
|
| +}
|
| +
|
| +int MenuMessageLoopMac::message_loop_depth() const {
|
| + return message_loop_depth_;
|
| +}
|
| +
|
| +} // namespace views
|
|
|