Fix content_browsertests on Linux GN build.
[chromium-blink-merge.git] / chromeos / dbus / dbus_client_bundle.h
blob7397adaea3a4038fafcc98f7b49ab1c7e85a32ab
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 BluetoothAdapterClient;
16 class BluetoothAgentManagerClient;
17 class BluetoothDeviceClient;
18 class BluetoothGattCharacteristicClient;
19 class BluetoothGattDescriptorClient;
20 class BluetoothGattManagerClient;
21 class BluetoothGattServiceClient;
22 class BluetoothInputClient;
23 class BluetoothMediaClient;
24 class BluetoothMediaTransportClient;
25 class BluetoothProfileManagerClient;
26 class CrasAudioClient;
27 class CrosDisksClient;
28 class CryptohomeClient;
29 class DebugDaemonClient;
30 class EasyUnlockClient;
31 class LeadershipDaemonManagerClient;
32 class LorgnetteManagerClient;
33 class ShillDeviceClient;
34 class ShillIPConfigClient;
35 class ShillManagerClient;
36 class ShillServiceClient;
37 class ShillProfileClient;
38 class ShillThirdPartyVpnDriverClient;
39 class GsmSMSClient;
40 class ImageBurnerClient;
41 class IntrospectableClient;
42 class ModemMessagingClient;
43 class NfcManagerClient;
44 class NfcAdapterClient;
45 class NfcDeviceClient;
46 class NfcTagClient;
47 class NfcRecordClient;
48 class PeerDaemonManagerClient;
49 class PermissionBrokerClient;
50 class SystemClockClient;
51 class PowerManagerClient;
52 class SessionManagerClient;
53 class SMSClient;
54 class UpdateEngineClient;
56 // The bundle of all D-Bus clients used in DBusThreadManager. The bundle
57 // is used to delete them at once in the right order before shutting down the
58 // system bus. See also the comment in the destructor of DBusThreadManager.
59 class CHROMEOS_EXPORT DBusClientBundle {
60 public:
61 typedef int DBusClientTypeMask;
63 // TODO(zelidrag): We might want to collapse few more of these subsystems if
64 // their dbus interfaced correspond to the same daemon.
65 enum DBusClientType {
66 NO_CLIENT = 0,
67 BLUETOOTH = 1 << 0,
68 CRAS = 1 << 1,
69 CROS_DISKS = 1 << 2,
70 CRYPTOHOME = 1 << 3,
71 DEBUG_DAEMON = 1 << 4,
72 EASY_UNLOCK = 1 << 5,
73 LORGNETTE_MANAGER = 1 << 6,
74 SHILL = 1 << 7,
75 GSM_SMS = 1 << 8,
76 IMAGE_BURNER = 1 << 9,
77 INTROSPECTABLE = 1 << 10,
78 MODEM_MESSAGING = 1 << 11,
79 NFC = 1 << 12,
80 PERMISSION_BROKER = 1 << 13,
81 POWER_MANAGER = 1 << 14,
82 SESSION_MANAGER = 1 << 15,
83 SMS = 1 << 16,
84 SYSTEM_CLOCK = 1 << 17,
85 UPDATE_ENGINE = 1 << 18,
86 PEER_DAEMON = 1 << 19,
87 LEADERSHIP_DAEMON = 1 << 20,
90 explicit DBusClientBundle(DBusClientTypeMask unstub_client_mask);
91 ~DBusClientBundle();
93 // Returns true if |client| is stubbed.
94 bool IsUsingStub(DBusClientType client);
96 // Returns true if any real DBusClient is used.
97 bool IsUsingAnyRealClient();
99 // Initialize proper runtime environment for its dbus clients.
100 void SetupDefaultEnvironment();
102 // Parses command line param values for dbus subsystem that should be
103 // un-stubbed.
104 static DBusClientTypeMask ParseUnstubList(const std::string& unstub_list);
106 BluetoothAdapterClient* bluetooth_adapter_client() {
107 return bluetooth_adapter_client_.get();
110 BluetoothAgentManagerClient* bluetooth_agent_manager_client() {
111 return bluetooth_agent_manager_client_.get();
114 BluetoothDeviceClient* bluetooth_device_client() {
115 return bluetooth_device_client_.get();
118 BluetoothGattCharacteristicClient* bluetooth_gatt_characteristic_client() {
119 return bluetooth_gatt_characteristic_client_.get();
122 BluetoothGattDescriptorClient* bluetooth_gatt_descriptor_client() {
123 return bluetooth_gatt_descriptor_client_.get();
126 BluetoothGattManagerClient* bluetooth_gatt_manager_client() {
127 return bluetooth_gatt_manager_client_.get();
130 BluetoothGattServiceClient* bluetooth_gatt_service_client() {
131 return bluetooth_gatt_service_client_.get();
134 BluetoothInputClient* bluetooth_input_client() {
135 return bluetooth_input_client_.get();
138 BluetoothMediaClient* bluetooth_media_client() {
139 return bluetooth_media_client_.get();
142 BluetoothMediaTransportClient* bluetooth_media_transport_client() {
143 return bluetooth_media_transport_client_.get();
146 BluetoothProfileManagerClient* bluetooth_profile_manager_client() {
147 return bluetooth_profile_manager_client_.get();
150 CrasAudioClient* cras_audio_client() {
151 return cras_audio_client_.get();
154 CrosDisksClient* cros_disks_client() {
155 return cros_disks_client_.get();
158 CryptohomeClient* cryptohome_client() {
159 return cryptohome_client_.get();
162 DebugDaemonClient* debug_daemon_client() {
163 return debug_daemon_client_.get();
166 EasyUnlockClient* easy_unlock_client() {
167 return easy_unlock_client_.get();
170 LeadershipDaemonManagerClient* leadership_daemon_manager_client() {
171 return leadership_daemon_manager_client_.get();
174 LorgnetteManagerClient* lorgnette_manager_client() {
175 return lorgnette_manager_client_.get();
178 ShillDeviceClient* shill_device_client() {
179 return shill_device_client_.get();
182 ShillIPConfigClient* shill_ipconfig_client() {
183 return shill_ipconfig_client_.get();
186 ShillManagerClient* shill_manager_client() {
187 return shill_manager_client_.get();
190 ShillServiceClient* shill_service_client() {
191 return shill_service_client_.get();
194 ShillProfileClient* shill_profile_client() {
195 return shill_profile_client_.get();
198 ShillThirdPartyVpnDriverClient* shill_third_party_vpn_driver_client() {
199 return shill_third_party_vpn_driver_client_.get();
202 GsmSMSClient* gsm_sms_client() {
203 return gsm_sms_client_.get();
206 ImageBurnerClient* image_burner_client() {
207 return image_burner_client_.get();
210 IntrospectableClient* introspectable_client() {
211 return introspectable_client_.get();
214 ModemMessagingClient* modem_messaging_client() {
215 return modem_messaging_client_.get();
218 NfcManagerClient* nfc_manager_client() {
219 return nfc_manager_client_.get();
222 NfcAdapterClient* nfc_adapter_client() {
223 return nfc_adapter_client_.get();
226 NfcDeviceClient* nfc_device_client() {
227 return nfc_device_client_.get();
230 NfcTagClient* nfc_tag_client() {
231 return nfc_tag_client_.get();
234 NfcRecordClient* nfc_record_client() {
235 return nfc_record_client_.get();
238 PeerDaemonManagerClient* peer_daemon_manager_client() {
239 return peer_daemon_manager_client_.get();
242 PermissionBrokerClient* permission_broker_client() {
243 return permission_broker_client_.get();
246 SystemClockClient* system_clock_client() {
247 return system_clock_client_.get();
250 PowerManagerClient* power_manager_client() {
251 return power_manager_client_.get();
254 SessionManagerClient* session_manager_client() {
255 return session_manager_client_.get();
258 SMSClient* sms_client() {
259 return sms_client_.get();
262 UpdateEngineClient* update_engine_client() {
263 return update_engine_client_.get();
266 private:
267 friend class DBusThreadManagerSetter;
269 // Bitmask that defines which dbus clients are not stubbed out. Bitmap flags
270 // are defined within DBusClientType enum.
271 DBusClientTypeMask unstub_client_mask_;
273 scoped_ptr<BluetoothAdapterClient> bluetooth_adapter_client_;
274 scoped_ptr<BluetoothAgentManagerClient> bluetooth_agent_manager_client_;
275 scoped_ptr<BluetoothDeviceClient> bluetooth_device_client_;
276 scoped_ptr<BluetoothGattCharacteristicClient>
277 bluetooth_gatt_characteristic_client_;
278 scoped_ptr<BluetoothGattDescriptorClient> bluetooth_gatt_descriptor_client_;
279 scoped_ptr<BluetoothGattManagerClient> bluetooth_gatt_manager_client_;
280 scoped_ptr<BluetoothGattServiceClient> bluetooth_gatt_service_client_;
281 scoped_ptr<BluetoothInputClient> bluetooth_input_client_;
282 scoped_ptr<BluetoothMediaClient> bluetooth_media_client_;
283 scoped_ptr<BluetoothMediaTransportClient> bluetooth_media_transport_client_;
284 scoped_ptr<BluetoothProfileManagerClient> bluetooth_profile_manager_client_;
285 scoped_ptr<CrasAudioClient> cras_audio_client_;
286 scoped_ptr<CrosDisksClient> cros_disks_client_;
287 scoped_ptr<CryptohomeClient> cryptohome_client_;
288 scoped_ptr<DebugDaemonClient> debug_daemon_client_;
289 scoped_ptr<EasyUnlockClient> easy_unlock_client_;
290 scoped_ptr<LeadershipDaemonManagerClient> leadership_daemon_manager_client_;
291 scoped_ptr<LorgnetteManagerClient> lorgnette_manager_client_;
292 scoped_ptr<PeerDaemonManagerClient> peer_daemon_manager_client_;
293 scoped_ptr<ShillDeviceClient> shill_device_client_;
294 scoped_ptr<ShillIPConfigClient> shill_ipconfig_client_;
295 scoped_ptr<ShillManagerClient> shill_manager_client_;
296 scoped_ptr<ShillServiceClient> shill_service_client_;
297 scoped_ptr<ShillProfileClient> shill_profile_client_;
298 scoped_ptr<ShillThirdPartyVpnDriverClient>
299 shill_third_party_vpn_driver_client_;
300 scoped_ptr<GsmSMSClient> gsm_sms_client_;
301 scoped_ptr<ImageBurnerClient> image_burner_client_;
302 scoped_ptr<IntrospectableClient> introspectable_client_;
303 scoped_ptr<ModemMessagingClient> modem_messaging_client_;
304 // The declaration order for NFC client objects is important. See
305 // DBusThreadManager::InitializeClients for the dependencies.
306 scoped_ptr<NfcManagerClient> nfc_manager_client_;
307 scoped_ptr<NfcAdapterClient> nfc_adapter_client_;
308 scoped_ptr<NfcDeviceClient> nfc_device_client_;
309 scoped_ptr<NfcTagClient> nfc_tag_client_;
310 scoped_ptr<NfcRecordClient> nfc_record_client_;
311 scoped_ptr<PermissionBrokerClient> permission_broker_client_;
312 scoped_ptr<SystemClockClient> system_clock_client_;
313 scoped_ptr<PowerManagerClient> power_manager_client_;
314 scoped_ptr<SessionManagerClient> session_manager_client_;
315 scoped_ptr<SMSClient> sms_client_;
316 scoped_ptr<UpdateEngineClient> update_engine_client_;
318 DISALLOW_COPY_AND_ASSIGN(DBusClientBundle);
321 } // namespace chromeos
323 #endif // CHROMEOS_DBUS_DBUS_CLIENT_BUNDLE_H_