| Index: chrome/browser/resources/chromeos/drive_internals.js
|
| diff --git a/chrome/browser/resources/chromeos/drive_internals.js b/chrome/browser/resources/chromeos/drive_internals.js
|
| index 8e07931593549732e6110687364e54006ccd43eb..a578dc5efd69d61068ff84480c2db0abef12c405 100644
|
| --- a/chrome/browser/resources/chromeos/drive_internals.js
|
| +++ b/chrome/browser/resources/chromeos/drive_internals.js
|
| @@ -70,7 +70,7 @@ function updateCacheContents(cacheEntry) {
|
|
|
| /**
|
| * Updates the Local Storage summary.
|
| - * @param {Object} localStorageSummary Dictionaty describing the status of local
|
| + * @param {Object} localStorageSummary Dictionary describing the status of local
|
| * stogage.
|
| */
|
| function updateLocalStorageUsage(localStorageSummary) {
|
| @@ -79,6 +79,43 @@ function updateLocalStorageUsage(localStorageSummary) {
|
| }
|
|
|
| /**
|
| + * Updates the summary about in-flight operations.
|
| + * @param {Array} inFlightOperations List of dictionaries describing the status
|
| + * of in-flight operations.
|
| + */
|
| +function updateInFlightOperations(inFlightOperations) {
|
| + var container = $('in-flight-operations-contents');
|
| +
|
| + // Reset the table.
|
| + var existingNodes = container.childNodes;
|
| + for (var i = 0; i < existingNodes.length; i++) {
|
| + var node = existingNodes[i];
|
| + if (node.className == 'in-flight-operation')
|
| + container.removeChild(node);
|
| + }
|
| +
|
| + // Add in-flight operations.
|
| + for (var i = 0; i < inFlightOperations.length; i++) {
|
| + var operation = inFlightOperations[i];
|
| + var tr = document.createElement('tr');
|
| + tr.className = 'in-flight-operation';
|
| + tr.appendChild(createElementFromText('td', operation.operation_id));
|
| + tr.appendChild(createElementFromText('td', operation.operation_type));
|
| + tr.appendChild(createElementFromText('td', operation.file_path));
|
| + tr.appendChild(createElementFromText('td', operation.transfer_state));
|
| + tr.appendChild(createElementFromText('td', operation.start_time));
|
| + var progress = operation.progress_current + '/' + operation.progress_total;
|
| + if (operation.progress_total > 0) {
|
| + progress += ' (' +
|
| + (operation.progress_current / operation.progress_total * 100) + '%)';
|
| + }
|
| + tr.appendChild(createElementFromText('td', progress));
|
| +
|
| + container.appendChild(tr);
|
| + }
|
| +}
|
| +
|
| +/**
|
| * 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.
|
| @@ -92,4 +129,7 @@ function createElementFromText(elementName, text) {
|
|
|
| document.addEventListener('DOMContentLoaded', function() {
|
| chrome.send('pageLoaded');
|
| + window.setInterval(function() {
|
| + chrome.send('periodicUpdate');
|
| + }, 1000);
|
| });
|
|
|