Chromium Code Reviews| Index: chrome/common/extensions/api/gcd_private.idl |
| diff --git a/chrome/common/extensions/api/gcd_private.idl b/chrome/common/extensions/api/gcd_private.idl |
| index 69c517a030629e014c15e0451bcda331b5afa383..c10137c6c1d3f23ad402d8e69e6b88c2303f7a7d 100644 |
| --- a/chrome/common/extensions/api/gcd_private.idl |
| +++ b/chrome/common/extensions/api/gcd_private.idl |
| @@ -29,6 +29,25 @@ namespace gcdPrivate { |
| DOMString deviceDescription; |
| }; |
| + enum Status { |
| + // populateWifiPassword was true and the password has not been prefetched. |
| + wifiPasswordError, |
| + // populateWifiPassword was true and the message cannot be parsed as a setup |
| + // message. |
| + setupParseError, |
| + // Could not connect to the device. |
| + connectionError, |
| + // Error in establishing session. |
| + sessionError, |
| + // Success. |
| + success |
| + }; |
| + |
| + enum ConfirmationType { |
| + displayCode, |
| + audio |
| + }; |
| + |
| callback CloudDeviceListCallback = void(GCDDevice[] devices); |
| // |commandDefinitions| : Is "commandDefs" value of device described at |
| @@ -46,6 +65,28 @@ namespace gcdPrivate { |
| // TODO(vitalybuka): consider to describe object in IDL. |
| callback CommandListCallback = void(object[] commands); |
| + // Called when the confirmation code is available or on error. |
| + // |sessionId| is the session ID (identifies the session for future calls) |
| + // |status| is the status (success or type of error) |
| + // |code| is the confirmation code or empty on error |
| + // |confirmationType| is the type of confirmation required |
| + callback ConfirmationCodeCallback = void(long sessionId, |
| + Status status, |
| + DOMString code, |
| + ConfirmationType type); |
| + // Called to indicated the session is established. |
| + // |status| is the status (success or type of error) |
| + callback SessionEstablishedCallback = void(Status status); |
| + // Called when the response to the message sent is available or on error. |
| + // |status| is the status (success or type of error) |
| + // |response| is the response object or null on error |
| + callback MessageResponseCallback = void(Status status, |
| + object response); |
| + // Called as a response to |prefetchWifiPassword| |
| + // |success| Denotes whether the password fetch has succeeded or failed. |
| + callback SuccessCallback = void(boolean success); |
| + |
| + |
| interface Functions { |
| // Returns the list of cloud devices visible locally or available in the |
| // cloud for user account. |
| @@ -56,31 +97,32 @@ namespace gcdPrivate { |
| // onDeviceStateChanged and onDeviceRemoved events, or it will do nothing. |
| static void queryForNewLocalDevices(); |
| - // Starts device setup process. Returns id of setup process. Id should be |
| - // used as |setupId| in all subsequent setup related calls, and for |
| - // filtering setup events. |
| - static long startSetup(DOMString deviceId); |
| - |
| - // Sets WiFi network as reply to |onGetWifiNetworks| event. |
| - // |setupId| : The value returned by |startSetup|. |
| - // |network| : The wifi network for device setup. |
| - static void setWiFiNetwork(long setupId, DOMString network); |
| - |
| - // Sets WiFi network password as reply to |onGetWifiPassword| event. |
| - // |setupId| : The value returned by |startSetup|. |
| - // |password| : The password for network selected with |setWiFiNetwork|. |
| - static void setWiFiPassword(long setupId, DOMString password); |
| - |
| - // Confirms that security code known to application match to the code known |
| - // to device. |
| - // |setupId| : The value returned by |startSetup|. |
| - static void confirmCode(long setupId); |
| - |
| - // Stops registration process. |
| - // This call triggers |onSetupError| event. App should wait this even before |
| - // starting new registration. |
| - // |setupId| : The value returned by |startSetup|. |
| - static void stopSetup(long setupId); |
| + // Cache the WiFi password in the browser process for use during |
| + // provisioning. This is done to allow the gathering of the wifi password to |
| + // not be done while connected to the device's network. Callback is called |
| + // with true if wifi password was cached and false if it was unavailable. |
| + static void prefetchWifiPassword(DOMString ssid, SuccessCallback callback); |
| + |
| + // Establish the session. |
| + static void establishSession(DOMString ipAddress, |
| + long port, |
| + ConfirmationCodeCallback callback); |
| + |
| + // Confirm that the code is correct. Device will still need to confirm. |
| + static void confirmCode(long sessionId, |
| + SessionEstablishedCallback callback); |
| + |
| + // Send an encrypted message to the device. If |populateWifiPassword| is |
| + // true, treat the message as a setup message, extract the SSID, and add in |
| + // the wifi password. The password for this SSID must have been prefetched |
| + // with prefetchWifiPassword. |
| + static void sendMessage(long sessionId, |
| + object message, |
|
Vitaly Buka (NO REVIEWS)
2014/07/16 18:49:12
Could you please define message in idl?
Noam Samuel
2014/07/16 18:52:38
I want to give the LAX team the flexibility to use
Noam Samuel
2014/07/16 21:08:19
Split into api and input
|
| + boolean populateWifiPassword, |
|
Vitaly Buka (NO REVIEWS)
2014/07/16 18:49:12
why can't we remove "populateWifiPassword"
looks l
Noam Samuel
2014/07/16 18:52:38
Ditto.
Noam Samuel
2014/07/16 21:08:19
OK, done
|
| + MessageResponseCallback callback); |
| + |
| + // Terminate the session with the device. |
| + static void terminateSession(long sessionId); |
| // Returns command definitions. |
| // |deviceId| : The device to get command definitions for. |
| @@ -133,32 +175,5 @@ namespace gcdPrivate { |
| // Notifies that device has disappeared. |
| // |deviceId| : The device has disappeared. |
| static void onDeviceRemoved(DOMString deviceId); |
| - |
| - // Notifies app that setup is waiting for a wifi network. App should reply |
| - // with |setWiFiNetwork|. |
| - // |setupId| : The value returned by |startSetup|. |
| - static void onGetWifiNetwork(long setupId); |
| - |
| - // Notifies app that setup is waiting for password for the network provided |
| - // with |setWiFiNetwork|. Even will be called if setup flow would unable to |
| - // get password from the system. |
| - // App should reply with |setWiFiPassword|. |
| - // |setupId| : The value returned by |startSetup|. |
| - static void onGetWifiPassword(long setupId); |
| - |
| - // Notifies app that setup is waiting for confirmation that code is the same |
| - // as code known to device. App should reply with |confirmCode|, or |
| - // |stopSetup| if code does not match. |
| - // |confirmationCode| : The code to confirm. |
| - // |setupId| : The value returned by |startSetup|. |
| - static void onConfirmCode(long setupId, DOMString confirmationCode); |
| - |
| - // Notifies app that setup is completed successfully. |
| - // |setupId| : The value returned by |startSetup|. |
| - static void onSetupSuccess(long setupId); |
| - |
| - // Notifies app that setup is failed or stopped. |
| - // |setupId| : The value returned by |startSetup|. |
| - static void onSetupError(long setupId); |
| }; |
| }; |