Index: chrome/browser/resources/crashes.js |
diff --git a/chrome/browser/resources/crashes.js b/chrome/browser/resources/crashes.js |
index c845c748f4f59de4bc31bd448a40a5da8022476d..83944e501788b47aa1861b13878374a0c2ea0b8a 100644 |
--- a/chrome/browser/resources/crashes.js |
+++ b/chrome/browser/resources/crashes.js |
@@ -2,10 +2,14 @@ |
// 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. |
*/ |
function requestCrashes() { |
+ refreshCrashListId = clearInterval(refreshCrashListId); |
chrome.send('requestCrashList'); |
} |
@@ -83,4 +87,23 @@ function updateCrashList(enabled, crashes, version) { |
$('noCrashes').hidden = crashes.length != 0; |
} |
+/** |
+ * Request crashes get uploaded in the background. |
+ */ |
+function requestCrashUpload() { |
+ chrome.send('requestCrashUpload'); |
+ |
+ // Trigger a refresh in 5 seconds. |
+ refreshCrashListId = setInterval(requestCrashes, 5000); |
xiyuan
2013/10/08 20:20:10
Since requestCrashes clears the interval, it seems
vapier
2014/03/25 20:49:07
Done
|
+} |
+ |
+/** |
+ * Callback from backend when crash uploading has started. |
+ * @param {boolean} enabled Whether or not crash reporting is enabled. |
+ */ |
+function updateCrashUploadStatus(enabled) { |
+ $('uploadCrashesLink').onclick = requestCrashUpload; |
Lei Zhang
2013/10/08 20:08:57
Can't you just set this once and be done with it?
vapier
2013/10/08 20:16:24
i can add logic to initialize only once
|
+ $('crashUploadStatus').hidden = !enabled; |
+} |
+ |
document.addEventListener('DOMContentLoaded', requestCrashes); |