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 = upload['local_file'];
49 localFileLine.appendChild(localFileLink);
51 logBlock.appendChild(localFileLine);
53 var uploadLine = document.createElement('p');
54 if (upload['id'].length == 0) {
55 uploadLine.textContent =
56 loadTimeData.getString('webrtcLogNotUploadedMessage');
58 uploadLine.textContent =
59 loadTimeData.getStringF('webrtcLogUploadTimeFormat',
60 upload['upload_time']) + '. ' +
61 loadTimeData.getStringF('webrtcLogReportIdFormat',
63 var link = document.createElement('a');
65 'Chrome Version: ' + version,
66 // TODO(tbreisacher): fill in the OS automatically?
67 'Operating System: e.g., "Windows 7", "Mac OSX 10.6"',
69 'URL (if applicable) where the problem occurred:',
71 'Can you reproduce this problem?',
73 'What steps will reproduce this problem? (or if it\'s not ' +
74 'reproducible, what were you doing just before the problem)?',
78 '*Please note that issues filed with no information filled in ' +
79 'above will be marked as WontFix*',
81 '****DO NOT CHANGE BELOW THIS LINE****',
82 'report_id:' + upload.id
85 template: 'Defect report from user',
86 comment: commentLines.join('\n'),
88 var href = 'http://code.google.com/p/chromium/issues/entry';
89 for (var param in params) {
90 href = appendParam(href, param, params[param]);
93 link.target = '_blank';
94 link.textContent = loadTimeData.getString('bugLinkText');
95 uploadLine.appendChild(link);
97 logBlock.appendChild(uploadLine);
99 logSection.appendChild(logBlock);
102 $('no-logs').hidden = uploads.length != 0;
105 document.addEventListener('DOMContentLoaded', requestUploads);