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