[ServiceWorker] Implement WebServiceWorkerContextClient::openWindow().
[chromium-blink-merge.git] / chromeos / dbus / shill_device_client.h
blobd7128ebbe0d91e0b4dd15f389c7abe2c52ace825
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_DEVICE_CLIENT_H_
6 #define CHROMEOS_DBUS_SHILL_DEVICE_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 net {
31 class IPEndPoint;
33 } // namespace net
35 namespace chromeos {
37 class ShillPropertyChangedObserver;
39 // ShillDeviceClient is used to communicate with the Shill Device service.
40 // All methods should be called from the origin thread which initializes the
41 // DBusThreadManager instance.
42 class CHROMEOS_EXPORT ShillDeviceClient : public DBusClient {
43 public:
44 typedef ShillClientHelper::PropertyChangedHandler PropertyChangedHandler;
45 typedef ShillClientHelper::DictionaryValueCallback DictionaryValueCallback;
46 typedef ShillClientHelper::StringCallback StringCallback;
47 typedef ShillClientHelper::ErrorCallback ErrorCallback;
49 // Interface for setting up devices for testing.
50 // Accessed through GetTestInterface(), only implemented in the Stub Impl.
51 class TestInterface {
52 public:
53 virtual void AddDevice(const std::string& device_path,
54 const std::string& type,
55 const std::string& name) = 0;
56 virtual void RemoveDevice(const std::string& device_path) = 0;
57 virtual void ClearDevices() = 0;
58 virtual void SetDeviceProperty(const std::string& device_path,
59 const std::string& name,
60 const base::Value& value) = 0;
61 virtual std::string GetDevicePathForType(const std::string& type) = 0;
63 protected:
64 virtual ~TestInterface() {}
67 ~ShillDeviceClient() override;
69 // Factory function, creates a new instance which is owned by the caller.
70 // For normal usage, access the singleton via DBusThreadManager::Get().
71 static ShillDeviceClient* Create();
73 // Adds a property changed |observer| for the device at |device_path|.
74 virtual void AddPropertyChangedObserver(
75 const dbus::ObjectPath& device_path,
76 ShillPropertyChangedObserver* observer) = 0;
78 // Removes a property changed |observer| for the device at |device_path|.
79 virtual void RemovePropertyChangedObserver(
80 const dbus::ObjectPath& device_path,
81 ShillPropertyChangedObserver* observer) = 0;
83 // Calls GetProperties method.
84 // |callback| is called after the method call finishes.
85 virtual void GetProperties(const dbus::ObjectPath& device_path,
86 const DictionaryValueCallback& callback) = 0;
88 // Calls ProposeScan method.
89 // |callback| is called after the method call finishes.
90 virtual void ProposeScan(const dbus::ObjectPath& device_path,
91 const VoidDBusMethodCallback& callback) = 0;
93 // Calls SetProperty method.
94 // |callback| is called after the method call finishes.
95 virtual void SetProperty(const dbus::ObjectPath& device_path,
96 const std::string& name,
97 const base::Value& value,
98 const base::Closure& callback,
99 const ErrorCallback& error_callback) = 0;
101 // Calls ClearProperty method.
102 // |callback| is called after the method call finishes.
103 virtual void ClearProperty(const dbus::ObjectPath& device_path,
104 const std::string& name,
105 const VoidDBusMethodCallback& callback) = 0;
107 // Calls AddIPConfig method.
108 // |callback| is called after the method call finishes.
109 virtual void AddIPConfig(const dbus::ObjectPath& device_path,
110 const std::string& method,
111 const ObjectPathDBusMethodCallback& callback) = 0;
113 // Calls the RequirePin method.
114 // |callback| is called after the method call finishes.
115 virtual void RequirePin(const dbus::ObjectPath& device_path,
116 const std::string& pin,
117 bool require,
118 const base::Closure& callback,
119 const ErrorCallback& error_callback) = 0;
121 // Calls the EnterPin method.
122 // |callback| is called after the method call finishes.
123 virtual void EnterPin(const dbus::ObjectPath& device_path,
124 const std::string& pin,
125 const base::Closure& callback,
126 const ErrorCallback& error_callback) = 0;
128 // Calls the UnblockPin method.
129 // |callback| is called after the method call finishes.
130 virtual void UnblockPin(const dbus::ObjectPath& device_path,
131 const std::string& puk,
132 const std::string& pin,
133 const base::Closure& callback,
134 const ErrorCallback& error_callback) = 0;
136 // Calls the ChangePin method.
137 // |callback| is called after the method call finishes.
138 virtual void ChangePin(const dbus::ObjectPath& device_path,
139 const std::string& old_pin,
140 const std::string& new_pin,
141 const base::Closure& callback,
142 const ErrorCallback& error_callback) = 0;
144 // Calls the Register method.
145 // |callback| is called after the method call finishes.
146 virtual void Register(const dbus::ObjectPath& device_path,
147 const std::string& network_id,
148 const base::Closure& callback,
149 const ErrorCallback& error_callback) = 0;
151 // Calls the SetCarrier method.
152 // |callback| is called after the method call finishes.
153 virtual void SetCarrier(const dbus::ObjectPath& device_path,
154 const std::string& carrier,
155 const base::Closure& callback,
156 const ErrorCallback& error_callback) = 0;
158 // Calls the Reset method.
159 // |callback| is called after the method call finishes.
160 virtual void Reset(const dbus::ObjectPath& device_path,
161 const base::Closure& callback,
162 const ErrorCallback& error_callback) = 0;
164 // Calls the PerformTDLSOperation method.
165 // |callback| is called after the method call finishes.
166 virtual void PerformTDLSOperation(const dbus::ObjectPath& device_path,
167 const std::string& operation,
168 const std::string& peer,
169 const StringCallback& callback,
170 const ErrorCallback& error_callback) = 0;
172 // Adds |ip_endpoint| to the list of tcp connections that the device should
173 // monitor to wake the system from suspend.
174 virtual void AddWakeOnPacketConnection(
175 const dbus::ObjectPath& device_path,
176 const net::IPEndPoint& ip_endpoint,
177 const base::Closure& callback,
178 const ErrorCallback& error_callback) = 0;
180 // Removes |ip_endpoint| from the list of tcp connections that the device
181 // should monitor to wake the system from suspend.
182 virtual void RemoveWakeOnPacketConnection(
183 const dbus::ObjectPath& device_path,
184 const net::IPEndPoint& ip_endpoint,
185 const base::Closure& callback,
186 const ErrorCallback& error_callback) = 0;
188 // Clears the list of tcp connections that the device should monitor to wake
189 // the system from suspend.
190 virtual void RemoveAllWakeOnPacketConnections(
191 const dbus::ObjectPath& device_path,
192 const base::Closure& callback,
193 const ErrorCallback& error_callback) = 0;
195 // Returns an interface for testing (stub only), or returns NULL.
196 virtual TestInterface* GetTestInterface() = 0;
198 protected:
199 friend class ShillDeviceClientTest;
201 // Create() should be used instead.
202 ShillDeviceClient();
204 private:
205 DISALLOW_COPY_AND_ASSIGN(ShillDeviceClient);
208 } // namespace chromeos
210 #endif // CHROMEOS_DBUS_SHILL_DEVICE_CLIENT_H_