Chromium Code Reviews| Index: chrome/browser/resources/sync_file_system_internals/extension_statuses.js |
| diff --git a/chrome/browser/resources/sync_file_system_internals/extension_statuses.js b/chrome/browser/resources/sync_file_system_internals/extension_statuses.js |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..2b598f884fd16d03d313c36aa14552d01c33d1fd |
| --- /dev/null |
| +++ b/chrome/browser/resources/sync_file_system_internals/extension_statuses.js |
| @@ -0,0 +1,57 @@ |
| +// Copyright 2013 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +/** |
| + * WebUI to monitor the Sync File System Service. |
| + */ |
| +var extensionStatuses = (function() { |
| +'use strict'; |
| + |
| +function extensionStatuses() { |
|
Bernhard Bauer
2013/06/07 10:44:46
Class names should start upper-case.
calvinlo
2013/06/10 05:15:45
Done.
|
| +} |
| + |
| +/** |
| + * Get initial map of extension statuses (pending batch sync, enabled and |
| + * disabled). |
| + */ |
| +function getExtensionStatuses() { |
| + chrome.send('getExtensionStatuses'); |
| +} |
| + |
| +function main() { |
| + getExtensionStatuses(); |
| +} |
| + |
| +// TODO(calvinlo): Move to helper file so it doesn't need to be duplicated. |
| +/** |
| + * Creates an element named |elementName| containing the content |text|. |
| + * @param {string} elementName Name of the new element to be created. |
| + * @param {string} text Text to be contained in the new element. |
| + * @return {HTMLElement} The newly created HTML element. |
| + */ |
| +function createElementFromText(elementName, text) { |
| + var element = document.createElement(elementName); |
| + element.appendChild(document.createTextNode(text)); |
| + return element; |
| +} |
| + |
| +/** |
| + * Handles callback from getUpdateLog. |
| + * @param {Array} list List of dictionaries containing 'time' and 'logEvent'. |
| + */ |
| +extensionStatuses.prototype.onGetExtensionStatuses = |
| + function(extensionStatuses) { |
| + var itemContainer = $('extension-entries'); |
| + for (var i = 0; i < extensionStatuses.length; i++) { |
| + var originEntry = extensionStatuses[i]; |
| + var tr = document.createElement('tr'); |
| + tr.appendChild(createElementFromText('td', originEntry.extensionID)); |
| + tr.appendChild(createElementFromText('td', originEntry.status)); |
| + itemContainer.appendChild(tr); |
| + } |
| +} |
| + |
| +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.
|
| +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
|
| +})(); |