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

Unified 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: Rebase to test mac compile 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 side-by-side diff with in-line comments
Download patch
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..f1943126b552a1c488f8a3a563470ee9bc321562
--- /dev/null
+++ b/chrome/browser/resources/sync_file_system_internals/extension_statuses.js
@@ -0,0 +1,59 @@
+// 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.
+
+/**
+ * Handles the Extension ID -> SyncStatus tab for syncfs-internals.
+ */
+var ExtensionStatuses = (function() {
+'use strict';
+
+var ExtensionStatuses = {};
+
+/**
+ * Get initial map of extension statuses (pending batch sync, enabled and
+ * disabled).
+ */
+function getExtensionStatuses() {
+ chrome.send('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 onGetExtensionStatuses.
+ * @param {Array} list of dictionaries containing 'extensionID' and 'status'.
+ */
+ExtensionStatuses.onGetExtensionStatuses = function(extensionStatuses) {
+ var itemContainer = $('extension-entries');
+ itemContainer.textContent = '';
+
+ 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);
+ }
+}
+
+function main() {
+ getExtensionStatuses();
+ $('refresh-extensions-statuses').addEventListener('click',
+ getExtensionStatuses);
+}
+
+document.addEventListener('DOMContentLoaded', main);
+return ExtensionStatuses;
+})();

Powered by Google App Engine
This is Rietveld 408576698