1 // Copyright 2013 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 function dumpDevices(devices) {
6 $('#deviceinfos').empty();
7 $('#deviceinfos').append(outputDevicesToList(devices));
10 function outputDevicesToList(devices) {
11 var table = $('<table border="1">');
12 table.append($("<tr>" +
13 "<th>" + "Name" + "</th>" +
14 "<th>" + "OS" + "</th>" +
15 "<th>" + "Id" + "</th>" +
16 "<th>" + "Type" + "</th>" +
17 "<th>" + "Chrome Version" + "</th>" +
19 for (i = 0; i < devices.length; i++) {
20 table.append($("<tr>" +
21 "<td>" + devices[i].name + "</td>" +
22 "<td>" + devices[i].os + "</td>" +
23 "<td>" + devices[i].id + "</td>" +
24 "<td>" + devices[i].type + "</td>" +
25 "<td>" + devices[i].chromeVersion + "</td>" +
31 // Add an event listener to listen for changes to device info. The
32 // callback would redisplay the list of devices.
33 chrome.signedInDevices.onDeviceInfoChange.addListener(dumpDevices);
35 function populateDevices() {
36 // Get the list of devices and display it.
37 chrome.signedInDevices.get(false, dumpDevices);
40 document.addEventListener('DOMContentLoaded', function () {