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']; |
(...skipping 11 matching lines...) Expand all Loading... | |
22 var entry = gcacheContents[i]; | 22 var entry = gcacheContents[i]; |
23 var tr = document.createElement('tr'); | 23 var tr = document.createElement('tr'); |
24 | 24 |
25 // Add some suffix based on the type. | 25 // Add some suffix based on the type. |
26 var path = entry.path; | 26 var path = entry.path; |
27 if (entry.is_directory) | 27 if (entry.is_directory) |
28 path += '/'; | 28 path += '/'; |
29 else if (entry.is_symbolic_link) | 29 else if (entry.is_symbolic_link) |
30 path += '@'; | 30 path += '@'; |
31 | 31 |
32 // Try to parse ISO8601-formated date and stringify to localized format. | |
33 var last_modified = new Date(entry.last_modified); | |
34 var last_modified_str = | |
35 (last_modified && !isNaN(last_modified)) ? last_modified.ToString() : | |
36 '[' + last_modified + ']'; | |
satorux1
2012/08/03 23:06:28
Can we instead pass the local time from C++ side?
| |
37 | |
32 tr.appendChild(createElementFromText('td', path)); | 38 tr.appendChild(createElementFromText('td', path)); |
33 tr.appendChild(createElementFromText('td', entry.size)); | 39 tr.appendChild(createElementFromText('td', entry.size)); |
34 tr.appendChild(createElementFromText('td', entry.last_modified)); | 40 tr.appendChild(createElementFromText('td', last_modified_str)); |
35 tbody.appendChild(tr); | 41 tbody.appendChild(tr); |
36 } | 42 } |
37 } | 43 } |
38 | 44 |
39 /** | 45 /** |
40 * Updates the File System Contents section. The function is called from the | 46 * Updates the File System Contents section. The function is called from the |
41 * C++ side repeatedly with contents of a directory. | 47 * C++ side repeatedly with contents of a directory. |
42 * @param {string} directoryContentsAsText Pre-formatted string representation | 48 * @param {string} directoryContentsAsText Pre-formatted string representation |
43 * of contents a directory in the file system. | 49 * of contents a directory in the file system. |
44 */ | 50 */ |
(...skipping 28 matching lines...) Expand all Loading... | |
73 */ | 79 */ |
74 function createElementFromText(elementName, text) { | 80 function createElementFromText(elementName, text) { |
75 var element = document.createElement(elementName); | 81 var element = document.createElement(elementName); |
76 element.appendChild(document.createTextNode(text)); | 82 element.appendChild(document.createTextNode(text)); |
77 return element; | 83 return element; |
78 } | 84 } |
79 | 85 |
80 document.addEventListener('DOMContentLoaded', function() { | 86 document.addEventListener('DOMContentLoaded', function() { |
81 chrome.send('pageLoaded'); | 87 chrome.send('pageLoaded'); |
82 }); | 88 }); |
OLD | NEW |