OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "ios/chrome/browser/ui/history/history_util.h" | 5 #include "ios/chrome/browser/ui/history/history_util.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 | 8 |
9 #include "base/i18n/time_formatting.h" | 9 #include "base/i18n/time_formatting.h" |
10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
11 #include "components/strings/grit/components_strings.h" | 11 #include "components/strings/grit/components_strings.h" |
12 #include "ios/chrome/browser/ui/history/history_entry.h" | 12 #include "ios/chrome/browser/ui/history/history_entry.h" |
13 #include "ui/base/l10n/l10n_util.h" | 13 #include "ui/base/l10n/l10n_util.h" |
14 #include "ui/base/l10n/time_format.h" | 14 #include "ui/base/l10n/time_format.h" |
15 #include "url/gurl.h" | 15 #include "url/gurl.h" |
16 | 16 |
| 17 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 18 #error "This file requires ARC support." |
| 19 #endif |
| 20 |
17 namespace history { | 21 namespace history { |
18 | 22 |
19 base::string16 GetRelativeDateLocalized(const base::Time& visit_time) { | 23 base::string16 GetRelativeDateLocalized(const base::Time& visit_time) { |
20 base::Time midnight = base::Time::Now().LocalMidnight(); | 24 base::Time midnight = base::Time::Now().LocalMidnight(); |
21 base::string16 date_str = ui::TimeFormat::RelativeDate(visit_time, &midnight); | 25 base::string16 date_str = ui::TimeFormat::RelativeDate(visit_time, &midnight); |
22 if (date_str.empty()) { | 26 if (date_str.empty()) { |
23 date_str = base::TimeFormatFriendlyDate(visit_time); | 27 date_str = base::TimeFormatFriendlyDate(visit_time); |
24 } else { | 28 } else { |
25 date_str = l10n_util::GetStringFUTF16( | 29 date_str = l10n_util::GetStringFUTF16( |
26 IDS_HISTORY_DATE_WITH_RELATIVE_TIME, date_str, | 30 IDS_HISTORY_DATE_WITH_RELATIVE_TIME, date_str, |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 entry.all_timestamps.end()); | 67 entry.all_timestamps.end()); |
64 | 68 |
65 if (combined_entry->entry_type != entry.entry_type) { | 69 if (combined_entry->entry_type != entry.entry_type) { |
66 combined_entry->entry_type = history::HistoryEntry::COMBINED_ENTRY; | 70 combined_entry->entry_type = history::HistoryEntry::COMBINED_ENTRY; |
67 } | 71 } |
68 } | 72 } |
69 } | 73 } |
70 entries->swap(new_entries); | 74 entries->swap(new_entries); |
71 } | 75 } |
72 } // namespace history | 76 } // namespace history |
OLD | NEW |