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

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

Issue 10387120: use load_time_data for about:crashes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 7 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 localStrings = new LocalStrings();
6
7 /** 5 /**
8 * Requests the list of crashes from the backend. 6 * Requests the list of crashes from the backend.
9 */ 7 */
10 function requestCrashes() { 8 function requestCrashes() {
11 chrome.send('requestCrashList'); 9 chrome.send('requestCrashList');
12 } 10 }
13 11
14 /** 12 /**
15 * Callback from backend with the list of crashes. Builds the UI. 13 * Callback from backend with the list of crashes. Builds the UI.
16 * @param {boolean} enabled Whether or not crash reporting is enabled. 14 * @param {boolean} enabled Whether or not crash reporting is enabled.
17 * @param {array} crashes The list of crashes. 15 * @param {array} crashes The list of crashes.
18 * @param {string} version The browser version. 16 * @param {string} version The browser version.
19 */ 17 */
20 function updateCrashList(enabled, crashes, version) { 18 function updateCrashList(enabled, crashes, version) {
21 $('countBanner').textContent = localStrings.getStringF('crashCountFormat', 19 $('countBanner').textContent = loadTimeData.getStringF('crashCountFormat',
22 crashes.length); 20 crashes.length);
23 21
24 var crashSection = $('crashList'); 22 var crashSection = $('crashList');
25 23
26 $('enabledMode').hidden = !enabled; 24 $('enabledMode').hidden = !enabled;
27 $('disabledMode').hidden = enabled; 25 $('disabledMode').hidden = enabled;
28 26
29 if (!enabled) 27 if (!enabled)
30 return; 28 return;
31 29
32 // Clear any previous list. 30 // Clear any previous list.
33 crashSection.textContent = ''; 31 crashSection.textContent = '';
34 32
35 for (var i = 0; i < crashes.length; i++) { 33 for (var i = 0; i < crashes.length; i++) {
36 var crash = crashes[i]; 34 var crash = crashes[i];
37 35
38 var crashBlock = document.createElement('div'); 36 var crashBlock = document.createElement('div');
39 var title = document.createElement('h3'); 37 var title = document.createElement('h3');
40 title.textContent = localStrings.getStringF('crashHeaderFormat', 38 title.textContent = loadTimeData.getStringF('crashHeaderFormat',
41 crash['id']); 39 crash['id']);
42 crashBlock.appendChild(title); 40 crashBlock.appendChild(title);
43 var date = document.createElement('p'); 41 var date = document.createElement('p');
44 date.textContent = localStrings.getStringF('crashTimeFormat', 42 date.textContent = loadTimeData.getStringF('crashTimeFormat',
45 crash['time']); 43 crash['time']);
46 crashBlock.appendChild(date); 44 crashBlock.appendChild(date);
47 var linkBlock = document.createElement('p'); 45 var linkBlock = document.createElement('p');
48 var link = document.createElement('a'); 46 var link = document.createElement('a');
49 var commentLines = [ 47 var commentLines = [
50 'Chrome Version: ' + version, 48 'Chrome Version: ' + version,
51 // TODO(tbreisacher): fill in the OS automatically? 49 // TODO(tbreisacher): fill in the OS automatically?
52 'Operating System: e.g., "Windows 7", "Mac OSX 10.6"', 50 'Operating System: e.g., "Windows 7", "Mac OSX 10.6"',
53 '', 51 '',
54 'URL (if applicable) where crash occurred:', 52 'URL (if applicable) where crash occurred:',
(...skipping 14 matching lines...) Expand all
69 var params = { 67 var params = {
70 template: 'Crash Report', 68 template: 'Crash Report',
71 comment: commentLines.join('\n'), 69 comment: commentLines.join('\n'),
72 }; 70 };
73 var href = 'http://code.google.com/p/chromium/issues/entry'; 71 var href = 'http://code.google.com/p/chromium/issues/entry';
74 for (var param in params) { 72 for (var param in params) {
75 href = appendParam(href, param, params[param]); 73 href = appendParam(href, param, params[param]);
76 } 74 }
77 link.href = href; 75 link.href = href;
78 link.target = '_blank'; 76 link.target = '_blank';
79 link.textContent = localStrings.getString('bugLinkText'); 77 link.textContent = loadTimeData.getString('bugLinkText');
80 linkBlock.appendChild(link); 78 linkBlock.appendChild(link);
81 crashBlock.appendChild(linkBlock); 79 crashBlock.appendChild(linkBlock);
82 crashSection.appendChild(crashBlock); 80 crashSection.appendChild(crashBlock);
83 } 81 }
84 82
85 $('noCrashes').hidden = crashes.length != 0; 83 $('noCrashes').hidden = crashes.length != 0;
86 } 84 }
87 85
88 document.addEventListener('DOMContentLoaded', requestCrashes); 86 document.addEventListener('DOMContentLoaded', requestCrashes);
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