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 ApManagerClient
;
16 class BluetoothAdapterClient
;
17 class BluetoothAgentManagerClient
;
18 class BluetoothDeviceClient
;
19 class BluetoothGattCharacteristicClient
;
20 class BluetoothGattDescriptorClient
;
21 class BluetoothGattManagerClient
;
22 class BluetoothGattServiceClient
;
23 class BluetoothInputClient
;
24 class BluetoothMediaClient
;
25 class BluetoothMediaTransportClient
;
26 class BluetoothProfileManagerClient
;
27 class CrasAudioClient
;
28 class CrosDisksClient
;
29 class CryptohomeClient
;
30 class DebugDaemonClient
;
31 class EasyUnlockClient
;
32 class LeadershipDaemonManagerClient
;
33 class LorgnetteManagerClient
;
34 class MetronomeClient
;
35 class ShillDeviceClient
;
36 class ShillIPConfigClient
;
37 class ShillManagerClient
;
38 class ShillServiceClient
;
39 class ShillProfileClient
;
40 class ShillThirdPartyVpnDriverClient
;
42 class ImageBurnerClient
;
43 class IntrospectableClient
;
44 class ModemMessagingClient
;
45 class NfcManagerClient
;
46 class NfcAdapterClient
;
47 class NfcDeviceClient
;
49 class NfcRecordClient
;
50 class PeerDaemonManagerClient
;
51 class PermissionBrokerClient
;
52 class PrivetDaemonManagerClient
;
53 class SystemClockClient
;
54 class PowerManagerClient
;
55 class SessionManagerClient
;
57 class UpdateEngineClient
;
59 // The bundle of all D-Bus clients used in DBusThreadManager. The bundle
60 // is used to delete them at once in the right order before shutting down the
61 // system bus. See also the comment in the destructor of DBusThreadManager.
62 class CHROMEOS_EXPORT DBusClientBundle
{
64 typedef int DBusClientTypeMask
;
66 // TODO(zelidrag): We might want to collapse few more of these subsystems if
67 // their dbus interfaced correspond to the same daemon.
74 DEBUG_DAEMON
= 1 << 4,
76 LORGNETTE_MANAGER
= 1 << 6,
79 IMAGE_BURNER
= 1 << 9,
80 INTROSPECTABLE
= 1 << 10,
81 MODEM_MESSAGING
= 1 << 11,
83 PERMISSION_BROKER
= 1 << 13,
84 POWER_MANAGER
= 1 << 14,
85 SESSION_MANAGER
= 1 << 15,
87 SYSTEM_CLOCK
= 1 << 17,
88 UPDATE_ENGINE
= 1 << 18,
89 PEER_DAEMON
= 1 << 19,
90 LEADERSHIP_DAEMON
= 1 << 20,
93 PRIVET_DAEMON
= 1 << 23,
96 explicit DBusClientBundle(DBusClientTypeMask unstub_client_mask
);
99 // Returns true if |client| is stubbed.
100 bool IsUsingStub(DBusClientType client
);
102 // Returns true if any real DBusClient is used.
103 bool IsUsingAnyRealClient();
105 // Initialize proper runtime environment for its dbus clients.
106 void SetupDefaultEnvironment();
108 // Parses command line param values for dbus subsystem that should be
110 static DBusClientTypeMask
ParseUnstubList(const std::string
& unstub_list
);
112 ApManagerClient
* ap_manager_client() { return ap_manager_client_
.get(); }
114 BluetoothAdapterClient
* bluetooth_adapter_client() {
115 return bluetooth_adapter_client_
.get();
118 BluetoothAgentManagerClient
* bluetooth_agent_manager_client() {
119 return bluetooth_agent_manager_client_
.get();
122 BluetoothDeviceClient
* bluetooth_device_client() {
123 return bluetooth_device_client_
.get();
126 BluetoothGattCharacteristicClient
* bluetooth_gatt_characteristic_client() {
127 return bluetooth_gatt_characteristic_client_
.get();
130 BluetoothGattDescriptorClient
* bluetooth_gatt_descriptor_client() {
131 return bluetooth_gatt_descriptor_client_
.get();
134 BluetoothGattManagerClient
* bluetooth_gatt_manager_client() {
135 return bluetooth_gatt_manager_client_
.get();
138 BluetoothGattServiceClient
* bluetooth_gatt_service_client() {
139 return bluetooth_gatt_service_client_
.get();
142 BluetoothInputClient
* bluetooth_input_client() {
143 return bluetooth_input_client_
.get();
146 BluetoothMediaClient
* bluetooth_media_client() {
147 return bluetooth_media_client_
.get();
150 BluetoothMediaTransportClient
* bluetooth_media_transport_client() {
151 return bluetooth_media_transport_client_
.get();
154 BluetoothProfileManagerClient
* bluetooth_profile_manager_client() {
155 return bluetooth_profile_manager_client_
.get();
158 CrasAudioClient
* cras_audio_client() {
159 return cras_audio_client_
.get();
162 CrosDisksClient
* cros_disks_client() {
163 return cros_disks_client_
.get();
166 CryptohomeClient
* cryptohome_client() {
167 return cryptohome_client_
.get();
170 DebugDaemonClient
* debug_daemon_client() {
171 return debug_daemon_client_
.get();
174 EasyUnlockClient
* easy_unlock_client() {
175 return easy_unlock_client_
.get();
178 LeadershipDaemonManagerClient
* leadership_daemon_manager_client() {
179 return leadership_daemon_manager_client_
.get();
182 LorgnetteManagerClient
* lorgnette_manager_client() {
183 return lorgnette_manager_client_
.get();
186 MetronomeClient
* metronome_client() { return metronome_client_
.get(); }
188 ShillDeviceClient
* shill_device_client() {
189 return shill_device_client_
.get();
192 ShillIPConfigClient
* shill_ipconfig_client() {
193 return shill_ipconfig_client_
.get();
196 ShillManagerClient
* shill_manager_client() {
197 return shill_manager_client_
.get();
200 ShillServiceClient
* shill_service_client() {
201 return shill_service_client_
.get();
204 ShillProfileClient
* shill_profile_client() {
205 return shill_profile_client_
.get();
208 ShillThirdPartyVpnDriverClient
* shill_third_party_vpn_driver_client() {
209 return shill_third_party_vpn_driver_client_
.get();
212 GsmSMSClient
* gsm_sms_client() {
213 return gsm_sms_client_
.get();
216 ImageBurnerClient
* image_burner_client() {
217 return image_burner_client_
.get();
220 IntrospectableClient
* introspectable_client() {
221 return introspectable_client_
.get();
224 ModemMessagingClient
* modem_messaging_client() {
225 return modem_messaging_client_
.get();
228 NfcManagerClient
* nfc_manager_client() {
229 return nfc_manager_client_
.get();
232 NfcAdapterClient
* nfc_adapter_client() {
233 return nfc_adapter_client_
.get();
236 NfcDeviceClient
* nfc_device_client() {
237 return nfc_device_client_
.get();
240 NfcTagClient
* nfc_tag_client() {
241 return nfc_tag_client_
.get();
244 NfcRecordClient
* nfc_record_client() {
245 return nfc_record_client_
.get();
248 PeerDaemonManagerClient
* peer_daemon_manager_client() {
249 return peer_daemon_manager_client_
.get();
252 PermissionBrokerClient
* permission_broker_client() {
253 return permission_broker_client_
.get();
256 PrivetDaemonManagerClient
* privet_daemon_manager_client() {
257 return privet_daemon_manager_client_
.get();
260 SystemClockClient
* system_clock_client() {
261 return system_clock_client_
.get();
264 PowerManagerClient
* power_manager_client() {
265 return power_manager_client_
.get();
268 SessionManagerClient
* session_manager_client() {
269 return session_manager_client_
.get();
272 SMSClient
* sms_client() {
273 return sms_client_
.get();
276 UpdateEngineClient
* update_engine_client() {
277 return update_engine_client_
.get();
281 friend class DBusThreadManagerSetter
;
283 // Bitmask that defines which dbus clients are not stubbed out. Bitmap flags
284 // are defined within DBusClientType enum.
285 DBusClientTypeMask unstub_client_mask_
;
287 scoped_ptr
<ApManagerClient
> ap_manager_client_
;
288 scoped_ptr
<BluetoothAdapterClient
> bluetooth_adapter_client_
;
289 scoped_ptr
<BluetoothAgentManagerClient
> bluetooth_agent_manager_client_
;
290 scoped_ptr
<BluetoothDeviceClient
> bluetooth_device_client_
;
291 scoped_ptr
<BluetoothGattCharacteristicClient
>
292 bluetooth_gatt_characteristic_client_
;
293 scoped_ptr
<BluetoothGattDescriptorClient
> bluetooth_gatt_descriptor_client_
;
294 scoped_ptr
<BluetoothGattManagerClient
> bluetooth_gatt_manager_client_
;
295 scoped_ptr
<BluetoothGattServiceClient
> bluetooth_gatt_service_client_
;
296 scoped_ptr
<BluetoothInputClient
> bluetooth_input_client_
;
297 scoped_ptr
<BluetoothMediaClient
> bluetooth_media_client_
;
298 scoped_ptr
<BluetoothMediaTransportClient
> bluetooth_media_transport_client_
;
299 scoped_ptr
<BluetoothProfileManagerClient
> bluetooth_profile_manager_client_
;
300 scoped_ptr
<CrasAudioClient
> cras_audio_client_
;
301 scoped_ptr
<CrosDisksClient
> cros_disks_client_
;
302 scoped_ptr
<CryptohomeClient
> cryptohome_client_
;
303 scoped_ptr
<DebugDaemonClient
> debug_daemon_client_
;
304 scoped_ptr
<EasyUnlockClient
> easy_unlock_client_
;
305 scoped_ptr
<LeadershipDaemonManagerClient
> leadership_daemon_manager_client_
;
306 scoped_ptr
<LorgnetteManagerClient
> lorgnette_manager_client_
;
307 scoped_ptr
<MetronomeClient
> metronome_client_
;
308 scoped_ptr
<PeerDaemonManagerClient
> peer_daemon_manager_client_
;
309 scoped_ptr
<PrivetDaemonManagerClient
> privet_daemon_manager_client_
;
310 scoped_ptr
<ShillDeviceClient
> shill_device_client_
;
311 scoped_ptr
<ShillIPConfigClient
> shill_ipconfig_client_
;
312 scoped_ptr
<ShillManagerClient
> shill_manager_client_
;
313 scoped_ptr
<ShillServiceClient
> shill_service_client_
;
314 scoped_ptr
<ShillProfileClient
> shill_profile_client_
;
315 scoped_ptr
<ShillThirdPartyVpnDriverClient
>
316 shill_third_party_vpn_driver_client_
;
317 scoped_ptr
<GsmSMSClient
> gsm_sms_client_
;
318 scoped_ptr
<ImageBurnerClient
> image_burner_client_
;
319 scoped_ptr
<IntrospectableClient
> introspectable_client_
;
320 scoped_ptr
<ModemMessagingClient
> modem_messaging_client_
;
321 // The declaration order for NFC client objects is important. See
322 // DBusThreadManager::InitializeClients for the dependencies.
323 scoped_ptr
<NfcManagerClient
> nfc_manager_client_
;
324 scoped_ptr
<NfcAdapterClient
> nfc_adapter_client_
;
325 scoped_ptr
<NfcDeviceClient
> nfc_device_client_
;
326 scoped_ptr
<NfcTagClient
> nfc_tag_client_
;
327 scoped_ptr
<NfcRecordClient
> nfc_record_client_
;
328 scoped_ptr
<PermissionBrokerClient
> permission_broker_client_
;
329 scoped_ptr
<SystemClockClient
> system_clock_client_
;
330 scoped_ptr
<PowerManagerClient
> power_manager_client_
;
331 scoped_ptr
<SessionManagerClient
> session_manager_client_
;
332 scoped_ptr
<SMSClient
> sms_client_
;
333 scoped_ptr
<UpdateEngineClient
> update_engine_client_
;
335 DISALLOW_COPY_AND_ASSIGN(DBusClientBundle
);
338 } // namespace chromeos
340 #endif // CHROMEOS_DBUS_DBUS_CLIENT_BUNDLE_H_