1 // Copyright 2013 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 EXTENSIONS_BROWSER_API_NETWORKING_PRIVATE_NETWORKING_PRIVATE_API_H_
6 #define EXTENSIONS_BROWSER_API_NETWORKING_PRIVATE_NETWORKING_PRIVATE_API_H_
10 #include "base/macros.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "base/values.h"
13 #include "extensions/browser/extension_function.h"
15 namespace extensions
{
17 namespace networking_private
{
19 extern const char kErrorInvalidNetworkGuid
[];
20 extern const char kErrorNetworkUnavailable
[];
21 extern const char kErrorEncryptionError
[];
22 extern const char kErrorNotReady
[];
23 extern const char kErrorNotSupported
[];
25 } // namespace networking_private
27 // Implements the chrome.networkingPrivate.getProperties method.
28 class NetworkingPrivateGetPropertiesFunction
: public AsyncExtensionFunction
{
30 NetworkingPrivateGetPropertiesFunction() {}
31 DECLARE_EXTENSION_FUNCTION("networkingPrivate.getProperties",
32 NETWORKINGPRIVATE_GETPROPERTIES
);
35 ~NetworkingPrivateGetPropertiesFunction() override
;
37 // AsyncExtensionFunction overrides.
38 bool RunAsync() override
;
41 void Success(scoped_ptr
<base::DictionaryValue
> result
);
42 void Failure(const std::string
& error_name
);
44 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateGetPropertiesFunction
);
47 // Implements the chrome.networkingPrivate.getManagedProperties method.
48 class NetworkingPrivateGetManagedPropertiesFunction
49 : public AsyncExtensionFunction
{
51 NetworkingPrivateGetManagedPropertiesFunction() {}
52 DECLARE_EXTENSION_FUNCTION("networkingPrivate.getManagedProperties",
53 NETWORKINGPRIVATE_GETMANAGEDPROPERTIES
);
56 ~NetworkingPrivateGetManagedPropertiesFunction() override
;
58 // AsyncExtensionFunction overrides.
59 bool RunAsync() override
;
62 void Success(scoped_ptr
<base::DictionaryValue
> result
);
63 void Failure(const std::string
& error
);
65 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateGetManagedPropertiesFunction
);
68 // Implements the chrome.networkingPrivate.getState method.
69 class NetworkingPrivateGetStateFunction
: public AsyncExtensionFunction
{
71 NetworkingPrivateGetStateFunction() {}
72 DECLARE_EXTENSION_FUNCTION("networkingPrivate.getState",
73 NETWORKINGPRIVATE_GETSTATE
);
76 ~NetworkingPrivateGetStateFunction() override
;
78 // AsyncExtensionFunction overrides.
79 bool RunAsync() override
;
82 void Success(scoped_ptr
<base::DictionaryValue
> result
);
83 void Failure(const std::string
& error
);
85 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateGetStateFunction
);
88 // Implements the chrome.networkingPrivate.setProperties method.
89 class NetworkingPrivateSetPropertiesFunction
: public AsyncExtensionFunction
{
91 NetworkingPrivateSetPropertiesFunction() {}
92 DECLARE_EXTENSION_FUNCTION("networkingPrivate.setProperties",
93 NETWORKINGPRIVATE_SETPROPERTIES
);
96 ~NetworkingPrivateSetPropertiesFunction() override
;
98 // AsyncExtensionFunction overrides.
99 bool RunAsync() override
;
103 void Failure(const std::string
& error
);
105 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateSetPropertiesFunction
);
108 // Implements the chrome.networkingPrivate.createNetwork method.
109 class NetworkingPrivateCreateNetworkFunction
: public AsyncExtensionFunction
{
111 NetworkingPrivateCreateNetworkFunction() {}
112 DECLARE_EXTENSION_FUNCTION("networkingPrivate.createNetwork",
113 NETWORKINGPRIVATE_CREATENETWORK
);
116 ~NetworkingPrivateCreateNetworkFunction() override
;
118 // AsyncExtensionFunction overrides.
119 bool RunAsync() override
;
122 void Success(const std::string
& guid
);
123 void Failure(const std::string
& error
);
125 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateCreateNetworkFunction
);
128 // Implements the chrome.networkingPrivate.getNetworks method.
129 class NetworkingPrivateGetNetworksFunction
: public AsyncExtensionFunction
{
131 NetworkingPrivateGetNetworksFunction() {}
132 DECLARE_EXTENSION_FUNCTION("networkingPrivate.getNetworks",
133 NETWORKINGPRIVATE_GETNETWORKS
);
136 ~NetworkingPrivateGetNetworksFunction() override
;
138 // AsyncExtensionFunction overrides.
139 bool RunAsync() override
;
142 void Success(scoped_ptr
<base::ListValue
> network_list
);
143 void Failure(const std::string
& error
);
145 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateGetNetworksFunction
);
148 // Implements the chrome.networkingPrivate.getVisibleNetworks method.
149 class NetworkingPrivateGetVisibleNetworksFunction
150 : public AsyncExtensionFunction
{
152 NetworkingPrivateGetVisibleNetworksFunction() {}
153 DECLARE_EXTENSION_FUNCTION("networkingPrivate.getVisibleNetworks",
154 NETWORKINGPRIVATE_GETVISIBLENETWORKS
);
157 ~NetworkingPrivateGetVisibleNetworksFunction() override
;
159 // AsyncExtensionFunction overrides.
160 bool RunAsync() override
;
163 void Success(scoped_ptr
<base::ListValue
> network_list
);
164 void Failure(const std::string
& error
);
166 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateGetVisibleNetworksFunction
);
169 // Implements the chrome.networkingPrivate.getEnabledNetworkTypes method.
170 class NetworkingPrivateGetEnabledNetworkTypesFunction
171 : public SyncExtensionFunction
{
173 NetworkingPrivateGetEnabledNetworkTypesFunction() {}
174 DECLARE_EXTENSION_FUNCTION("networkingPrivate.getEnabledNetworkTypes",
175 NETWORKINGPRIVATE_GETENABLEDNETWORKTYPES
);
178 ~NetworkingPrivateGetEnabledNetworkTypesFunction() override
;
180 // SyncExtensionFunction overrides.
181 bool RunSync() override
;
184 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateGetEnabledNetworkTypesFunction
);
187 // Implements the chrome.networkingPrivate.enableNetworkType method.
188 class NetworkingPrivateEnableNetworkTypeFunction
189 : public SyncExtensionFunction
{
191 NetworkingPrivateEnableNetworkTypeFunction() {}
192 DECLARE_EXTENSION_FUNCTION("networkingPrivate.enableNetworkType",
193 NETWORKINGPRIVATE_ENABLENETWORKTYPE
);
196 ~NetworkingPrivateEnableNetworkTypeFunction() override
;
198 // SyncExtensionFunction overrides.
199 bool RunSync() override
;
202 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateEnableNetworkTypeFunction
);
205 // Implements the chrome.networkingPrivate.disableNetworkType method.
206 class NetworkingPrivateDisableNetworkTypeFunction
207 : public SyncExtensionFunction
{
209 NetworkingPrivateDisableNetworkTypeFunction() {}
210 DECLARE_EXTENSION_FUNCTION("networkingPrivate.disableNetworkType",
211 NETWORKINGPRIVATE_DISABLENETWORKTYPE
);
214 ~NetworkingPrivateDisableNetworkTypeFunction() override
;
216 // SyncExtensionFunction overrides.
217 bool RunSync() override
;
220 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateDisableNetworkTypeFunction
);
223 // Implements the chrome.networkingPrivate.requestNetworkScan method.
224 class NetworkingPrivateRequestNetworkScanFunction
225 : public SyncExtensionFunction
{
227 NetworkingPrivateRequestNetworkScanFunction() {}
228 DECLARE_EXTENSION_FUNCTION("networkingPrivate.requestNetworkScan",
229 NETWORKINGPRIVATE_REQUESTNETWORKSCAN
);
232 ~NetworkingPrivateRequestNetworkScanFunction() override
;
234 // SyncExtensionFunction overrides.
235 bool RunSync() override
;
238 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateRequestNetworkScanFunction
);
241 // Implements the chrome.networkingPrivate.startConnect method.
242 class NetworkingPrivateStartConnectFunction
: public AsyncExtensionFunction
{
244 NetworkingPrivateStartConnectFunction() {}
245 DECLARE_EXTENSION_FUNCTION("networkingPrivate.startConnect",
246 NETWORKINGPRIVATE_STARTCONNECT
);
249 ~NetworkingPrivateStartConnectFunction() override
;
251 // AsyncExtensionFunction overrides.
252 bool RunAsync() override
;
256 void Failure(const std::string
& error
);
258 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateStartConnectFunction
);
261 // Implements the chrome.networkingPrivate.startDisconnect method.
262 class NetworkingPrivateStartDisconnectFunction
: public AsyncExtensionFunction
{
264 NetworkingPrivateStartDisconnectFunction() {}
265 DECLARE_EXTENSION_FUNCTION("networkingPrivate.startDisconnect",
266 NETWORKINGPRIVATE_STARTDISCONNECT
);
269 ~NetworkingPrivateStartDisconnectFunction() override
;
271 // AsyncExtensionFunction overrides.
272 bool RunAsync() override
;
276 void Failure(const std::string
& error
);
278 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateStartDisconnectFunction
);
281 // Implements the chrome.networkingPrivate.verifyDestination method.
282 class NetworkingPrivateVerifyDestinationFunction
283 : public AsyncExtensionFunction
{
285 NetworkingPrivateVerifyDestinationFunction() {}
286 DECLARE_EXTENSION_FUNCTION("networkingPrivate.verifyDestination",
287 NETWORKINGPRIVATE_VERIFYDESTINATION
);
290 ~NetworkingPrivateVerifyDestinationFunction() override
;
292 // AsyncExtensionFunction overrides.
293 bool RunAsync() override
;
295 void Success(bool result
);
296 void Failure(const std::string
& error
);
299 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateVerifyDestinationFunction
);
302 // Implements the chrome.networkingPrivate.verifyAndEncryptCredentials method.
303 class NetworkingPrivateVerifyAndEncryptCredentialsFunction
304 : public AsyncExtensionFunction
{
306 NetworkingPrivateVerifyAndEncryptCredentialsFunction() {}
307 DECLARE_EXTENSION_FUNCTION("networkingPrivate.verifyAndEncryptCredentials",
308 NETWORKINGPRIVATE_VERIFYANDENCRYPTCREDENTIALS
);
311 ~NetworkingPrivateVerifyAndEncryptCredentialsFunction() override
;
313 // AsyncExtensionFunction overrides.
314 bool RunAsync() override
;
316 void Success(const std::string
& result
);
317 void Failure(const std::string
& error
);
320 DISALLOW_COPY_AND_ASSIGN(
321 NetworkingPrivateVerifyAndEncryptCredentialsFunction
);
324 // Implements the chrome.networkingPrivate.verifyAndEncryptData method.
325 class NetworkingPrivateVerifyAndEncryptDataFunction
326 : public AsyncExtensionFunction
{
328 NetworkingPrivateVerifyAndEncryptDataFunction() {}
329 DECLARE_EXTENSION_FUNCTION("networkingPrivate.verifyAndEncryptData",
330 NETWORKINGPRIVATE_VERIFYANDENCRYPTDATA
);
333 ~NetworkingPrivateVerifyAndEncryptDataFunction() override
;
335 // AsyncExtensionFunction overrides.
336 bool RunAsync() override
;
338 void Success(const std::string
& result
);
339 void Failure(const std::string
& error
);
342 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateVerifyAndEncryptDataFunction
);
345 // Implements the chrome.networkingPrivate.setWifiTDLSEnabledState method.
346 class NetworkingPrivateSetWifiTDLSEnabledStateFunction
347 : public AsyncExtensionFunction
{
349 NetworkingPrivateSetWifiTDLSEnabledStateFunction() {}
350 DECLARE_EXTENSION_FUNCTION("networkingPrivate.setWifiTDLSEnabledState",
351 NETWORKINGPRIVATE_SETWIFITDLSENABLEDSTATE
);
354 ~NetworkingPrivateSetWifiTDLSEnabledStateFunction() override
;
356 // AsyncExtensionFunction overrides.
357 bool RunAsync() override
;
359 void Success(const std::string
& result
);
360 void Failure(const std::string
& error
);
363 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateSetWifiTDLSEnabledStateFunction
);
366 // Implements the chrome.networkingPrivate.getWifiTDLSStatus method.
367 class NetworkingPrivateGetWifiTDLSStatusFunction
368 : public AsyncExtensionFunction
{
370 NetworkingPrivateGetWifiTDLSStatusFunction() {}
371 DECLARE_EXTENSION_FUNCTION("networkingPrivate.getWifiTDLSStatus",
372 NETWORKINGPRIVATE_GETWIFITDLSSTATUS
);
375 ~NetworkingPrivateGetWifiTDLSStatusFunction() override
;
377 // AsyncExtensionFunction overrides.
378 bool RunAsync() override
;
380 void Success(const std::string
& result
);
381 void Failure(const std::string
& error
);
384 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateGetWifiTDLSStatusFunction
);
387 class NetworkingPrivateGetCaptivePortalStatusFunction
388 : public AsyncExtensionFunction
{
390 NetworkingPrivateGetCaptivePortalStatusFunction() {}
391 DECLARE_EXTENSION_FUNCTION("networkingPrivate.getCaptivePortalStatus",
392 NETWORKINGPRIVATE_GETCAPTIVEPORTALSTATUS
);
394 // AsyncExtensionFunction overrides.
395 bool RunAsync() override
;
398 ~NetworkingPrivateGetCaptivePortalStatusFunction() override
;
401 void Success(const std::string
& result
);
402 void Failure(const std::string
& error
);
404 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateGetCaptivePortalStatusFunction
);
407 } // namespace extensions
409 #endif // EXTENSIONS_BROWSER_API_NETWORKING_PRIVATE_NETWORKING_PRIVATE_API_H_