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