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.createNetwork method.
129 class NetworkingPrivateForgetNetworkFunction
: public AsyncExtensionFunction
{
131 NetworkingPrivateForgetNetworkFunction() {}
132 DECLARE_EXTENSION_FUNCTION("networkingPrivate.forgetNetwork",
133 NETWORKINGPRIVATE_FORGETNETWORK
);
136 ~NetworkingPrivateForgetNetworkFunction() override
;
138 // AsyncExtensionFunction overrides.
139 bool RunAsync() override
;
143 void Failure(const std::string
& error
);
145 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateForgetNetworkFunction
);
148 // Implements the chrome.networkingPrivate.getNetworks method.
149 class NetworkingPrivateGetNetworksFunction
: public AsyncExtensionFunction
{
151 NetworkingPrivateGetNetworksFunction() {}
152 DECLARE_EXTENSION_FUNCTION("networkingPrivate.getNetworks",
153 NETWORKINGPRIVATE_GETNETWORKS
);
156 ~NetworkingPrivateGetNetworksFunction() override
;
158 // AsyncExtensionFunction overrides.
159 bool RunAsync() override
;
162 void Success(scoped_ptr
<base::ListValue
> network_list
);
163 void Failure(const std::string
& error
);
165 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateGetNetworksFunction
);
168 // Implements the chrome.networkingPrivate.getVisibleNetworks method.
169 class NetworkingPrivateGetVisibleNetworksFunction
170 : public AsyncExtensionFunction
{
172 NetworkingPrivateGetVisibleNetworksFunction() {}
173 DECLARE_EXTENSION_FUNCTION("networkingPrivate.getVisibleNetworks",
174 NETWORKINGPRIVATE_GETVISIBLENETWORKS
);
177 ~NetworkingPrivateGetVisibleNetworksFunction() override
;
179 // AsyncExtensionFunction overrides.
180 bool RunAsync() override
;
183 void Success(scoped_ptr
<base::ListValue
> network_list
);
184 void Failure(const std::string
& error
);
186 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateGetVisibleNetworksFunction
);
189 // Implements the chrome.networkingPrivate.getEnabledNetworkTypes method.
190 class NetworkingPrivateGetEnabledNetworkTypesFunction
191 : public SyncExtensionFunction
{
193 NetworkingPrivateGetEnabledNetworkTypesFunction() {}
194 DECLARE_EXTENSION_FUNCTION("networkingPrivate.getEnabledNetworkTypes",
195 NETWORKINGPRIVATE_GETENABLEDNETWORKTYPES
);
198 ~NetworkingPrivateGetEnabledNetworkTypesFunction() override
;
200 // SyncExtensionFunction overrides.
201 bool RunSync() override
;
204 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateGetEnabledNetworkTypesFunction
);
207 // Implements the chrome.networkingPrivate.getDeviceStates method.
208 class NetworkingPrivateGetDeviceStatesFunction
: public SyncExtensionFunction
{
210 NetworkingPrivateGetDeviceStatesFunction() {}
211 DECLARE_EXTENSION_FUNCTION("networkingPrivate.getDeviceStates",
212 NETWORKINGPRIVATE_GETDEVICESTATES
);
215 ~NetworkingPrivateGetDeviceStatesFunction() override
;
217 // SyncExtensionFunction overrides.
218 bool RunSync() override
;
221 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateGetDeviceStatesFunction
);
224 // Implements the chrome.networkingPrivate.enableNetworkType method.
225 class NetworkingPrivateEnableNetworkTypeFunction
226 : public SyncExtensionFunction
{
228 NetworkingPrivateEnableNetworkTypeFunction() {}
229 DECLARE_EXTENSION_FUNCTION("networkingPrivate.enableNetworkType",
230 NETWORKINGPRIVATE_ENABLENETWORKTYPE
);
233 ~NetworkingPrivateEnableNetworkTypeFunction() override
;
235 // SyncExtensionFunction overrides.
236 bool RunSync() override
;
239 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateEnableNetworkTypeFunction
);
242 // Implements the chrome.networkingPrivate.disableNetworkType method.
243 class NetworkingPrivateDisableNetworkTypeFunction
244 : public SyncExtensionFunction
{
246 NetworkingPrivateDisableNetworkTypeFunction() {}
247 DECLARE_EXTENSION_FUNCTION("networkingPrivate.disableNetworkType",
248 NETWORKINGPRIVATE_DISABLENETWORKTYPE
);
251 ~NetworkingPrivateDisableNetworkTypeFunction() override
;
253 // SyncExtensionFunction overrides.
254 bool RunSync() override
;
257 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateDisableNetworkTypeFunction
);
260 // Implements the chrome.networkingPrivate.requestNetworkScan method.
261 class NetworkingPrivateRequestNetworkScanFunction
262 : public SyncExtensionFunction
{
264 NetworkingPrivateRequestNetworkScanFunction() {}
265 DECLARE_EXTENSION_FUNCTION("networkingPrivate.requestNetworkScan",
266 NETWORKINGPRIVATE_REQUESTNETWORKSCAN
);
269 ~NetworkingPrivateRequestNetworkScanFunction() override
;
271 // SyncExtensionFunction overrides.
272 bool RunSync() override
;
275 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateRequestNetworkScanFunction
);
278 // Implements the chrome.networkingPrivate.startConnect method.
279 class NetworkingPrivateStartConnectFunction
: public AsyncExtensionFunction
{
281 NetworkingPrivateStartConnectFunction() {}
282 DECLARE_EXTENSION_FUNCTION("networkingPrivate.startConnect",
283 NETWORKINGPRIVATE_STARTCONNECT
);
286 ~NetworkingPrivateStartConnectFunction() override
;
288 // AsyncExtensionFunction overrides.
289 bool RunAsync() override
;
293 void Failure(const std::string
& error
);
295 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateStartConnectFunction
);
298 // Implements the chrome.networkingPrivate.startDisconnect method.
299 class NetworkingPrivateStartDisconnectFunction
: public AsyncExtensionFunction
{
301 NetworkingPrivateStartDisconnectFunction() {}
302 DECLARE_EXTENSION_FUNCTION("networkingPrivate.startDisconnect",
303 NETWORKINGPRIVATE_STARTDISCONNECT
);
306 ~NetworkingPrivateStartDisconnectFunction() override
;
308 // AsyncExtensionFunction overrides.
309 bool RunAsync() override
;
313 void Failure(const std::string
& error
);
315 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateStartDisconnectFunction
);
318 // Implements the chrome.networkingPrivate.startActivate method.
319 class NetworkingPrivateStartActivateFunction
: public AsyncExtensionFunction
{
321 NetworkingPrivateStartActivateFunction() {}
322 DECLARE_EXTENSION_FUNCTION("networkingPrivate.startActivate",
323 NETWORKINGPRIVATE_STARTACTIVATE
);
326 ~NetworkingPrivateStartActivateFunction() override
;
328 // AsyncExtensionFunction overrides.
329 bool RunAsync() override
;
333 void Failure(const std::string
& error
);
335 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateStartActivateFunction
);
338 // Implements the chrome.networkingPrivate.verifyDestination method.
339 class NetworkingPrivateVerifyDestinationFunction
340 : public AsyncExtensionFunction
{
342 NetworkingPrivateVerifyDestinationFunction() {}
343 DECLARE_EXTENSION_FUNCTION("networkingPrivate.verifyDestination",
344 NETWORKINGPRIVATE_VERIFYDESTINATION
);
347 ~NetworkingPrivateVerifyDestinationFunction() override
;
349 // AsyncExtensionFunction overrides.
350 bool RunAsync() override
;
352 void Success(bool result
);
353 void Failure(const std::string
& error
);
356 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateVerifyDestinationFunction
);
359 // Implements the chrome.networkingPrivate.verifyAndEncryptCredentials method.
360 class NetworkingPrivateVerifyAndEncryptCredentialsFunction
361 : public AsyncExtensionFunction
{
363 NetworkingPrivateVerifyAndEncryptCredentialsFunction() {}
364 DECLARE_EXTENSION_FUNCTION("networkingPrivate.verifyAndEncryptCredentials",
365 NETWORKINGPRIVATE_VERIFYANDENCRYPTCREDENTIALS
);
368 ~NetworkingPrivateVerifyAndEncryptCredentialsFunction() override
;
370 // AsyncExtensionFunction overrides.
371 bool RunAsync() override
;
373 void Success(const std::string
& result
);
374 void Failure(const std::string
& error
);
377 DISALLOW_COPY_AND_ASSIGN(
378 NetworkingPrivateVerifyAndEncryptCredentialsFunction
);
381 // Implements the chrome.networkingPrivate.verifyAndEncryptData method.
382 class NetworkingPrivateVerifyAndEncryptDataFunction
383 : public AsyncExtensionFunction
{
385 NetworkingPrivateVerifyAndEncryptDataFunction() {}
386 DECLARE_EXTENSION_FUNCTION("networkingPrivate.verifyAndEncryptData",
387 NETWORKINGPRIVATE_VERIFYANDENCRYPTDATA
);
390 ~NetworkingPrivateVerifyAndEncryptDataFunction() override
;
392 // AsyncExtensionFunction overrides.
393 bool RunAsync() override
;
395 void Success(const std::string
& result
);
396 void Failure(const std::string
& error
);
399 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateVerifyAndEncryptDataFunction
);
402 // Implements the chrome.networkingPrivate.setWifiTDLSEnabledState method.
403 class NetworkingPrivateSetWifiTDLSEnabledStateFunction
404 : public AsyncExtensionFunction
{
406 NetworkingPrivateSetWifiTDLSEnabledStateFunction() {}
407 DECLARE_EXTENSION_FUNCTION("networkingPrivate.setWifiTDLSEnabledState",
408 NETWORKINGPRIVATE_SETWIFITDLSENABLEDSTATE
);
411 ~NetworkingPrivateSetWifiTDLSEnabledStateFunction() override
;
413 // AsyncExtensionFunction overrides.
414 bool RunAsync() override
;
416 void Success(const std::string
& result
);
417 void Failure(const std::string
& error
);
420 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateSetWifiTDLSEnabledStateFunction
);
423 // Implements the chrome.networkingPrivate.getWifiTDLSStatus method.
424 class NetworkingPrivateGetWifiTDLSStatusFunction
425 : public AsyncExtensionFunction
{
427 NetworkingPrivateGetWifiTDLSStatusFunction() {}
428 DECLARE_EXTENSION_FUNCTION("networkingPrivate.getWifiTDLSStatus",
429 NETWORKINGPRIVATE_GETWIFITDLSSTATUS
);
432 ~NetworkingPrivateGetWifiTDLSStatusFunction() override
;
434 // AsyncExtensionFunction overrides.
435 bool RunAsync() override
;
437 void Success(const std::string
& result
);
438 void Failure(const std::string
& error
);
441 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateGetWifiTDLSStatusFunction
);
444 class NetworkingPrivateGetCaptivePortalStatusFunction
445 : public AsyncExtensionFunction
{
447 NetworkingPrivateGetCaptivePortalStatusFunction() {}
448 DECLARE_EXTENSION_FUNCTION("networkingPrivate.getCaptivePortalStatus",
449 NETWORKINGPRIVATE_GETCAPTIVEPORTALSTATUS
);
451 // AsyncExtensionFunction overrides.
452 bool RunAsync() override
;
455 ~NetworkingPrivateGetCaptivePortalStatusFunction() override
;
458 void Success(const std::string
& result
);
459 void Failure(const std::string
& error
);
461 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateGetCaptivePortalStatusFunction
);
464 } // namespace extensions
466 #endif // EXTENSIONS_BROWSER_API_NETWORKING_PRIVATE_NETWORKING_PRIVATE_API_H_