| 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 "ui/base/l10n/time_format.h" | 5 #include "ui/base/l10n/time_format.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 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/strings/string_util.h" | 11 #include "base/strings/string_util.h" |
| 12 #include "base/time/time.h" | 12 #include "base/time/time.h" |
| 13 #include "third_party/icu/source/common/unicode/unistr.h" | 13 #include "third_party/icu/source/common/unicode/unistr.h" |
| 14 #include "ui/base/l10n/formatter.h" | 14 #include "ui/base/l10n/formatter.h" |
| 15 #include "ui/base/l10n/l10n_util.h" | 15 #include "ui/base/l10n/l10n_util.h" |
| 16 #include "ui/base/ui_base_export.h" | 16 #include "ui/base/ui_base_export.h" |
| 17 #include "ui/strings/grit/ui_strings.h" | 17 #include "ui/strings/grit/ui_strings.h" |
| 18 | 18 |
| 19 using base::Time; | 19 using base::Time; |
| 20 using base::TimeDelta; | 20 using base::TimeDelta; |
| 21 using ui::TimeFormat; | 21 using ui::TimeFormat; |
| 22 | 22 |
| 23 namespace ui { | 23 namespace ui { |
| 24 | 24 |
| 25 UI_BASE_EXPORT base::LazyInstance<FormatterContainer> g_container = | 25 UI_BASE_EXPORT base::LazyInstance<FormatterContainer>::DestructorAtExit |
| 26 LAZY_INSTANCE_INITIALIZER; | 26 g_container = LAZY_INSTANCE_INITIALIZER; |
| 27 | 27 |
| 28 // static | 28 // static |
| 29 base::string16 TimeFormat::Simple(TimeFormat::Format format, | 29 base::string16 TimeFormat::Simple(TimeFormat::Format format, |
| 30 TimeFormat::Length length, | 30 TimeFormat::Length length, |
| 31 const base::TimeDelta& delta) { | 31 const base::TimeDelta& delta) { |
| 32 return Detailed(format, length, 0, delta); | 32 return Detailed(format, length, 0, delta); |
| 33 } | 33 } |
| 34 | 34 |
| 35 // static | 35 // static |
| 36 base::string16 TimeFormat::Detailed(TimeFormat::Format format, | 36 base::string16 TimeFormat::Detailed(TimeFormat::Format format, |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 if (time >= tomorrow) | 127 if (time >= tomorrow) |
| 128 return base::string16(); | 128 return base::string16(); |
| 129 else if (time >= midnight_today) | 129 else if (time >= midnight_today) |
| 130 return l10n_util::GetStringUTF16(IDS_PAST_TIME_TODAY); | 130 return l10n_util::GetStringUTF16(IDS_PAST_TIME_TODAY); |
| 131 else if (time >= yesterday) | 131 else if (time >= yesterday) |
| 132 return l10n_util::GetStringUTF16(IDS_PAST_TIME_YESTERDAY); | 132 return l10n_util::GetStringUTF16(IDS_PAST_TIME_YESTERDAY); |
| 133 return base::string16(); | 133 return base::string16(); |
| 134 } | 134 } |
| 135 | 135 |
| 136 } // namespace ui | 136 } // namespace ui |
| OLD | NEW |