Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / chrome / common / extensions / api / dial.idl
blobd16fdfd6919ea8af27f36f817f86f8c4d509e738
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
3 // found in the LICENSE file.
5 // Use the <code>chrome.dial</code> API to discover devices that support DIAL.
6 // Protocol specification: http://www.dial-multiscreen.org/
7 namespace dial {
9 // Represents a unique device that responded to a DIAL discovery request.
10 dictionary DialDevice {
12 // A label identifying the device within this instance of the browser.
13 // Not guaranteed to persist beyond browser instances.
14 DOMString deviceLabel;
16 // A URL pointing to the device description resource for the device.
17 DOMString deviceDescriptionUrl;
19 // The uPnP configuration ID reported by the device. Corresponds to the
20 // CONFIGID.UPNP.ORG header in the M-SEARCH response.
21 long? configId;
24 enum DialErrorCode {
25 no_listeners,
26 no_valid_network_interfaces,
27 network_disconnected,
28 cellular_network,
29 socket_error,
30 unknown
33 dictionary DialError {
34 DialErrorCode code;
37 callback BooleanCallback = void (boolean result);
39 interface Functions {
41 // Requests that DIAL discovery happen immediately. The request may not be
42 // honored as discovery may already be happening in the background. The
43 // callback is invoked with |true| if discovery was initiated or |false|
44 // otherwise.
45 static void discoverNow(BooleanCallback callback);
48 interface Events {
50 // 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
52 // event. May be fired in response to multiple circumstances:
54 // (1) The DIAL service refreshed its device list through periodic polling.
55 // (2) A client invoked discoverNow().
56 // (3) An event happened that should invalidate the device list
57 // (e.g., a network interface went offline), in which case it is fired
58 // with an empty array.
59 static void onDeviceList(DialDevice[] result);
61 // Event fired to inform clients on errors during device discovery.
62 static void onError(DialError error);