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.
5 #ifndef UI_WM_PUBLIC_DISPATCHER_CLIENT_H_
6 #define UI_WM_PUBLIC_DISPATCHER_CLIENT_H_
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"
17 class DispatcherClient
;
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
{
23 DispatcherRunLoop(DispatcherClient
* client
,
24 base::MessagePumpDispatcher
* dispatcher
);
28 base::Closure
QuitClosure();
32 base::Closure run_closure_
;
33 base::Closure quit_closure_
;
35 DISALLOW_COPY_AND_ASSIGN(DispatcherRunLoop
);
38 // An interface implemented by an object which handles nested dispatchers.
39 class AURA_EXPORT DispatcherClient
{
41 virtual ~DispatcherClient() {}
44 friend class DispatcherRunLoop
;
46 virtual void PrepareNestedLoopClosures(
47 base::MessagePumpDispatcher
* dispatcher
,
48 base::Closure
* run_closure
,
49 base::Closure
* quit_closure
) = 0;
52 AURA_EXPORT
void SetDispatcherClient(Window
* root_window
,
53 DispatcherClient
* client
);
54 AURA_EXPORT DispatcherClient
* GetDispatcherClient(Window
* root_window
);
59 #endif // UI_WM_PUBLIC_DISPATCHER_CLIENT_H_