OLD | NEW |
---|---|
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 #include "chrome/browser/browser_process_platform_part_chromeos.h" | 5 #include "chrome/browser/browser_process_platform_part_chromeos.h" |
6 | 6 |
7 #include "ash/public/interfaces/constants.mojom.h" | 7 #include "ash/public/interfaces/constants.mojom.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
10 #include "base/time/default_tick_clock.h" | 10 #include "base/time/default_tick_clock.h" |
(...skipping 26 matching lines...) Expand all Loading... | |
37 #include "chromeos/geolocation/simple_geolocation_provider.h" | 37 #include "chromeos/geolocation/simple_geolocation_provider.h" |
38 #include "chromeos/timezone/timezone_resolver.h" | 38 #include "chromeos/timezone/timezone_resolver.h" |
39 #include "components/session_manager/core/session_manager.h" | 39 #include "components/session_manager/core/session_manager.h" |
40 #include "components/user_manager/user_manager.h" | 40 #include "components/user_manager/user_manager.h" |
41 #include "mash/public/interfaces/launchable.mojom.h" | 41 #include "mash/public/interfaces/launchable.mojom.h" |
42 #include "services/preferences/public/interfaces/preferences.mojom.h" | 42 #include "services/preferences/public/interfaces/preferences.mojom.h" |
43 #include "services/service_manager/public/cpp/binder_registry.h" | 43 #include "services/service_manager/public/cpp/binder_registry.h" |
44 #include "services/service_manager/public/cpp/interface_provider.h" | 44 #include "services/service_manager/public/cpp/interface_provider.h" |
45 #include "services/service_manager/public/cpp/service.h" | 45 #include "services/service_manager/public/cpp/service.h" |
46 #include "services/ui/public/interfaces/constants.mojom.h" | 46 #include "services/ui/public/interfaces/constants.mojom.h" |
47 #include "services/ui/service.h" | |
47 | 48 |
48 #if defined(USE_OZONE) | 49 #if defined(USE_OZONE) |
49 #include "content/public/common/service_manager_connection.h" | 50 #include "content/public/common/service_manager_connection.h" |
50 #include "services/service_manager/runner/common/client_util.h" | 51 #include "services/service_manager/runner/common/client_util.h" |
51 #include "services/ui/public/cpp/input_devices/input_device_controller.h" | 52 #include "services/ui/public/cpp/input_devices/input_device_controller.h" |
52 #include "services/ui/public/cpp/input_devices/input_device_controller_client.h" | 53 #include "services/ui/public/cpp/input_devices/input_device_controller_client.h" |
53 #include "services/ui/public/interfaces/constants.mojom.h" | 54 #include "services/ui/public/interfaces/constants.mojom.h" |
54 #endif | 55 #endif |
55 | 56 |
56 namespace { | 57 namespace { |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
122 | 123 |
123 service_manager::BinderRegistry interfaces_; | 124 service_manager::BinderRegistry interfaces_; |
124 mojo::BindingSet<mash::mojom::Launchable> bindings_; | 125 mojo::BindingSet<mash::mojom::Launchable> bindings_; |
125 #if defined(USE_OZONE) | 126 #if defined(USE_OZONE) |
126 ui::InputDeviceController input_device_controller_; | 127 ui::InputDeviceController input_device_controller_; |
127 #endif | 128 #endif |
128 | 129 |
129 DISALLOW_COPY_AND_ASSIGN(ChromeServiceChromeOS); | 130 DISALLOW_COPY_AND_ASSIGN(ChromeServiceChromeOS); |
130 }; | 131 }; |
131 | 132 |
133 std::unique_ptr<service_manager::Service> CreateEmbeddedUIService( | |
134 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, | |
135 base::WeakPtr<ui::ImageCursorsSet> image_cursors_set_weak_ptr) { | |
136 ui::Service::InProcessConfig config; | |
137 config.resource_runner = task_runner; | |
138 config.image_cursors_set_weak_ptr = image_cursors_set_weak_ptr; | |
139 return base::MakeUnique<ui::Service>(&config); | |
140 } | |
141 | |
132 } // namespace | 142 } // namespace |
133 | 143 |
134 BrowserProcessPlatformPart::BrowserProcessPlatformPart() | 144 BrowserProcessPlatformPart::BrowserProcessPlatformPart() |
135 : created_profile_helper_(false) {} | 145 : created_profile_helper_(false) {} |
136 | 146 |
137 BrowserProcessPlatformPart::~BrowserProcessPlatformPart() { | 147 BrowserProcessPlatformPart::~BrowserProcessPlatformPart() { |
138 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); | 148 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); |
139 } | 149 } |
140 | 150 |
141 void BrowserProcessPlatformPart::InitializeAutomaticRebootManager() { | 151 void BrowserProcessPlatformPart::InitializeAutomaticRebootManager() { |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
267 services->insert(std::make_pair(prefs::mojom::kForwarderServiceName, info)); | 277 services->insert(std::make_pair(prefs::mojom::kForwarderServiceName, info)); |
268 } | 278 } |
269 | 279 |
270 if (!ash_util::IsRunningInMash()) { | 280 if (!ash_util::IsRunningInMash()) { |
271 service_manager::EmbeddedServiceInfo info; | 281 service_manager::EmbeddedServiceInfo info; |
272 info.factory = base::Bind(&ash_util::CreateEmbeddedAshService, | 282 info.factory = base::Bind(&ash_util::CreateEmbeddedAshService, |
273 base::ThreadTaskRunnerHandle::Get()); | 283 base::ThreadTaskRunnerHandle::Get()); |
274 info.task_runner = base::ThreadTaskRunnerHandle::Get(); | 284 info.task_runner = base::ThreadTaskRunnerHandle::Get(); |
275 services->insert(std::make_pair(ash::mojom::kServiceName, info)); | 285 services->insert(std::make_pair(ash::mojom::kServiceName, info)); |
276 } | 286 } |
287 | |
288 if (chromeos::GetAshConfig() == ash::Config::MUS) { | |
sky
2017/07/13 20:37:20
This certainly works for mushrome, but given we wa
| |
289 service_manager::EmbeddedServiceInfo info; | |
290 info.factory = base::Bind(&CreateEmbeddedUIService, | |
291 base::ThreadTaskRunnerHandle::Get(), | |
292 image_cursors_set_.GetWeakPtr()); | |
293 info.use_own_thread = true; | |
294 info.message_loop_type = base::MessageLoop::TYPE_UI; | |
295 info.thread_priority = base::ThreadPriority::DISPLAY; | |
296 services->insert(std::make_pair(ui::mojom::kServiceName, info)); | |
297 } | |
277 } | 298 } |
278 | 299 |
279 chromeos::system::SystemClock* BrowserProcessPlatformPart::GetSystemClock() { | 300 chromeos::system::SystemClock* BrowserProcessPlatformPart::GetSystemClock() { |
280 if (!system_clock_.get()) | 301 if (!system_clock_.get()) |
281 system_clock_.reset(new chromeos::system::SystemClock()); | 302 system_clock_.reset(new chromeos::system::SystemClock()); |
282 return system_clock_.get(); | 303 return system_clock_.get(); |
283 } | 304 } |
284 | 305 |
285 void BrowserProcessPlatformPart::DestroySystemClock() { | 306 void BrowserProcessPlatformPart::DestroySystemClock() { |
286 system_clock_.reset(); | 307 system_clock_.reset(); |
(...skipping 24 matching lines...) Expand all Loading... | |
311 } | 332 } |
312 return input_device_controller_client_.get(); | 333 return input_device_controller_client_.get(); |
313 } | 334 } |
314 #endif | 335 #endif |
315 | 336 |
316 void BrowserProcessPlatformPart::CreateProfileHelper() { | 337 void BrowserProcessPlatformPart::CreateProfileHelper() { |
317 DCHECK(!created_profile_helper_ && !profile_helper_); | 338 DCHECK(!created_profile_helper_ && !profile_helper_); |
318 created_profile_helper_ = true; | 339 created_profile_helper_ = true; |
319 profile_helper_.reset(new chromeos::ProfileHelper()); | 340 profile_helper_.reset(new chromeos::ProfileHelper()); |
320 } | 341 } |
OLD | NEW |