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