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