Commit 7689ba95 authored by Tim Song's avatar Tim Song Committed by Commit Bot

Ash Tray: Update Do not disturb mode button tooltip to include state.

The updated tooltip will include "Do not disturb is {on/off}", making it more
consistent with the other tooltip buttons.

BUG=1002471

Change-Id: I2cb41dc89aa1bf133dd77640340cc0c140a8b96a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1795306Reviewed-by: default avatarAhmed Mehfooz <amehfooz@chromium.org>
Commit-Queue: Tim Song <tengs@chromium.org>
Cr-Commit-Position: refs/heads/master@{#695808}
parent 308727d1
...@@ -583,7 +583,13 @@ This file contains the strings for ash. ...@@ -583,7 +583,13 @@ This file contains the strings for ash.
Notifications Notifications
</message> </message>
<message name="IDS_ASH_STATUS_TRAY_NOTIFICATIONS_TOGGLE_TOOLTIP" desc="The tooltip text of the button that toggles Do-not-disturb state for notifications"> <message name="IDS_ASH_STATUS_TRAY_NOTIFICATIONS_TOGGLE_TOOLTIP" desc="The tooltip text of the button that toggles Do-not-disturb state for notifications">
Toggle Do not disturb Toggle Do not disturb. <ph name="STATE_TEXT">$1<ex>Do not disturb is on.</ex></ph>
</message>
<message name="IDS_ASH_STATUS_TRAY_NOTIFICATIONS_DO_NOT_DISTURB_ON_STATE" desc="The tooltip text indicating that Do-not-disturb mode is on.">
Do not disturb is on.
</message>
<message name="IDS_ASH_STATUS_TRAY_NOTIFICATIONS_DO_NOT_DISTURB_OFF_STATE" desc="The tooltip text indicating that Do-not-disturb mode is off.">
Do not disturb is off.
</message> </message>
<message name="IDS_ASH_STATUS_TRAY_NOTIFICATIONS_SETTINGS_ON_TOOLTIP" desc="The tooltip text of the button that shows notification settings. Used when all notifications are enabled."> <message name="IDS_ASH_STATUS_TRAY_NOTIFICATIONS_SETTINGS_ON_TOOLTIP" desc="The tooltip text of the button that shows notification settings. Used when all notifications are enabled.">
Show notification settings. Notifications are on Show notification settings. Notifications are on
......
...@@ -41,8 +41,9 @@ FeaturePodButton* QuietModeFeaturePodController::CreateButton() { ...@@ -41,8 +41,9 @@ FeaturePodButton* QuietModeFeaturePodController::CreateButton() {
!Shell::Get()->session_controller()->IsScreenLocked()); !Shell::Get()->session_controller()->IsScreenLocked());
button_->SetLabel( button_->SetLabel(
l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_NOTIFICATIONS_LABEL)); l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_NOTIFICATIONS_LABEL));
button_->SetIconTooltip(l10n_util::GetStringUTF16( button_->SetIconTooltip(l10n_util::GetStringFUTF16(
IDS_ASH_STATUS_TRAY_NOTIFICATIONS_TOGGLE_TOOLTIP)); IDS_ASH_STATUS_TRAY_NOTIFICATIONS_TOGGLE_TOOLTIP,
GetQuietModeStateTooltip()));
button_->ShowDetailedViewArrow(); button_->ShowDetailedViewArrow();
NotifierSettingsController::Get()->AddNotifierSettingsObserver(this); NotifierSettingsController::Get()->AddNotifierSettingsObserver(this);
OnQuietModeChanged(MessageCenter::Get()->IsQuietMode()); OnQuietModeChanged(MessageCenter::Get()->IsQuietMode());
...@@ -72,6 +73,9 @@ SystemTrayItemUmaType QuietModeFeaturePodController::GetUmaType() const { ...@@ -72,6 +73,9 @@ SystemTrayItemUmaType QuietModeFeaturePodController::GetUmaType() const {
void QuietModeFeaturePodController::OnQuietModeChanged(bool in_quiet_mode) { void QuietModeFeaturePodController::OnQuietModeChanged(bool in_quiet_mode) {
button_->SetToggled(in_quiet_mode); button_->SetToggled(in_quiet_mode);
button_->SetIconTooltip(l10n_util::GetStringFUTF16(
IDS_ASH_STATUS_TRAY_NOTIFICATIONS_TOGGLE_TOOLTIP,
GetQuietModeStateTooltip()));
if (in_quiet_mode) { if (in_quiet_mode) {
button_->SetSubLabel(l10n_util::GetStringUTF16( button_->SetSubLabel(l10n_util::GetStringUTF16(
...@@ -109,4 +113,11 @@ void QuietModeFeaturePodController::OnNotifiersUpdated( ...@@ -109,4 +113,11 @@ void QuietModeFeaturePodController::OnNotifiersUpdated(
} }
} }
base::string16 QuietModeFeaturePodController::GetQuietModeStateTooltip() {
return l10n_util::GetStringUTF16(
MessageCenter::Get()->IsQuietMode()
? IDS_ASH_STATUS_TRAY_NOTIFICATIONS_DO_NOT_DISTURB_ON_STATE
: IDS_ASH_STATUS_TRAY_NOTIFICATIONS_DO_NOT_DISTURB_OFF_STATE);
}
} // namespace ash } // namespace ash
...@@ -42,6 +42,8 @@ class ASH_EXPORT QuietModeFeaturePodController ...@@ -42,6 +42,8 @@ class ASH_EXPORT QuietModeFeaturePodController
const std::vector<NotifierMetadata>& notifiers) override; const std::vector<NotifierMetadata>& notifiers) override;
private: private:
base::string16 GetQuietModeStateTooltip();
UnifiedSystemTrayController* const tray_controller_; UnifiedSystemTrayController* const tray_controller_;
FeaturePodButton* button_ = nullptr; FeaturePodButton* button_ = nullptr;
......
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