diff options
author | rkc@chromium.org <rkc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-31 01:30:22 +0000 |
---|---|---|
committer | rkc@chromium.org <rkc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-31 01:30:22 +0000 |
commit | 95527d02888bc4bba1de22c146c7d134724a3728 (patch) | |
tree | 556dfc78b6ef6ed921f04fdc68d7c9aa7e2e3f40 | |
parent | 3dd857f10ce78d6cb851c1f67206b72f03f4844c (diff) | |
download | chromium_src-95527d02888bc4bba1de22c146c7d134724a3728.zip chromium_src-95527d02888bc4bba1de22c146c7d134724a3728.tar.gz chromium_src-95527d02888bc4bba1de22c146c7d134724a3728.tar.bz2 |
Allow users to launch the feedback page from an extension.
The primary issue blocking this is was the screenshot, which would show up as a broken link if a user went to the chrome://feedback page directly.
With this change, to launch the feedback page from an extension, open it with this format,
chrome://feedback/#0?description=Text you want in the description field&categoryTag=TheCategory&customPageUrl=www.yourpageurl.com
Including the customPageUrl will supress the screenshot completely and set the page url on the displayed feedback page to the one specified.
R=zelidrag@chromium.org,xiyuan@chromium.org
BUG=chromium-os:24993
TEST=Tested opening the feedback page without going through the Report an Issue menu item with the customPageUrl parameter. Verified that the screenshot is not shown at all and the feedback is sent successfully on submit.
Review URL: http://codereview.chromium.org/9271033
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@119800 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/resources/feedback.css | 6 | ||||
-rw-r--r-- | chrome/browser/resources/feedback.html | 13 | ||||
-rw-r--r-- | chrome/browser/resources/feedback.js | 56 |
3 files changed, 49 insertions, 26 deletions
diff --git a/chrome/browser/resources/feedback.css b/chrome/browser/resources/feedback.css index 74582daa8..61cf546 100644 --- a/chrome/browser/resources/feedback.css +++ b/chrome/browser/resources/feedback.css @@ -1,3 +1,8 @@ +/* Copyright (c) 2012 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. + */ + .feedback-label { text-align: start; vertical-align: text-top; @@ -39,7 +44,6 @@ hr { .thumbnail-list { -webkit-margin-start: 1em; width: 33.5em; - display: block; margin-top: 0.5em; margin-bottom: 1em; } diff --git a/chrome/browser/resources/feedback.html b/chrome/browser/resources/feedback.html index dd44b3f..8e418ea 100644 --- a/chrome/browser/resources/feedback.html +++ b/chrome/browser/resources/feedback.html @@ -108,7 +108,7 @@ </tr> </if> <!-- Screenshot --> - <tr> + <tr id="screenshot-row"> <td> <table class="feedback-table"> <tr> @@ -120,15 +120,14 @@ </label> <if expr="pp_ifdef('chromeos')"> <span id="screenshot-label-saved" - style="display: none;" - i18n-content="saved-screenshot"> + i18n-content="saved-screenshot" hidden> </span> <a id="screenshot-link-tosaved" href="#" i18n-content="choose-different-screenshot"> </a> <a id="screenshot-link-tocurrent" href="#" - style="display: none;" - i18n-content="choose-original-screenshot"> + i18n-content="choose-original-screenshot" + hidden> </a> </if> </td> @@ -139,8 +138,8 @@ <tr> <td> <if expr="pp_ifdef('chromeos')"> - <div id="saved-screenshots" style="display: none;" - class="thumbnail-list"></div> + <div id="saved-screenshots" class="thumbnail-list" + hidden></div> </if> <div id="current-screenshots" class="thumbnail-list"> </div> diff --git a/chrome/browser/resources/feedback.js b/chrome/browser/resources/feedback.js index 0e19d25..fc0588f 100644 --- a/chrome/browser/resources/feedback.js +++ b/chrome/browser/resources/feedback.js @@ -25,7 +25,7 @@ function selectImage(divId, thumbnailId) { var thumbnailDivs = $(divId).children; selectedThumbnailDivId = divId; if (thumbnailDivs.length == 0) { - $(divId).style.display = 'none'; + $(divId).hidden = true; return; } for (var i = 0; i < thumbnailDivs.length; i++) { @@ -74,6 +74,18 @@ function addScreenshot(divId, screenshot) { } /** + * Disables screenshots completely. + */ +function disableScreenshots() { + $('screenshot-row').hidden = true; + $('screenshot-checkbox').checked = false; + + $('current-screenshots').hidden = true; + if ($('saved-screenshots')) + $('saved-screenshots').hidden = true; +} + +/** * 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. @@ -122,9 +134,9 @@ function cancel() { */ function currentSelected() { // TODO(rkc): Change this to use a class instead. - $('current-screenshots').style.display = 'block'; + $('current-screenshots').hidden = false; if ($('saved-screenshots')) - $('saved-screenshots').style.display = 'none'; + $('saved-screenshots').hidden = true; if (selectedThumbnailDivId != 'current-screenshots') selectImage('current-screenshots', @@ -138,13 +150,13 @@ function currentSelected() { * selected when we had this div open previously. */ function savedSelected() { - $('current-screenshots').style.display = 'none'; + $('current-screenshots').hidden = true; if ($('saved-screenshots').childElementCount == 0) { // setupSavedScreenshots will take care of changing visibility chrome.send('refreshSavedScreenshots', []); } else { - $('saved-screenshots').style.display = 'block'; + $('saved-screenshots').hidden = false; if (selectedThumbnailDivId != 'saved-screenshots') selectImage('saved-screenshots', savedThumbnailIds['saved-screenshots']); } @@ -158,12 +170,12 @@ function savedSelected() { * the current screenshot to saved screenshots */ function changeToSaved() { - $('screenshot-label-current').style.display = 'none'; - $('screenshot-label-saved').style.display = 'inline'; + $('screenshot-label-current').hidden = true; + $('screenshot-label-saved').hidden = false; // Change the link to say "go to original" - $('screenshot-link-tosaved').style.display = 'none'; - $('screenshot-link-tocurrent').style.display = 'inline'; + $('screenshot-link-tosaved').hidden = true; + $('screenshot-link-tocurrent').hidden = false; savedSelected(); } @@ -173,12 +185,12 @@ function changeToSaved() { * the saved screenshots to the current screenshots */ function changeToCurrent() { - $('screenshot-label-current').style.display = 'inline'; - $('screenshot-label-saved').style.display = 'none'; + $('screenshot-label-current').hidden = false; + $('screenshot-label-saved').hidden = true; - // Change the link to say "go to original" - $('screenshot-link-tosaved').style.display = 'inline'; - $('screenshot-link-tocurrent').style.display = 'none'; + // Change the link to say "go to saved" + $('screenshot-link-tosaved').hidden = false; + $('screenshot-link-tocurrent').hidden = true; currentSelected(); } @@ -211,6 +223,7 @@ function load() { var parameters = { 'description': '', 'categoryTag': '', + 'customPageUrl': '', }; var queryPos = window.location.hash.indexOf('?'); if (queryPos !== -1) { @@ -228,6 +241,12 @@ function load() { // Set the initial description text. $('description-text').textContent = parameters['description']; + // If a page url is spcified in the parameters, override the default page url. + if (parameters['customPageUrl'] != '') { + $('page-url-text').value = parameters['customPageUrl']; + // and disable the page image, since it doesn't make sense on a custum url. + disableScreenshots(); + } // Pick up the category tag (for most cases this will be an empty string) categoryTag = parameters['categoryTag']; @@ -246,7 +265,7 @@ function setupSavedScreenshots(screenshots) { localStrings.getString('no-saved-screenshots'); // Make sure we make the display the message. - $('saved-screenshots').style.display = 'block'; + $('saved-screenshots').hidden = false; // In case the user tries to send now; fail safe, do not send a screenshot // at all versus sending the current screenshot. @@ -264,7 +283,8 @@ function setupSavedScreenshots(screenshots) { function setupDialogDefaults(defaults) { if (defaults.length > 0) { - $('page-url-text').value = defaults[0]; + if ($('page-url-text').value == '') + $('page-url-text').value = defaults[0]; if (defaults[0] == '') $('page-url-checkbox').checked = false; @@ -274,10 +294,10 @@ function setupDialogDefaults(defaults) { if (defaults[2] == '') { // if we didn't get an e-mail address from cros, // disable the user email display totally. - $('user-email-table').style.display = 'none'; + $('user-email-table').hidden = true; // this also means we are in privacy mode, so no saved screenshots. - $('screenshot-link-tosaved').style.display = 'none'; + $('screenshot-link-tosaved').hidden = true; } } } |