OLD | NEW |
| (Empty) |
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. | |
4 | |
5 #include "ui/views/controls/menu/menu_message_loop_mac.h" | |
6 | |
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" | |
12 | |
13 namespace views { | |
14 | |
15 // static | |
16 MenuMessageLoop* MenuMessageLoop::Create() { | |
17 return new MenuMessageLoopMac; | |
18 } | |
19 | |
20 // static | |
21 void MenuMessageLoop::RepostEventToWindow(const ui::LocatedEvent* event, | |
22 gfx::NativeWindow window, | |
23 const gfx::Point& screen_loc) { | |
24 NOTIMPLEMENTED(); | |
25 } | |
26 | |
27 MenuMessageLoopMac::MenuMessageLoopMac() {} | |
28 | |
29 MenuMessageLoopMac::~MenuMessageLoopMac() {} | |
30 | |
31 void MenuMessageLoopMac::Run() { | |
32 base::MessageLoopForUI* loop = base::MessageLoopForUI::current(); | |
33 base::MessageLoop::ScopedNestableTaskAllower allow(loop); | |
34 base::RunLoop run_loop; | |
35 base::AutoReset<base::RunLoop*> reset_run_loop(&run_loop_, &run_loop); | |
36 run_loop.Run(); | |
37 } | |
38 | |
39 void MenuMessageLoopMac::QuitNow() { | |
40 DCHECK(run_loop_); | |
41 run_loop_->Quit(); | |
42 } | |
43 | |
44 } // namespace views | |
OLD | NEW |