Add an extension override bubble and warning box for proxy extensions.
[chromium-blink-merge.git] / chromeos / dbus / shill_service_client.h
blob5e2e6de1e171b07142a86a8d0297e6b270b5b51c
1 // Copyright (c) 2012 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_SHILL_SERVICE_CLIENT_H_
6 #define CHROMEOS_DBUS_SHILL_SERVICE_CLIENT_H_
8 #include <string>
10 #include "base/basictypes.h"
11 #include "base/callback.h"
12 #include "chromeos/chromeos_export.h"
13 #include "chromeos/dbus/dbus_client.h"
14 #include "chromeos/dbus/shill_client_helper.h"
16 namespace base {
18 class Value;
19 class DictionaryValue;
21 } // namespace base
23 namespace dbus {
25 class ObjectPath;
27 } // namespace dbus
29 namespace chromeos {
31 // ShillServiceClient is used to communicate with the Shill Service
32 // service.
33 // All methods should be called from the origin thread which initializes the
34 // DBusThreadManager instance.
35 class CHROMEOS_EXPORT ShillServiceClient : public DBusClient {
36 public:
37 typedef ShillClientHelper::PropertyChangedHandler PropertyChangedHandler;
38 typedef ShillClientHelper::DictionaryValueCallback DictionaryValueCallback;
39 typedef ShillClientHelper::ListValueCallback ListValueCallback;
40 typedef ShillClientHelper::ErrorCallback ErrorCallback;
42 // Interface for setting up services for testing. Accessed through
43 // GetTestInterface(), only implemented in the stub implementation.
44 class TestInterface {
45 public:
46 // Adds a Service to the Manager and Service stubs.
47 virtual void AddService(const std::string& service_path,
48 const std::string& name,
49 const std::string& type,
50 const std::string& state,
51 bool add_to_visible_list,
52 bool add_to_watch_list) = 0;
53 virtual void AddServiceWithIPConfig(const std::string& service_path,
54 const std::string& guid,
55 const std::string& name,
56 const std::string& type,
57 const std::string& state,
58 const std::string& ipconfig_path,
59 bool add_to_visible_list,
60 bool add_to_watch_list) = 0;
62 // Removes a Service to the Manager and Service stubs.
63 virtual void RemoveService(const std::string& service_path) = 0;
65 // Returns false if a Service matching |service_path| does not exist.
66 virtual bool SetServiceProperty(const std::string& service_path,
67 const std::string& property,
68 const base::Value& value) = 0;
70 // Returns properties for |service_path| or NULL if no Service matches.
71 virtual const base::DictionaryValue* GetServiceProperties(
72 const std::string& service_path) const = 0;
74 // Clears all Services from the Manager and Service stubs.
75 virtual void ClearServices() = 0;
77 virtual void SetConnectBehavior(const std::string& service_path,
78 const base::Closure& behavior) = 0;
80 protected:
81 virtual ~TestInterface() {}
83 virtual ~ShillServiceClient();
85 // Factory function, creates a new instance which is owned by the caller.
86 // For normal usage, access the singleton via DBusThreadManager::Get().
87 static ShillServiceClient* Create();
89 // Adds a property changed |observer| to the service at |service_path|.
90 virtual void AddPropertyChangedObserver(
91 const dbus::ObjectPath& service_path,
92 ShillPropertyChangedObserver* observer) = 0;
94 // Removes a property changed |observer| to the service at |service_path|.
95 virtual void RemovePropertyChangedObserver(
96 const dbus::ObjectPath& service_path,
97 ShillPropertyChangedObserver* observer) = 0;
99 // Calls GetProperties method.
100 // |callback| is called after the method call succeeds.
101 virtual void GetProperties(const dbus::ObjectPath& service_path,
102 const DictionaryValueCallback& callback) = 0;
104 // Calls SetProperty method.
105 // |callback| is called after the method call succeeds.
106 virtual void SetProperty(const dbus::ObjectPath& service_path,
107 const std::string& name,
108 const base::Value& value,
109 const base::Closure& callback,
110 const ErrorCallback& error_callback) = 0;
112 // Calls SetProperties method.
113 // |callback| is called after the method call succeeds.
114 virtual void SetProperties(const dbus::ObjectPath& service_path,
115 const base::DictionaryValue& properties,
116 const base::Closure& callback,
117 const ErrorCallback& error_callback) = 0;
119 // Calls ClearProperty method.
120 // |callback| is called after the method call succeeds.
121 virtual void ClearProperty(const dbus::ObjectPath& service_path,
122 const std::string& name,
123 const base::Closure& callback,
124 const ErrorCallback& error_callback) = 0;
126 // Calls ClearProperties method.
127 // |callback| is called after the method call succeeds.
128 virtual void ClearProperties(const dbus::ObjectPath& service_path,
129 const std::vector<std::string>& names,
130 const ListValueCallback& callback,
131 const ErrorCallback& error_callback) = 0;
133 // Calls Connect method.
134 // |callback| is called after the method call succeeds.
135 virtual void Connect(const dbus::ObjectPath& service_path,
136 const base::Closure& callback,
137 const ErrorCallback& error_callback) = 0;
139 // Calls Disconnect method.
140 // |callback| is called after the method call succeeds.
141 virtual void Disconnect(const dbus::ObjectPath& service_path,
142 const base::Closure& callback,
143 const ErrorCallback& error_callback) = 0;
145 // Calls Remove method.
146 // |callback| is called after the method call succeeds.
147 virtual void Remove(const dbus::ObjectPath& service_path,
148 const base::Closure& callback,
149 const ErrorCallback& error_callback) = 0;
151 // Calls ActivateCellularModem method.
152 // |callback| is called after the method call succeeds.
153 virtual void ActivateCellularModem(
154 const dbus::ObjectPath& service_path,
155 const std::string& carrier,
156 const base::Closure& callback,
157 const ErrorCallback& error_callback) = 0;
159 // Calls the CompleteCellularActivation method.
160 // |callback| is called after the method call succeeds.
161 virtual void CompleteCellularActivation(
162 const dbus::ObjectPath& service_path,
163 const base::Closure& callback,
164 const ErrorCallback& error_callback) = 0;
166 // Calls the GetLoadableProfileEntries method.
167 // |callback| is called after the method call succeeds.
168 virtual void GetLoadableProfileEntries(
169 const dbus::ObjectPath& service_path,
170 const DictionaryValueCallback& callback) = 0;
172 // Returns an interface for testing (stub only), or returns NULL.
173 virtual TestInterface* GetTestInterface() = 0;
175 protected:
176 friend class ShillServiceClientTest;
178 // Create() should be used instead.
179 ShillServiceClient();
181 private:
182 DISALLOW_COPY_AND_ASSIGN(ShillServiceClient);
185 } // namespace chromeos
187 #endif // CHROMEOS_DBUS_SHILL_SERVICE_CLIENT_H_