Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Allow feedback form to be shown in an App Launcher feedback mode.

This mode changes the strings shown, and also hides some parts of the
form such as screenshots and URLs. This mode is opened by showing the
feedback form with a new category tab of "AppLauncher"

BUG=179474


Review URL: https://chromiumcodereview.appspot.com/12737006

git-svn-id: http://src.chromium.org/svn/trunk/src/chrome/browser@190138 4ff67af0-8c30-449e-8e8b-ad334ec8d88c
  • Loading branch information...
commit a1396b0fc303137a6339cf60bb84dc20949c4410 1 parent 6db5a61
benwells@chromium.org authored
View
6 feedback/feedback_util.cc
@@ -40,6 +40,10 @@
using content::WebContents;
+namespace chrome {
+const char kAppLauncherCategoryTag[] = "AppLauncher";
+} // namespace chrome
+
const int kFeedbackVersion = 1;
const char kReportPhishingUrl[] =
@@ -367,7 +371,7 @@ void FeedbackUtil::SendReport(scoped_refptr<FeedbackData> data) {
#if defined(FULL_SAFE_BROWSING)
// static
void FeedbackUtil::ReportPhishing(WebContents* current_tab,
- const std::string& phishing_url) {
+ const std::string& phishing_url) {
current_tab->GetController().LoadURL(
safe_browsing_util::GeneratePhishingReportUrl(
kReportPhishingUrl, phishing_url,
View
4 feedback/feedback_util.h
@@ -31,6 +31,10 @@ namespace content {
class WebContents;
}
+namespace chrome {
+extern const char kAppLauncherCategoryTag[];
+} // namespace chrome
+
class FeedbackUtil {
public:
View
9 resources/feedback.css
@@ -105,3 +105,12 @@
font-weight: bold;
padding-left: 20px;
}
+
+.launcher-layout #page-url,
+.launcher-layout #screenshot-row,
+.launcher-layout #title,
+.launcher-layout #description,
+html:not(.launcher-layout) #launcher-title,
+html:not(.launcher-layout) #launcher-description {
+ display: none;
+}
View
6 resources/feedback.html
@@ -14,9 +14,11 @@
</head>
<body id="feedback-page"
i18n-values=".style.fontFamily:fontfamily;.style.fontSize:fontsize">
- <h1 i18n-content="title"></h1>
+ <h1 id="title" i18n-content="title"></h1>
+ <h1 id="launcher-title" i18n-content="launcher-title"></h1>
<div id="content">
- <span id="description" colspan="2" i18n-content="description"></span>
+ <span id="description" i18n-content="description"></span>
+ <span id="launcher-description" i18n-content="launcher-description"></span>
<textarea id="description-text" rows="10"></textarea>
<div id="page-url" class="input-text-container checkbox">
<label>
View
6 resources/feedback.js
@@ -95,7 +95,7 @@ function addScreenshot(divId, screenshot) {
}
/**
- * Disables screenshots completely.
+ * Enables screenshots.
*/
function enableScreenshots() {
if (forceDisableScreenshots)
@@ -398,7 +398,9 @@ function setupDialogDefaults(defaults) {
$('user-email-text').value = defaults.userEmail;
$('user-email-checkbox').checked = defaults.emailCheckboxDefault;
- // Are screenshots disabled?
+ document.documentElement.classList.toggle('launcher-layout',
+ defaults.launcherFeedback);
+
if (!defaults.disableScreenshots)
enableScreenshots();
View
63 ui/webui/feedback_ui.cc
@@ -203,28 +203,29 @@ void ShowFeedbackPage(Browser* browser,
return;
}
- std::vector<unsigned char>* last_screenshot_png =
- FeedbackUtil::GetScreenshotPng();
- last_screenshot_png->clear();
+ if (category_tag != kAppLauncherCategoryTag) {
+ std::vector<unsigned char>* last_screenshot_png =
+ FeedbackUtil::GetScreenshotPng();
+ last_screenshot_png->clear();
- gfx::NativeWindow native_window;
- gfx::Rect snapshot_bounds;
+ gfx::NativeWindow native_window;
+ gfx::Rect snapshot_bounds;
#if defined(OS_CHROMEOS)
- // For ChromeOS, don't use the browser window but the root window
- // instead to grab the screenshot. We want everything on the screen, not
- // just the current browser.
- native_window = ash::Shell::GetPrimaryRootWindow();
- snapshot_bounds = gfx::Rect(native_window->bounds());
+ // For ChromeOS, don't use the browser window but the root window
+ // instead to grab the screenshot. We want everything on the screen, not
+ // just the current browser.
+ native_window = ash::Shell::GetPrimaryRootWindow();
+ snapshot_bounds = gfx::Rect(native_window->bounds());
#else
- native_window = browser->window()->GetNativeWindow();
- snapshot_bounds = gfx::Rect(browser->window()->GetBounds().size());
+ native_window = browser->window()->GetNativeWindow();
+ snapshot_bounds = gfx::Rect(browser->window()->GetBounds().size());
#endif
- bool success = chrome::GrabWindowSnapshotForUser(native_window,
- last_screenshot_png,
- snapshot_bounds);
- FeedbackUtil::SetScreenshotSize(success ? snapshot_bounds : gfx::Rect());
-
+ bool success = chrome::GrabWindowSnapshotForUser(native_window,
+ last_screenshot_png,
+ snapshot_bounds);
+ FeedbackUtil::SetScreenshotSize(success ? snapshot_bounds : gfx::Rect());
+ }
std::string feedback_url = std::string(chrome::kChromeUIFeedbackURL) + "?" +
kSessionIDParameter + base::IntToString(browser->session_id().id()) +
"&" + kTabIndexParameter +
@@ -282,6 +283,7 @@ class FeedbackHandler : public WebUIMessageHandler,
scoped_refptr<FeedbackData> feedback_data_;
std::string target_tab_url_;
+ std::string category_tag_;
#if defined(OS_CHROMEOS)
// Timestamp of when the feedback request was initiated.
std::string timestamp_;
@@ -337,6 +339,9 @@ content::WebUIDataSource* CreateFeedbackUIHTMLSource(bool successful_init) {
source->AddLocalizedString("no-saved-screenshots",
IDS_FEEDBACK_NO_SAVED_SCREENSHOTS_HELP);
source->AddLocalizedString("privacy-note", IDS_FEEDBACK_PRIVACY_NOTE);
+ source->AddLocalizedString("launcher-title", IDS_FEEDBACK_LAUNCHER_TITLE);
+ source->AddLocalizedString("launcher-description",
+ IDS_FEEDBACK_LAUNCHER_DESCRIPTION_LABEL);
source->SetJsonPath("strings.js");
source->AddResourcePath("feedback.js", IDR_FEEDBACK_JS);
@@ -407,29 +412,28 @@ bool FeedbackHandler::Init() {
&query_str, 0, kSessionIDParameter, "");
if (!base::StringToInt(query_str, &session_id))
return false;
- continue;
- }
- if (StartsWithASCII(*it, std::string(kTabIndexParameter), true)) {
+ } else if (StartsWithASCII(*it, std::string(kTabIndexParameter), true)) {
ReplaceFirstSubstringAfterOffset(
&query_str, 0, kTabIndexParameter, "");
if (!base::StringToInt(query_str, &index))
return false;
- continue;
- }
- if (StartsWithASCII(*it, std::string(kCustomPageUrlParameter), true)) {
+ } else if (StartsWithASCII(*it, std::string(kCustomPageUrlParameter),
+ true)) {
ReplaceFirstSubstringAfterOffset(
&query_str, 0, kCustomPageUrlParameter, "");
custom_page_url = query_str;
- continue;
- }
+ } else if (StartsWithASCII(*it, std::string(kCategoryTagParameter),
+ true)) {
+ ReplaceFirstSubstringAfterOffset(
+ &query_str, 0, kCategoryTagParameter, "");
+ category_tag_ = query_str;
#if defined(OS_CHROMEOS)
- if (StartsWithASCII(*it, std::string(kTimestampParameter), true)) {
+ } else if (StartsWithASCII(*it, std::string(kTimestampParameter), true)) {
ReplaceFirstSubstringAfterOffset(
&query_str, 0, kTimestampParameter, "");
timestamp_ = query_str;
- continue;
- }
#endif
+ }
}
}
@@ -490,6 +494,9 @@ void FeedbackHandler::HandleGetDialogDefaults(const ListValue*) {
// Send back values which the dialog js needs initially.
DictionaryValue dialog_defaults;
+ if (category_tag_ == chrome::kAppLauncherCategoryTag)
+ dialog_defaults.SetBoolean("launcherFeedback", true);
+
// Current url.
dialog_defaults.SetString("currentUrl", target_tab_url_);
Please sign in to comment.
Something went wrong with that request. Please try again.