Add ICU message format support
[chromium-blink-merge.git] / extensions / browser / api / networking_private / networking_private_api.h
blob6283839f547c6238850f84ce30cd15a27182d051
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_
8 #include <string>
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 kErrorInvalidNetworkOperation[];
21 extern const char kErrorNetworkUnavailable[];
22 extern const char kErrorEncryptionError[];
23 extern const char kErrorNotReady[];
24 extern const char kErrorNotSupported[];
25 extern const char kErrorSimLocked[];
27 } // namespace networking_private
29 // Implements the chrome.networkingPrivate.getProperties method.
30 class NetworkingPrivateGetPropertiesFunction : public AsyncExtensionFunction {
31 public:
32 NetworkingPrivateGetPropertiesFunction() {}
33 DECLARE_EXTENSION_FUNCTION("networkingPrivate.getProperties",
34 NETWORKINGPRIVATE_GETPROPERTIES);
36 protected:
37 ~NetworkingPrivateGetPropertiesFunction() override;
39 // AsyncExtensionFunction overrides.
40 bool RunAsync() override;
42 private:
43 void Success(scoped_ptr<base::DictionaryValue> result);
44 void Failure(const std::string& error_name);
46 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateGetPropertiesFunction);
49 // Implements the chrome.networkingPrivate.getManagedProperties method.
50 class NetworkingPrivateGetManagedPropertiesFunction
51 : public AsyncExtensionFunction {
52 public:
53 NetworkingPrivateGetManagedPropertiesFunction() {}
54 DECLARE_EXTENSION_FUNCTION("networkingPrivate.getManagedProperties",
55 NETWORKINGPRIVATE_GETMANAGEDPROPERTIES);
57 protected:
58 ~NetworkingPrivateGetManagedPropertiesFunction() override;
60 // AsyncExtensionFunction overrides.
61 bool RunAsync() override;
63 private:
64 void Success(scoped_ptr<base::DictionaryValue> result);
65 void Failure(const std::string& error);
67 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateGetManagedPropertiesFunction);
70 // Implements the chrome.networkingPrivate.getState method.
71 class NetworkingPrivateGetStateFunction : public AsyncExtensionFunction {
72 public:
73 NetworkingPrivateGetStateFunction() {}
74 DECLARE_EXTENSION_FUNCTION("networkingPrivate.getState",
75 NETWORKINGPRIVATE_GETSTATE);
77 protected:
78 ~NetworkingPrivateGetStateFunction() override;
80 // AsyncExtensionFunction overrides.
81 bool RunAsync() override;
83 private:
84 void Success(scoped_ptr<base::DictionaryValue> result);
85 void Failure(const std::string& error);
87 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateGetStateFunction);
90 // Implements the chrome.networkingPrivate.setProperties method.
91 class NetworkingPrivateSetPropertiesFunction : public AsyncExtensionFunction {
92 public:
93 NetworkingPrivateSetPropertiesFunction() {}
94 DECLARE_EXTENSION_FUNCTION("networkingPrivate.setProperties",
95 NETWORKINGPRIVATE_SETPROPERTIES);
97 protected:
98 ~NetworkingPrivateSetPropertiesFunction() override;
100 // AsyncExtensionFunction overrides.
101 bool RunAsync() override;
103 private:
104 void Success();
105 void Failure(const std::string& error);
107 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateSetPropertiesFunction);
110 // Implements the chrome.networkingPrivate.createNetwork method.
111 class NetworkingPrivateCreateNetworkFunction : public AsyncExtensionFunction {
112 public:
113 NetworkingPrivateCreateNetworkFunction() {}
114 DECLARE_EXTENSION_FUNCTION("networkingPrivate.createNetwork",
115 NETWORKINGPRIVATE_CREATENETWORK);
117 protected:
118 ~NetworkingPrivateCreateNetworkFunction() override;
120 // AsyncExtensionFunction overrides.
121 bool RunAsync() override;
123 private:
124 void Success(const std::string& guid);
125 void Failure(const std::string& error);
127 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateCreateNetworkFunction);
130 // Implements the chrome.networkingPrivate.createNetwork method.
131 class NetworkingPrivateForgetNetworkFunction : public AsyncExtensionFunction {
132 public:
133 NetworkingPrivateForgetNetworkFunction() {}
134 DECLARE_EXTENSION_FUNCTION("networkingPrivate.forgetNetwork",
135 NETWORKINGPRIVATE_FORGETNETWORK);
137 protected:
138 ~NetworkingPrivateForgetNetworkFunction() override;
140 // AsyncExtensionFunction overrides.
141 bool RunAsync() override;
143 private:
144 void Success();
145 void Failure(const std::string& error);
147 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateForgetNetworkFunction);
150 // Implements the chrome.networkingPrivate.getNetworks method.
151 class NetworkingPrivateGetNetworksFunction : public AsyncExtensionFunction {
152 public:
153 NetworkingPrivateGetNetworksFunction() {}
154 DECLARE_EXTENSION_FUNCTION("networkingPrivate.getNetworks",
155 NETWORKINGPRIVATE_GETNETWORKS);
157 protected:
158 ~NetworkingPrivateGetNetworksFunction() override;
160 // AsyncExtensionFunction overrides.
161 bool RunAsync() override;
163 private:
164 void Success(scoped_ptr<base::ListValue> network_list);
165 void Failure(const std::string& error);
167 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateGetNetworksFunction);
170 // Implements the chrome.networkingPrivate.getVisibleNetworks method.
171 class NetworkingPrivateGetVisibleNetworksFunction
172 : public AsyncExtensionFunction {
173 public:
174 NetworkingPrivateGetVisibleNetworksFunction() {}
175 DECLARE_EXTENSION_FUNCTION("networkingPrivate.getVisibleNetworks",
176 NETWORKINGPRIVATE_GETVISIBLENETWORKS);
178 protected:
179 ~NetworkingPrivateGetVisibleNetworksFunction() override;
181 // AsyncExtensionFunction overrides.
182 bool RunAsync() override;
184 private:
185 void Success(scoped_ptr<base::ListValue> network_list);
186 void Failure(const std::string& error);
188 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateGetVisibleNetworksFunction);
191 // Implements the chrome.networkingPrivate.getEnabledNetworkTypes method.
192 class NetworkingPrivateGetEnabledNetworkTypesFunction
193 : public SyncExtensionFunction {
194 public:
195 NetworkingPrivateGetEnabledNetworkTypesFunction() {}
196 DECLARE_EXTENSION_FUNCTION("networkingPrivate.getEnabledNetworkTypes",
197 NETWORKINGPRIVATE_GETENABLEDNETWORKTYPES);
199 protected:
200 ~NetworkingPrivateGetEnabledNetworkTypesFunction() override;
202 // SyncExtensionFunction overrides.
203 bool RunSync() override;
205 private:
206 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateGetEnabledNetworkTypesFunction);
209 // Implements the chrome.networkingPrivate.getDeviceStates method.
210 class NetworkingPrivateGetDeviceStatesFunction : public SyncExtensionFunction {
211 public:
212 NetworkingPrivateGetDeviceStatesFunction() {}
213 DECLARE_EXTENSION_FUNCTION("networkingPrivate.getDeviceStates",
214 NETWORKINGPRIVATE_GETDEVICESTATES);
216 protected:
217 ~NetworkingPrivateGetDeviceStatesFunction() override;
219 // SyncExtensionFunction overrides.
220 bool RunSync() override;
222 private:
223 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateGetDeviceStatesFunction);
226 // Implements the chrome.networkingPrivate.enableNetworkType method.
227 class NetworkingPrivateEnableNetworkTypeFunction
228 : public SyncExtensionFunction {
229 public:
230 NetworkingPrivateEnableNetworkTypeFunction() {}
231 DECLARE_EXTENSION_FUNCTION("networkingPrivate.enableNetworkType",
232 NETWORKINGPRIVATE_ENABLENETWORKTYPE);
234 protected:
235 ~NetworkingPrivateEnableNetworkTypeFunction() override;
237 // SyncExtensionFunction overrides.
238 bool RunSync() override;
240 private:
241 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateEnableNetworkTypeFunction);
244 // Implements the chrome.networkingPrivate.disableNetworkType method.
245 class NetworkingPrivateDisableNetworkTypeFunction
246 : public SyncExtensionFunction {
247 public:
248 NetworkingPrivateDisableNetworkTypeFunction() {}
249 DECLARE_EXTENSION_FUNCTION("networkingPrivate.disableNetworkType",
250 NETWORKINGPRIVATE_DISABLENETWORKTYPE);
252 protected:
253 ~NetworkingPrivateDisableNetworkTypeFunction() override;
255 // SyncExtensionFunction overrides.
256 bool RunSync() override;
258 private:
259 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateDisableNetworkTypeFunction);
262 // Implements the chrome.networkingPrivate.requestNetworkScan method.
263 class NetworkingPrivateRequestNetworkScanFunction
264 : public SyncExtensionFunction {
265 public:
266 NetworkingPrivateRequestNetworkScanFunction() {}
267 DECLARE_EXTENSION_FUNCTION("networkingPrivate.requestNetworkScan",
268 NETWORKINGPRIVATE_REQUESTNETWORKSCAN);
270 protected:
271 ~NetworkingPrivateRequestNetworkScanFunction() override;
273 // SyncExtensionFunction overrides.
274 bool RunSync() override;
276 private:
277 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateRequestNetworkScanFunction);
280 // Implements the chrome.networkingPrivate.startConnect method.
281 class NetworkingPrivateStartConnectFunction : public AsyncExtensionFunction {
282 public:
283 NetworkingPrivateStartConnectFunction() {}
284 DECLARE_EXTENSION_FUNCTION("networkingPrivate.startConnect",
285 NETWORKINGPRIVATE_STARTCONNECT);
287 protected:
288 ~NetworkingPrivateStartConnectFunction() override;
290 // AsyncExtensionFunction overrides.
291 bool RunAsync() override;
293 private:
294 void Success();
295 void Failure(const std::string& error);
297 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateStartConnectFunction);
300 // Implements the chrome.networkingPrivate.startDisconnect method.
301 class NetworkingPrivateStartDisconnectFunction : public AsyncExtensionFunction {
302 public:
303 NetworkingPrivateStartDisconnectFunction() {}
304 DECLARE_EXTENSION_FUNCTION("networkingPrivate.startDisconnect",
305 NETWORKINGPRIVATE_STARTDISCONNECT);
307 protected:
308 ~NetworkingPrivateStartDisconnectFunction() override;
310 // AsyncExtensionFunction overrides.
311 bool RunAsync() override;
313 private:
314 void Success();
315 void Failure(const std::string& error);
317 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateStartDisconnectFunction);
320 // Implements the chrome.networkingPrivate.startActivate method.
321 class NetworkingPrivateStartActivateFunction : public AsyncExtensionFunction {
322 public:
323 NetworkingPrivateStartActivateFunction() {}
324 DECLARE_EXTENSION_FUNCTION("networkingPrivate.startActivate",
325 NETWORKINGPRIVATE_STARTACTIVATE);
327 protected:
328 ~NetworkingPrivateStartActivateFunction() override;
330 // AsyncExtensionFunction overrides.
331 bool RunAsync() override;
333 private:
334 void Success();
335 void Failure(const std::string& error);
337 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateStartActivateFunction);
340 // Implements the chrome.networkingPrivate.verifyDestination method.
341 class NetworkingPrivateVerifyDestinationFunction
342 : public AsyncExtensionFunction {
343 public:
344 NetworkingPrivateVerifyDestinationFunction() {}
345 DECLARE_EXTENSION_FUNCTION("networkingPrivate.verifyDestination",
346 NETWORKINGPRIVATE_VERIFYDESTINATION);
348 protected:
349 ~NetworkingPrivateVerifyDestinationFunction() override;
351 // AsyncExtensionFunction overrides.
352 bool RunAsync() override;
354 void Success(bool result);
355 void Failure(const std::string& error);
357 private:
358 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateVerifyDestinationFunction);
361 // Implements the chrome.networkingPrivate.verifyAndEncryptCredentials method.
362 class NetworkingPrivateVerifyAndEncryptCredentialsFunction
363 : public AsyncExtensionFunction {
364 public:
365 NetworkingPrivateVerifyAndEncryptCredentialsFunction() {}
366 DECLARE_EXTENSION_FUNCTION("networkingPrivate.verifyAndEncryptCredentials",
367 NETWORKINGPRIVATE_VERIFYANDENCRYPTCREDENTIALS);
369 protected:
370 ~NetworkingPrivateVerifyAndEncryptCredentialsFunction() override;
372 // AsyncExtensionFunction overrides.
373 bool RunAsync() override;
375 void Success(const std::string& result);
376 void Failure(const std::string& error);
378 private:
379 DISALLOW_COPY_AND_ASSIGN(
380 NetworkingPrivateVerifyAndEncryptCredentialsFunction);
383 // Implements the chrome.networkingPrivate.verifyAndEncryptData method.
384 class NetworkingPrivateVerifyAndEncryptDataFunction
385 : public AsyncExtensionFunction {
386 public:
387 NetworkingPrivateVerifyAndEncryptDataFunction() {}
388 DECLARE_EXTENSION_FUNCTION("networkingPrivate.verifyAndEncryptData",
389 NETWORKINGPRIVATE_VERIFYANDENCRYPTDATA);
391 protected:
392 ~NetworkingPrivateVerifyAndEncryptDataFunction() override;
394 // AsyncExtensionFunction overrides.
395 bool RunAsync() override;
397 void Success(const std::string& result);
398 void Failure(const std::string& error);
400 private:
401 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateVerifyAndEncryptDataFunction);
404 // Implements the chrome.networkingPrivate.setWifiTDLSEnabledState method.
405 class NetworkingPrivateSetWifiTDLSEnabledStateFunction
406 : public AsyncExtensionFunction {
407 public:
408 NetworkingPrivateSetWifiTDLSEnabledStateFunction() {}
409 DECLARE_EXTENSION_FUNCTION("networkingPrivate.setWifiTDLSEnabledState",
410 NETWORKINGPRIVATE_SETWIFITDLSENABLEDSTATE);
412 protected:
413 ~NetworkingPrivateSetWifiTDLSEnabledStateFunction() override;
415 // AsyncExtensionFunction overrides.
416 bool RunAsync() override;
418 void Success(const std::string& result);
419 void Failure(const std::string& error);
421 private:
422 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateSetWifiTDLSEnabledStateFunction);
425 // Implements the chrome.networkingPrivate.getWifiTDLSStatus method.
426 class NetworkingPrivateGetWifiTDLSStatusFunction
427 : public AsyncExtensionFunction {
428 public:
429 NetworkingPrivateGetWifiTDLSStatusFunction() {}
430 DECLARE_EXTENSION_FUNCTION("networkingPrivate.getWifiTDLSStatus",
431 NETWORKINGPRIVATE_GETWIFITDLSSTATUS);
433 protected:
434 ~NetworkingPrivateGetWifiTDLSStatusFunction() override;
436 // AsyncExtensionFunction overrides.
437 bool RunAsync() override;
439 void Success(const std::string& result);
440 void Failure(const std::string& error);
442 private:
443 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateGetWifiTDLSStatusFunction);
446 class NetworkingPrivateGetCaptivePortalStatusFunction
447 : public AsyncExtensionFunction {
448 public:
449 NetworkingPrivateGetCaptivePortalStatusFunction() {}
450 DECLARE_EXTENSION_FUNCTION("networkingPrivate.getCaptivePortalStatus",
451 NETWORKINGPRIVATE_GETCAPTIVEPORTALSTATUS);
453 // AsyncExtensionFunction overrides.
454 bool RunAsync() override;
456 protected:
457 ~NetworkingPrivateGetCaptivePortalStatusFunction() override;
459 private:
460 void Success(const std::string& result);
461 void Failure(const std::string& error);
463 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateGetCaptivePortalStatusFunction);
466 class NetworkingPrivateUnlockCellularSimFunction
467 : public AsyncExtensionFunction {
468 public:
469 NetworkingPrivateUnlockCellularSimFunction() {}
470 DECLARE_EXTENSION_FUNCTION("networkingPrivate.unlockCellularSim",
471 NETWORKINGPRIVATE_UNLOCKCELLULARSIM);
473 // AsyncExtensionFunction overrides.
474 bool RunAsync() override;
476 protected:
477 ~NetworkingPrivateUnlockCellularSimFunction() override;
479 private:
480 void Success();
481 void Failure(const std::string& error);
483 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateUnlockCellularSimFunction);
486 class NetworkingPrivateSetCellularSimStateFunction
487 : public AsyncExtensionFunction {
488 public:
489 NetworkingPrivateSetCellularSimStateFunction() {}
490 DECLARE_EXTENSION_FUNCTION("networkingPrivate.setCellularSimState",
491 NETWORKINGPRIVATE_SETCELLULARSIMSTATE);
493 // AsyncExtensionFunction overrides.
494 bool RunAsync() override;
496 protected:
497 ~NetworkingPrivateSetCellularSimStateFunction() override;
499 private:
500 void Success();
501 void Failure(const std::string& error);
503 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateSetCellularSimStateFunction);
506 } // namespace extensions
508 #endif // EXTENSIONS_BROWSER_API_NETWORKING_PRIVATE_NETWORKING_PRIVATE_API_H_