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/gpu.mojom.h" | 15 #include "components/mus/public/interfaces/gpu.mojom.h" |
15 #include "components/mus/public/interfaces/window_manager.mojom.h" | 16 #include "components/mus/public/interfaces/window_manager.mojom.h" |
16 #include "components/mus/public/interfaces/window_tree.mojom.h" | 17 #include "components/mus/public/interfaces/window_tree.mojom.h" |
17 #include "components/mus/public/interfaces/window_tree_host.mojom.h" | 18 #include "components/mus/public/interfaces/window_tree_host.mojom.h" |
18 #include "components/mus/ws/connection_manager_delegate.h" | 19 #include "components/mus/ws/connection_manager_delegate.h" |
19 #include "mojo/common/weak_binding_set.h" | 20 #include "mojo/common/weak_binding_set.h" |
20 #include "mojo/services/tracing/public/cpp/tracing_impl.h" | 21 #include "mojo/services/tracing/public/cpp/tracing_impl.h" |
21 #include "mojo/shell/public/cpp/app_lifetime_helper.h" | 22 #include "mojo/shell/public/cpp/app_lifetime_helper.h" |
22 #include "mojo/shell/public/cpp/application_delegate.h" | 23 #include "mojo/shell/public/cpp/application_delegate.h" |
23 #include "mojo/shell/public/cpp/interface_factory.h" | 24 #include "mojo/shell/public/cpp/interface_factory.h" |
(...skipping 12 matching lines...) Expand all Loading... |
36 class SurfacesState; | 37 class SurfacesState; |
37 | 38 |
38 namespace ws { | 39 namespace ws { |
39 class ConnectionManager; | 40 class ConnectionManager; |
40 class ForwardingWindowManager; | 41 class ForwardingWindowManager; |
41 } | 42 } |
42 | 43 |
43 class MandolineUIServicesApp | 44 class MandolineUIServicesApp |
44 : public mojo::ApplicationDelegate, | 45 : public mojo::ApplicationDelegate, |
45 public ws::ConnectionManagerDelegate, | 46 public ws::ConnectionManagerDelegate, |
| 47 public mojo::InterfaceFactory<mojom::DisplayManager>, |
46 public mojo::InterfaceFactory<mojom::WindowManager>, | 48 public mojo::InterfaceFactory<mojom::WindowManager>, |
47 public mojo::InterfaceFactory<mojom::WindowTreeHostFactory>, | 49 public mojo::InterfaceFactory<mojom::WindowTreeHostFactory>, |
48 public mojo::InterfaceFactory<mojom::Gpu>, | 50 public mojo::InterfaceFactory<mojom::Gpu>, |
49 public mojom::WindowTreeHostFactory { | 51 public mojom::WindowTreeHostFactory { |
50 public: | 52 public: |
51 MandolineUIServicesApp(); | 53 MandolineUIServicesApp(); |
52 ~MandolineUIServicesApp() override; | 54 ~MandolineUIServicesApp() override; |
53 | 55 |
54 private: | 56 private: |
| 57 // Holds InterfaceRequests received before the first WindowTreeHost Display |
| 58 // has been established. |
| 59 struct PendingRequest; |
| 60 |
55 // ApplicationDelegate: | 61 // ApplicationDelegate: |
56 void Initialize(mojo::ApplicationImpl* app) override; | 62 void Initialize(mojo::ApplicationImpl* app) override; |
57 bool ConfigureIncomingConnection( | 63 bool ConfigureIncomingConnection( |
58 mojo::ApplicationConnection* connection) override; | 64 mojo::ApplicationConnection* connection) override; |
59 | 65 |
60 // ConnectionManagerDelegate: | 66 // ConnectionManagerDelegate: |
61 void OnFirstRootConnectionCreated() override; | 67 void OnFirstRootConnectionCreated() override; |
62 void OnNoMoreRootConnections() override; | 68 void OnNoMoreRootConnections() override; |
63 ws::ClientConnection* CreateClientConnectionForEmbedAtWindow( | 69 ws::ClientConnection* CreateClientConnectionForEmbedAtWindow( |
64 ws::ConnectionManager* connection_manager, | 70 ws::ConnectionManager* connection_manager, |
65 mojo::InterfaceRequest<mojom::WindowTree> tree_request, | 71 mojo::InterfaceRequest<mojom::WindowTree> tree_request, |
66 ws::ServerWindow* root, | 72 ws::ServerWindow* root, |
67 uint32_t policy_bitmask, | 73 uint32_t policy_bitmask, |
68 mojom::WindowTreeClientPtr client) override; | 74 mojom::WindowTreeClientPtr client) override; |
69 | 75 |
| 76 // mojo::InterfaceFactory<mojom::DisplayManager> implementation. |
| 77 void Create(mojo::ApplicationConnection* connection, |
| 78 mojo::InterfaceRequest<mojom::DisplayManager> request) override; |
| 79 |
70 // mojo::InterfaceFactory<mojom::WindowManager> implementation. | 80 // mojo::InterfaceFactory<mojom::WindowManager> implementation. |
71 void Create(mojo::ApplicationConnection* connection, | 81 void Create(mojo::ApplicationConnection* connection, |
72 mojo::InterfaceRequest<mojom::WindowManager> request) override; | 82 mojo::InterfaceRequest<mojom::WindowManager> request) override; |
73 | 83 |
74 // mojo::InterfaceFactory<mojom::WindowTreeHostFactory>: | 84 // mojo::InterfaceFactory<mojom::WindowTreeHostFactory>: |
75 void Create( | 85 void Create( |
76 mojo::ApplicationConnection* connection, | 86 mojo::ApplicationConnection* connection, |
77 mojo::InterfaceRequest<mojom::WindowTreeHostFactory> request) override; | 87 mojo::InterfaceRequest<mojom::WindowTreeHostFactory> request) override; |
78 | 88 |
79 // mojo::InterfaceFactory<mojom::Gpu> implementation. | 89 // mojo::InterfaceFactory<mojom::Gpu> implementation. |
80 void Create(mojo::ApplicationConnection* connection, | 90 void Create(mojo::ApplicationConnection* connection, |
81 mojo::InterfaceRequest<mojom::Gpu> request) override; | 91 mojo::InterfaceRequest<mojom::Gpu> request) override; |
82 | 92 |
83 // mojom::WindowTreeHostFactory implementation. | 93 // mojom::WindowTreeHostFactory implementation. |
84 void CreateWindowTreeHost(mojo::InterfaceRequest<mojom::WindowTreeHost> host, | 94 void CreateWindowTreeHost(mojo::InterfaceRequest<mojom::WindowTreeHost> host, |
85 mojom::WindowTreeHostClientPtr host_client, | 95 mojom::WindowTreeHostClientPtr host_client, |
86 mojom::WindowTreeClientPtr tree_client, | 96 mojom::WindowTreeClientPtr tree_client, |
87 mojom::WindowManagerPtr window_manager) override; | 97 mojom::WindowManagerPtr window_manager) override; |
88 | 98 |
89 mojo::WeakBindingSet<mojom::WindowTreeHostFactory> factory_bindings_; | 99 mojo::WeakBindingSet<mojom::WindowTreeHostFactory> factory_bindings_; |
90 scoped_ptr<ws::ForwardingWindowManager> window_manager_impl_; | 100 scoped_ptr<ws::ForwardingWindowManager> window_manager_impl_; |
91 mojo::WeakBindingSet<mojom::WindowManager> window_manager_bindings_; | 101 mojo::WeakBindingSet<mojom::WindowManager> window_manager_bindings_; |
92 mojo::ApplicationImpl* app_impl_; | 102 mojo::ApplicationImpl* app_impl_; |
93 scoped_ptr<ws::ConnectionManager> connection_manager_; | 103 scoped_ptr<ws::ConnectionManager> connection_manager_; |
94 scoped_refptr<GpuState> gpu_state_; | 104 scoped_refptr<GpuState> gpu_state_; |
95 scoped_ptr<ui::PlatformEventSource> event_source_; | 105 scoped_ptr<ui::PlatformEventSource> event_source_; |
96 mojo::TracingImpl tracing_; | 106 mojo::TracingImpl tracing_; |
97 using WindowManagerRequests = | 107 using PendingRequests = std::vector<scoped_ptr<PendingRequest>>; |
98 std::vector<scoped_ptr<mojo::InterfaceRequest<mojom::WindowManager>>>; | 108 PendingRequests pending_requests_; |
99 WindowManagerRequests pending_window_manager_requests_; | |
100 | 109 |
101 // Surfaces | 110 // Surfaces |
102 scoped_refptr<SurfacesState> surfaces_state_; | 111 scoped_refptr<SurfacesState> surfaces_state_; |
103 | 112 |
104 DISALLOW_COPY_AND_ASSIGN(MandolineUIServicesApp); | 113 DISALLOW_COPY_AND_ASSIGN(MandolineUIServicesApp); |
105 }; | 114 }; |
106 | 115 |
107 } // namespace mus | 116 } // namespace mus |
108 | 117 |
109 #endif // COMPONENTS_MUS_MUS_APP_H_ | 118 #endif // COMPONENTS_MUS_MUS_APP_H_ |
OLD | NEW |