Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(142)

Unified Diff: chromeos/dbus/dbus_clients_common.h

Issue 2343993003: chromeos: Refactor D-Bus client creation for ash and browser processes (Closed)
Patch Set: cleanup, extend tests Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chromeos/dbus/dbus_clients_common.h
diff --git a/chromeos/dbus/dbus_clients_common.h b/chromeos/dbus/dbus_clients_common.h
new file mode 100644
index 0000000000000000000000000000000000000000..caa6205b614b05dafe4e9cebc62430d10787e4b1
--- /dev/null
+++ b/chromeos/dbus/dbus_clients_common.h
@@ -0,0 +1,79 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROMEOS_DBUS_DBUS_CLIENTS_COMMON_H_
+#define CHROMEOS_DBUS_DBUS_CLIENTS_COMMON_H_
+
+#include <memory>
+#include <string>
+
+#include "base/macros.h"
+#include "chromeos/chromeos_export.h"
+#include "chromeos/dbus/dbus_client_types.h"
+
+namespace dbus {
+class Bus;
+}
+
+namespace chromeos {
+
+class CrasAudioClient;
+class CryptohomeClient;
+class PermissionBrokerClient;
+class PowerManagerClient;
+class SessionManagerClient;
+class ShillDeviceClient;
+class ShillIPConfigClient;
+class ShillManagerClient;
+class ShillProfileClient;
+class ShillServiceClient;
+class ShillThirdPartyVpnDriverClient;
+class SystemClockClient;
+class UpdateEngineClient;
+
+// D-Bus clients used in multiple processes (e.g. ash, browser, mus).
+class CHROMEOS_EXPORT DBusClientsCommon {
+ public:
+ // Creates real implementations for |real_client_mask| and fakes for all
+ // others. Fakes are used when running on Linux desktop and in tests.
+ explicit DBusClientsCommon(DBusClientTypeMask real_client_mask);
+ ~DBusClientsCommon();
+
+ // Returns true if |client| has a real (non-fake) client implementation.
+ bool IsUsingReal(DBusClientType client) const;
+
+ // // Returns true if any real DBusClient is used.
+ // bool IsUsingAnyRealClient() const;
+
+ // Initialize proper runtime environment for its dbus clients.
+ void Initialize(dbus::Bus* system_bus);
+
+ private:
+ friend class DBusThreadManager;
+ friend class DBusThreadManagerSetter;
+
+ // Bitmask for clients with real implementations.
+ const DBusClientTypeMask real_client_mask_;
+
+ std::unique_ptr<CrasAudioClient> cras_audio_client_;
+ std::unique_ptr<CryptohomeClient> cryptohome_client_;
+ std::unique_ptr<ShillDeviceClient> shill_device_client_;
+ std::unique_ptr<ShillIPConfigClient> shill_ipconfig_client_;
+ std::unique_ptr<ShillManagerClient> shill_manager_client_;
+ std::unique_ptr<ShillServiceClient> shill_service_client_;
+ std::unique_ptr<ShillProfileClient> shill_profile_client_;
+ std::unique_ptr<ShillThirdPartyVpnDriverClient>
+ shill_third_party_vpn_driver_client_;
+ std::unique_ptr<PermissionBrokerClient> permission_broker_client_;
+ std::unique_ptr<SystemClockClient> system_clock_client_;
+ std::unique_ptr<PowerManagerClient> power_manager_client_;
+ std::unique_ptr<SessionManagerClient> session_manager_client_;
+ std::unique_ptr<UpdateEngineClient> update_engine_client_;
+
+ DISALLOW_COPY_AND_ASSIGN(DBusClientsCommon);
+};
+
+} // namespace chromeos
+
+#endif // CHROMEOS_DBUS_DBUS_CLIENTS_COMMON_H_

Powered by Google App Engine
This is Rietveld 408576698