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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 class ScreenManager; | 46 class ScreenManager; |
47 } | 47 } |
48 | 48 |
49 namespace service_manager { | 49 namespace service_manager { |
50 class Connector; | 50 class Connector; |
51 class Identity; | 51 class Identity; |
52 } | 52 } |
53 | 53 |
54 namespace ui { | 54 namespace ui { |
55 | 55 |
56 class ImageCursors; | 56 class ImageCursorsHolder; |
57 class InputDeviceController; | 57 class InputDeviceController; |
58 class PlatformEventSource; | 58 class PlatformEventSource; |
59 | 59 |
60 namespace ws { | 60 namespace ws { |
61 class WindowServer; | 61 class WindowServer; |
62 } | 62 } |
63 | 63 |
64 class Service : public service_manager::Service, | 64 class Service : public service_manager::Service, |
65 public ws::WindowServerDelegate { | 65 public ws::WindowServerDelegate { |
66 public: | 66 public: |
67 // |resource_runner| is the task runner for the thread which can be used to | 67 // |resource_runner| is the task runner for the thread which can be used to |
68 // load resources. Used when UI Service run inside a Window Manager's | 68 // load resources. Used when UI Service run inside a Window Manager's |
69 // process (and so the resources need to be loaded on the WM's thread). | 69 // process (and so the resources need to be loaded on the WM's thread). |
70 // When UI Service is run in a separate process, |resource_runner| | 70 // When UI Service is run in a separate process, |resource_runner| |
71 // should be null, and resources are loaded on the UI Service's thread. | 71 // should be null, and resources are loaded on the UI Service's thread. |
72 // |image_cursors_weak_ptr| is also only used when the UI service runs | 72 // |image_cursors_weak_ptr| is also only used when the UI service runs |
73 // in-process. It can only be dereferenced on |resource_runner|. | 73 // in-process. It can only be dereferenced on |resource_runner|. |
74 Service(scoped_refptr<base::SingleThreadTaskRunner> resource_runner, | 74 Service(scoped_refptr<base::SingleThreadTaskRunner> resource_runner, |
75 base::WeakPtr<ui::ImageCursors> image_cursors_weak_ptr); | 75 base::WeakPtr<ui::ImageCursorsHolder> image_cursors_holder_weak_ptr); |
76 ~Service() override; | 76 ~Service() override; |
77 | 77 |
78 private: | 78 private: |
79 // Holds InterfaceRequests received before the first WindowTreeHost Display | 79 // Holds InterfaceRequests received before the first WindowTreeHost Display |
80 // has been established. | 80 // has been established. |
81 struct PendingRequest; | 81 struct PendingRequest; |
82 struct UserState; | 82 struct UserState; |
83 | 83 |
84 using UserIdToUserState = std::map<ws::UserId, std::unique_ptr<UserState>>; | 84 using UserIdToUserState = std::map<ws::UserId, std::unique_ptr<UserState>>; |
85 | 85 |
(...skipping 18 matching lines...) Expand all Loading... |
104 mojo::ScopedMessagePipeHandle interface_pipe) override; | 104 mojo::ScopedMessagePipeHandle interface_pipe) override; |
105 | 105 |
106 // WindowServerDelegate: | 106 // WindowServerDelegate: |
107 void StartDisplayInit() override; | 107 void StartDisplayInit() override; |
108 void OnFirstDisplayReady() override; | 108 void OnFirstDisplayReady() override; |
109 void OnNoMoreDisplays() override; | 109 void OnNoMoreDisplays() override; |
110 bool IsTestConfig() const override; | 110 bool IsTestConfig() const override; |
111 void OnWillCreateTreeForWindowManager( | 111 void OnWillCreateTreeForWindowManager( |
112 bool automatically_create_display_roots) override; | 112 bool automatically_create_display_roots) override; |
113 scoped_refptr<base::SingleThreadTaskRunner>& GetResourceRunner() override; | 113 scoped_refptr<base::SingleThreadTaskRunner>& GetResourceRunner() override; |
114 base::WeakPtr<ui::ImageCursors> GetImageCursorsWeakPtr() override; | 114 base::WeakPtr<ui::ImageCursorsHolder> GetImageCursorsHolderWeakPtr() override; |
115 | 115 |
116 void BindAccessibilityManagerRequest( | 116 void BindAccessibilityManagerRequest( |
117 const service_manager::BindSourceInfo& source_info, | 117 const service_manager::BindSourceInfo& source_info, |
118 mojom::AccessibilityManagerRequest request); | 118 mojom::AccessibilityManagerRequest request); |
119 | 119 |
120 void BindClipboardRequest(const service_manager::BindSourceInfo& source_info, | 120 void BindClipboardRequest(const service_manager::BindSourceInfo& source_info, |
121 mojom::ClipboardRequest request); | 121 mojom::ClipboardRequest request); |
122 | 122 |
123 void BindDisplayManagerRequest( | 123 void BindDisplayManagerRequest( |
124 const service_manager::BindSourceInfo& source_info, | 124 const service_manager::BindSourceInfo& source_info, |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 // its own process. | 177 // its own process. |
178 bool in_process_; | 178 bool in_process_; |
179 | 179 |
180 // Can be used to access resources. Will be null until the service is started | 180 // Can be used to access resources. Will be null until the service is started |
181 // if the UI Service doesn't run in WM's process. | 181 // if the UI Service doesn't run in WM's process. |
182 scoped_refptr<base::SingleThreadTaskRunner> resource_runner_; | 182 scoped_refptr<base::SingleThreadTaskRunner> resource_runner_; |
183 | 183 |
184 // Used when UI Service runs in-process, and can only be de-referenced on | 184 // Used when UI Service runs in-process, and can only be de-referenced on |
185 // |resource_runner_|. When UI Service doesn't run in-process, this points to | 185 // |resource_runner_|. When UI Service doesn't run in-process, this points to |
186 // |image_cursors_| (and should be de-referenced on UI Serivice's thread). | 186 // |image_cursors_| (and should be de-referenced on UI Serivice's thread). |
187 base::WeakPtr<ui::ImageCursors> image_cursors_weak_ptr_; | 187 base::WeakPtr<ui::ImageCursorsHolder> image_cursors_holder_weak_ptr_; |
188 | 188 |
189 // Used when UI Service doesn't run in-process. | 189 // Used when UI Service doesn't run in-process. |
190 std::unique_ptr<ui::ImageCursors> image_cursors_; | 190 std::unique_ptr<ui::ImageCursorsHolder> image_cursors_holder_; |
191 | 191 |
192 bool test_config_; | 192 bool test_config_; |
193 #if defined(USE_OZONE) | 193 #if defined(USE_OZONE) |
194 std::unique_ptr<gfx::ClientNativePixmapFactory> client_native_pixmap_factory_; | 194 std::unique_ptr<gfx::ClientNativePixmapFactory> client_native_pixmap_factory_; |
195 #if defined(OS_CHROMEOS) | 195 #if defined(OS_CHROMEOS) |
196 std::unique_ptr<InputDeviceController> input_device_controller_; | 196 std::unique_ptr<InputDeviceController> input_device_controller_; |
197 #endif | 197 #endif |
198 #endif | 198 #endif |
199 | 199 |
200 // Manages display hardware and handles display management. May register Mojo | 200 // Manages display hardware and handles display management. May register Mojo |
(...skipping 10 matching lines...) Expand all Loading... |
211 | 211 |
212 // Set to true in StartDisplayInit(). | 212 // Set to true in StartDisplayInit(). |
213 bool is_gpu_ready_ = false; | 213 bool is_gpu_ready_ = false; |
214 | 214 |
215 DISALLOW_COPY_AND_ASSIGN(Service); | 215 DISALLOW_COPY_AND_ASSIGN(Service); |
216 }; | 216 }; |
217 | 217 |
218 } // namespace ui | 218 } // namespace ui |
219 | 219 |
220 #endif // SERVICES_UI_SERVICE_H_ | 220 #endif // SERVICES_UI_SERVICE_H_ |
OLD | NEW |