Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(104)

Side by Side Diff: chrome/browser/resources/crashes.js

Issue 26536002: chrome://crashes: add a link on CrOS for triggering crash uploading (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: delete debug code Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/resources/crashes.html ('k') | chrome/browser/ui/webui/crashes_ui.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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() {
9 chrome.send('requestCrashList'); 12 chrome.send('requestCrashList');
10 } 13 }
11 14
12 /** 15 /**
13 * Callback from backend with the list of crashes. Builds the UI. 16 * Callback from backend with the list of crashes. Builds the UI.
14 * @param {boolean} enabled Whether or not crash reporting is enabled. 17 * @param {boolean} enabled Whether or not crash reporting is enabled.
18 * @param {boolean} dynamic_backend Whether the crash backend is dynamic.
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, dynamic_backend, crashes, version) {
xiyuan 2014/03/25 21:30:58 dynamic_backend -> dynamicBackend
vapier 2014/03/25 21:35:46 Done.
19 $('countBanner').textContent = loadTimeData.getStringF('crashCountFormat', 23 $('countBanner').textContent = loadTimeData.getStringF('crashCountFormat',
20 crashes.length); 24 crashes.length);
21 25
22 var crashSection = $('crashList'); 26 var crashSection = $('crashList');
23 27
24 $('enabledMode').hidden = !enabled; 28 $('enabledMode').hidden = !enabled;
25 $('disabledMode').hidden = enabled; 29 $('disabledMode').hidden = enabled;
26 30
31 if (dynamic_backend)
32 $('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
33
27 if (!enabled) 34 if (!enabled)
28 return; 35 return;
29 36
30 // Clear any previous list. 37 // Clear any previous list.
31 crashSection.textContent = ''; 38 crashSection.textContent = '';
32 39
33 for (var i = 0; i < crashes.length; i++) { 40 for (var i = 0; i < crashes.length; i++) {
34 var crash = crashes[i]; 41 var crash = crashes[i];
35 42
36 var crashBlock = document.createElement('div'); 43 var crashBlock = document.createElement('div');
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 link.target = '_blank'; 83 link.target = '_blank';
77 link.textContent = loadTimeData.getString('bugLinkText'); 84 link.textContent = loadTimeData.getString('bugLinkText');
78 linkBlock.appendChild(link); 85 linkBlock.appendChild(link);
79 crashBlock.appendChild(linkBlock); 86 crashBlock.appendChild(linkBlock);
80 crashSection.appendChild(crashBlock); 87 crashSection.appendChild(crashBlock);
81 } 88 }
82 89
83 $('noCrashes').hidden = crashes.length != 0; 90 $('noCrashes').hidden = crashes.length != 0;
84 } 91 }
85 92
86 document.addEventListener('DOMContentLoaded', requestCrashes); 93 /**
94 * Request crashes get uploaded in the background.
95 */
96 function requestCrashUpload() {
97 // Don't need locking with this call because the system crash reporter
98 // has locking built into itself.
99 chrome.send('requestCrashUpload');
100
101 // Trigger a refresh in 5 seconds. Clear any previous requests.
102 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
103 refreshCrashListId = setTimeout(requestCrashes, 5000);
104 }
105
106 document.addEventListener('DOMContentLoaded', function() {
107 $('uploadCrashes').onclick = requestCrashUpload;
108 requestCrashes();
109 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/crashes.html ('k') | chrome/browser/ui/webui/crashes_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698