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