OLD | NEW |
| (Empty) |
1 // Copyright 2015 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 COMPONENTS_MUS_WS_DISPLAY_BINDING_H_ | |
6 #define COMPONENTS_MUS_WS_DISPLAY_BINDING_H_ | |
7 | |
8 #include <memory> | |
9 | |
10 #include "base/macros.h" | |
11 #include "components/mus/public/interfaces/window_tree_host.mojom.h" | |
12 #include "components/mus/ws/display.h" | |
13 #include "components/mus/ws/user_id.h" | |
14 #include "mojo/public/cpp/bindings/binding.h" | |
15 | |
16 namespace mus { | |
17 namespace ws { | |
18 | |
19 class ServerWindow; | |
20 class WindowServer; | |
21 class WindowTree; | |
22 | |
23 // DisplayBinding manages the binding between a Display and it's mojo clients. | |
24 // DisplayBinding is used when a Display is created via a | |
25 // WindowTreeHostFactory. | |
26 // | |
27 // DisplayBinding is owned by Display. | |
28 class DisplayBinding { | |
29 public: | |
30 virtual ~DisplayBinding() {} | |
31 | |
32 virtual WindowTree* CreateWindowTree(ServerWindow* root) = 0; | |
33 }; | |
34 | |
35 // Live implementation of DisplayBinding. | |
36 class DisplayBindingImpl : public DisplayBinding { | |
37 public: | |
38 DisplayBindingImpl(mojom::WindowTreeHostRequest request, | |
39 Display* display, | |
40 const UserId& user_id, | |
41 mojom::WindowTreeClientPtr client, | |
42 WindowServer* window_server); | |
43 ~DisplayBindingImpl() override; | |
44 | |
45 private: | |
46 // DisplayBinding: | |
47 WindowTree* CreateWindowTree(ServerWindow* root) override; | |
48 | |
49 WindowServer* window_server_; | |
50 const UserId user_id_; | |
51 mojo::Binding<mojom::WindowTreeHost> binding_; | |
52 mojom::WindowTreeClientPtr client_; | |
53 | |
54 DISALLOW_COPY_AND_ASSIGN(DisplayBindingImpl); | |
55 }; | |
56 | |
57 } // namespace ws | |
58 } // namespace mus | |
59 | |
60 #endif // COMPONENTS_MUS_WS_DISPLAY_BINDING_H_ | |
OLD | NEW |