Chromium Code Reviews| 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 #include "chromeos/dbus/dbus_clients_common.h" | 5 #include "chromeos/dbus/dbus_clients_common.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "chromeos/chromeos_switches.h" | 8 #include "chromeos/chromeos_switches.h" |
| 9 #include "chromeos/dbus/biod/biod_client.h" | |
| 9 #include "chromeos/dbus/cras_audio_client.h" | 10 #include "chromeos/dbus/cras_audio_client.h" |
| 10 #include "chromeos/dbus/cryptohome_client.h" | 11 #include "chromeos/dbus/cryptohome_client.h" |
| 11 #include "chromeos/dbus/dbus_client_implementation_type.h" | 12 #include "chromeos/dbus/dbus_client_implementation_type.h" |
| 12 #include "chromeos/dbus/dbus_thread_manager.h" | 13 #include "chromeos/dbus/dbus_thread_manager.h" |
| 13 #include "chromeos/dbus/fake_cras_audio_client.h" | 14 #include "chromeos/dbus/fake_cras_audio_client.h" |
| 14 #include "chromeos/dbus/fake_cryptohome_client.h" | 15 #include "chromeos/dbus/fake_cryptohome_client.h" |
| 15 #include "chromeos/dbus/fake_gsm_sms_client.h" | 16 #include "chromeos/dbus/fake_gsm_sms_client.h" |
| 16 #include "chromeos/dbus/fake_modem_messaging_client.h" | 17 #include "chromeos/dbus/fake_modem_messaging_client.h" |
| 17 #include "chromeos/dbus/fake_permission_broker_client.h" | 18 #include "chromeos/dbus/fake_permission_broker_client.h" |
| 18 #include "chromeos/dbus/fake_shill_device_client.h" | 19 #include "chromeos/dbus/fake_shill_device_client.h" |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 35 #include "chromeos/dbus/shill_profile_client.h" | 36 #include "chromeos/dbus/shill_profile_client.h" |
| 36 #include "chromeos/dbus/shill_service_client.h" | 37 #include "chromeos/dbus/shill_service_client.h" |
| 37 #include "chromeos/dbus/shill_third_party_vpn_driver_client.h" | 38 #include "chromeos/dbus/shill_third_party_vpn_driver_client.h" |
| 38 #include "chromeos/dbus/sms_client.h" | 39 #include "chromeos/dbus/sms_client.h" |
| 39 #include "chromeos/dbus/system_clock_client.h" | 40 #include "chromeos/dbus/system_clock_client.h" |
| 40 #include "chromeos/dbus/update_engine_client.h" | 41 #include "chromeos/dbus/update_engine_client.h" |
| 41 | 42 |
| 42 namespace chromeos { | 43 namespace chromeos { |
| 43 | 44 |
| 44 DBusClientsCommon::DBusClientsCommon(bool use_real_clients) { | 45 DBusClientsCommon::DBusClientsCommon(bool use_real_clients) { |
| 46 biod_client_.reset(BiodClient::Create(use_real_clients | |
| 47 ? REAL_DBUS_CLIENT_IMPLEMENTATION | |
| 48 : FAKE_DBUS_CLIENT_IMPLEMENTATION)); | |
|
stevenjb
2017/04/05 16:36:20
We use this pattern enough now that we should set
sammiequon
2017/04/05 17:53:26
Done.
| |
| 49 | |
| 45 if (use_real_clients) | 50 if (use_real_clients) |
| 46 cras_audio_client_.reset(CrasAudioClient::Create()); | 51 cras_audio_client_.reset(CrasAudioClient::Create()); |
| 47 else | 52 else |
| 48 cras_audio_client_.reset(new FakeCrasAudioClient); | 53 cras_audio_client_.reset(new FakeCrasAudioClient); |
| 49 | 54 |
| 50 if (use_real_clients) | 55 if (use_real_clients) |
| 51 cryptohome_client_.reset(CryptohomeClient::Create()); | 56 cryptohome_client_.reset(CryptohomeClient::Create()); |
| 52 else | 57 else |
| 53 cryptohome_client_.reset(new FakeCryptohomeClient); | 58 cryptohome_client_.reset(new FakeCryptohomeClient); |
| 54 | 59 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 111 update_engine_client_.reset(UpdateEngineClient::Create( | 116 update_engine_client_.reset(UpdateEngineClient::Create( |
| 112 use_real_clients ? REAL_DBUS_CLIENT_IMPLEMENTATION | 117 use_real_clients ? REAL_DBUS_CLIENT_IMPLEMENTATION |
| 113 : FAKE_DBUS_CLIENT_IMPLEMENTATION)); | 118 : FAKE_DBUS_CLIENT_IMPLEMENTATION)); |
| 114 } | 119 } |
| 115 | 120 |
| 116 DBusClientsCommon::~DBusClientsCommon() {} | 121 DBusClientsCommon::~DBusClientsCommon() {} |
| 117 | 122 |
| 118 void DBusClientsCommon::Initialize(dbus::Bus* system_bus) { | 123 void DBusClientsCommon::Initialize(dbus::Bus* system_bus) { |
| 119 DCHECK(DBusThreadManager::IsInitialized()); | 124 DCHECK(DBusThreadManager::IsInitialized()); |
| 120 | 125 |
| 126 biod_client_->Init(system_bus); | |
| 121 cras_audio_client_->Init(system_bus); | 127 cras_audio_client_->Init(system_bus); |
| 122 cryptohome_client_->Init(system_bus); | 128 cryptohome_client_->Init(system_bus); |
| 123 gsm_sms_client_->Init(system_bus); | 129 gsm_sms_client_->Init(system_bus); |
| 124 modem_messaging_client_->Init(system_bus); | 130 modem_messaging_client_->Init(system_bus); |
| 125 permission_broker_client_->Init(system_bus); | 131 permission_broker_client_->Init(system_bus); |
| 126 power_manager_client_->Init(system_bus); | 132 power_manager_client_->Init(system_bus); |
| 127 session_manager_client_->Init(system_bus); | 133 session_manager_client_->Init(system_bus); |
| 128 shill_device_client_->Init(system_bus); | 134 shill_device_client_->Init(system_bus); |
| 129 shill_ipconfig_client_->Init(system_bus); | 135 shill_ipconfig_client_->Init(system_bus); |
| 130 shill_manager_client_->Init(system_bus); | 136 shill_manager_client_->Init(system_bus); |
| 131 shill_service_client_->Init(system_bus); | 137 shill_service_client_->Init(system_bus); |
| 132 shill_profile_client_->Init(system_bus); | 138 shill_profile_client_->Init(system_bus); |
| 133 shill_third_party_vpn_driver_client_->Init(system_bus); | 139 shill_third_party_vpn_driver_client_->Init(system_bus); |
| 134 sms_client_->Init(system_bus); | 140 sms_client_->Init(system_bus); |
| 135 system_clock_client_->Init(system_bus); | 141 system_clock_client_->Init(system_bus); |
| 136 update_engine_client_->Init(system_bus); | 142 update_engine_client_->Init(system_bus); |
| 137 | 143 |
| 138 ShillManagerClient::TestInterface* manager = | 144 ShillManagerClient::TestInterface* manager = |
| 139 shill_manager_client_->GetTestInterface(); | 145 shill_manager_client_->GetTestInterface(); |
| 140 if (manager) | 146 if (manager) |
| 141 manager->SetupDefaultEnvironment(); | 147 manager->SetupDefaultEnvironment(); |
| 142 } | 148 } |
| 143 | 149 |
| 144 } // namespace chromeos | 150 } // namespace chromeos |
| OLD | NEW |