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