OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/common/time_format.h" | 5 #include "chrome/common/time_format.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "base/stl_util.h" | 12 #include "base/stl_util.h" |
13 #include "base/string16.h" | 13 #include "base/string16.h" |
14 #include "base/time.h" | 14 #include "base/time.h" |
15 #include "base/utf_string_conversions.h" | 15 #include "base/utf_string_conversions.h" |
16 #include "grit/generated_resources.h" | 16 #include "grit/generated_resources.h" |
| 17 #include "third_party/icu/public/common/unicode/locid.h" |
| 18 #include "third_party/icu/public/i18n/unicode/datefmt.h" |
| 19 #include "third_party/icu/public/i18n/unicode/plurfmt.h" |
| 20 #include "third_party/icu/public/i18n/unicode/plurrule.h" |
| 21 #include "third_party/icu/public/i18n/unicode/smpdtfmt.h" |
17 #include "ui/base/l10n/l10n_util.h" | 22 #include "ui/base/l10n/l10n_util.h" |
18 #include "unicode/datefmt.h" | |
19 #include "unicode/locid.h" | |
20 #include "unicode/plurfmt.h" | |
21 #include "unicode/plurrule.h" | |
22 #include "unicode/smpdtfmt.h" | |
23 | 23 |
24 using base::Time; | 24 using base::Time; |
25 using base::TimeDelta; | 25 using base::TimeDelta; |
26 | 26 |
27 namespace { | 27 namespace { |
28 | 28 |
29 static const char kFallbackFormatSuffixShort[] = "}"; | 29 static const char kFallbackFormatSuffixShort[] = "}"; |
30 static const char kFallbackFormatSuffixLeft[] = " left}"; | 30 static const char kFallbackFormatSuffixLeft[] = " left}"; |
31 static const char kFallbackFormatSuffixAgo[] = " ago}"; | 31 static const char kFallbackFormatSuffixAgo[] = " ago}"; |
32 | 32 |
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
404 Time tomorrow = midnight_today + day; | 404 Time tomorrow = midnight_today + day; |
405 Time yesterday = midnight_today - day; | 405 Time yesterday = midnight_today - day; |
406 if (time >= tomorrow) | 406 if (time >= tomorrow) |
407 return string16(); | 407 return string16(); |
408 else if (time >= midnight_today) | 408 else if (time >= midnight_today) |
409 return l10n_util::GetStringUTF16(IDS_PAST_TIME_TODAY); | 409 return l10n_util::GetStringUTF16(IDS_PAST_TIME_TODAY); |
410 else if (time >= yesterday) | 410 else if (time >= yesterday) |
411 return l10n_util::GetStringUTF16(IDS_PAST_TIME_YESTERDAY); | 411 return l10n_util::GetStringUTF16(IDS_PAST_TIME_YESTERDAY); |
412 return string16(); | 412 return string16(); |
413 } | 413 } |
OLD | NEW |