Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(468)

Side by Side Diff: chrome/common/extensions/api/gcd_private.idl

Issue 695253002: chrome.gcdPrivate allows app to choose pairing method. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Mon Nov 3 15:09:22 PST 2014 Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 12 matching lines...) Expand all
23 DOMString deviceType; 23 DOMString deviceType;
24 24
25 // Device human readable name. 25 // Device human readable name.
26 DOMString deviceName; 26 DOMString deviceName;
27 27
28 // Device human readable description. 28 // Device human readable description.
29 DOMString deviceDescription; 29 DOMString deviceDescription;
30 }; 30 };
31 31
32 enum Status { 32 enum Status {
33 // Success.
34 success,
35
33 // populateWifiPassword was true and the password has not been prefetched. 36 // populateWifiPassword was true and the password has not been prefetched.
34 wifiPasswordError, 37 wifiPasswordError,
35 38
36 // populateWifiPassword was true and the message cannot be parsed as a setup 39 // populateWifiPassword was true and the message cannot be parsed as a setup
37 // message. 40 // message.
38 setupParseError, 41 setupParseError,
39 42
40 // Could not connect to the device. 43 // Could not connect to the device.
41 connectionError, 44 connectionError,
42 45
43 // Error in establishing session. 46 // Error in establishing session.
44 sessionError, 47 sessionError,
45 48
46 // Unknown session. 49 // Unknown session.
47 unknownSessionError, 50 unknownSessionError,
48 51
49 // Bad confirmation code. Ask user to retype. 52 // Bad pairing code. Ask user to retype.
50 badConfirmationCodeError, 53 badPairingCodeError,
51 54
52 // Success. 55 // Setup error.
53 success 56 setupError
54 }; 57 };
55 58
56 enum ConfirmationType { 59 enum PairingType {
57 displayCode, 60 pinCode,
58 stickerCode 61 embeddedCode
59 };
60
61 // Information regarding the confirmation of a device.
62 dictionary ConfirmationInfo {
63 // Type of confirmation.
64 ConfirmationType type;
65
66 // Code if available.
67 DOMString? code;
68 }; 62 };
69 63
70 callback CloudDeviceListCallback = void(GCDDevice[] devices); 64 callback CloudDeviceListCallback = void(GCDDevice[] devices);
71 65
72 // |commandDefinitions| : Is "commandDefs" value of device described at 66 // |commandDefinitions| : Is "commandDefs" value of device described at
73 // https://developers.google.com/cloud-devices/v1/reference/devices 67 // https://developers.google.com/cloud-devices/v1/reference/devices
74 // TODO(vitalybuka): consider to describe object in IDL. 68 // TODO(vitalybuka): consider to describe object in IDL.
75 callback CommandDefinitionsCallback = void(object commandDefinitions); 69 callback CommandDefinitionsCallback = void(object commandDefinitions);
76 70
77 // |command| : Described at 71 // |command| : Described at
78 // https://developers.google.com/cloud-devices/v1/reference/commands 72 // https://developers.google.com/cloud-devices/v1/reference/commands
79 // TODO(vitalybuka): consider to describe object in IDL. 73 // TODO(vitalybuka): consider to describe object in IDL.
80 callback CommandCallback = void(object command); 74 callback CommandCallback = void(object command);
81 75
82 // |commands| : Array of commands described at 76 // |commands| : Array of commands described at
83 // https://developers.google.com/cloud-devices/v1/reference/commands 77 // https://developers.google.com/cloud-devices/v1/reference/commands
84 // TODO(vitalybuka): consider to describe object in IDL. 78 // TODO(vitalybuka): consider to describe object in IDL.
85 callback CommandListCallback = void(object[] commands); 79 callback CommandListCallback = void(object[] commands);
86 80
87 // Called when the confirmation code is available or on error. 81 // Generic callback for session calls, with status only.
88 // |sessionId| is the session ID (identifies the session for future calls) 82 callback SessionCallback = void(Status status);
89 // |status| is the status (success or type of error) 83
90 // |confirmation| is the information about the confirmation. 84 // Called when device establishing of secure session is started.
Aleksey Shlyapnikov 2014/11/03 23:35:09 Called when device starts to establish a secure se
Vitaly Buka (NO REVIEWS) 2014/11/04 00:54:38 Done.
91 callback ConfirmationCodeCallback = void(long sessionId, 85 // If |status| is |success| app should vall |startPairing|.
86 // |sessionId| is the session ID (identifies the session for future calls).
87 // |status| is the status (success or type of error).
88 // |pairingTypes| is the list of supported pairing types.
89 callback EstablishSessionCallback = void(long sessionId,
92 Status status, 90 Status status,
93 ConfirmationInfo confirmation); 91 PairingType[] pairingTypes);
94
95 // Called to indicated the session is established.
96 // |status| is the status (success or type of error)
97 callback SessionEstablishedCallback = void(Status status);
98 92
99 // Called when the response to the message sent is available or on error. 93 // Called when the response to the message sent is available or on error.
100 // |status| is the status (success or type of error) 94 // |status| is the status (success or type of error)
101 // |response| is the response object or null on error 95 // |response| is the response object or null on error
102 callback MessageResponseCallback = void(Status status, 96 callback SendMessageCallback = void(Status status,
103 object response); 97 object response);
104 98
105 // Called as a response to |prefetchWifiPassword| 99 // Called as a response to |prefetchWifiPassword|
106 // |success| Denotes whether the password fetch has succeeded or failed. 100 // |success| Denotes whether the password fetch has succeeded or failed.
107 callback SuccessCallback = void(boolean success); 101 callback SuccessCallback = void(boolean success);
108 102
109 // Called as a response to |getPrefetchedWifiNameList| 103 // Called as a response to |getPrefetchedWifiNameList|
110 // |list| the list of ssids for which wifi passwords were prefetched. 104 // |list| the list of ssids for which wifi passwords were prefetched.
111 callback SSIDListCallback = void(DOMString[] networks); 105 callback SSIDListCallback = void(DOMString[] networks);
112 106
113 interface Functions { 107 interface Functions {
(...skipping 11 matching lines...) Expand all
125 // not be done while connected to the device's network. Callback is called 119 // not be done while connected to the device's network. Callback is called
126 // with true if wifi password was cached and false if it was unavailable. 120 // with true if wifi password was cached and false if it was unavailable.
127 static void prefetchWifiPassword(DOMString ssid, SuccessCallback callback); 121 static void prefetchWifiPassword(DOMString ssid, SuccessCallback callback);
128 122
129 // Get the list of ssids with prefetched callbacks. 123 // Get the list of ssids with prefetched callbacks.
130 static void getPrefetchedWifiNameList(SSIDListCallback callback); 124 static void getPrefetchedWifiNameList(SSIDListCallback callback);
131 125
132 // Establish the session. 126 // Establish the session.
133 static void establishSession(DOMString ipAddress, 127 static void establishSession(DOMString ipAddress,
134 long port, 128 long port,
135 ConfirmationCodeCallback callback); 129 EstablishSessionCallback callback);
136 130
137 // Send confirmation code. Device will still need to confirm. |code| must be 131 // Start pairing with selected method.
138 // present and must match the code from the device, even when the code is 132 // |pairingType| is the any value provided
139 // supplied in the |ConfirmationInfo| object. 133 static void startPairing(long sessionId,
134 PairingType pairingType,
135 SessionCallback callback);
136
137 // Confirm pairing code.
138 // |code| is the string generated by pairing process and availible to the
139 // user.
140 static void confirmCode(long sessionId, 140 static void confirmCode(long sessionId,
141 DOMString code, 141 DOMString code,
142 SessionEstablishedCallback callback); 142 SessionCallback callback);
143 143
144 // Send an encrypted message to the device. |api| is the API path and 144 // Send an encrypted message to the device. |api| is the API path and
145 // |input| is the input object. If the message is a setup message with a 145 // |input| is the input object. If the message is a setup message with a
146 // wifi ssid specified but no password, the password cached from 146 // wifi ssid specified but no password, the password cached from
147 // |prefetchWifiPassword| will be used and the call will fail if it's not 147 // |prefetchWifiPassword| will be used and the call will fail if it's not
148 // available. For open networks use an empty string as the password. 148 // available. For open networks use an empty string as the password.
149 static void sendMessage(long sessionId, 149 static void sendMessage(long sessionId,
150 DOMString api, 150 DOMString api,
151 object input, 151 object input,
152 MessageResponseCallback callback); 152 SendMessageCallback callback);
153 153
154 // Terminate the session with the device. 154 // Terminate the session with the device.
155 static void terminateSession(long sessionId); 155 static void terminateSession(long sessionId);
156 156
157 // Returns command definitions. 157 // Returns command definitions.
158 // |deviceId| : The device to get command definitions for. 158 // |deviceId| : The device to get command definitions for.
159 // |callback| : The result callback. 159 // |callback| : The result callback.
160 static void getCommandDefinitions(DOMString deviceId, 160 static void getCommandDefinitions(DOMString deviceId,
161 CommandDefinitionsCallback callback); 161 CommandDefinitionsCallback callback);
162 162
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 // Subscribe to this event to start listening new or updated devices. New 200 // Subscribe to this event to start listening new or updated devices. New
201 // listeners will get called with all known devices on the network, and 201 // listeners will get called with all known devices on the network, and
202 // status updates for devices available through the cloud. 202 // status updates for devices available through the cloud.
203 static void onDeviceStateChanged(GCDDevice device); 203 static void onDeviceStateChanged(GCDDevice device);
204 204
205 // Notifies that device has disappeared. 205 // Notifies that device has disappeared.
206 // |deviceId| : The device has disappeared. 206 // |deviceId| : The device has disappeared.
207 static void onDeviceRemoved(DOMString deviceId); 207 static void onDeviceRemoved(DOMString deviceId);
208 }; 208 };
209 }; 209 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698