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); | |
102 | 99 |
103 interface Functions { | 100 interface Functions { |
104 // Returns the list of cloud devices visible locally or available in the | 101 // Returns the list of cloud devices visible locally or available in the |
105 // cloud for user account. | 102 // cloud for user account. |
106 static void getCloudDeviceList(CloudDeviceListCallback callback); | 103 static void getCloudDeviceList(CloudDeviceListCallback callback); |
107 | 104 |
108 // Queries network for local devices. Triggers an onDeviceStateChanged and | 105 // Queries network for local devices. Triggers an onDeviceStateChanged and |
109 // onDeviceRemoved events. Call this function *only* after registering for | 106 // onDeviceRemoved events. Call this function *only* after registering for |
110 // onDeviceStateChanged and onDeviceRemoved events, or it will do nothing. | 107 // onDeviceStateChanged and onDeviceRemoved events, or it will do nothing. |
111 static void queryForNewLocalDevices(); | 108 static void queryForNewLocalDevices(); |
112 | 109 |
113 // Cache the WiFi password in the browser process for use during | 110 // Cache the WiFi password in the browser process for use during |
114 // provisioning. This is done to allow the gathering of the wifi password to | 111 // provisioning. This is done to allow the gathering of the wifi password to |
115 // not be done while connected to the device's network. Callback is called | 112 // not be done while connected to the device's network. Callback is called |
116 // with true if wifi password was cached and false if it was unavailable. | 113 // with true if wifi password was cached and false if it was unavailable. |
117 static void prefetchWifiPassword(DOMString ssid, SuccessCallback callback); | 114 static void prefetchWifiPassword(DOMString ssid, SuccessCallback callback); |
118 | 115 |
119 // Get the list of ssids with prefetched callbacks. | |
120 static void getPrefetchedWifiNameList(SSIDListCallback callback); | |
121 | |
122 // Establish the session. | 116 // Establish the session. |
123 static void establishSession(DOMString ipAddress, | 117 static void establishSession(DOMString ipAddress, |
124 long port, | 118 long port, |
125 ConfirmationCodeCallback callback); | 119 ConfirmationCodeCallback callback); |
126 | 120 |
127 // Confirm that the code is correct. Device will still need to confirm. | 121 // Confirm that the code is correct. Device will still need to confirm. |
128 static void confirmCode(long sessionId, | 122 static void confirmCode(long sessionId, |
129 SessionEstablishedCallback callback); | 123 SessionEstablishedCallback callback); |
130 | 124 |
131 // Send an encrypted message to the device. |api| is the API path and | 125 // 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... |
187 // Subscribe to this event to start listening new or updated devices. New | 181 // Subscribe to this event to start listening new or updated devices. New |
188 // listeners will get called with all known devices on the network, and | 182 // listeners will get called with all known devices on the network, and |
189 // status updates for devices available through the cloud. | 183 // status updates for devices available through the cloud. |
190 static void onDeviceStateChanged(GCDDevice device); | 184 static void onDeviceStateChanged(GCDDevice device); |
191 | 185 |
192 // Notifies that device has disappeared. | 186 // Notifies that device has disappeared. |
193 // |deviceId| : The device has disappeared. | 187 // |deviceId| : The device has disappeared. |
194 static void onDeviceRemoved(DOMString deviceId); | 188 static void onDeviceRemoved(DOMString deviceId); |
195 }; | 189 }; |
196 }; | 190 }; |
OLD | NEW |