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 <string> | 10 #include <string> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/macros.h" | 13 #include "base/macros.h" |
14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
15 #include "components/mus/public/interfaces/display.mojom.h" | 15 #include "components/mus/public/interfaces/display.mojom.h" |
16 #include "components/mus/public/interfaces/gpu.mojom.h" | 16 #include "components/mus/public/interfaces/gpu.mojom.h" |
17 #include "components/mus/public/interfaces/user_access_manager.mojom.h" | 17 #include "components/mus/public/interfaces/user_access_manager.mojom.h" |
18 #include "components/mus/public/interfaces/window_manager_factory.mojom.h" | 18 #include "components/mus/public/interfaces/window_manager_factory.mojom.h" |
19 #include "components/mus/public/interfaces/window_tree.mojom.h" | 19 #include "components/mus/public/interfaces/window_tree.mojom.h" |
20 #include "components/mus/public/interfaces/window_tree_host.mojom.h" | 20 #include "components/mus/public/interfaces/window_tree_host.mojom.h" |
21 #include "components/mus/ws/platform_display_init_params.h" | 21 #include "components/mus/ws/platform_display_init_params.h" |
22 #include "components/mus/ws/user_id.h" | 22 #include "components/mus/ws/user_id.h" |
23 #include "components/mus/ws/window_server_delegate.h" | 23 #include "components/mus/ws/window_server_delegate.h" |
24 #include "services/shell/public/cpp/application_runner.h" | 24 #include "services/shell/public/cpp/application_runner.h" |
25 #include "services/shell/public/cpp/interface_factory.h" | 25 #include "services/shell/public/cpp/interface_factory.h" |
26 #include "services/shell/public/cpp/shell_client.h" | 26 #include "services/shell/public/cpp/shell_client.h" |
27 #include "services/tracing/public/cpp/tracing_impl.h" | 27 #include "services/tracing/public/cpp/tracing_impl.h" |
28 | 28 |
29 namespace mojo { | 29 namespace shell { |
30 class Connector; | 30 class Connector; |
31 } | 31 } |
32 | 32 |
33 namespace ui { | 33 namespace ui { |
34 class PlatformEventSource; | 34 class PlatformEventSource; |
35 } | 35 } |
36 | 36 |
37 namespace mus { | 37 namespace mus { |
38 namespace ws { | 38 namespace ws { |
39 class ForwardingWindowManager; | 39 class ForwardingWindowManager; |
40 class WindowServer; | 40 class WindowServer; |
41 } | 41 } |
42 | 42 |
43 class MandolineUIServicesApp | 43 class MandolineUIServicesApp |
44 : public mojo::ShellClient, | 44 : public shell::ShellClient, |
45 public ws::WindowServerDelegate, | 45 public ws::WindowServerDelegate, |
46 public mojo::InterfaceFactory<mojom::DisplayManager>, | 46 public shell::InterfaceFactory<mojom::DisplayManager>, |
47 public mojo::InterfaceFactory<mojom::UserAccessManager>, | 47 public shell::InterfaceFactory<mojom::UserAccessManager>, |
48 public mojo::InterfaceFactory<mojom::WindowManagerFactoryService>, | 48 public shell::InterfaceFactory<mojom::WindowManagerFactoryService>, |
49 public mojo::InterfaceFactory<mojom::WindowTreeFactory>, | 49 public shell::InterfaceFactory<mojom::WindowTreeFactory>, |
50 public mojo::InterfaceFactory<mojom::WindowTreeHostFactory>, | 50 public shell::InterfaceFactory<mojom::WindowTreeHostFactory>, |
51 public mojo::InterfaceFactory<mojom::Gpu> { | 51 public shell::InterfaceFactory<mojom::Gpu> { |
52 public: | 52 public: |
53 MandolineUIServicesApp(); | 53 MandolineUIServicesApp(); |
54 ~MandolineUIServicesApp() override; | 54 ~MandolineUIServicesApp() override; |
55 | 55 |
56 private: | 56 private: |
57 // Holds InterfaceRequests received before the first WindowTreeHost Display | 57 // Holds InterfaceRequests received before the first WindowTreeHost Display |
58 // has been established. | 58 // has been established. |
59 struct PendingRequest; | 59 struct PendingRequest; |
60 struct UserState; | 60 struct UserState; |
61 | 61 |
62 using UserIdToUserState = std::map<ws::UserId, scoped_ptr<UserState>>; | 62 using UserIdToUserState = std::map<ws::UserId, scoped_ptr<UserState>>; |
63 | 63 |
64 void InitializeResources(mojo::Connector* connector); | 64 void InitializeResources(shell::Connector* connector); |
65 | 65 |
66 // Returns the user specific state for the user id of |connection|. MusApp | 66 // Returns the user specific state for the user id of |connection|. MusApp |
67 // owns the return value. | 67 // owns the return value. |
68 // TODO(sky): if we allow removal of user ids then we need to close anything | 68 // TODO(sky): if we allow removal of user ids then we need to close anything |
69 // associated with the user (all incoming pipes...) on removal. | 69 // associated with the user (all incoming pipes...) on removal. |
70 UserState* GetUserState(mojo::Connection* connection); | 70 UserState* GetUserState(shell::Connection* connection); |
71 | 71 |
72 void AddUserIfNecessary(mojo::Connection* connection); | 72 void AddUserIfNecessary(shell::Connection* connection); |
73 | 73 |
74 // mojo::ShellClient: | 74 // shell::ShellClient: |
75 void Initialize(mojo::Connector* connector, const mojo::Identity& identity, | 75 void Initialize(shell::Connector* connector, |
| 76 const shell::Identity& identity, |
76 uint32_t id) override; | 77 uint32_t id) override; |
77 bool AcceptConnection(mojo::Connection* connection) override; | 78 bool AcceptConnection(shell::Connection* connection) override; |
78 | 79 |
79 // WindowServerDelegate: | 80 // WindowServerDelegate: |
80 void OnFirstDisplayReady() override; | 81 void OnFirstDisplayReady() override; |
81 void OnNoMoreDisplays() override; | 82 void OnNoMoreDisplays() override; |
82 void CreateDefaultDisplays() override; | 83 void CreateDefaultDisplays() override; |
83 | 84 |
84 // mojo::InterfaceFactory<mojom::DisplayManager> implementation. | 85 // shell::InterfaceFactory<mojom::DisplayManager> implementation. |
85 void Create(mojo::Connection* connection, | 86 void Create(shell::Connection* connection, |
86 mojom::DisplayManagerRequest request) override; | 87 mojom::DisplayManagerRequest request) override; |
87 | 88 |
88 // mojo::InterfaceFactory<mojom::UserAccessManager> implementation. | 89 // shell::InterfaceFactory<mojom::UserAccessManager> implementation. |
89 void Create(mojo::Connection* connection, | 90 void Create(shell::Connection* connection, |
90 mojom::UserAccessManagerRequest request) override; | 91 mojom::UserAccessManagerRequest request) override; |
91 | 92 |
92 // mojo::InterfaceFactory<mojom::WindowManagerFactoryService> implementation. | 93 // shell::InterfaceFactory<mojom::WindowManagerFactoryService> implementation. |
93 void Create(mojo::Connection* connection, | 94 void Create(shell::Connection* connection, |
94 mojom::WindowManagerFactoryServiceRequest request) override; | 95 mojom::WindowManagerFactoryServiceRequest request) override; |
95 | 96 |
96 // mojo::InterfaceFactory<mojom::WindowTreeFactory>: | 97 // shell::InterfaceFactory<mojom::WindowTreeFactory>: |
97 void Create(mojo::Connection* connection, | 98 void Create(shell::Connection* connection, |
98 mojom::WindowTreeFactoryRequest request) override; | 99 mojom::WindowTreeFactoryRequest request) override; |
99 | 100 |
100 // mojo::InterfaceFactory<mojom::WindowTreeHostFactory>: | 101 // shell::InterfaceFactory<mojom::WindowTreeHostFactory>: |
101 void Create(mojo::Connection* connection, | 102 void Create(shell::Connection* connection, |
102 mojom::WindowTreeHostFactoryRequest request) override; | 103 mojom::WindowTreeHostFactoryRequest request) override; |
103 | 104 |
104 // mojo::InterfaceFactory<mojom::Gpu> implementation. | 105 // shell::InterfaceFactory<mojom::Gpu> implementation. |
105 void Create(mojo::Connection* connection, mojom::GpuRequest request) override; | 106 void Create(shell::Connection* connection, |
| 107 mojom::GpuRequest request) override; |
106 | 108 |
107 ws::PlatformDisplayInitParams platform_display_init_params_; | 109 ws::PlatformDisplayInitParams platform_display_init_params_; |
108 scoped_ptr<ws::WindowServer> window_server_; | 110 scoped_ptr<ws::WindowServer> window_server_; |
109 scoped_ptr<ui::PlatformEventSource> event_source_; | 111 scoped_ptr<ui::PlatformEventSource> event_source_; |
110 mojo::TracingImpl tracing_; | 112 mojo::TracingImpl tracing_; |
111 using PendingRequests = std::vector<scoped_ptr<PendingRequest>>; | 113 using PendingRequests = std::vector<scoped_ptr<PendingRequest>>; |
112 PendingRequests pending_requests_; | 114 PendingRequests pending_requests_; |
113 | 115 |
114 UserIdToUserState user_id_to_user_state_; | 116 UserIdToUserState user_id_to_user_state_; |
115 | 117 |
116 DISALLOW_COPY_AND_ASSIGN(MandolineUIServicesApp); | 118 DISALLOW_COPY_AND_ASSIGN(MandolineUIServicesApp); |
117 }; | 119 }; |
118 | 120 |
119 } // namespace mus | 121 } // namespace mus |
120 | 122 |
121 #endif // COMPONENTS_MUS_MUS_APP_H_ | 123 #endif // COMPONENTS_MUS_MUS_APP_H_ |
OLD | NEW |