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"> |
(...skipping 22 matching lines...) Expand all Loading... | |
33 }; | 33 }; |
34 | 34 |
35 enum CaptivePortalStatus { | 35 enum CaptivePortalStatus { |
36 Unknown, Offline, Online, Portal, ProxyAuthRequired | 36 Unknown, Offline, Online, Portal, ProxyAuthRequired |
37 }; | 37 }; |
38 | 38 |
39 enum ConnectionStateType { | 39 enum ConnectionStateType { |
40 Connected, Connecting, NotConnected | 40 Connected, Connecting, NotConnected |
41 }; | 41 }; |
42 | 42 |
43 enum DeviceStateType { | |
44 // Device is available but not initialized. | |
45 Uninitialized, | |
46 // Device is intialized but not enabled. | |
47 Disabled, | |
48 // Enabled state has been requested but has not completed. | |
49 Enabling, | |
50 // Device is enabled. | |
51 Enabled | |
52 }; | |
53 | |
43 enum IPConfigType { | 54 enum IPConfigType { |
44 DHCP, Static | 55 DHCP, Static |
45 }; | 56 }; |
46 | 57 |
47 enum NetworkType { | 58 enum NetworkType { |
48 All, Bluetooth, Cellular, Ethernet, VPN, Wireless, WiFi, WiMAX | 59 All, Cellular, Ethernet, VPN, Wireless, WiFi, WiMAX |
49 }; | 60 }; |
50 | 61 |
51 dictionary APNProperties { | 62 dictionary APNProperties { |
52 DOMString? AccessPointName; | 63 DOMString? AccessPointName; |
53 DOMString? Language; | 64 DOMString? Language; |
54 DOMString? LocalizedName; | 65 DOMString? LocalizedName; |
55 DOMString? Name; | 66 DOMString? Name; |
56 DOMString? Password; | 67 DOMString? Password; |
57 DOMString? Username; | 68 DOMString? Username; |
58 }; | 69 }; |
59 | 70 |
60 dictionary CellularConfigProperties { | 71 dictionary CellularConfigProperties { |
61 boolean? AutoConnect; | 72 boolean? AutoConnect; |
62 APNProperties? APN; | 73 APNProperties? APN; |
63 | 74 |
64 // Specifies which carrier to use for Cellular configurations that support | 75 // Specifies which carrier to use for Cellular configurations that support |
65 // multiple carriers. May be set with $(ref:setProperties), but will be | 76 // multiple carriers. May be set with $(ref:setProperties), but will be |
66 // ignored by $(ref:createConfiguration). | 77 // ignored by $(ref:createConfiguration). |
67 DOMString? Carrier; | 78 DOMString? Carrier; |
68 }; | 79 }; |
69 | 80 |
70 dictionary CellularStateProperties { | 81 dictionary CellularStateProperties { |
71 ActivationStateType? ActivationState; | 82 ActivationStateType? ActivationState; |
72 DOMString? NetworkTechnology; | 83 DOMString? NetworkTechnology; |
73 DOMString? RoamingState; | 84 DOMString? RoamingState; |
74 long? SignalStrength; | 85 long? SignalStrength; |
75 }; | 86 }; |
76 | 87 |
88 dictionary DeviceStateProperties { | |
89 // Set if the device is enabled. True if the device is currently scanning. | |
pneubeck (no reviews)
2015/04/09 09:41:22
as mentioned in the test, this is not fully accura
stevenjb
2015/04/09 16:20:25
Acknowledged.
| |
90 boolean? Scanning; | |
91 | |
92 // The current state of the device. | |
93 DeviceStateType State; | |
94 | |
95 // The network type associated with the device (Cellular, Ethernet, WiFi, or | |
96 // WiMAX). | |
97 NetworkType Type; | |
98 }; | |
99 | |
77 dictionary EthernetStateProperties { | 100 dictionary EthernetStateProperties { |
78 DOMString Authentication; | 101 DOMString Authentication; |
79 }; | 102 }; |
80 | 103 |
81 dictionary IPConfigProperties { | 104 dictionary IPConfigProperties { |
82 DOMString? Gateway; | 105 DOMString? Gateway; |
83 DOMString? IPAddress; | 106 DOMString? IPAddress; |
84 DOMString[]? NameServers; | 107 DOMString[]? NameServers; |
85 long? RoutingPrefix; | 108 long? RoutingPrefix; |
86 DOMString? Type; | 109 DOMString? Type; |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
214 | 237 |
215 callback VoidCallback = void(); | 238 callback VoidCallback = void(); |
216 callback BooleanCallback = void(boolean result); | 239 callback BooleanCallback = void(boolean result); |
217 callback StringCallback = void(DOMString result); | 240 callback StringCallback = void(DOMString result); |
218 // TODO(stevenjb): Use NetworkProperties for |result| once defined. | 241 // TODO(stevenjb): Use NetworkProperties for |result| once defined. |
219 callback GetPropertiesCallback = void(object result); | 242 callback GetPropertiesCallback = void(object result); |
220 // TODO(stevenjb): Use ManagedNetworkProperties for |result| once defined. | 243 // TODO(stevenjb): Use ManagedNetworkProperties for |result| once defined. |
221 callback GetManagedPropertiesCallback = void(object result); | 244 callback GetManagedPropertiesCallback = void(object result); |
222 callback GetStatePropertiesCallback = void(NetworkStateProperties result); | 245 callback GetStatePropertiesCallback = void(NetworkStateProperties result); |
223 callback GetNetworksCallback = void(NetworkStateProperties[] result); | 246 callback GetNetworksCallback = void(NetworkStateProperties[] result); |
247 callback GetDeviceStatesCallback = void(DeviceStateProperties[] result); | |
224 callback GetEnabledNetworkTypesCallback = void(NetworkType[] result); | 248 callback GetEnabledNetworkTypesCallback = void(NetworkType[] result); |
225 callback CaptivePortalStatusCallback = void(CaptivePortalStatus result); | 249 callback CaptivePortalStatusCallback = void(CaptivePortalStatus result); |
226 | 250 |
227 // These functions all report failures via chrome.runtime.lastError. | 251 // These functions all report failures via chrome.runtime.lastError. |
228 interface Functions { | 252 interface Functions { |
229 // Gets all the properties of the network with id networkGuid. Includes all | 253 // Gets all the properties of the network with id networkGuid. Includes all |
230 // properties of the network (read-only and read/write values). | 254 // properties of the network (read-only and read/write values). |
231 // |networkGuid|: The GUID of the network to get properties for. | 255 // |networkGuid|: The GUID of the network to get properties for. |
232 // |callback|: Called with the network properties when received. | 256 // |callback|: Called with the network properties when received. |
233 static void getProperties(DOMString networkGuid, | 257 static void getProperties(DOMString networkGuid, |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
293 // properties when received. | 317 // properties when received. |
294 static void getNetworks(NetworkFilter filter, | 318 static void getNetworks(NetworkFilter filter, |
295 GetNetworksCallback callback); | 319 GetNetworksCallback callback); |
296 | 320 |
297 // Deprecated. Please use $(ref:networkingPrivate.getNetworks) with | 321 // Deprecated. Please use $(ref:networkingPrivate.getNetworks) with |
298 // filter.visible = true instead. | 322 // filter.visible = true instead. |
299 [deprecated="Use getNetworks."] static void getVisibleNetworks( | 323 [deprecated="Use getNetworks."] static void getVisibleNetworks( |
300 NetworkType networkType, | 324 NetworkType networkType, |
301 GetNetworksCallback callback); | 325 GetNetworksCallback callback); |
302 | 326 |
303 // Returns a list of the enabled network types. Note: this only returns | 327 // Deprecated. Please use $(ref:networkingPrivate.getDeviceStates) instead. |
304 // discrete types that can be enabled or disabled: Cellular, Ethernet, WiFi, | 328 [deprecated="Use getDeviceStates."] static void getEnabledNetworkTypes( |
305 // Wimax. | 329 GetEnabledNetworkTypesCallback callback); |
306 // |callback|: Called immediately with the enabled network types. | |
307 static void getEnabledNetworkTypes(GetEnabledNetworkTypesCallback callback); | |
308 | 330 |
309 // Enable the specified network type. Note, the type might represent | 331 // Returns a list of $(ref:networkingPrivate.DeviceStateProperties) objects. |
310 // multiple network types (e.g. 'Wireless'). | 332 // |callback|: Called with a list of devices and their state. |
333 static void getDeviceStates(GetDeviceStatesCallback callback); | |
334 | |
335 // Enables any devices matching the specified network type. Note, the type | |
336 // might represent multiple network types (e.g. 'Wireless'). | |
311 // |networkType|: The type of network to enable. | 337 // |networkType|: The type of network to enable. |
312 static void enableNetworkType(NetworkType networkType); | 338 static void enableNetworkType(NetworkType networkType); |
313 | 339 |
314 // Disable the specified network type. See note for | 340 // Disables any devices matching the specified network type. See note for |
315 // $(ref:networkingPrivate.enableNetworkType). | 341 // $(ref:networkingPrivate.enableNetworkType). |
316 // |networkType|: The type of network to disable. | 342 // |networkType|: The type of network to disable. |
317 static void disableNetworkType(NetworkType networkType); | 343 static void disableNetworkType(NetworkType networkType); |
318 | 344 |
319 // Requests that the networking subsystem scan for new networks and | 345 // Requests that the networking subsystem scan for new networks and |
320 // update the list returned by $(ref:getVisibleNetworks). This is only a | 346 // update the list returned by $(ref:getVisibleNetworks). This is only a |
321 // request: the network subsystem can choose to ignore it. If the list | 347 // request: the network subsystem can choose to ignore it. If the list |
322 // is updated, then the $(ref:onNetworkListChanged) event will be fired. | 348 // is updated, then the $(ref:onNetworkListChanged) event will be fired. |
323 static void requestNetworkScan(); | 349 static void requestNetworkScan(); |
324 | 350 |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
407 | 433 |
408 interface Events { | 434 interface Events { |
409 // Fired when the properties change on any of the networks. Sends a list of | 435 // Fired when the properties change on any of the networks. Sends a list of |
410 // GUIDs for networks whose properties have changed. | 436 // GUIDs for networks whose properties have changed. |
411 static void onNetworksChanged(DOMString[] changes); | 437 static void onNetworksChanged(DOMString[] changes); |
412 | 438 |
413 // Fired when the list of networks has changed. Sends a complete list of | 439 // Fired when the list of networks has changed. Sends a complete list of |
414 // GUIDs for all the current networks. | 440 // GUIDs for all the current networks. |
415 static void onNetworkListChanged(DOMString[] changes); | 441 static void onNetworkListChanged(DOMString[] changes); |
416 | 442 |
443 // Fired when the list of devices has changed or any device state properties | |
444 // have changed. | |
445 static void onDeviceStateListChanged(); | |
446 | |
417 // Fired when a portal detection for a network completes. Sends the guid of | 447 // Fired when a portal detection for a network completes. Sends the guid of |
418 // the network and the corresponding captive portal status. | 448 // the network and the corresponding captive portal status. |
419 static void onPortalDetectionCompleted(DOMString networkGuid, | 449 static void onPortalDetectionCompleted(DOMString networkGuid, |
420 CaptivePortalStatus status); | 450 CaptivePortalStatus status); |
421 }; | 451 }; |
422 }; | 452 }; |
OLD | NEW |