0

[Privacy Hub] Fixes the microphone notification text

The original was ALL CAPS, we are changing the test to be in line with
the Privacy Hub spec.

Bug: b/254907853
Change-Id: I0fa90fe05fcbf1f7a0beb36b2970c7470df0d601
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4004623
Reviewed-by: Alex Newcomer <newcomer@chromium.org>
Auto-Submit: Jan Láník <janlanik@google.com>
Commit-Queue: Jan Láník <janlanik@google.com>
Cr-Commit-Position: refs/heads/main@{#1068143}
This commit is contained in:
Jan Lanik
2022-11-07 16:48:29 +00:00
committed by Chromium LUCI CQ
parent 2534661b26
commit de7434c1e0
8 changed files with 32 additions and 29 deletions

@ -4490,16 +4490,16 @@ Here are some things you can try to get started.
<!-- Strings for microphone mute switch notification -->
<message name="IDS_MICROPHONE_MUTED_NOTIFICATION_TITLE" desc="Title for a notification shown to the users when an app tries to use the microphone while the microphone is muted.i Similar to IDS_MICROPHONE_MUTED_NOTIFICATION_TITLE_WITH_APP_NAME, except this message contains a generic app name string. Used when the name of the app that's using the microphone cannot be determined.">
An app wants to use the microphone
</message>
<message name="IDS_MICROPHONE_MUTED_NOTIFICATION_TITLE_WITH_APP_NAME" desc="Title for a notification shown to the users when an app tries to use the microphone while the microphone is muted. Similar to IDS_MICROPHONE_MUTED_NOTIFICATION_TITLE, except this message has a placeholder for the app name.">
<ph name="APP_NAME">$1<ex>Parallels Desktop</ex></ph> wants to use the microphone
Turn on microphone access?
</message>
<message name="IDS_MICROPHONE_MUTED_NOTIFICATION_MESSAGE" desc="Message for a notification shown to the users when an app tries to use the microphone while the microphone is muted.">
Your microphone is currently turned off
Allows microphone access for all apps and websites with the microphone permission
</message>
<message name="IDS_MICROPHONE_MUTED_NOTIFICATION_MESSAGE_WITH_APP_NAME" desc="Message for a notification shown to the users when an app tries to use the microphone while the microphone is muted.">
Allows microphone access for <ph name="APP_NAME">$1<ex>Zoom</ex></ph> and all apps and websites with the microphone permission
</message>
<message name="IDS_MICROPHONE_MUTED_NOTIFICATION_ACTION_BUTTON" desc="Label for an action button in a notification shown to the users when an app tries to use the microphone while the microphone is muted. The button, when tapped unmutes the microphone.">
TURN ON MICROPHONE
Turn on microphone access
</message>
<message name="IDS_MICROPHONE_MUTE_SWITCH_ON_NOTIFICATION_MESSAGE" desc="Message for a notification shown to the users when an app tries to use the microphone while the microphone mute switch, which disables microphone input, is turned on.">
Your microphone is off. Turn on your devices microphone button.

@ -1 +1 @@
777aca20772bd4f34c2d34195625cc6e25155680
a3f5dd22925b6f620dd7d349dcc8fea011dd9faa

@ -1 +1 @@
777aca20772bd4f34c2d34195625cc6e25155680
37d686b7a7166fe7d6563b34d37e93343f870236

@ -0,0 +1 @@
a3f5dd22925b6f620dd7d349dcc8fea011dd9faa

@ -1 +1 @@
2d3075f4126b4deeaa38a4b14073a57b66a2d950
a3f5dd22925b6f620dd7d349dcc8fea011dd9faa

@ -1 +0,0 @@
777aca20772bd4f34c2d34195625cc6e25155680

@ -134,7 +134,7 @@ MicrophoneMuteNotificationController::GenerateMicrophoneMuteNotification(
std::unique_ptr<message_center::Notification> notification =
CreateSystemNotification(
message_center::NOTIFICATION_TYPE_SIMPLE, kNotificationId,
GetNotificationTitle(app_name), GetNotificationMessage(),
GetNotificationTitle(), GetNotificationMessage(app_name),
/*display_source=*/std::u16string(), GURL(),
message_center::NotifierId(
message_center::NotifierType::SYSTEM_COMPONENT, kNotificationId,
@ -144,23 +144,23 @@ MicrophoneMuteNotificationController::GenerateMicrophoneMuteNotification(
return notification;
}
std::u16string MicrophoneMuteNotificationController::GetNotificationMessage()
const {
return mic_muted_by_mute_switch_
? l10n_util::GetStringUTF16(
IDS_MICROPHONE_MUTE_SWITCH_ON_NOTIFICATION_MESSAGE)
: l10n_util::GetStringUTF16(
IDS_MICROPHONE_MUTED_NOTIFICATION_MESSAGE);
std::u16string MicrophoneMuteNotificationController::GetNotificationMessage(
const absl::optional<std::u16string>& app_name) const {
if (mic_muted_by_mute_switch_) {
return l10n_util::GetStringUTF16(
IDS_MICROPHONE_MUTE_SWITCH_ON_NOTIFICATION_MESSAGE);
}
if (app_name.value_or(u"").empty()) {
return l10n_util::GetStringUTF16(IDS_MICROPHONE_MUTED_NOTIFICATION_MESSAGE);
}
return l10n_util::GetStringFUTF16(
IDS_MICROPHONE_MUTED_NOTIFICATION_MESSAGE_WITH_APP_NAME,
app_name.value());
}
std::u16string MicrophoneMuteNotificationController::GetNotificationTitle(
const absl::optional<std::u16string>& app_name) const {
return !app_name.value_or(u"").empty()
? l10n_util::GetStringFUTF16(
IDS_MICROPHONE_MUTED_NOTIFICATION_TITLE_WITH_APP_NAME,
app_name.value())
: l10n_util::GetStringUTF16(
IDS_MICROPHONE_MUTED_NOTIFICATION_TITLE);
std::u16string MicrophoneMuteNotificationController::GetNotificationTitle()
const {
return l10n_util::GetStringUTF16(IDS_MICROPHONE_MUTED_NOTIFICATION_TITLE);
}
void MicrophoneMuteNotificationController::RemoveMicrophoneMuteNotification() {

@ -57,11 +57,14 @@ class ASH_EXPORT MicrophoneMuteNotificationController
message_center::NotificationPriority priority);
// Mic mute notification title.
std::u16string GetNotificationTitle(
const absl::optional<std::u16string>& app_name) const;
std::u16string GetNotificationTitle() const;
// Mic mute notification body.
std::u16string GetNotificationMessage() const;
// If the name of the app is provided via \p app_name, it may be used in the
// notification body. If the name is empty, a generic text that avoids
// refering to the app by name will be used.
std::u16string GetNotificationMessage(
const absl::optional<std::u16string>& app_name) const;
// Takes down the mic mute notification.
void RemoveMicrophoneMuteNotification();