Index: chrome/common/time_format.cc |
diff --git a/chrome/common/time_format.cc b/chrome/common/time_format.cc |
index 233090417abb340fd67b262582037d4334a0c6a2..13554d3d735862cd9bba6c87a4c25d909cfc50b8 100644 |
--- a/chrome/common/time_format.cc |
+++ b/chrome/common/time_format.cc |
@@ -79,6 +79,29 @@ static const MessageIDs kTimeRemainingMessageIDs = { { |
} |
} }; |
+static const MessageIDs kTimeRemainingLongMessageIDs = { { |
+ { |
+ IDS_TIME_REMAINING_SECS_DEFAULT, IDS_TIME_REMAINING_SEC_SINGULAR, |
+ IDS_TIME_REMAINING_SECS_ZERO, IDS_TIME_REMAINING_SECS_TWO, |
+ IDS_TIME_REMAINING_SECS_FEW, IDS_TIME_REMAINING_SECS_MANY |
+ }, |
+ { |
+ IDS_TIME_REMAINING_LONG_MINS_DEFAULT, IDS_TIME_REMAINING_LONG_MIN_SINGULAR, |
+ IDS_TIME_REMAINING_LONG_MINS_ZERO, IDS_TIME_REMAINING_LONG_MINS_TWO, |
+ IDS_TIME_REMAINING_LONG_MINS_FEW, IDS_TIME_REMAINING_LONG_MINS_MANY |
+ }, |
+ { |
+ IDS_TIME_REMAINING_HOURS_DEFAULT, IDS_TIME_REMAINING_HOUR_SINGULAR, |
+ IDS_TIME_REMAINING_HOURS_ZERO, IDS_TIME_REMAINING_HOURS_TWO, |
+ IDS_TIME_REMAINING_HOURS_FEW, IDS_TIME_REMAINING_HOURS_MANY |
+ }, |
+ { |
+ IDS_TIME_REMAINING_DAYS_DEFAULT, IDS_TIME_REMAINING_DAY_SINGULAR, |
+ IDS_TIME_REMAINING_DAYS_ZERO, IDS_TIME_REMAINING_DAYS_TWO, |
+ IDS_TIME_REMAINING_DAYS_FEW, IDS_TIME_REMAINING_DAYS_MANY |
+ } |
+} }; |
+ |
static const MessageIDs kTimeElapsedMessageIDs = { { |
{ |
IDS_TIME_ELAPSED_SECS_DEFAULT, IDS_TIME_ELAPSED_SEC_SINGULAR, |
@@ -106,6 +129,7 @@ static const MessageIDs kTimeElapsedMessageIDs = { { |
enum FormatType { |
FORMAT_SHORT, |
FORMAT_REMAINING, |
+ FORMAT_REMAINING_LONG, |
FORMAT_ELAPSED, |
}; |
@@ -119,6 +143,8 @@ class TimeFormatter { |
return short_formatter_; |
case FORMAT_REMAINING: |
return time_left_formatter_; |
+ case FORMAT_REMAINING_LONG: |
+ return time_left_long_formatter_; |
case FORMAT_ELAPSED: |
return time_elapsed_formatter_; |
default: |
@@ -133,6 +159,8 @@ class TimeFormatter { |
return kTimeShortMessageIDs; |
case FORMAT_REMAINING: |
return kTimeRemainingMessageIDs; |
+ case FORMAT_REMAINING_LONG: |
+ return kTimeRemainingLongMessageIDs; |
case FORMAT_ELAPSED: |
return kTimeElapsedMessageIDs; |
default: |
@@ -146,6 +174,7 @@ class TimeFormatter { |
case FORMAT_SHORT: |
return kFallbackFormatSuffixShort; |
case FORMAT_REMAINING: |
+ case FORMAT_REMAINING_LONG: |
return kFallbackFormatSuffixLeft; |
case FORMAT_ELAPSED: |
return kFallbackFormatSuffixAgo; |
@@ -158,6 +187,7 @@ class TimeFormatter { |
TimeFormatter() { |
BuildFormats(FORMAT_SHORT, &short_formatter_); |
BuildFormats(FORMAT_REMAINING, &time_left_formatter_); |
+ BuildFormats(FORMAT_REMAINING_LONG, &time_left_long_formatter_); |
BuildFormats(FORMAT_ELAPSED, &time_elapsed_formatter_); |
} |
~TimeFormatter() { |
@@ -165,6 +195,8 @@ class TimeFormatter { |
short_formatter_.end()); |
STLDeleteContainerPointers(time_left_formatter_.begin(), |
time_left_formatter_.end()); |
+ STLDeleteContainerPointers(time_left_long_formatter_.begin(), |
+ time_left_long_formatter_.end()); |
STLDeleteContainerPointers(time_elapsed_formatter_.begin(), |
time_elapsed_formatter_.end()); |
} |
@@ -172,6 +204,7 @@ class TimeFormatter { |
std::vector<icu::PluralFormat*> short_formatter_; |
std::vector<icu::PluralFormat*> time_left_formatter_; |
+ std::vector<icu::PluralFormat*> time_left_long_formatter_; |
std::vector<icu::PluralFormat*> time_elapsed_formatter_; |
static void BuildFormats(FormatType format_type, |
std::vector<icu::PluralFormat*>* time_formats); |
@@ -315,6 +348,11 @@ string16 TimeFormat::TimeRemaining(const TimeDelta& delta) { |
} |
// static |
+string16 TimeFormat::TimeRemainingLong(const TimeDelta& delta) { |
+ return FormatTimeImpl(delta, FORMAT_REMAINING_LONG); |
+} |
+ |
+// static |
string16 TimeFormat::TimeRemainingShort(const TimeDelta& delta) { |
return FormatTimeImpl(delta, FORMAT_SHORT); |
} |