Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
|
pneubeck (no reviews)
2015/03/26 16:56:47
you should run chrome/common/extensions/docs/serve
| |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 // The <code>chrome.networkingPrivate</code> API is used for configuring | |
| 6 // network connections (Cellular, Ethernet, VPN, WiFi" or WiMAX). This private | |
|
pneubeck (no reviews)
2015/03/26 16:56:47
nit: remove orphaned "
| |
| 7 // API is only valid if called from a browser or app associated with the | |
| 8 // primary user. See the ONC documentation for descriptions of properties. | |
| 9 // TODO(stevenjb/pneubeck): Merge the ONC documentation with this document and | |
| 10 // use it as the ONC specification. | |
| 11 | |
| 12 namespace networkingPrivate { | |
| 13 enum ActivationStateType { | |
| 14 Activated, Activating, NotActivated, PartiallyActivated | |
| 15 }; | |
| 16 | |
| 17 enum CaptivePortalStatus { | |
| 18 Unknown, Offline, Online, Portal, ProxyAuthRequired | |
| 19 }; | |
| 20 | |
| 21 enum ConnectionStateType { | |
| 22 Connected, Connecting, NotConnected | |
| 23 }; | |
| 24 | |
| 25 enum IPConfigType { | |
| 26 DHCP, Static | |
| 27 }; | |
| 28 | |
| 29 enum NetworkType { | |
| 30 All, Bluetooth, Cellular, Ethernet, VPN, Wireless, WiFi, WiMAX | |
| 31 }; | |
| 32 | |
| 33 dictionary APNProperties { | |
|
pneubeck (no reviews)
2015/03/26 16:56:47
if you don't need for any of these the generated C
| |
| 34 DOMString? AccessPointName; | |
| 35 DOMString? Name; | |
| 36 DOMString? Username; | |
| 37 DOMString? Password; | |
| 38 }; | |
| 39 | |
| 40 dictionary CellularConfigProperties { | |
| 41 boolean? AutoConnect; | |
| 42 APNProperties? APN; | |
| 43 }; | |
| 44 | |
| 45 dictionary CellularStateProperties { | |
| 46 long? SignalStrength; | |
| 47 boolean? OutOfCredits; | |
| 48 DOMString? RoamingState; | |
| 49 ActivationStateType? ActivationState; | |
| 50 DOMString? NetworkTechnology; | |
| 51 }; | |
| 52 | |
| 53 dictionary EthernetStateProperties { | |
| 54 DOMString? Authentication; | |
| 55 }; | |
| 56 | |
| 57 dictionary IPConfigProperties { | |
| 58 DOMString? Gateway; | |
| 59 DOMString? IPAddress; | |
| 60 DOMString[]? NameServers; | |
| 61 DOMString? Type; | |
| 62 long? RoutingPrefix; | |
| 63 }; | |
| 64 | |
| 65 dictionary IPSecProperties { | |
| 66 DOMString? AuthenticationType; | |
| 67 }; | |
| 68 | |
| 69 dictionary VPNConfigProperties { | |
| 70 boolean? AutoConnect; | |
| 71 DOMString? Type; | |
| 72 DOMString? Host; | |
| 73 }; | |
| 74 | |
| 75 dictionary VPNStateProperties { | |
| 76 DOMString? Type; | |
| 77 IPSecProperties? IPsec; | |
| 78 }; | |
| 79 | |
| 80 dictionary WiFiConfigProperties { | |
| 81 boolean? AutoConnect; | |
| 82 }; | |
| 83 | |
| 84 dictionary WiFiStateProperties { | |
| 85 DOMString? Security; | |
| 86 long? SignalStrength; | |
| 87 }; | |
| 88 | |
| 89 dictionary WiMaxConfigProperties { | |
| 90 boolean? AutoConnect; | |
| 91 }; | |
| 92 | |
| 93 dictionary WiMAXStateProperties { | |
| 94 long? SignalStrength; | |
| 95 }; | |
| 96 | |
| 97 dictionary NetworkConfigProperties { | |
| 98 CellularConfigProperties? Cellular; | |
| 99 DOMString? GUID; | |
| 100 IPConfigType? IPAddressConfigType; | |
| 101 DOMString? Name; | |
| 102 IPConfigType? NameServersConfigType; | |
| 103 long? Priority; | |
| 104 IPConfigProperties? StaticIPConfig; | |
| 105 NetworkType? Type; | |
| 106 VPNConfigProperties? VPN; | |
| 107 WiFiConfigProperties? WiFi; | |
| 108 WiMaxConfigProperties? WiMAX; | |
| 109 }; | |
| 110 | |
| 111 dictionary NetworkStateProperties { | |
| 112 CellularStateProperties? Cellular; | |
| 113 boolean? Connectable; | |
| 114 ConnectionStateType? ConnectionState; | |
| 115 EthernetStateProperties? Ethernet; | |
| 116 DOMString? ErrorState; | |
| 117 DOMString GUID; | |
| 118 DOMString? Name; | |
| 119 long? Priority; | |
| 120 DOMString? Source; | |
| 121 NetworkType Type; | |
| 122 VPNStateProperties? VPN; | |
| 123 WiFiStateProperties? WiFi; | |
| 124 WiMAXStateProperties? WiMAX; | |
| 125 }; | |
| 126 | |
| 127 dictionary VerificationProperties { | |
| 128 // A string containing a PEM-encoded (including the 'BEGIN CERTIFICATE' | |
| 129 // header and 'END CERTIFICATE' footer) X.509 certificate for use in | |
| 130 // verifying the signed data. | |
| 131 DOMString certificate; | |
| 132 | |
| 133 // An array of PEM-encoded X.509 intermediate certificate authority | |
| 134 // certificates. Each PEM-encoded certificate is expected to have the | |
| 135 // 'BEGIN CERTIFICATE' header and 'END CERTIFICATE' footer. | |
| 136 DOMString[]? intermediateCertificates; | |
| 137 | |
| 138 // A string containing a Base64-encoded RSAPublicKey ASN.1 structure, | |
| 139 // representing the public key to be used by verifyAndEncryptCredentials and | |
| 140 // verifyAndEncryptData methods. | |
| 141 DOMString publicKey; | |
| 142 | |
| 143 // A string containing a base64-encoded random binary data for use in | |
| 144 // verifying the signed data. | |
| 145 DOMString nonce; | |
| 146 | |
| 147 // A string containing the identifying data string signed by the device. | |
| 148 DOMString signedData; | |
| 149 | |
| 150 // A string containing the serial number of the device. | |
| 151 DOMString deviceSerial; | |
| 152 | |
| 153 // A string containing the SSID of the device. Should be empty for new | |
| 154 // configurations. | |
| 155 DOMString deviceSsid; | |
| 156 | |
| 157 // A string containing the BSSID of the device. Should be empty for new | |
| 158 // configurations. | |
| 159 DOMString deviceBssid; | |
| 160 }; | |
| 161 | |
| 162 dictionary NetworkFilter { | |
| 163 // The type of networks to return. | |
| 164 NetworkType networkType; | |
| 165 | |
| 166 // If true, only include visible (physically connected or in-range) | |
| 167 // networks. Defaults to 'false'. | |
| 168 boolean? visible; | |
| 169 | |
| 170 // If true, only include configured (saved) networks. Defaults to 'false'. | |
| 171 boolean? configured; | |
| 172 | |
| 173 // Maximum number of networks to return. Defaults to 1000. Use 0 for no | |
| 174 // limit. | |
| 175 long? limit; | |
| 176 }; | |
| 177 | |
| 178 callback VoidCallback = void(); | |
| 179 callback BooleanCallback = void(boolean result); | |
| 180 callback StringCallback = void(DOMString result); | |
| 181 // TODO(stevenjb): Use NetworkProperties for |result| once defined. | |
| 182 callback GetPropertiesCallback = void(object result); | |
| 183 // TODO(stevenjb): Use ManagedNetworkProperties for |result| once defined. | |
| 184 callback GetManagedPropertiesCallback = void(object result); | |
| 185 callback GetStatePropertiesCallback = void(NetworkStateProperties result); | |
| 186 callback GetNetworksCallback = void(NetworkStateProperties[] result); | |
| 187 callback GetEnabledNetwrokTypesCallback = void(NetworkType[] result); | |
| 188 callback CaptivePortalStatusCallback = void(CaptivePortalStatus result); | |
| 189 | |
| 190 // These functions all report failures via chrome.runtime.lastError. | |
| 191 interface Functions { | |
| 192 // Gets all the properties of the network with id networkGuid. Includes all | |
| 193 // properties of the network (read-only and read/write values). | |
| 194 // |networkGuid|: The identifier of the network to get properties for. | |
| 195 // |callback|: Returns the properties of the network. | |
| 196 static void getProperties(DOMString networkGuid, | |
| 197 GetPropertiesCallback callback); | |
| 198 | |
| 199 // Gets the merged properties of the network with id networkGuid from the | |
| 200 // sources: User settings, shared settings, user policy, device policy and | |
| 201 // the currently active settings. | |
| 202 // |networkGuid|: The identifier of the network to get properties for. | |
| 203 // |callback|: Returns the managed properties of the network. | |
| 204 static void getManagedProperties(DOMString networkGuid, | |
| 205 GetManagedPropertiesCallback callback); | |
| 206 | |
| 207 // Gets the cached read-only properties of the network with id networkGuid. | |
| 208 // This is meant to be a higher performance function than getProperties, | |
| 209 // which requires a round trip to query the networking subsystem. The | |
| 210 // following properties are returned for all networks: GUID, Type, Name, | |
| 211 // WiFi.Security. Additional properties are provided for visible networks: | |
| 212 // ConnectionState, ErrorState, WiFi.SignalStrength, | |
| 213 // Cellular.NetworkTechnology, Cellular.ActivationState, | |
| 214 // Cellular.RoamingState, Cellular.OutOfCredits. | |
| 215 // |networkGuid|: The identifier of the network to get properties for. | |
| 216 // |callback|: Returns the managed properties of the network. | |
| 217 static void getState(DOMString networkGuid, | |
| 218 GetStatePropertiesCallback callback); | |
| 219 | |
| 220 // Sets the properties of the network with id networkGuid. | |
| 221 // |networkGuid|: The identifier of the network to set properties for. | |
| 222 // |properties|: The ONC properties to set. | |
| 223 // |callback|: Called when the operation has completed. | |
| 224 static void setProperties(DOMString networkGuid, | |
| 225 NetworkConfigProperties properties, | |
| 226 optional VoidCallback callback); | |
| 227 | |
| 228 // Creates a new network configuration from properties. If a matching | |
| 229 // configured network already exists, this will fail. Otherwise returns the | |
| 230 // guid of the new network. | |
| 231 // |shared|: If true, share this network configuration with other users. | |
| 232 // |properties|: The ONC properties to configure the new network with. | |
| 233 // |callback|: Returns the identifier of the created network. | |
| 234 static void createNetwork(boolean shared, | |
| 235 NetworkConfigProperties properties, | |
| 236 optional StringCallback callback); | |
| 237 | |
| 238 // Returns a list of network objects with the same properties provided by | |
| 239 // getState. A filter is provided to specify the type of networks returned | |
| 240 // and to limit the number of networks. Networks are ordered by the system | |
| 241 // based on their priority, with connected or connecting networks listed | |
| 242 // first. static void getNetworks(); | |
| 243 // |filter|: Describes which networks to return. | |
| 244 // |callback|: Returns the network state properties. | |
| 245 static void getNetworks(NetworkFilter filter, | |
| 246 GetNetworksCallback callback); | |
| 247 | |
| 248 // Deprecated. Please use $(ref:networkingPrivate.getNetworks) with | |
| 249 // filter.visble = true instead. | |
| 250 [deprecated="Use getNetworks."] static void getVisibleNetworks( | |
| 251 NetworkType networkType, | |
| 252 GetNetworksCallback callback); | |
| 253 | |
| 254 // Returns a list of the enabled network types. Note: this only returns | |
| 255 // discrete types that can be enabled or disabled: Cellular, Ethernet, WiFi, | |
| 256 // Wimax. | |
| 257 static void getEnabledNetworkTypes(GetEnabledNetwrokTypesCallback callback); | |
| 258 | |
| 259 // Enable the specified network type. Note, the type might represent | |
| 260 // multiple network types (e.g. 'Wireless'). | |
| 261 static void enableNetworkType(NetworkType networkType); | |
| 262 | |
| 263 // Disable the specified network type. See note for | |
| 264 // $(ref:networkingPrivate.enableNetworkType). | |
| 265 static void disableNetworkType(NetworkType networkType); | |
| 266 | |
| 267 // Requests that the networking subsystem scan for new networks and | |
| 268 // update the list returned by getVisibleNetworks. This is only a | |
| 269 // request: the network subsystem can choose to ignore it. If the list | |
| 270 // is updated, then the onNetworkListChanged event will be fired. | |
| 271 static void requestNetworkScan(); | |
| 272 | |
| 273 // Starts a connection to the network with networkGuid. | |
| 274 // |networkGuid|: The identifier of the network to connect to. | |
| 275 static void startConnect(DOMString networkGuid, | |
| 276 optional VoidCallback callback); | |
| 277 | |
| 278 // Starts a disconnect from the network with networkGuid. | |
| 279 // |networkGuid|: The identifier of the network to disconnect from. | |
| 280 static void startDisconnect(DOMString networkGuid, | |
| 281 optional VoidCallback callback); | |
| 282 | |
| 283 // Starts activation of the Cellular network with networkGuid. | |
| 284 // |networkGuid|: The identifier of the Cellular network to activate. | |
| 285 // |carrier|: Optional name of carrier to activate. | |
| 286 static void startActivate(DOMString networkGuid, | |
| 287 optional DOMString carrier, | |
| 288 optional VoidCallback callback); | |
| 289 | |
| 290 // Verifies that the device is a trusted device. | |
| 291 // |properties|: Properties of the destination to use in verifying that it | |
| 292 // is a trusted device. | |
| 293 // |callback|: A callback function that indicates whether or not the device | |
| 294 // is a trusted device. | |
| 295 static void verifyDestination(VerificationProperties properties, | |
| 296 BooleanCallback callback); | |
| 297 | |
| 298 // Verifies that the device is a trusted device and retrieves encrypted | |
| 299 // network credentials. | |
| 300 // |properties|: Properties of the destination to use in verifying that it | |
| 301 // is a trusted device. | |
| 302 // |networkGuid|: The identifier of the Cellular network to activate. | |
| 303 // |callback|: A callback function that receives base64-encoded encrypted | |
| 304 // credential data to send to a trusted device. | |
| 305 static void verifyAndEncryptCredentials(VerificationProperties properties, | |
| 306 DOMString networkGuid, | |
| 307 StringCallback callback); | |
| 308 | |
| 309 // Verifies that the device is a trusted device and encrypts supplied | |
| 310 // data with device public key. | |
| 311 // |properties|: Properties of the destination to use in verifying that it | |
| 312 // is a trusted device. | |
| 313 // |data|: A string containing the base64-encoded data to encrypt. | |
| 314 // |callback|: A callback function that receives base64-encoded encrypted | |
| 315 // data to send to a trusted device. | |
| 316 static void verifyAndEncryptData(VerificationProperties properties, | |
| 317 DOMString data, | |
| 318 StringCallback callback); | |
| 319 | |
| 320 // Enables TDLS for wifi traffic with a specified peer if available. | |
| 321 // |ip_or_mac_address|: The IP or MAC address of the peer with which to | |
| 322 // enable a TDLS connection. | |
| 323 // |enabled| If true, enable TDLS, otherwise disable TDLS. | |
| 324 // |calback|: A callback function that receives a string with an error or | |
| 325 // the current TDLS status. 'Failed' indicates that the request failed | |
| 326 // (e.g. MAC address lookup failed). 'Timeout' indicates that the lookup | |
| 327 // timed out. Otherwise a valid status is returned (see | |
| 328 // getWifiTDLSStatus). | |
| 329 static void setWifiTDLSEnabledState(DOMString ip_or_mac_address, | |
| 330 boolean enabled, | |
| 331 StringCallback callback); | |
| 332 | |
| 333 // Returns the current TDLS status for the specified peer. | |
| 334 // |ip_or_mac_address|: The IP or MAC address of the peer. | |
| 335 // |calback|: A callback function that receives a string with the current | |
| 336 // TDLS status which can be 'Connected', 'Disabled', 'Disconnected', | |
| 337 // 'Nonexistent', or 'Unknown'. | |
| 338 static void getWifiTDLSStatus(DOMString ip_or_mac_address, | |
| 339 StringCallback callback); | |
| 340 | |
| 341 // Returns captive portal status for the network matching 'guid'. | |
| 342 // |networkGuid|: The identifier of the network to get the captive portal | |
| 343 // status for. | |
| 344 // |calback|: Results of the query for network captive portal status. | |
| 345 static void getCaptivePortalStatus(DOMString networkGuid, | |
| 346 CaptivePortalStatusCallback callback); | |
| 347 }; | |
| 348 | |
| 349 interface Events { | |
| 350 // Fired when the properties change on any of the networks. Sends a list of | |
| 351 // identifiers for networks whose properties have changed. | |
| 352 static void onNetworksChanged(DOMString[] changes); | |
| 353 | |
| 354 // Fired when the list of networks has changed. Sends a complete list of | |
| 355 // identifiers for all the current networks. | |
| 356 static void onNetworkListChanged(DOMString[] changes); | |
| 357 | |
| 358 // Fired when a portal detection for a network completes. Sends the guid of | |
| 359 // the network and the corresponding captive portal status. | |
| 360 static void onPortalDetectionCompleted(DOMString networkGuid, | |
| 361 CaptivePortalStatus status); | |
| 362 }; | |
| 363 }; | |
| OLD | NEW |