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

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: removed old view before storing a new one 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..f4b706755e037812de64867d7449fb802b1de880 100644
--- a/ash/system/tray/system_tray.cc
+++ b/ash/system/tray/system_tray.cc
@@ -51,6 +51,7 @@
#include "ash/system/chromeos/network/tray_network.h"
#include "ash/system/chromeos/network/tray_sms.h"
#include "ash/system/chromeos/network/tray_vpn.h"
+#include "ash/system/chromeos/power/power_status.h"
#include "ash/system/chromeos/power/tray_power.h"
#include "ash/system/chromeos/rotation/tray_rotation_lock.h"
#include "ash/system/chromeos/screen_security/screen_capture_tray_item.h"
@@ -402,6 +403,16 @@ void SystemTray::DestroyNotificationBubble() {
}
}
+base::string16 SystemTray::GetAccessibleNameForTray() {
+ base::string16 time = GetAccessibleTimeString(base::Time::Now());
+ base::string16 battery = base::ASCIIToUTF16("");
+#if defined(OS_CHROMEOS)
+ battery = PowerStatus::Get()->GetAccessibleNameString(false);
+#endif
+ return l10n_util::GetStringFUTF16(
+ IDS_ASH_STATUS_TRAY_ACCESSIBLE_DESCRIPTION, time, battery);
+}
+
int SystemTray::GetTrayXOffset(SystemTrayItem* item) const {
// Don't attempt to align the arrow if the shelf is on the left or right.
if (shelf_alignment() != SHELF_ALIGNMENT_BOTTOM &&
@@ -588,6 +599,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(
+ now, hour_type, base::kKeepAmPm);
+}
+
void SystemTray::SetShelfAlignment(ShelfAlignment alignment) {
if (alignment == shelf_alignment())
return;
@@ -615,10 +634,6 @@ void SystemTray::AnchorUpdated() {
}
}
-base::string16 SystemTray::GetAccessibleNameForTray() {
- return l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_ACCESSIBLE_NAME);
-}
-
void SystemTray::BubbleResized(const TrayBubbleView* bubble_view) {
UpdateWebNotifications();
}
« no previous file with comments | « ash/system/tray/system_tray.h ('k') | chrome/browser/ui/views/accessibility/accessibility_event_router_views.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698