0

dark_mode: AUTO status string in system tray

Bug: 1307977
Test: Manual
Change-Id: Iac389fdf3379b9c03f0409c639da60336cfcd134
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3542433
Reviewed-by: Ahmed Mehfooz <amehfooz@chromium.org>
Commit-Queue: Cattalyya Nuengsigkapian <cattalyya@chromium.org>
Cr-Commit-Position: refs/heads/main@{#987184}
This commit is contained in:
Cattalyya Nuengsigkapian
2022-03-30 21:07:45 +00:00
committed by Chromium LUCI CQ
parent e4c6b5ccb7
commit 8c3d591f15
4 changed files with 19 additions and 3 deletions

@ -453,6 +453,12 @@ This file contains the strings for ash.
<message name="IDS_ASH_STATUS_TRAY_DARK_THEME_ON_STATE" desc="Button label for the Dark theme feature." meaning="Dark theme feature is on. [CHAR_LIMIT=14]">
On
</message>
<message name="IDS_ASH_STATUS_TRAY_DARK_THEME_ON_STATE_AUTO_SCHEDULED" desc="Button label for the Dark theme feature when auto scheduling is enabled." meaning="Dark mode is automatically scheduled to be on until sunrise. [CHAR_LIMIT=16]">
On until sunrise
</message>
<message name="IDS_ASH_STATUS_TRAY_DARK_THEME_OFF_STATE_AUTO_SCHEDULED" desc="Button label for the Dark theme feature when auto scheduling is enabled." meaning="Dark mode is automatically scheduled to be off until sunset. [CHAR_LIMIT=16]">
Off until sunset
</message>
<message name="IDS_ASH_STATUS_TRAY_CAST_CAST_DESKTOP_ACCESSIBILITY_STOP" desc="Stop button accessibility label used in the tray popup to tell the user to stop a cast to the desktop.">
Stop casting screen to <ph name="RECEIVER_NAME">$1<ex>Living Room</ex></ph>
</message>

@ -0,0 +1 @@
bdf636dc9512d2d9873945b213c03bebabf5a41c

@ -0,0 +1 @@
0c768a66fe0ee51cd9c80abcb8fbed79f03b4bd6

@ -10,6 +10,7 @@
#include "ash/shell.h"
#include "ash/strings/grit/ash_strings.h"
#include "ash/style/ash_color_provider.h"
#include "ash/style/dark_mode_controller.h"
#include "ash/system/model/system_tray_model.h"
#include "ash/system/tray/tray_popup_utils.h"
#include "ash/system/unified/feature_pod_button.h"
@ -68,9 +69,16 @@ void DarkModeFeaturePodController::OnColorModeChanged(bool dark_mode_enabled) {
void DarkModeFeaturePodController::UpdateButton(bool dark_mode_enabled) {
button_->SetToggled(dark_mode_enabled);
button_->SetSubLabel(l10n_util::GetStringUTF16(
dark_mode_enabled ? IDS_ASH_STATUS_TRAY_DARK_THEME_ON_STATE
: IDS_ASH_STATUS_TRAY_DARK_THEME_OFF_STATE));
if (ash::Shell::Get()->dark_mode_controller()->GetAutoScheduleEnabled()) {
button_->SetSubLabel(l10n_util::GetStringUTF16(
dark_mode_enabled
? IDS_ASH_STATUS_TRAY_DARK_THEME_ON_STATE_AUTO_SCHEDULED
: IDS_ASH_STATUS_TRAY_DARK_THEME_OFF_STATE_AUTO_SCHEDULED));
} else {
button_->SetSubLabel(l10n_util::GetStringUTF16(
dark_mode_enabled ? IDS_ASH_STATUS_TRAY_DARK_THEME_ON_STATE
: IDS_ASH_STATUS_TRAY_DARK_THEME_OFF_STATE));
}
std::u16string tooltip_state = l10n_util::GetStringUTF16(
dark_mode_enabled