Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / ui / views / controls / menu / menu_message_loop_mac.cc
blobae5670a7aa1132916fbcb3ba36adbaac98f6967f
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "ui/views/controls/menu/menu_message_loop_mac.h"
7 #include "base/auto_reset.h"
8 #include "base/logging.h"
9 #include "base/message_loop/message_loop.h"
10 #include "base/run_loop.h"
11 #include "ui/gfx/geometry/point.h"
13 namespace views {
15 // static
16 MenuMessageLoop* MenuMessageLoop::Create() {
17 return new MenuMessageLoopMac;
20 MenuMessageLoopMac::MenuMessageLoopMac() {
23 MenuMessageLoopMac::~MenuMessageLoopMac() {
26 void MenuMessageLoopMac::RepostEventToWindow(const ui::LocatedEvent& event,
27 gfx::NativeWindow window,
28 const gfx::Point& screen_loc) {
29 NOTIMPLEMENTED();
32 void MenuMessageLoopMac::Run(MenuController* controller,
33 Widget* owner,
34 bool nested_menu) {
35 base::MessageLoopForUI* loop = base::MessageLoopForUI::current();
36 base::MessageLoop::ScopedNestableTaskAllower allow(loop);
37 base::RunLoop run_loop;
38 base::AutoReset<base::RunLoop*> reset_run_loop(&run_loop_, &run_loop);
39 run_loop.Run();
42 void MenuMessageLoopMac::QuitNow() {
43 DCHECK(run_loop_);
44 run_loop_->Quit();
47 void MenuMessageLoopMac::ClearOwner() {
50 } // namespace views