Chromium Code Reviews| 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 e372a1ce9fd1cffa60e8ac3e4e4e2fdd1c838329..e1f466fbe8f2c45075eb3fa5e382493fd9172dfe 100644 |
| --- a/chrome/browser/resources/chromeos/drive_internals.js |
| +++ b/chrome/browser/resources/chromeos/drive_internals.js |
| @@ -4,11 +4,55 @@ |
| /** |
| * Updates the Authentication Status section. |
| - * @param {Object} auth_status Dictionary containing auth status. |
| + * @param {Object} authStatus Dictionary containing auth status. |
| */ |
| -function UpdateAuthStatus(auth_status) { |
| - $('has-refresh-token').textContent = auth_status['has-refresh-token']; |
| - $('has-access-token').textContent = auth_status['has-access-token']; |
| +function UpdateAuthStatus(authStatus) { |
|
achuithb
2012/07/26 23:16:29
same
satorux1
2012/07/27 15:23:23
Done.
|
| + $('has-refresh-token').textContent = authStatus['has-refresh-token']; |
| + $('has-access-token').textContent = authStatus['has-access-token']; |
| +} |
| + |
| +/** |
| + * Updates the GCache Contents section. |
| + * @param {Array} gcacheContents List of dictionaries describing metadata |
| + * of files and directories under the GCache directory. |
| + */ |
| +function UpdateGCacheContents(gcacheContents) { |
|
achuithb
2012/07/26 23:16:29
I think the first letter needs not be capitalized
satorux1
2012/07/27 15:23:23
Good catch! Done.
|
| + var tbody = $('gcache-contents'); |
| + // Add a header row. |
| + var tr = document.createElement('tr'); |
| + tr.appendChild(createElementFromText('th', 'Path')); |
| + tr.appendChild(createElementFromText('th', 'Size')); |
| + tr.appendChild(createElementFromText('th', 'Last Modified')); |
| + tbody.appendChild(tr); |
| + |
| + for (var i = 0; i < gcacheContents.length; i++) { |
| + var entry = gcacheContents[i]; |
| + var tr = document.createElement('tr'); |
| + |
| + // Add some suffix based on the type. |
| + var path = entry.path; |
| + if (entry.is_directory) |
| + path += '/'; |
| + else if (entry.is_symbolic_link) |
| + path += '@'; |
| + |
| + tr.appendChild(createElementFromText('td', path)); |
| + tr.appendChild(createElementFromText('td', entry.size)); |
| + tr.appendChild(createElementFromText('td', entry.last_modified)); |
| + tbody.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. |
| + * @return {HTMLElement} The newly created HTML element. |
| + */ |
| +function createElementFromText(elementName, text) { |
| + var element = document.createElement(elementName); |
| + element.appendChild(document.createTextNode(text)); |
| + return element; |
| } |
| document.addEventListener('DOMContentLoaded', function() { |