Chromium Code Reviews| 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 // An API for discovery of devices that support DIAL. | 5 // An API for discovery of devices that support DIAL. |
| 6 // Protocol specification: http://www.dial-multiscreen.org/ | 6 // Protocol specification: http://www.dial-multiscreen.org/ |
| 7 // | 7 // |
| 8 // The API is backed by a service that multicasts discovery requests on the | 8 // The API is backed by a service that multicasts discovery requests on the |
| 9 // local network to discover DIAL-capable devices and maintains a list of | 9 // local network to discover DIAL-capable devices and maintains a list of |
| 10 // devices that have responded. Adding an onDeviceList listener causes the | 10 // devices that have responded. Adding an onDeviceList listener causes the |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 21 // On-demand use (updates when discoverNow() is called): | 21 // On-demand use (updates when discoverNow() is called): |
| 22 // chrome.dial.onDeviceList.addListener(function (list) { updateMenu(list); }); | 22 // chrome.dial.onDeviceList.addListener(function (list) { updateMenu(list); }); |
| 23 // chrome.dial.discoverNow(); | 23 // chrome.dial.discoverNow(); |
| 24 // (Remember to remove the listener when the menu closes.) | 24 // (Remember to remove the listener when the menu closes.) |
| 25 // | 25 // |
| 26 // Background use (updates only when periodic polling happens): | 26 // Background use (updates only when periodic polling happens): |
| 27 // var myList; | 27 // var myList; |
| 28 // chrome.dial.onDeviceList.addListener(function (list) { myList = list; }); | 28 // chrome.dial.onDeviceList.addListener(function (list) { myList = list; }); |
| 29 // | 29 // |
| 30 // These can be combined to poll for devices to prime the device menu, then | 30 // These can be combined to poll for devices to prime the device menu, then |
| 31 // refresh the menu when it is displayed. | 31 // refresh the menu when it is displayed. |
|
epeterson
2013/06/13 03:24:28
All of this is going to show up as dial's descript
not at google - send to devlin
2013/06/19 16:47:16
Yes we should move it to an intro. Could you do th
epeterson
2013/06/20 23:07:40
I created an intro for chrome.dial. The API isn't
| |
| 32 | |
| 33 namespace dial { | 32 namespace dial { |
| 34 | 33 |
| 35 // Represents a unique device that responded to a DIAL discovery request. | 34 // Represents a unique device that responded to a DIAL discovery request. |
| 36 dictionary DialDevice { | 35 dictionary DialDevice { |
| 37 | 36 |
| 38 // A label identifying the device within this instance of the browser. | 37 // A label identifying the device within this instance of the browser. |
| 39 // Not guaranteed to persist beyond browser instances. | 38 // Not guaranteed to persist beyond browser instances. |
| 40 DOMString deviceLabel; | 39 DOMString deviceLabel; |
| 41 | 40 |
| 42 // A URL pointing to the device description resource for the device. | 41 // A URL pointing to the device description resource for the device. |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 81 // (2) A client invoked discoverNow(). | 80 // (2) A client invoked discoverNow(). |
| 82 // (3) An event happened that should invalidate the device list | 81 // (3) An event happened that should invalidate the device list |
| 83 // (e.g., a network interface went offline), in which case it is fired | 82 // (e.g., a network interface went offline), in which case it is fired |
| 84 // with an empty array. | 83 // with an empty array. |
| 85 static void onDeviceList(DialDevice[] result); | 84 static void onDeviceList(DialDevice[] result); |
| 86 | 85 |
| 87 // Event fired to inform clients on errors during device discovery. | 86 // Event fired to inform clients on errors during device discovery. |
| 88 static void onError(DialError error); | 87 static void onError(DialError error); |
| 89 }; | 88 }; |
| 90 }; | 89 }; |
| OLD | NEW |