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