| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 // The history service records page titles, and visit times, as well as | 79 // The history service records page titles, and visit times, as well as |
| 80 // (eventually) information about autocomplete. | 80 // (eventually) information about autocomplete. |
| 81 // | 81 // |
| 82 // This service is thread safe. Each request callback is invoked in the | 82 // This service is thread safe. Each request callback is invoked in the |
| 83 // thread that made the request. | 83 // thread that made the request. |
| 84 class HistoryService : public CancelableRequestProvider, | 84 class HistoryService : public CancelableRequestProvider, |
| 85 public NotificationObserver, | 85 public NotificationObserver, |
| 86 public base::RefCountedThreadSafe<HistoryService> { | 86 public base::RefCountedThreadSafe<HistoryService> { |
| 87 public: | 87 public: |
| 88 // Miscellaneous commonly-used types. | 88 // Miscellaneous commonly-used types. |
| 89 typedef std::vector<GURL> RedirectList; | |
| 90 typedef std::vector<PageUsageData*> PageUsageDataList; | 89 typedef std::vector<PageUsageData*> PageUsageDataList; |
| 91 | 90 |
| 92 // ID (both star_id and group_id) of the bookmark bar. | 91 // ID (both star_id and group_id) of the bookmark bar. |
| 93 // This entry always exists. | 92 // This entry always exists. |
| 94 static const history::StarID kBookmarkBarID; | 93 static const history::StarID kBookmarkBarID; |
| 95 | 94 |
| 96 // Must call Init after construction. | 95 // Must call Init after construction. |
| 97 explicit HistoryService(Profile* profile); | 96 explicit HistoryService(Profile* profile); |
| 98 // The empty constructor is provided only for testing. | 97 // The empty constructor is provided only for testing. |
| 99 HistoryService(); | 98 HistoryService(); |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 // 'did_replace_entry' is true when the navigation entry for this page has | 157 // 'did_replace_entry' is true when the navigation entry for this page has |
| 159 // replaced the existing entry. A non-user initiated redirect causes such | 158 // replaced the existing entry. A non-user initiated redirect causes such |
| 160 // replacement. | 159 // replacement. |
| 161 // | 160 // |
| 162 // All "Add Page" functions will update the visited link database. | 161 // All "Add Page" functions will update the visited link database. |
| 163 void AddPage(const GURL& url, | 162 void AddPage(const GURL& url, |
| 164 const void* id_scope, | 163 const void* id_scope, |
| 165 int32 page_id, | 164 int32 page_id, |
| 166 const GURL& referrer, | 165 const GURL& referrer, |
| 167 PageTransition::Type transition, | 166 PageTransition::Type transition, |
| 168 const RedirectList& redirects, | 167 const history::RedirectList& redirects, |
| 169 bool did_replace_entry); | 168 bool did_replace_entry); |
| 170 | 169 |
| 171 // For adding pages to history with a specific time. This is for testing | 170 // For adding pages to history with a specific time. This is for testing |
| 172 // purposes. Call the previous one to use the current time. | 171 // purposes. Call the previous one to use the current time. |
| 173 void AddPage(const GURL& url, | 172 void AddPage(const GURL& url, |
| 174 base::Time time, | 173 base::Time time, |
| 175 const void* id_scope, | 174 const void* id_scope, |
| 176 int32 page_id, | 175 int32 page_id, |
| 177 const GURL& referrer, | 176 const GURL& referrer, |
| 178 PageTransition::Type transition, | 177 PageTransition::Type transition, |
| 179 const RedirectList& redirects, | 178 const history::RedirectList& redirects, |
| 180 bool did_replace_entry); | 179 bool did_replace_entry); |
| 181 | 180 |
| 182 // For adding pages to history where no tracking information can be done. | 181 // For adding pages to history where no tracking information can be done. |
| 183 void AddPage(const GURL& url) { | 182 void AddPage(const GURL& url) { |
| 184 AddPage(url, NULL, 0, GURL::EmptyGURL(), PageTransition::LINK, | 183 AddPage(url, NULL, 0, GURL::EmptyGURL(), PageTransition::LINK, |
| 185 RedirectList(), false); | 184 history::RedirectList(), false); |
| 186 } | 185 } |
| 187 | 186 |
| 188 // Sets the title for the given page. The page should be in history. If it | 187 // Sets the title for the given page. The page should be in history. If it |
| 189 // is not, this operation is ignored. This call will not update the full | 188 // is not, this operation is ignored. This call will not update the full |
| 190 // text index. The last title set when the page is indexed will be the | 189 // text index. The last title set when the page is indexed will be the |
| 191 // title in the full text index. | 190 // title in the full text index. |
| 192 void SetPageTitle(const GURL& url, const std::wstring& title); | 191 void SetPageTitle(const GURL& url, const std::wstring& title); |
| 193 | 192 |
| 194 // Indexing ------------------------------------------------------------------ | 193 // Indexing ------------------------------------------------------------------ |
| 195 | 194 |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 // the original page. If A redirects to B, the vector will contain only B, | 268 // the original page. If A redirects to B, the vector will contain only B, |
| 270 // and A will be in 'source_url'. | 269 // and A will be in 'source_url'. |
| 271 // | 270 // |
| 272 // If there is no such URL in the database or the most recent visit has no | 271 // If there is no such URL in the database or the most recent visit has no |
| 273 // redirect, the vector will be empty. If the history system failed for | 272 // redirect, the vector will be empty. If the history system failed for |
| 274 // some reason, success will additionally be false. If the given page | 273 // some reason, success will additionally be false. If the given page |
| 275 // has redirected to multiple destinations, this will pick a random one. | 274 // has redirected to multiple destinations, this will pick a random one. |
| 276 typedef Callback4<Handle, | 275 typedef Callback4<Handle, |
| 277 GURL, // from_url | 276 GURL, // from_url |
| 278 bool, // success | 277 bool, // success |
| 279 RedirectList*>::Type | 278 history::RedirectList*>::Type |
| 280 QueryRedirectsCallback; | 279 QueryRedirectsCallback; |
| 281 | 280 |
| 282 // Schedules a query for the most recent redirect coming out of the given | 281 // Schedules a query for the most recent redirect coming out of the given |
| 283 // URL. See the RedirectQuerySource above, which is guaranteed to be called | 282 // URL. See the RedirectQuerySource above, which is guaranteed to be called |
| 284 // if the request is not canceled. | 283 // if the request is not canceled. |
| 285 Handle QueryRedirectsFrom(const GURL& from_url, | 284 Handle QueryRedirectsFrom(const GURL& from_url, |
| 286 CancelableRequestConsumerBase* consumer, | 285 CancelableRequestConsumerBase* consumer, |
| 287 QueryRedirectsCallback* callback); | 286 QueryRedirectsCallback* callback); |
| 288 | 287 |
| 289 // Schedules a query to get the most recent redirects ending at the given | 288 // Schedules a query to get the most recent redirects ending at the given |
| (...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 789 Profile* profile_; | 788 Profile* profile_; |
| 790 | 789 |
| 791 // Has the backend finished loading? The backend is loaded once Init has | 790 // Has the backend finished loading? The backend is loaded once Init has |
| 792 // completed. | 791 // completed. |
| 793 bool backend_loaded_; | 792 bool backend_loaded_; |
| 794 | 793 |
| 795 DISALLOW_EVIL_CONSTRUCTORS(HistoryService); | 794 DISALLOW_EVIL_CONSTRUCTORS(HistoryService); |
| 796 }; | 795 }; |
| 797 | 796 |
| 798 #endif // CHROME_BROWSER_HISTORY_HISTORY_H__ | 797 #endif // CHROME_BROWSER_HISTORY_HISTORY_H__ |
| OLD | NEW |