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