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