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

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

Issue 2734883003: base: Make TimeDurationFormat* report failures. (Closed)
Patch Set: log locale 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
« no previous file with comments | « no previous file | ash/common/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/common/system/chromeos/power/battery_notification.cc
diff --git a/ash/common/system/chromeos/power/battery_notification.cc b/ash/common/system/chromeos/power/battery_notification.cc
index 23395ff2a312c8c2930f8ca705fb7abf6e6a5402..e817a6bcf368b70c0a3e0f5349da5950a26e0e68 100644
--- a/ash/common/system/chromeos/power/battery_notification.cc
+++ b/ash/common/system/chromeos/power/battery_notification.cc
@@ -62,9 +62,11 @@ std::unique_ptr<Notification> CreateNotification(
} else if (PowerStatus::ShouldDisplayBatteryTime(time) &&
!status.IsBatteryDischargingOnLinePower()) {
if (status.IsBatteryCharging()) {
+ base::string16 duration;
+ if (!TimeDurationFormat(time, base::DURATION_WIDTH_NARROW, &duration))
+ LOG(ERROR) << "Failed to format duration " << time.ToInternalValue();
time_message = l10n_util::GetStringFUTF16(
- IDS_ASH_STATUS_TRAY_BATTERY_TIME_UNTIL_FULL,
- TimeDurationFormat(time, base::DURATION_WIDTH_NARROW));
+ IDS_ASH_STATUS_TRAY_BATTERY_TIME_UNTIL_FULL, duration);
} else {
// This is a low battery warning prompting the user in minutes.
time_message = ui::TimeFormat::Simple(ui::TimeFormat::FORMAT_REMAINING,
« no previous file with comments | « no previous file | ash/common/system/chromeos/power/power_status_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698