OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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>chrome.vpnProvider</code> API to implement a VPN | 5 // Use the <code>chrome.vpnProvider</code> API to implement a VPN |
6 // client. | 6 // client. |
7 namespace vpnProvider { | 7 namespace vpnProvider { |
8 // A parameters class for the VPN interface. | 8 // A parameters class for the VPN interface. |
9 dictionary Parameters { | 9 dictionary Parameters { |
10 // IP address for the VPN interface in CIDR notation. | 10 // IP address for the VPN interface in CIDR notation. |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 }; | 56 }; |
57 | 57 |
58 // The enum is used by the platform to notify the client of the VPN session | 58 // The enum is used by the platform to notify the client of the VPN session |
59 // status. | 59 // status. |
60 enum PlatformMessage { | 60 enum PlatformMessage { |
61 // VPN configuration connected. | 61 // VPN configuration connected. |
62 connected, | 62 connected, |
63 // VPN configuration disconnected. | 63 // VPN configuration disconnected. |
64 disconnected, | 64 disconnected, |
65 // An error occurred in VPN connection, for example a timeout. A description | 65 // An error occurred in VPN connection, for example a timeout. A description |
66 // of the error is give as the <ahref="#property-onPlatformMessage-error"> | 66 // of the error is given as the <a href="#property-onPlatformMessage-error"> |
67 // error argument to onPlatformMessage</a>. | 67 // error argument to onPlatformMessage</a>. |
68 error, | 68 error, |
69 // The default physical network connection is down. | 69 // The default physical network connection is down. |
70 linkDown, | 70 linkDown, |
71 // The default physical network connection is back up. | 71 // The default physical network connection is back up. |
72 linkUp, | 72 linkUp, |
73 // The default physical network connection changed, e.g. wifi->mobile. | 73 // The default physical network connection changed, e.g. wifi->mobile. |
74 linkChanged, | 74 linkChanged, |
75 // The OS is preparing to suspend, so the VPN should drop its connection. | 75 // The OS is preparing to suspend, so the VPN should drop its connection. |
76 // The extension is not guaranteed to receive this event prior to | 76 // The extension is not guaranteed to receive this event prior to |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 // error. | 151 // error. |
152 static void notifyConnectionStateChanged( | 152 static void notifyConnectionStateChanged( |
153 VpnConnectionState state, | 153 VpnConnectionState state, |
154 optional CallCompleteCallback callback); | 154 optional CallCompleteCallback callback); |
155 }; | 155 }; |
156 | 156 |
157 interface Events { | 157 interface Events { |
158 // Triggered when a message is received from the platform for a | 158 // Triggered when a message is received from the platform for a |
159 // VPN configuration owned by the extension. | 159 // VPN configuration owned by the extension. |
160 // |id|: ID of the configuration the message is intended for. | 160 // |id|: ID of the configuration the message is intended for. |
161 // |message|: The message received from the platform. | 161 // |message|: The message received from the platform. Note that new |
| 162 // message types may be added in future Chrome versions to support new |
| 163 // features. |
162 // |error|: Error message when there is an error. | 164 // |error|: Error message when there is an error. |
163 static void onPlatformMessage(DOMString id, | 165 static void onPlatformMessage(DOMString id, |
164 PlatformMessage message, | 166 PlatformMessage message, |
165 DOMString error); | 167 DOMString error); |
166 | 168 |
167 // Triggered when an IP packet is received via the tunnel for the VPN | 169 // Triggered when an IP packet is received via the tunnel for the VPN |
168 // session owned by the extension. | 170 // session owned by the extension. |
169 // |data|: The IP packet received from the platform. | 171 // |data|: The IP packet received from the platform. |
170 static void onPacketReceived(ArrayBuffer data); | 172 static void onPacketReceived(ArrayBuffer data); |
171 | 173 |
(...skipping 10 matching lines...) Expand all Loading... |
182 static void onConfigCreated(DOMString id, DOMString name, object data); | 184 static void onConfigCreated(DOMString id, DOMString name, object data); |
183 | 185 |
184 // Triggered when there is a UI event for the extension. UI events are | 186 // Triggered when there is a UI event for the extension. UI events are |
185 // signals from the platform that indicate to the app that a UI dialog | 187 // signals from the platform that indicate to the app that a UI dialog |
186 // needs to be shown to the user. | 188 // needs to be shown to the user. |
187 // |event|: The UI event that is triggered. | 189 // |event|: The UI event that is triggered. |
188 // |id|: ID of the configuration for which the UI event was triggered. | 190 // |id|: ID of the configuration for which the UI event was triggered. |
189 static void onUIEvent(UIEvent event, optional DOMString id); | 191 static void onUIEvent(UIEvent event, optional DOMString id); |
190 }; | 192 }; |
191 }; | 193 }; |
OLD | NEW |