Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(108)

Side by Side Diff: chrome/browser/resources/sync_file_system_internals/extension_statuses.js

Issue 16398011: Show ExtensionID->OriginSyncStatus in syncfs-internals WebUI (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Hiroki review #1 Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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 })();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698