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