blob: a301e92dd557d43d7f83f9520f1f60dae32395c0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef UI_WM_PUBLIC_DISPATCHER_CLIENT_H_
#define UI_WM_PUBLIC_DISPATCHER_CLIENT_H_
#include "base/callback.h"
#include "base/macros.h"
#include "base/message_loop/message_pump_dispatcher.h"
#include "ui/aura/aura_export.h"
namespace aura {
class Window;
namespace client {
class DispatcherClient;
// A base::RunLoop like object for running a nested message-loop with a
// specified DispatcherClient and a MessagePumpDispatcher.
class AURA_EXPORT DispatcherRunLoop {
public:
DispatcherRunLoop(DispatcherClient* client,
base::MessagePumpDispatcher* dispatcher);
~DispatcherRunLoop();
void Run();
base::Closure QuitClosure();
void Quit();
private:
base::Closure run_closure_;
base::Closure quit_closure_;
DISALLOW_COPY_AND_ASSIGN(DispatcherRunLoop);
};
// An interface implemented by an object which handles nested dispatchers.
class AURA_EXPORT DispatcherClient {
public:
virtual ~DispatcherClient() {}
protected:
friend class DispatcherRunLoop;
virtual void PrepareNestedLoopClosures(
base::MessagePumpDispatcher* dispatcher,
base::Closure* run_closure,
base::Closure* quit_closure) = 0;
};
AURA_EXPORT void SetDispatcherClient(Window* root_window,
DispatcherClient* client);
AURA_EXPORT DispatcherClient* GetDispatcherClient(Window* root_window);
} // namespace client
} // namespace aura
#endif // UI_WM_PUBLIC_DISPATCHER_CLIENT_H_
|