Index: chrome/browser/resources/crashes.js |
diff --git a/chrome/browser/resources/crashes.js b/chrome/browser/resources/crashes.js |
index c845c748f4f59de4bc31bd448a40a5da8022476d..fdc8711d5e3dd06290ea8ec2a622fd923ba27bdd 100644 |
--- a/chrome/browser/resources/crashes.js |
+++ b/chrome/browser/resources/crashes.js |
@@ -2,6 +2,9 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
+/* Id for tracking automatic refresh of crash list. */ |
+var refreshCrashListId = undefined; |
+ |
/** |
* Requests the list of crashes from the backend. |
*/ |
@@ -12,10 +15,11 @@ function requestCrashes() { |
/** |
* Callback from backend with the list of crashes. Builds the UI. |
* @param {boolean} enabled Whether or not crash reporting is enabled. |
+ * @param {boolean} dynamic_backend Whether the crash backend is dynamic. |
* @param {array} crashes The list of crashes. |
* @param {string} version The browser version. |
*/ |
-function updateCrashList(enabled, crashes, version) { |
+function updateCrashList(enabled, dynamic_backend, crashes, version) { |
xiyuan
2014/03/25 21:30:58
dynamic_backend -> dynamicBackend
vapier
2014/03/25 21:35:46
Done.
|
$('countBanner').textContent = loadTimeData.getStringF('crashCountFormat', |
crashes.length); |
@@ -24,6 +28,9 @@ function updateCrashList(enabled, crashes, version) { |
$('enabledMode').hidden = !enabled; |
$('disabledMode').hidden = enabled; |
+ if (dynamic_backend) |
+ $('crashUploadStatus').hidden = !enabled; |
xiyuan
2014/03/25 21:30:58
nit: we can get rid "if"
$('crashUploadStatus').
vapier
2014/03/25 21:35:46
sure. i plan on adding more UI elements, but they
|
+ |
if (!enabled) |
return; |
@@ -83,4 +90,20 @@ function updateCrashList(enabled, crashes, version) { |
$('noCrashes').hidden = crashes.length != 0; |
} |
-document.addEventListener('DOMContentLoaded', requestCrashes); |
+/** |
+ * Request crashes get uploaded in the background. |
+ */ |
+function requestCrashUpload() { |
+ // Don't need locking with this call because the system crash reporter |
+ // has locking built into itself. |
+ chrome.send('requestCrashUpload'); |
+ |
+ // Trigger a refresh in 5 seconds. Clear any previous requests. |
+ clearInterval(refreshCrashListId); |
xiyuan
2014/03/25 21:30:58
if (refreshCrashListId)
clearTimeout(refreshCras
vapier
2014/03/25 21:35:46
any particular reason for the if ? when i tested
|
+ refreshCrashListId = setTimeout(requestCrashes, 5000); |
+} |
+ |
+document.addEventListener('DOMContentLoaded', function() { |
+ $('uploadCrashes').onclick = requestCrashUpload; |
+ requestCrashes(); |
+}); |