| 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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 }; | 94 }; |
| 95 var href = 'https://code.google.com/p/chromium/issues/entry'; | 95 var href = 'https://code.google.com/p/chromium/issues/entry'; |
| 96 for (var param in params) { | 96 for (var param in params) { |
| 97 href = appendParam(href, param, params[param]); | 97 href = appendParam(href, param, params[param]); |
| 98 } | 98 } |
| 99 link.href = href; | 99 link.href = href; |
| 100 link.target = '_blank'; | 100 link.target = '_blank'; |
| 101 link.textContent = loadTimeData.getString('bugLinkText'); | 101 link.textContent = loadTimeData.getString('bugLinkText'); |
| 102 linkBlock.appendChild(link); | 102 linkBlock.appendChild(link); |
| 103 crashBlock.appendChild(linkBlock); | 103 crashBlock.appendChild(linkBlock); |
| 104 } else if (crash.state == 'pending_user_requested') { | 104 } else { |
| 105 var userRequested = document.createElement('p'); | 105 if (crash.state == 'pending_user_requested') |
| 106 userRequested.textContent = | 106 var textContentKey = 'crashUserRequested'; |
| 107 loadTimeData.getStringF('crashUserRequested', crash.time); | 107 else if (crash.state == 'pending') |
| 108 crashBlock.appendChild(userRequested); | |
| 109 } else if (crash.state == 'pending' || crash.state == 'not_uploaded') { | |
| 110 if (crash.state == 'pending') | |
| 111 var textContentKey = 'crashPending'; | 108 var textContentKey = 'crashPending'; |
| 109 else if (crash.state == 'not_uploaded') |
| 110 var textContentKey = 'crashNotUploaded'; |
| 112 else | 111 else |
| 113 var textContentKey = 'crashNotUploaded'; | 112 continue; |
| 114 | 113 |
| 115 var notUploaded = document.createElement('p'); | 114 var crashText = document.createElement('p'); |
| 116 notUploaded.textContent = loadTimeData.getStringF(textContentKey, | 115 crashText.textContent = loadTimeData.getStringF(textContentKey, |
| 117 crash.time); | 116 crash.time); |
| 118 crashBlock.appendChild(notUploaded); | 117 crashBlock.appendChild(crashText); |
| 119 | 118 |
| 120 if (manualUploads) { | 119 if (crash.file_size != '') { |
| 120 var crashSizeText = document.createElement('p'); |
| 121 crashSizeText.textContent = loadTimeData.getStringF('crashSizeMessage', |
| 122 crash.file_size); |
| 123 crashBlock.appendChild(crashSizeText); |
| 124 } |
| 125 |
| 126 // Do not show "Send now" link for already requested crashes. |
| 127 if (crash.state != 'pending_user_requested' && manualUploads) { |
| 121 var uploadNowLinkBlock = document.createElement('p'); | 128 var uploadNowLinkBlock = document.createElement('p'); |
| 122 var link = document.createElement('a'); | 129 var link = document.createElement('a'); |
| 123 link.href = ''; | 130 link.href = ''; |
| 124 link.textContent = loadTimeData.getString('uploadNowLinkText'); | 131 link.textContent = loadTimeData.getString('uploadNowLinkText'); |
| 125 link.local_id = crash.local_id; | 132 link.local_id = crash.local_id; |
| 126 link.onclick = function() { | 133 link.onclick = function() { |
| 127 chrome.send('requestSingleCrashUpload', [this.local_id]); | 134 chrome.send('requestSingleCrashUpload', [this.local_id]); |
| 128 }; | 135 }; |
| 129 uploadNowLinkBlock.appendChild(link); | 136 uploadNowLinkBlock.appendChild(link); |
| 130 crashBlock.appendChild(uploadNowLinkBlock); | 137 crashBlock.appendChild(uploadNowLinkBlock); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 145 chrome.send('requestCrashUpload'); | 152 chrome.send('requestCrashUpload'); |
| 146 | 153 |
| 147 // Trigger a refresh in 5 seconds. Clear any previous requests. | 154 // Trigger a refresh in 5 seconds. Clear any previous requests. |
| 148 clearTimeout(refreshCrashListId); | 155 clearTimeout(refreshCrashListId); |
| 149 refreshCrashListId = setTimeout(requestCrashes, 5000); | 156 refreshCrashListId = setTimeout(requestCrashes, 5000); |
| 150 } | 157 } |
| 151 | 158 |
| 152 document.addEventListener('DOMContentLoaded', function() { | 159 document.addEventListener('DOMContentLoaded', function() { |
| 153 $('uploadCrashes').onclick = requestCrashUpload; | 160 $('uploadCrashes').onclick = requestCrashUpload; |
| 154 requestCrashes(); | 161 requestCrashes(); |
| 155 }); | 162 }); |
| OLD | NEW |