| 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 /* Id for tracking automatic refresh of crash list. */ | 5 /* Id for tracking automatic refresh of crash list. */ |
| 6 var refreshCrashListId = undefined; | 6 var refreshCrashListId = undefined; |
| 7 | 7 |
| 8 /** | 8 /** |
| 9 * Requests the list of crashes from the backend. | 9 * Requests the list of crashes from the backend. |
| 10 */ | 10 */ |
| 11 function requestCrashes() { | 11 function requestCrashes() { |
| 12 chrome.send('requestCrashList'); | 12 chrome.send('requestCrashList'); |
| 13 } | 13 } |
| 14 | 14 |
| 15 /** | 15 /** |
| 16 * Callback from backend with the list of crashes. Builds the UI. | 16 * Callback from backend with the list of crashes. Builds the UI. |
| 17 * @param {boolean} enabled Whether or not crash reporting is enabled. | 17 * @param {boolean} enabled Whether or not crash reporting is enabled. |
| 18 * @param {boolean} dynamicBackend Whether the crash backend is dynamic. | 18 * @param {boolean} dynamicBackend Whether the crash backend is dynamic. |
| 19 * @param {array} crashes The list of crashes. | 19 * @param {array} crashes The list of crashes. |
| 20 * @param {string} version The browser version. | 20 * @param {string} version The browser version. |
| 21 * @param {string} os The OS name and version. | 21 * @param {string} os The OS name and version. |
| 22 */ | 22 */ |
| 23 function updateCrashList(enabled, dynamicBackend, crashes, version, os) { | 23 function updateCrashList(enabled, dynamicBackend, crashes, version, os) { |
| 24 $('countBanner').textContent = loadTimeData.getStringF('crashCountFormat', | 24 $('countBanner').textContent = |
| 25 crashes.length); | 25 loadTimeData.getStringF('crashCountFormat', |
| 26 crashes.length.toLocaleString()); |
| 26 | 27 |
| 27 var crashSection = $('crashList'); | 28 var crashSection = $('crashList'); |
| 28 | 29 |
| 29 $('enabledMode').hidden = !enabled; | 30 $('enabledMode').hidden = !enabled; |
| 30 $('disabledMode').hidden = enabled; | 31 $('disabledMode').hidden = enabled; |
| 31 $('crashUploadStatus').hidden = !enabled || !dynamicBackend; | 32 $('crashUploadStatus').hidden = !enabled || !dynamicBackend; |
| 32 | 33 |
| 33 if (!enabled) | 34 if (!enabled) |
| 34 return; | 35 return; |
| 35 | 36 |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 | 105 |
| 105 // Trigger a refresh in 5 seconds. Clear any previous requests. | 106 // Trigger a refresh in 5 seconds. Clear any previous requests. |
| 106 clearTimeout(refreshCrashListId); | 107 clearTimeout(refreshCrashListId); |
| 107 refreshCrashListId = setTimeout(requestCrashes, 5000); | 108 refreshCrashListId = setTimeout(requestCrashes, 5000); |
| 108 } | 109 } |
| 109 | 110 |
| 110 document.addEventListener('DOMContentLoaded', function() { | 111 document.addEventListener('DOMContentLoaded', function() { |
| 111 $('uploadCrashes').onclick = requestCrashUpload; | 112 $('uploadCrashes').onclick = requestCrashUpload; |
| 112 requestCrashes(); | 113 requestCrashes(); |
| 113 }); | 114 }); |
| OLD | NEW |