OLD | NEW |
| (Empty) |
1 // Copyright (c) 2012 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 #ifndef UI_WM_PUBLIC_DISPATCHER_CLIENT_H_ | |
6 #define UI_WM_PUBLIC_DISPATCHER_CLIENT_H_ | |
7 | |
8 #include "base/callback.h" | |
9 #include "base/macros.h" | |
10 #include "base/message_loop/message_pump_dispatcher.h" | |
11 #include "ui/aura/aura_export.h" | |
12 | |
13 namespace aura { | |
14 class Window; | |
15 namespace client { | |
16 | |
17 class DispatcherClient; | |
18 | |
19 // A base::RunLoop like object for running a nested message-loop with a | |
20 // specified DispatcherClient and a MessagePumpDispatcher. | |
21 class AURA_EXPORT DispatcherRunLoop { | |
22 public: | |
23 DispatcherRunLoop(DispatcherClient* client, | |
24 base::MessagePumpDispatcher* dispatcher); | |
25 ~DispatcherRunLoop(); | |
26 | |
27 void Run(); | |
28 base::Closure QuitClosure(); | |
29 void Quit(); | |
30 | |
31 private: | |
32 base::Closure run_closure_; | |
33 base::Closure quit_closure_; | |
34 | |
35 DISALLOW_COPY_AND_ASSIGN(DispatcherRunLoop); | |
36 }; | |
37 | |
38 // An interface implemented by an object which handles nested dispatchers. | |
39 class AURA_EXPORT DispatcherClient { | |
40 public: | |
41 virtual ~DispatcherClient() {} | |
42 | |
43 protected: | |
44 friend class DispatcherRunLoop; | |
45 | |
46 virtual void PrepareNestedLoopClosures( | |
47 base::MessagePumpDispatcher* dispatcher, | |
48 base::Closure* run_closure, | |
49 base::Closure* quit_closure) = 0; | |
50 }; | |
51 | |
52 AURA_EXPORT void SetDispatcherClient(Window* root_window, | |
53 DispatcherClient* client); | |
54 AURA_EXPORT DispatcherClient* GetDispatcherClient(Window* root_window); | |
55 | |
56 } // namespace client | |
57 } // namespace aura | |
58 | |
59 #endif // UI_WM_PUBLIC_DISPATCHER_CLIENT_H_ | |
OLD | NEW |