Chromium Code Reviews| Index: chrome/browser/resources/media/webrtc_logs.js |
| diff --git a/chrome/browser/resources/media/webrtc_logs.js b/chrome/browser/resources/media/webrtc_logs.js |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..11165558b0edcfe18202e5b50aa6a7f825966d04 |
| --- /dev/null |
| +++ b/chrome/browser/resources/media/webrtc_logs.js |
| @@ -0,0 +1,86 @@ |
| +// Copyright 2013 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +/** |
| + * Requests the list of uploads from the backend. |
| + */ |
| +function requestUploads() { |
| + chrome.send('requestWebRtcLogsList'); |
| +} |
| + |
| +/** |
| + * Callback from backend with the list of uploads. Builds the UI. |
| + * @param {boolean} enabled Whether or not uploading is enabled. |
| + * @param {array} uploads The list of uploads. |
| + * @param {string} version The browser version. |
| + */ |
| +function updateWebRtcLogsList(enabled, uploads, version) { |
|
James Hawkins
2013/06/24 15:05:07
Where is this used?
Henrik Grunell
2013/06/24 17:11:44
In WebRtcLogsDOMHandler::UpdateUI (webrtc_logs_ui.
|
| + $('logBanner').textContent = loadTimeData.getStringF('webrtcLogTimeFormat', |
| + uploads.length); |
| + |
| + var logSection = $('logList'); |
| + |
| + $('enabledMode').hidden = !enabled; |
| + $('disabledMode').hidden = enabled; |
| + |
| + if (!enabled) |
| + return; |
| + |
| + // Clear any previous list. |
| + logSection.textContent = ''; |
| + |
| + for (var i = 0; i < uploads.length; i++) { |
| + var upload = uploads[i]; |
| + |
| + var logBlock = document.createElement('div'); |
| + var title = document.createElement('h3'); |
| + title.textContent = loadTimeData.getStringF('webrtcLogHeaderFormat', |
| + upload['id']); |
| + logBlock.appendChild(title); |
| + var date = document.createElement('p'); |
| + date.textContent = loadTimeData.getStringF('webrtcLogTimeFormat', |
| + upload['time']); |
| + logBlock.appendChild(date); |
| + var linkBlock = document.createElement('p'); |
| + var link = document.createElement('a'); |
| + var commentLines = [ |
| + 'Chrome Version: ' + version, |
| + // TODO(tbreisacher): fill in the OS automatically? |
| + 'Operating System: e.g., "Windows 7", "Mac OSX 10.6"', |
| + '', |
| + 'URL (if applicable) where the problem occurred:', |
| + '', |
| + 'Can you reproduce this problem?', |
| + '', |
| + 'What steps will reproduce this problem? (or if it\'s not ' + |
| + 'reproducible, what were you doing just before the problem)?', |
| + '', |
| + '1.', '2.', '3.', |
| + '', |
| + '*Please note that issues filed with no information filled in ' + |
| + 'above will be marked as WontFix*', |
| + '', |
| + '****DO NOT CHANGE BELOW THIS LINE****', |
| + 'report_id:' + upload.id |
| + ]; |
| + var params = { |
| + template: 'Defect report from user', |
| + comment: commentLines.join('\n'), |
| + }; |
| + var href = 'http://code.google.com/p/chromium/issues/entry'; |
| + for (var param in params) { |
| + href = appendParam(href, param, params[param]); |
| + } |
| + link.href = href; |
| + link.target = '_blank'; |
| + link.textContent = loadTimeData.getString('bugLinkText'); |
| + linkBlock.appendChild(link); |
| + logBlock.appendChild(linkBlock); |
| + logSection.appendChild(logBlock); |
| + } |
| + |
| + $('noLogs').hidden = uploads.length != 0; |
| +} |
| + |
| +document.addEventListener('DOMContentLoaded', requestUploads); |