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

Unified Diff: ash/system/chromeos/power/power_status.cc

Issue 147443007: Add support for localized time strings with two units, eg. "2 hours 17 minutes" (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address Tony's comments Created 6 years, 10 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
« no previous file with comments | « ash/display/resolution_notification_controller.cc ('k') | ash/system/chromeos/power/power_status_view.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/system/chromeos/power/power_status.cc
diff --git a/ash/system/chromeos/power/power_status.cc b/ash/system/chromeos/power/power_status.cc
index 24d29d68b68a45797b09804e3dadcda2d08c5f67..68cdf1a5574bf6709a89861c647ea1cc6b5b38e0 100644
--- a/ash/system/chromeos/power/power_status.cc
+++ b/ash/system/chromeos/power/power_status.cc
@@ -48,15 +48,23 @@ void SanitizeProto(power_manager::PowerSupplyProperties* proto) {
base::string16 GetBatteryTimeAccessibilityString(int hour, int min) {
DCHECK(hour || min);
if (hour && !min) {
- return ui::TimeFormat::TimeDurationLong(base::TimeDelta::FromHours(hour));
+ return ui::TimeFormat::Simple(ui::TimeFormat::FORMAT_DURATION,
+ ui::TimeFormat::LENGTH_LONG,
+ base::TimeDelta::FromHours(hour));
}
if (min && !hour) {
- return ui::TimeFormat::TimeDurationLong(base::TimeDelta::FromMinutes(min));
+ return ui::TimeFormat::Simple(ui::TimeFormat::FORMAT_DURATION,
+ ui::TimeFormat::LENGTH_LONG,
+ base::TimeDelta::FromMinutes(min));
}
return l10n_util::GetStringFUTF16(
IDS_ASH_STATUS_TRAY_BATTERY_TIME_ACCESSIBLE,
- ui::TimeFormat::TimeDurationLong(base::TimeDelta::FromHours(hour)),
- ui::TimeFormat::TimeDurationLong(base::TimeDelta::FromMinutes(min)));
+ ui::TimeFormat::Simple(ui::TimeFormat::FORMAT_DURATION,
+ ui::TimeFormat::LENGTH_LONG,
+ base::TimeDelta::FromHours(hour)),
+ ui::TimeFormat::Simple(ui::TimeFormat::FORMAT_DURATION,
+ ui::TimeFormat::LENGTH_LONG,
+ base::TimeDelta::FromMinutes(min)));
}
static PowerStatus* g_power_status = NULL;
« no previous file with comments | « ash/display/resolution_notification_controller.cc ('k') | ash/system/chromeos/power/power_status_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698