diff options
author | rkc@google.com <rkc@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-19 17:42:20 +0000 |
---|---|---|
committer | rkc@google.com <rkc@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-19 17:42:20 +0000 |
commit | 74a9f9f48c5832f548368eb8b43933f6b2a10e60 (patch) | |
tree | 5067464449bbb6725d8daaec1dc9399eb0866ab2 /chrome/browser/resources | |
parent | 4685af7696690319a792030aafb329169cb93fa2 (diff) | |
download | chromium_src-74a9f9f48c5832f548368eb8b43933f6b2a10e60.zip chromium_src-74a9f9f48c5832f548368eb8b43933f6b2a10e60.tar.gz chromium_src-74a9f9f48c5832f548368eb8b43933f6b2a10e60.tar.bz2 |
Checkin for CL: http://codereview.chromium.org/3061044/show
TEST=Backend: Various reports submitted from Chrome OS and Windows builds
sent to the feedback test server. For Chromium OS, sent reports
with current screenshot and saved screenshots; verified all reports
for data accuracy and completion.
Frontend: Tested the UI features by excersizing various options; tested
not selecting any issue, tested switching between screenshot types.
Review URL: http://codereview.chromium.org/3181027
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@56708 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/resources')
-rw-r--r-- | chrome/browser/resources/bug_report.css | 99 | ||||
-rw-r--r-- | chrome/browser/resources/bug_report.html | 135 | ||||
-rw-r--r-- | chrome/browser/resources/bug_report.js | 152 | ||||
-rw-r--r-- | chrome/browser/resources/bug_report_cros.html | 169 | ||||
-rw-r--r-- | chrome/browser/resources/bug_report_invalid.html | 10 |
5 files changed, 565 insertions, 0 deletions
diff --git a/chrome/browser/resources/bug_report.css b/chrome/browser/resources/bug_report.css new file mode 100644 index 0000000..09230c1 --- /dev/null +++ b/chrome/browser/resources/bug_report.css @@ -0,0 +1,99 @@ +.bug-report-label { + text-align: start; + vertical-align: text-top; +} + +.bug-report-text { + width: 40em; + resize: none; +} + +.bug-report-button { + width: 8em; +} + +hr { + border: none; + height: 1px; + background: #cccccc; + margin-top: 10px; + margin-bottom: 10px; + width: 33.5em; +} + +.thumbnail-list { + -webkit-margin-start: 1em; + width: 33.5em; + display: block; + margin-top: 0.5em; + margin-bottom: 1em; +} + +.image-thumbnail-container { + display: inline-block; + border: 2px solid white; + -webkit-border-radius: 3px; + z-index: 0; +} + +.image-thumbnail-container-selected { + display: inline-block; + border: 2px solid green; + -webkit-border-radius: 3px; + z-index: 0; +} + +.image-thumbnail-container:hover { + border: 2px solid #B8DAB0; + z-index: 0; +} + +.image-popup { + width: 50%; +} + +.image-thumbnail { + position: relative; + z-index: 1; + display: inline-block; + padding: 0px; + border: 2px solid white; +} + +.image-thumbnail:hover { + z-index: 2; +} + +.image-thumbnail div { + display: none; +} + +.image-thumbnail img { + display: block; + width: 75px; +} + +.image-thumbnail:hover div { + display: block; + position: absolute; + top: 130%; + left:0; + padding: 1px; + border: 1px dashed blue; + background-color: transparent; + text-align: center +} + +.image-thumbnail:hover div img { + position: absolute; + width: 400px; +} + +th { + padding-top: 10px; + color: #233478; +} + +body { + -webkit-user-select: none; +} diff --git a/chrome/browser/resources/bug_report.html b/chrome/browser/resources/bug_report.html new file mode 100644 index 0000000..c3b53ce --- /dev/null +++ b/chrome/browser/resources/bug_report.html @@ -0,0 +1,135 @@ +<!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 = '';
+
+ $('current-screenshot').nextSibling.textContent =
+ localStrings.getString('currentscreenshots');
+ $('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');
+ 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');
+
+ // 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 > 0) + addScreenshot('current-screenshots', screenshots[0]); +} + +function setupDialogDefaults(defaults) { + if (defaults.length > 0) + $('page-url-text').value = defaults[0];
+}
+
+window.addEventListener('DOMContentLoaded', load); +</script> +</head> +<body> +<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> + <!-- Screenshot radio buttons --> + <tr> + <th id="screenshot" class="bug-report-label" i18n-content="screenshot"> + </th> + </tr> + <tr> + <td> + <input id="no-screenshot" type="radio" name="screenshot-group" + value="none" onclick="noneSelected()"> + <br> + <input id="current-screenshot" type="radio" name="screenshot-group" + value="current" checked onclick="currentSelected()"> + <br> + <div id="current-screenshots" class="thumbnail-list"> + </div> + </td> + </tr> + <!-- Buttons --> + <tr> + <td> + <hr> + <input id='send-report-button' type="submit" class="bug-report-button" + i18n-values="value:send-report" onclick="sendReport()"> + <input id='cancel-button' type="submit" class="bug-report-button" + i18n-values="value:cancel" onclick="cancel()"> + </td> + </tr> +</table> +</body> +</html> diff --git a/chrome/browser/resources/bug_report.js b/chrome/browser/resources/bug_report.js new file mode 100644 index 0000000..508a954 --- /dev/null +++ b/chrome/browser/resources/bug_report.js @@ -0,0 +1,152 @@ +// Copyright (c) 2010 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. + +// Constants. +var FEEDBACK_LANDING_PAGE = + 'http://www.google.com/support/chrome/go/feedback_confirmation' + +var selectedThumbnailDivId = ''; +var selectedThumbnailId = ''; +var selectedImageUrl; + +var savedThumbnailIds = []; +savedThumbnailIds['current-screenshots'] = ''; +savedThumbnailIds['saved-screenshots'] = ''; + +var localStrings = new LocalStrings(); + +/** + * Selects an image thumbnail in the specified div. + */ +function selectImage(divId, thumbnailId) { + var thumbnailDivs = $(divId).children; + selectedThumbnailDivId = divId; + for (var i = 0; i < thumbnailDivs.length; i++) { + // If the the current div matches the thumbnail id provided, + // or there is no thumbnail id given, and we're at the first thumbnail. + if ((thumbnailDivs[i].id == thumbnailId) || (!thumbnailId && !i)) { + thumbnailDivs[i].className = 'image-thumbnail-container-selected'; + selectedThumbnailId = thumbnailId; + savedThumbnailIds[divId] = thumbnailId; + } else { + thumbnailDivs[i].className = 'image-thumbnail-container'; + } + } +} + +/** + * Adds an image thumbnail to the specified div. + */ +function addScreenshot(divId, screenshot) { + var thumbnailDiv = document.createElement('div'); + thumbnailDiv.className = 'image-thumbnail-container'; + + thumbnailDiv.id = divId + '-thumbnailDiv-' + $(divId).children.length; + thumbnailDiv.onclick = function() { + selectImage(divId, thumbnailDiv.id); + }; + + var innerDiv = document.createElement('div'); + innerDiv.className = 'image-thumbnail'; + + var thumbnail = document.createElement('img'); + thumbnail.id = thumbnailDiv.id + '-image'; + thumbnail.src = screenshot; + innerDiv.appendChild(thumbnail); + + var largeImage = document.createElement('img'); + largeImage.src = screenshot; + + var popupDiv = document.createElement('div'); + popupDiv.appendChild(largeImage); + innerDiv.appendChild(popupDiv); + + thumbnailDiv.appendChild(innerDiv); + $(divId).appendChild(thumbnailDiv); + + if (!selectedThumbnailId) + selectImage(divId, thumbnailDiv.id); +} + +/** + * Send's the report; after the report is sent, we need to be redirected to + * the landing page, but we shouldn't be able to navigate back, hence + * we open the landing page in a new tab and sendReport closes this tab. + */ +function sendReport() { + if (!$('issue-with-combo').selectedIndex) { + alert(localStrings.getString('no-issue-selected')); + return false; + } + + var imagePath = ''; + if (selectedThumbnailId) + imagePath = $(selectedThumbnailId + '-image').src; + + // Note, categories are based from 1 in our protocol buffers, so no + // adjustment is needed on selectedIndex. + var reportArray = [String($('issue-with-combo').selectedIndex), + $('page-url-text').value, + $('description-text').value, + imagePath]; + + // Add chromeos data if it exists. + if ($('user-email-text') && $('sys-info-checkbox')) { + reportArray = reportArray.concat([$('user-email-text').value, + String($('sys-info-checkbox').checked)]); + } + + // open the landing page in a new tab, sendReport will close this one. + window.open(FEEDBACK_LANDING_PAGE, '_blank'); + chrome.send('sendReport', reportArray); + return true; +} + +function cancel() { + chrome.send('cancel', []); + return true; +} + +/** + * Select the current screenshots div, restoring the image that was + * selected when we had this div open previously. + */ +function currentSelected() { + $('current-screenshots').style.display = 'block'; + if ($('saved-screenshots')) + $('saved-screenshots').style.display = 'none'; + + if (selectedThumbnailDivId != 'current-screenshots') + selectImage('current-screenshots', + savedThumbnailIds['current-screenshots']); + + return true; +} + +/** + * Select the saved screenshots div, restoring the image that was + * selected when we had this div open previously. + */ +function savedSelected() { + $('current-screenshots').style.display = 'none'; + $('saved-screenshots').style.display = 'block'; + + if (selectedThumbnailDivId != 'saved-screenshots') + selectImage('saved-screenshots', savedThumbnailIds['saved-screenshots']); + + return true; +} + +/** + * Unselect all screenshots divs. + */ +function noneSelected() { + $('current-screenshots').style.display = 'none'; + if ($('saved-screenshots')) + $('saved-screenshots').style.display = 'none'; + + selectedThumbnailDivId = ''; + selectedThumbnailId = ''; + return true; +} diff --git a/chrome/browser/resources/bug_report_cros.html b/chrome/browser/resources/bug_report_cros.html new file mode 100644 index 0000000..d001c7e --- /dev/null +++ b/chrome/browser/resources/bug_report_cros.html @@ -0,0 +1,169 @@ +<!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 = ''; + + $('current-screenshot').nextSibling.textContent = + localStrings.getString('currentscreenshots'); + $('saved-screenshot').nextSibling.textContent = + localStrings.getString('savedscreenshots'); + $('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'); + 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'); + + // 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) { + currentScreenshot = screenshots[0]; + addScreenshot('current-screenshots', currentScreenshot); + + savedScreenshots = screenshots[1]; + for (i = 0; i < savedScreenshots.length; ++i) + addScreenshot('saved-screenshots', savedScreenshots[i]); + } +} + +function setupDialogDefaults(defaults) { + if (defaults.length > 2) { + $('page-url-text').value = defaults[0]; + $('sysinfo-url').href = defaults[1]; + $('user-email-text').value = defaults[2]; + } +} + +window.addEventListener('DOMContentLoaded', load); +</script> +</head> +<body> +<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> + <!-- System Information checkbox --> + <tr> + <td> + <input id="sys-info-checkbox" type="checkbox" value="sysinfo" checked> + <span id="sysinfo-label"></span> <a href='about:blank' id="sysinfo-url" + target="_blank" i18n-content="sysinfo">></a> + </td> + </tr> + <!-- 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> + <!-- Screenshot radio buttons --> + <tr> + <th id="screenshot" class="bug-report-label" i18n-content="screenshot"> + </th> + </tr> + <tr> + <td> + <input id="no-screenshot" type="radio" name="screenshot-group" + value="none" onclick="noneSelected()"> + <br> + <input id="saved-screenshot" type="radio" name="screenshot-group" + value="saved" onclick="savedSelected()"> + <br> + <div id="saved-screenshots" style="display: none;" + class="thumbnail-list"> + </div> + <input id="current-screenshot" type="radio" name="screenshot-group" + value="current" checked onclick="currentSelected()"> + <br> + <div id="current-screenshots" class="thumbnail-list"> + </div> + </td> + </tr> + <!-- Buttons --> + <tr> + <td> + <hr> + <input id='send-report-button' type="submit" class="bug-report-button" + i18n-values="value:send-report" onclick="sendReport()"> + <input id='cancel-button' type="submit" class="bug-report-button" + i18n-values="value:cancel" onclick="cancel()"> + </td> + </tr> +</table> +</body> +</html> diff --git a/chrome/browser/resources/bug_report_invalid.html b/chrome/browser/resources/bug_report_invalid.html new file mode 100644 index 0000000..e6b1605 --- /dev/null +++ b/chrome/browser/resources/bug_report_invalid.html @@ -0,0 +1,10 @@ +<!DOCTYPE HTML> +<html> +<head> +<meta charset="utf-8"> +</head> +<title i18n-content="title"></title> +<body onselectstart='return false'> +Invalid BugReport options - please check. +</body> +</html> |