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_HISTORY_HISTORY_H_ | 5 #ifndef CHROME_BROWSER_HISTORY_HISTORY_H_ |
6 #define CHROME_BROWSER_HISTORY_HISTORY_H_ | 6 #define CHROME_BROWSER_HISTORY_HISTORY_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/callback.h" | 12 #include "base/callback.h" |
13 #include "base/file_path.h" | 13 #include "base/file_path.h" |
14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
16 #include "base/observer_list_threadsafe.h" | 16 #include "base/observer_list_threadsafe.h" |
17 #include "base/string16.h" | 17 #include "base/string16.h" |
| 18 #include "base/time.h" |
18 #include "chrome/browser/cancelable_request.h" | 19 #include "chrome/browser/cancelable_request.h" |
19 #include "chrome/browser/common/url_database/template_url_id.h" | 20 #include "chrome/browser/common/url_database/template_url_id.h" |
20 #include "chrome/browser/favicon/favicon_service.h" | 21 #include "chrome/browser/favicon/favicon_service.h" |
21 #include "chrome/browser/history/history_types.h" | 22 #include "chrome/browser/history/history_types.h" |
22 #include "chrome/browser/profiles/refcounted_profile_keyed_service.h" | 23 #include "chrome/browser/profiles/refcounted_profile_keyed_service.h" |
23 #include "chrome/common/ref_counted_util.h" | 24 #include "chrome/common/ref_counted_util.h" |
24 #include "content/public/browser/notification_observer.h" | 25 #include "content/public/browser/notification_observer.h" |
25 #include "content/public/browser/notification_registrar.h" | 26 #include "content/public/browser/notification_registrar.h" |
26 #include "content/public/common/page_transition_types.h" | 27 #include "content/public/common/page_transition_types.h" |
27 #include "sql/init_status.h" | 28 #include "sql/init_status.h" |
28 #include "ui/base/layout.h" | 29 #include "ui/base/layout.h" |
29 | 30 |
30 #if defined(OS_ANDROID) | 31 #if defined(OS_ANDROID) |
31 #include "chrome/browser/history/android/android_history_provider_service.h" | 32 #include "chrome/browser/history/android/android_history_provider_service.h" |
32 #endif | 33 #endif |
33 | 34 |
34 class BookmarkService; | 35 class BookmarkService; |
35 class FilePath; | 36 class FilePath; |
36 class GURL; | 37 class GURL; |
37 class HistoryURLProvider; | 38 class HistoryURLProvider; |
38 struct HistoryURLProviderParams; | 39 struct HistoryURLProviderParams; |
39 class PageUsageData; | 40 class PageUsageData; |
40 class PageUsageRequest; | 41 class PageUsageRequest; |
41 class Profile; | 42 class Profile; |
42 | 43 |
43 namespace base { | 44 namespace base { |
44 class Thread; | 45 class Thread; |
45 class Time; | |
46 } | 46 } |
47 | 47 |
48 namespace content { | 48 namespace content { |
49 struct DownloadPersistentStoreInfo; | 49 struct DownloadPersistentStoreInfo; |
50 } | 50 } |
51 | 51 |
52 namespace history { | 52 namespace history { |
53 class InMemoryHistoryBackend; | 53 class InMemoryHistoryBackend; |
54 class InMemoryURLIndex; | 54 class InMemoryURLIndex; |
55 class InMemoryURLIndexTest; | 55 class InMemoryURLIndexTest; |
56 class HistoryAddPageArgs; | 56 struct HistoryAddPageArgs; |
57 class HistoryBackend; | 57 class HistoryBackend; |
58 class HistoryDatabase; | 58 class HistoryDatabase; |
59 struct HistoryDetails; | 59 struct HistoryDetails; |
60 class HistoryQueryTest; | 60 class HistoryQueryTest; |
61 class VisitFilter; | 61 class VisitFilter; |
62 class URLDatabase; | 62 class URLDatabase; |
63 class VisitDatabaseObserver; | 63 class VisitDatabaseObserver; |
64 } // namespace history | 64 } // namespace history |
65 | 65 |
66 | 66 |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 // Return the quick history index. | 158 // Return the quick history index. |
159 history::InMemoryURLIndex* InMemoryIndex() const { | 159 history::InMemoryURLIndex* InMemoryIndex() const { |
160 return in_memory_url_index_.get(); | 160 return in_memory_url_index_.get(); |
161 } | 161 } |
162 | 162 |
163 // RefcountedProfileKeyedService: | 163 // RefcountedProfileKeyedService: |
164 virtual void ShutdownOnUIThread() OVERRIDE; | 164 virtual void ShutdownOnUIThread() OVERRIDE; |
165 | 165 |
166 // Navigation ---------------------------------------------------------------- | 166 // Navigation ---------------------------------------------------------------- |
167 | 167 |
168 // Adds the given canonical URL to history with the current time as the visit | 168 // Adds the given canonical URL to history with the given time as the visit |
169 // time. Referrer may be the empty string. | 169 // time. Referrer may be the empty string. |
170 // | 170 // |
171 // The supplied render process host is used to scope the given page ID. Page | 171 // The supplied render process host is used to scope the given page ID. Page |
172 // IDs are only unique inside a given render process, so we need that to | 172 // IDs are only unique inside a given render process, so we need that to |
173 // differentiate them. This pointer should not be dereferenced by the history | 173 // differentiate them. This pointer should not be dereferenced by the history |
174 // system. | 174 // system. |
175 // | 175 // |
176 // The scope/ids can be NULL if there is no meaningful tracking information | 176 // The scope/ids can be NULL if there is no meaningful tracking information |
177 // that can be performed on the given URL. The 'page_id' should be the ID of | 177 // that can be performed on the given URL. The 'page_id' should be the ID of |
178 // the current session history entry in the given process. | 178 // the current session history entry in the given process. |
179 // | 179 // |
180 // 'redirects' is an array of redirect URLs leading to this page, with the | 180 // 'redirects' is an array of redirect URLs leading to this page, with the |
181 // page itself as the last item (so when there is no redirect, it will have | 181 // page itself as the last item (so when there is no redirect, it will have |
182 // one entry). If there are no redirects, this array may also be empty for | 182 // one entry). If there are no redirects, this array may also be empty for |
183 // the convenience of callers. | 183 // the convenience of callers. |
184 // | 184 // |
185 // 'did_replace_entry' is true when the navigation entry for this page has | 185 // 'did_replace_entry' is true when the navigation entry for this page has |
186 // replaced the existing entry. A non-user initiated redirect causes such | 186 // replaced the existing entry. A non-user initiated redirect causes such |
187 // replacement. | 187 // replacement. |
188 // | 188 // |
189 // All "Add Page" functions will update the visited link database. | 189 // All "Add Page" functions will update the visited link database. |
190 void AddPage(const GURL& url, | 190 void AddPage(const GURL& url, |
191 const void* id_scope, | |
192 int32 page_id, | |
193 const GURL& referrer, | |
194 content::PageTransition transition, | |
195 const history::RedirectList& redirects, | |
196 history::VisitSource visit_source, | |
197 bool did_replace_entry); | |
198 | |
199 // For adding pages to history with a specific time. This is for testing | |
200 // purposes. Call the previous one to use the current time. | |
201 void AddPage(const GURL& url, | |
202 base::Time time, | 191 base::Time time, |
203 const void* id_scope, | 192 const void* id_scope, |
204 int32 page_id, | 193 int32 page_id, |
205 const GURL& referrer, | 194 const GURL& referrer, |
| 195 const history::RedirectList& redirects, |
206 content::PageTransition transition, | 196 content::PageTransition transition, |
207 const history::RedirectList& redirects, | |
208 history::VisitSource visit_source, | 197 history::VisitSource visit_source, |
209 bool did_replace_entry); | 198 bool did_replace_entry); |
210 | 199 |
211 // For adding pages to history where no tracking information can be done. | 200 // For adding pages to history where no tracking information can be done. |
212 void AddPage(const GURL& url, history::VisitSource visit_source) { | 201 void AddPage(const GURL& url, |
213 AddPage(url, NULL, 0, GURL(), content::PAGE_TRANSITION_LINK, | 202 base::Time time, |
214 history::RedirectList(), visit_source, false); | 203 history::VisitSource visit_source); |
215 } | |
216 | 204 |
217 // All AddPage variants end up here. | 205 // All AddPage variants end up here. |
218 void AddPage(const history::HistoryAddPageArgs& add_page_args); | 206 void AddPage(const history::HistoryAddPageArgs& add_page_args); |
219 | 207 |
220 // Adds an entry for the specified url without creating a visit. This should | 208 // Adds an entry for the specified url without creating a visit. This should |
221 // only be used when bookmarking a page, otherwise the row leaks in the | 209 // only be used when bookmarking a page, otherwise the row leaks in the |
222 // history db (it never gets cleaned). | 210 // history db (it never gets cleaned). |
223 void AddPageNoVisitForBookmark(const GURL& url, const string16& title); | 211 void AddPageNoVisitForBookmark(const GURL& url, const string16& title); |
224 | 212 |
225 // Sets the title for the given page. The page should be in history. If it | 213 // Sets the title for the given page. The page should be in history. If it |
(...skipping 854 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1080 // The index used for quick history lookups. | 1068 // The index used for quick history lookups. |
1081 scoped_ptr<history::InMemoryURLIndex> in_memory_url_index_; | 1069 scoped_ptr<history::InMemoryURLIndex> in_memory_url_index_; |
1082 | 1070 |
1083 scoped_refptr<ObserverListThreadSafe<history::VisitDatabaseObserver> > | 1071 scoped_refptr<ObserverListThreadSafe<history::VisitDatabaseObserver> > |
1084 visit_database_observers_; | 1072 visit_database_observers_; |
1085 | 1073 |
1086 DISALLOW_COPY_AND_ASSIGN(HistoryService); | 1074 DISALLOW_COPY_AND_ASSIGN(HistoryService); |
1087 }; | 1075 }; |
1088 | 1076 |
1089 #endif // CHROME_BROWSER_HISTORY_HISTORY_H_ | 1077 #endif // CHROME_BROWSER_HISTORY_HISTORY_H_ |
OLD | NEW |