| 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 */ |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 crashes, version, os) { | 26 crashes, version, os) { |
| 27 $('countBanner').textContent = | 27 $('countBanner').textContent = |
| 28 loadTimeData.getStringF('crashCountFormat', | 28 loadTimeData.getStringF('crashCountFormat', |
| 29 crashes.length.toLocaleString()); | 29 crashes.length.toLocaleString()); |
| 30 | 30 |
| 31 var crashSection = $('crashList'); | 31 var crashSection = $('crashList'); |
| 32 | 32 |
| 33 $('disabledMode').hidden = enabled; | 33 $('disabledMode').hidden = enabled; |
| 34 $('crashUploadStatus').hidden = !enabled || !dynamicBackend; | 34 $('crashUploadStatus').hidden = !enabled || !dynamicBackend; |
| 35 | 35 |
| 36 // Make the height fixed while clearing the |
| 37 // element in order to maintain scroll position. |
| 38 crashSection.style.height = getComputedStyle(crashSection).height; |
| 36 // Clear any previous list. | 39 // Clear any previous list. |
| 37 crashSection.textContent = ''; | 40 crashSection.textContent = ''; |
| 38 | 41 |
| 39 var productName = loadTimeData.getString('shortProductName'); | 42 var productName = loadTimeData.getString('shortProductName'); |
| 40 | 43 |
| 41 for (var i = 0; i < crashes.length; i++) { | 44 for (var i = 0; i < crashes.length; i++) { |
| 42 var crash = crashes[i]; | 45 var crash = crashes[i]; |
| 43 if (crash.local_id == '') | 46 if (crash.local_id == '') |
| 44 crash.local_id = productName; | 47 crash.local_id = productName; |
| 45 | 48 |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 link.onclick = function() { | 137 link.onclick = function() { |
| 135 chrome.send('requestSingleCrashUpload', [this.local_id]); | 138 chrome.send('requestSingleCrashUpload', [this.local_id]); |
| 136 }; | 139 }; |
| 137 uploadNowLinkBlock.appendChild(link); | 140 uploadNowLinkBlock.appendChild(link); |
| 138 crashBlock.appendChild(uploadNowLinkBlock); | 141 crashBlock.appendChild(uploadNowLinkBlock); |
| 139 } | 142 } |
| 140 } | 143 } |
| 141 crashSection.appendChild(crashBlock); | 144 crashSection.appendChild(crashBlock); |
| 142 } | 145 } |
| 143 | 146 |
| 147 // Reset the height, in order to accommodate for the new content. |
| 148 crashSection.style.height = ""; |
| 144 $('noCrashes').hidden = crashes.length != 0; | 149 $('noCrashes').hidden = crashes.length != 0; |
| 145 } | 150 } |
| 146 | 151 |
| 147 /** | 152 /** |
| 148 * Request crashes get uploaded in the background. | 153 * Request crashes get uploaded in the background. |
| 149 */ | 154 */ |
| 150 function requestCrashUpload() { | 155 function requestCrashUpload() { |
| 151 // Don't need locking with this call because the system crash reporter | 156 // Don't need locking with this call because the system crash reporter |
| 152 // has locking built into itself. | 157 // has locking built into itself. |
| 153 chrome.send('requestCrashUpload'); | 158 chrome.send('requestCrashUpload'); |
| 154 | 159 |
| 155 // Trigger a refresh in 5 seconds. Clear any previous requests. | 160 // Trigger a refresh in 5 seconds. Clear any previous requests. |
| 156 clearTimeout(refreshCrashListId); | 161 clearTimeout(refreshCrashListId); |
| 157 refreshCrashListId = setTimeout(requestCrashes, 5000); | 162 refreshCrashListId = setTimeout(requestCrashes, 5000); |
| 158 } | 163 } |
| 159 | 164 |
| 160 document.addEventListener('DOMContentLoaded', function() { | 165 document.addEventListener('DOMContentLoaded', function() { |
| 161 $('uploadCrashes').onclick = requestCrashUpload; | 166 $('uploadCrashes').onclick = requestCrashUpload; |
| 162 requestCrashes(); | 167 requestCrashes(); |
| 163 }); | 168 }); |
| OLD | NEW |