OLD | NEW |
---|---|
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 { |
(...skipping 16 matching lines...) Expand all Loading... | |
27 network_disconnected, | 27 network_disconnected, |
28 cellular_network, | 28 cellular_network, |
29 socket_error, | 29 socket_error, |
30 unknown | 30 unknown |
31 }; | 31 }; |
32 | 32 |
33 dictionary DialError { | 33 dictionary DialError { |
34 DialErrorCode code; | 34 DialErrorCode code; |
35 }; | 35 }; |
36 | 36 |
37 // The NetworkService interface is used to provide a set of connection | |
38 // information for an HTTP service endpoint and if available, service events | |
39 // running on a networked device. | |
40 // | |
41 // TODO(justinlin): Add event interfaces? | |
42 dictionary NetworkService { | |
43 // A unique identifier for the given user-selected service instance. | |
44 DOMString id; | |
45 | |
46 // The name of the user-selected service. | |
47 DOMString name; | |
48 | |
49 // The valid service type token value of the user-selected service | |
50 // (i.e. upnp:..., zeroconf:..., dial:...). | |
51 DOMString type; | |
52 | |
53 // The control URL endpoint (including any required port information) of the | |
54 // user-selected control service that has been added to the entry script | |
55 // origin's URL whitelist. | |
mark a. foltz
2013/08/19 18:25:26
The URL whitelist comment doesn't make as much sen
| |
56 DOMString url; | |
57 | |
58 // The configuration information associated with the service depending on | |
59 // the requested service type. | |
60 DOMString config; | |
61 | |
62 // Current date + deviice expiry in UTC time. | |
63 long expiryTimestamp; | |
64 | |
65 // Whether the service is online. | |
mark a. foltz
2013/08/19 18:25:26
I am not sure this is directly available from the
| |
66 boolean online; | |
67 }; | |
68 | |
37 callback BooleanCallback = void (boolean result); | 69 callback BooleanCallback = void (boolean result); |
38 | 70 |
71 callback GetNetworkServicesCallback = void (NetworkService[] deviceInfo); | |
72 | |
39 interface Functions { | 73 interface Functions { |
40 | |
41 // Requests that DIAL discovery happen immediately. The request may not be | 74 // Requests that DIAL discovery happen immediately. The request may not be |
42 // honored as discovery may already be happening in the background. The | 75 // honored as discovery may already be happening in the background. The |
43 // callback is invoked with |true| if discovery was initiated or |false| | 76 // callback is invoked with |true| if discovery was initiated or |false| |
44 // otherwise. | 77 // otherwise. |
45 static void discoverNow(BooleanCallback callback); | 78 static void discoverNow(BooleanCallback callback); |
79 | |
80 static void getNetworkServices(GetNetworkServicesCallback callback); | |
46 }; | 81 }; |
47 | 82 |
48 interface Events { | 83 interface Events { |
49 | 84 |
50 // Event fired to inform clients of the current, complete set of responsive | 85 // 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 | 86 // devices. Clients should only need to store the list from the most recent |
52 // event. May be fired in response to multiple circumstances: | 87 // event. May be fired in response to multiple circumstances: |
53 // | 88 // |
54 // (1) The DIAL service refreshed its device list through periodic polling. | 89 // (1) The DIAL service refreshed its device list through periodic polling. |
55 // (2) A client invoked discoverNow(). | 90 // (2) A client invoked discoverNow(). |
56 // (3) An event happened that should invalidate the device list | 91 // (3) An event happened that should invalidate the device list |
57 // (e.g., a network interface went offline), in which case it is fired | 92 // (e.g., a network interface went offline), in which case it is fired |
58 // with an empty array. | 93 // with an empty array. |
59 static void onDeviceList(DialDevice[] result); | 94 static void onDeviceList(DialDevice[] result); |
60 | 95 |
61 // Event fired to inform clients on errors during device discovery. | 96 // Event fired to inform clients on errors during device discovery. |
62 static void onError(DialError error); | 97 static void onError(DialError error); |
98 | |
99 // TODO(justinlin): Merge these two events? | |
100 // Event fired when a network service becomes newly available. | |
101 static void onNetworkServiceAvailable(); | |
102 // Event fired when a network service becomes newly unavailable. | |
103 static void onNetworkServiceUnavailable(); | |
63 }; | 104 }; |
64 }; | 105 }; |
OLD | NEW |