Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 /** | 5 /** |
| 6 * Updates the Authentication Status section. | 6 * Updates the Authentication Status section. |
| 7 * @param {Object} authStatus Dictionary containing auth status. | 7 * @param {Object} authStatus Dictionary containing auth status. |
| 8 */ | 8 */ |
| 9 function updateAuthStatus(authStatus) { | 9 function updateAuthStatus(authStatus) { |
| 10 $('has-refresh-token').textContent = authStatus['has-refresh-token']; | 10 $('has-refresh-token').textContent = authStatus['has-refresh-token']; |
| 11 $('has-access-token').textContent = authStatus['has-access-token']; | 11 $('has-access-token').textContent = authStatus['has-access-token']; |
| 12 } | 12 } |
| 13 | 13 |
| 14 /** | 14 /** |
| 15 * Updates the GCache Contents section. | 15 * Updates the GCache Contents section. |
| 16 * @param {Array} gcacheContents List of dictionaries describing metadata | 16 * @param {Array} gcacheContents List of dictionaries describing metadata |
| 17 * of files and directories under the GCache directory. | 17 * of files and directories under the GCache directory. |
| 18 * @param {Array} gcacheSummary Dictionary of summary of GCache. | |
|
satorux1
2012/08/04 01:28:26
The type should be Object
| |
| 18 */ | 19 */ |
| 19 function updateGCacheContents(gcacheContents) { | 20 function updateGCacheContents(gcacheContents, gcacheSummary) { |
| 20 var tbody = $('gcache-contents'); | 21 var tbody = $('gcache-contents'); |
| 21 for (var i = 0; i < gcacheContents.length; i++) { | 22 for (var i = 0; i < gcacheContents.length; i++) { |
| 22 var entry = gcacheContents[i]; | 23 var entry = gcacheContents[i]; |
| 23 var tr = document.createElement('tr'); | 24 var tr = document.createElement('tr'); |
| 24 | 25 |
| 25 // Add some suffix based on the type. | 26 // Add some suffix based on the type. |
| 26 var path = entry.path; | 27 var path = entry.path; |
| 27 if (entry.is_directory) | 28 if (entry.is_directory) |
| 28 path += '/'; | 29 path += '/'; |
| 29 else if (entry.is_symbolic_link) | 30 else if (entry.is_symbolic_link) |
| 30 path += '@'; | 31 path += '@'; |
| 31 | 32 |
| 32 tr.appendChild(createElementFromText('td', path)); | 33 tr.appendChild(createElementFromText('td', path)); |
| 33 tr.appendChild(createElementFromText('td', entry.size)); | 34 tr.appendChild(createElementFromText('td', entry.size)); |
| 34 tr.appendChild(createElementFromText('td', entry.last_modified)); | 35 tr.appendChild(createElementFromText('td', entry.last_modified)); |
| 35 tbody.appendChild(tr); | 36 tbody.appendChild(tr); |
| 36 } | 37 } |
| 38 | |
| 39 $('gcache-summary-total-size').textContent = gcacheSummary['total_size']; | |
| 37 } | 40 } |
| 38 | 41 |
| 39 /** | 42 /** |
| 40 * Updates the File System Contents section. The function is called from the | 43 * Updates the File System Contents section. The function is called from the |
| 41 * C++ side repeatedly with contents of a directory. | 44 * C++ side repeatedly with contents of a directory. |
| 42 * @param {string} directoryContentsAsText Pre-formatted string representation | 45 * @param {string} directoryContentsAsText Pre-formatted string representation |
| 43 * of contents a directory in the file system. | 46 * of contents a directory in the file system. |
| 44 */ | 47 */ |
| 45 function updateFileSystemContents(directoryContentsAsText) { | 48 function updateFileSystemContents(directoryContentsAsText) { |
| 46 var div = $('file-system-contents'); | 49 var div = $('file-system-contents'); |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 73 */ | 76 */ |
| 74 function createElementFromText(elementName, text) { | 77 function createElementFromText(elementName, text) { |
| 75 var element = document.createElement(elementName); | 78 var element = document.createElement(elementName); |
| 76 element.appendChild(document.createTextNode(text)); | 79 element.appendChild(document.createTextNode(text)); |
| 77 return element; | 80 return element; |
| 78 } | 81 } |
| 79 | 82 |
| 80 document.addEventListener('DOMContentLoaded', function() { | 83 document.addEventListener('DOMContentLoaded', function() { |
| 81 chrome.send('pageLoaded'); | 84 chrome.send('pageLoaded'); |
| 82 }); | 85 }); |
| OLD | NEW |