| OLD | NEW |
| (Empty) |
| 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. | |
| 4 | |
| 5 #ifndef CHROMEOS_DBUS_DBUS_CLIENT_BUNDLE_H_ | |
| 6 #define CHROMEOS_DBUS_DBUS_CLIENT_BUNDLE_H_ | |
| 7 | |
| 8 #include <memory> | |
| 9 #include <string> | |
| 10 | |
| 11 #include "base/macros.h" | |
| 12 #include "chromeos/chromeos_export.h" | |
| 13 #include "chromeos/dbus/dbus_client_types.h" | |
| 14 | |
| 15 namespace chromeos { | |
| 16 | |
| 17 class ArcObbMounterClient; | |
| 18 class CrasAudioClient; | |
| 19 class CrosDisksClient; | |
| 20 class CryptohomeClient; | |
| 21 class DebugDaemonClient; | |
| 22 class EasyUnlockClient; | |
| 23 class GsmSMSClient; | |
| 24 class ImageBurnerClient; | |
| 25 class LorgnetteManagerClient; | |
| 26 class ModemMessagingClient; | |
| 27 class PermissionBrokerClient; | |
| 28 class PowerManagerClient; | |
| 29 class SMSClient; | |
| 30 class SessionManagerClient; | |
| 31 class ShillDeviceClient; | |
| 32 class ShillIPConfigClient; | |
| 33 class ShillManagerClient; | |
| 34 class ShillProfileClient; | |
| 35 class ShillServiceClient; | |
| 36 class ShillThirdPartyVpnDriverClient; | |
| 37 class SystemClockClient; | |
| 38 class UpdateEngineClient; | |
| 39 | |
| 40 // The bundle of all D-Bus clients used in DBusThreadManager. The bundle | |
| 41 // is used to delete them at once in the right order before shutting down the | |
| 42 // system bus. See also the comment in the destructor of DBusThreadManager. | |
| 43 class CHROMEOS_EXPORT DBusClientBundle { | |
| 44 public: | |
| 45 // Creates real implementations for |real_client_mask| and fakes for all | |
| 46 // others. Fakes are used when running on Linux desktop and in tests. | |
| 47 explicit DBusClientBundle(DBusClientTypeMask real_client_mask); | |
| 48 ~DBusClientBundle(); | |
| 49 | |
| 50 // Returns true if |client| has a real (non-fake) client implementation. | |
| 51 bool IsUsingReal(DBusClientType client) const; | |
| 52 | |
| 53 // Returns true if any real DBusClient is used. | |
| 54 bool IsUsingAnyRealClient() const; | |
| 55 | |
| 56 // Initialize proper runtime environment for its dbus clients. | |
| 57 void SetupDefaultEnvironment(); | |
| 58 | |
| 59 ArcObbMounterClient* arc_obb_mounter_client() { | |
| 60 return arc_obb_mounter_client_.get(); | |
| 61 } | |
| 62 | |
| 63 CrasAudioClient* cras_audio_client() { | |
| 64 return cras_audio_client_.get(); | |
| 65 } | |
| 66 | |
| 67 CrosDisksClient* cros_disks_client() { | |
| 68 return cros_disks_client_.get(); | |
| 69 } | |
| 70 | |
| 71 CryptohomeClient* cryptohome_client() { | |
| 72 return cryptohome_client_.get(); | |
| 73 } | |
| 74 | |
| 75 DebugDaemonClient* debug_daemon_client() { | |
| 76 return debug_daemon_client_.get(); | |
| 77 } | |
| 78 | |
| 79 EasyUnlockClient* easy_unlock_client() { | |
| 80 return easy_unlock_client_.get(); | |
| 81 } | |
| 82 | |
| 83 LorgnetteManagerClient* lorgnette_manager_client() { | |
| 84 return lorgnette_manager_client_.get(); | |
| 85 } | |
| 86 | |
| 87 ShillDeviceClient* shill_device_client() { | |
| 88 return shill_device_client_.get(); | |
| 89 } | |
| 90 | |
| 91 ShillIPConfigClient* shill_ipconfig_client() { | |
| 92 return shill_ipconfig_client_.get(); | |
| 93 } | |
| 94 | |
| 95 ShillManagerClient* shill_manager_client() { | |
| 96 return shill_manager_client_.get(); | |
| 97 } | |
| 98 | |
| 99 ShillServiceClient* shill_service_client() { | |
| 100 return shill_service_client_.get(); | |
| 101 } | |
| 102 | |
| 103 ShillProfileClient* shill_profile_client() { | |
| 104 return shill_profile_client_.get(); | |
| 105 } | |
| 106 | |
| 107 ShillThirdPartyVpnDriverClient* shill_third_party_vpn_driver_client() { | |
| 108 return shill_third_party_vpn_driver_client_.get(); | |
| 109 } | |
| 110 | |
| 111 GsmSMSClient* gsm_sms_client() { | |
| 112 return gsm_sms_client_.get(); | |
| 113 } | |
| 114 | |
| 115 ImageBurnerClient* image_burner_client() { | |
| 116 return image_burner_client_.get(); | |
| 117 } | |
| 118 | |
| 119 ModemMessagingClient* modem_messaging_client() { | |
| 120 return modem_messaging_client_.get(); | |
| 121 } | |
| 122 | |
| 123 PermissionBrokerClient* permission_broker_client() { | |
| 124 return permission_broker_client_.get(); | |
| 125 } | |
| 126 | |
| 127 SystemClockClient* system_clock_client() { | |
| 128 return system_clock_client_.get(); | |
| 129 } | |
| 130 | |
| 131 PowerManagerClient* power_manager_client() { | |
| 132 return power_manager_client_.get(); | |
| 133 } | |
| 134 | |
| 135 SessionManagerClient* session_manager_client() { | |
| 136 return session_manager_client_.get(); | |
| 137 } | |
| 138 | |
| 139 SMSClient* sms_client() { | |
| 140 return sms_client_.get(); | |
| 141 } | |
| 142 | |
| 143 UpdateEngineClient* update_engine_client() { | |
| 144 return update_engine_client_.get(); | |
| 145 } | |
| 146 | |
| 147 private: | |
| 148 friend class DBusThreadManagerSetter; | |
| 149 | |
| 150 // Bitmask for clients with real implementations. | |
| 151 const DBusClientTypeMask real_client_mask_; | |
| 152 | |
| 153 std::unique_ptr<ArcObbMounterClient> arc_obb_mounter_client_; | |
| 154 std::unique_ptr<CrasAudioClient> cras_audio_client_; | |
| 155 std::unique_ptr<CrosDisksClient> cros_disks_client_; | |
| 156 std::unique_ptr<CryptohomeClient> cryptohome_client_; | |
| 157 std::unique_ptr<DebugDaemonClient> debug_daemon_client_; | |
| 158 std::unique_ptr<EasyUnlockClient> easy_unlock_client_; | |
| 159 std::unique_ptr<LorgnetteManagerClient> lorgnette_manager_client_; | |
| 160 std::unique_ptr<ShillDeviceClient> shill_device_client_; | |
| 161 std::unique_ptr<ShillIPConfigClient> shill_ipconfig_client_; | |
| 162 std::unique_ptr<ShillManagerClient> shill_manager_client_; | |
| 163 std::unique_ptr<ShillServiceClient> shill_service_client_; | |
| 164 std::unique_ptr<ShillProfileClient> shill_profile_client_; | |
| 165 std::unique_ptr<ShillThirdPartyVpnDriverClient> | |
| 166 shill_third_party_vpn_driver_client_; | |
| 167 std::unique_ptr<GsmSMSClient> gsm_sms_client_; | |
| 168 std::unique_ptr<ImageBurnerClient> image_burner_client_; | |
| 169 std::unique_ptr<ModemMessagingClient> modem_messaging_client_; | |
| 170 std::unique_ptr<PermissionBrokerClient> permission_broker_client_; | |
| 171 std::unique_ptr<SystemClockClient> system_clock_client_; | |
| 172 std::unique_ptr<PowerManagerClient> power_manager_client_; | |
| 173 std::unique_ptr<SessionManagerClient> session_manager_client_; | |
| 174 std::unique_ptr<SMSClient> sms_client_; | |
| 175 std::unique_ptr<UpdateEngineClient> update_engine_client_; | |
| 176 | |
| 177 DISALLOW_COPY_AND_ASSIGN(DBusClientBundle); | |
| 178 }; | |
| 179 | |
| 180 } // namespace chromeos | |
| 181 | |
| 182 #endif // CHROMEOS_DBUS_DBUS_CLIENT_BUNDLE_H_ | |
| OLD | NEW |