OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef COMPONENTS_MUS_MUS_APP_H_ | 5 #ifndef COMPONENTS_MUS_MUS_APP_H_ |
6 #define COMPONENTS_MUS_MUS_APP_H_ | 6 #define COMPONENTS_MUS_MUS_APP_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "components/mus/public/interfaces/display.mojom.h" | 14 #include "components/mus/public/interfaces/display.mojom.h" |
15 #include "components/mus/public/interfaces/gpu.mojom.h" | 15 #include "components/mus/public/interfaces/gpu.mojom.h" |
16 #include "components/mus/public/interfaces/window_manager_factory.mojom.h" | 16 #include "components/mus/public/interfaces/window_manager_factory.mojom.h" |
17 #include "components/mus/public/interfaces/window_tree.mojom.h" | 17 #include "components/mus/public/interfaces/window_tree.mojom.h" |
18 #include "components/mus/public/interfaces/window_tree_host.mojom.h" | 18 #include "components/mus/public/interfaces/window_tree_host.mojom.h" |
19 #include "components/mus/ws/connection_manager_delegate.h" | 19 #include "components/mus/ws/connection_manager_delegate.h" |
20 #include "mojo/common/weak_binding_set.h" | 20 #include "mojo/common/weak_binding_set.h" |
21 #include "mojo/services/tracing/public/cpp/tracing_impl.h" | 21 #include "mojo/services/tracing/public/cpp/tracing_impl.h" |
22 #include "mojo/shell/public/cpp/app_lifetime_helper.h" | |
23 #include "mojo/shell/public/cpp/application_delegate.h" | |
24 #include "mojo/shell/public/cpp/interface_factory.h" | 22 #include "mojo/shell/public/cpp/interface_factory.h" |
| 23 #include "mojo/shell/public/cpp/shell_client.h" |
25 | 24 |
26 namespace mojo { | 25 namespace mojo { |
27 class Shell; | 26 class Shell; |
28 } | 27 } |
29 | 28 |
30 namespace ui { | 29 namespace ui { |
31 class PlatformEventSource; | 30 class PlatformEventSource; |
32 } | 31 } |
33 | 32 |
34 namespace mus { | 33 namespace mus { |
35 | 34 |
36 class GpuState; | 35 class GpuState; |
37 class SurfacesState; | 36 class SurfacesState; |
38 | 37 |
39 namespace ws { | 38 namespace ws { |
40 class ConnectionManager; | 39 class ConnectionManager; |
41 class ForwardingWindowManager; | 40 class ForwardingWindowManager; |
42 class WindowTreeFactory; | 41 class WindowTreeFactory; |
43 } | 42 } |
44 | 43 |
45 class MandolineUIServicesApp | 44 class MandolineUIServicesApp |
46 : public mojo::ApplicationDelegate, | 45 : public mojo::ShellClient, |
47 public ws::ConnectionManagerDelegate, | 46 public ws::ConnectionManagerDelegate, |
48 public mojo::InterfaceFactory<mojom::DisplayManager>, | 47 public mojo::InterfaceFactory<mojom::DisplayManager>, |
49 public mojo::InterfaceFactory<mojom::WindowManagerFactoryService>, | 48 public mojo::InterfaceFactory<mojom::WindowManagerFactoryService>, |
50 public mojo::InterfaceFactory<mojom::WindowTreeFactory>, | 49 public mojo::InterfaceFactory<mojom::WindowTreeFactory>, |
51 public mojo::InterfaceFactory<mojom::WindowTreeHostFactory>, | 50 public mojo::InterfaceFactory<mojom::WindowTreeHostFactory>, |
52 public mojo::InterfaceFactory<mojom::Gpu>, | 51 public mojo::InterfaceFactory<mojom::Gpu>, |
53 public mojom::WindowTreeHostFactory { | 52 public mojom::WindowTreeHostFactory { |
54 public: | 53 public: |
55 MandolineUIServicesApp(); | 54 MandolineUIServicesApp(); |
56 ~MandolineUIServicesApp() override; | 55 ~MandolineUIServicesApp() override; |
57 | 56 |
58 private: | 57 private: |
59 // Holds InterfaceRequests received before the first WindowTreeHost Display | 58 // Holds InterfaceRequests received before the first WindowTreeHost Display |
60 // has been established. | 59 // has been established. |
61 struct PendingRequest; | 60 struct PendingRequest; |
62 | 61 |
63 // ApplicationDelegate: | 62 // mojo::ShellClient: |
64 void Initialize(mojo::Shell* shell, const std::string& url, | 63 void Initialize(mojo::Shell* shell, const std::string& url, |
65 uint32_t id) override; | 64 uint32_t id) override; |
66 bool AcceptConnection( | 65 bool AcceptConnection(mojo::Connection* connection) override; |
67 mojo::ApplicationConnection* connection) override; | |
68 | 66 |
69 // ConnectionManagerDelegate: | 67 // ConnectionManagerDelegate: |
70 void OnFirstRootConnectionCreated() override; | 68 void OnFirstRootConnectionCreated() override; |
71 void OnNoMoreRootConnections() override; | 69 void OnNoMoreRootConnections() override; |
72 ws::ClientConnection* CreateClientConnectionForEmbedAtWindow( | 70 ws::ClientConnection* CreateClientConnectionForEmbedAtWindow( |
73 ws::ConnectionManager* connection_manager, | 71 ws::ConnectionManager* connection_manager, |
74 mojo::InterfaceRequest<mojom::WindowTree> tree_request, | 72 mojo::InterfaceRequest<mojom::WindowTree> tree_request, |
75 ws::ServerWindow* root, | 73 ws::ServerWindow* root, |
76 uint32_t policy_bitmask, | 74 uint32_t policy_bitmask, |
77 mojom::WindowTreeClientPtr client) override; | 75 mojom::WindowTreeClientPtr client) override; |
78 | 76 |
79 // mojo::InterfaceFactory<mojom::DisplayManager> implementation. | 77 // mojo::InterfaceFactory<mojom::DisplayManager> implementation. |
80 void Create(mojo::ApplicationConnection* connection, | 78 void Create(mojo::Connection* connection, |
81 mojo::InterfaceRequest<mojom::DisplayManager> request) override; | 79 mojo::InterfaceRequest<mojom::DisplayManager> request) override; |
82 | 80 |
83 // mojo::InterfaceFactory<mojom::WindowManagerFactoryService> implementation. | 81 // mojo::InterfaceFactory<mojom::WindowManagerFactoryService> implementation. |
84 void Create(mojo::ApplicationConnection* connection, | 82 void Create(mojo::Connection* connection, |
85 mojo::InterfaceRequest<mojom::WindowManagerFactoryService> | 83 mojo::InterfaceRequest<mojom::WindowManagerFactoryService> |
86 request) override; | 84 request) override; |
87 | 85 |
88 // mojo::InterfaceFactory<mojom::WindowTreeFactory>: | 86 // mojo::InterfaceFactory<mojom::WindowTreeFactory>: |
89 void Create( | 87 void Create( |
90 mojo::ApplicationConnection* connection, | 88 mojo::Connection* connection, |
91 mojo::InterfaceRequest<mojom::WindowTreeFactory> request) override; | 89 mojo::InterfaceRequest<mojom::WindowTreeFactory> request) override; |
92 | 90 |
93 // mojo::InterfaceFactory<mojom::WindowTreeHostFactory>: | 91 // mojo::InterfaceFactory<mojom::WindowTreeHostFactory>: |
94 void Create( | 92 void Create( |
95 mojo::ApplicationConnection* connection, | 93 mojo::Connection* connection, |
96 mojo::InterfaceRequest<mojom::WindowTreeHostFactory> request) override; | 94 mojo::InterfaceRequest<mojom::WindowTreeHostFactory> request) override; |
97 | 95 |
98 // mojo::InterfaceFactory<mojom::Gpu> implementation. | 96 // mojo::InterfaceFactory<mojom::Gpu> implementation. |
99 void Create(mojo::ApplicationConnection* connection, | 97 void Create(mojo::Connection* connection, |
100 mojo::InterfaceRequest<mojom::Gpu> request) override; | 98 mojo::InterfaceRequest<mojom::Gpu> request) override; |
101 | 99 |
102 // mojom::WindowTreeHostFactory implementation. | 100 // mojom::WindowTreeHostFactory implementation. |
103 void CreateWindowTreeHost(mojo::InterfaceRequest<mojom::WindowTreeHost> host, | 101 void CreateWindowTreeHost(mojo::InterfaceRequest<mojom::WindowTreeHost> host, |
104 mojom::WindowTreeClientPtr tree_client) override; | 102 mojom::WindowTreeClientPtr tree_client) override; |
105 | 103 |
106 mojo::WeakBindingSet<mojom::WindowTreeHostFactory> factory_bindings_; | 104 mojo::WeakBindingSet<mojom::WindowTreeHostFactory> factory_bindings_; |
107 mojo::Shell* shell_; | 105 mojo::Shell* shell_; |
108 scoped_ptr<ws::ConnectionManager> connection_manager_; | 106 scoped_ptr<ws::ConnectionManager> connection_manager_; |
109 scoped_refptr<GpuState> gpu_state_; | 107 scoped_refptr<GpuState> gpu_state_; |
110 scoped_ptr<ui::PlatformEventSource> event_source_; | 108 scoped_ptr<ui::PlatformEventSource> event_source_; |
111 mojo::TracingImpl tracing_; | 109 mojo::TracingImpl tracing_; |
112 using PendingRequests = std::vector<scoped_ptr<PendingRequest>>; | 110 using PendingRequests = std::vector<scoped_ptr<PendingRequest>>; |
113 PendingRequests pending_requests_; | 111 PendingRequests pending_requests_; |
114 scoped_ptr<ws::WindowTreeFactory> window_tree_factory_; | 112 scoped_ptr<ws::WindowTreeFactory> window_tree_factory_; |
115 | 113 |
116 // Surfaces | 114 // Surfaces |
117 scoped_refptr<SurfacesState> surfaces_state_; | 115 scoped_refptr<SurfacesState> surfaces_state_; |
118 | 116 |
119 DISALLOW_COPY_AND_ASSIGN(MandolineUIServicesApp); | 117 DISALLOW_COPY_AND_ASSIGN(MandolineUIServicesApp); |
120 }; | 118 }; |
121 | 119 |
122 } // namespace mus | 120 } // namespace mus |
123 | 121 |
124 #endif // COMPONENTS_MUS_MUS_APP_H_ | 122 #endif // COMPONENTS_MUS_MUS_APP_H_ |
OLD | NEW |