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 18 matching lines...) Expand all Loading... | |
| 29 DOMString deviceDescription; | 29 DOMString deviceDescription; |
| 30 }; | 30 }; |
| 31 | 31 |
| 32 // Represents wifi network credentials. | 32 // Represents wifi network credentials. |
| 33 dictionary WiFiCredentials { | 33 dictionary WiFiCredentials { |
| 34 DOMString ssid; | 34 DOMString ssid; |
| 35 DOMString password; | 35 DOMString password; |
| 36 }; | 36 }; |
| 37 | 37 |
| 38 callback CloudDeviceListCallback = void(GCDDevice[] devices); | 38 callback CloudDeviceListCallback = void(GCDDevice[] devices); |
| 39 callback CommandDefsCallback = void(object commandDefs); | |
| 40 callback CommandCallback = void(object command); | |
| 41 callback CommandListCallback = void(object[] commands); | |
| 39 | 42 |
| 40 interface Functions { | 43 interface Functions { |
| 41 static void getCloudDeviceList(CloudDeviceListCallback callback); | 44 static void getCloudDeviceList(CloudDeviceListCallback callback); |
| 42 | 45 |
| 43 // Call this function *only* after registering for onLocalDeviceStateChanged | 46 // Call this function *only* after registering for onLocalDeviceStateChanged |
| 44 // events, or it will do nothing. This will trigger an | 47 // events, or it will do nothing. This will trigger an |
| 45 // onLocalDeviceStateChanged event per device. | 48 // onLocalDeviceStateChanged event per device. |
| 46 static void queryForNewLocalDevices(); | 49 static void queryForNewLocalDevices(); |
| 47 | 50 |
| 48 // Starts device setup process. Returns id of setup process. Id should be | 51 // Starts device setup process. Returns id of setup process. Id should be |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 64 // Confirms that security code known to application match to the code known | 67 // Confirms that security code known to application match to the code known |
| 65 // to device. | 68 // to device. |
| 66 // |setupId| is a value returned by |setupStart|. | 69 // |setupId| is a value returned by |setupStart|. |
| 67 static void setupConfirmCode(long setupId); | 70 static void setupConfirmCode(long setupId); |
| 68 | 71 |
| 69 // Stops registration process. | 72 // Stops registration process. |
| 70 // This call triggers |onSetupError| event. App should wait this even before | 73 // This call triggers |onSetupError| event. App should wait this even before |
| 71 // starting new registration. | 74 // starting new registration. |
| 72 // |setupId| is a value returned by |setupStart|. | 75 // |setupId| is a value returned by |setupStart|. |
| 73 static void setupStop(long setupId); | 76 static void setupStop(long setupId); |
| 77 | |
| 78 // Returns command definitions. | |
| 79 static void getCommandDefs(GCDDevice device, CommandDefsCallback callback); | |
|
alexsemenov
2014/07/02 18:17:25
Let's rename to getCommandDefinitions and CommandD
Vitaly Buka (NO REVIEWS)
2014/07/02 22:20:00
Done.
| |
| 80 | |
| 81 static void insertCommand(GCDDevice device, | |
| 82 long expireInMs, | |
| 83 long responseAwaitMs, | |
|
alexsemenov
2014/07/02 18:17:25
Only need expiration time
Vitaly Buka (NO REVIEWS)
2014/07/02 22:20:00
Done.
| |
| 84 object command, | |
| 85 CommandDefsCallback callback); | |
|
alexsemenov
2014/07/02 18:17:26
Same here: CommandDefinitionsCallback
alexsemenov
2014/07/02 18:17:26
CommandDefsCallback -> CommandCallback here?
Vitaly Buka (NO REVIEWS)
2014/07/02 22:20:01
Done.
| |
| 86 | |
| 87 static void getCommand(DOMString commandId, | |
| 88 DOMString mediaPath, | |
|
alexsemenov
2014/07/02 18:17:25
Let's remove mediaPath for now
Vitaly Buka (NO REVIEWS)
2014/07/02 22:20:01
Done.
| |
| 89 CommandCallback callback); | |
| 90 | |
| 91 static void cancelCommand(DOMString commandId, | |
| 92 CommandCallback callback); | |
| 93 | |
| 94 static void getCommandsList(GCDDevice device, | |
| 95 DOMString byUser, | |
| 96 DOMString state, | |
| 97 CommandListCallback callback); | |
| 74 }; | 98 }; |
| 75 | 99 |
| 76 interface Events { | 100 interface Events { |
| 77 // Subscribe to this event to start listening to cloud devices. New | 101 // Subscribe to this event to start listening to cloud devices. New |
| 78 // listeners will get called with all known devices on the network. | 102 // listeners will get called with all known devices on the network. |
| 79 static void onLocalDeviceStateChanged(boolean available, GCDDevice device); | 103 static void onLocalDeviceStateChanged(boolean available, GCDDevice device); |
| 80 | 104 |
| 81 // Notifies app that setup is waiting for network list. | 105 // Notifies app that setup is waiting for network list. |
| 82 // App should reply with |setupSetWiFiNetworks|. | 106 // App should reply with |setupSetWiFiNetworks|. |
| 83 // |setupId| is a value returned by |setupStart|. | 107 // |setupId| is a value returned by |setupStart|. |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 99 | 123 |
| 100 // Notifies app that setup is completed successfully. | 124 // Notifies app that setup is completed successfully. |
| 101 // |setupId| is a value returned by |setupStart|. | 125 // |setupId| is a value returned by |setupStart|. |
| 102 static void onSetupSuccess(long setupId); | 126 static void onSetupSuccess(long setupId); |
| 103 | 127 |
| 104 // Notifies app that setup is failed or stoped. | 128 // Notifies app that setup is failed or stoped. |
| 105 // |setupId| is a value returned by |setupStart|. | 129 // |setupId| is a value returned by |setupStart|. |
| 106 static void onSetupError(long setupId); | 130 static void onSetupError(long setupId); |
| 107 }; | 131 }; |
| 108 }; | 132 }; |
| OLD | NEW |