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

Unified Diff: ash/common/system/chromeos/power/power_status_view.cc

Issue 2734883003: base: Make TimeDurationFormat* report failures. (Closed)
Patch Set: Created 3 years, 9 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/common/system/chromeos/power/power_status_view.cc
diff --git a/ash/common/system/chromeos/power/power_status_view.cc b/ash/common/system/chromeos/power/power_status_view.cc
index 0a0f5541e6af22e7c1aefd5462c6a1d6f8e05954..3e918b98496f4f9c1f728cc96a27d14a1732124a 100644
--- a/ash/common/system/chromeos/power/power_status_view.cc
+++ b/ash/common/system/chromeos/power/power_status_view.cc
@@ -124,11 +124,15 @@ void PowerStatusView::UpdateText() {
: status.GetBatteryTimeToEmpty();
if (PowerStatus::ShouldDisplayBatteryTime(time) &&
!status.IsBatteryDischargingOnLinePower()) {
+ base::string16 duration;
+ if (!base::TimeDurationFormat(time, base::DURATION_WIDTH_NUMERIC,
+ &duration))
+ LOG(ERROR) << "Failed to format duration " << time.ToInternalValue();
battery_time_status = l10n_util::GetStringFUTF16(
status.IsBatteryCharging()
? IDS_ASH_STATUS_TRAY_BATTERY_TIME_UNTIL_FULL_SHORT
: IDS_ASH_STATUS_TRAY_BATTERY_TIME_LEFT_SHORT,
- TimeDurationFormat(time, base::DURATION_WIDTH_NUMERIC));
+ duration);
}
}
}

Powered by Google App Engine
This is Rietveld 408576698