Chromium Code Reviews| 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 28 matching lines...) Expand all Loading... | |
| 39 | 39 |
| 40 // Could not connect to the device. | 40 // Could not connect to the device. |
| 41 connectionError, | 41 connectionError, |
| 42 | 42 |
| 43 // Error in establishing session. | 43 // Error in establishing session. |
| 44 sessionError, | 44 sessionError, |
| 45 | 45 |
| 46 // Unknown session. | 46 // Unknown session. |
| 47 unknownSessionError, | 47 unknownSessionError, |
| 48 | 48 |
| 49 // Bad confirmation code. Ask user to retype. | |
| 50 badConfirmationCodeError, | |
| 51 | |
| 49 // Success. | 52 // Success. |
| 50 success | 53 success |
| 51 }; | 54 }; |
| 52 | 55 |
| 53 enum ConfirmationType { | 56 enum ConfirmationType { |
| 54 displayCode, | 57 displayCode, |
| 55 audio | 58 stickerCode |
| 56 }; | 59 }; |
| 57 | 60 |
| 58 callback CloudDeviceListCallback = void(GCDDevice[] devices); | 61 callback CloudDeviceListCallback = void(GCDDevice[] devices); |
| 59 | 62 |
| 60 // |commandDefinitions| : Is "commandDefs" value of device described at | 63 // |commandDefinitions| : Is "commandDefs" value of device described at |
| 61 // https://developers.google.com/cloud-devices/v1/reference/devices | 64 // https://developers.google.com/cloud-devices/v1/reference/devices |
| 62 // TODO(vitalybuka): consider to describe object in IDL. | 65 // TODO(vitalybuka): consider to describe object in IDL. |
| 63 callback CommandDefinitionsCallback = void(object commandDefinitions); | 66 callback CommandDefinitionsCallback = void(object commandDefinitions); |
| 64 | 67 |
| 65 // |command| : Described at | 68 // |command| : Described at |
| 66 // https://developers.google.com/cloud-devices/v1/reference/commands | 69 // https://developers.google.com/cloud-devices/v1/reference/commands |
| 67 // TODO(vitalybuka): consider to describe object in IDL. | 70 // TODO(vitalybuka): consider to describe object in IDL. |
| 68 callback CommandCallback = void(object command); | 71 callback CommandCallback = void(object command); |
| 69 | 72 |
| 70 // |commands| : Array of commands described at | 73 // |commands| : Array of commands described at |
| 71 // https://developers.google.com/cloud-devices/v1/reference/commands | 74 // https://developers.google.com/cloud-devices/v1/reference/commands |
| 72 // TODO(vitalybuka): consider to describe object in IDL. | 75 // TODO(vitalybuka): consider to describe object in IDL. |
| 73 callback CommandListCallback = void(object[] commands); | 76 callback CommandListCallback = void(object[] commands); |
| 74 | 77 |
| 75 // Called when the confirmation code is available or on error. | 78 // Called when the confirmation code is available or on error. |
| 76 // |sessionId| is the session ID (identifies the session for future calls) | 79 // |sessionId| is the session ID (identifies the session for future calls) |
| 77 // |status| is the status (success or type of error) | 80 // |status| is the status (success or type of error) |
| 78 // |code| is the confirmation code or empty on error | 81 // |code| is the confirmation code or empty if not available (code |
|
Vitaly Buka (NO REVIEWS)
2014/08/21 22:15:24
maybe
dictionary ConfirmationInfo {
Confirmati
Noam Samuel
2014/08/21 23:11:12
Done.
| |
| 82 // is only available for displayCode confirmation) | |
| 79 // |confirmationType| is the type of confirmation required | 83 // |confirmationType| is the type of confirmation required |
| 80 callback ConfirmationCodeCallback = void(long sessionId, | 84 callback ConfirmationCodeCallback = void(long sessionId, |
| 81 Status status, | 85 Status status, |
| 82 DOMString code, | 86 DOMString code, |
| 83 ConfirmationType type); | 87 ConfirmationType type); |
| 84 | 88 |
| 85 // Called to indicated the session is established. | 89 // Called to indicated the session is established. |
| 86 // |status| is the status (success or type of error) | 90 // |status| is the status (success or type of error) |
| 87 callback SessionEstablishedCallback = void(Status status); | 91 callback SessionEstablishedCallback = void(Status status); |
| 88 | 92 |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 117 static void prefetchWifiPassword(DOMString ssid, SuccessCallback callback); | 121 static void prefetchWifiPassword(DOMString ssid, SuccessCallback callback); |
| 118 | 122 |
| 119 // Get the list of ssids with prefetched callbacks. | 123 // Get the list of ssids with prefetched callbacks. |
| 120 static void getPrefetchedWifiNameList(SSIDListCallback callback); | 124 static void getPrefetchedWifiNameList(SSIDListCallback callback); |
| 121 | 125 |
| 122 // Establish the session. | 126 // Establish the session. |
| 123 static void establishSession(DOMString ipAddress, | 127 static void establishSession(DOMString ipAddress, |
| 124 long port, | 128 long port, |
| 125 ConfirmationCodeCallback callback); | 129 ConfirmationCodeCallback callback); |
| 126 | 130 |
| 127 // Confirm that the code is correct. Device will still need to confirm. | 131 // Send confirmation code. Device will still need to confirm. |
| 128 static void confirmCode(long sessionId, | 132 static void confirmCode(long sessionId, |
|
Vitaly Buka (NO REVIEWS)
2014/08/21 22:15:24
It's not clear what should be pass here for displa
Noam Samuel
2014/08/21 23:11:12
Done.
| |
| 133 DOMString code, | |
| 129 SessionEstablishedCallback callback); | 134 SessionEstablishedCallback callback); |
| 130 | 135 |
| 131 // Send an encrypted message to the device. |api| is the API path and | 136 // Send an encrypted message to the device. |api| is the API path and |
| 132 // |input| is the input object. If the message is a setup message with a | 137 // |input| is the input object. If the message is a setup message with a |
| 133 // wifi ssid specified but no password, the password cached from | 138 // wifi ssid specified but no password, the password cached from |
| 134 // |prefetchWifiPassword| will be used and the call will fail if it's not | 139 // |prefetchWifiPassword| will be used and the call will fail if it's not |
| 135 // available. For open networks use an empty string as the password. | 140 // available. For open networks use an empty string as the password. |
| 136 static void sendMessage(long sessionId, | 141 static void sendMessage(long sessionId, |
| 137 DOMString api, | 142 DOMString api, |
| 138 object input, | 143 object input, |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 187 // Subscribe to this event to start listening new or updated devices. New | 192 // 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 | 193 // listeners will get called with all known devices on the network, and |
| 189 // status updates for devices available through the cloud. | 194 // status updates for devices available through the cloud. |
| 190 static void onDeviceStateChanged(GCDDevice device); | 195 static void onDeviceStateChanged(GCDDevice device); |
| 191 | 196 |
| 192 // Notifies that device has disappeared. | 197 // Notifies that device has disappeared. |
| 193 // |deviceId| : The device has disappeared. | 198 // |deviceId| : The device has disappeared. |
| 194 static void onDeviceRemoved(DOMString deviceId); | 199 static void onDeviceRemoved(DOMString deviceId); |
| 195 }; | 200 }; |
| 196 }; | 201 }; |
| OLD | NEW |