Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1227)

Unified Diff: chrome/browser/resources/bug_report.js

Issue 5372007: Retry commit for, (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/chrome/browser/resources
Patch Set: Created 10 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/resources/bug_report.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/bug_report.js
diff --git a/chrome/browser/resources/bug_report.js b/chrome/browser/resources/bug_report.js
index dbd12418a7a79617b833042bcd9f6334de7ca622..3d40b4e1f3c1ed0feacd4a52b80766b463e8e54c 100644
--- a/chrome/browser/resources/bug_report.js
+++ b/chrome/browser/resources/bug_report.js
@@ -52,22 +52,18 @@ function addScreenshot(divId, screenshot) {
};
var innerDiv = document.createElement('div');
- innerDiv.className = 'image-thumbnail';
+ if (divId == 'current-screenshots')
+ innerDiv.className = 'image-thumbnail-current';
+ else
+ innerDiv.className = 'image-thumbnail';
var thumbnail = document.createElement('img');
thumbnail.id = thumbnailDiv.id + '-image';
// We add the ?+timestamp to make sure the image URLs are unique
// and Chrome does not load the image from cache.
- thumbnail.src = screenshot + "?" + Date.now();
+ thumbnail.src = screenshot + '?' + Date.now();
innerDiv.appendChild(thumbnail);
- var largeImage = document.createElement('img');
- largeImage.src = screenshot + "?" + Date.now();
-
- var popupDiv = document.createElement('div');
- popupDiv.appendChild(largeImage);
- innerDiv.appendChild(popupDiv);
-
thumbnailDiv.appendChild(innerDiv);
$(divId).appendChild(thumbnailDiv);
@@ -84,20 +80,31 @@ function sendReport() {
if (!$('issue-with-combo').selectedIndex) {
alert(localStrings.getString('no-issue-selected'));
return false;
+ } else if ($('description-text').value.length == 0) {
+ alert(localStrings.getString('no-description'));
+ return false;
}
var imagePath = '';
- if (selectedThumbnailId)
+ if ($('screenshot-checkbox').checked && selectedThumbnailId)
imagePath = $(selectedThumbnailId + '-image').src;
+ var pageUrl = $('page-url-text').value;
+ if (!$('page-url-checkbox').checked)
+ pageUrl = '';
+ // 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,
+ pageUrl,
$('description-text').value,
imagePath];
- // Add chromeos data if it exists.
- if ($('user-email-text') && $('sys-info-checkbox')) {
- reportArray = reportArray.concat([$('user-email-text').value,
+ // Add chromeos data if it exists.
+ if ($('user-email-text') && $('sys-info-checkbox')) {
+ var userEmail= $('user-email-text').textContent;
+ if (!$('user-email-checkbox').checked)
+ userEmail = '';
+ reportArray = reportArray.concat([userEmail,
String($('sys-info-checkbox').checked)]);
}
@@ -117,6 +124,7 @@ function cancel() {
* selected when we had this div open previously.
*/
function currentSelected() {
+ // TODO(rkc): Change this to use a class instead.
$('current-screenshots').style.display = 'block';
if ($('saved-screenshots'))
$('saved-screenshots').style.display = 'none';
@@ -131,26 +139,49 @@ function currentSelected() {
/**
* Select the saved screenshots div, restoring the image that was
* selected when we had this div open previously.
- */
-function savedSelected() {
+ */
+function savedSelected() {
$('current-screenshots').style.display = 'none';
- $('saved-screenshots').style.display = 'block';
- if (selectedThumbnailDivId != 'saved-screenshots')
- selectImage('saved-screenshots', savedThumbnailIds['saved-screenshots']);
+ if ($('saved-screenshots').childElementCount == 0) {
+ // setupSavedScreenshots will take care of changing visibility
+ chrome.send('refreshSavedScreenshots', []);
+ } else {
+ $('saved-screenshots').style.display = 'block';
+ if (selectedThumbnailDivId != 'saved-screenshots')
+ selectImage('saved-screenshots', savedThumbnailIds['saved-screenshots']);
+ }
return true;
}
+
/**
- * Unselect all screenshots divs.
+ * Change the type of screenshot we're showing to the user from
+ * the current screenshot to saved screenshots
*/
-function noneSelected() {
- $('current-screenshots').style.display = 'none';
- if ($('saved-screenshots'))
- $('saved-screenshots').style.display = 'none';
+function changeToSaved() {
+ $('screenshot-label-current').style.display = 'none';
+ $('screenshot-label-saved').style.display = 'inline';
- selectedThumbnailDivId = '';
- selectedThumbnailId = '';
- return true;
+ // Change the link to say "go to original"
+ $('screenshot-link-tosaved').style.display = 'none';
+ $('screenshot-link-tocurrent').style.display = 'inline';
+
+ savedSelected();
+}
+
+/**
+ * Change the type of screenshot we're showing to the user from
+ * the saved screenshots to the current screenshots
+ */
+function changeToCurrent() {
+ $('screenshot-label-current').style.display = 'inline';
+ $('screenshot-label-saved').style.display = 'none';
+
+ // Change the link to say "go to original"
+ $('screenshot-link-tosaved').style.display = 'inline';
+ $('screenshot-link-tocurrent').style.display = 'none';
+
+ currentSelected();
}
« no previous file with comments | « chrome/browser/resources/bug_report.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698