Commit 286fcbbb authored by Ahmed Fakhry's avatar Ahmed Fakhry Committed by Commit Bot

[Feedback] Introduce description placeholder text

Instead of pre-populating the feedback description of crash
reports with text that ends up being sent to the server, we
should instead add this text as a placeholder instruction to
the user.

BUG=756630
TEST=manual

Cq-Include-Trybots: master.tryserver.chromium.linux:closure_compilation
Change-Id: I86bbead3eed94d028277721239cc12fecd886484
Reviewed-on: https://chromium-review.googlesource.com/848501Reviewed-by: default avatarToni Barzic <tbarzic@chromium.org>
Reviewed-by: default avatarScott Violet <sky@chromium.org>
Commit-Queue: Ahmed Fakhry <afakhry@chromium.org>
Cr-Commit-Position: refs/heads/master@{#526893}
parent 52e1d55c
......@@ -255,7 +255,7 @@ void LoginFeedback::EnsureFeedbackUI() {
extensions::FeedbackPrivateAPI* api =
extensions::FeedbackPrivateAPI::GetFactoryInstance()->Get(profile_);
api->RequestFeedbackForFlow(
description_, "Login", std::string(), GURL(),
description_, std::string(), "Login", std::string(), GURL(),
extensions::api::feedback_private::FeedbackFlow::FEEDBACK_FLOW_LOGIN);
// Make sure there is a feedback app window opened.
......
......@@ -79,9 +79,9 @@ class FeedbackTest : public ExtensionBrowserTest {
extensions::FeedbackPrivateAPI* api =
extensions::FeedbackPrivateAPI::GetFactoryInstance()->Get(
browser()->profile());
api->RequestFeedbackForFlow("Test description", "Test tag",
extra_diagnostics, GURL("http://www.test.com"),
flow);
api->RequestFeedbackForFlow("Test description", "Test placeholder",
"Test tag", extra_diagnostics,
GURL("http://www.test.com"), flow);
}
};
......
......@@ -20,6 +20,7 @@ namespace chrome {
void ShowFeedbackPage(Browser* browser,
FeedbackSource source,
const std::string& description_template,
const std::string& description_placeholder_text,
const std::string& category_tag,
const std::string& extra_diagnostics) {
GURL page_url;
......@@ -42,7 +43,8 @@ void ShowFeedbackPage(Browser* browser,
extensions::FeedbackPrivateAPI::GetFactoryInstance()->Get(profile);
api->RequestFeedbackForFlow(
description_template, category_tag, extra_diagnostics, page_url,
description_template, description_placeholder_text, category_tag,
extra_diagnostics, page_url,
source == kFeedbackSourceSadTabPage
? feedback_private::FeedbackFlow::FEEDBACK_FLOW_SADTABCRASH
: feedback_private::FeedbackFlow::FEEDBACK_FLOW_REGULAR);
......
......@@ -321,6 +321,7 @@ function initialize() {
}
$('description-text').textContent = feedbackInfo.description;
$('description-text').placeholder = feedbackInfo.descriptionPlaceholder;
if (feedbackInfo.pageUrl)
$('page-url-text').value = feedbackInfo.pageUrl;
......
......@@ -269,7 +269,9 @@ void SupervisedUserInterstitial::CommandReceived(const std::string& command) {
#else
chrome::ShowFeedbackPage(chrome::FindBrowserWithWebContents(web_contents_),
chrome::kFeedbackSourceSupervisedUserInterstitial,
message, std::string() /* category_tag */,
message,
std::string() /* description_placeholder_text */,
std::string() /* category_tag */,
std::string() /* extra_diagnostics */);
#endif
return;
......
......@@ -1095,6 +1095,7 @@ void OpenFeedbackDialog(Browser* browser, FeedbackSource source) {
base::RecordAction(UserMetricsAction("Feedback"));
chrome::ShowFeedbackPage(
browser, source, std::string() /* description_template */,
std::string() /* description_placeholder_text */,
std::string() /* category_tag */, std::string() /* extra_diagnostics */);
}
......
......@@ -66,6 +66,7 @@ void ShowConflicts(Browser* browser);
void ShowFeedbackPage(Browser* browser,
FeedbackSource source,
const std::string& description_template,
const std::string& description_placeholder_text,
const std::string& category_tag,
const std::string& extra_diagnostics);
......
......@@ -32,8 +32,9 @@ void OnProfileErrorDialogDismissed(const std::string& diagnostics,
l10n_util::GetStringUTF8(IDS_PROFILE_ERROR_FEEDBACK_DESCRIPTION);
chrome::ShowFeedbackPage(nullptr, chrome::kFeedbackSourceProfileErrorDialog,
feedback_description, kProfileErrorFeedbackCategory,
diagnostics);
feedback_description,
std::string() /* description_placeholder_text */,
kProfileErrorFeedbackCategory, diagnostics);
}
#endif // !defined(OS_ANDROID)
......
......@@ -228,6 +228,7 @@ void SadTab::PerformAction(SadTab::Action action) {
ShowFeedbackPage(
chrome::FindBrowserWithWebContents(web_contents_),
chrome::kFeedbackSourceSadTabPage,
std::string() /* description_template */,
l10n_util::GetStringUTF8(kind_ == SAD_TAB_KIND_CRASHED
? IDS_CRASHED_TAB_FEEDBACK_MESSAGE
: IDS_KILLED_TAB_FEEDBACK_MESSAGE),
......
......@@ -97,6 +97,7 @@ LogSourceAccessManager* FeedbackPrivateAPI::GetLogSourceAccessManager() const {
void FeedbackPrivateAPI::RequestFeedbackForFlow(
const std::string& description_template,
const std::string& description_placeholder_text,
const std::string& category_tag,
const std::string& extra_diagnostics,
const GURL& page_url,
......@@ -104,6 +105,8 @@ void FeedbackPrivateAPI::RequestFeedbackForFlow(
if (browser_context_ && EventRouter::Get(browser_context_)) {
FeedbackInfo info;
info.description = description_template;
info.description_placeholder =
std::make_unique<std::string>(description_placeholder_text);
info.category_tag = std::make_unique<std::string>(category_tag);
info.page_url = std::make_unique<std::string>(page_url.spec());
info.system_information = std::make_unique<SystemInformationList>();
......
......@@ -32,6 +32,7 @@ class FeedbackPrivateAPI : public BrowserContextKeyedAPI {
#endif // defined(OS_CHROMEOS)
void RequestFeedbackForFlow(const std::string& description_template,
const std::string& description_placeholder_text,
const std::string& category_tag,
const std::string& extra_diagnostics,
const GURL& page_url,
......
......@@ -44,6 +44,10 @@ namespace feedbackPrivate {
// The feedback text describing the user issue.
DOMString description;
// The placeholder text that will be shown in the description field when
// it's empty.
DOMString? descriptionPlaceholder;
// The e-mail of the user that initiated this feedback.
DOMString? email;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment