| 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 tr.appendChild(createElementFromText('td', cacheEntry.is_present)); | 62 tr.appendChild(createElementFromText('td', cacheEntry.is_present)); |
| 63 tr.appendChild(createElementFromText('td', cacheEntry.is_pinned)); | 63 tr.appendChild(createElementFromText('td', cacheEntry.is_pinned)); |
| 64 tr.appendChild(createElementFromText('td', cacheEntry.is_dirty)); | 64 tr.appendChild(createElementFromText('td', cacheEntry.is_dirty)); |
| 65 tr.appendChild(createElementFromText('td', cacheEntry.is_mounted)); | 65 tr.appendChild(createElementFromText('td', cacheEntry.is_mounted)); |
| 66 tr.appendChild(createElementFromText('td', cacheEntry.is_persistent)); | 66 tr.appendChild(createElementFromText('td', cacheEntry.is_persistent)); |
| 67 | 67 |
| 68 $('cache-contents').appendChild(tr); | 68 $('cache-contents').appendChild(tr); |
| 69 } | 69 } |
| 70 | 70 |
| 71 /** | 71 /** |
| 72 * Updates the Local Storage summary. |
| 73 * @param {Object} localStorageSummary Dictionaty describing the status of local |
| 74 * stogage. |
| 75 */ |
| 76 function updateLocalStorageUsage(localStorageSummary) { |
| 77 var freeSpaceInMB = localStorageSummary.free_space / (1 << 20); |
| 78 $('local-storage-freespace').innerText = freeSpaceInMB; |
| 79 } |
| 80 |
| 81 /** |
| 72 * Creates an element named |elementName| containing the content |text|. | 82 * Creates an element named |elementName| containing the content |text|. |
| 73 * @param {string} elementName Name of the new element to be created. | 83 * @param {string} elementName Name of the new element to be created. |
| 74 * @param {string} text Text to be contained in the new element. | 84 * @param {string} text Text to be contained in the new element. |
| 75 * @return {HTMLElement} The newly created HTML element. | 85 * @return {HTMLElement} The newly created HTML element. |
| 76 */ | 86 */ |
| 77 function createElementFromText(elementName, text) { | 87 function createElementFromText(elementName, text) { |
| 78 var element = document.createElement(elementName); | 88 var element = document.createElement(elementName); |
| 79 element.appendChild(document.createTextNode(text)); | 89 element.appendChild(document.createTextNode(text)); |
| 80 return element; | 90 return element; |
| 81 } | 91 } |
| 82 | 92 |
| 83 document.addEventListener('DOMContentLoaded', function() { | 93 document.addEventListener('DOMContentLoaded', function() { |
| 84 chrome.send('pageLoaded'); | 94 chrome.send('pageLoaded'); |
| 85 }); | 95 }); |
| OLD | NEW |