| 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_client_bundle.h" | 5 #include "chromeos/dbus/dbus_client_bundle.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/strings/string_split.h" | 10 #include "base/strings/string_split.h" |
| 11 #include "base/strings/string_util.h" | 11 #include "base/strings/string_util.h" |
| 12 #include "chromeos/chromeos_switches.h" | 12 #include "chromeos/chromeos_switches.h" |
| 13 #include "chromeos/dbus/ap_manager_client.h" |
| 13 #include "chromeos/dbus/bluetooth_adapter_client.h" | 14 #include "chromeos/dbus/bluetooth_adapter_client.h" |
| 14 #include "chromeos/dbus/bluetooth_agent_manager_client.h" | 15 #include "chromeos/dbus/bluetooth_agent_manager_client.h" |
| 15 #include "chromeos/dbus/bluetooth_device_client.h" | 16 #include "chromeos/dbus/bluetooth_device_client.h" |
| 16 #include "chromeos/dbus/bluetooth_gatt_characteristic_client.h" | 17 #include "chromeos/dbus/bluetooth_gatt_characteristic_client.h" |
| 17 #include "chromeos/dbus/bluetooth_gatt_descriptor_client.h" | 18 #include "chromeos/dbus/bluetooth_gatt_descriptor_client.h" |
| 18 #include "chromeos/dbus/bluetooth_gatt_manager_client.h" | 19 #include "chromeos/dbus/bluetooth_gatt_manager_client.h" |
| 19 #include "chromeos/dbus/bluetooth_gatt_service_client.h" | 20 #include "chromeos/dbus/bluetooth_gatt_service_client.h" |
| 20 #include "chromeos/dbus/bluetooth_input_client.h" | 21 #include "chromeos/dbus/bluetooth_input_client.h" |
| 21 #include "chromeos/dbus/bluetooth_media_client.h" | 22 #include "chromeos/dbus/bluetooth_media_client.h" |
| 22 #include "chromeos/dbus/bluetooth_media_transport_client.h" | 23 #include "chromeos/dbus/bluetooth_media_transport_client.h" |
| 23 #include "chromeos/dbus/bluetooth_profile_manager_client.h" | 24 #include "chromeos/dbus/bluetooth_profile_manager_client.h" |
| 24 #include "chromeos/dbus/cras_audio_client.h" | 25 #include "chromeos/dbus/cras_audio_client.h" |
| 25 #include "chromeos/dbus/cros_disks_client.h" | 26 #include "chromeos/dbus/cros_disks_client.h" |
| 26 #include "chromeos/dbus/cryptohome_client.h" | 27 #include "chromeos/dbus/cryptohome_client.h" |
| 27 #include "chromeos/dbus/debug_daemon_client.h" | 28 #include "chromeos/dbus/debug_daemon_client.h" |
| 28 #include "chromeos/dbus/easy_unlock_client.h" | 29 #include "chromeos/dbus/easy_unlock_client.h" |
| 30 #include "chromeos/dbus/fake_ap_manager_client.h" |
| 29 #include "chromeos/dbus/fake_bluetooth_adapter_client.h" | 31 #include "chromeos/dbus/fake_bluetooth_adapter_client.h" |
| 30 #include "chromeos/dbus/fake_bluetooth_agent_manager_client.h" | 32 #include "chromeos/dbus/fake_bluetooth_agent_manager_client.h" |
| 31 #include "chromeos/dbus/fake_bluetooth_device_client.h" | 33 #include "chromeos/dbus/fake_bluetooth_device_client.h" |
| 32 #include "chromeos/dbus/fake_bluetooth_gatt_characteristic_client.h" | 34 #include "chromeos/dbus/fake_bluetooth_gatt_characteristic_client.h" |
| 33 #include "chromeos/dbus/fake_bluetooth_gatt_descriptor_client.h" | 35 #include "chromeos/dbus/fake_bluetooth_gatt_descriptor_client.h" |
| 34 #include "chromeos/dbus/fake_bluetooth_gatt_manager_client.h" | 36 #include "chromeos/dbus/fake_bluetooth_gatt_manager_client.h" |
| 35 #include "chromeos/dbus/fake_bluetooth_gatt_service_client.h" | 37 #include "chromeos/dbus/fake_bluetooth_gatt_service_client.h" |
| 36 #include "chromeos/dbus/fake_bluetooth_input_client.h" | 38 #include "chromeos/dbus/fake_bluetooth_input_client.h" |
| 37 #include "chromeos/dbus/fake_bluetooth_media_client.h" | 39 #include "chromeos/dbus/fake_bluetooth_media_client.h" |
| 38 #include "chromeos/dbus/fake_bluetooth_media_transport_client.h" | 40 #include "chromeos/dbus/fake_bluetooth_media_transport_client.h" |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 | 93 |
| 92 namespace chromeos { | 94 namespace chromeos { |
| 93 | 95 |
| 94 namespace { | 96 namespace { |
| 95 | 97 |
| 96 // Command line switch mapping for --dbus-unstub-clients. | 98 // Command line switch mapping for --dbus-unstub-clients. |
| 97 const struct { | 99 const struct { |
| 98 const char* param_name; | 100 const char* param_name; |
| 99 DBusClientBundle::DBusClientType client_type; | 101 DBusClientBundle::DBusClientType client_type; |
| 100 } client_type_map[] = { | 102 } client_type_map[] = { |
| 103 { "ap", DBusClientBundle::AP_MANAGER }, |
| 101 { "bluetooth", DBusClientBundle::BLUETOOTH }, | 104 { "bluetooth", DBusClientBundle::BLUETOOTH }, |
| 102 { "cras", DBusClientBundle::CRAS }, | 105 { "cras", DBusClientBundle::CRAS }, |
| 103 { "cros_disks", DBusClientBundle::CROS_DISKS }, | 106 { "cros_disks", DBusClientBundle::CROS_DISKS }, |
| 104 { "cryptohome", DBusClientBundle::CRYPTOHOME }, | 107 { "cryptohome", DBusClientBundle::CRYPTOHOME }, |
| 105 { "debug_daemon", DBusClientBundle::DEBUG_DAEMON }, | 108 { "debug_daemon", DBusClientBundle::DEBUG_DAEMON }, |
| 106 { "easy_unlock", DBusClientBundle::EASY_UNLOCK }, | 109 { "easy_unlock", DBusClientBundle::EASY_UNLOCK }, |
| 107 { "leadership_daemon", DBusClientBundle::LEADERSHIP_DAEMON }, | 110 { "leadership_daemon", DBusClientBundle::LEADERSHIP_DAEMON }, |
| 108 { "lorgnette_manager", DBusClientBundle::LORGNETTE_MANAGER }, | 111 { "lorgnette_manager", DBusClientBundle::LORGNETTE_MANAGER }, |
| 109 { "metronome", DBusClientBundle::METRONOME }, | 112 { "metronome", DBusClientBundle::METRONOME }, |
| 110 { "shill", DBusClientBundle::SHILL }, | 113 { "shill", DBusClientBundle::SHILL }, |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 permission_broker_client_.reset(new FakePermissionBrokerClient); | 282 permission_broker_client_.reset(new FakePermissionBrokerClient); |
| 280 | 283 |
| 281 if (!IsUsingStub(LEADERSHIP_DAEMON)) { | 284 if (!IsUsingStub(LEADERSHIP_DAEMON)) { |
| 282 leadership_daemon_manager_client_.reset( | 285 leadership_daemon_manager_client_.reset( |
| 283 LeadershipDaemonManagerClient::Create()); | 286 LeadershipDaemonManagerClient::Create()); |
| 284 } else { | 287 } else { |
| 285 leadership_daemon_manager_client_.reset( | 288 leadership_daemon_manager_client_.reset( |
| 286 new FakeLeadershipDaemonManagerClient); | 289 new FakeLeadershipDaemonManagerClient); |
| 287 } | 290 } |
| 288 | 291 |
| 292 if (!IsUsingStub(AP_MANAGER)) |
| 293 ap_manager_client_.reset(ApManagerClient::Create()); |
| 294 else |
| 295 ap_manager_client_.reset(new FakeApManagerClient); |
| 296 |
| 289 power_manager_client_.reset(PowerManagerClient::Create( | 297 power_manager_client_.reset(PowerManagerClient::Create( |
| 290 IsUsingStub(POWER_MANAGER) ? STUB_DBUS_CLIENT_IMPLEMENTATION | 298 IsUsingStub(POWER_MANAGER) ? STUB_DBUS_CLIENT_IMPLEMENTATION |
| 291 : REAL_DBUS_CLIENT_IMPLEMENTATION)); | 299 : REAL_DBUS_CLIENT_IMPLEMENTATION)); |
| 292 | 300 |
| 293 session_manager_client_.reset(SessionManagerClient::Create( | 301 session_manager_client_.reset(SessionManagerClient::Create( |
| 294 IsUsingStub(SESSION_MANAGER) ? STUB_DBUS_CLIENT_IMPLEMENTATION | 302 IsUsingStub(SESSION_MANAGER) ? STUB_DBUS_CLIENT_IMPLEMENTATION |
| 295 : REAL_DBUS_CLIENT_IMPLEMENTATION)); | 303 : REAL_DBUS_CLIENT_IMPLEMENTATION)); |
| 296 | 304 |
| 297 if (!IsUsingStub(SMS)) | 305 if (!IsUsingStub(SMS)) |
| 298 sms_client_.reset(SMSClient::Create()); | 306 sms_client_.reset(SMSClient::Create()); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 343 unstub_mask |= client; | 351 unstub_mask |= client; |
| 344 } else { | 352 } else { |
| 345 LOG(ERROR) << "Unknown dbus client: " << *iter; | 353 LOG(ERROR) << "Unknown dbus client: " << *iter; |
| 346 } | 354 } |
| 347 } | 355 } |
| 348 | 356 |
| 349 return unstub_mask; | 357 return unstub_mask; |
| 350 } | 358 } |
| 351 | 359 |
| 352 } // namespace chromeos | 360 } // namespace chromeos |
| OLD | NEW |