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/memory/scoped_vector.h" | 12 #include "base/memory/scoped_vector.h" |
13 #include "base/stl_util.h" | 13 #include "base/stl_util.h" |
14 #include "base/strings/string16.h" | 14 #include "base/strings/string16.h" |
15 #include "base/strings/utf_string_conversions.h" | 15 #include "base/strings/utf_string_conversions.h" |
16 #include "base/time/time.h" | 16 #include "base/time/time.h" |
17 #include "grit/generated_resources.h" | 17 #include "grit/generated_resources.h" |
18 #include "third_party/icu/public/common/unicode/locid.h" | 18 #include "third_party/icu/source/common/unicode/locid.h" |
19 #include "third_party/icu/public/i18n/unicode/datefmt.h" | 19 #include "third_party/icu/source/i18n/unicode/datefmt.h" |
20 #include "third_party/icu/public/i18n/unicode/plurfmt.h" | 20 #include "third_party/icu/source/i18n/unicode/plurfmt.h" |
21 #include "third_party/icu/public/i18n/unicode/plurrule.h" | 21 #include "third_party/icu/source/i18n/unicode/plurrule.h" |
22 #include "third_party/icu/public/i18n/unicode/smpdtfmt.h" | 22 #include "third_party/icu/source/i18n/unicode/smpdtfmt.h" |
23 #include "ui/base/l10n/l10n_util.h" | 23 #include "ui/base/l10n/l10n_util.h" |
24 | 24 |
25 using base::Time; | 25 using base::Time; |
26 using base::TimeDelta; | 26 using base::TimeDelta; |
27 | 27 |
28 namespace { | 28 namespace { |
29 | 29 |
30 static const char kFallbackFormatSuffixShort[] = "}"; | 30 static const char kFallbackFormatSuffixShort[] = "}"; |
31 static const char kFallbackFormatSuffixLeft[] = " left}"; | 31 static const char kFallbackFormatSuffixLeft[] = " left}"; |
32 static const char kFallbackFormatSuffixAgo[] = " ago}"; | 32 static const char kFallbackFormatSuffixAgo[] = " ago}"; |
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
395 Time tomorrow = midnight_today + day; | 395 Time tomorrow = midnight_today + day; |
396 Time yesterday = midnight_today - day; | 396 Time yesterday = midnight_today - day; |
397 if (time >= tomorrow) | 397 if (time >= tomorrow) |
398 return string16(); | 398 return string16(); |
399 else if (time >= midnight_today) | 399 else if (time >= midnight_today) |
400 return l10n_util::GetStringUTF16(IDS_PAST_TIME_TODAY); | 400 return l10n_util::GetStringUTF16(IDS_PAST_TIME_TODAY); |
401 else if (time >= yesterday) | 401 else if (time >= yesterday) |
402 return l10n_util::GetStringUTF16(IDS_PAST_TIME_YESTERDAY); | 402 return l10n_util::GetStringUTF16(IDS_PAST_TIME_YESTERDAY); |
403 return string16(); | 403 return string16(); |
404 } | 404 } |
OLD | NEW |