Skip to content

Commit

Permalink
[Cast feedback] Add a checkbox to indicate user permission to send email
Browse files Browse the repository at this point in the history
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 <mfoltz@chromium.org>
Commit-Queue: Takumi Fujimoto <takumif@chromium.org>
Cr-Commit-Position: refs/heads/main@{#990230}
  • Loading branch information
Takumi Fujimoto authored and Chromium LUCI CQ committed Apr 8, 2022
1 parent 953a237 commit 75b6d1b
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 13 deletions.
6 changes: 6 additions & 0 deletions chrome/app/media_router_strings.grdp
Expand Up @@ -205,6 +205,12 @@ video files, instead of all files.">
<message name="IDS_MEDIA_ROUTER_FEEDBACK_ADDITIONAL_COMMENTS" desc="Text for field in feedback form for other comments.">
Additional comments:
</message>
<message name="IDS_MEDIA_ROUTER_FEEDBACK_ALLOW_CONTACT_BY_EMAIL" desc="Label for a checkbox in a form indicating whether the user is permitting Google to contact them by email.">
We may email you for more information or updates
</message>
<message name="IDS_MEDIA_ROUTER_FEEDBACK_YOUR_EMAIL_ADDRESS" desc="Default text shown in a text input box for the user to enter their email address.">
Your email address
</message>
<message name="IDS_MEDIA_ROUTER_FEEDBACK_EMAIL_FIELD" desc="Text for the email field in the feedback form.">
Email (optional):
</message>
Expand Down
@@ -0,0 +1 @@
422d4718c9b17a88fb5da0e526d643ad925b5841
@@ -0,0 +1 @@
078ba16a641c05d2ae8d58a5b451cb8b9a12e0ab
20 changes: 16 additions & 4 deletions chrome/browser/resources/media_router/cast_feedback_ui.html
Expand Up @@ -22,6 +22,10 @@
line-height: 13px;
}

#allow-contact-by-email {
padding: 10px 0;
}

#feedback-confirmation {
width: initial;
}
Expand Down Expand Up @@ -103,7 +107,7 @@
color: var(--google-red-500);
}

.send-logs {
.checkbox-label {
font-size: 15px;
}

Expand Down Expand Up @@ -331,13 +335,21 @@
</template>
<div class="question">
<div class="h2">$i18n{emailField}</div>
<cr-input placeholder="$i18n{yourAnswer}"
<cr-checkbox checked="{{allowContactByEmail_}}"
aria-description="$i18n{allowContactByEmail}"
id="allow-contact-by-email">
<span class="checkbox-label">
$i18n{allowContactByEmail}
</span>
</cr-checkbox>
<cr-input placeholder="$i18n{yourEmailAddress}"
value="{{userEmail_}}"
type="text">
type="text"
disabled="[[!allowContactByEmail_]]">
</cr-input>
<cr-checkbox checked="{{attachLogs_}}"
aria-description="$i18n{sendLogs}">
<span class="send-logs">
<span class="checkbox-label" id="send-logs">
$i18nRaw{sendLogsHtml}
</span>
</cr-checkbox>
Expand Down
27 changes: 19 additions & 8 deletions chrome/browser/resources/media_router/cast_feedback_ui.js
Expand Up @@ -115,6 +115,12 @@ export class FeedbackUiElement extends PolymerElement {

static get properties() {
return {
/** @private */
allowContactByEmail_: {
type: Boolean,
value: false,
},

/** @private */
attachLogs_: {
type: Boolean,
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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_(),
Expand Down Expand Up @@ -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;
}

Expand Down
3 changes: 2 additions & 1 deletion chrome/browser/ui/webui/media_router/cast_feedback_ui.cc
Expand Up @@ -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},
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit 75b6d1b

Please sign in to comment.