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

Side by Side 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 unified diff | Download patch
OLDNEW
(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_CLIENTS_COMMON_H_
6 #define CHROMEOS_DBUS_DBUS_CLIENTS_COMMON_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 dbus {
16 class Bus;
17 }
18
19 namespace chromeos {
20
21 class CrasAudioClient;
22 class CryptohomeClient;
23 class PermissionBrokerClient;
24 class PowerManagerClient;
25 class SessionManagerClient;
26 class ShillDeviceClient;
27 class ShillIPConfigClient;
28 class ShillManagerClient;
29 class ShillProfileClient;
30 class ShillServiceClient;
31 class ShillThirdPartyVpnDriverClient;
32 class SystemClockClient;
33 class UpdateEngineClient;
34
35 // D-Bus clients used in multiple processes (e.g. ash, browser, mus).
36 class CHROMEOS_EXPORT DBusClientsCommon {
37 public:
38 // Creates real implementations for |real_client_mask| and fakes for all
39 // others. Fakes are used when running on Linux desktop and in tests.
40 explicit DBusClientsCommon(DBusClientTypeMask real_client_mask);
41 ~DBusClientsCommon();
42
43 // Returns true if |client| has a real (non-fake) client implementation.
44 bool IsUsingReal(DBusClientType client) const;
45
46 // // Returns true if any real DBusClient is used.
47 // bool IsUsingAnyRealClient() const;
48
49 // Initialize proper runtime environment for its dbus clients.
50 void Initialize(dbus::Bus* system_bus);
51
52 private:
53 friend class DBusThreadManager;
54 friend class DBusThreadManagerSetter;
55
56 // Bitmask for clients with real implementations.
57 const DBusClientTypeMask real_client_mask_;
58
59 std::unique_ptr<CrasAudioClient> cras_audio_client_;
60 std::unique_ptr<CryptohomeClient> cryptohome_client_;
61 std::unique_ptr<ShillDeviceClient> shill_device_client_;
62 std::unique_ptr<ShillIPConfigClient> shill_ipconfig_client_;
63 std::unique_ptr<ShillManagerClient> shill_manager_client_;
64 std::unique_ptr<ShillServiceClient> shill_service_client_;
65 std::unique_ptr<ShillProfileClient> shill_profile_client_;
66 std::unique_ptr<ShillThirdPartyVpnDriverClient>
67 shill_third_party_vpn_driver_client_;
68 std::unique_ptr<PermissionBrokerClient> permission_broker_client_;
69 std::unique_ptr<SystemClockClient> system_clock_client_;
70 std::unique_ptr<PowerManagerClient> power_manager_client_;
71 std::unique_ptr<SessionManagerClient> session_manager_client_;
72 std::unique_ptr<UpdateEngineClient> update_engine_client_;
73
74 DISALLOW_COPY_AND_ASSIGN(DBusClientsCommon);
75 };
76
77 } // namespace chromeos
78
79 #endif // CHROMEOS_DBUS_DBUS_CLIENTS_COMMON_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698