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.gcdPrivate</code> API to discover GCD APIs and register | 5 // Use the <code>chrome.gcdPrivate</code> API to discover GCD APIs and register |
6 // them. | 6 // them. |
7 namespace gcdPrivate { | 7 namespace gcdPrivate { |
8 | 8 |
9 enum SetupType { mdns, wifi, cloud }; | 9 enum SetupType { mdns, wifi, cloud }; |
10 | 10 |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 // Called when the response to the message sent is available or on error. | 89 // Called when the response to the message sent is available or on error. |
90 // |status| is the status (success or type of error) | 90 // |status| is the status (success or type of error) |
91 // |response| is the response object or null on error | 91 // |response| is the response object or null on error |
92 callback MessageResponseCallback = void(Status status, | 92 callback MessageResponseCallback = void(Status status, |
93 object response); | 93 object response); |
94 | 94 |
95 // Called as a response to |prefetchWifiPassword| | 95 // Called as a response to |prefetchWifiPassword| |
96 // |success| Denotes whether the password fetch has succeeded or failed. | 96 // |success| Denotes whether the password fetch has succeeded or failed. |
97 callback SuccessCallback = void(boolean success); | 97 callback SuccessCallback = void(boolean success); |
98 | 98 |
| 99 // Called as a response to |getPrefetchedWifiNameList| |
| 100 // |list| the list of ssids for which wifi passwords were prefetched. |
| 101 callback SSIDListCallback = void(DOMString[] networks); |
99 | 102 |
100 interface Functions { | 103 interface Functions { |
101 // Returns the list of cloud devices visible locally or available in the | 104 // Returns the list of cloud devices visible locally or available in the |
102 // cloud for user account. | 105 // cloud for user account. |
103 static void getCloudDeviceList(CloudDeviceListCallback callback); | 106 static void getCloudDeviceList(CloudDeviceListCallback callback); |
104 | 107 |
105 // Queries network for local devices. Triggers an onDeviceStateChanged and | 108 // Queries network for local devices. Triggers an onDeviceStateChanged and |
106 // onDeviceRemoved events. Call this function *only* after registering for | 109 // onDeviceRemoved events. Call this function *only* after registering for |
107 // onDeviceStateChanged and onDeviceRemoved events, or it will do nothing. | 110 // onDeviceStateChanged and onDeviceRemoved events, or it will do nothing. |
108 static void queryForNewLocalDevices(); | 111 static void queryForNewLocalDevices(); |
109 | 112 |
110 // Cache the WiFi password in the browser process for use during | 113 // Cache the WiFi password in the browser process for use during |
111 // provisioning. This is done to allow the gathering of the wifi password to | 114 // provisioning. This is done to allow the gathering of the wifi password to |
112 // not be done while connected to the device's network. Callback is called | 115 // not be done while connected to the device's network. Callback is called |
113 // with true if wifi password was cached and false if it was unavailable. | 116 // with true if wifi password was cached and false if it was unavailable. |
114 static void prefetchWifiPassword(DOMString ssid, SuccessCallback callback); | 117 static void prefetchWifiPassword(DOMString ssid, SuccessCallback callback); |
115 | 118 |
| 119 // Get the list of ssids with prefetched callbacks. |
| 120 static void getPrefetchedWifiNameList(SSIDListCallback callback); |
| 121 |
116 // Establish the session. | 122 // Establish the session. |
117 static void establishSession(DOMString ipAddress, | 123 static void establishSession(DOMString ipAddress, |
118 long port, | 124 long port, |
119 ConfirmationCodeCallback callback); | 125 ConfirmationCodeCallback callback); |
120 | 126 |
121 // Confirm that the code is correct. Device will still need to confirm. | 127 // Confirm that the code is correct. Device will still need to confirm. |
122 static void confirmCode(long sessionId, | 128 static void confirmCode(long sessionId, |
123 SessionEstablishedCallback callback); | 129 SessionEstablishedCallback callback); |
124 | 130 |
125 // Send an encrypted message to the device. |api| is the API path and | 131 // Send an encrypted message to the device. |api| is the API path and |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 // Subscribe to this event to start listening new or updated devices. New | 187 // Subscribe to this event to start listening new or updated devices. New |
182 // listeners will get called with all known devices on the network, and | 188 // listeners will get called with all known devices on the network, and |
183 // status updates for devices available through the cloud. | 189 // status updates for devices available through the cloud. |
184 static void onDeviceStateChanged(GCDDevice device); | 190 static void onDeviceStateChanged(GCDDevice device); |
185 | 191 |
186 // Notifies that device has disappeared. | 192 // Notifies that device has disappeared. |
187 // |deviceId| : The device has disappeared. | 193 // |deviceId| : The device has disappeared. |
188 static void onDeviceRemoved(DOMString deviceId); | 194 static void onDeviceRemoved(DOMString deviceId); |
189 }; | 195 }; |
190 }; | 196 }; |
OLD | NEW |