| OLD | NEW |
| (Empty) |
| 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. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_NETWORKING_PRIVATE_NETWORKING_PRIVATE_API_
H_ | |
| 6 #define CHROME_BROWSER_EXTENSIONS_API_NETWORKING_PRIVATE_NETWORKING_PRIVATE_API_
H_ | |
| 7 | |
| 8 #include <string> | |
| 9 | |
| 10 #include "base/macros.h" | |
| 11 #include "base/memory/scoped_ptr.h" | |
| 12 #include "base/values.h" | |
| 13 #include "extensions/browser/extension_function.h" | |
| 14 | |
| 15 namespace extensions { | |
| 16 | |
| 17 namespace networking_private { | |
| 18 | |
| 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[]; | |
| 24 | |
| 25 } // namespace networking_private | |
| 26 | |
| 27 // Implements the chrome.networkingPrivate.getProperties method. | |
| 28 class NetworkingPrivateGetPropertiesFunction : public AsyncExtensionFunction { | |
| 29 public: | |
| 30 NetworkingPrivateGetPropertiesFunction() {} | |
| 31 DECLARE_EXTENSION_FUNCTION("networkingPrivate.getProperties", | |
| 32 NETWORKINGPRIVATE_GETPROPERTIES); | |
| 33 | |
| 34 protected: | |
| 35 ~NetworkingPrivateGetPropertiesFunction() override; | |
| 36 | |
| 37 // AsyncExtensionFunction overrides. | |
| 38 bool RunAsync() override; | |
| 39 | |
| 40 private: | |
| 41 void Success(scoped_ptr<base::DictionaryValue> result); | |
| 42 void Failure(const std::string& error_name); | |
| 43 | |
| 44 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateGetPropertiesFunction); | |
| 45 }; | |
| 46 | |
| 47 // Implements the chrome.networkingPrivate.getManagedProperties method. | |
| 48 class NetworkingPrivateGetManagedPropertiesFunction | |
| 49 : public AsyncExtensionFunction { | |
| 50 public: | |
| 51 NetworkingPrivateGetManagedPropertiesFunction() {} | |
| 52 DECLARE_EXTENSION_FUNCTION("networkingPrivate.getManagedProperties", | |
| 53 NETWORKINGPRIVATE_GETMANAGEDPROPERTIES); | |
| 54 | |
| 55 protected: | |
| 56 ~NetworkingPrivateGetManagedPropertiesFunction() override; | |
| 57 | |
| 58 // AsyncExtensionFunction overrides. | |
| 59 bool RunAsync() override; | |
| 60 | |
| 61 private: | |
| 62 void Success(scoped_ptr<base::DictionaryValue> result); | |
| 63 void Failure(const std::string& error); | |
| 64 | |
| 65 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateGetManagedPropertiesFunction); | |
| 66 }; | |
| 67 | |
| 68 // Implements the chrome.networkingPrivate.getState method. | |
| 69 class NetworkingPrivateGetStateFunction : public AsyncExtensionFunction { | |
| 70 public: | |
| 71 NetworkingPrivateGetStateFunction() {} | |
| 72 DECLARE_EXTENSION_FUNCTION("networkingPrivate.getState", | |
| 73 NETWORKINGPRIVATE_GETSTATE); | |
| 74 | |
| 75 protected: | |
| 76 ~NetworkingPrivateGetStateFunction() override; | |
| 77 | |
| 78 // AsyncExtensionFunction overrides. | |
| 79 bool RunAsync() override; | |
| 80 | |
| 81 private: | |
| 82 void Success(scoped_ptr<base::DictionaryValue> result); | |
| 83 void Failure(const std::string& error); | |
| 84 | |
| 85 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateGetStateFunction); | |
| 86 }; | |
| 87 | |
| 88 // Implements the chrome.networkingPrivate.setProperties method. | |
| 89 class NetworkingPrivateSetPropertiesFunction : public AsyncExtensionFunction { | |
| 90 public: | |
| 91 NetworkingPrivateSetPropertiesFunction() {} | |
| 92 DECLARE_EXTENSION_FUNCTION("networkingPrivate.setProperties", | |
| 93 NETWORKINGPRIVATE_SETPROPERTIES); | |
| 94 | |
| 95 protected: | |
| 96 ~NetworkingPrivateSetPropertiesFunction() override; | |
| 97 | |
| 98 // AsyncExtensionFunction overrides. | |
| 99 bool RunAsync() override; | |
| 100 | |
| 101 private: | |
| 102 void Success(); | |
| 103 void Failure(const std::string& error); | |
| 104 | |
| 105 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateSetPropertiesFunction); | |
| 106 }; | |
| 107 | |
| 108 // Implements the chrome.networkingPrivate.createNetwork method. | |
| 109 class NetworkingPrivateCreateNetworkFunction : public AsyncExtensionFunction { | |
| 110 public: | |
| 111 NetworkingPrivateCreateNetworkFunction() {} | |
| 112 DECLARE_EXTENSION_FUNCTION("networkingPrivate.createNetwork", | |
| 113 NETWORKINGPRIVATE_CREATENETWORK); | |
| 114 | |
| 115 protected: | |
| 116 ~NetworkingPrivateCreateNetworkFunction() override; | |
| 117 | |
| 118 // AsyncExtensionFunction overrides. | |
| 119 bool RunAsync() override; | |
| 120 | |
| 121 private: | |
| 122 void Success(const std::string& guid); | |
| 123 void Failure(const std::string& error); | |
| 124 | |
| 125 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateCreateNetworkFunction); | |
| 126 }; | |
| 127 | |
| 128 // Implements the chrome.networkingPrivate.getNetworks method. | |
| 129 class NetworkingPrivateGetNetworksFunction : public AsyncExtensionFunction { | |
| 130 public: | |
| 131 NetworkingPrivateGetNetworksFunction() {} | |
| 132 DECLARE_EXTENSION_FUNCTION("networkingPrivate.getNetworks", | |
| 133 NETWORKINGPRIVATE_GETNETWORKS); | |
| 134 | |
| 135 protected: | |
| 136 ~NetworkingPrivateGetNetworksFunction() override; | |
| 137 | |
| 138 // AsyncExtensionFunction overrides. | |
| 139 bool RunAsync() override; | |
| 140 | |
| 141 private: | |
| 142 void Success(scoped_ptr<base::ListValue> network_list); | |
| 143 void Failure(const std::string& error); | |
| 144 | |
| 145 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateGetNetworksFunction); | |
| 146 }; | |
| 147 | |
| 148 // Implements the chrome.networkingPrivate.getVisibleNetworks method. | |
| 149 class NetworkingPrivateGetVisibleNetworksFunction | |
| 150 : public AsyncExtensionFunction { | |
| 151 public: | |
| 152 NetworkingPrivateGetVisibleNetworksFunction() {} | |
| 153 DECLARE_EXTENSION_FUNCTION("networkingPrivate.getVisibleNetworks", | |
| 154 NETWORKINGPRIVATE_GETVISIBLENETWORKS); | |
| 155 | |
| 156 protected: | |
| 157 ~NetworkingPrivateGetVisibleNetworksFunction() override; | |
| 158 | |
| 159 // AsyncExtensionFunction overrides. | |
| 160 bool RunAsync() override; | |
| 161 | |
| 162 private: | |
| 163 void Success(scoped_ptr<base::ListValue> network_list); | |
| 164 void Failure(const std::string& error); | |
| 165 | |
| 166 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateGetVisibleNetworksFunction); | |
| 167 }; | |
| 168 | |
| 169 // Implements the chrome.networkingPrivate.getEnabledNetworkTypes method. | |
| 170 class NetworkingPrivateGetEnabledNetworkTypesFunction | |
| 171 : public SyncExtensionFunction { | |
| 172 public: | |
| 173 NetworkingPrivateGetEnabledNetworkTypesFunction() {} | |
| 174 DECLARE_EXTENSION_FUNCTION("networkingPrivate.getEnabledNetworkTypes", | |
| 175 NETWORKINGPRIVATE_GETENABLEDNETWORKTYPES); | |
| 176 | |
| 177 protected: | |
| 178 ~NetworkingPrivateGetEnabledNetworkTypesFunction() override; | |
| 179 | |
| 180 // SyncExtensionFunction overrides. | |
| 181 bool RunSync() override; | |
| 182 | |
| 183 private: | |
| 184 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateGetEnabledNetworkTypesFunction); | |
| 185 }; | |
| 186 | |
| 187 // Implements the chrome.networkingPrivate.enableNetworkType method. | |
| 188 class NetworkingPrivateEnableNetworkTypeFunction | |
| 189 : public SyncExtensionFunction { | |
| 190 public: | |
| 191 NetworkingPrivateEnableNetworkTypeFunction() {} | |
| 192 DECLARE_EXTENSION_FUNCTION("networkingPrivate.enableNetworkType", | |
| 193 NETWORKINGPRIVATE_ENABLENETWORKTYPE); | |
| 194 | |
| 195 protected: | |
| 196 ~NetworkingPrivateEnableNetworkTypeFunction() override; | |
| 197 | |
| 198 // SyncExtensionFunction overrides. | |
| 199 bool RunSync() override; | |
| 200 | |
| 201 private: | |
| 202 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateEnableNetworkTypeFunction); | |
| 203 }; | |
| 204 | |
| 205 // Implements the chrome.networkingPrivate.disableNetworkType method. | |
| 206 class NetworkingPrivateDisableNetworkTypeFunction | |
| 207 : public SyncExtensionFunction { | |
| 208 public: | |
| 209 NetworkingPrivateDisableNetworkTypeFunction() {} | |
| 210 DECLARE_EXTENSION_FUNCTION("networkingPrivate.disableNetworkType", | |
| 211 NETWORKINGPRIVATE_DISABLENETWORKTYPE); | |
| 212 | |
| 213 protected: | |
| 214 ~NetworkingPrivateDisableNetworkTypeFunction() override; | |
| 215 | |
| 216 // SyncExtensionFunction overrides. | |
| 217 bool RunSync() override; | |
| 218 | |
| 219 private: | |
| 220 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateDisableNetworkTypeFunction); | |
| 221 }; | |
| 222 | |
| 223 // Implements the chrome.networkingPrivate.requestNetworkScan method. | |
| 224 class NetworkingPrivateRequestNetworkScanFunction | |
| 225 : public SyncExtensionFunction { | |
| 226 public: | |
| 227 NetworkingPrivateRequestNetworkScanFunction() {} | |
| 228 DECLARE_EXTENSION_FUNCTION("networkingPrivate.requestNetworkScan", | |
| 229 NETWORKINGPRIVATE_REQUESTNETWORKSCAN); | |
| 230 | |
| 231 protected: | |
| 232 ~NetworkingPrivateRequestNetworkScanFunction() override; | |
| 233 | |
| 234 // SyncExtensionFunction overrides. | |
| 235 bool RunSync() override; | |
| 236 | |
| 237 private: | |
| 238 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateRequestNetworkScanFunction); | |
| 239 }; | |
| 240 | |
| 241 | |
| 242 // Implements the chrome.networkingPrivate.startConnect method. | |
| 243 class NetworkingPrivateStartConnectFunction : public AsyncExtensionFunction { | |
| 244 public: | |
| 245 NetworkingPrivateStartConnectFunction() {} | |
| 246 DECLARE_EXTENSION_FUNCTION("networkingPrivate.startConnect", | |
| 247 NETWORKINGPRIVATE_STARTCONNECT); | |
| 248 | |
| 249 protected: | |
| 250 ~NetworkingPrivateStartConnectFunction() override; | |
| 251 | |
| 252 // AsyncExtensionFunction overrides. | |
| 253 bool RunAsync() override; | |
| 254 | |
| 255 private: | |
| 256 void Success(); | |
| 257 void Failure(const std::string& error); | |
| 258 | |
| 259 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateStartConnectFunction); | |
| 260 }; | |
| 261 | |
| 262 // Implements the chrome.networkingPrivate.startDisconnect method. | |
| 263 class NetworkingPrivateStartDisconnectFunction : public AsyncExtensionFunction { | |
| 264 public: | |
| 265 NetworkingPrivateStartDisconnectFunction() {} | |
| 266 DECLARE_EXTENSION_FUNCTION("networkingPrivate.startDisconnect", | |
| 267 NETWORKINGPRIVATE_STARTDISCONNECT); | |
| 268 | |
| 269 protected: | |
| 270 ~NetworkingPrivateStartDisconnectFunction() override; | |
| 271 | |
| 272 // AsyncExtensionFunction overrides. | |
| 273 bool RunAsync() override; | |
| 274 | |
| 275 private: | |
| 276 void Success(); | |
| 277 void Failure(const std::string& error); | |
| 278 | |
| 279 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateStartDisconnectFunction); | |
| 280 }; | |
| 281 | |
| 282 // Implements the chrome.networkingPrivate.verifyDestination method. | |
| 283 class NetworkingPrivateVerifyDestinationFunction | |
| 284 : public AsyncExtensionFunction { | |
| 285 public: | |
| 286 NetworkingPrivateVerifyDestinationFunction() {} | |
| 287 DECLARE_EXTENSION_FUNCTION("networkingPrivate.verifyDestination", | |
| 288 NETWORKINGPRIVATE_VERIFYDESTINATION); | |
| 289 | |
| 290 protected: | |
| 291 ~NetworkingPrivateVerifyDestinationFunction() override; | |
| 292 | |
| 293 // AsyncExtensionFunction overrides. | |
| 294 bool RunAsync() override; | |
| 295 | |
| 296 void Success(bool result); | |
| 297 void Failure(const std::string& error); | |
| 298 | |
| 299 private: | |
| 300 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateVerifyDestinationFunction); | |
| 301 }; | |
| 302 | |
| 303 // Implements the chrome.networkingPrivate.verifyAndEncryptCredentials method. | |
| 304 class NetworkingPrivateVerifyAndEncryptCredentialsFunction | |
| 305 : public AsyncExtensionFunction { | |
| 306 public: | |
| 307 NetworkingPrivateVerifyAndEncryptCredentialsFunction() {} | |
| 308 DECLARE_EXTENSION_FUNCTION("networkingPrivate.verifyAndEncryptCredentials", | |
| 309 NETWORKINGPRIVATE_VERIFYANDENCRYPTCREDENTIALS); | |
| 310 | |
| 311 protected: | |
| 312 ~NetworkingPrivateVerifyAndEncryptCredentialsFunction() override; | |
| 313 | |
| 314 // AsyncExtensionFunction overrides. | |
| 315 bool RunAsync() override; | |
| 316 | |
| 317 void Success(const std::string& result); | |
| 318 void Failure(const std::string& error); | |
| 319 | |
| 320 private: | |
| 321 DISALLOW_COPY_AND_ASSIGN( | |
| 322 NetworkingPrivateVerifyAndEncryptCredentialsFunction); | |
| 323 }; | |
| 324 | |
| 325 // Implements the chrome.networkingPrivate.verifyAndEncryptData method. | |
| 326 class NetworkingPrivateVerifyAndEncryptDataFunction | |
| 327 : public AsyncExtensionFunction { | |
| 328 public: | |
| 329 NetworkingPrivateVerifyAndEncryptDataFunction() {} | |
| 330 DECLARE_EXTENSION_FUNCTION("networkingPrivate.verifyAndEncryptData", | |
| 331 NETWORKINGPRIVATE_VERIFYANDENCRYPTDATA); | |
| 332 | |
| 333 protected: | |
| 334 ~NetworkingPrivateVerifyAndEncryptDataFunction() override; | |
| 335 | |
| 336 // AsyncExtensionFunction overrides. | |
| 337 bool RunAsync() override; | |
| 338 | |
| 339 void Success(const std::string& result); | |
| 340 void Failure(const std::string& error); | |
| 341 | |
| 342 private: | |
| 343 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateVerifyAndEncryptDataFunction); | |
| 344 }; | |
| 345 | |
| 346 // Implements the chrome.networkingPrivate.setWifiTDLSEnabledState method. | |
| 347 class NetworkingPrivateSetWifiTDLSEnabledStateFunction | |
| 348 : public AsyncExtensionFunction { | |
| 349 public: | |
| 350 NetworkingPrivateSetWifiTDLSEnabledStateFunction() {} | |
| 351 DECLARE_EXTENSION_FUNCTION("networkingPrivate.setWifiTDLSEnabledState", | |
| 352 NETWORKINGPRIVATE_SETWIFITDLSENABLEDSTATE); | |
| 353 | |
| 354 protected: | |
| 355 ~NetworkingPrivateSetWifiTDLSEnabledStateFunction() override; | |
| 356 | |
| 357 // AsyncExtensionFunction overrides. | |
| 358 bool RunAsync() override; | |
| 359 | |
| 360 void Success(const std::string& result); | |
| 361 void Failure(const std::string& error); | |
| 362 | |
| 363 private: | |
| 364 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateSetWifiTDLSEnabledStateFunction); | |
| 365 }; | |
| 366 | |
| 367 // Implements the chrome.networkingPrivate.getWifiTDLSStatus method. | |
| 368 class NetworkingPrivateGetWifiTDLSStatusFunction | |
| 369 : public AsyncExtensionFunction { | |
| 370 public: | |
| 371 NetworkingPrivateGetWifiTDLSStatusFunction() {} | |
| 372 DECLARE_EXTENSION_FUNCTION("networkingPrivate.getWifiTDLSStatus", | |
| 373 NETWORKINGPRIVATE_GETWIFITDLSSTATUS); | |
| 374 | |
| 375 protected: | |
| 376 ~NetworkingPrivateGetWifiTDLSStatusFunction() override; | |
| 377 | |
| 378 // AsyncExtensionFunction overrides. | |
| 379 bool RunAsync() override; | |
| 380 | |
| 381 void Success(const std::string& result); | |
| 382 void Failure(const std::string& error); | |
| 383 | |
| 384 private: | |
| 385 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateGetWifiTDLSStatusFunction); | |
| 386 }; | |
| 387 | |
| 388 class NetworkingPrivateGetCaptivePortalStatusFunction | |
| 389 : public AsyncExtensionFunction { | |
| 390 public: | |
| 391 NetworkingPrivateGetCaptivePortalStatusFunction() {} | |
| 392 DECLARE_EXTENSION_FUNCTION("networkingPrivate.getCaptivePortalStatus", | |
| 393 NETWORKINGPRIVATE_GETCAPTIVEPORTALSTATUS); | |
| 394 | |
| 395 // AsyncExtensionFunction overrides. | |
| 396 bool RunAsync() override; | |
| 397 | |
| 398 protected: | |
| 399 ~NetworkingPrivateGetCaptivePortalStatusFunction() override; | |
| 400 | |
| 401 private: | |
| 402 void Success(const std::string& result); | |
| 403 void Failure(const std::string& error); | |
| 404 | |
| 405 DISALLOW_COPY_AND_ASSIGN(NetworkingPrivateGetCaptivePortalStatusFunction); | |
| 406 }; | |
| 407 | |
| 408 } // namespace extensions | |
| 409 | |
| 410 #endif // CHROME_BROWSER_EXTENSIONS_API_NETWORKING_PRIVATE_NETWORKING_PRIVATE_A
PI_H_ | |
| OLD | NEW |