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.
5 #ifndef CHROMEOS_DBUS_DBUS_CLIENT_BUNDLE_H_
6 #define CHROMEOS_DBUS_DBUS_CLIENT_BUNDLE_H_
10 #include "base/memory/scoped_ptr.h"
11 #include "chromeos/chromeos_export.h"
15 class AmplifierClient
;
16 class ApManagerClient
;
18 class BluetoothAdapterClient
;
19 class BluetoothAgentManagerClient
;
20 class BluetoothDeviceClient
;
21 class BluetoothGattCharacteristicClient
;
22 class BluetoothGattDescriptorClient
;
23 class BluetoothGattManagerClient
;
24 class BluetoothGattServiceClient
;
25 class BluetoothInputClient
;
26 class BluetoothLEAdvertisingManagerClient
;
27 class BluetoothMediaClient
;
28 class BluetoothMediaTransportClient
;
29 class BluetoothProfileManagerClient
;
30 class CrasAudioClient
;
31 class CrosDisksClient
;
32 class CryptohomeClient
;
33 class DebugDaemonClient
;
34 class EasyUnlockClient
;
36 class ImageBurnerClient
;
37 class IntrospectableClient
;
38 class LorgnetteManagerClient
;
39 class ModemMessagingClient
;
40 class NfcAdapterClient
;
41 class NfcDeviceClient
;
42 class NfcManagerClient
;
43 class NfcRecordClient
;
45 class PeerDaemonManagerClient
;
46 class PermissionBrokerClient
;
47 class PowerManagerClient
;
48 class PrivetDaemonManagerClient
;
50 class SessionManagerClient
;
51 class ShillDeviceClient
;
52 class ShillIPConfigClient
;
53 class ShillManagerClient
;
54 class ShillProfileClient
;
55 class ShillServiceClient
;
56 class ShillThirdPartyVpnDriverClient
;
57 class SystemClockClient
;
58 class UpdateEngineClient
;
60 // The bundle of all D-Bus clients used in DBusThreadManager. The bundle
61 // is used to delete them at once in the right order before shutting down the
62 // system bus. See also the comment in the destructor of DBusThreadManager.
63 class CHROMEOS_EXPORT DBusClientBundle
{
65 typedef int DBusClientTypeMask
;
67 // TODO(zelidrag): We might want to collapse few more of these subsystems if
68 // their dbus interfaced correspond to the same daemon.
75 DEBUG_DAEMON
= 1 << 4,
77 LORGNETTE_MANAGER
= 1 << 6,
80 IMAGE_BURNER
= 1 << 9,
81 INTROSPECTABLE
= 1 << 10,
82 MODEM_MESSAGING
= 1 << 11,
84 PERMISSION_BROKER
= 1 << 13,
85 POWER_MANAGER
= 1 << 14,
86 SESSION_MANAGER
= 1 << 15,
88 SYSTEM_CLOCK
= 1 << 17,
89 UPDATE_ENGINE
= 1 << 18,
90 PEER_DAEMON
= 1 << 19,
92 PRIVET_DAEMON
= 1 << 21,
97 explicit DBusClientBundle(DBusClientTypeMask unstub_client_mask
);
100 // Returns true if |client| is stubbed.
101 bool IsUsingStub(DBusClientType client
);
103 // Returns true if any real DBusClient is used.
104 bool IsUsingAnyRealClient();
106 // Initialize proper runtime environment for its dbus clients.
107 void SetupDefaultEnvironment();
109 // Parses command line param values for dbus subsystem that should be
111 static DBusClientTypeMask
ParseUnstubList(const std::string
& unstub_list
);
113 AmplifierClient
* amplifier_client() { return amplifier_client_
.get(); }
115 ApManagerClient
* ap_manager_client() { return ap_manager_client_
.get(); }
117 AudioDspClient
* audio_dsp_client() { return audio_dsp_client_
.get(); }
119 BluetoothAdapterClient
* bluetooth_adapter_client() {
120 return bluetooth_adapter_client_
.get();
123 BluetoothLEAdvertisingManagerClient
*
124 bluetooth_le_advertising_manager_client() {
125 return bluetooth_le_advertising_manager_client_
.get();
128 BluetoothAgentManagerClient
* bluetooth_agent_manager_client() {
129 return bluetooth_agent_manager_client_
.get();
132 BluetoothDeviceClient
* bluetooth_device_client() {
133 return bluetooth_device_client_
.get();
136 BluetoothGattCharacteristicClient
* bluetooth_gatt_characteristic_client() {
137 return bluetooth_gatt_characteristic_client_
.get();
140 BluetoothGattDescriptorClient
* bluetooth_gatt_descriptor_client() {
141 return bluetooth_gatt_descriptor_client_
.get();
144 BluetoothGattManagerClient
* bluetooth_gatt_manager_client() {
145 return bluetooth_gatt_manager_client_
.get();
148 BluetoothGattServiceClient
* bluetooth_gatt_service_client() {
149 return bluetooth_gatt_service_client_
.get();
152 BluetoothInputClient
* bluetooth_input_client() {
153 return bluetooth_input_client_
.get();
156 BluetoothMediaClient
* bluetooth_media_client() {
157 return bluetooth_media_client_
.get();
160 BluetoothMediaTransportClient
* bluetooth_media_transport_client() {
161 return bluetooth_media_transport_client_
.get();
164 BluetoothProfileManagerClient
* bluetooth_profile_manager_client() {
165 return bluetooth_profile_manager_client_
.get();
168 CrasAudioClient
* cras_audio_client() {
169 return cras_audio_client_
.get();
172 CrosDisksClient
* cros_disks_client() {
173 return cros_disks_client_
.get();
176 CryptohomeClient
* cryptohome_client() {
177 return cryptohome_client_
.get();
180 DebugDaemonClient
* debug_daemon_client() {
181 return debug_daemon_client_
.get();
184 EasyUnlockClient
* easy_unlock_client() {
185 return easy_unlock_client_
.get();
188 LorgnetteManagerClient
* lorgnette_manager_client() {
189 return lorgnette_manager_client_
.get();
192 ShillDeviceClient
* shill_device_client() {
193 return shill_device_client_
.get();
196 ShillIPConfigClient
* shill_ipconfig_client() {
197 return shill_ipconfig_client_
.get();
200 ShillManagerClient
* shill_manager_client() {
201 return shill_manager_client_
.get();
204 ShillServiceClient
* shill_service_client() {
205 return shill_service_client_
.get();
208 ShillProfileClient
* shill_profile_client() {
209 return shill_profile_client_
.get();
212 ShillThirdPartyVpnDriverClient
* shill_third_party_vpn_driver_client() {
213 return shill_third_party_vpn_driver_client_
.get();
216 GsmSMSClient
* gsm_sms_client() {
217 return gsm_sms_client_
.get();
220 ImageBurnerClient
* image_burner_client() {
221 return image_burner_client_
.get();
224 IntrospectableClient
* introspectable_client() {
225 return introspectable_client_
.get();
228 ModemMessagingClient
* modem_messaging_client() {
229 return modem_messaging_client_
.get();
232 NfcManagerClient
* nfc_manager_client() {
233 return nfc_manager_client_
.get();
236 NfcAdapterClient
* nfc_adapter_client() {
237 return nfc_adapter_client_
.get();
240 NfcDeviceClient
* nfc_device_client() {
241 return nfc_device_client_
.get();
244 NfcTagClient
* nfc_tag_client() {
245 return nfc_tag_client_
.get();
248 NfcRecordClient
* nfc_record_client() {
249 return nfc_record_client_
.get();
252 PeerDaemonManagerClient
* peer_daemon_manager_client() {
253 return peer_daemon_manager_client_
.get();
256 PermissionBrokerClient
* permission_broker_client() {
257 return permission_broker_client_
.get();
260 PrivetDaemonManagerClient
* privet_daemon_manager_client() {
261 return privet_daemon_manager_client_
.get();
264 SystemClockClient
* system_clock_client() {
265 return system_clock_client_
.get();
268 PowerManagerClient
* power_manager_client() {
269 return power_manager_client_
.get();
272 SessionManagerClient
* session_manager_client() {
273 return session_manager_client_
.get();
276 SMSClient
* sms_client() {
277 return sms_client_
.get();
280 UpdateEngineClient
* update_engine_client() {
281 return update_engine_client_
.get();
285 friend class DBusThreadManagerSetter
;
287 // Bitmask that defines which dbus clients are not stubbed out. Bitmap flags
288 // are defined within DBusClientType enum.
289 DBusClientTypeMask unstub_client_mask_
;
291 scoped_ptr
<AmplifierClient
> amplifier_client_
;
292 scoped_ptr
<ApManagerClient
> ap_manager_client_
;
293 scoped_ptr
<AudioDspClient
> audio_dsp_client_
;
294 scoped_ptr
<BluetoothAdapterClient
> bluetooth_adapter_client_
;
295 scoped_ptr
<BluetoothLEAdvertisingManagerClient
>
296 bluetooth_le_advertising_manager_client_
;
297 scoped_ptr
<BluetoothAgentManagerClient
> bluetooth_agent_manager_client_
;
298 scoped_ptr
<BluetoothDeviceClient
> bluetooth_device_client_
;
299 scoped_ptr
<BluetoothGattCharacteristicClient
>
300 bluetooth_gatt_characteristic_client_
;
301 scoped_ptr
<BluetoothGattDescriptorClient
> bluetooth_gatt_descriptor_client_
;
302 scoped_ptr
<BluetoothGattManagerClient
> bluetooth_gatt_manager_client_
;
303 scoped_ptr
<BluetoothGattServiceClient
> bluetooth_gatt_service_client_
;
304 scoped_ptr
<BluetoothInputClient
> bluetooth_input_client_
;
305 scoped_ptr
<BluetoothMediaClient
> bluetooth_media_client_
;
306 scoped_ptr
<BluetoothMediaTransportClient
> bluetooth_media_transport_client_
;
307 scoped_ptr
<BluetoothProfileManagerClient
> bluetooth_profile_manager_client_
;
308 scoped_ptr
<CrasAudioClient
> cras_audio_client_
;
309 scoped_ptr
<CrosDisksClient
> cros_disks_client_
;
310 scoped_ptr
<CryptohomeClient
> cryptohome_client_
;
311 scoped_ptr
<DebugDaemonClient
> debug_daemon_client_
;
312 scoped_ptr
<EasyUnlockClient
> easy_unlock_client_
;
313 scoped_ptr
<LorgnetteManagerClient
> lorgnette_manager_client_
;
314 scoped_ptr
<PeerDaemonManagerClient
> peer_daemon_manager_client_
;
315 scoped_ptr
<PrivetDaemonManagerClient
> privet_daemon_manager_client_
;
316 scoped_ptr
<ShillDeviceClient
> shill_device_client_
;
317 scoped_ptr
<ShillIPConfigClient
> shill_ipconfig_client_
;
318 scoped_ptr
<ShillManagerClient
> shill_manager_client_
;
319 scoped_ptr
<ShillServiceClient
> shill_service_client_
;
320 scoped_ptr
<ShillProfileClient
> shill_profile_client_
;
321 scoped_ptr
<ShillThirdPartyVpnDriverClient
>
322 shill_third_party_vpn_driver_client_
;
323 scoped_ptr
<GsmSMSClient
> gsm_sms_client_
;
324 scoped_ptr
<ImageBurnerClient
> image_burner_client_
;
325 scoped_ptr
<IntrospectableClient
> introspectable_client_
;
326 scoped_ptr
<ModemMessagingClient
> modem_messaging_client_
;
327 // The declaration order for NFC client objects is important. See
328 // DBusThreadManager::InitializeClients for the dependencies.
329 scoped_ptr
<NfcManagerClient
> nfc_manager_client_
;
330 scoped_ptr
<NfcAdapterClient
> nfc_adapter_client_
;
331 scoped_ptr
<NfcDeviceClient
> nfc_device_client_
;
332 scoped_ptr
<NfcTagClient
> nfc_tag_client_
;
333 scoped_ptr
<NfcRecordClient
> nfc_record_client_
;
334 scoped_ptr
<PermissionBrokerClient
> permission_broker_client_
;
335 scoped_ptr
<SystemClockClient
> system_clock_client_
;
336 scoped_ptr
<PowerManagerClient
> power_manager_client_
;
337 scoped_ptr
<SessionManagerClient
> session_manager_client_
;
338 scoped_ptr
<SMSClient
> sms_client_
;
339 scoped_ptr
<UpdateEngineClient
> update_engine_client_
;
341 DISALLOW_COPY_AND_ASSIGN(DBusClientBundle
);
344 } // namespace chromeos
346 #endif // CHROMEOS_DBUS_DBUS_CLIENT_BUNDLE_H_