| 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 // Use the <code>networking.config</code> API to authenticate to captive | |
| 6 // portals. | |
| 7 namespace networking.config { | |
| 8 // Indicator for the type of network used in $(NetworkInfo). | |
| 9 enum NetworkType { WiFi }; | |
| 10 | |
| 11 // A dictionary identifying filtered networks. One of <code>GUID</code>, | |
| 12 // <code>SSID</code> or <code>HexSSID</code> must be set. | |
| 13 dictionary NetworkInfo { | |
| 14 // Currently only WiFi supported, see $(NetworkType). | |
| 15 NetworkType Type; | |
| 16 | |
| 17 // A unique identifier of the network. | |
| 18 DOMString? GUID; | |
| 19 | |
| 20 // A hex-encoded byte sequence. | |
| 21 DOMString? HexSSID; | |
| 22 | |
| 23 // The decoded SSID of the network (default encoding is UTF-8). To filter | |
| 24 // for non-UTF-8 SSIDs, use HexSSID instead. | |
| 25 DOMString? SSID; | |
| 26 | |
| 27 // Identifier indicating the security type of the network. Valid values are | |
| 28 // <code>None</code>, <code>WEP-PSK</code>, <code>WPA-PSK</code> and | |
| 29 // <code>WPA-EAP</code>. | |
| 30 DOMString? Security; | |
| 31 }; | |
| 32 | |
| 33 // Argument to $(finishAuthentication) indicating the result of the | |
| 34 // captive portal authentication attempt. | |
| 35 enum AuthenticationResult { | |
| 36 // The extension does not handle this network or captive portal (e.g. server | |
| 37 // end-point not found or not compatible). | |
| 38 unhandled, | |
| 39 | |
| 40 // The extension handled this network and authenticated successfully. | |
| 41 succeeded, | |
| 42 | |
| 43 // The extension handled this network, tried to authenticate, however was | |
| 44 // rejected by the server. | |
| 45 rejected, | |
| 46 | |
| 47 // The extension handled this network, tried to authenticate, however failed | |
| 48 // due to an unspecified error. | |
| 49 failed | |
| 50 }; | |
| 51 | |
| 52 interface Functions { | |
| 53 // Allows an extension to define network filters for the networks it can | |
| 54 // handle. A call to this function will remove all filters previously | |
| 55 // installed by the extension before setting the new list. | |
| 56 // |networks|: Network filters to set. Every <code>NetworkInfo</code> must | |
| 57 // either have the <code>SSID</code> or <code>HexSSID</code> | |
| 58 // set. Other fields will be ignored. | |
| 59 void setNetworkFilter(NetworkInfo[] networks); | |
| 60 | |
| 61 // Called by the extension to notify the network config API that it finished | |
| 62 // a captive portal authentication attempt and hand over the result of the | |
| 63 // attempt. This function must only be called with the GUID of the latest | |
| 64 // $(onCaptivePortalDetected) event. | |
| 65 // |GUID|: unique network identifier obtained from | |
| 66 // $(onCaptivePortalDetected). | |
| 67 // |result|: the result of the authentication attempt | |
| 68 void finishAuthentication(DOMString GUID, AuthenticationResult result); | |
| 69 }; | |
| 70 | |
| 71 interface Events { | |
| 72 // This event fires everytime a captive portal is detected on a network | |
| 73 // matching any of the currently registered network filters and the user | |
| 74 // consents to use the extension for authentication. Network filters may be | |
| 75 // set using the $(setNetworkFilter). | |
| 76 // Upon receiving this event the extension should start its authentication | |
| 77 // attempt with the captive portal. When the extension finishes its attempt | |
| 78 // it must call $(finishAuthentication) with the <code>GUID</code> received | |
| 79 // with this event and the appropriate $(AuthenticationResult) to notify | |
| 80 // the captive portal API. | |
| 81 // |networkInfo|: information about the network on which a captive portal | |
| 82 // was detected. | |
| 83 static void onCaptivePortalDetected(NetworkInfo networkInfo); | |
| 84 }; | |
| 85 }; | |
| OLD | NEW |