4th attempt to land change to remove NativeViewportService and
[chromium-blink-merge.git] / chromeos / dbus / dbus_thread_manager.cc
blob3e88a50057f2a719b37955d1284600cf0a7dec61
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "chromeos/dbus/dbus_thread_manager.h"
7 #include "base/command_line.h"
8 #include "base/sys_info.h"
9 #include "base/threading/thread.h"
10 #include "chromeos/chromeos_switches.h"
11 #include "chromeos/dbus/bluetooth_adapter_client.h"
12 #include "chromeos/dbus/bluetooth_agent_manager_client.h"
13 #include "chromeos/dbus/bluetooth_device_client.h"
14 #include "chromeos/dbus/bluetooth_gatt_characteristic_client.h"
15 #include "chromeos/dbus/bluetooth_gatt_descriptor_client.h"
16 #include "chromeos/dbus/bluetooth_gatt_manager_client.h"
17 #include "chromeos/dbus/bluetooth_gatt_service_client.h"
18 #include "chromeos/dbus/bluetooth_input_client.h"
19 #include "chromeos/dbus/bluetooth_profile_manager_client.h"
20 #include "chromeos/dbus/cras_audio_client.h"
21 #include "chromeos/dbus/cros_disks_client.h"
22 #include "chromeos/dbus/cryptohome_client.h"
23 #include "chromeos/dbus/dbus_client.h"
24 #include "chromeos/dbus/dbus_client_bundle.h"
25 #include "chromeos/dbus/debug_daemon_client.h"
26 #include "chromeos/dbus/easy_unlock_client.h"
27 #include "chromeos/dbus/gsm_sms_client.h"
28 #include "chromeos/dbus/image_burner_client.h"
29 #include "chromeos/dbus/introspectable_client.h"
30 #include "chromeos/dbus/lorgnette_manager_client.h"
31 #include "chromeos/dbus/modem_messaging_client.h"
32 #include "chromeos/dbus/nfc_adapter_client.h"
33 #include "chromeos/dbus/nfc_device_client.h"
34 #include "chromeos/dbus/nfc_manager_client.h"
35 #include "chromeos/dbus/nfc_record_client.h"
36 #include "chromeos/dbus/nfc_tag_client.h"
37 #include "chromeos/dbus/permission_broker_client.h"
38 #include "chromeos/dbus/power_manager_client.h"
39 #include "chromeos/dbus/power_policy_controller.h"
40 #include "chromeos/dbus/session_manager_client.h"
41 #include "chromeos/dbus/shill_device_client.h"
42 #include "chromeos/dbus/shill_ipconfig_client.h"
43 #include "chromeos/dbus/shill_manager_client.h"
44 #include "chromeos/dbus/shill_profile_client.h"
45 #include "chromeos/dbus/shill_service_client.h"
46 #include "chromeos/dbus/sms_client.h"
47 #include "chromeos/dbus/system_clock_client.h"
48 #include "chromeos/dbus/update_engine_client.h"
49 #include "dbus/bus.h"
50 #include "dbus/dbus_statistics.h"
52 namespace chromeos {
54 static DBusThreadManager* g_dbus_thread_manager = NULL;
55 static bool g_using_dbus_thread_manager_for_testing = false;
57 DBusThreadManager::DBusThreadManager(scoped_ptr<DBusClientBundle> client_bundle)
58 : client_bundle_(client_bundle.Pass()) {
59 dbus::statistics::Initialize();
61 if (client_bundle_->IsUsingAnyRealClient()) {
62 // At least one real DBusClient is used.
63 // Create the D-Bus thread.
64 base::Thread::Options thread_options;
65 thread_options.message_loop_type = base::MessageLoop::TYPE_IO;
66 dbus_thread_.reset(new base::Thread("D-Bus thread"));
67 dbus_thread_->StartWithOptions(thread_options);
69 // Create the connection to the system bus.
70 dbus::Bus::Options system_bus_options;
71 system_bus_options.bus_type = dbus::Bus::SYSTEM;
72 system_bus_options.connection_type = dbus::Bus::PRIVATE;
73 system_bus_options.dbus_task_runner = dbus_thread_->message_loop_proxy();
74 system_bus_ = new dbus::Bus(system_bus_options);
77 // TODO(crbug.com/345586): Move PowerPolicyController out of
78 // DBusThreadManager.
79 power_policy_controller_.reset(new PowerPolicyController);
82 DBusThreadManager::~DBusThreadManager() {
83 // PowerPolicyController's destructor depends on PowerManagerClient.
84 power_policy_controller_.reset();
86 // Delete all D-Bus clients before shutting down the system bus.
87 client_bundle_.reset();
89 // Shut down the bus. During the browser shutdown, it's ok to shut down
90 // the bus synchronously.
91 if (system_bus_.get())
92 system_bus_->ShutdownOnDBusThreadAndBlock();
94 // Stop the D-Bus thread.
95 if (dbus_thread_)
96 dbus_thread_->Stop();
98 dbus::statistics::Shutdown();
100 if (!g_dbus_thread_manager)
101 return; // Called form Shutdown() or local test instance.
103 // There should never be both a global instance and a local instance.
104 CHECK(this == g_dbus_thread_manager);
105 if (g_using_dbus_thread_manager_for_testing) {
106 g_dbus_thread_manager = NULL;
107 g_using_dbus_thread_manager_for_testing = false;
108 VLOG(1) << "DBusThreadManager destroyed";
109 } else {
110 LOG(FATAL) << "~DBusThreadManager() called outside of Shutdown()";
114 dbus::Bus* DBusThreadManager::GetSystemBus() {
115 return system_bus_.get();
118 BluetoothAdapterClient* DBusThreadManager::GetBluetoothAdapterClient() {
119 return client_bundle_->bluetooth_adapter_client();
122 BluetoothAgentManagerClient*
123 DBusThreadManager::GetBluetoothAgentManagerClient() {
124 return client_bundle_->bluetooth_agent_manager_client();
127 BluetoothDeviceClient* DBusThreadManager::GetBluetoothDeviceClient() {
128 return client_bundle_->bluetooth_device_client();
131 BluetoothGattCharacteristicClient*
132 DBusThreadManager::GetBluetoothGattCharacteristicClient() {
133 return client_bundle_->bluetooth_gatt_characteristic_client();
136 BluetoothGattDescriptorClient*
137 DBusThreadManager::GetBluetoothGattDescriptorClient() {
138 return client_bundle_->bluetooth_gatt_descriptor_client();
141 BluetoothGattManagerClient*
142 DBusThreadManager::GetBluetoothGattManagerClient() {
143 return client_bundle_->bluetooth_gatt_manager_client();
146 BluetoothGattServiceClient*
147 DBusThreadManager::GetBluetoothGattServiceClient() {
148 return client_bundle_->bluetooth_gatt_service_client();
151 BluetoothInputClient* DBusThreadManager::GetBluetoothInputClient() {
152 return client_bundle_->bluetooth_input_client();
155 BluetoothProfileManagerClient*
156 DBusThreadManager::GetBluetoothProfileManagerClient() {
157 return client_bundle_->bluetooth_profile_manager_client();
160 CrasAudioClient* DBusThreadManager::GetCrasAudioClient() {
161 return client_bundle_->cras_audio_client();
164 CrosDisksClient* DBusThreadManager::GetCrosDisksClient() {
165 return client_bundle_->cros_disks_client();
168 CryptohomeClient* DBusThreadManager::GetCryptohomeClient() {
169 return client_bundle_->cryptohome_client();
172 DebugDaemonClient* DBusThreadManager::GetDebugDaemonClient() {
173 return client_bundle_->debug_daemon_client();
176 EasyUnlockClient* DBusThreadManager::GetEasyUnlockClient() {
177 return client_bundle_->easy_unlock_client();
179 LorgnetteManagerClient*
180 DBusThreadManager::GetLorgnetteManagerClient() {
181 return client_bundle_->lorgnette_manager_client();
184 ShillDeviceClient*
185 DBusThreadManager::GetShillDeviceClient() {
186 return client_bundle_->shill_device_client();
189 ShillIPConfigClient*
190 DBusThreadManager::GetShillIPConfigClient() {
191 return client_bundle_->shill_ipconfig_client();
194 ShillManagerClient*
195 DBusThreadManager::GetShillManagerClient() {
196 return client_bundle_->shill_manager_client();
199 ShillServiceClient*
200 DBusThreadManager::GetShillServiceClient() {
201 return client_bundle_->shill_service_client();
204 ShillProfileClient*
205 DBusThreadManager::GetShillProfileClient() {
206 return client_bundle_->shill_profile_client();
209 GsmSMSClient* DBusThreadManager::GetGsmSMSClient() {
210 return client_bundle_->gsm_sms_client();
213 ImageBurnerClient* DBusThreadManager::GetImageBurnerClient() {
214 return client_bundle_->image_burner_client();
217 IntrospectableClient* DBusThreadManager::GetIntrospectableClient() {
218 return client_bundle_->introspectable_client();
221 ModemMessagingClient* DBusThreadManager::GetModemMessagingClient() {
222 return client_bundle_->modem_messaging_client();
225 NfcAdapterClient* DBusThreadManager::GetNfcAdapterClient() {
226 return client_bundle_->nfc_adapter_client();
229 NfcDeviceClient* DBusThreadManager::GetNfcDeviceClient() {
230 return client_bundle_->nfc_device_client();
233 NfcManagerClient* DBusThreadManager::GetNfcManagerClient() {
234 return client_bundle_->nfc_manager_client();
237 NfcRecordClient* DBusThreadManager::GetNfcRecordClient() {
238 return client_bundle_->nfc_record_client();
241 NfcTagClient* DBusThreadManager::GetNfcTagClient() {
242 return client_bundle_->nfc_tag_client();
245 PermissionBrokerClient* DBusThreadManager::GetPermissionBrokerClient() {
246 return client_bundle_->permission_broker_client();
249 PowerManagerClient* DBusThreadManager::GetPowerManagerClient() {
250 return client_bundle_->power_manager_client();
253 SessionManagerClient* DBusThreadManager::GetSessionManagerClient() {
254 return client_bundle_->session_manager_client();
257 SMSClient* DBusThreadManager::GetSMSClient() {
258 return client_bundle_->sms_client();
261 SystemClockClient* DBusThreadManager::GetSystemClockClient() {
262 return client_bundle_->system_clock_client();
265 UpdateEngineClient* DBusThreadManager::GetUpdateEngineClient() {
266 return client_bundle_->update_engine_client();
269 PowerPolicyController* DBusThreadManager::GetPowerPolicyController() {
270 return power_policy_controller_.get();
273 void DBusThreadManager::InitializeClients() {
274 GetBluetoothAdapterClient()->Init(GetSystemBus());
275 GetBluetoothAgentManagerClient()->Init(GetSystemBus());
276 GetBluetoothDeviceClient()->Init(GetSystemBus());
277 GetBluetoothGattCharacteristicClient()->Init(GetSystemBus());
278 GetBluetoothGattDescriptorClient()->Init(GetSystemBus());
279 GetBluetoothGattManagerClient()->Init(GetSystemBus());
280 GetBluetoothGattServiceClient()->Init(GetSystemBus());
281 GetBluetoothInputClient()->Init(GetSystemBus());
282 GetBluetoothProfileManagerClient()->Init(GetSystemBus());
283 GetCrasAudioClient()->Init(GetSystemBus());
284 GetCrosDisksClient()->Init(GetSystemBus());
285 GetCryptohomeClient()->Init(GetSystemBus());
286 GetDebugDaemonClient()->Init(GetSystemBus());
287 GetEasyUnlockClient()->Init(GetSystemBus());
288 GetGsmSMSClient()->Init(GetSystemBus());
289 GetImageBurnerClient()->Init(GetSystemBus());
290 GetIntrospectableClient()->Init(GetSystemBus());
291 GetLorgnetteManagerClient()->Init(GetSystemBus());
292 GetModemMessagingClient()->Init(GetSystemBus());
293 GetPermissionBrokerClient()->Init(GetSystemBus());
294 GetPowerManagerClient()->Init(GetSystemBus());
295 GetSessionManagerClient()->Init(GetSystemBus());
296 GetShillDeviceClient()->Init(GetSystemBus());
297 GetShillIPConfigClient()->Init(GetSystemBus());
298 GetShillManagerClient()->Init(GetSystemBus());
299 GetShillServiceClient()->Init(GetSystemBus());
300 GetShillProfileClient()->Init(GetSystemBus());
301 GetSMSClient()->Init(GetSystemBus());
302 GetSystemClockClient()->Init(GetSystemBus());
303 GetUpdateEngineClient()->Init(GetSystemBus());
305 // Initialize the NFC clients in the correct order. The order of
306 // initialization matters due to dependencies that exist between the
307 // client objects.
308 GetNfcManagerClient()->Init(GetSystemBus());
309 GetNfcAdapterClient()->Init(GetSystemBus());
310 GetNfcDeviceClient()->Init(GetSystemBus());
311 GetNfcTagClient()->Init(GetSystemBus());
312 GetNfcRecordClient()->Init(GetSystemBus());
314 // PowerPolicyController is dependent on PowerManagerClient, so
315 // initialize it after the main list of clients.
316 if (GetPowerPolicyController())
317 GetPowerPolicyController()->Init(this);
319 // This must be called after the list of clients so they've each had a
320 // chance to register with their object g_dbus_thread_managers.
321 if (GetSystemBus())
322 GetSystemBus()->GetManagedObjects();
324 client_bundle_->SetupDefaultEnvironment();
327 bool DBusThreadManager::IsUsingStub(DBusClientBundle::DBusClientType client) {
328 return client_bundle_->IsUsingStub(client);
331 // static
332 void DBusThreadManager::Initialize() {
333 // If we initialize DBusThreadManager twice we may also be shutting it down
334 // early; do not allow that.
335 if (g_using_dbus_thread_manager_for_testing)
336 return;
338 CHECK(!g_dbus_thread_manager);
339 bool use_dbus_stub = !base::SysInfo::IsRunningOnChromeOS() ||
340 CommandLine::ForCurrentProcess()->HasSwitch(
341 chromeos::switches::kDbusStub);
342 bool force_unstub_clients = CommandLine::ForCurrentProcess()->HasSwitch(
343 chromeos::switches::kDbusUnstubClients);
344 // Determine whether we use stub or real client implementations.
345 if (force_unstub_clients) {
346 InitializeWithPartialStub(
347 CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
348 chromeos::switches::kDbusUnstubClients));
349 } else if (use_dbus_stub) {
350 InitializeWithStubs();
351 } else {
352 InitializeWithRealClients();
356 // static
357 scoped_ptr<DBusThreadManagerSetter> DBusThreadManager::GetSetterForTesting() {
358 if (!g_using_dbus_thread_manager_for_testing) {
359 g_using_dbus_thread_manager_for_testing = true;
360 InitializeWithStubs();
363 return make_scoped_ptr(new DBusThreadManagerSetter());
366 // static
367 void DBusThreadManager::CreateGlobalInstance(
368 DBusClientBundle::DBusClientTypeMask unstub_client_mask) {
369 CHECK(!g_dbus_thread_manager);
370 g_dbus_thread_manager = new DBusThreadManager(
371 make_scoped_ptr(new DBusClientBundle(unstub_client_mask)));
372 g_dbus_thread_manager->InitializeClients();
375 // static
376 void DBusThreadManager::InitializeWithRealClients() {
377 CreateGlobalInstance(~static_cast<DBusClientBundle::DBusClientTypeMask>(0));
378 VLOG(1) << "DBusThreadManager initialized for Chrome OS";
381 // static
382 void DBusThreadManager::InitializeWithStubs() {
383 CreateGlobalInstance(0 /* unstub_client_mask */);
384 VLOG(1) << "DBusThreadManager created for testing";
387 // static
388 void DBusThreadManager::InitializeWithPartialStub(
389 const std::string& unstub_clients) {
390 DBusClientBundle::DBusClientTypeMask unstub_client_mask =
391 DBusClientBundle::ParseUnstubList(unstub_clients);
392 // We should have something parsed correctly here.
393 LOG_IF(FATAL, unstub_client_mask == 0)
394 << "Switch values for --" << chromeos::switches::kDbusUnstubClients
395 << " cannot be parsed: " << unstub_clients;
396 VLOG(1) << "DBusThreadManager initialized for mixed runtime environment";
397 CreateGlobalInstance(unstub_client_mask);
400 // static
401 bool DBusThreadManager::IsInitialized() {
402 return g_dbus_thread_manager != NULL;
405 // static
406 void DBusThreadManager::Shutdown() {
407 // Ensure that we only shutdown DBusThreadManager once.
408 CHECK(g_dbus_thread_manager);
409 DBusThreadManager* dbus_thread_manager = g_dbus_thread_manager;
410 g_dbus_thread_manager = NULL;
411 g_using_dbus_thread_manager_for_testing = false;
412 delete dbus_thread_manager;
413 VLOG(1) << "DBusThreadManager Shutdown completed";
416 // static
417 DBusThreadManager* DBusThreadManager::Get() {
418 CHECK(g_dbus_thread_manager)
419 << "DBusThreadManager::Get() called before Initialize()";
420 return g_dbus_thread_manager;
423 DBusThreadManagerSetter::DBusThreadManagerSetter() {
426 DBusThreadManagerSetter::~DBusThreadManagerSetter() {
429 void DBusThreadManagerSetter::SetBluetoothAdapterClient(
430 scoped_ptr<BluetoothAdapterClient> client) {
431 DBusThreadManager::Get()->client_bundle_->bluetooth_adapter_client_ =
432 client.Pass();
435 void DBusThreadManagerSetter::SetBluetoothAgentManagerClient(
436 scoped_ptr<BluetoothAgentManagerClient> client) {
437 DBusThreadManager::Get()->client_bundle_->bluetooth_agent_manager_client_ =
438 client.Pass();
441 void DBusThreadManagerSetter::SetBluetoothDeviceClient(
442 scoped_ptr<BluetoothDeviceClient> client) {
443 DBusThreadManager::Get()->client_bundle_->bluetooth_device_client_ =
444 client.Pass();
447 void DBusThreadManagerSetter::SetBluetoothGattCharacteristicClient(
448 scoped_ptr<BluetoothGattCharacteristicClient> client) {
449 DBusThreadManager::Get()->client_bundle_->
450 bluetooth_gatt_characteristic_client_ = client.Pass();
453 void DBusThreadManagerSetter::SetBluetoothGattDescriptorClient(
454 scoped_ptr<BluetoothGattDescriptorClient> client) {
455 DBusThreadManager::Get()->client_bundle_->bluetooth_gatt_descriptor_client_ =
456 client.Pass();
459 void DBusThreadManagerSetter::SetBluetoothGattManagerClient(
460 scoped_ptr<BluetoothGattManagerClient> client) {
461 DBusThreadManager::Get()->client_bundle_->bluetooth_gatt_manager_client_ =
462 client.Pass();
465 void DBusThreadManagerSetter::SetBluetoothGattServiceClient(
466 scoped_ptr<BluetoothGattServiceClient> client) {
467 DBusThreadManager::Get()->client_bundle_->bluetooth_gatt_service_client_ =
468 client.Pass();
471 void DBusThreadManagerSetter::SetBluetoothInputClient(
472 scoped_ptr<BluetoothInputClient> client) {
473 DBusThreadManager::Get()->client_bundle_->bluetooth_input_client_ =
474 client.Pass();
477 void DBusThreadManagerSetter::SetBluetoothProfileManagerClient(
478 scoped_ptr<BluetoothProfileManagerClient> client) {
479 DBusThreadManager::Get()->client_bundle_->bluetooth_profile_manager_client_ =
480 client.Pass();
483 void DBusThreadManagerSetter::SetCrasAudioClient(
484 scoped_ptr<CrasAudioClient> client) {
485 DBusThreadManager::Get()->client_bundle_->cras_audio_client_ = client.Pass();
488 void DBusThreadManagerSetter::SetCrosDisksClient(
489 scoped_ptr<CrosDisksClient> client) {
490 DBusThreadManager::Get()->client_bundle_->cros_disks_client_ = client.Pass();
493 void DBusThreadManagerSetter::SetCryptohomeClient(
494 scoped_ptr<CryptohomeClient> client) {
495 DBusThreadManager::Get()->client_bundle_->cryptohome_client_ = client.Pass();
498 void DBusThreadManagerSetter::SetDebugDaemonClient(
499 scoped_ptr<DebugDaemonClient> client) {
500 DBusThreadManager::Get()->client_bundle_->debug_daemon_client_ =
501 client.Pass();
504 void DBusThreadManagerSetter::SetEasyUnlockClient(
505 scoped_ptr<EasyUnlockClient> client) {
506 DBusThreadManager::Get()->client_bundle_->easy_unlock_client_ = client.Pass();
509 void DBusThreadManagerSetter::SetLorgnetteManagerClient(
510 scoped_ptr<LorgnetteManagerClient> client) {
511 DBusThreadManager::Get()->client_bundle_->lorgnette_manager_client_ =
512 client.Pass();
515 void DBusThreadManagerSetter::SetShillDeviceClient(
516 scoped_ptr<ShillDeviceClient> client) {
517 DBusThreadManager::Get()->client_bundle_->shill_device_client_ =
518 client.Pass();
521 void DBusThreadManagerSetter::SetShillIPConfigClient(
522 scoped_ptr<ShillIPConfigClient> client) {
523 DBusThreadManager::Get()->client_bundle_->shill_ipconfig_client_ =
524 client.Pass();
527 void DBusThreadManagerSetter::SetShillManagerClient(
528 scoped_ptr<ShillManagerClient> client) {
529 DBusThreadManager::Get()->client_bundle_->shill_manager_client_ =
530 client.Pass();
533 void DBusThreadManagerSetter::SetShillServiceClient(
534 scoped_ptr<ShillServiceClient> client) {
535 DBusThreadManager::Get()->client_bundle_->shill_service_client_ =
536 client.Pass();
539 void DBusThreadManagerSetter::SetShillProfileClient(
540 scoped_ptr<ShillProfileClient> client) {
541 DBusThreadManager::Get()->client_bundle_->shill_profile_client_ =
542 client.Pass();
545 void DBusThreadManagerSetter::SetGsmSMSClient(
546 scoped_ptr<GsmSMSClient> client) {
547 DBusThreadManager::Get()->client_bundle_->gsm_sms_client_ = client.Pass();
550 void DBusThreadManagerSetter::SetImageBurnerClient(
551 scoped_ptr<ImageBurnerClient> client) {
552 DBusThreadManager::Get()->client_bundle_->image_burner_client_ =
553 client.Pass();
556 void DBusThreadManagerSetter::SetIntrospectableClient(
557 scoped_ptr<IntrospectableClient> client) {
558 DBusThreadManager::Get()->client_bundle_->introspectable_client_ =
559 client.Pass();
562 void DBusThreadManagerSetter::SetModemMessagingClient(
563 scoped_ptr<ModemMessagingClient> client) {
564 DBusThreadManager::Get()->client_bundle_->modem_messaging_client_ =
565 client.Pass();
568 void DBusThreadManagerSetter::SetNfcAdapterClient(
569 scoped_ptr<NfcAdapterClient> client) {
570 DBusThreadManager::Get()->client_bundle_->nfc_adapter_client_ = client.Pass();
573 void DBusThreadManagerSetter::SetNfcDeviceClient(
574 scoped_ptr<NfcDeviceClient> client) {
575 DBusThreadManager::Get()->client_bundle_->nfc_device_client_ = client.Pass();
578 void DBusThreadManagerSetter::SetNfcManagerClient(
579 scoped_ptr<NfcManagerClient> client) {
580 DBusThreadManager::Get()->client_bundle_->nfc_manager_client_ = client.Pass();
583 void DBusThreadManagerSetter::SetNfcRecordClient(
584 scoped_ptr<NfcRecordClient> client) {
585 DBusThreadManager::Get()->client_bundle_->nfc_record_client_ = client.Pass();
588 void DBusThreadManagerSetter::SetNfcTagClient(
589 scoped_ptr<NfcTagClient> client) {
590 DBusThreadManager::Get()->client_bundle_->nfc_tag_client_ = client.Pass();
593 void DBusThreadManagerSetter::SetPermissionBrokerClient(
594 scoped_ptr<PermissionBrokerClient> client) {
595 DBusThreadManager::Get()->client_bundle_->permission_broker_client_ =
596 client.Pass();
599 void DBusThreadManagerSetter::SetPowerManagerClient(
600 scoped_ptr<PowerManagerClient> client) {
601 DBusThreadManager::Get()->power_policy_controller_.reset();
602 DBusThreadManager::Get()->client_bundle_->power_manager_client_ =
603 client.Pass();
604 DBusThreadManager::Get()->power_policy_controller_.reset(
605 new PowerPolicyController);
606 DBusThreadManager::Get()->power_policy_controller_->Init(
607 DBusThreadManager::Get());
610 void DBusThreadManagerSetter::SetSessionManagerClient(
611 scoped_ptr<SessionManagerClient> client) {
612 DBusThreadManager::Get()->client_bundle_->session_manager_client_ =
613 client.Pass();
616 void DBusThreadManagerSetter::SetSMSClient(scoped_ptr<SMSClient> client) {
617 DBusThreadManager::Get()->client_bundle_->sms_client_ = client.Pass();
620 void DBusThreadManagerSetter::SetSystemClockClient(
621 scoped_ptr<SystemClockClient> client) {
622 DBusThreadManager::Get()->client_bundle_->system_clock_client_ =
623 client.Pass();
626 void DBusThreadManagerSetter::SetUpdateEngineClient(
627 scoped_ptr<UpdateEngineClient> client) {
628 DBusThreadManager::Get()->client_bundle_->update_engine_client_ =
629 client.Pass();
632 } // namespace chromeos