1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
6 * Requests the list of uploads from the backend.
8 function requestUploads() {
9 chrome
.send('requestWebRtcLogsList');
13 * Callback from backend with the list of uploads. Builds the UI.
14 * @param {array} uploads The list of uploads.
15 * @param {string} version The browser version.
17 function updateWebRtcLogsList(uploads
, version
) {
18 $('log-banner').textContent
= loadTimeData
.getStringF('webrtcLogCountFormat',
21 var logSection
= $('log-list');
23 // Clear any previous list.
24 logSection
.textContent
= '';
26 for (var i
= 0; i
< uploads
.length
; i
++) {
27 var upload
= uploads
[i
];
29 var logBlock
= document
.createElement('div');
31 var title
= document
.createElement('h3');
33 loadTimeData
.getStringF('webrtcLogHeaderFormat',
34 upload
['capture_time'].length
!= 0 ?
35 upload
['capture_time'] :
36 upload
['upload_time']);
37 logBlock
.appendChild(title
);
39 var localFileLine
= document
.createElement('p');
40 if (upload
['local_file'].length
== 0) {
41 localFileLine
.textContent
=
42 loadTimeData
.getString('noLocalLogFileMessage');
44 localFileLine
.textContent
=
45 loadTimeData
.getString('webrtcLogLocalFileLabelFormat') + ' ';
46 var localFileLink
= document
.createElement('a');
47 localFileLink
.href
= 'file://' + upload
['local_file'];
48 localFileLink
.textContent
=
49 loadTimeData
.getStringF('webrtcLogLocalFileFormat',
50 upload
['local_file']);
51 localFileLine
.appendChild(localFileLink
);
53 logBlock
.appendChild(localFileLine
);
55 var uploadLine
= document
.createElement('p');
56 if (upload
['id'].length
== 0) {
57 uploadLine
.textContent
=
58 loadTimeData
.getString('webrtcLogNotUploadedMessage');
60 uploadLine
.textContent
=
61 loadTimeData
.getStringF('webrtcLogUploadTimeFormat',
62 upload
['upload_time']) + '. ' +
63 loadTimeData
.getStringF('webrtcLogReportIdFormat',
65 var link
= document
.createElement('a');
67 'Chrome Version: ' + version
,
68 // TODO(tbreisacher): fill in the OS automatically?
69 'Operating System: e.g., "Windows 7", "Mac OSX 10.6"',
71 'URL (if applicable) where the problem occurred:',
73 'Can you reproduce this problem?',
75 'What steps will reproduce this problem? (or if it\'s not ' +
76 'reproducible, what were you doing just before the problem)?',
80 '*Please note that issues filed with no information filled in ' +
81 'above will be marked as WontFix*',
83 '****DO NOT CHANGE BELOW THIS LINE****',
84 'report_id:' + upload
.id
87 template
: 'Defect report from user',
88 comment
: commentLines
.join('\n'),
90 var href
= 'http://code.google.com/p/chromium/issues/entry';
91 for (var param
in params
) {
92 href
= appendParam(href
, param
, params
[param
]);
95 link
.target
= '_blank';
96 link
.textContent
= loadTimeData
.getString('bugLinkText');
97 uploadLine
.appendChild(link
);
99 logBlock
.appendChild(uploadLine
);
101 logSection
.appendChild(logBlock
);
104 $('no-logs').hidden
= uploads
.length
!= 0;
107 document
.addEventListener('DOMContentLoaded', requestUploads
);