Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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. | |
| 4 | |
| 5 /** | |
| 6 * WebUI to monitor the Sync File System Service. | |
| 7 */ | |
| 8 var extensionStatuses = (function() { | |
| 9 'use strict'; | |
| 10 | |
| 11 function extensionStatuses() { | |
|
Bernhard Bauer
2013/06/07 10:44:46
Class names should start upper-case.
calvinlo
2013/06/10 05:15:45
Done.
| |
| 12 } | |
| 13 | |
| 14 /** | |
| 15 * Get initial map of extension statuses (pending batch sync, enabled and | |
| 16 * disabled). | |
| 17 */ | |
| 18 function getExtensionStatuses() { | |
| 19 chrome.send('getExtensionStatuses'); | |
| 20 } | |
| 21 | |
| 22 function main() { | |
| 23 getExtensionStatuses(); | |
| 24 } | |
| 25 | |
| 26 // TODO(calvinlo): Move to helper file so it doesn't need to be duplicated. | |
| 27 /** | |
| 28 * Creates an element named |elementName| containing the content |text|. | |
| 29 * @param {string} elementName Name of the new element to be created. | |
| 30 * @param {string} text Text to be contained in the new element. | |
| 31 * @return {HTMLElement} The newly created HTML element. | |
| 32 */ | |
| 33 function createElementFromText(elementName, text) { | |
| 34 var element = document.createElement(elementName); | |
| 35 element.appendChild(document.createTextNode(text)); | |
| 36 return element; | |
| 37 } | |
| 38 | |
| 39 /** | |
| 40 * Handles callback from getUpdateLog. | |
| 41 * @param {Array} list List of dictionaries containing 'time' and 'logEvent'. | |
| 42 */ | |
| 43 extensionStatuses.prototype.onGetExtensionStatuses = | |
| 44 function(extensionStatuses) { | |
| 45 var itemContainer = $('extension-entries'); | |
| 46 for (var i = 0; i < extensionStatuses.length; i++) { | |
| 47 var originEntry = extensionStatuses[i]; | |
| 48 var tr = document.createElement('tr'); | |
| 49 tr.appendChild(createElementFromText('td', originEntry.extensionID)); | |
| 50 tr.appendChild(createElementFromText('td', originEntry.status)); | |
| 51 itemContainer.appendChild(tr); | |
| 52 } | |
| 53 } | |
| 54 | |
| 55 document.addEventListener('DOMContentLoaded', main); | |
|
Bernhard Bauer
2013/06/07 10:44:46
You could directly add getExtensionStatuses here.
calvinlo
2013/06/10 05:15:45
Done.
| |
| 56 return new extensionStatuses; | |
|
Bernhard Bauer
2013/06/07 10:44:46
Do you actually need an instance of this class her
calvinlo
2013/06/10 05:15:45
You're right, this could just be an exported stati
| |
| 57 })(); | |
| OLD | NEW |