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 #ifndef CHROMEOS_DBUS_DBUS_CLIENT_BUNDLE_H_ | 5 #ifndef CHROMEOS_DBUS_DBUS_CLIENT_BUNDLE_H_ |
6 #define CHROMEOS_DBUS_DBUS_CLIENT_BUNDLE_H_ | 6 #define CHROMEOS_DBUS_DBUS_CLIENT_BUNDLE_H_ |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "chromeos/chromeos_export.h" | 9 #include "chromeos/chromeos_export.h" |
10 | 10 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 class PowerManagerClient; | 44 class PowerManagerClient; |
45 class SessionManagerClient; | 45 class SessionManagerClient; |
46 class SMSClient; | 46 class SMSClient; |
47 class UpdateEngineClient; | 47 class UpdateEngineClient; |
48 | 48 |
49 // The bundle of all D-Bus clients used in DBusThreadManagerImpl. The bundle | 49 // The bundle of all D-Bus clients used in DBusThreadManagerImpl. The bundle |
50 // is used to delete them at once in the right order before shutting down the | 50 // is used to delete them at once in the right order before shutting down the |
51 // system bus. See also the comment in the destructor of DBusThreadManagerImpl. | 51 // system bus. See also the comment in the destructor of DBusThreadManagerImpl. |
52 class CHROMEOS_EXPORT DBusClientBundle { | 52 class CHROMEOS_EXPORT DBusClientBundle { |
53 public: | 53 public: |
54 typedef unsigned int DBusClientTypeMask; | 54 typedef int DBusClientTypeMask; |
55 | 55 |
56 // TODO(zelidrag): We might want to collapse few more of these subsystems if | 56 // TODO(zelidrag): We might want to collapse few more of these subsystems if |
57 // their dbus interfaced correspond to the same daemon. | 57 // their dbus interfaced correspond to the same daemon. |
58 enum DBusClientType { | 58 enum DBusClientType { |
59 NO_CLIENTS = 0, | 59 NO_CLIENT = 0, |
60 BLUETOOTH = 1 << 0, | 60 BLUETOOTH = 1 << 0, |
61 CRAS = 1 << 1, | 61 CRAS = 1 << 1, |
62 CROS_DISKS = 1 << 2, | 62 CROS_DISKS = 1 << 2, |
63 CRYPTOHOME = 1 << 3, | 63 CRYPTOHOME = 1 << 3, |
64 DEBUG_DAEMON = 1 << 4, | 64 DEBUG_DAEMON = 1 << 4, |
65 EASY_UNLOCK = 1 << 5, | 65 EASY_UNLOCK = 1 << 5, |
66 LORGNETTE_MANAGER = 1 << 6, | 66 LORGNETTE_MANAGER = 1 << 6, |
67 SHILL = 1 << 7, | 67 SHILL = 1 << 7, |
68 GSM_SMS = 1 << 8, | 68 GSM_SMS = 1 << 8, |
69 IMAGE_BURNER = 1 << 9, | 69 IMAGE_BURNER = 1 << 9, |
70 INTROSPECTABLE = 1 << 10, | 70 INTROSPECTABLE = 1 << 10, |
71 MODEM_MESSAGING = 1 << 11, | 71 MODEM_MESSAGING = 1 << 11, |
72 NFC = 1 << 12, | 72 NFC = 1 << 12, |
73 PERMISSION_BROKER = 1 << 13, | 73 PERMISSION_BROKER = 1 << 13, |
74 POWER_MANAGER = 1 << 14, | 74 POWER_MANAGER = 1 << 14, |
75 SESSION_MANAGER = 1 << 15, | 75 SESSION_MANAGER = 1 << 15, |
76 SMS = 1 << 16, | 76 SMS = 1 << 16, |
77 SYSTEM_CLOCK = 1 << 17, | 77 SYSTEM_CLOCK = 1 << 17, |
78 UPDATE_ENGINE = 1 << 18, | 78 UPDATE_ENGINE = 1 << 18, |
79 ALL_CLIENTS = ~static_cast<DBusClientTypeMask>(0), | |
80 }; | 79 }; |
81 | 80 |
82 DBusClientBundle(); | 81 DBusClientBundle(DBusClientTypeMask unstub_client_mask); |
83 ~DBusClientBundle(); | 82 ~DBusClientBundle(); |
84 | 83 |
| 84 // Returns true if |client| is stubbed. |
| 85 bool IsUsingStub(DBusClientType client); |
| 86 |
| 87 // Returns true if any real DBusClient is used. |
| 88 bool IsUsingAnyRealClient(); |
| 89 |
85 // Initialize proper runtime environment for its dbus clients. | 90 // Initialize proper runtime environment for its dbus clients. |
86 void SetupDefaultEnvironment(); | 91 void SetupDefaultEnvironment(); |
87 | 92 |
88 // Parses command line param values for dbus subsystem that should be | 93 // Parses command line param values for dbus subsystem that should be |
89 // un-stubbed. | 94 // un-stubbed. |
90 static DBusClientTypeMask ParseUnstubList(const std::string& unstub_list); | 95 static DBusClientTypeMask ParseUnstubList(const std::string& unstub_list); |
91 | 96 |
92 BluetoothAdapterClient* bluetooth_adapter_client() { | 97 BluetoothAdapterClient* bluetooth_adapter_client() { |
93 return bluetooth_adapter_client_.get(); | 98 return bluetooth_adapter_client_.get(); |
94 } | 99 } |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 return sms_client_.get(); | 230 return sms_client_.get(); |
226 } | 231 } |
227 | 232 |
228 UpdateEngineClient* update_engine_client() { | 233 UpdateEngineClient* update_engine_client() { |
229 return update_engine_client_.get(); | 234 return update_engine_client_.get(); |
230 } | 235 } |
231 | 236 |
232 private: | 237 private: |
233 friend class DBusThreadManagerSetter; | 238 friend class DBusThreadManagerSetter; |
234 | 239 |
| 240 // Bitmask that defines which dbus clients are not stubbed out. Bitmap flags |
| 241 // are defined within DBusClientType enum. |
| 242 DBusClientTypeMask unstub_client_mask_; |
| 243 |
235 scoped_ptr<BluetoothAdapterClient> bluetooth_adapter_client_; | 244 scoped_ptr<BluetoothAdapterClient> bluetooth_adapter_client_; |
236 scoped_ptr<BluetoothAgentManagerClient> bluetooth_agent_manager_client_; | 245 scoped_ptr<BluetoothAgentManagerClient> bluetooth_agent_manager_client_; |
237 scoped_ptr<BluetoothDeviceClient> bluetooth_device_client_; | 246 scoped_ptr<BluetoothDeviceClient> bluetooth_device_client_; |
238 scoped_ptr<BluetoothGattCharacteristicClient> | 247 scoped_ptr<BluetoothGattCharacteristicClient> |
239 bluetooth_gatt_characteristic_client_; | 248 bluetooth_gatt_characteristic_client_; |
240 scoped_ptr<BluetoothGattDescriptorClient> bluetooth_gatt_descriptor_client_; | 249 scoped_ptr<BluetoothGattDescriptorClient> bluetooth_gatt_descriptor_client_; |
241 scoped_ptr<BluetoothGattManagerClient> bluetooth_gatt_manager_client_; | 250 scoped_ptr<BluetoothGattManagerClient> bluetooth_gatt_manager_client_; |
242 scoped_ptr<BluetoothGattServiceClient> bluetooth_gatt_service_client_; | 251 scoped_ptr<BluetoothGattServiceClient> bluetooth_gatt_service_client_; |
243 scoped_ptr<BluetoothInputClient> bluetooth_input_client_; | 252 scoped_ptr<BluetoothInputClient> bluetooth_input_client_; |
244 scoped_ptr<BluetoothProfileManagerClient> bluetooth_profile_manager_client_; | 253 scoped_ptr<BluetoothProfileManagerClient> bluetooth_profile_manager_client_; |
245 scoped_ptr<CrasAudioClient> cras_audio_client_; | 254 scoped_ptr<CrasAudioClient> cras_audio_client_; |
246 scoped_ptr<CrosDisksClient> cros_disks_client_; | 255 scoped_ptr<CrosDisksClient> cros_disks_client_; |
247 scoped_ptr<CryptohomeClient> cryptohome_client_; | 256 scoped_ptr<CryptohomeClient> cryptohome_client_; |
248 scoped_ptr<DebugDaemonClient> debug_daemon_client_; | 257 scoped_ptr<DebugDaemonClient> debug_daemon_client_; |
249 scoped_ptr<EasyUnlockClient> easy_unlock_client_; | 258 scoped_ptr<EasyUnlockClient> easy_unlock_client_; |
250 scoped_ptr<LorgnetteManagerClient> lorgnette_manager_client_; | 259 scoped_ptr<LorgnetteManagerClient> lorgnette_manager_client_; |
251 scoped_ptr<ShillDeviceClient> shill_device_client_; | 260 scoped_ptr<ShillDeviceClient> shill_device_client_; |
252 scoped_ptr<ShillIPConfigClient> shill_ipconfig_client_; | 261 scoped_ptr<ShillIPConfigClient> shill_ipconfig_client_; |
253 scoped_ptr<ShillManagerClient> shill_manager_client_; | 262 scoped_ptr<ShillManagerClient> shill_manager_client_; |
254 scoped_ptr<ShillServiceClient> shill_service_client_; | 263 scoped_ptr<ShillServiceClient> shill_service_client_; |
255 scoped_ptr<ShillProfileClient> shill_profile_client_; | 264 scoped_ptr<ShillProfileClient> shill_profile_client_; |
256 scoped_ptr<GsmSMSClient> gsm_sms_client_; | 265 scoped_ptr<GsmSMSClient> gsm_sms_client_; |
257 scoped_ptr<ImageBurnerClient> image_burner_client_; | 266 scoped_ptr<ImageBurnerClient> image_burner_client_; |
258 scoped_ptr<IntrospectableClient> introspectable_client_; | 267 scoped_ptr<IntrospectableClient> introspectable_client_; |
259 scoped_ptr<ModemMessagingClient> modem_messaging_client_; | 268 scoped_ptr<ModemMessagingClient> modem_messaging_client_; |
260 // The declaration order for NFC client objects is important. See | 269 // The declaration order for NFC client objects is important. See |
261 // DBusThreadManager::CreateDefaultClients for the dependencies. | 270 // DBusThreadManager::InitializeClients for the dependencies. |
262 scoped_ptr<NfcManagerClient> nfc_manager_client_; | 271 scoped_ptr<NfcManagerClient> nfc_manager_client_; |
263 scoped_ptr<NfcAdapterClient> nfc_adapter_client_; | 272 scoped_ptr<NfcAdapterClient> nfc_adapter_client_; |
264 scoped_ptr<NfcDeviceClient> nfc_device_client_; | 273 scoped_ptr<NfcDeviceClient> nfc_device_client_; |
265 scoped_ptr<NfcTagClient> nfc_tag_client_; | 274 scoped_ptr<NfcTagClient> nfc_tag_client_; |
266 scoped_ptr<NfcRecordClient> nfc_record_client_; | 275 scoped_ptr<NfcRecordClient> nfc_record_client_; |
267 scoped_ptr<PermissionBrokerClient> permission_broker_client_; | 276 scoped_ptr<PermissionBrokerClient> permission_broker_client_; |
268 scoped_ptr<SystemClockClient> system_clock_client_; | 277 scoped_ptr<SystemClockClient> system_clock_client_; |
269 scoped_ptr<PowerManagerClient> power_manager_client_; | 278 scoped_ptr<PowerManagerClient> power_manager_client_; |
270 scoped_ptr<SessionManagerClient> session_manager_client_; | 279 scoped_ptr<SessionManagerClient> session_manager_client_; |
271 scoped_ptr<SMSClient> sms_client_; | 280 scoped_ptr<SMSClient> sms_client_; |
272 scoped_ptr<UpdateEngineClient> update_engine_client_; | 281 scoped_ptr<UpdateEngineClient> update_engine_client_; |
273 | 282 |
274 DISALLOW_COPY_AND_ASSIGN(DBusClientBundle); | 283 DISALLOW_COPY_AND_ASSIGN(DBusClientBundle); |
275 }; | 284 }; |
276 | 285 |
277 } // namespace chromeos | 286 } // namespace chromeos |
278 | 287 |
279 #endif // CHROMEOS_DBUS_DBUS_CLIENT_BUNDLE_H_ | 288 #endif // CHROMEOS_DBUS_DBUS_CLIENT_BUNDLE_H_ |
OLD | NEW |