OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifndef CHROME_BROWSER_UI_WEBUI_HISTORY_UI_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_HISTORY_UI_H_ |
6 #define CHROME_BROWSER_UI_WEBUI_HISTORY_UI_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_HISTORY_UI_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 struct HistoryEntry { | 40 struct HistoryEntry { |
41 // Values indicating whether an entry represents only local visits, only | 41 // Values indicating whether an entry represents only local visits, only |
42 // remote visits, or a mixture of both. | 42 // remote visits, or a mixture of both. |
43 enum EntryType { | 43 enum EntryType { |
44 EMPTY_ENTRY = 0, | 44 EMPTY_ENTRY = 0, |
45 LOCAL_ENTRY, | 45 LOCAL_ENTRY, |
46 REMOTE_ENTRY, | 46 REMOTE_ENTRY, |
47 COMBINED_ENTRY | 47 COMBINED_ENTRY |
48 }; | 48 }; |
49 | 49 |
50 HistoryEntry(EntryType type, const GURL& url, const base::string16& title, | 50 HistoryEntry(EntryType type, const GURL& url, const base::string16& title, h
istory::HistoryContext context, |
51 base::Time time, const std::string& client_id, | 51 base::Time time, const std::string& client_id, |
52 bool is_search_result, const base::string16& snippet, | 52 bool is_search_result, const base::string16& snippet, |
53 bool blocked_visit, const std::string& accept_languages); | 53 bool blocked_visit, const std::string& accept_languages); |
54 HistoryEntry(); | 54 HistoryEntry(); |
55 virtual ~HistoryEntry(); | 55 virtual ~HistoryEntry(); |
56 | 56 |
57 // Formats this entry's URL and title and adds them to |result|. | 57 // Formats this entry's URL and title and adds them to |result|. |
58 void SetUrlAndTitle(base::DictionaryValue* result) const; | 58 void SetUrlAndTitle(base::DictionaryValue* result) const; |
59 | 59 |
60 // Converts the entry to a DictionaryValue to be owned by the caller. | 60 // Converts the entry to a DictionaryValue to be owned by the caller. |
61 scoped_ptr<base::DictionaryValue> ToValue( | 61 scoped_ptr<base::DictionaryValue> ToValue( |
62 bookmarks::BookmarkModel* bookmark_model, | 62 bookmarks::BookmarkModel* bookmark_model, |
63 SupervisedUserService* supervised_user_service, | 63 SupervisedUserService* supervised_user_service, |
64 const ProfileSyncService* sync_service) const; | 64 const ProfileSyncService* sync_service) const; |
65 | 65 |
66 // Comparison function for sorting HistoryEntries from newest to oldest. | 66 // Comparison function for sorting HistoryEntries from newest to oldest. |
67 static bool SortByTimeDescending( | 67 static bool SortByTimeDescending( |
68 const HistoryEntry& entry1, const HistoryEntry& entry2); | 68 const HistoryEntry& entry1, const HistoryEntry& entry2); |
69 | 69 |
70 // The type of visits this entry represents: local, remote, or both. | 70 // The type of visits this entry represents: local, remote, or both. |
71 EntryType entry_type; | 71 EntryType entry_type; |
72 | 72 |
73 GURL url; | 73 GURL url; |
74 base::string16 title; // Title of the entry. May be empty. | 74 base::string16 title; // Title of the entry. May be empty. |
| 75 history::HistoryContext context; |
75 | 76 |
76 // The time of the entry. Usually this will be the time of the most recent | 77 // The time of the entry. Usually this will be the time of the most recent |
77 // visit to |url| on a particular day as defined in the local timezone. | 78 // visit to |url| on a particular day as defined in the local timezone. |
78 base::Time time; | 79 base::Time time; |
79 | 80 |
80 // The sync ID of the client on which the most recent visit occurred. | 81 // The sync ID of the client on which the most recent visit occurred. |
81 std::string client_id; | 82 std::string client_id; |
82 | 83 |
83 // Timestamps of all local or remote visits the same URL on the same day. | 84 // Timestamps of all local or remote visits the same URL on the same day. |
84 std::set<int64> all_timestamps; | 85 std::set<int64> all_timestamps; |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 explicit HistoryUI(content::WebUI* web_ui); | 222 explicit HistoryUI(content::WebUI* web_ui); |
222 | 223 |
223 static base::RefCountedMemory* GetFaviconResourceBytes( | 224 static base::RefCountedMemory* GetFaviconResourceBytes( |
224 ui::ScaleFactor scale_factor); | 225 ui::ScaleFactor scale_factor); |
225 | 226 |
226 private: | 227 private: |
227 DISALLOW_COPY_AND_ASSIGN(HistoryUI); | 228 DISALLOW_COPY_AND_ASSIGN(HistoryUI); |
228 }; | 229 }; |
229 | 230 |
230 #endif // CHROME_BROWSER_UI_WEBUI_HISTORY_UI_H_ | 231 #endif // CHROME_BROWSER_UI_WEBUI_HISTORY_UI_H_ |
OLD | NEW |