- add sources.
[platform/framework/web/crosswalk.git] / src / chrome / common / extensions / api / dial.idl
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.
4
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 {
8
9   // Represents a unique device that responded to a DIAL discovery request.
10   dictionary DialDevice {
11
12     // A label identifying the device within this instance of the browser.
13     // Not guaranteed to persist beyond browser instances.
14     DOMString deviceLabel;
15
16     // A URL pointing to the device description resource for the device.
17     DOMString deviceDescriptionUrl;
18
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;
22   };
23
24   enum DialErrorCode {
25     no_listeners,
26     no_valid_network_interfaces,
27     network_disconnected,
28     cellular_network,
29     socket_error,
30     unknown
31   };
32
33   dictionary DialError {
34     DialErrorCode code;
35   };
36
37   callback BooleanCallback = void (boolean result);
38
39   interface Functions {
40
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);
46   };
47
48   interface Events {
49
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:
53     //
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);
60
61     // Event fired to inform clients on errors during device discovery.
62     static void onError(DialError error);
63   };
64 };