<commit_before><!DOCTYPE HTML>
<html i18n-values="dir:textdirection;">
<head>
<meta charset="utf-8"/>
<title i18n-content="title"></title>
<link rel="stylesheet" href="bug_report.css"/>

<script src="shared/js/local_strings.js"></script>
<script src="shared/js/util.js"></script>
<script src="bug_report.js"></script>
<script>

///////////////////////////////////////////////////////////////////////////////
// Document Functions:
/**
 * Window onload handler, sets up the page.
 */
function load() {
  // textContent on description-text textarea seems to default
  // to several spaces, this resets it to empty.
  $('description-text').textContent = '';
  $('send-report-button').disabled = true;

  $('issue-with-combo').addEventListener('change', function(e) {
    $('send-report-button').disabled = 
        this.selectedIndex <= 0 || $('description-text').value.length == 0;
  });

  $('description-text').addEventListener('keyup', function(e) {
    $('send-report-button').disabled =
        $('issue-with-combo').selectedIndex <= 0 || this.value.length == 0;
  });

  $('current-screenshot').nextSibling.textContent =
      localStrings.getString('currentscreenshots');
<if expr="pp_ifdef('chromeos')">
  $('saved-screenshot').nextSibling.textContent =
      localStrings.getString('savedscreenshots');
</if>
  $('no-screenshot').nextSibling.textContent =
      localStrings.getString('noscreenshot');

  // Get a list of issues that we allow the user to select from.
  // Note, the order and the issues types themselves are different
  // between Chromium and Chromium OS, so this code needs to be
  // maintained individually between the bug_report.html and
  // bug_report_cros.html files.
  var issueTypeText = [];
  issueTypeText[0] = localStrings.getString('issue-choose');
<if expr="not pp_ifdef('chromeos')">
  issueTypeText[1] = localStrings.getString('issue-page-formatting');
  issueTypeText[2] = localStrings.getString('issue-page-load');
  issueTypeText[3] = localStrings.getString('issue-plugins');
  issueTypeText[4] = localStrings.getString('issue-tabs');
  issueTypeText[5] = localStrings.getString('issue-sync');
  issueTypeText[6] = localStrings.getString('issue-crashes');
  issueTypeText[7] = localStrings.getString('issue-extensions');
  issueTypeText[8] = localStrings.getString('issue-phishing');
  issueTypeText[9] = localStrings.getString('issue-other');
</if>
<if expr="pp_ifdef('chromeos')">
  issueTypeText[1] = localStrings.getString('issue-connectivity');
  issueTypeText[2] = localStrings.getString('issue-sync');
  issueTypeText[3] = localStrings.getString('issue-crashes');
  issueTypeText[4] = localStrings.getString('issue-page-formatting');
  issueTypeText[5] = localStrings.getString('issue-extensions');
  issueTypeText[6] = localStrings.getString('issue-standby');
  issueTypeText[7] = localStrings.getString('issue-phishing');
  issueTypeText[8] = localStrings.getString('issue-other');
</if>
  // Add all the issues to the selection box.
  for (var i = 0; i < issueTypeText.length; i++) {
    var option = document.createElement('option');
    option.className = 'bug-report-text';
    option.textContent = issueTypeText[i];
    $('issue-with-combo').add(option);
  }

  chrome.send('getDialogDefaults', []);
  chrome.send('refreshScreenshots', []);
};

function setupScreenshots(screenshots) {
  if (screenshots.length == 1) {
    addScreenshot('current-screenshots', screenshots[0]);
  } else {
    // We're in Chromium OS.
    currentScreenshot = screenshots[0];
    addScreenshot('current-screenshots', currentScreenshot);

    savedScreenshots = screenshots[1];
    if (savedScreenshots.length == 0) {
      $('saved-screenshots').disabled = true;
      return;
    }
    for (i = 0; i < savedScreenshots.length; ++i)
      addScreenshot('saved-screenshots', savedScreenshots[i]);
  }
}

function setupDialogDefaults(defaults) {
  if (defaults.length > 0) {
    $('page-url-text').value = defaults[0];
    if (defaults.length > 2) {
      // We're in Chromium OS.
      $('user-email-text').value = defaults[2];
    }
  }
}

window.addEventListener('DOMContentLoaded', load);
</script>
</head>
<body>
<div>
  <div id="main-panel">
    <div class="formpane">
      <table>
        <!--  Issue type dropdown -->
        <tr>
          <th id="issue-with" class="bug-report-label" i18n-content="issue-with">
          </th>
        </tr>
        <tr>
          <td>
            <select id="issue-with-combo" class="bug-report-text">
            </select>
          </td>
        </tr>
        <!--  Page URL text box -->
        <tr>
          <th colspan="2" id="page-url" class="bug-report-label"
              i18n-content="page-url">
          </th>
        </tr>
        <tr>
          <td colspan="2">
            <input id='page-url-text' maxlength=200 class="bug-report-text">
          </td>
        </tr>
        <!--  Description -->
        <tr>
          <th id="description" colspan="2" class="bug-report-label"
              i18n-content="description">
          </th>
        </tr>
        <tr>
          <td colspan="2">
            <textarea id='description-text' rows="10" class="bug-report-text">
            </textarea>
          </td>
        </tr>
      </table>
    </div>
    <div class="formpane">
      <table>
<if expr="pp_ifdef('chromeos')">
        <!--  Page URL text box -->
        <tr>
          <th id="user-email" class="bug-report-label" i18n-content="user-email">
          </th>
        </tr>
        <tr>
          <td>
            <input id='user-email-text' maxlength=200 class="bug-report-text">
          </td>
        </tr>
        <!--  System Information checkbox -->
        <tr>
          <td>
            <input id="sys-info-checkbox" type="checkbox" value="sysinfo" checked>
            <span id="sysinfo-label"></span> <a href='chrome://system/'
                id="sysinfo-url"><span i18n-content="sysinfo"></span></a>
          </td>
        </tr>
</if>
        <!--  Screenshot radio buttons -->
        <tr>
          <th id="screenshot" class="bug-report-label" i18n-content="screenshot">
          </th>
        </tr>
        <tr><commit_msg>Make 'Send system information' link open about:system in a new tab.<commit_after><!DOCTYPE HTML>
<html i18n-values="dir:textdirection;">
<head>
<meta charset="utf-8"/>
<title i18n-content="title"></title>
<link rel="stylesheet" href="bug_report.css"/>

<script src="shared/js/local_strings.js"></script>
<script src="shared/js/util.js"></script>
<script src="bug_report.js"></script>
<script>

///////////////////////////////////////////////////////////////////////////////
// Document Functions:
/**
 * Window onload handler, sets up the page.
 */
function load() {
  // textContent on description-text textarea seems to default
  // to several spaces, this resets it to empty.
  $('description-text').textContent = '';
  $('send-report-button').disabled = true;

  $('issue-with-combo').addEventListener('change', function(e) {
    $('send-report-button').disabled = 
        this.selectedIndex <= 0 || $('description-text').value.length == 0;
  });

  $('description-text').addEventListener('keyup', function(e) {
    $('send-report-button').disabled =
        $('issue-with-combo').selectedIndex <= 0 || this.value.length == 0;
  });

  $('current-screenshot').nextSibling.textContent =
      localStrings.getString('currentscreenshots');
<if expr="pp_ifdef('chromeos')">
  $('saved-screenshot').nextSibling.textContent =
      localStrings.getString('savedscreenshots');
</if>
  $('no-screenshot').nextSibling.textContent =
      localStrings.getString('noscreenshot');

  // Get a list of issues that we allow the user to select from.
  // Note, the order and the issues types themselves are different
  // between Chromium and Chromium OS, so this code needs to be
  // maintained individually between the bug_report.html and
  // bug_report_cros.html files.
  var issueTypeText = [];
  issueTypeText[0] = localStrings.getString('issue-choose');
<if expr="not pp_ifdef('chromeos')">
  issueTypeText[1] = localStrings.getString('issue-page-formatting');
  issueTypeText[2] = localStrings.getString('issue-page-load');
  issueTypeText[3] = localStrings.getString('issue-plugins');
  issueTypeText[4] = localStrings.getString('issue-tabs');
  issueTypeText[5] = localStrings.getString('issue-sync');
  issueTypeText[6] = localStrings.getString('issue-crashes');
  issueTypeText[7] = localStrings.getString('issue-extensions');
  issueTypeText[8] = localStrings.getString('issue-phishing');
  issueTypeText[9] = localStrings.getString('issue-other');
</if>
<if expr="pp_ifdef('chromeos')">
  issueTypeText[1] = localStrings.getString('issue-connectivity');
  issueTypeText[2] = localStrings.getString('issue-sync');
  issueTypeText[3] = localStrings.getString('issue-crashes');
  issueTypeText[4] = localStrings.getString('issue-page-formatting');
  issueTypeText[5] = localStrings.getString('issue-extensions');
  issueTypeText[6] = localStrings.getString('issue-standby');
  issueTypeText[7] = localStrings.getString('issue-phishing');
  issueTypeText[8] = localStrings.getString('issue-other');
</if>
  // Add all the issues to the selection box.
  for (var i = 0; i < issueTypeText.length; i++) {
    var option = document.createElement('option');
    option.className = 'bug-report-text';
    option.textContent = issueTypeText[i];
    $('issue-with-combo').add(option);
  }

  chrome.send('getDialogDefaults', []);
  chrome.send('refreshScreenshots', []);
};

function setupScreenshots(screenshots) {
  if (screenshots.length == 1) {
    addScreenshot('current-screenshots', screenshots[0]);
  } else {
    // We're in Chromium OS.
    currentScreenshot = screenshots[0];
    addScreenshot('current-screenshots', currentScreenshot);

    savedScreenshots = screenshots[1];
    if (savedScreenshots.length == 0) {
      $('saved-screenshots').disabled = true;
      return;
    }
    for (i = 0; i < savedScreenshots.length; ++i)
      addScreenshot('saved-screenshots', savedScreenshots[i]);
  }
}

function setupDialogDefaults(defaults) {
  if (defaults.length > 0) {
    $('page-url-text').value = defaults[0];
    if (defaults.length > 2) {
      // We're in Chromium OS.
      $('user-email-text').value = defaults[2];
    }
  }
}

window.addEventListener('DOMContentLoaded', load);
</script>
</head>
<body>
<div>
  <div id="main-panel">
    <div class="formpane">
      <table>
        <!--  Issue type dropdown -->
        <tr>
          <th id="issue-with" class="bug-report-label" i18n-content="issue-with">
          </th>
        </tr>
        <tr>
          <td>
            <select id="issue-with-combo" class="bug-report-text">
            </select>
          </td>
        </tr>
        <!--  Page URL text box -->
        <tr>
          <th colspan="2" id="page-url" class="bug-report-label"
              i18n-content="page-url">
          </th>
        </tr>
        <tr>
          <td colspan="2">
            <input id='page-url-text' maxlength=200 class="bug-report-text">
          </td>
        </tr>
        <!--  Description -->
        <tr>
          <th id="description" colspan="2" class="bug-report-label"
              i18n-content="description">
          </th>
        </tr>
        <tr>
          <td colspan="2">
            <textarea id='description-text' rows="10" class="bug-report-text">
            </textarea>
          </td>
        </tr>
      </table>
    </div>
    <div class="formpane">
      <table>
<if expr="pp_ifdef('chromeos')">
        <!--  Page URL text box -->
        <tr>
          <th id="user-email" class="bug-report-label" i18n-content="user-email">
          </th>
        </tr>
        <tr>
          <td>
            <input id='user-email-text' maxlength=200 class="bug-report-text">
          </td>
        </tr>
        <!--  System Information checkbox -->
        <tr>
          <td>
            <input id="sys-info-checkbox" type="checkbox" value="sysinfo" checked>
            <span id="sysinfo-label"></span> <a href='chrome://system/'
                id="sysinfo-url" target="_blank"><span i18n-content="sysinfo"></span></a>
          </td>
        </tr>
</if>
        <!--  Screenshot radio buttons -->
        <tr>
          <th id="screenshot" class="bug-report-label" i18n-content="screenshot">
          </th>
        </tr>
        <tr>
{'fraction_non_alphanumeric': 0.18355965082444228, 'fraction_numerical': 0.010022631749110895, 'mean_word_length': 2.7988946883635246, 'pattern_counts': {'":': 0, '<': 197, '<?xml version=': 0, '>': 193, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2965188', 'n_tokens_mistral': 3976, 'n_tokens_neox': 3819, 'n_words': 722}