Make castv2 performance test work.
[chromium-blink-merge.git] / ui / wm / public / dispatcher_client.h
bloba301e92dd557d43d7f83f9520f1f60dae32395c0
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"
13 namespace aura {
14 class Window;
15 namespace client {
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 {
22 public:
23 DispatcherRunLoop(DispatcherClient* client,
24 base::MessagePumpDispatcher* dispatcher);
25 ~DispatcherRunLoop();
27 void Run();
28 base::Closure QuitClosure();
29 void Quit();
31 private:
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 {
40 public:
41 virtual ~DispatcherClient() {}
43 protected:
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);
56 } // namespace client
57 } // namespace aura
59 #endif // UI_WM_PUBLIC_DISPATCHER_CLIENT_H_