| 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 <map> | 7 #include <map> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/observer_list.h" | 10 #include "base/observer_list.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/bluetooth_adapter_client.h" | 14 #include "chromeos/dbus/bluetooth_adapter_client.h" |
| 15 #include "chromeos/dbus/bluetooth_agent_manager_client.h" | 15 #include "chromeos/dbus/bluetooth_agent_manager_client.h" |
| 16 #include "chromeos/dbus/bluetooth_device_client.h" | 16 #include "chromeos/dbus/bluetooth_device_client.h" |
| 17 #include "chromeos/dbus/bluetooth_gatt_characteristic_client.h" |
| 18 #include "chromeos/dbus/bluetooth_gatt_descriptor_client.h" |
| 19 #include "chromeos/dbus/bluetooth_gatt_service_client.h" |
| 17 #include "chromeos/dbus/bluetooth_input_client.h" | 20 #include "chromeos/dbus/bluetooth_input_client.h" |
| 18 #include "chromeos/dbus/bluetooth_profile_manager_client.h" | 21 #include "chromeos/dbus/bluetooth_profile_manager_client.h" |
| 19 #include "chromeos/dbus/cras_audio_client.h" | 22 #include "chromeos/dbus/cras_audio_client.h" |
| 20 #include "chromeos/dbus/cros_disks_client.h" | 23 #include "chromeos/dbus/cros_disks_client.h" |
| 21 #include "chromeos/dbus/cryptohome_client.h" | 24 #include "chromeos/dbus/cryptohome_client.h" |
| 22 #include "chromeos/dbus/dbus_client.h" | 25 #include "chromeos/dbus/dbus_client.h" |
| 23 #include "chromeos/dbus/dbus_thread_manager_observer.h" | 26 #include "chromeos/dbus/dbus_thread_manager_observer.h" |
| 24 #include "chromeos/dbus/debug_daemon_client.h" | 27 #include "chromeos/dbus/debug_daemon_client.h" |
| 25 #include "chromeos/dbus/fake_dbus_thread_manager.h" | 28 #include "chromeos/dbus/fake_dbus_thread_manager.h" |
| 26 #include "chromeos/dbus/gsm_sms_client.h" | 29 #include "chromeos/dbus/gsm_sms_client.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 // Many components like login are not useful with a stub implementation. | 67 // Many components like login are not useful with a stub implementation. |
| 65 if (CommandLine::ForCurrentProcess()->HasSwitch( | 68 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 66 chromeos::switches::kDbusStub)) { | 69 chromeos::switches::kDbusStub)) { |
| 67 client_type_override = STUB_DBUS_CLIENT_IMPLEMENTATION; | 70 client_type_override = STUB_DBUS_CLIENT_IMPLEMENTATION; |
| 68 } | 71 } |
| 69 | 72 |
| 70 bluetooth_adapter_client_.reset(BluetoothAdapterClient::Create()); | 73 bluetooth_adapter_client_.reset(BluetoothAdapterClient::Create()); |
| 71 bluetooth_agent_manager_client_.reset( | 74 bluetooth_agent_manager_client_.reset( |
| 72 BluetoothAgentManagerClient::Create()); | 75 BluetoothAgentManagerClient::Create()); |
| 73 bluetooth_device_client_.reset(BluetoothDeviceClient::Create()); | 76 bluetooth_device_client_.reset(BluetoothDeviceClient::Create()); |
| 77 bluetooth_gatt_characteristic_client_.reset( |
| 78 BluetoothGattCharacteristicClient::Create()); |
| 79 bluetooth_gatt_descriptor_client_.reset( |
| 80 BluetoothGattDescriptorClient::Create()); |
| 81 bluetooth_gatt_service_client_.reset(BluetoothGattServiceClient::Create()); |
| 74 bluetooth_input_client_.reset(BluetoothInputClient::Create()); | 82 bluetooth_input_client_.reset(BluetoothInputClient::Create()); |
| 75 bluetooth_profile_manager_client_.reset( | 83 bluetooth_profile_manager_client_.reset( |
| 76 BluetoothProfileManagerClient::Create()); | 84 BluetoothProfileManagerClient::Create()); |
| 77 cras_audio_client_.reset(CrasAudioClient::Create()); | 85 cras_audio_client_.reset(CrasAudioClient::Create()); |
| 78 cros_disks_client_.reset(CrosDisksClient::Create(client_type)); | 86 cros_disks_client_.reset(CrosDisksClient::Create(client_type)); |
| 79 cryptohome_client_.reset(CryptohomeClient::Create()); | 87 cryptohome_client_.reset(CryptohomeClient::Create()); |
| 80 debug_daemon_client_.reset(DebugDaemonClient::Create()); | 88 debug_daemon_client_.reset(DebugDaemonClient::Create()); |
| 81 shill_manager_client_.reset(ShillManagerClient::Create()); | 89 shill_manager_client_.reset(ShillManagerClient::Create()); |
| 82 shill_device_client_.reset(ShillDeviceClient::Create()); | 90 shill_device_client_.reset(ShillDeviceClient::Create()); |
| 83 shill_ipconfig_client_.reset(ShillIPConfigClient::Create()); | 91 shill_ipconfig_client_.reset(ShillIPConfigClient::Create()); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 107 | 115 |
| 108 BluetoothAdapterClient* bluetooth_adapter_client() { | 116 BluetoothAdapterClient* bluetooth_adapter_client() { |
| 109 return bluetooth_adapter_client_.get(); | 117 return bluetooth_adapter_client_.get(); |
| 110 } | 118 } |
| 111 BluetoothAgentManagerClient* bluetooth_agent_manager_client() { | 119 BluetoothAgentManagerClient* bluetooth_agent_manager_client() { |
| 112 return bluetooth_agent_manager_client_.get(); | 120 return bluetooth_agent_manager_client_.get(); |
| 113 } | 121 } |
| 114 BluetoothDeviceClient* bluetooth_device_client() { | 122 BluetoothDeviceClient* bluetooth_device_client() { |
| 115 return bluetooth_device_client_.get(); | 123 return bluetooth_device_client_.get(); |
| 116 } | 124 } |
| 125 BluetoothGattCharacteristicClient* bluetooth_gatt_characteristic_client() { |
| 126 return bluetooth_gatt_characteristic_client_.get(); |
| 127 } |
| 128 BluetoothGattDescriptorClient* bluetooth_gatt_descriptor_client() { |
| 129 return bluetooth_gatt_descriptor_client_.get(); |
| 130 } |
| 131 BluetoothGattServiceClient* bluetooth_gatt_service_client() { |
| 132 return bluetooth_gatt_service_client_.get(); |
| 133 } |
| 117 BluetoothInputClient* bluetooth_input_client() { | 134 BluetoothInputClient* bluetooth_input_client() { |
| 118 return bluetooth_input_client_.get(); | 135 return bluetooth_input_client_.get(); |
| 119 } | 136 } |
| 120 BluetoothProfileManagerClient* bluetooth_profile_manager_client() { | 137 BluetoothProfileManagerClient* bluetooth_profile_manager_client() { |
| 121 return bluetooth_profile_manager_client_.get(); | 138 return bluetooth_profile_manager_client_.get(); |
| 122 } | 139 } |
| 123 CrasAudioClient* cras_audio_client() { | 140 CrasAudioClient* cras_audio_client() { |
| 124 return cras_audio_client_.get(); | 141 return cras_audio_client_.get(); |
| 125 } | 142 } |
| 126 CrosDisksClient* cros_disks_client() { | 143 CrosDisksClient* cros_disks_client() { |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 return sms_client_.get(); | 207 return sms_client_.get(); |
| 191 } | 208 } |
| 192 UpdateEngineClient* update_engine_client() { | 209 UpdateEngineClient* update_engine_client() { |
| 193 return update_engine_client_.get(); | 210 return update_engine_client_.get(); |
| 194 } | 211 } |
| 195 | 212 |
| 196 private: | 213 private: |
| 197 scoped_ptr<BluetoothAdapterClient> bluetooth_adapter_client_; | 214 scoped_ptr<BluetoothAdapterClient> bluetooth_adapter_client_; |
| 198 scoped_ptr<BluetoothAgentManagerClient> bluetooth_agent_manager_client_; | 215 scoped_ptr<BluetoothAgentManagerClient> bluetooth_agent_manager_client_; |
| 199 scoped_ptr<BluetoothDeviceClient> bluetooth_device_client_; | 216 scoped_ptr<BluetoothDeviceClient> bluetooth_device_client_; |
| 217 scoped_ptr<BluetoothGattCharacteristicClient> |
| 218 bluetooth_gatt_characteristic_client_; |
| 219 scoped_ptr<BluetoothGattDescriptorClient> bluetooth_gatt_descriptor_client_; |
| 220 scoped_ptr<BluetoothGattServiceClient> bluetooth_gatt_service_client_; |
| 200 scoped_ptr<BluetoothInputClient> bluetooth_input_client_; | 221 scoped_ptr<BluetoothInputClient> bluetooth_input_client_; |
| 201 scoped_ptr<BluetoothProfileManagerClient> bluetooth_profile_manager_client_; | 222 scoped_ptr<BluetoothProfileManagerClient> bluetooth_profile_manager_client_; |
| 202 scoped_ptr<CrasAudioClient> cras_audio_client_; | 223 scoped_ptr<CrasAudioClient> cras_audio_client_; |
| 203 scoped_ptr<CrosDisksClient> cros_disks_client_; | 224 scoped_ptr<CrosDisksClient> cros_disks_client_; |
| 204 scoped_ptr<CryptohomeClient> cryptohome_client_; | 225 scoped_ptr<CryptohomeClient> cryptohome_client_; |
| 205 scoped_ptr<DebugDaemonClient> debug_daemon_client_; | 226 scoped_ptr<DebugDaemonClient> debug_daemon_client_; |
| 206 scoped_ptr<ShillDeviceClient> shill_device_client_; | 227 scoped_ptr<ShillDeviceClient> shill_device_client_; |
| 207 scoped_ptr<ShillIPConfigClient> shill_ipconfig_client_; | 228 scoped_ptr<ShillIPConfigClient> shill_ipconfig_client_; |
| 208 scoped_ptr<ShillManagerClient> shill_manager_client_; | 229 scoped_ptr<ShillManagerClient> shill_manager_client_; |
| 209 scoped_ptr<ShillServiceClient> shill_service_client_; | 230 scoped_ptr<ShillServiceClient> shill_service_client_; |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 | 309 |
| 289 virtual BluetoothAgentManagerClient* GetBluetoothAgentManagerClient() | 310 virtual BluetoothAgentManagerClient* GetBluetoothAgentManagerClient() |
| 290 OVERRIDE { | 311 OVERRIDE { |
| 291 return client_bundle_->bluetooth_agent_manager_client(); | 312 return client_bundle_->bluetooth_agent_manager_client(); |
| 292 } | 313 } |
| 293 | 314 |
| 294 virtual BluetoothDeviceClient* GetBluetoothDeviceClient() OVERRIDE { | 315 virtual BluetoothDeviceClient* GetBluetoothDeviceClient() OVERRIDE { |
| 295 return client_bundle_->bluetooth_device_client(); | 316 return client_bundle_->bluetooth_device_client(); |
| 296 } | 317 } |
| 297 | 318 |
| 319 virtual BluetoothGattCharacteristicClient* |
| 320 GetBluetoothGattCharacteristicClient() OVERRIDE { |
| 321 return client_bundle_->bluetooth_gatt_characteristic_client(); |
| 322 } |
| 323 |
| 324 virtual BluetoothGattDescriptorClient* GetBluetoothGattDescriptorClient() |
| 325 OVERRIDE { |
| 326 return client_bundle_->bluetooth_gatt_descriptor_client(); |
| 327 } |
| 328 |
| 329 virtual BluetoothGattServiceClient* GetBluetoothGattServiceClient() OVERRIDE { |
| 330 return client_bundle_->bluetooth_gatt_service_client(); |
| 331 } |
| 332 |
| 298 virtual BluetoothInputClient* GetBluetoothInputClient() OVERRIDE { | 333 virtual BluetoothInputClient* GetBluetoothInputClient() OVERRIDE { |
| 299 return client_bundle_->bluetooth_input_client(); | 334 return client_bundle_->bluetooth_input_client(); |
| 300 } | 335 } |
| 301 | 336 |
| 302 virtual BluetoothProfileManagerClient* GetBluetoothProfileManagerClient() | 337 virtual BluetoothProfileManagerClient* GetBluetoothProfileManagerClient() |
| 303 OVERRIDE { | 338 OVERRIDE { |
| 304 return client_bundle_->bluetooth_profile_manager_client(); | 339 return client_bundle_->bluetooth_profile_manager_client(); |
| 305 } | 340 } |
| 306 | 341 |
| 307 virtual CrasAudioClient* GetCrasAudioClient() OVERRIDE { | 342 virtual CrasAudioClient* GetCrasAudioClient() OVERRIDE { |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 513 CHECK(g_dbus_thread_manager) | 548 CHECK(g_dbus_thread_manager) |
| 514 << "DBusThreadManager::Get() called before Initialize()"; | 549 << "DBusThreadManager::Get() called before Initialize()"; |
| 515 return g_dbus_thread_manager; | 550 return g_dbus_thread_manager; |
| 516 } | 551 } |
| 517 | 552 |
| 518 // static | 553 // static |
| 519 void DBusThreadManager::InitializeClients() { | 554 void DBusThreadManager::InitializeClients() { |
| 520 InitClient(g_dbus_thread_manager->GetBluetoothAdapterClient()); | 555 InitClient(g_dbus_thread_manager->GetBluetoothAdapterClient()); |
| 521 InitClient(g_dbus_thread_manager->GetBluetoothAgentManagerClient()); | 556 InitClient(g_dbus_thread_manager->GetBluetoothAgentManagerClient()); |
| 522 InitClient(g_dbus_thread_manager->GetBluetoothDeviceClient()); | 557 InitClient(g_dbus_thread_manager->GetBluetoothDeviceClient()); |
| 558 InitClient(g_dbus_thread_manager->GetBluetoothGattCharacteristicClient()); |
| 559 InitClient(g_dbus_thread_manager->GetBluetoothGattDescriptorClient()); |
| 560 InitClient(g_dbus_thread_manager->GetBluetoothGattServiceClient()); |
| 523 InitClient(g_dbus_thread_manager->GetBluetoothInputClient()); | 561 InitClient(g_dbus_thread_manager->GetBluetoothInputClient()); |
| 524 InitClient(g_dbus_thread_manager->GetBluetoothProfileManagerClient()); | 562 InitClient(g_dbus_thread_manager->GetBluetoothProfileManagerClient()); |
| 525 InitClient(g_dbus_thread_manager->GetCrasAudioClient()); | 563 InitClient(g_dbus_thread_manager->GetCrasAudioClient()); |
| 526 InitClient(g_dbus_thread_manager->GetCrosDisksClient()); | 564 InitClient(g_dbus_thread_manager->GetCrosDisksClient()); |
| 527 InitClient(g_dbus_thread_manager->GetCryptohomeClient()); | 565 InitClient(g_dbus_thread_manager->GetCryptohomeClient()); |
| 528 InitClient(g_dbus_thread_manager->GetDebugDaemonClient()); | 566 InitClient(g_dbus_thread_manager->GetDebugDaemonClient()); |
| 529 InitClient(g_dbus_thread_manager->GetGsmSMSClient()); | 567 InitClient(g_dbus_thread_manager->GetGsmSMSClient()); |
| 530 InitClient(g_dbus_thread_manager->GetImageBurnerClient()); | 568 InitClient(g_dbus_thread_manager->GetImageBurnerClient()); |
| 531 InitClient(g_dbus_thread_manager->GetIntrospectableClient()); | 569 InitClient(g_dbus_thread_manager->GetIntrospectableClient()); |
| 532 InitClient(g_dbus_thread_manager->GetModemMessagingClient()); | 570 InitClient(g_dbus_thread_manager->GetModemMessagingClient()); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 564 g_dbus_thread_manager->GetSystemBus()->GetManagedObjects(); | 602 g_dbus_thread_manager->GetSystemBus()->GetManagedObjects(); |
| 565 } | 603 } |
| 566 | 604 |
| 567 // static | 605 // static |
| 568 void DBusThreadManager::InitClient(DBusClient* client) { | 606 void DBusThreadManager::InitClient(DBusClient* client) { |
| 569 if (client) | 607 if (client) |
| 570 client->Init(g_dbus_thread_manager->GetSystemBus()); | 608 client->Init(g_dbus_thread_manager->GetSystemBus()); |
| 571 } | 609 } |
| 572 | 610 |
| 573 } // namespace chromeos | 611 } // namespace chromeos |
| OLD | NEW |