| 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 // <a href="https://code.google.com/p/chromium/codesearch#chromium/src/component
s/onc/docs/onc_spec.html"> | 10 // <a href="https://code.google.com/p/chromium/codesearch#chromium/src/component
s/onc/docs/onc_spec.html"> |
| 11 // src/components/onc/docs/onc_spec.html</a>, or the | 11 // src/components/onc/docs/onc_spec.html</a>, or the |
| 12 // <a href="http://www.chromium.org/chromium-os/chromiumos-design-docs/open-netw
ork-configuration"> | 12 // <a href="http://www.chromium.org/chromium-os/chromiumos-design-docs/open-netw
ork-configuration"> |
| 13 // Open Network Configuration</a> page at chromium.org. | 13 // Open Network Configuration</a> page at chromium.org. |
| 14 // | 14 // <br><br> |
| 15 // NOTE: Most dictionary properties and enum values use UpperCamelCase to match |
| 16 // the ONC spec instead of the JavaScript lowerCamelCase convention. |
| 17 // <br><br> |
| 18 // "State" properties describe just the ONC properties returned by |
| 19 // $(ref:networkingPrivate.getState) and $(ref:networkingPrivate.getNetworks). |
| 20 // <br><br> |
| 21 // "Config" properties describe just the ONC properties that can be configured |
| 22 // through this API. NOTE: Not all configuration properties are exposed at this |
| 23 // time, only those currently required by the Chrome Settings UI. |
| 24 // TODO(stevenjb): Provide all configuration properties and types, |
| 25 // crbug.com/380937. |
| 26 // <br><br> |
| 15 // TODO(stevenjb/pneubeck): Merge the ONC documentation with this document and | 27 // TODO(stevenjb/pneubeck): Merge the ONC documentation with this document and |
| 16 // use it as the ONC specification. | 28 // use it as the ONC specification. |
| 17 | 29 |
| 18 namespace networkingPrivate { | 30 namespace networkingPrivate { |
| 31 enum ActivationStateType { |
| 32 Activated, Activating, NotActivated, PartiallyActivated |
| 33 }; |
| 34 |
| 19 enum CaptivePortalStatus { | 35 enum CaptivePortalStatus { |
| 20 Unknown, Offline, Online, Portal, ProxyAuthRequired | 36 Unknown, Offline, Online, Portal, ProxyAuthRequired |
| 21 }; | 37 }; |
| 22 | 38 |
| 39 enum ConnectionStateType { |
| 40 Connected, Connecting, NotConnected |
| 41 }; |
| 42 |
| 43 enum IPConfigType { |
| 44 DHCP, Static |
| 45 }; |
| 46 |
| 23 enum NetworkType { | 47 enum NetworkType { |
| 24 All, Bluetooth, Cellular, Ethernet, VPN, Wireless, WiFi, WiMAX | 48 All, Bluetooth, Cellular, Ethernet, VPN, Wireless, WiFi, WiMAX |
| 25 }; | 49 }; |
| 26 | 50 |
| 51 dictionary APNProperties { |
| 52 DOMString? AccessPointName; |
| 53 DOMString? Language; |
| 54 DOMString? LocalizedName; |
| 55 DOMString? Name; |
| 56 DOMString? Password; |
| 57 DOMString? Username; |
| 58 }; |
| 59 |
| 60 dictionary CellularConfigProperties { |
| 61 boolean? AutoConnect; |
| 62 APNProperties? APN; |
| 63 }; |
| 64 |
| 65 dictionary CellularStateProperties { |
| 66 ActivationStateType? ActivationState; |
| 67 DOMString? NetworkTechnology; |
| 68 DOMString? RoamingState; |
| 69 long? SignalStrength; |
| 70 }; |
| 71 |
| 72 dictionary EthernetStateProperties { |
| 73 DOMString Authentication; |
| 74 }; |
| 75 |
| 76 dictionary IPConfigProperties { |
| 77 DOMString? Gateway; |
| 78 DOMString? IPAddress; |
| 79 DOMString[]? NameServers; |
| 80 long? RoutingPrefix; |
| 81 DOMString? Type; |
| 82 DOMString? WebProxyAutoDiscoveryUrl; |
| 83 }; |
| 84 |
| 85 dictionary IPSecProperties { |
| 86 DOMString AuthenticationType; |
| 87 }; |
| 88 |
| 89 dictionary ThirdPartyVPNProperties { |
| 90 DOMString ExtensionID; |
| 91 }; |
| 92 |
| 93 dictionary VPNConfigProperties { |
| 94 boolean? AutoConnect; |
| 95 DOMString? Host; |
| 96 ThirdPartyVPNProperties? ThirdPartyVPN; |
| 97 DOMString? Type; |
| 98 }; |
| 99 |
| 100 dictionary VPNStateProperties { |
| 101 DOMString Type; |
| 102 IPSecProperties? IPsec; |
| 103 ThirdPartyVPNProperties? ThirdPartyVPN; |
| 104 }; |
| 105 |
| 106 dictionary WiFiConfigProperties { |
| 107 boolean? AutoConnect; |
| 108 DOMString? HexSSID; |
| 109 boolean? HiddenSSID; |
| 110 DOMString? Passphrase; |
| 111 DOMString? SSID; |
| 112 DOMString? Security; |
| 113 }; |
| 114 |
| 115 dictionary WiFiStateProperties { |
| 116 DOMString Security; |
| 117 long? SignalStrength; |
| 118 }; |
| 119 |
| 120 dictionary WiMaxConfigProperties { |
| 121 boolean? AutoConnect; |
| 122 }; |
| 123 |
| 124 dictionary WiMAXStateProperties { |
| 125 long? SignalStrength; |
| 126 }; |
| 127 |
| 128 dictionary NetworkConfigProperties { |
| 129 CellularConfigProperties? Cellular; |
| 130 DOMString? GUID; |
| 131 IPConfigType? IPAddressConfigType; |
| 132 DOMString? Name; |
| 133 IPConfigType? NameServersConfigType; |
| 134 long? Priority; |
| 135 IPConfigProperties? StaticIPConfig; |
| 136 NetworkType? Type; |
| 137 VPNConfigProperties? VPN; |
| 138 WiFiConfigProperties? WiFi; |
| 139 WiMaxConfigProperties? WiMAX; |
| 140 }; |
| 141 |
| 142 dictionary NetworkStateProperties { |
| 143 CellularStateProperties? Cellular; |
| 144 boolean? Connectable; |
| 145 ConnectionStateType? ConnectionState; |
| 146 EthernetStateProperties? Ethernet; |
| 147 DOMString? ErrorState; |
| 148 DOMString GUID; |
| 149 DOMString? Name; |
| 150 long? Priority; |
| 151 DOMString? Source; |
| 152 NetworkType Type; |
| 153 VPNStateProperties? VPN; |
| 154 WiFiStateProperties? WiFi; |
| 155 WiMAXStateProperties? WiMAX; |
| 156 }; |
| 157 |
| 27 dictionary VerificationProperties { | 158 dictionary VerificationProperties { |
| 28 // A string containing a PEM-encoded (including the 'BEGIN CERTIFICATE' | 159 // A string containing a PEM-encoded (including the 'BEGIN CERTIFICATE' |
| 29 // header and 'END CERTIFICATE' footer) X.509 certificate for use in | 160 // header and 'END CERTIFICATE' footer) X.509 certificate for use in |
| 30 // verifying the signed data. | 161 // verifying the signed data. |
| 31 DOMString certificate; | 162 DOMString certificate; |
| 32 | 163 |
| 33 // An array of PEM-encoded X.509 intermediate certificate authority | 164 // An array of PEM-encoded X.509 intermediate certificate authority |
| 34 // certificates. Each PEM-encoded certificate is expected to have the | 165 // certificates. Each PEM-encoded certificate is expected to have the |
| 35 // 'BEGIN CERTIFICATE' header and 'END CERTIFICATE' footer. | 166 // 'BEGIN CERTIFICATE' header and 'END CERTIFICATE' footer. |
| 36 DOMString[]? intermediateCertificates; | 167 DOMString[]? intermediateCertificates; |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 long? limit; | 207 long? limit; |
| 77 }; | 208 }; |
| 78 | 209 |
| 79 callback VoidCallback = void(); | 210 callback VoidCallback = void(); |
| 80 callback BooleanCallback = void(boolean result); | 211 callback BooleanCallback = void(boolean result); |
| 81 callback StringCallback = void(DOMString result); | 212 callback StringCallback = void(DOMString result); |
| 82 // TODO(stevenjb): Use NetworkProperties for |result| once defined. | 213 // TODO(stevenjb): Use NetworkProperties for |result| once defined. |
| 83 callback GetPropertiesCallback = void(object result); | 214 callback GetPropertiesCallback = void(object result); |
| 84 // TODO(stevenjb): Use ManagedNetworkProperties for |result| once defined. | 215 // TODO(stevenjb): Use ManagedNetworkProperties for |result| once defined. |
| 85 callback GetManagedPropertiesCallback = void(object result); | 216 callback GetManagedPropertiesCallback = void(object result); |
| 86 callback GetStatePropertiesCallback = void(object result); | 217 callback GetStatePropertiesCallback = void(NetworkStateProperties result); |
| 87 callback GetNetworksCallback = void(object[] result); | 218 callback GetNetworksCallback = void(NetworkStateProperties[] result); |
| 88 callback GetEnabledNetworkTypesCallback = void(NetworkType[] result); | 219 callback GetEnabledNetworkTypesCallback = void(NetworkType[] result); |
| 89 callback CaptivePortalStatusCallback = void(CaptivePortalStatus result); | 220 callback CaptivePortalStatusCallback = void(CaptivePortalStatus result); |
| 90 | 221 |
| 91 // These functions all report failures via chrome.runtime.lastError. | 222 // These functions all report failures via chrome.runtime.lastError. |
| 92 interface Functions { | 223 interface Functions { |
| 93 // Gets all the properties of the network with id networkGuid. Includes all | 224 // Gets all the properties of the network with id networkGuid. Includes all |
| 94 // properties of the network (read-only and read/write values). | 225 // properties of the network (read-only and read/write values). |
| 95 // |networkGuid|: The GUID of the network to get properties for. | 226 // |networkGuid|: The GUID of the network to get properties for. |
| 96 // |callback|: Called with the network properties when received. | 227 // |callback|: Called with the network properties when received. |
| 97 static void getProperties(DOMString networkGuid, | 228 static void getProperties(DOMString networkGuid, |
| 98 GetPropertiesCallback callback); | 229 GetPropertiesCallback callback); |
| 99 | 230 |
| 100 // Gets the merged properties of the network with id networkGuid from the | 231 // Gets the merged properties of the network with id networkGuid from the |
| 101 // sources: User settings, shared settings, user policy, device policy and | 232 // sources: User settings, shared settings, user policy, device policy and |
| 102 // the currently active settings. | 233 // the currently active settings. |
| 103 // |networkGuid|: The GUID of the network to get properties for. | 234 // |networkGuid|: The GUID of the network to get properties for. |
| 104 // |callback|: Called with the managed network properties when received. | 235 // |callback|: Called with the managed network properties when received. |
| 105 static void getManagedProperties(DOMString networkGuid, | 236 static void getManagedProperties(DOMString networkGuid, |
| 106 GetManagedPropertiesCallback callback); | 237 GetManagedPropertiesCallback callback); |
| 107 | 238 |
| 108 // Gets the cached read-only properties of the network with id networkGuid. | 239 // Gets the cached read-only properties of the network with id networkGuid. |
| 109 // This is meant to be a higher performance function than | 240 // This is meant to be a higher performance function than |
| 110 // $(ref:getProperties), which requires a round trip to query the networking | 241 // $(ref:getProperties), which requires a round trip to query the networking |
| 111 // subsystem. The following properties are returned for all networks: GUID, | 242 // subsystem. The following properties are returned for all networks: GUID, |
| 112 // Type, Name, WiFi.Security. Additional properties are provided for visible | 243 // Type, Name, WiFi.Security. Additional properties are provided for visible |
| 113 // networks: ConnectionState, ErrorState, WiFi.SignalStrength, | 244 // networks: ConnectionState, ErrorState, WiFi.SignalStrength, |
| 114 // Cellular.NetworkTechnology, Cellular.ActivationState, | 245 // Cellular.NetworkTechnology, Cellular.ActivationState, |
| 115 // Cellular.RoamingState, Cellular.OutOfCredits. | 246 // Cellular.RoamingState. |
| 116 // |networkGuid|: The GUID of the network to get properties for. | 247 // |networkGuid|: The GUID of the network to get properties for. |
| 117 // |callback|: Called immediately with the network state properties. | 248 // |callback|: Called immediately with the network state properties. |
| 118 static void getState(DOMString networkGuid, | 249 static void getState(DOMString networkGuid, |
| 119 GetStatePropertiesCallback callback); | 250 GetStatePropertiesCallback callback); |
| 120 | 251 |
| 121 // Sets the properties of the network with id networkGuid. | 252 // Sets the properties of the network with id networkGuid. |
| 122 // |networkGuid|: The GUID of the network to set properties for. | 253 // |networkGuid|: The GUID of the network to set properties for. |
| 123 // |properties|: The properties to set. | 254 // |properties|: The properties to set. |
| 124 // |callback|: Called when the operation has completed. | 255 // |callback|: Called when the operation has completed. |
| 125 static void setProperties(DOMString networkGuid, | 256 static void setProperties(DOMString networkGuid, |
| 126 object properties, | 257 NetworkConfigProperties properties, |
| 127 optional VoidCallback callback); | 258 optional VoidCallback callback); |
| 128 | 259 |
| 129 // Creates a new network configuration from properties. If a matching | 260 // Creates a new network configuration from properties. If a matching |
| 130 // configured network already exists, this will fail. Otherwise returns the | 261 // configured network already exists, this will fail. Otherwise returns the |
| 131 // guid of the new network. | 262 // guid of the new network. |
| 132 // |shared|: If true, share this network configuration with other users. | 263 // |shared|: If true, share this network configuration with other users. |
| 133 // |properties|: The properties to configure the new network with. | 264 // |properties|: The properties to configure the new network with. |
| 134 // |callback|: Called with the GUID for the new network configuration once | 265 // |callback|: Called with the GUID for the new network configuration once |
| 135 // the network has been created. | 266 // the network has been created. |
| 136 static void createNetwork(boolean shared, | 267 static void createNetwork(boolean shared, |
| 137 object properties, | 268 NetworkConfigProperties properties, |
| 138 optional StringCallback callback); | 269 optional StringCallback callback); |
| 139 | 270 |
| 140 // Forgets a network configuration by clearing any configured properties for | 271 // Forgets a network configuration by clearing any configured properties for |
| 141 // the network with GUID 'networkGuid'. This may also include any other | 272 // the network with GUID 'networkGuid'. This may also include any other |
| 142 // networks with matching identifiers (e.g. WiFi SSID and Security). If no | 273 // networks with matching identifiers (e.g. WiFi SSID and Security). If no |
| 143 // such configuration exists, an error will be set and the operation will | 274 // such configuration exists, an error will be set and the operation will |
| 144 // fail. | 275 // fail. |
| 145 // |networkGuid|: The GUID of the network to forget. | 276 // |networkGuid|: The GUID of the network to forget. |
| 146 // |callback|: Called when the operation has completed. | 277 // |callback|: Called when the operation has completed. |
| 147 static void forgetNetwork(DOMString networkGuid, | 278 static void forgetNetwork(DOMString networkGuid, |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 // Fired when the list of networks has changed. Sends a complete list of | 408 // Fired when the list of networks has changed. Sends a complete list of |
| 278 // GUIDs for all the current networks. | 409 // GUIDs for all the current networks. |
| 279 static void onNetworkListChanged(DOMString[] changes); | 410 static void onNetworkListChanged(DOMString[] changes); |
| 280 | 411 |
| 281 // Fired when a portal detection for a network completes. Sends the guid of | 412 // Fired when a portal detection for a network completes. Sends the guid of |
| 282 // the network and the corresponding captive portal status. | 413 // the network and the corresponding captive portal status. |
| 283 static void onPortalDetectionCompleted(DOMString networkGuid, | 414 static void onPortalDetectionCompleted(DOMString networkGuid, |
| 284 CaptivePortalStatus status); | 415 CaptivePortalStatus status); |
| 285 }; | 416 }; |
| 286 }; | 417 }; |
| OLD | NEW |