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

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

Issue 2583853004: [chrome.dial] Adds chrome.dial.fetchDeviceDecription API. (Closed)
Patch Set: Fix initialization Created 3 years, 11 months 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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.dial</code> API to discover devices that support DIAL. 5 // Use the <code>chrome.dial</code> API to discover devices that support DIAL.
6 // Protocol specification: http://www.dial-multiscreen.org/ 6 // Protocol specification: http://www.dial-multiscreen.org/
7 namespace dial { 7 namespace dial {
8 8
9 // Represents a unique device that responded to a DIAL discovery request. 9 // Represents a unique device that responded to a DIAL discovery request.
10 dictionary DialDevice { 10 dictionary DialDevice {
11 11
12 // A label identifying the device within this instance of the browser. 12 // A label identifying the device within this instance of the browser.
13 // Not guaranteed to persist beyond browser instances. 13 // Not guaranteed to persist beyond browser instances.
14 DOMString deviceLabel; 14 DOMString deviceLabel;
15 15
16 // A URL pointing to the device description resource for the device. 16 // A URL pointing to the device description resource for the device.
17 DOMString deviceDescriptionUrl; 17 DOMString deviceDescriptionUrl;
18 18
19 // The uPnP configuration ID reported by the device. Corresponds to the 19 // The uPnP configuration ID reported by the device. Corresponds to the
20 // CONFIGID.UPNP.ORG header in the M-SEARCH response. 20 // CONFIGID.UPNP.ORG header in the M-SEARCH response.
21 long? configId; 21 long? configId;
22 }; 22 };
23 23
24 // Represents a device description resource successfully fetched from a
25 // DIAL device.
26 dictionary DialDeviceDescription {
27
28 // The label of the device that the description was fetched for.
29 DOMString deviceLabel;
30
31 // The contents of the Application-URL header in the response.
32 DOMString appUrl;
33
34 // The content of the response body. This will be an XML document
35 // (hopefully) conforming to section 2.3 of the UPnP spec.
36 DOMString deviceDescription;
37 };
38
24 enum DialErrorCode { 39 enum DialErrorCode {
25 no_listeners, 40 no_listeners,
26 no_valid_network_interfaces, 41 no_valid_network_interfaces,
27 network_disconnected, 42 network_disconnected,
28 cellular_network, 43 cellular_network,
29 socket_error, 44 socket_error,
30 unknown 45 unknown
31 }; 46 };
32 47
33 dictionary DialError { 48 dictionary DialError {
34 DialErrorCode code; 49 DialErrorCode code;
35 }; 50 };
36 51
37 callback BooleanCallback = void (boolean result); 52 callback BooleanCallback = void (boolean result);
53 callback DeviceDescriptionCallback = void (DialDeviceDescription result);
38 54
39 interface Functions { 55 interface Functions {
40 56
41 // Requests that DIAL discovery happen immediately. The request may not be 57 // Requests that DIAL discovery happen immediately. The request may not be
42 // honored as discovery may already be happening in the background. The 58 // honored as discovery may already be happening in the background. The
43 // callback is invoked with |true| if discovery was initiated or |false| 59 // callback is invoked with |true| if discovery was initiated or |false|
44 // otherwise. 60 // otherwise.
45 static void discoverNow(BooleanCallback callback); 61 static void discoverNow(BooleanCallback callback);
62
63 // Fetches the device description for the DIAL device identified by
64 // |deviceLabel|. If successful, the callback is invoked with a
65 // DialDeviceDescription containing the content of the device description.
66 //
67 // If unsuccessful, callback is invoked with |null| and lastError is set
68 // to an error message. If the error occurred during the HTTP fetch itself,
69 // the message will begin "HTTP XXX:" where XXX is the HTTP result code.
imcheng 2016/12/28 05:36:45 ... begin with
mark a. foltz 2017/01/04 00:20:16 Done.
70 static void fetchDeviceDescription(DOMString deviceLabel,
71 DeviceDescriptionCallback callback);
46 }; 72 };
47 73
48 interface Events { 74 interface Events {
49 75
50 // Event fired to inform clients of the current, complete set of responsive 76 // Event fired to inform clients of the current, complete set of responsive
51 // devices. Clients should only need to store the list from the most recent 77 // devices. Clients should only need to store the list from the most recent
52 // event. May be fired in response to multiple circumstances: 78 // event. May be fired in response to multiple circumstances:
53 // 79 //
54 // (1) The DIAL service refreshed its device list through periodic polling. 80 // (1) The DIAL service refreshed its device list through periodic polling.
55 // (2) A client invoked discoverNow(). 81 // (2) A client invoked discoverNow().
56 // (3) An event happened that should invalidate the device list 82 // (3) An event happened that should invalidate the device list
57 // (e.g., a network interface went offline), in which case it is fired 83 // (e.g., a network interface went offline), in which case it is fired
58 // with an empty array. 84 // with an empty array.
59 static void onDeviceList(DialDevice[] result); 85 static void onDeviceList(DialDevice[] result);
60 86
61 // Event fired to inform clients on errors during device discovery. 87 // Event fired to inform clients on errors during device discovery.
62 static void onError(DialError error); 88 static void onError(DialError error);
63 }; 89 };
64 }; 90 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698