Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2015 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 // The <code>chrome.networkingPrivate</code> API is used for configuring | |
| 6 // network connections (Cellular, Ethernet, VPN, WiFi or WiMAX). This private | |
| 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. | |
|
asargent_no_longer_on_chrome
2015/03/26 19:57:09
Is there a pointer to the ONC documentation you ca
stevenjb
2015/03/27 16:59:14
Done.
| |
| 11 | |
| 12 namespace networkingPrivate { | |
| 13 enum CaptivePortalStatus { | |
| 14 Unknown, Offline, Online, Portal, ProxyAuthRequired | |
| 15 }; | |
| 16 | |
| 17 enum NetworkType { | |
| 18 All, Bluetooth, Cellular, Ethernet, VPN, Wireless, WiFi, WiMAX | |
| 19 }; | |
| 20 | |
| 21 dictionary VerificationProperties { | |
| 22 // A string containing a PEM-encoded (including the 'BEGIN CERTIFICATE' | |
| 23 // header and 'END CERTIFICATE' footer) X.509 certificate for use in | |
| 24 // verifying the signed data. | |
| 25 DOMString certificate; | |
| 26 | |
| 27 // An array of PEM-encoded X.509 intermediate certificate authority | |
| 28 // certificates. Each PEM-encoded certificate is expected to have the | |
| 29 // 'BEGIN CERTIFICATE' header and 'END CERTIFICATE' footer. | |
| 30 DOMString[]? intermediateCertificates; | |
| 31 | |
| 32 // A string containing a Base64-encoded RSAPublicKey ASN.1 structure, | |
| 33 // representing the public key to be used by verifyAndEncryptCredentials and | |
| 34 // verifyAndEncryptData methods. | |
| 35 DOMString publicKey; | |
| 36 | |
| 37 // A string containing a base64-encoded random binary data for use in | |
| 38 // verifying the signed data. | |
| 39 DOMString nonce; | |
| 40 | |
| 41 // A string containing the identifying data string signed by the device. | |
| 42 DOMString signedData; | |
| 43 | |
| 44 // A string containing the serial number of the device. | |
| 45 DOMString deviceSerial; | |
| 46 | |
| 47 // A string containing the SSID of the device. Should be empty for new | |
| 48 // configurations. | |
| 49 DOMString deviceSsid; | |
| 50 | |
| 51 // A string containing the BSSID of the device. Should be empty for new | |
| 52 // configurations. | |
| 53 DOMString deviceBssid; | |
| 54 }; | |
| 55 | |
| 56 dictionary NetworkFilter { | |
| 57 // The type of networks to return. | |
| 58 NetworkType networkType; | |
| 59 | |
| 60 // If true, only include visible (physically connected or in-range) | |
| 61 // networks. Defaults to 'false'. | |
| 62 boolean? visible; | |
| 63 | |
| 64 // If true, only include configured (saved) networks. Defaults to 'false'. | |
| 65 boolean? configured; | |
| 66 | |
| 67 // Maximum number of networks to return. Defaults to 1000. Use 0 for no | |
| 68 // limit. | |
|
asargent_no_longer_on_chrome
2015/03/26 19:57:08
it might be worth mentioning if leaving limit unde
stevenjb
2015/03/27 16:59:14
Done.
| |
| 69 long? limit; | |
| 70 }; | |
| 71 | |
| 72 callback VoidCallback = void(); | |
| 73 callback BooleanCallback = void(boolean result); | |
| 74 callback StringCallback = void(DOMString result); | |
| 75 // TODO(stevenjb): Use NetworkProperties for |result| once defined. | |
| 76 callback GetPropertiesCallback = void(object result); | |
| 77 // TODO(stevenjb): Use ManagedNetworkProperties for |result| once defined. | |
| 78 callback GetManagedPropertiesCallback = void(object result); | |
| 79 callback GetStatePropertiesCallback = void(object result); | |
| 80 callback GetNetworksCallback = void(object[] result); | |
| 81 callback GetEnabledNetwrokTypesCallback = void(NetworkType[] result); | |
|
asargent_no_longer_on_chrome
2015/03/26 19:57:08
typo: "..Netwrok.."
stevenjb
2015/03/27 16:59:14
Done.
| |
| 82 callback CaptivePortalStatusCallback = void(CaptivePortalStatus result); | |
| 83 | |
| 84 // These functions all report failures via chrome.runtime.lastError. | |
| 85 interface Functions { | |
| 86 // Gets all the properties of the network with id networkGuid. Includes all | |
| 87 // properties of the network (read-only and read/write values). | |
| 88 // |networkGuid|: The identifier of the network to get properties for. | |
| 89 // |callback|: Returns the properties of the network. | |
| 90 static void getProperties(DOMString networkGuid, | |
| 91 GetPropertiesCallback callback); | |
| 92 | |
| 93 // Gets the merged properties of the network with id networkGuid from the | |
| 94 // sources: User settings, shared settings, user policy, device policy and | |
| 95 // the currently active settings. | |
| 96 // |networkGuid|: The identifier of the network to get properties for. | |
| 97 // |callback|: Returns the managed properties of the network. | |
| 98 static void getManagedProperties(DOMString networkGuid, | |
| 99 GetManagedPropertiesCallback callback); | |
| 100 | |
| 101 // Gets the cached read-only properties of the network with id networkGuid. | |
| 102 // This is meant to be a higher performance function than getProperties, | |
| 103 // which requires a round trip to query the networking subsystem. The | |
| 104 // following properties are returned for all networks: GUID, Type, Name, | |
| 105 // WiFi.Security. Additional properties are provided for visible networks: | |
| 106 // ConnectionState, ErrorState, WiFi.SignalStrength, | |
| 107 // Cellular.NetworkTechnology, Cellular.ActivationState, | |
| 108 // Cellular.RoamingState, Cellular.OutOfCredits. | |
| 109 // |networkGuid|: The identifier of the network to get properties for. | |
| 110 // |callback|: Returns the managed properties of the network. | |
| 111 static void getState(DOMString networkGuid, | |
| 112 GetStatePropertiesCallback callback); | |
| 113 | |
| 114 // Sets the properties of the network with id networkGuid. | |
| 115 // |networkGuid|: The identifier of the network to set properties for. | |
| 116 // |properties|: The ONC properties to set. | |
| 117 // |callback|: Called when the operation has completed. | |
| 118 static void setProperties(DOMString networkGuid, | |
| 119 object properties, | |
| 120 optional VoidCallback callback); | |
| 121 | |
| 122 // Creates a new network configuration from properties. If a matching | |
| 123 // configured network already exists, this will fail. Otherwise returns the | |
| 124 // guid of the new network. | |
| 125 // |shared|: If true, share this network configuration with other users. | |
| 126 // |properties|: The ONC properties to configure the new network with. | |
| 127 // |callback|: Returns the identifier of the created network. | |
| 128 static void createNetwork(boolean shared, | |
| 129 object properties, | |
| 130 optional StringCallback callback); | |
| 131 | |
| 132 // Forgets a network configuration by clearing any configured properties for | |
| 133 // the network with GUID 'networkGuid'. This may also include any other | |
| 134 // networks with matching identifiers (e.g. WiFi SSID and Security). If no | |
| 135 // such configuration exists, an error will be set and the operation will | |
| 136 // fail. | |
| 137 static void forgetNetwork(DOMString networkGuid, | |
| 138 optional VoidCallback callback); | |
| 139 | |
| 140 // Returns a list of network objects with the same properties provided by | |
| 141 // getState. A filter is provided to specify the type of networks returned | |
|
asargent_no_longer_on_chrome
2015/03/26 19:57:08
Consider using "$(ref:networkingPrivate.getState)"
| |
| 142 // and to limit the number of networks. Networks are ordered by the system | |
| 143 // based on their priority, with connected or connecting networks listed | |
| 144 // first. static void getNetworks(); | |
|
asargent_no_longer_on_chrome
2015/03/26 19:57:08
Did you mean to leave "static void getNetworks();"
stevenjb
2015/03/27 16:59:14
Done.
| |
| 145 // |filter|: Describes which networks to return. | |
| 146 // |callback|: Returns the network state properties. | |
| 147 static void getNetworks(NetworkFilter filter, | |
| 148 GetNetworksCallback callback); | |
| 149 | |
| 150 // Deprecated. Please use $(ref:networkingPrivate.getNetworks) with | |
| 151 // filter.visble = true instead. | |
| 152 [deprecated="Use getNetworks."] static void getVisibleNetworks( | |
| 153 NetworkType networkType, | |
| 154 GetNetworksCallback callback); | |
| 155 | |
| 156 // Returns a list of the enabled network types. Note: this only returns | |
| 157 // discrete types that can be enabled or disabled: Cellular, Ethernet, WiFi, | |
| 158 // Wimax. | |
| 159 static void getEnabledNetworkTypes(GetEnabledNetwrokTypesCallback callback); | |
| 160 | |
| 161 // Enable the specified network type. Note, the type might represent | |
| 162 // multiple network types (e.g. 'Wireless'). | |
| 163 static void enableNetworkType(NetworkType networkType); | |
| 164 | |
| 165 // Disable the specified network type. See note for | |
| 166 // $(ref:networkingPrivate.enableNetworkType). | |
| 167 static void disableNetworkType(NetworkType networkType); | |
| 168 | |
| 169 // Requests that the networking subsystem scan for new networks and | |
| 170 // update the list returned by getVisibleNetworks. This is only a | |
| 171 // request: the network subsystem can choose to ignore it. If the list | |
| 172 // is updated, then the onNetworkListChanged event will be fired. | |
| 173 static void requestNetworkScan(); | |
| 174 | |
| 175 // Starts a connection to the network with networkGuid. | |
| 176 // |networkGuid|: The identifier of the network to connect to. | |
| 177 static void startConnect(DOMString networkGuid, | |
| 178 optional VoidCallback callback); | |
| 179 | |
| 180 // Starts a disconnect from the network with networkGuid. | |
| 181 // |networkGuid|: The identifier of the network to disconnect from. | |
| 182 static void startDisconnect(DOMString networkGuid, | |
| 183 optional VoidCallback callback); | |
| 184 | |
| 185 // Starts activation of the Cellular network with networkGuid. | |
| 186 // |networkGuid|: The identifier of the Cellular network to activate. | |
| 187 // |carrier|: Optional name of carrier to activate. | |
| 188 static void startActivate(DOMString networkGuid, | |
| 189 optional DOMString carrier, | |
| 190 optional VoidCallback callback); | |
| 191 | |
| 192 // Verifies that the device is a trusted device. | |
| 193 // |properties|: Properties of the destination to use in verifying that it | |
| 194 // is a trusted device. | |
| 195 // |callback|: A callback function that indicates whether or not the device | |
| 196 // is a trusted device. | |
| 197 static void verifyDestination(VerificationProperties properties, | |
| 198 BooleanCallback callback); | |
| 199 | |
| 200 // Verifies that the device is a trusted device and retrieves encrypted | |
| 201 // network credentials. | |
| 202 // |properties|: Properties of the destination to use in verifying that it | |
| 203 // is a trusted device. | |
| 204 // |networkGuid|: The identifier of the Cellular network to activate. | |
| 205 // |callback|: A callback function that receives base64-encoded encrypted | |
| 206 // credential data to send to a trusted device. | |
| 207 static void verifyAndEncryptCredentials(VerificationProperties properties, | |
| 208 DOMString networkGuid, | |
| 209 StringCallback callback); | |
| 210 | |
| 211 // Verifies that the device is a trusted device and encrypts supplied | |
| 212 // data with device public key. | |
| 213 // |properties|: Properties of the destination to use in verifying that it | |
| 214 // is a trusted device. | |
| 215 // |data|: A string containing the base64-encoded data to encrypt. | |
| 216 // |callback|: A callback function that receives base64-encoded encrypted | |
| 217 // data to send to a trusted device. | |
| 218 static void verifyAndEncryptData(VerificationProperties properties, | |
| 219 DOMString data, | |
| 220 StringCallback callback); | |
| 221 | |
| 222 // Enables TDLS for wifi traffic with a specified peer if available. | |
| 223 // |ip_or_mac_address|: The IP or MAC address of the peer with which to | |
| 224 // enable a TDLS connection. | |
| 225 // |enabled| If true, enable TDLS, otherwise disable TDLS. | |
| 226 // |calback|: A callback function that receives a string with an error or | |
| 227 // the current TDLS status. 'Failed' indicates that the request failed | |
| 228 // (e.g. MAC address lookup failed). 'Timeout' indicates that the lookup | |
| 229 // timed out. Otherwise a valid status is returned (see | |
| 230 // getWifiTDLSStatus). | |
| 231 static void setWifiTDLSEnabledState(DOMString ip_or_mac_address, | |
| 232 boolean enabled, | |
| 233 StringCallback callback); | |
| 234 | |
| 235 // Returns the current TDLS status for the specified peer. | |
| 236 // |ip_or_mac_address|: The IP or MAC address of the peer. | |
| 237 // |calback|: A callback function that receives a string with the current | |
| 238 // TDLS status which can be 'Connected', 'Disabled', 'Disconnected', | |
| 239 // 'Nonexistent', or 'Unknown'. | |
| 240 static void getWifiTDLSStatus(DOMString ip_or_mac_address, | |
| 241 StringCallback callback); | |
| 242 | |
| 243 // Returns captive portal status for the network matching 'guid'. | |
| 244 // |networkGuid|: The identifier of the network to get the captive portal | |
| 245 // status for. | |
| 246 // |calback|: Results of the query for network captive portal status. | |
| 247 static void getCaptivePortalStatus(DOMString networkGuid, | |
| 248 CaptivePortalStatusCallback callback); | |
| 249 }; | |
| 250 | |
| 251 interface Events { | |
| 252 // Fired when the properties change on any of the networks. Sends a list of | |
| 253 // identifiers for networks whose properties have changed. | |
| 254 static void onNetworksChanged(DOMString[] changes); | |
| 255 | |
| 256 // Fired when the list of networks has changed. Sends a complete list of | |
| 257 // identifiers for all the current networks. | |
| 258 static void onNetworkListChanged(DOMString[] changes); | |
| 259 | |
| 260 // Fired when a portal detection for a network completes. Sends the guid of | |
| 261 // the network and the corresponding captive portal status. | |
| 262 static void onPortalDetectionCompleted(DOMString networkGuid, | |
| 263 CaptivePortalStatus status); | |
| 264 }; | |
| 265 }; | |
| OLD | NEW |