Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // The <code>chrome.networkingPrivate</code> API is used for configuring | 5 // The <code>chrome.networkingPrivate</code> API is used for configuring |
| 6 // network connections (Cellular, Ethernet, VPN, WiFi or WiMAX). This private | 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 | 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 | 8 // primary user. See the Open Network Configuration (ONC) documentation for |
| 9 // descriptions of properties: | 9 // descriptions of properties: |
| 10 // src/components/onc/docs/onc_spec.html, also available at | 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 | 11 // http://www.chromium.org/chromium-os/chromiumos-design-docs/open-network-confi guration |
|
pneubeck (no reviews)
2015/03/27 19:13:43
please check what the notation for urls was
stevenjb
2015/03/27 22:11:14
Done.
| |
| 12 // | |
| 13 // NOTE: Most dictionary properties and enum values use UpperCamelCase to match | |
| 14 // the ONC spec instead of the JavaScript lowerCamelCase convention. | |
| 15 // | |
| 16 // "State" properties describe just the ONC properties returned by | |
|
pneubeck (no reviews)
2015/03/27 19:13:43
an alternative naming scheme to StateProperties vs
stevenjb
2015/03/27 22:11:15
I think I prefer the 'Properties'. It makes it a l
| |
| 17 // $(ref:networkingPrivate.getState) and $(ref:networkingPrivate.getNetworks). | |
| 18 // | |
| 19 // "Config" properties describe just the ONC properties that can be configured | |
|
pneubeck (no reviews)
2015/03/27 19:13:43
we'll really have to add the dictionary inheritanc
stevenjb
2015/03/27 22:11:15
We should discuss this at some point, but it fact
| |
| 20 // through this API. NOTE: Not all configuration propertes are exposed at this | |
|
pneubeck (no reviews)
2015/03/27 19:13:43
propertes -> properties
stevenjb
2015/03/27 22:11:14
Done.
| |
| 21 // time, only those currently required by the Chrome Settings UI. | |
| 22 // TODO(stevenjb): Provide all configuration properties and types, | |
| 23 // crbug.com/380937. | |
| 24 // | |
| 12 // TODO(stevenjb/pneubeck): Merge the ONC documentation with this document and | 25 // TODO(stevenjb/pneubeck): Merge the ONC documentation with this document and |
| 13 // use it as the ONC specification. | 26 // use it as the ONC specification. |
| 14 | 27 |
| 15 namespace networkingPrivate { | 28 namespace networkingPrivate { |
| 29 enum ActivationStateType { | |
| 30 Activated, Activating, NotActivated, PartiallyActivated | |
| 31 }; | |
| 32 | |
| 16 enum CaptivePortalStatus { | 33 enum CaptivePortalStatus { |
| 17 Unknown, Offline, Online, Portal, ProxyAuthRequired | 34 Unknown, Offline, Online, Portal, ProxyAuthRequired |
| 18 }; | 35 }; |
| 19 | 36 |
| 37 enum ConnectionStateType { | |
| 38 Connected, Connecting, NotConnected | |
| 39 }; | |
| 40 | |
| 41 enum IPConfigType { | |
| 42 DHCP, Static | |
| 43 }; | |
| 44 | |
| 20 enum NetworkType { | 45 enum NetworkType { |
| 21 All, Bluetooth, Cellular, Ethernet, VPN, Wireless, WiFi, WiMAX | 46 All, Bluetooth, Cellular, Ethernet, VPN, Wireless, WiFi, WiMAX |
| 22 }; | 47 }; |
| 23 | 48 |
| 49 dictionary APNProperties { | |
|
pneubeck (no reviews)
2015/03/27 19:13:43
neither Config* nor StateProperties
but this is ma
stevenjb
2015/03/27 22:11:15
For sub-dictionaries that can be used in either I
| |
| 50 DOMString? AccessPointName; | |
| 51 DOMString? Language; | |
| 52 DOMString? LocalizedName; | |
| 53 DOMString? Name; | |
| 54 DOMString? Password; | |
| 55 DOMString? Username; | |
| 56 }; | |
| 57 | |
| 58 dictionary CellularConfigProperties { | |
| 59 boolean? AutoConnect; | |
| 60 APNProperties? APN; | |
| 61 }; | |
| 62 | |
| 63 dictionary CellularStateProperties { | |
| 64 ActivationStateType? ActivationState; | |
| 65 DOMString? NetworkTechnology; | |
| 66 boolean? OutOfCredits; | |
|
pneubeck (no reviews)
2015/03/27 19:13:43
can't find this in onc_signature.cc nor onc_spec
stevenjb
2015/03/27 22:11:15
Looks like we don't translate it. I think we used
| |
| 67 DOMString? RoamingState; | |
| 68 long? SignalStrength; | |
| 69 }; | |
| 70 | |
| 71 dictionary EthernetStateProperties { | |
| 72 DOMString? Authentication; | |
|
pneubeck (no reviews)
2015/03/27 19:13:44
mandatory
stevenjb
2015/03/27 22:11:15
Done.
| |
| 73 }; | |
| 74 | |
| 75 dictionary IPConfigProperties { | |
|
pneubeck (no reviews)
2015/03/27 19:13:43
neither Config* nor StateProperties
but this is ma
stevenjb
2015/03/27 22:11:15
Yeah, "IPConfig" is unfortunately named. I think w
| |
| 76 DOMString? Gateway; | |
| 77 DOMString? IPAddress; | |
| 78 DOMString[]? NameServers; | |
| 79 long? RoutingPrefix; | |
| 80 DOMString? Type; | |
| 81 DOMString? WebProxyAutoDiscoveryUrl; | |
| 82 }; | |
| 83 | |
| 84 dictionary IPSecProperties { | |
|
pneubeck (no reviews)
2015/03/27 19:13:44
neither Config* nor StateProperties
but this is ma
stevenjb
2015/03/27 22:11:15
Also on purpose.
| |
| 85 DOMString? AuthenticationType; | |
|
pneubeck (no reviews)
2015/03/27 19:13:44
mandatory in state
stevenjb
2015/03/27 22:11:15
Done.
| |
| 86 }; | |
| 87 | |
| 88 dictionary ThirdPartyVPNProperties { | |
|
pneubeck (no reviews)
2015/03/27 19:13:44
neither Config* nor StateProperties
but this is ma
stevenjb
2015/03/27 22:11:14
Correct.
| |
| 89 DOMString ExtensionID; | |
| 90 }; | |
| 91 | |
| 92 dictionary VPNConfigProperties { | |
| 93 boolean? AutoConnect; | |
| 94 DOMString? Host; | |
| 95 ThirdPartyVPNProperties? ThirdPartyVPN; | |
| 96 DOMString? Type; | |
| 97 }; | |
| 98 | |
| 99 dictionary VPNStateProperties { | |
| 100 DOMString? Type; | |
|
pneubeck (no reviews)
2015/03/27 19:13:43
mandatory
stevenjb
2015/03/27 22:11:15
Done.
| |
| 101 IPSecProperties? IPsec; | |
| 102 ThirdPartyVPNProperties? ThirdPartyVPN; | |
| 103 }; | |
| 104 | |
| 105 dictionary WiFiConfigProperties { | |
| 106 boolean? AutoConnect; | |
| 107 DOMString? HexSSID; | |
| 108 DOMString? HiddenSSID; | |
|
pneubeck (no reviews)
2015/03/27 19:13:43
must be bool not string
stevenjb
2015/03/27 22:11:14
Oops. Done.
| |
| 109 DOMString? Passphrase; | |
| 110 DOMString? SSID; | |
| 111 DOMString? Security; | |
| 112 }; | |
| 113 | |
| 114 dictionary WiFiStateProperties { | |
| 115 DOMString? Security; | |
|
pneubeck (no reviews)
2015/03/27 19:13:43
mandatory
stevenjb
2015/03/27 22:11:15
Done.
| |
| 116 long? SignalStrength; | |
|
pneubeck (no reviews)
2015/03/27 19:13:44
wasn't this always set, i.e. 0 for not-visible
the
stevenjb
2015/03/27 22:11:15
Actually, for non-visible networks we don't provid
| |
| 117 }; | |
| 118 | |
| 119 dictionary WiMaxConfigProperties { | |
| 120 boolean? AutoConnect; | |
| 121 }; | |
| 122 | |
| 123 dictionary WiMAXStateProperties { | |
| 124 long? SignalStrength; | |
|
pneubeck (no reviews)
2015/03/27 19:13:44
same as for wifi
stevenjb
2015/03/27 22:11:15
Ditto.
| |
| 125 }; | |
| 126 | |
| 127 dictionary NetworkConfigProperties { | |
| 128 CellularConfigProperties? Cellular; | |
| 129 DOMString? GUID; | |
| 130 IPConfigType? IPAddressConfigType; | |
| 131 DOMString? Name; | |
| 132 IPConfigType? NameServersConfigType; | |
| 133 long? Priority; | |
| 134 IPConfigProperties? StaticIPConfig; | |
| 135 NetworkType? Type; | |
| 136 VPNConfigProperties? VPN; | |
| 137 WiFiConfigProperties? WiFi; | |
| 138 WiMaxConfigProperties? WiMAX; | |
| 139 }; | |
| 140 | |
| 141 dictionary NetworkStateProperties { | |
| 142 CellularStateProperties? Cellular; | |
| 143 boolean? Connectable; | |
| 144 ConnectionStateType? ConnectionState; | |
| 145 EthernetStateProperties? Ethernet; | |
| 146 DOMString? ErrorState; | |
| 147 DOMString GUID; | |
| 148 DOMString? Name; | |
| 149 long? Priority; | |
| 150 DOMString? Source; | |
| 151 NetworkType Type; | |
| 152 VPNStateProperties? VPN; | |
| 153 WiFiStateProperties? WiFi; | |
| 154 WiMAXStateProperties? WiMAX; | |
| 155 }; | |
| 156 | |
| 24 dictionary VerificationProperties { | 157 dictionary VerificationProperties { |
| 25 // A string containing a PEM-encoded (including the 'BEGIN CERTIFICATE' | 158 // A string containing a PEM-encoded (including the 'BEGIN CERTIFICATE' |
| 26 // header and 'END CERTIFICATE' footer) X.509 certificate for use in | 159 // header and 'END CERTIFICATE' footer) X.509 certificate for use in |
| 27 // verifying the signed data. | 160 // verifying the signed data. |
| 28 DOMString certificate; | 161 DOMString certificate; |
| 29 | 162 |
| 30 // An array of PEM-encoded X.509 intermediate certificate authority | 163 // An array of PEM-encoded X.509 intermediate certificate authority |
| 31 // certificates. Each PEM-encoded certificate is expected to have the | 164 // certificates. Each PEM-encoded certificate is expected to have the |
| 32 // 'BEGIN CERTIFICATE' header and 'END CERTIFICATE' footer. | 165 // 'BEGIN CERTIFICATE' header and 'END CERTIFICATE' footer. |
| 33 DOMString[]? intermediateCertificates; | 166 DOMString[]? intermediateCertificates; |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 72 long? limit; | 205 long? limit; |
| 73 }; | 206 }; |
| 74 | 207 |
| 75 callback VoidCallback = void(); | 208 callback VoidCallback = void(); |
| 76 callback BooleanCallback = void(boolean result); | 209 callback BooleanCallback = void(boolean result); |
| 77 callback StringCallback = void(DOMString result); | 210 callback StringCallback = void(DOMString result); |
| 78 // TODO(stevenjb): Use NetworkProperties for |result| once defined. | 211 // TODO(stevenjb): Use NetworkProperties for |result| once defined. |
| 79 callback GetPropertiesCallback = void(object result); | 212 callback GetPropertiesCallback = void(object result); |
| 80 // TODO(stevenjb): Use ManagedNetworkProperties for |result| once defined. | 213 // TODO(stevenjb): Use ManagedNetworkProperties for |result| once defined. |
| 81 callback GetManagedPropertiesCallback = void(object result); | 214 callback GetManagedPropertiesCallback = void(object result); |
| 82 callback GetStatePropertiesCallback = void(object result); | 215 callback GetStatePropertiesCallback = void(NetworkStateProperties result); |
| 83 callback GetNetworksCallback = void(object[] result); | 216 callback GetNetworksCallback = void(NetworkStateProperties[] result); |
| 84 callback GetEnabledNetworkTypesCallback = void(NetworkType[] result); | 217 callback GetEnabledNetworkTypesCallback = void(NetworkType[] result); |
| 85 callback CaptivePortalStatusCallback = void(CaptivePortalStatus result); | 218 callback CaptivePortalStatusCallback = void(CaptivePortalStatus result); |
| 86 | 219 |
| 87 // These functions all report failures via chrome.runtime.lastError. | 220 // These functions all report failures via chrome.runtime.lastError. |
| 88 interface Functions { | 221 interface Functions { |
| 89 // Gets all the properties of the network with id networkGuid. Includes all | 222 // Gets all the properties of the network with id networkGuid. Includes all |
| 90 // properties of the network (read-only and read/write values). | 223 // properties of the network (read-only and read/write values). |
| 91 // |networkGuid|: The identifier of the network to get properties for. | 224 // |networkGuid|: The identifier of the network to get properties for. |
| 92 // |callback|: Returns the properties of the network. | 225 // |callback|: Returns the properties of the network. |
| 93 static void getProperties(DOMString networkGuid, | 226 static void getProperties(DOMString networkGuid, |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 112 // |networkGuid|: The identifier of the network to get properties for. | 245 // |networkGuid|: The identifier of the network to get properties for. |
| 113 // |callback|: Returns the managed properties of the network. | 246 // |callback|: Returns the managed properties of the network. |
| 114 static void getState(DOMString networkGuid, | 247 static void getState(DOMString networkGuid, |
| 115 GetStatePropertiesCallback callback); | 248 GetStatePropertiesCallback callback); |
| 116 | 249 |
| 117 // Sets the properties of the network with id networkGuid. | 250 // Sets the properties of the network with id networkGuid. |
| 118 // |networkGuid|: The identifier of the network to set properties for. | 251 // |networkGuid|: The identifier of the network to set properties for. |
| 119 // |properties|: The ONC properties to set. | 252 // |properties|: The ONC properties to set. |
| 120 // |callback|: Called when the operation has completed. | 253 // |callback|: Called when the operation has completed. |
| 121 static void setProperties(DOMString networkGuid, | 254 static void setProperties(DOMString networkGuid, |
| 122 object properties, | 255 NetworkConfigProperties properties, |
| 123 optional VoidCallback callback); | 256 optional VoidCallback callback); |
| 124 | 257 |
| 125 // Creates a new network configuration from properties. If a matching | 258 // Creates a new network configuration from properties. If a matching |
| 126 // configured network already exists, this will fail. Otherwise returns the | 259 // configured network already exists, this will fail. Otherwise returns the |
| 127 // guid of the new network. | 260 // guid of the new network. |
| 128 // |shared|: If true, share this network configuration with other users. | 261 // |shared|: If true, share this network configuration with other users. |
| 129 // |properties|: The ONC properties to configure the new network with. | 262 // |properties|: The ONC properties to configure the new network with. |
| 130 // |callback|: Returns the identifier of the created network. | 263 // |callback|: Returns the identifier of the created network. |
| 131 static void createNetwork(boolean shared, | 264 static void createNetwork(boolean shared, |
| 132 object properties, | 265 NetworkConfigProperties properties, |
| 133 optional StringCallback callback); | 266 optional StringCallback callback); |
| 134 | 267 |
| 135 // Forgets a network configuration by clearing any configured properties for | 268 // Forgets a network configuration by clearing any configured properties for |
| 136 // the network with GUID 'networkGuid'. This may also include any other | 269 // the network with GUID 'networkGuid'. This may also include any other |
| 137 // networks with matching identifiers (e.g. WiFi SSID and Security). If no | 270 // 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 | 271 // such configuration exists, an error will be set and the operation will |
| 139 // fail. | 272 // fail. |
| 140 static void forgetNetwork(DOMString networkGuid, | 273 static void forgetNetwork(DOMString networkGuid, |
| 141 optional VoidCallback callback); | 274 optional VoidCallback callback); |
| 142 | 275 |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 259 // Fired when the list of networks has changed. Sends a complete list of | 392 // Fired when the list of networks has changed. Sends a complete list of |
| 260 // identifiers for all the current networks. | 393 // identifiers for all the current networks. |
| 261 static void onNetworkListChanged(DOMString[] changes); | 394 static void onNetworkListChanged(DOMString[] changes); |
| 262 | 395 |
| 263 // Fired when a portal detection for a network completes. Sends the guid of | 396 // Fired when a portal detection for a network completes. Sends the guid of |
| 264 // the network and the corresponding captive portal status. | 397 // the network and the corresponding captive portal status. |
| 265 static void onPortalDetectionCompleted(DOMString networkGuid, | 398 static void onPortalDetectionCompleted(DOMString networkGuid, |
| 266 CaptivePortalStatus status); | 399 CaptivePortalStatus status); |
| 267 }; | 400 }; |
| 268 }; | 401 }; |
| OLD | NEW |