| 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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 callback CommandListCallback = void(object[] commands); | 84 callback CommandListCallback = void(object[] commands); |
| 85 | 85 |
| 86 // Generic callback for session calls, with status only. | 86 // Generic callback for session calls, with status only. |
| 87 callback SessionCallback = void(Status status); | 87 callback SessionCallback = void(Status status); |
| 88 | 88 |
| 89 // Called when device starts to establish a secure session. | 89 // Called when device starts to establish a secure session. |
| 90 // If |status| is |success| app should call |startPairing|. | 90 // If |status| is |success| app should call |startPairing|. |
| 91 // |sessionId| : The session ID (identifies the session for future calls). | 91 // |sessionId| : The session ID (identifies the session for future calls). |
| 92 // |status| : The status of operation (success or type of error). | 92 // |status| : The status of operation (success or type of error). |
| 93 // |pairingTypes| is the list of supported pairing types. | 93 // |pairingTypes| is the list of supported pairing types. |
| 94 callback EstablishSessionCallback = void(long sessionId, | 94 callback CreateSessionCallback = void(long sessionId, |
| 95 Status status, | 95 Status status, |
| 96 PairingType[] pairingTypes); | 96 PairingType[] pairingTypes); |
| 97 | 97 |
| 98 // Called when the response to the message sent is available or on error. | 98 // Called when the response to the message sent is available or on error. |
| 99 // |status| : The status of operation (success or type of error). | 99 // |status| : The status of operation (success or type of error). |
| 100 // |response| : The response object with result or error description. May be | 100 // |response| : The response object with result or error description. May be |
| 101 // empty for some errors. | 101 // empty for some errors. |
| 102 callback SendMessageCallback = void(Status status, object response); | 102 callback SendMessageCallback = void(Status status, object response); |
| 103 | 103 |
| 104 // Called as a response to |prefetchWifiPassword| | 104 // Called as a response to |prefetchWifiPassword| |
| 105 // |success| : Denotes whether the password fetch has succeeded or failed. | 105 // |success| : Denotes whether the password fetch has succeeded or failed. |
| 106 callback SuccessCallback = void(boolean success); | 106 callback SuccessCallback = void(boolean success); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 122 // Cache the WiFi password in the browser process for use during | 122 // Cache the WiFi password in the browser process for use during |
| 123 // provisioning. This is done to allow the gathering of the wifi password to | 123 // provisioning. This is done to allow the gathering of the wifi password to |
| 124 // not be done while connected to the device's network. Callback is called | 124 // not be done while connected to the device's network. Callback is called |
| 125 // with true if wifi password was cached and false if it was unavailable. | 125 // with true if wifi password was cached and false if it was unavailable. |
| 126 // |ssid| : The network to prefetch password for. | 126 // |ssid| : The network to prefetch password for. |
| 127 static void prefetchWifiPassword(DOMString ssid, SuccessCallback callback); | 127 static void prefetchWifiPassword(DOMString ssid, SuccessCallback callback); |
| 128 | 128 |
| 129 // Get the list of SSIDs with prefetched callbacks. | 129 // Get the list of SSIDs with prefetched callbacks. |
| 130 static void getPrefetchedWifiNameList(SSIDListCallback callback); | 130 static void getPrefetchedWifiNameList(SSIDListCallback callback); |
| 131 | 131 |
| 132 // Deprecated. Establish the session. | |
| 133 // TODO(vitalybuka): Remove after uptate of apps using this. | |
| 134 // http://crbug.com/461504 | |
| 135 // |ipAddress| : The IPv4 or IPv6 address of the device. | |
| 136 // |port| : The port with Privet HTTP server. | |
| 137 static void establishSession(DOMString ipAddress, | |
| 138 long port, | |
| 139 EstablishSessionCallback callback); | |
| 140 | |
| 141 // Create new pairing. | 132 // Create new pairing. |
| 142 // |serviceName| : The mDns service name of the device. | 133 // |serviceName| : The mDns service name of the device. |
| 143 static void createSession(DOMString serviceName, | 134 static void createSession(DOMString serviceName, |
| 144 EstablishSessionCallback callback); | 135 CreateSessionCallback callback); |
| 145 | 136 |
| 146 // Start pairing with selected method. Should be called after | 137 // Start pairing with selected method. Should be called after |
| 147 // |establishSession|. | 138 // |establishSession|. |
| 148 // |sessionId| : The ID of the session created with |establishSession|. | 139 // |sessionId| : The ID of the session created with |establishSession|. |
| 149 // |pairingType| : The value selected from the list provided in | 140 // |pairingType| : The value selected from the list provided in |
| 150 // callback of |establishSession|. | 141 // callback of |establishSession|. |
| 151 static void startPairing(long sessionId, | 142 static void startPairing(long sessionId, |
| 152 PairingType pairingType, | 143 PairingType pairingType, |
| 153 SessionCallback callback); | 144 SessionCallback callback); |
| 154 | 145 |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 // Subscribe to this event to start listening new or updated devices. New | 214 // Subscribe to this event to start listening new or updated devices. New |
| 224 // listeners will get called with all known devices on the network, and | 215 // listeners will get called with all known devices on the network, and |
| 225 // status updates for devices available through the cloud. | 216 // status updates for devices available through the cloud. |
| 226 static void onDeviceStateChanged(GCDDevice device); | 217 static void onDeviceStateChanged(GCDDevice device); |
| 227 | 218 |
| 228 // Notifies that device has disappeared. | 219 // Notifies that device has disappeared. |
| 229 // |deviceId| : The device has disappeared. | 220 // |deviceId| : The device has disappeared. |
| 230 static void onDeviceRemoved(DOMString deviceId); | 221 static void onDeviceRemoved(DOMString deviceId); |
| 231 }; | 222 }; |
| 232 }; | 223 }; |
| OLD | NEW |