| 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 SERVICES_UI_SERVICE_H_ | 5 #ifndef SERVICES_UI_SERVICE_H_ |
| 6 #define SERVICES_UI_SERVICE_H_ | 6 #define SERVICES_UI_SERVICE_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 #endif | 41 #endif |
| 42 | 42 |
| 43 namespace display { | 43 namespace display { |
| 44 class PlatformScreen; | 44 class PlatformScreen; |
| 45 } | 45 } |
| 46 | 46 |
| 47 namespace gfx { | 47 namespace gfx { |
| 48 class Rect; | 48 class Rect; |
| 49 } | 49 } |
| 50 | 50 |
| 51 namespace shell { | 51 namespace service_manager { |
| 52 class Connector; | 52 class Connector; |
| 53 } | 53 } |
| 54 | 54 |
| 55 namespace ui { | 55 namespace ui { |
| 56 | 56 |
| 57 class PlatformEventSource; | 57 class PlatformEventSource; |
| 58 | 58 |
| 59 namespace ws { | 59 namespace ws { |
| 60 class ForwardingWindowManager; | 60 class ForwardingWindowManager; |
| 61 class WindowServer; | 61 class WindowServer; |
| 62 } | 62 } |
| 63 | 63 |
| 64 class Service | 64 class Service |
| 65 : public shell::Service, | 65 : public service_manager::Service, |
| 66 public ws::WindowServerDelegate, | 66 public ws::WindowServerDelegate, |
| 67 public shell::InterfaceFactory<mojom::AccessibilityManager>, | 67 public service_manager::InterfaceFactory<mojom::AccessibilityManager>, |
| 68 public shell::InterfaceFactory<mojom::Clipboard>, | 68 public service_manager::InterfaceFactory<mojom::Clipboard>, |
| 69 public shell::InterfaceFactory<mojom::DisplayManager>, | 69 public service_manager::InterfaceFactory<mojom::DisplayManager>, |
| 70 public shell::InterfaceFactory<mojom::GpuService>, | 70 public service_manager::InterfaceFactory<mojom::GpuService>, |
| 71 public shell::InterfaceFactory<mojom::IMERegistrar>, | 71 public service_manager::InterfaceFactory<mojom::IMERegistrar>, |
| 72 public shell::InterfaceFactory<mojom::IMEServer>, | 72 public service_manager::InterfaceFactory<mojom::IMEServer>, |
| 73 public shell::InterfaceFactory<mojom::UserAccessManager>, | 73 public service_manager::InterfaceFactory<mojom::UserAccessManager>, |
| 74 public shell::InterfaceFactory<mojom::UserActivityMonitor>, | 74 public service_manager::InterfaceFactory<mojom::UserActivityMonitor>, |
| 75 public shell::InterfaceFactory<mojom::WindowManagerWindowTreeFactory>, | 75 public service_manager::InterfaceFactory< |
| 76 public shell::InterfaceFactory<mojom::WindowTreeFactory>, | 76 mojom::WindowManagerWindowTreeFactory>, |
| 77 public shell::InterfaceFactory<mojom::WindowTreeHostFactory>, | 77 public service_manager::InterfaceFactory<mojom::WindowTreeFactory>, |
| 78 public shell::InterfaceFactory<mojom::WindowServerTest> { | 78 public service_manager::InterfaceFactory<mojom::WindowTreeHostFactory>, |
| 79 public service_manager::InterfaceFactory<mojom::WindowServerTest> { |
| 79 public: | 80 public: |
| 80 Service(); | 81 Service(); |
| 81 ~Service() override; | 82 ~Service() override; |
| 82 | 83 |
| 83 private: | 84 private: |
| 84 // Holds InterfaceRequests received before the first WindowTreeHost Display | 85 // Holds InterfaceRequests received before the first WindowTreeHost Display |
| 85 // has been established. | 86 // has been established. |
| 86 struct PendingRequest; | 87 struct PendingRequest; |
| 87 struct UserState; | 88 struct UserState; |
| 88 | 89 |
| 89 using UserIdToUserState = std::map<ws::UserId, std::unique_ptr<UserState>>; | 90 using UserIdToUserState = std::map<ws::UserId, std::unique_ptr<UserState>>; |
| 90 | 91 |
| 91 void InitializeResources(shell::Connector* connector); | 92 void InitializeResources(service_manager::Connector* connector); |
| 92 | 93 |
| 93 // Returns the user specific state for the user id of |remote_identity|. | 94 // Returns the user specific state for the user id of |remote_identity|. |
| 94 // Service owns the return value. | 95 // Service owns the return value. |
| 95 // TODO(sky): if we allow removal of user ids then we need to close anything | 96 // TODO(sky): if we allow removal of user ids then we need to close anything |
| 96 // associated with the user (all incoming pipes...) on removal. | 97 // associated with the user (all incoming pipes...) on removal. |
| 97 UserState* GetUserState(const shell::Identity& remote_identity); | 98 UserState* GetUserState(const service_manager::Identity& remote_identity); |
| 98 | 99 |
| 99 void AddUserIfNecessary(const shell::Identity& remote_identity); | 100 void AddUserIfNecessary(const service_manager::Identity& remote_identity); |
| 100 | 101 |
| 101 // shell::Service: | 102 // service_manager::Service: |
| 102 void OnStart(const shell::Identity& identity) override; | 103 void OnStart(const service_manager::Identity& identity) override; |
| 103 bool OnConnect(const shell::Identity& remote_identity, | 104 bool OnConnect(const service_manager::Identity& remote_identity, |
| 104 shell::InterfaceRegistry* registry) override; | 105 service_manager::InterfaceRegistry* registry) override; |
| 105 | 106 |
| 106 // WindowServerDelegate: | 107 // WindowServerDelegate: |
| 107 void OnFirstDisplayReady() override; | 108 void OnFirstDisplayReady() override; |
| 108 void OnNoMoreDisplays() override; | 109 void OnNoMoreDisplays() override; |
| 109 bool IsTestConfig() const override; | 110 bool IsTestConfig() const override; |
| 110 void CreateDefaultDisplays() override; | 111 void CreateDefaultDisplays() override; |
| 111 void UpdateTouchTransforms() override; | 112 void UpdateTouchTransforms() override; |
| 112 | 113 |
| 113 // shell::InterfaceFactory<mojom::AccessibilityManager> implementation. | 114 // service_manager::InterfaceFactory<mojom::AccessibilityManager> |
| 114 void Create(const shell::Identity& remote_identity, | 115 // implementation. |
| 116 void Create(const service_manager::Identity& remote_identity, |
| 115 mojom::AccessibilityManagerRequest request) override; | 117 mojom::AccessibilityManagerRequest request) override; |
| 116 | 118 |
| 117 // shell::InterfaceFactory<mojom::Clipboard> implementation. | 119 // service_manager::InterfaceFactory<mojom::Clipboard> implementation. |
| 118 void Create(const shell::Identity& remote_identity, | 120 void Create(const service_manager::Identity& remote_identity, |
| 119 mojom::ClipboardRequest request) override; | 121 mojom::ClipboardRequest request) override; |
| 120 | 122 |
| 121 // shell::InterfaceFactory<mojom::DisplayManager> implementation. | 123 // service_manager::InterfaceFactory<mojom::DisplayManager> implementation. |
| 122 void Create(const shell::Identity& remote_identity, | 124 void Create(const service_manager::Identity& remote_identity, |
| 123 mojom::DisplayManagerRequest request) override; | 125 mojom::DisplayManagerRequest request) override; |
| 124 | 126 |
| 125 // shell::InterfaceFactory<mojom::GpuService> implementation. | 127 // service_manager::InterfaceFactory<mojom::GpuService> implementation. |
| 126 void Create(const shell::Identity& remote_identity, | 128 void Create(const service_manager::Identity& remote_identity, |
| 127 mojom::GpuServiceRequest request) override; | 129 mojom::GpuServiceRequest request) override; |
| 128 | 130 |
| 129 // shell::InterfaceFactory<mojom::IMERegistrar> implementation. | 131 // service_manager::InterfaceFactory<mojom::IMERegistrar> implementation. |
| 130 void Create(const shell::Identity& remote_identity, | 132 void Create(const service_manager::Identity& remote_identity, |
| 131 mojom::IMERegistrarRequest request) override; | 133 mojom::IMERegistrarRequest request) override; |
| 132 | 134 |
| 133 // shell::InterfaceFactory<mojom::IMEServer> implementation. | 135 // service_manager::InterfaceFactory<mojom::IMEServer> implementation. |
| 134 void Create(const shell::Identity& remote_identity, | 136 void Create(const service_manager::Identity& remote_identity, |
| 135 mojom::IMEServerRequest request) override; | 137 mojom::IMEServerRequest request) override; |
| 136 | 138 |
| 137 // shell::InterfaceFactory<mojom::UserAccessManager> implementation. | 139 // service_manager::InterfaceFactory<mojom::UserAccessManager> implementation. |
| 138 void Create(const shell::Identity& remote_identity, | 140 void Create(const service_manager::Identity& remote_identity, |
| 139 mojom::UserAccessManagerRequest request) override; | 141 mojom::UserAccessManagerRequest request) override; |
| 140 | 142 |
| 141 // shell::InterfaceFactory<mojom::UserActivityMonitor> implementation. | 143 // service_manager::InterfaceFactory<mojom::UserActivityMonitor> |
| 142 void Create(const shell::Identity& remote_identity, | 144 // implementation. |
| 145 void Create(const service_manager::Identity& remote_identity, |
| 143 mojom::UserActivityMonitorRequest request) override; | 146 mojom::UserActivityMonitorRequest request) override; |
| 144 | 147 |
| 145 // shell::InterfaceFactory<mojom::WindowManagerWindowTreeFactory> | 148 // service_manager::InterfaceFactory<mojom::WindowManagerWindowTreeFactory> |
| 146 // implementation. | 149 // implementation. |
| 147 void Create(const shell::Identity& remote_identity, | 150 void Create(const service_manager::Identity& remote_identity, |
| 148 mojom::WindowManagerWindowTreeFactoryRequest request) override; | 151 mojom::WindowManagerWindowTreeFactoryRequest request) override; |
| 149 | 152 |
| 150 // shell::InterfaceFactory<mojom::WindowTreeFactory>: | 153 // service_manager::InterfaceFactory<mojom::WindowTreeFactory>: |
| 151 void Create(const shell::Identity& remote_identity, | 154 void Create(const service_manager::Identity& remote_identity, |
| 152 mojom::WindowTreeFactoryRequest request) override; | 155 mojom::WindowTreeFactoryRequest request) override; |
| 153 | 156 |
| 154 // shell::InterfaceFactory<mojom::WindowTreeHostFactory>: | 157 // service_manager::InterfaceFactory<mojom::WindowTreeHostFactory>: |
| 155 void Create(const shell::Identity& remote_identity, | 158 void Create(const service_manager::Identity& remote_identity, |
| 156 mojom::WindowTreeHostFactoryRequest request) override; | 159 mojom::WindowTreeHostFactoryRequest request) override; |
| 157 | 160 |
| 158 // shell::InterfaceFactory<mojom::WindowServerTest> implementation. | 161 // service_manager::InterfaceFactory<mojom::WindowServerTest> implementation. |
| 159 void Create(const shell::Identity& remote_identity, | 162 void Create(const service_manager::Identity& remote_identity, |
| 160 mojom::WindowServerTestRequest request) override; | 163 mojom::WindowServerTestRequest request) override; |
| 161 | 164 |
| 162 std::unique_ptr<ws::WindowServer> window_server_; | 165 std::unique_ptr<ws::WindowServer> window_server_; |
| 163 std::unique_ptr<ui::PlatformEventSource> event_source_; | 166 std::unique_ptr<ui::PlatformEventSource> event_source_; |
| 164 tracing::Provider tracing_; | 167 tracing::Provider tracing_; |
| 165 using PendingRequests = std::vector<std::unique_ptr<PendingRequest>>; | 168 using PendingRequests = std::vector<std::unique_ptr<PendingRequest>>; |
| 166 PendingRequests pending_requests_; | 169 PendingRequests pending_requests_; |
| 167 | 170 |
| 168 UserIdToUserState user_id_to_user_state_; | 171 UserIdToUserState user_id_to_user_state_; |
| 169 | 172 |
| 170 // Provides input-device information via Mojo IPC. Registers Mojo interfaces | 173 // Provides input-device information via Mojo IPC. Registers Mojo interfaces |
| 171 // and must outlive shell::InterfaceRegistry. | 174 // and must outlive service_manager::InterfaceRegistry. |
| 172 InputDeviceServer input_device_server_; | 175 InputDeviceServer input_device_server_; |
| 173 | 176 |
| 174 bool test_config_; | 177 bool test_config_; |
| 175 #if defined(USE_OZONE) | 178 #if defined(USE_OZONE) |
| 176 std::unique_ptr<ui::ClientNativePixmapFactory> client_native_pixmap_factory_; | 179 std::unique_ptr<ui::ClientNativePixmapFactory> client_native_pixmap_factory_; |
| 177 #endif | 180 #endif |
| 178 | 181 |
| 179 // Manages display hardware and handles display management. May register Mojo | 182 // Manages display hardware and handles display management. May register Mojo |
| 180 // interfaces and must outlive shell::InterfaceRegistry. | 183 // interfaces and must outlive service_manager::InterfaceRegistry. |
| 181 std::unique_ptr<display::PlatformScreen> platform_screen_; | 184 std::unique_ptr<display::PlatformScreen> platform_screen_; |
| 182 | 185 |
| 183 std::unique_ptr<ws::TouchController> touch_controller_; | 186 std::unique_ptr<ws::TouchController> touch_controller_; |
| 184 IMERegistrarImpl ime_registrar_; | 187 IMERegistrarImpl ime_registrar_; |
| 185 IMEServerImpl ime_server_; | 188 IMEServerImpl ime_server_; |
| 186 | 189 |
| 187 DISALLOW_COPY_AND_ASSIGN(Service); | 190 DISALLOW_COPY_AND_ASSIGN(Service); |
| 188 }; | 191 }; |
| 189 | 192 |
| 190 } // namespace ui | 193 } // namespace ui |
| 191 | 194 |
| 192 #endif // SERVICES_UI_SERVICE_H_ | 195 #endif // SERVICES_UI_SERVICE_H_ |
| OLD | NEW |