Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2242)

Unified Diff: ash/system/tray/system_tray.cc

Issue 380943002: Added battery level and time to the status tray's accessible name. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ash/system/tray/system_tray.cc
diff --git a/ash/system/tray/system_tray.cc b/ash/system/tray/system_tray.cc
index 5c6af2ce30da634886aa8cbdad624d3e1522a86f..bc3a377e1b93344a5dc55819d515dceaeae43cd7 100644
--- a/ash/system/tray/system_tray.cc
+++ b/ash/system/tray/system_tray.cc
@@ -588,6 +588,14 @@ void SystemTray::UpdateWebNotifications() {
status_area_widget()->web_notification_tray()->SetSystemTrayHeight(height);
}
+base::string16 SystemTray::GetAccessibleTimeString(
+ const base::Time& now) const {
+ base::HourClockType hour_type =
+ ash::Shell::GetInstance()->system_tray_delegate()->GetHourClockType();
+ return base::TimeFormatTimeOfDayWithHourClockType(
Peter Lundblad 2014/07/09 23:08:11 Just to make sure, can you try this with the setti
evy 2014/07/10 17:19:57 24 hour time is read very strange (oh nine. one on
+ now, hour_type, base::kKeepAmPm);
+}
+
void SystemTray::SetShelfAlignment(ShelfAlignment alignment) {
if (alignment == shelf_alignment())
return;
@@ -616,7 +624,13 @@ void SystemTray::AnchorUpdated() {
}
base::string16 SystemTray::GetAccessibleNameForTray() {
- return l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_ACCESSIBLE_NAME);
+ base::string16 name =
+ l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_ACCESSIBLE_NAME);
+ base::string16 time = GetAccessibleTimeString(base::Time::Now());
+ base::string16 battery = PowerStatus::Get()->GetShortAccessibleNameString();
+ return name + base::ASCIIToUTF16(". ") +
dmazzoni 2014/07/10 16:23:16 This is borderline, but this is usually the best p
evy 2014/07/10 17:19:57 Done.
+ time + base::ASCIIToUTF16(". ") +
+ battery;
}
void SystemTray::BubbleResized(const TrayBubbleView* bubble_view) {

Powered by Google App Engine
This is Rietveld 408576698