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

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

Issue 2602593002: [chrome.dial] [WIP] Adds an API to get the active network ID. (Closed)
Patch Set: Outline API 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 enum DialErrorCode { 24 enum DialErrorCode {
25 no_listeners, 25 no_listeners,
26 // Deprecated. Use onNetworkIdChanged instead.
26 no_valid_network_interfaces, 27 no_valid_network_interfaces,
28 // Deprecated. Use onNetworkIdChanged instead.
27 network_disconnected, 29 network_disconnected,
28 cellular_network, 30 cellular_network,
29 socket_error, 31 socket_error,
30 unknown 32 unknown
31 }; 33 };
32 34
33 dictionary DialError { 35 dictionary DialError {
34 DialErrorCode code; 36 DialErrorCode code;
35 }; 37 };
36 38
37 callback BooleanCallback = void (boolean result); 39 callback BooleanCallback = void (boolean result);
40 callback NetworkIdCallback = void (DOMString result);
38 41
39 interface Functions { 42 interface Functions {
40 43
41 // Requests that DIAL discovery happen immediately. The request may not be 44 // Requests that DIAL discovery happen immediately. The request may not be
42 // honored as discovery may already be happening in the background. The 45 // honored as discovery may already be happening in the background. The
43 // callback is invoked with |true| if discovery was initiated or |false| 46 // callback is invoked with |true| if discovery was initiated or |false|
44 // otherwise. 47 // otherwise.
45 static void discoverNow(BooleanCallback callback); 48 static void discoverNow(BooleanCallback callback);
49
50 // Returns the current discovery network identifier. See the documentation
51 // for onNetworkIdChanged for details.
52 static void getNetworkId(NetworkIdCallback callback);
46 }; 53 };
47 54
48 interface Events { 55 interface Events {
49 56
50 // Event fired to inform clients of the current, complete set of responsive 57 // 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 58 // devices. Clients should only need to store the list from the most recent
52 // event. May be fired in response to multiple circumstances: 59 // event. May be fired in response to multiple circumstances:
53 // 60 //
54 // (1) The DIAL service refreshed its device list through periodic polling. 61 // (1) The DIAL service refreshed its device list through periodic polling.
55 // (2) A client invoked discoverNow(). 62 // (2) A client invoked discoverNow().
56 // (3) An event happened that should invalidate the device list 63 // (3) An event happened that should invalidate the device list
57 // (e.g., a network interface went offline), in which case it is fired 64 // (e.g., a network interface went offline), in which case it is fired
58 // with an empty array. 65 // with an empty array.
59 static void onDeviceList(DialDevice[] result); 66 static void onDeviceList(DialDevice[] result);
60 67
61 // Event fired to inform clients on errors during device discovery. 68 // Event fired to inform clients on errors during device discovery.
62 static void onError(DialError error); 69 static void onError(DialError error);
70
71 // Fired when the network being used for discovery has changed. |networkId|
72 // contains a short signature combining information from network interface
73 // and WiFi network identifiers to identify the current set of networks
74 // being used for discovery. This can be used by clients to clear and
75 // re-bootstrap device caches on a network change.
76 //
77 // |networkId| can take the following values:
78 // - "#XXXXXX" is a signature of the set of active networks.
79 // - "disconnected" means there is no active network for discovery.
80 // - "unknown" means there is an active network, but its signature
81 // cannot be determined.
82 //
83 // This event may be throttled to prevent it from firing too frequently; it
84 // is designed to be event-page friendly.
85 static void onNetworkIdChanged(DOMString networkId);
63 }; 86 };
64 }; 87 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698