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