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. */ | |
6 var refreshCrashListId = undefined; | |
7 | |
5 /** | 8 /** |
6 * Requests the list of crashes from the backend. | 9 * Requests the list of crashes from the backend. |
7 */ | 10 */ |
8 function requestCrashes() { | 11 function requestCrashes() { |
12 refreshCrashListId = clearInterval(refreshCrashListId); | |
9 chrome.send('requestCrashList'); | 13 chrome.send('requestCrashList'); |
10 } | 14 } |
11 | 15 |
12 /** | 16 /** |
13 * Callback from backend with the list of crashes. Builds the UI. | 17 * Callback from backend with the list of crashes. Builds the UI. |
14 * @param {boolean} enabled Whether or not crash reporting is enabled. | 18 * @param {boolean} enabled Whether or not crash reporting is enabled. |
15 * @param {array} crashes The list of crashes. | 19 * @param {array} crashes The list of crashes. |
16 * @param {string} version The browser version. | 20 * @param {string} version The browser version. |
17 */ | 21 */ |
18 function updateCrashList(enabled, crashes, version) { | 22 function updateCrashList(enabled, crashes, version) { |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
76 link.target = '_blank'; | 80 link.target = '_blank'; |
77 link.textContent = loadTimeData.getString('bugLinkText'); | 81 link.textContent = loadTimeData.getString('bugLinkText'); |
78 linkBlock.appendChild(link); | 82 linkBlock.appendChild(link); |
79 crashBlock.appendChild(linkBlock); | 83 crashBlock.appendChild(linkBlock); |
80 crashSection.appendChild(crashBlock); | 84 crashSection.appendChild(crashBlock); |
81 } | 85 } |
82 | 86 |
83 $('noCrashes').hidden = crashes.length != 0; | 87 $('noCrashes').hidden = crashes.length != 0; |
84 } | 88 } |
85 | 89 |
90 /** | |
91 * Request crashes get uploaded in the background. | |
92 */ | |
93 function requestCrashUpload() { | |
94 chrome.send('requestCrashUpload'); | |
95 | |
96 // Trigger a refresh in 5 seconds. | |
97 refreshCrashListId = setInterval(requestCrashes, 5000); | |
98 } | |
99 | |
100 /** | |
101 * Callback from backend when crash uploading has started. | |
102 * @param {boolean} enabled Whether or not crash reporting is enabled. | |
103 */ | |
104 function updateCrashUploadStatus(enabled) { | |
105 $('uploadCrashesLink').onclick = requestCrashUpload; | |
106 $('crashUploadStatus').hidden = !enabled; | |
107 | |
108 if (!enabled) | |
Lei Zhang
2013/10/08 18:05:07
Don't you return no matter what?
vapier
2013/10/08 18:10:16
yes. this makes more sense when you see a follow
| |
109 return; | |
110 } | |
111 | |
86 document.addEventListener('DOMContentLoaded', requestCrashes); | 112 document.addEventListener('DOMContentLoaded', requestCrashes); |
OLD | NEW |