From 75b6d1b8495e769410dc1da24db28d1bf415a4d5 Mon Sep 17 00:00:00 2001 From: Takumi Fujimoto Date: Fri, 8 Apr 2022 01:51:42 +0000 Subject: [PATCH] [Cast feedback] Add a checkbox to indicate user permission to send email Add a checkbox to the feedback form at chrome://cast-feedback for the user to indicate whether they allow us to send email to the address they provide. Also change the default text in the email input element to "Your email address" from "Your answer" Screenshot: https://drive.google.com/file/d/1uv25GuXb3-Rsl71rhgY4nj6TtDWXWNz9/view?usp=sharing Bug: b/214000578 Change-Id: I9cdd5abeb6fb6243843be6124fc859f1cf4c8960 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3574735 Reviewed-by: Mark Foltz Commit-Queue: Takumi Fujimoto Cr-Commit-Position: refs/heads/main@{#990230} --- chrome/app/media_router_strings.grdp | 6 +++++ ...R_FEEDBACK_ALLOW_CONTACT_BY_EMAIL.png.sha1 | 1 + ...OUTER_FEEDBACK_YOUR_EMAIL_ADDRESS.png.sha1 | 1 + .../media_router/cast_feedback_ui.html | 20 +++++++++++--- .../media_router/cast_feedback_ui.js | 27 +++++++++++++------ .../ui/webui/media_router/cast_feedback_ui.cc | 3 ++- 6 files changed, 45 insertions(+), 13 deletions(-) create mode 100644 chrome/app/media_router_strings_grdp/IDS_MEDIA_ROUTER_FEEDBACK_ALLOW_CONTACT_BY_EMAIL.png.sha1 create mode 100644 chrome/app/media_router_strings_grdp/IDS_MEDIA_ROUTER_FEEDBACK_YOUR_EMAIL_ADDRESS.png.sha1 diff --git a/chrome/app/media_router_strings.grdp b/chrome/app/media_router_strings.grdp index 49700535fc4380..5390f722a5508f 100644 --- a/chrome/app/media_router_strings.grdp +++ b/chrome/app/media_router_strings.grdp @@ -205,6 +205,12 @@ video files, instead of all files."> Additional comments: + + We may email you for more information or updates + + + Your email address + Email (optional): diff --git a/chrome/app/media_router_strings_grdp/IDS_MEDIA_ROUTER_FEEDBACK_ALLOW_CONTACT_BY_EMAIL.png.sha1 b/chrome/app/media_router_strings_grdp/IDS_MEDIA_ROUTER_FEEDBACK_ALLOW_CONTACT_BY_EMAIL.png.sha1 new file mode 100644 index 00000000000000..e75f39b79a9583 --- /dev/null +++ b/chrome/app/media_router_strings_grdp/IDS_MEDIA_ROUTER_FEEDBACK_ALLOW_CONTACT_BY_EMAIL.png.sha1 @@ -0,0 +1 @@ +422d4718c9b17a88fb5da0e526d643ad925b5841 \ No newline at end of file diff --git a/chrome/app/media_router_strings_grdp/IDS_MEDIA_ROUTER_FEEDBACK_YOUR_EMAIL_ADDRESS.png.sha1 b/chrome/app/media_router_strings_grdp/IDS_MEDIA_ROUTER_FEEDBACK_YOUR_EMAIL_ADDRESS.png.sha1 new file mode 100644 index 00000000000000..be247f54f508a1 --- /dev/null +++ b/chrome/app/media_router_strings_grdp/IDS_MEDIA_ROUTER_FEEDBACK_YOUR_EMAIL_ADDRESS.png.sha1 @@ -0,0 +1 @@ +078ba16a641c05d2ae8d58a5b451cb8b9a12e0ab \ No newline at end of file diff --git a/chrome/browser/resources/media_router/cast_feedback_ui.html b/chrome/browser/resources/media_router/cast_feedback_ui.html index 94117cf86539e7..afc9f4a709f064 100644 --- a/chrome/browser/resources/media_router/cast_feedback_ui.html +++ b/chrome/browser/resources/media_router/cast_feedback_ui.html @@ -22,6 +22,10 @@ line-height: 13px; } +#allow-contact-by-email { + padding: 10px 0; +} + #feedback-confirmation { width: initial; } @@ -103,7 +107,7 @@ color: var(--google-red-500); } -.send-logs { +.checkbox-label { font-size: 15px; } @@ -331,13 +335,21 @@
$i18n{emailField}
- + + $i18n{allowContactByEmail} + + + + type="text" + disabled="[[!allowContactByEmail_]]"> - + $i18nRaw{sendLogsHtml} diff --git a/chrome/browser/resources/media_router/cast_feedback_ui.js b/chrome/browser/resources/media_router/cast_feedback_ui.js index 3a1bb623aacc38..2563e320f32d96 100644 --- a/chrome/browser/resources/media_router/cast_feedback_ui.js +++ b/chrome/browser/resources/media_router/cast_feedback_ui.js @@ -115,6 +115,12 @@ export class FeedbackUiElement extends PolymerElement { static get properties() { return { + /** @private */ + allowContactByEmail_: { + type: Boolean, + value: false, + }, + /** @private */ attachLogs_: { type: Boolean, @@ -205,7 +211,7 @@ export class FeedbackUiElement extends PolymerElement { /** @override */ ready() { super.ready(); - this.shadowRoot.querySelector('.send-logs a') + this.shadowRoot.querySelector('#send-logs a') .addEventListener('click', event => { event.preventDefault(); this.logsDialog_.showModal(); @@ -287,7 +293,7 @@ export class FeedbackUiElement extends PolymerElement { const feedback = { productId: 85561, description: parts.join('\n'), - email: this.userEmail_, + email: this.allowContactByEmail_ ? this.userEmail_ : '', flow: chrome.feedbackPrivate.FeedbackFlow.REGULAR, categoryTag: this.categoryTag_, systemInformation: this.getProductSpecificData_(), @@ -368,12 +374,17 @@ export class FeedbackUiElement extends PolymerElement { /** @private */ getProductSpecificData_() { - const data = [{ - key: 'global_media_controls_cast_start_stop', - value: loadTimeData.getBoolean('globalMediaControlsCastStartStop') ? - 'true' : - 'false', - }]; + const data = [ + { + key: 'global_media_controls_cast_start_stop', + value: String( + !!loadTimeData.getBoolean('globalMediaControlsCastStartStop')), + }, + { + key: 'feedbackUserCtlConsent', + value: String(!!this.allowContactByEmail_), + } + ]; return data; } diff --git a/chrome/browser/ui/webui/media_router/cast_feedback_ui.cc b/chrome/browser/ui/webui/media_router/cast_feedback_ui.cc index ec78bbec16fafd..2fd1b7eb689642 100644 --- a/chrome/browser/ui/webui/media_router/cast_feedback_ui.cc +++ b/chrome/browser/ui/webui/media_router/cast_feedback_ui.cc @@ -46,7 +46,7 @@ CastFeedbackUI::CastFeedbackUI(content::WebUI* web_ui) static constexpr webui::LocalizedString kStrings[] = { {"additionalComments", IDS_MEDIA_ROUTER_FEEDBACK_ADDITIONAL_COMMENTS}, - {"additionalComments", IDS_MEDIA_ROUTER_FEEDBACK_ADDITIONAL_COMMENTS}, + {"allowContactByEmail", IDS_MEDIA_ROUTER_FEEDBACK_ALLOW_CONTACT_BY_EMAIL}, {"audioAcceptable", IDS_MEDIA_ROUTER_FEEDBACK_AUDIO_ACCEPTABLE}, {"audioGood", IDS_MEDIA_ROUTER_FEEDBACK_AUDIO_GOOD}, {"audioPerfect", IDS_MEDIA_ROUTER_FEEDBACK_AUDIO_PERFECT}, @@ -105,6 +105,7 @@ CastFeedbackUI::CastFeedbackUI(content::WebUI* web_ui) {"videoUnwatchable", IDS_MEDIA_ROUTER_FEEDBACK_VIDEO_UNWATCHABLE}, {"yes", IDS_MEDIA_ROUTER_FEEDBACK_YES}, {"yourAnswer", IDS_MEDIA_ROUTER_FEEDBACK_YOUR_ANSWER}, + {"yourEmailAddress", IDS_MEDIA_ROUTER_FEEDBACK_YOUR_EMAIL_ADDRESS}, }; source->AddLocalizedStrings(kStrings); source->AddString(