OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef IOS_CHROME_BROWSER_UI_HISTORY_HISTORY_ENTRY_H_ |
| 6 #define IOS_CHROME_BROWSER_UI_HISTORY_HISTORY_ENTRY_H_ |
| 7 |
| 8 #include <set> |
| 9 #include <string> |
| 10 |
| 11 #include "base/strings/string16.h" |
| 12 #include "base/time/time.h" |
| 13 #include "url/gurl.h" |
| 14 |
| 15 namespace history { |
| 16 |
| 17 // Represents a history entry to be shown to the user, representing either |
| 18 // a local or remote visit. A single entry can represent multiple visits, |
| 19 // since only the most recent visit on a particular day is shown. |
| 20 struct HistoryEntry { |
| 21 // Values indicating whether an entry represents only local visits, only |
| 22 // remote visits, or a mixture of both. |
| 23 enum EntryType { EMPTY_ENTRY = 0, LOCAL_ENTRY, REMOTE_ENTRY, COMBINED_ENTRY }; |
| 24 |
| 25 HistoryEntry(EntryType type, |
| 26 const GURL& url, |
| 27 const base::string16& title, |
| 28 base::Time time, |
| 29 const std::string& client_id, |
| 30 bool is_search_result, |
| 31 const base::string16& snippet, |
| 32 bool blocked_visit); |
| 33 HistoryEntry(); |
| 34 HistoryEntry(const HistoryEntry&); |
| 35 ~HistoryEntry(); |
| 36 |
| 37 // Comparison function for sorting HistoryEntries from newest to oldest. |
| 38 static bool SortByTimeDescending(const HistoryEntry& entry1, |
| 39 const HistoryEntry& entry2); |
| 40 |
| 41 // The type of visits this entry represents: local, remote, or both. |
| 42 EntryType entry_type; |
| 43 |
| 44 // URL of the entry. |
| 45 GURL url; |
| 46 |
| 47 // Title of the entry. May be empty. |
| 48 base::string16 title; |
| 49 |
| 50 // Time of the entry. Usually this will be the time of the most recent |
| 51 // visit to |url| on a particular day as defined in the local timezone. |
| 52 base::Time time; |
| 53 |
| 54 // Sync ID of the client on which the most recent visit occurred. |
| 55 std::string client_id; |
| 56 |
| 57 // Timestamps of all local or remote visits to the same URL on the same day. |
| 58 std::set<int64_t> all_timestamps; |
| 59 |
| 60 // If true, this entry is a history query result. |
| 61 bool is_search_result; |
| 62 |
| 63 // The entry's search snippet, if this entry is a history query result. |
| 64 base::string16 snippet; |
| 65 |
| 66 // Whether this entry was blocked when it was attempted. |
| 67 bool blocked_visit; |
| 68 }; |
| 69 } // namespace history |
| 70 |
| 71 #endif // IOS_CHROME_BROWSER_UI_HISTORY_HISTORY_ENTRY_H_ |
OLD | NEW |