| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "chromeos/dbus/mixed_dbus_thread_manager.h" | |
| 6 | |
| 7 namespace chromeos { | |
| 8 | |
| 9 MixedDBusThreadManager::MixedDBusThreadManager( | |
| 10 DBusThreadManager* real_thread_manager, | |
| 11 DBusThreadManager* fake_thread_manager) | |
| 12 : real_thread_manager_(real_thread_manager), | |
| 13 fake_thread_manager_(fake_thread_manager) { | |
| 14 } | |
| 15 | |
| 16 MixedDBusThreadManager::~MixedDBusThreadManager() { | |
| 17 } | |
| 18 | |
| 19 // DBusThreadManager overrides. | |
| 20 dbus::Bus* MixedDBusThreadManager::GetSystemBus() { | |
| 21 return real_thread_manager_->GetSystemBus(); | |
| 22 } | |
| 23 | |
| 24 BluetoothAdapterClient* MixedDBusThreadManager::GetBluetoothAdapterClient() { | |
| 25 return GetThreadManager( | |
| 26 DBusClientBundle::BLUETOOTH)->GetBluetoothAdapterClient(); | |
| 27 } | |
| 28 | |
| 29 BluetoothAgentManagerClient* | |
| 30 MixedDBusThreadManager::GetBluetoothAgentManagerClient() { | |
| 31 return GetThreadManager( | |
| 32 DBusClientBundle::BLUETOOTH)->GetBluetoothAgentManagerClient(); | |
| 33 } | |
| 34 | |
| 35 BluetoothDeviceClient* MixedDBusThreadManager::GetBluetoothDeviceClient() { | |
| 36 return GetThreadManager( | |
| 37 DBusClientBundle::BLUETOOTH)->GetBluetoothDeviceClient(); | |
| 38 } | |
| 39 | |
| 40 BluetoothGattCharacteristicClient* | |
| 41 MixedDBusThreadManager::GetBluetoothGattCharacteristicClient() { | |
| 42 return GetThreadManager(DBusClientBundle::BLUETOOTH)-> | |
| 43 GetBluetoothGattCharacteristicClient(); | |
| 44 } | |
| 45 | |
| 46 BluetoothGattDescriptorClient* | |
| 47 MixedDBusThreadManager::GetBluetoothGattDescriptorClient() { | |
| 48 return GetThreadManager(DBusClientBundle::BLUETOOTH)-> | |
| 49 GetBluetoothGattDescriptorClient(); | |
| 50 } | |
| 51 | |
| 52 BluetoothGattManagerClient* | |
| 53 MixedDBusThreadManager::GetBluetoothGattManagerClient() { | |
| 54 return GetThreadManager( | |
| 55 DBusClientBundle::BLUETOOTH)->GetBluetoothGattManagerClient(); | |
| 56 } | |
| 57 | |
| 58 BluetoothGattServiceClient* | |
| 59 MixedDBusThreadManager::GetBluetoothGattServiceClient() { | |
| 60 return GetThreadManager( | |
| 61 DBusClientBundle::BLUETOOTH)->GetBluetoothGattServiceClient(); | |
| 62 } | |
| 63 | |
| 64 BluetoothInputClient* MixedDBusThreadManager::GetBluetoothInputClient() { | |
| 65 return GetThreadManager( | |
| 66 DBusClientBundle::BLUETOOTH)->GetBluetoothInputClient(); | |
| 67 } | |
| 68 | |
| 69 BluetoothProfileManagerClient* | |
| 70 MixedDBusThreadManager::GetBluetoothProfileManagerClient() { | |
| 71 return GetThreadManager( | |
| 72 DBusClientBundle::BLUETOOTH)->GetBluetoothProfileManagerClient(); | |
| 73 } | |
| 74 | |
| 75 CrasAudioClient* MixedDBusThreadManager::GetCrasAudioClient() { | |
| 76 return GetThreadManager( | |
| 77 DBusClientBundle::CRAS)->GetCrasAudioClient(); | |
| 78 } | |
| 79 | |
| 80 CrosDisksClient* MixedDBusThreadManager::GetCrosDisksClient() { | |
| 81 return GetThreadManager(DBusClientBundle::CROS_DISKS)->GetCrosDisksClient(); | |
| 82 } | |
| 83 | |
| 84 CryptohomeClient* MixedDBusThreadManager::GetCryptohomeClient() { | |
| 85 return GetThreadManager( | |
| 86 DBusClientBundle::CRYPTOHOME)->GetCryptohomeClient(); | |
| 87 } | |
| 88 | |
| 89 DebugDaemonClient* MixedDBusThreadManager::GetDebugDaemonClient() { | |
| 90 return GetThreadManager( | |
| 91 DBusClientBundle::DEBUG_DAEMON)->GetDebugDaemonClient(); | |
| 92 } | |
| 93 | |
| 94 EasyUnlockClient* MixedDBusThreadManager::GetEasyUnlockClient() { | |
| 95 return GetThreadManager( | |
| 96 DBusClientBundle::EASY_UNLOCK)->GetEasyUnlockClient(); | |
| 97 } | |
| 98 | |
| 99 LorgnetteManagerClient* MixedDBusThreadManager::GetLorgnetteManagerClient() { | |
| 100 return GetThreadManager( | |
| 101 DBusClientBundle::LORGNETTE_MANAGER)->GetLorgnetteManagerClient(); | |
| 102 } | |
| 103 | |
| 104 ShillDeviceClient* MixedDBusThreadManager::GetShillDeviceClient() { | |
| 105 return GetThreadManager(DBusClientBundle::SHILL)->GetShillDeviceClient(); | |
| 106 } | |
| 107 | |
| 108 ShillIPConfigClient* MixedDBusThreadManager::GetShillIPConfigClient() { | |
| 109 return GetThreadManager(DBusClientBundle::SHILL)->GetShillIPConfigClient(); | |
| 110 } | |
| 111 | |
| 112 ShillManagerClient* MixedDBusThreadManager::GetShillManagerClient() { | |
| 113 return GetThreadManager(DBusClientBundle::SHILL)->GetShillManagerClient(); | |
| 114 } | |
| 115 | |
| 116 ShillProfileClient* MixedDBusThreadManager::GetShillProfileClient() { | |
| 117 return GetThreadManager(DBusClientBundle::SHILL)->GetShillProfileClient(); | |
| 118 } | |
| 119 | |
| 120 ShillServiceClient* MixedDBusThreadManager::GetShillServiceClient() { | |
| 121 return GetThreadManager(DBusClientBundle::SHILL)->GetShillServiceClient(); | |
| 122 } | |
| 123 | |
| 124 GsmSMSClient* MixedDBusThreadManager::GetGsmSMSClient() { | |
| 125 return GetThreadManager(DBusClientBundle::GSM_SMS)->GetGsmSMSClient(); | |
| 126 } | |
| 127 | |
| 128 ImageBurnerClient* MixedDBusThreadManager::GetImageBurnerClient() { | |
| 129 return GetThreadManager( | |
| 130 DBusClientBundle::IMAGE_BURNER)->GetImageBurnerClient(); | |
| 131 } | |
| 132 | |
| 133 IntrospectableClient* MixedDBusThreadManager::GetIntrospectableClient() { | |
| 134 return GetThreadManager( | |
| 135 DBusClientBundle::INTROSPECTABLE)->GetIntrospectableClient(); | |
| 136 } | |
| 137 | |
| 138 ModemMessagingClient* MixedDBusThreadManager::GetModemMessagingClient() { | |
| 139 return GetThreadManager( | |
| 140 DBusClientBundle::MODEM_MESSAGING)->GetModemMessagingClient(); | |
| 141 } | |
| 142 | |
| 143 NfcAdapterClient* MixedDBusThreadManager::GetNfcAdapterClient() { | |
| 144 return GetThreadManager(DBusClientBundle::NFC)->GetNfcAdapterClient(); | |
| 145 } | |
| 146 | |
| 147 NfcDeviceClient* MixedDBusThreadManager::GetNfcDeviceClient() { | |
| 148 return GetThreadManager(DBusClientBundle::NFC)->GetNfcDeviceClient(); | |
| 149 } | |
| 150 | |
| 151 NfcManagerClient* MixedDBusThreadManager::GetNfcManagerClient() { | |
| 152 return GetThreadManager(DBusClientBundle::NFC)->GetNfcManagerClient(); | |
| 153 } | |
| 154 | |
| 155 NfcRecordClient* MixedDBusThreadManager::GetNfcRecordClient() { | |
| 156 return GetThreadManager(DBusClientBundle::NFC)->GetNfcRecordClient(); | |
| 157 } | |
| 158 | |
| 159 NfcTagClient* MixedDBusThreadManager::GetNfcTagClient() { | |
| 160 return GetThreadManager(DBusClientBundle::NFC)->GetNfcTagClient(); | |
| 161 } | |
| 162 | |
| 163 PermissionBrokerClient* MixedDBusThreadManager::GetPermissionBrokerClient() { | |
| 164 return GetThreadManager( | |
| 165 DBusClientBundle::PERMISSION_BROKER)->GetPermissionBrokerClient(); | |
| 166 } | |
| 167 | |
| 168 PowerManagerClient* MixedDBusThreadManager::GetPowerManagerClient() { | |
| 169 return GetThreadManager( | |
| 170 DBusClientBundle::POWER_MANAGER)->GetPowerManagerClient(); | |
| 171 } | |
| 172 | |
| 173 PowerPolicyController* MixedDBusThreadManager::GetPowerPolicyController() { | |
| 174 return GetThreadManager( | |
| 175 DBusClientBundle::POWER_MANAGER)->GetPowerPolicyController(); | |
| 176 } | |
| 177 | |
| 178 SessionManagerClient* MixedDBusThreadManager::GetSessionManagerClient() { | |
| 179 return GetThreadManager( | |
| 180 DBusClientBundle::SESSION_MANAGER)->GetSessionManagerClient(); | |
| 181 } | |
| 182 | |
| 183 SMSClient* MixedDBusThreadManager::GetSMSClient() { | |
| 184 return GetThreadManager(DBusClientBundle::SMS)->GetSMSClient(); | |
| 185 } | |
| 186 | |
| 187 SystemClockClient* MixedDBusThreadManager::GetSystemClockClient() { | |
| 188 return GetThreadManager( | |
| 189 DBusClientBundle::SYSTEM_CLOCK)->GetSystemClockClient(); | |
| 190 } | |
| 191 | |
| 192 UpdateEngineClient* MixedDBusThreadManager::GetUpdateEngineClient() { | |
| 193 return GetThreadManager( | |
| 194 DBusClientBundle::UPDATE_ENGINE)->GetUpdateEngineClient(); | |
| 195 } | |
| 196 | |
| 197 DBusThreadManager* MixedDBusThreadManager::GetThreadManager( | |
| 198 DBusClientBundle::DBusClientType client) { | |
| 199 if (DBusThreadManager::IsUsingStub(client)) | |
| 200 return fake_thread_manager_.get(); | |
| 201 | |
| 202 return real_thread_manager_.get(); | |
| 203 } | |
| 204 | |
| 205 } // namespace chromeos | |
| OLD | NEW |