| 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 // Use the <code>networking.config</code> API to authenticate to captive | 5 // Use the <code>networking.config</code> API to authenticate to captive |
| 6 // portals. | 6 // portals. |
| 7 namespace networking.config { | 7 namespace networking.config { |
| 8 // Indicator for the type of network used in $(NetworkInfo). | 8 // Indicator for the type of network used in $(NetworkInfo). |
| 9 enum NetworkType { WiFi }; | 9 enum NetworkType { WiFi }; |
| 10 | 10 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 | 42 |
| 43 // The extension handled this network, tried to authenticate, however was | 43 // The extension handled this network, tried to authenticate, however was |
| 44 // rejected by the server. | 44 // rejected by the server. |
| 45 rejected, | 45 rejected, |
| 46 | 46 |
| 47 // The extension handled this network, tried to authenticate, however failed | 47 // The extension handled this network, tried to authenticate, however failed |
| 48 // due to an unspecified error. | 48 // due to an unspecified error. |
| 49 failed | 49 failed |
| 50 }; | 50 }; |
| 51 | 51 |
| 52 // Invoked by $(setNetworkFilter) when the respective operation is finished. |
| 53 callback SetNetworkFilterCallback = void(); |
| 54 |
| 55 // Invoked by $(finishAuthentication) when the respective operation is |
| 56 // finished. |
| 57 callback FinishAuthenticationCallback = void(); |
| 58 |
| 52 interface Functions { | 59 interface Functions { |
| 53 // Allows an extension to define network filters for the networks it can | 60 // Allows an extension to define network filters for the networks it can |
| 54 // handle. A call to this function will remove all filters previously | 61 // handle. A call to this function will remove all filters previously |
| 55 // installed by the extension before setting the new list. | 62 // installed by the extension before setting the new list. |
| 56 // |networks|: Network filters to set. Every <code>NetworkInfo</code> must | 63 // |networks|: Network filters to set. Every <code>NetworkInfo</code> must |
| 57 // either have the <code>SSID</code> or <code>HexSSID</code> | 64 // either have the <code>SSID</code> or <code>HexSSID</code> |
| 58 // set. Other fields will be ignored. | 65 // set. Other fields will be ignored. |
| 59 void setNetworkFilter(NetworkInfo[] networks); | 66 // |callback|: Called back when this operation is finished. |
| 67 void setNetworkFilter(NetworkInfo[] networks, |
| 68 SetNetworkFilterCallback callback); |
| 60 | 69 |
| 61 // Called by the extension to notify the network config API that it finished | 70 // 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 | 71 // 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 | 72 // attempt. This function must only be called with the GUID of the latest |
| 64 // $(onCaptivePortalDetected) event. | 73 // $(onCaptivePortalDetected) event. |
| 65 // |GUID|: unique network identifier obtained from | 74 // |GUID|: Unique network identifier obtained from |
| 66 // $(onCaptivePortalDetected). | 75 // $(onCaptivePortalDetected). |
| 67 // |result|: the result of the authentication attempt | 76 // |result|: The result of the authentication attempt. |
| 68 void finishAuthentication(DOMString GUID, AuthenticationResult result); | 77 // |callback|: Called back when this operation is finished. |
| 78 void finishAuthentication(DOMString GUID, AuthenticationResult result, |
| 79 FinishAuthenticationCallback callback); |
| 69 }; | 80 }; |
| 70 | 81 |
| 71 interface Events { | 82 interface Events { |
| 72 // This event fires everytime a captive portal is detected on a network | 83 // This event fires everytime a captive portal is detected on a network |
| 73 // matching any of the currently registered network filters and the user | 84 // matching any of the currently registered network filters and the user |
| 74 // consents to use the extension for authentication. Network filters may be | 85 // consents to use the extension for authentication. Network filters may be |
| 75 // set using the $(setNetworkFilter). | 86 // set using the $(setNetworkFilter). |
| 76 // Upon receiving this event the extension should start its authentication | 87 // Upon receiving this event the extension should start its authentication |
| 77 // attempt with the captive portal. When the extension finishes its attempt | 88 // attempt with the captive portal. When the extension finishes its attempt |
| 78 // it must call $(finishAuthentication) with the <code>GUID</code> received | 89 // it must call $(finishAuthentication) with the <code>GUID</code> received |
| 79 // with this event and the appropriate $(AuthenticationResult) to notify | 90 // with this event and the appropriate $(AuthenticationResult) to notify |
| 80 // the captive portal API. | 91 // the captive portal API. |
| 81 // |networkInfo|: information about the network on which a captive portal | 92 // |networkInfo|: information about the network on which a captive portal |
| 82 // was detected. | 93 // was detected. |
| 83 static void onCaptivePortalDetected(NetworkInfo networkInfo); | 94 static void onCaptivePortalDetected(NetworkInfo networkInfo); |
| 84 }; | 95 }; |
| 85 }; | 96 }; |
| OLD | NEW |