| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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_thread_manager.h" | 5 #include "chromeos/dbus/dbus_thread_manager.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| 11 #include "base/sys_info.h" | 11 #include "base/sys_info.h" |
| 12 #include "base/threading/thread.h" | 12 #include "base/threading/thread.h" |
| 13 #include "chromeos/chromeos_switches.h" | 13 #include "chromeos/chromeos_switches.h" |
| 14 #include "chromeos/dbus/arc_obb_mounter_client.h" | 14 #include "chromeos/dbus/arc_obb_mounter_client.h" |
| 15 #include "chromeos/dbus/cras_audio_client.h" | 15 #include "chromeos/dbus/cras_audio_client.h" |
| 16 #include "chromeos/dbus/cros_disks_client.h" | 16 #include "chromeos/dbus/cros_disks_client.h" |
| 17 #include "chromeos/dbus/cryptohome_client.h" | 17 #include "chromeos/dbus/cryptohome_client.h" |
| 18 #include "chromeos/dbus/dbus_client.h" | 18 #include "chromeos/dbus/dbus_client.h" |
| 19 #include "chromeos/dbus/debug_daemon_client.h" | 19 #include "chromeos/dbus/debug_daemon_client.h" |
| 20 #include "chromeos/dbus/easy_unlock_client.h" | 20 #include "chromeos/dbus/easy_unlock_client.h" |
| 21 #include "chromeos/dbus/gsm_sms_client.h" | 21 #include "chromeos/dbus/gsm_sms_client.h" |
| 22 #include "chromeos/dbus/image_burner_client.h" | 22 #include "chromeos/dbus/image_burner_client.h" |
| 23 #include "chromeos/dbus/introspectable_client.h" | 23 #include "chromeos/dbus/introspectable_client.h" |
| 24 #include "chromeos/dbus/lorgnette_manager_client.h" | 24 #include "chromeos/dbus/lorgnette_manager_client.h" |
| 25 #include "chromeos/dbus/modem_messaging_client.h" | 25 #include "chromeos/dbus/modem_messaging_client.h" |
| 26 #include "chromeos/dbus/nfc_adapter_client.h" | |
| 27 #include "chromeos/dbus/nfc_device_client.h" | |
| 28 #include "chromeos/dbus/nfc_manager_client.h" | |
| 29 #include "chromeos/dbus/nfc_record_client.h" | |
| 30 #include "chromeos/dbus/nfc_tag_client.h" | |
| 31 #include "chromeos/dbus/permission_broker_client.h" | 26 #include "chromeos/dbus/permission_broker_client.h" |
| 32 #include "chromeos/dbus/power_manager_client.h" | 27 #include "chromeos/dbus/power_manager_client.h" |
| 33 #include "chromeos/dbus/session_manager_client.h" | 28 #include "chromeos/dbus/session_manager_client.h" |
| 34 #include "chromeos/dbus/shill_device_client.h" | 29 #include "chromeos/dbus/shill_device_client.h" |
| 35 #include "chromeos/dbus/shill_ipconfig_client.h" | 30 #include "chromeos/dbus/shill_ipconfig_client.h" |
| 36 #include "chromeos/dbus/shill_manager_client.h" | 31 #include "chromeos/dbus/shill_manager_client.h" |
| 37 #include "chromeos/dbus/shill_profile_client.h" | 32 #include "chromeos/dbus/shill_profile_client.h" |
| 38 #include "chromeos/dbus/shill_service_client.h" | 33 #include "chromeos/dbus/shill_service_client.h" |
| 39 #include "chromeos/dbus/shill_third_party_vpn_driver_client.h" | 34 #include "chromeos/dbus/shill_third_party_vpn_driver_client.h" |
| 40 #include "chromeos/dbus/sms_client.h" | 35 #include "chromeos/dbus/sms_client.h" |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 } | 166 } |
| 172 | 167 |
| 173 IntrospectableClient* DBusThreadManager::GetIntrospectableClient() { | 168 IntrospectableClient* DBusThreadManager::GetIntrospectableClient() { |
| 174 return client_bundle_->introspectable_client(); | 169 return client_bundle_->introspectable_client(); |
| 175 } | 170 } |
| 176 | 171 |
| 177 ModemMessagingClient* DBusThreadManager::GetModemMessagingClient() { | 172 ModemMessagingClient* DBusThreadManager::GetModemMessagingClient() { |
| 178 return client_bundle_->modem_messaging_client(); | 173 return client_bundle_->modem_messaging_client(); |
| 179 } | 174 } |
| 180 | 175 |
| 181 NfcAdapterClient* DBusThreadManager::GetNfcAdapterClient() { | |
| 182 return client_bundle_->nfc_adapter_client(); | |
| 183 } | |
| 184 | |
| 185 NfcDeviceClient* DBusThreadManager::GetNfcDeviceClient() { | |
| 186 return client_bundle_->nfc_device_client(); | |
| 187 } | |
| 188 | |
| 189 NfcManagerClient* DBusThreadManager::GetNfcManagerClient() { | |
| 190 return client_bundle_->nfc_manager_client(); | |
| 191 } | |
| 192 | |
| 193 NfcRecordClient* DBusThreadManager::GetNfcRecordClient() { | |
| 194 return client_bundle_->nfc_record_client(); | |
| 195 } | |
| 196 | |
| 197 NfcTagClient* DBusThreadManager::GetNfcTagClient() { | |
| 198 return client_bundle_->nfc_tag_client(); | |
| 199 } | |
| 200 | |
| 201 PermissionBrokerClient* DBusThreadManager::GetPermissionBrokerClient() { | 176 PermissionBrokerClient* DBusThreadManager::GetPermissionBrokerClient() { |
| 202 return client_bundle_->permission_broker_client(); | 177 return client_bundle_->permission_broker_client(); |
| 203 } | 178 } |
| 204 | 179 |
| 205 PowerManagerClient* DBusThreadManager::GetPowerManagerClient() { | 180 PowerManagerClient* DBusThreadManager::GetPowerManagerClient() { |
| 206 return client_bundle_->power_manager_client(); | 181 return client_bundle_->power_manager_client(); |
| 207 } | 182 } |
| 208 | 183 |
| 209 SessionManagerClient* DBusThreadManager::GetSessionManagerClient() { | 184 SessionManagerClient* DBusThreadManager::GetSessionManagerClient() { |
| 210 return client_bundle_->session_manager_client(); | 185 return client_bundle_->session_manager_client(); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 240 GetShillDeviceClient()->Init(GetSystemBus()); | 215 GetShillDeviceClient()->Init(GetSystemBus()); |
| 241 GetShillIPConfigClient()->Init(GetSystemBus()); | 216 GetShillIPConfigClient()->Init(GetSystemBus()); |
| 242 GetShillManagerClient()->Init(GetSystemBus()); | 217 GetShillManagerClient()->Init(GetSystemBus()); |
| 243 GetShillServiceClient()->Init(GetSystemBus()); | 218 GetShillServiceClient()->Init(GetSystemBus()); |
| 244 GetShillProfileClient()->Init(GetSystemBus()); | 219 GetShillProfileClient()->Init(GetSystemBus()); |
| 245 GetShillThirdPartyVpnDriverClient()->Init(GetSystemBus()); | 220 GetShillThirdPartyVpnDriverClient()->Init(GetSystemBus()); |
| 246 GetSMSClient()->Init(GetSystemBus()); | 221 GetSMSClient()->Init(GetSystemBus()); |
| 247 GetSystemClockClient()->Init(GetSystemBus()); | 222 GetSystemClockClient()->Init(GetSystemBus()); |
| 248 GetUpdateEngineClient()->Init(GetSystemBus()); | 223 GetUpdateEngineClient()->Init(GetSystemBus()); |
| 249 | 224 |
| 250 // Initialize the NFC clients in the correct order. The order of | |
| 251 // initialization matters due to dependencies that exist between the | |
| 252 // client objects. | |
| 253 GetNfcManagerClient()->Init(GetSystemBus()); | |
| 254 GetNfcAdapterClient()->Init(GetSystemBus()); | |
| 255 GetNfcDeviceClient()->Init(GetSystemBus()); | |
| 256 GetNfcTagClient()->Init(GetSystemBus()); | |
| 257 GetNfcRecordClient()->Init(GetSystemBus()); | |
| 258 | |
| 259 // This must be called after the list of clients so they've each had a | 225 // This must be called after the list of clients so they've each had a |
| 260 // chance to register with their object g_dbus_thread_managers. | 226 // chance to register with their object g_dbus_thread_managers. |
| 261 if (GetSystemBus()) | 227 if (GetSystemBus()) |
| 262 GetSystemBus()->GetManagedObjects(); | 228 GetSystemBus()->GetManagedObjects(); |
| 263 | 229 |
| 264 client_bundle_->SetupDefaultEnvironment(); | 230 client_bundle_->SetupDefaultEnvironment(); |
| 265 } | 231 } |
| 266 | 232 |
| 267 bool DBusThreadManager::IsUsingStub(DBusClientBundle::DBusClientType client) { | 233 bool DBusThreadManager::IsUsingStub(DBusClientBundle::DBusClientType client) { |
| 268 return client_bundle_->IsUsingStub(client); | 234 return client_bundle_->IsUsingStub(client); |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 456 DBusThreadManager::Get()->client_bundle_->introspectable_client_ = | 422 DBusThreadManager::Get()->client_bundle_->introspectable_client_ = |
| 457 std::move(client); | 423 std::move(client); |
| 458 } | 424 } |
| 459 | 425 |
| 460 void DBusThreadManagerSetter::SetModemMessagingClient( | 426 void DBusThreadManagerSetter::SetModemMessagingClient( |
| 461 std::unique_ptr<ModemMessagingClient> client) { | 427 std::unique_ptr<ModemMessagingClient> client) { |
| 462 DBusThreadManager::Get()->client_bundle_->modem_messaging_client_ = | 428 DBusThreadManager::Get()->client_bundle_->modem_messaging_client_ = |
| 463 std::move(client); | 429 std::move(client); |
| 464 } | 430 } |
| 465 | 431 |
| 466 void DBusThreadManagerSetter::SetNfcAdapterClient( | |
| 467 std::unique_ptr<NfcAdapterClient> client) { | |
| 468 DBusThreadManager::Get()->client_bundle_->nfc_adapter_client_ = | |
| 469 std::move(client); | |
| 470 } | |
| 471 | |
| 472 void DBusThreadManagerSetter::SetNfcDeviceClient( | |
| 473 std::unique_ptr<NfcDeviceClient> client) { | |
| 474 DBusThreadManager::Get()->client_bundle_->nfc_device_client_ = | |
| 475 std::move(client); | |
| 476 } | |
| 477 | |
| 478 void DBusThreadManagerSetter::SetNfcManagerClient( | |
| 479 std::unique_ptr<NfcManagerClient> client) { | |
| 480 DBusThreadManager::Get()->client_bundle_->nfc_manager_client_ = | |
| 481 std::move(client); | |
| 482 } | |
| 483 | |
| 484 void DBusThreadManagerSetter::SetNfcRecordClient( | |
| 485 std::unique_ptr<NfcRecordClient> client) { | |
| 486 DBusThreadManager::Get()->client_bundle_->nfc_record_client_ = | |
| 487 std::move(client); | |
| 488 } | |
| 489 | |
| 490 void DBusThreadManagerSetter::SetNfcTagClient( | |
| 491 std::unique_ptr<NfcTagClient> client) { | |
| 492 DBusThreadManager::Get()->client_bundle_->nfc_tag_client_ = std::move(client); | |
| 493 } | |
| 494 | |
| 495 void DBusThreadManagerSetter::SetPermissionBrokerClient( | 432 void DBusThreadManagerSetter::SetPermissionBrokerClient( |
| 496 std::unique_ptr<PermissionBrokerClient> client) { | 433 std::unique_ptr<PermissionBrokerClient> client) { |
| 497 DBusThreadManager::Get()->client_bundle_->permission_broker_client_ = | 434 DBusThreadManager::Get()->client_bundle_->permission_broker_client_ = |
| 498 std::move(client); | 435 std::move(client); |
| 499 } | 436 } |
| 500 | 437 |
| 501 void DBusThreadManagerSetter::SetPowerManagerClient( | 438 void DBusThreadManagerSetter::SetPowerManagerClient( |
| 502 std::unique_ptr<PowerManagerClient> client) { | 439 std::unique_ptr<PowerManagerClient> client) { |
| 503 DBusThreadManager::Get()->client_bundle_->power_manager_client_ = | 440 DBusThreadManager::Get()->client_bundle_->power_manager_client_ = |
| 504 std::move(client); | 441 std::move(client); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 520 std::move(client); | 457 std::move(client); |
| 521 } | 458 } |
| 522 | 459 |
| 523 void DBusThreadManagerSetter::SetUpdateEngineClient( | 460 void DBusThreadManagerSetter::SetUpdateEngineClient( |
| 524 std::unique_ptr<UpdateEngineClient> client) { | 461 std::unique_ptr<UpdateEngineClient> client) { |
| 525 DBusThreadManager::Get()->client_bundle_->update_engine_client_ = | 462 DBusThreadManager::Get()->client_bundle_->update_engine_client_ = |
| 526 std::move(client); | 463 std::move(client); |
| 527 } | 464 } |
| 528 | 465 |
| 529 } // namespace chromeos | 466 } // namespace chromeos |
| OLD | NEW |