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_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_HISTORY_HISTORY_SERVICE_H_ |
6 #define CHROME_BROWSER_HISTORY_HISTORY_SERVICE_H_ | 6 #define CHROME_BROWSER_HISTORY_HISTORY_SERVICE_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 | 213 |
214 // All AddPage variants end up here. | 214 // All AddPage variants end up here. |
215 void AddPage(const history::HistoryAddPageArgs& add_page_args); | 215 void AddPage(const history::HistoryAddPageArgs& add_page_args); |
216 | 216 |
217 // Adds an entry for the specified url without creating a visit. This should | 217 // Adds an entry for the specified url without creating a visit. This should |
218 // only be used when bookmarking a page, otherwise the row leaks in the | 218 // only be used when bookmarking a page, otherwise the row leaks in the |
219 // history db (it never gets cleaned). | 219 // history db (it never gets cleaned). |
220 void AddPageNoVisitForBookmark(const GURL& url, const string16& title); | 220 void AddPageNoVisitForBookmark(const GURL& url, const string16& title); |
221 | 221 |
222 // Sets the title for the given page. The page should be in history. If it | 222 // Sets the title for the given page. The page should be in history. If it |
223 // is not, this operation is ignored. This call will not update the full | 223 // is not, this operation is ignored. |
224 // text index. The last title set when the page is indexed will be the | |
225 // title in the full text index. | |
226 void SetPageTitle(const GURL& url, const string16& title); | 224 void SetPageTitle(const GURL& url, const string16& title); |
227 | 225 |
228 // Updates the history database with a page's ending time stamp information. | 226 // Updates the history database with a page's ending time stamp information. |
229 // The page can be identified by the combination of the pointer to | 227 // The page can be identified by the combination of the pointer to |
230 // a RenderProcessHost, the page id and the url. | 228 // a RenderProcessHost, the page id and the url. |
231 // | 229 // |
232 // The given pointer will not be dereferenced, it is only used for | 230 // The given pointer will not be dereferenced, it is only used for |
233 // identification purposes, hence it is a void*. | 231 // identification purposes, hence it is a void*. |
234 void UpdateWithPageEndTime(const void* host, | 232 void UpdateWithPageEndTime(const void* host, |
235 int32 page_id, | 233 int32 page_id, |
236 const GURL& url, | 234 const GURL& url, |
237 base::Time end_ts); | 235 base::Time end_ts); |
238 | 236 |
239 // Indexing ------------------------------------------------------------------ | |
240 | |
241 // Notifies history of the body text of the given recently-visited URL. | |
242 // If the URL was not visited "recently enough," the history system may | |
243 // discard it. | |
244 void SetPageContents(const GURL& url, const string16& contents); | |
245 | |
246 // Querying ------------------------------------------------------------------ | 237 // Querying ------------------------------------------------------------------ |
247 | 238 |
248 // Returns the information about the requested URL. If the URL is found, | 239 // Returns the information about the requested URL. If the URL is found, |
249 // success will be true and the information will be in the URLRow parameter. | 240 // success will be true and the information will be in the URLRow parameter. |
250 // On success, the visits, if requested, will be sorted by date. If they have | 241 // On success, the visits, if requested, will be sorted by date. If they have |
251 // not been requested, the pointer will be valid, but the vector will be | 242 // not been requested, the pointer will be valid, but the vector will be |
252 // empty. | 243 // empty. |
253 // | 244 // |
254 // If success is false, neither the row nor the vector will be valid. | 245 // If success is false, neither the row nor the vector will be valid. |
255 typedef base::Callback<void( | 246 typedef base::Callback<void( |
(...skipping 11 matching lines...) Expand all Loading... |
267 CancelableRequestConsumerBase* consumer, | 258 CancelableRequestConsumerBase* consumer, |
268 const QueryURLCallback& callback); | 259 const QueryURLCallback& callback); |
269 | 260 |
270 // Provides the result of a query. See QueryResults in history_types.h. | 261 // Provides the result of a query. See QueryResults in history_types.h. |
271 // The common use will be to use QueryResults.Swap to suck the contents of | 262 // The common use will be to use QueryResults.Swap to suck the contents of |
272 // the results out of the passed in parameter and take ownership of them. | 263 // the results out of the passed in parameter and take ownership of them. |
273 typedef base::Callback<void(Handle, history::QueryResults*)> | 264 typedef base::Callback<void(Handle, history::QueryResults*)> |
274 QueryHistoryCallback; | 265 QueryHistoryCallback; |
275 | 266 |
276 // Queries all history with the given options (see QueryOptions in | 267 // Queries all history with the given options (see QueryOptions in |
277 // history_types.h). If non-empty, the full-text database will be queried with | 268 // history_types.h). If empty, all results matching the given options |
278 // the given |text_query|. If empty, all results matching the given options | |
279 // will be returned. | 269 // will be returned. |
280 // | |
281 // This isn't totally hooked up yet, this will query the "new" full text | |
282 // database (see SetPageContents) which won't generally be set yet. | |
283 Handle QueryHistory(const string16& text_query, | 270 Handle QueryHistory(const string16& text_query, |
284 const history::QueryOptions& options, | 271 const history::QueryOptions& options, |
285 CancelableRequestConsumerBase* consumer, | 272 CancelableRequestConsumerBase* consumer, |
286 const QueryHistoryCallback& callback); | 273 const QueryHistoryCallback& callback); |
287 | 274 |
288 // Called when the results of QueryRedirectsFrom are available. | 275 // Called when the results of QueryRedirectsFrom are available. |
289 // The given vector will contain a list of all redirects, not counting | 276 // The given vector will contain a list of all redirects, not counting |
290 // the original page. If A redirects to B, the vector will contain only B, | 277 // the original page. If A redirects to B, the vector will contain only B, |
291 // and A will be in 'source_url'. | 278 // and A will be in 'source_url'. |
292 // | 279 // |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 | 363 |
377 // Database management operations -------------------------------------------- | 364 // Database management operations -------------------------------------------- |
378 | 365 |
379 // Delete all the information related to a single url. | 366 // Delete all the information related to a single url. |
380 void DeleteURL(const GURL& url); | 367 void DeleteURL(const GURL& url); |
381 | 368 |
382 // Delete all the information related to a list of urls. (Deleting | 369 // Delete all the information related to a list of urls. (Deleting |
383 // URLs one by one is slow as it has to flush to disk each time.) | 370 // URLs one by one is slow as it has to flush to disk each time.) |
384 void DeleteURLsForTest(const std::vector<GURL>& urls); | 371 void DeleteURLsForTest(const std::vector<GURL>& urls); |
385 | 372 |
386 // Removes all visits in the selected time range (including the start time), | 373 // Removes all visits in the selected time range (including the |
387 // updating the URLs accordingly. This deletes the associated data, including | 374 // start time), updating the URLs accordingly. This deletes any |
388 // the full text index. This function also deletes the associated favicons, | 375 // associated data. This function also deletes the associated |
389 // if they are no longer referenced. |callback| runs when the expiration is | 376 // favicons, if they are no longer referenced. |callback| runs when |
390 // complete. You may use null Time values to do an unbounded delete in | 377 // the expiration is complete. You may use null Time values to do an |
391 // either direction. | 378 // unbounded delete in either direction. |
392 // If |restrict_urls| is not empty, only visits to the URLs in this set are | 379 // If |restrict_urls| is not empty, only visits to the URLs in this set are |
393 // removed. | 380 // removed. |
394 void ExpireHistoryBetween(const std::set<GURL>& restrict_urls, | 381 void ExpireHistoryBetween(const std::set<GURL>& restrict_urls, |
395 base::Time begin_time, | 382 base::Time begin_time, |
396 base::Time end_time, | 383 base::Time end_time, |
397 const base::Closure& callback, | 384 const base::Closure& callback, |
398 CancelableTaskTracker* tracker); | 385 CancelableTaskTracker* tracker); |
399 | 386 |
400 // Removes all visits to specified URLs in specific time ranges. | 387 // Removes all visits to specified URLs in specific time ranges. |
401 // This is the equivalent ExpireHistoryBetween() once for each element in the | 388 // This is the equivalent ExpireHistoryBetween() once for each element in the |
(...skipping 682 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1084 scoped_ptr<history::InMemoryURLIndex> in_memory_url_index_; | 1071 scoped_ptr<history::InMemoryURLIndex> in_memory_url_index_; |
1085 | 1072 |
1086 ObserverList<history::VisitDatabaseObserver> visit_database_observers_; | 1073 ObserverList<history::VisitDatabaseObserver> visit_database_observers_; |
1087 | 1074 |
1088 history::DeleteDirectiveHandler delete_directive_handler_; | 1075 history::DeleteDirectiveHandler delete_directive_handler_; |
1089 | 1076 |
1090 DISALLOW_COPY_AND_ASSIGN(HistoryService); | 1077 DISALLOW_COPY_AND_ASSIGN(HistoryService); |
1091 }; | 1078 }; |
1092 | 1079 |
1093 #endif // CHROME_BROWSER_HISTORY_HISTORY_SERVICE_H_ | 1080 #endif // CHROME_BROWSER_HISTORY_HISTORY_SERVICE_H_ |
OLD | NEW |