OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2014 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. |
| 4 |
| 5 #include "chromeos/dbus/dbus_client_bundle.h" |
| 6 |
| 7 #include "chromeos/dbus/bluetooth_adapter_client.h" |
| 8 #include "chromeos/dbus/bluetooth_agent_manager_client.h" |
| 9 #include "chromeos/dbus/bluetooth_device_client.h" |
| 10 #include "chromeos/dbus/bluetooth_gatt_characteristic_client.h" |
| 11 #include "chromeos/dbus/bluetooth_gatt_descriptor_client.h" |
| 12 #include "chromeos/dbus/bluetooth_gatt_manager_client.h" |
| 13 #include "chromeos/dbus/bluetooth_gatt_service_client.h" |
| 14 #include "chromeos/dbus/bluetooth_input_client.h" |
| 15 #include "chromeos/dbus/bluetooth_profile_manager_client.h" |
| 16 #include "chromeos/dbus/cras_audio_client.h" |
| 17 #include "chromeos/dbus/cros_disks_client.h" |
| 18 #include "chromeos/dbus/cryptohome_client.h" |
| 19 #include "chromeos/dbus/debug_daemon_client.h" |
| 20 #include "chromeos/dbus/easy_unlock_client.h" |
| 21 #include "chromeos/dbus/gsm_sms_client.h" |
| 22 #include "chromeos/dbus/image_burner_client.h" |
| 23 #include "chromeos/dbus/introspectable_client.h" |
| 24 #include "chromeos/dbus/lorgnette_manager_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" |
| 32 #include "chromeos/dbus/power_manager_client.h" |
| 33 #include "chromeos/dbus/power_policy_controller.h" |
| 34 #include "chromeos/dbus/session_manager_client.h" |
| 35 #include "chromeos/dbus/shill_device_client.h" |
| 36 #include "chromeos/dbus/shill_ipconfig_client.h" |
| 37 #include "chromeos/dbus/shill_manager_client.h" |
| 38 #include "chromeos/dbus/shill_profile_client.h" |
| 39 #include "chromeos/dbus/shill_service_client.h" |
| 40 #include "chromeos/dbus/sms_client.h" |
| 41 #include "chromeos/dbus/system_clock_client.h" |
| 42 #include "chromeos/dbus/update_engine_client.h" |
| 43 |
| 44 namespace chromeos { |
| 45 |
| 46 DBusClientBundle::DBusClientBundle(int client_mask) { |
| 47 const DBusClientImplementationType type = REAL_DBUS_CLIENT_IMPLEMENTATION; |
| 48 |
| 49 if (client_mask & BLUETOOTH) { |
| 50 bluetooth_adapter_client_.reset(BluetoothAdapterClient::Create()); |
| 51 bluetooth_agent_manager_client_.reset( |
| 52 BluetoothAgentManagerClient::Create()); |
| 53 bluetooth_device_client_.reset(BluetoothDeviceClient::Create()); |
| 54 bluetooth_input_client_.reset(BluetoothInputClient::Create()); |
| 55 bluetooth_profile_manager_client_.reset( |
| 56 BluetoothProfileManagerClient::Create()); |
| 57 } |
| 58 |
| 59 if (client_mask & BLUETOOTH_LOW_ENERGY) { |
| 60 bluetooth_gatt_characteristic_client_.reset( |
| 61 BluetoothGattCharacteristicClient::Create()); |
| 62 bluetooth_gatt_descriptor_client_.reset( |
| 63 BluetoothGattDescriptorClient::Create()); |
| 64 bluetooth_gatt_manager_client_.reset( |
| 65 BluetoothGattManagerClient::Create()); |
| 66 bluetooth_gatt_service_client_.reset( |
| 67 BluetoothGattServiceClient::Create()); |
| 68 } |
| 69 |
| 70 if (client_mask & CRAS) |
| 71 cras_audio_client_.reset(CrasAudioClient::Create()); |
| 72 |
| 73 if (client_mask & CROS_DISKS) |
| 74 cros_disks_client_.reset(CrosDisksClient::Create(type)); |
| 75 |
| 76 if (client_mask & CRYPTOHOME) |
| 77 cryptohome_client_.reset(CryptohomeClient::Create()); |
| 78 |
| 79 if (client_mask & DEBUG_DAEMON) |
| 80 debug_daemon_client_.reset(DebugDaemonClient::Create()); |
| 81 |
| 82 if (client_mask & EASY_UNLOCK) |
| 83 easy_unlock_client_.reset(EasyUnlockClient::Create()); |
| 84 |
| 85 if (client_mask & LORGNETTE_MANAGER) |
| 86 lorgnette_manager_client_.reset(LorgnetteManagerClient::Create()); |
| 87 |
| 88 if (client_mask & SHILL) { |
| 89 shill_manager_client_.reset(ShillManagerClient::Create()); |
| 90 shill_device_client_.reset(ShillDeviceClient::Create()); |
| 91 shill_ipconfig_client_.reset(ShillIPConfigClient::Create()); |
| 92 shill_service_client_.reset(ShillServiceClient::Create()); |
| 93 shill_profile_client_.reset(ShillProfileClient::Create()); |
| 94 } |
| 95 |
| 96 if (client_mask & GSM_SMS) |
| 97 gsm_sms_client_.reset(GsmSMSClient::Create()); |
| 98 |
| 99 if (client_mask & IMAGE_BURNER) |
| 100 image_burner_client_.reset(ImageBurnerClient::Create()); |
| 101 |
| 102 if (client_mask & INTROSPECTABLE) |
| 103 introspectable_client_.reset(IntrospectableClient::Create()); |
| 104 |
| 105 if (client_mask & MODEM_MESSAGING) |
| 106 modem_messaging_client_.reset(ModemMessagingClient::Create()); |
| 107 |
| 108 // Create the NFC clients in the correct order based on their dependencies. |
| 109 if (client_mask & NFC) { |
| 110 nfc_manager_client_.reset(NfcManagerClient::Create()); |
| 111 nfc_adapter_client_.reset( |
| 112 NfcAdapterClient::Create(nfc_manager_client_.get())); |
| 113 nfc_device_client_.reset( |
| 114 NfcDeviceClient::Create(nfc_adapter_client_.get())); |
| 115 nfc_tag_client_.reset(NfcTagClient::Create(nfc_adapter_client_.get())); |
| 116 nfc_record_client_.reset(NfcRecordClient::Create(nfc_device_client_.get(), |
| 117 nfc_tag_client_.get())); |
| 118 } |
| 119 |
| 120 if (client_mask & PERMISSION_BROKER) |
| 121 permission_broker_client_.reset(PermissionBrokerClient::Create()); |
| 122 |
| 123 if (client_mask & POWER_MANAGER) |
| 124 power_manager_client_.reset(PowerManagerClient::Create(type)); |
| 125 |
| 126 if (client_mask & SESSION_MANAGER) |
| 127 session_manager_client_.reset(SessionManagerClient::Create(type)); |
| 128 |
| 129 if (client_mask & SMS) |
| 130 sms_client_.reset(SMSClient::Create()); |
| 131 |
| 132 if (client_mask & SYSTEM_CLOCK) |
| 133 system_clock_client_.reset(SystemClockClient::Create()); |
| 134 |
| 135 if (client_mask & UPDATE_ENGINE) |
| 136 update_engine_client_.reset(UpdateEngineClient::Create(type)); |
| 137 } |
| 138 |
| 139 DBusClientBundle::~DBusClientBundle() { |
| 140 } |
| 141 |
| 142 BluetoothAdapterClient* DBusClientBundle::bluetooth_adapter_client() { |
| 143 return bluetooth_adapter_client_.get(); |
| 144 } |
| 145 |
| 146 BluetoothAgentManagerClient* |
| 147 DBusClientBundle::bluetooth_agent_manager_client() { |
| 148 return bluetooth_agent_manager_client_.get(); |
| 149 } |
| 150 |
| 151 BluetoothDeviceClient* DBusClientBundle::bluetooth_device_client() { |
| 152 return bluetooth_device_client_.get(); |
| 153 } |
| 154 |
| 155 BluetoothGattCharacteristicClient* |
| 156 DBusClientBundle::bluetooth_gatt_characteristic_client() { |
| 157 return bluetooth_gatt_characteristic_client_.get(); |
| 158 } |
| 159 |
| 160 BluetoothGattDescriptorClient* |
| 161 DBusClientBundle::bluetooth_gatt_descriptor_client() { |
| 162 return bluetooth_gatt_descriptor_client_.get(); |
| 163 |
| 164 } |
| 165 BluetoothGattManagerClient* DBusClientBundle::bluetooth_gatt_manager_client() { |
| 166 return bluetooth_gatt_manager_client_.get(); |
| 167 } |
| 168 |
| 169 BluetoothGattServiceClient* DBusClientBundle::bluetooth_gatt_service_client() { |
| 170 return bluetooth_gatt_service_client_.get(); |
| 171 } |
| 172 |
| 173 BluetoothInputClient* DBusClientBundle::bluetooth_input_client() { |
| 174 return bluetooth_input_client_.get(); |
| 175 } |
| 176 |
| 177 BluetoothProfileManagerClient* |
| 178 DBusClientBundle::bluetooth_profile_manager_client() { |
| 179 return bluetooth_profile_manager_client_.get(); |
| 180 } |
| 181 |
| 182 CrasAudioClient* DBusClientBundle::cras_audio_client() { |
| 183 return cras_audio_client_.get(); |
| 184 } |
| 185 |
| 186 CrosDisksClient* DBusClientBundle::cros_disks_client() { |
| 187 return cros_disks_client_.get(); |
| 188 } |
| 189 |
| 190 CryptohomeClient* DBusClientBundle::cryptohome_client() { |
| 191 return cryptohome_client_.get(); |
| 192 } |
| 193 |
| 194 DebugDaemonClient* DBusClientBundle::debug_daemon_client() { |
| 195 return debug_daemon_client_.get(); |
| 196 } |
| 197 |
| 198 EasyUnlockClient* DBusClientBundle::easy_unlock_client() { |
| 199 return easy_unlock_client_.get(); |
| 200 } |
| 201 |
| 202 LorgnetteManagerClient* DBusClientBundle::lorgnette_manager_client() { |
| 203 return lorgnette_manager_client_.get(); |
| 204 } |
| 205 |
| 206 ShillDeviceClient* DBusClientBundle::shill_device_client() { |
| 207 return shill_device_client_.get(); |
| 208 } |
| 209 |
| 210 ShillIPConfigClient* DBusClientBundle::shill_ipconfig_client() { |
| 211 return shill_ipconfig_client_.get(); |
| 212 } |
| 213 |
| 214 ShillManagerClient* DBusClientBundle::shill_manager_client() { |
| 215 return shill_manager_client_.get(); |
| 216 } |
| 217 |
| 218 ShillServiceClient* DBusClientBundle::shill_service_client() { |
| 219 return shill_service_client_.get(); |
| 220 } |
| 221 |
| 222 ShillProfileClient* DBusClientBundle::shill_profile_client() { |
| 223 return shill_profile_client_.get(); |
| 224 } |
| 225 |
| 226 GsmSMSClient* DBusClientBundle::gsm_sms_client() { |
| 227 return gsm_sms_client_.get(); |
| 228 } |
| 229 |
| 230 ImageBurnerClient* DBusClientBundle::image_burner_client() { |
| 231 return image_burner_client_.get(); |
| 232 } |
| 233 |
| 234 IntrospectableClient* DBusClientBundle::introspectable_client() { |
| 235 return introspectable_client_.get(); |
| 236 } |
| 237 |
| 238 ModemMessagingClient* DBusClientBundle::modem_messaging_client() { |
| 239 return modem_messaging_client_.get(); |
| 240 } |
| 241 |
| 242 NfcManagerClient* DBusClientBundle::nfc_manager_client() { |
| 243 return nfc_manager_client_.get(); |
| 244 } |
| 245 |
| 246 NfcAdapterClient* DBusClientBundle::nfc_adapter_client() { |
| 247 return nfc_adapter_client_.get(); |
| 248 } |
| 249 |
| 250 NfcDeviceClient* DBusClientBundle::nfc_device_client() { |
| 251 return nfc_device_client_.get(); |
| 252 } |
| 253 |
| 254 NfcTagClient* DBusClientBundle::nfc_tag_client() { |
| 255 return nfc_tag_client_.get(); |
| 256 } |
| 257 |
| 258 NfcRecordClient* DBusClientBundle::nfc_record_client() { |
| 259 return nfc_record_client_.get(); |
| 260 } |
| 261 |
| 262 PermissionBrokerClient* DBusClientBundle::permission_broker_client() { |
| 263 return permission_broker_client_.get(); |
| 264 } |
| 265 |
| 266 SystemClockClient* DBusClientBundle::system_clock_client() { |
| 267 return system_clock_client_.get(); |
| 268 } |
| 269 |
| 270 PowerManagerClient* DBusClientBundle::power_manager_client() { |
| 271 return power_manager_client_.get(); |
| 272 } |
| 273 |
| 274 SessionManagerClient* DBusClientBundle::session_manager_client() { |
| 275 return session_manager_client_.get(); |
| 276 } |
| 277 |
| 278 SMSClient* DBusClientBundle::sms_client() { |
| 279 return sms_client_.get(); |
| 280 } |
| 281 |
| 282 UpdateEngineClient* DBusClientBundle::update_engine_client() { |
| 283 return update_engine_client_.get(); |
| 284 } |
| 285 |
| 286 } // namespace chromeos |
OLD | NEW |