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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 void AddPage(const GURL& url, | 156 void AddPage(const GURL& url, |
157 const void* id_scope, | 157 const void* id_scope, |
158 int32 page_id, | 158 int32 page_id, |
159 const GURL& referrer, | 159 const GURL& referrer, |
160 PageTransition::Type transition, | 160 PageTransition::Type transition, |
161 const RedirectList& redirects); | 161 const RedirectList& redirects); |
162 | 162 |
163 // For adding pages to history with a specific time. This is for testing | 163 // For adding pages to history with a specific time. This is for testing |
164 // purposes. Call the previous one to use the current time. | 164 // purposes. Call the previous one to use the current time. |
165 void AddPage(const GURL& url, | 165 void AddPage(const GURL& url, |
166 Time time, | 166 base::Time time, |
167 const void* id_scope, | 167 const void* id_scope, |
168 int32 page_id, | 168 int32 page_id, |
169 const GURL& referrer, | 169 const GURL& referrer, |
170 PageTransition::Type transition, | 170 PageTransition::Type transition, |
171 const RedirectList& redirects); | 171 const RedirectList& redirects); |
172 | 172 |
173 // For adding pages to history where no tracking information can be done. | 173 // For adding pages to history where no tracking information can be done. |
174 void AddPage(const GURL& url) { | 174 void AddPage(const GURL& url) { |
175 AddPage(url, NULL, 0, GURL::EmptyGURL(), PageTransition::LINK, | 175 AddPage(url, NULL, 0, GURL::EmptyGURL(), PageTransition::LINK, |
176 RedirectList()); | 176 RedirectList()); |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 // Schedules a query for the most recent redirect coming out of the given | 273 // Schedules a query for the most recent redirect coming out of the given |
274 // URL. See the RedirectQuerySource above, which is guaranteed to be called | 274 // URL. See the RedirectQuerySource above, which is guaranteed to be called |
275 // if the request is not canceled. | 275 // if the request is not canceled. |
276 Handle QueryRedirectsFrom(const GURL& from_url, | 276 Handle QueryRedirectsFrom(const GURL& from_url, |
277 CancelableRequestConsumerBase* consumer, | 277 CancelableRequestConsumerBase* consumer, |
278 QueryRedirectsCallback* callback); | 278 QueryRedirectsCallback* callback); |
279 | 279 |
280 typedef Callback4<Handle, | 280 typedef Callback4<Handle, |
281 bool, // Were we able to determine the # of visits? | 281 bool, // Were we able to determine the # of visits? |
282 int, // Number of visits. | 282 int, // Number of visits. |
283 Time>::Type // Time of first visit. Only first bool is | 283 base::Time>::Type // Time of first visit. Only first bool is |
284 // true and int is > 0. | 284 // true and int is > 0. |
285 GetVisitCountToHostCallback; | 285 GetVisitCountToHostCallback; |
286 | 286 |
287 // Requests the number of visits to all urls on the scheme/host/post | 287 // Requests the number of visits to all urls on the scheme/host/post |
288 // identified by url. This is only valid for http and https urls. | 288 // identified by url. This is only valid for http and https urls. |
289 Handle GetVisitCountToHost(const GURL& url, | 289 Handle GetVisitCountToHost(const GURL& url, |
290 CancelableRequestConsumerBase* consumer, | 290 CancelableRequestConsumerBase* consumer, |
291 GetVisitCountToHostCallback* callback); | 291 GetVisitCountToHostCallback* callback); |
292 | 292 |
293 // Thumbnails ---------------------------------------------------------------- | 293 // Thumbnails ---------------------------------------------------------------- |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 // Implemented by the caller of 'ExpireHistory(Since|Between)' below, and | 380 // Implemented by the caller of 'ExpireHistory(Since|Between)' below, and |
381 // is called when the history service has deleted the history. | 381 // is called when the history service has deleted the history. |
382 typedef Callback0::Type ExpireHistoryCallback; | 382 typedef Callback0::Type ExpireHistoryCallback; |
383 | 383 |
384 // Removes all visits in the selected time range (including the start time), | 384 // Removes all visits in the selected time range (including the start time), |
385 // updating the URLs accordingly. This deletes the associated data, including | 385 // updating the URLs accordingly. This deletes the associated data, including |
386 // the full text index. This function also deletes the associated favicons, | 386 // the full text index. This function also deletes the associated favicons, |
387 // if they are no longer referenced. |callback| runs when the expiration is | 387 // if they are no longer referenced. |callback| runs when the expiration is |
388 // complete. You may use null Time values to do an unbounded delete in | 388 // complete. You may use null Time values to do an unbounded delete in |
389 // either direction. | 389 // either direction. |
390 void ExpireHistoryBetween(Time begin_time, Time end_time, | 390 void ExpireHistoryBetween(base::Time begin_time, base::Time end_time, |
391 CancelableRequestConsumerBase* consumer, | 391 CancelableRequestConsumerBase* consumer, |
392 ExpireHistoryCallback* callback); | 392 ExpireHistoryCallback* callback); |
393 | 393 |
394 // Downloads ----------------------------------------------------------------- | 394 // Downloads ----------------------------------------------------------------- |
395 | 395 |
396 // Implemented by the caller of 'CreateDownload' below, and is called when the | 396 // Implemented by the caller of 'CreateDownload' below, and is called when the |
397 // history service has created a new entry for a download in the history db. | 397 // history service has created a new entry for a download in the history db. |
398 typedef Callback2<DownloadCreateInfo, int64>::Type DownloadCreateCallback; | 398 typedef Callback2<DownloadCreateInfo, int64>::Type DownloadCreateCallback; |
399 | 399 |
400 // Begins a history request to create a new persistent entry for a download. | 400 // Begins a history request to create a new persistent entry for a download. |
(...skipping 26 matching lines...) Expand all Loading... |
427 | 427 |
428 // Permanently remove a download from the history system. This is a 'fire and | 428 // Permanently remove a download from the history system. This is a 'fire and |
429 // forget' operation. | 429 // forget' operation. |
430 void RemoveDownload(int64 db_handle); | 430 void RemoveDownload(int64 db_handle); |
431 | 431 |
432 // Permanently removes all completed download from the history system within | 432 // Permanently removes all completed download from the history system within |
433 // the specified range. This function does not delete downloads that are in | 433 // the specified range. This function does not delete downloads that are in |
434 // progress or in the process of being cancelled. This is a 'fire and forget' | 434 // progress or in the process of being cancelled. This is a 'fire and forget' |
435 // operation. You can pass is_null times to get unbounded time in either or | 435 // operation. You can pass is_null times to get unbounded time in either or |
436 // both directions. | 436 // both directions. |
437 void RemoveDownloadsBetween(Time remove_begin, Time remove_end); | 437 void RemoveDownloadsBetween(base::Time remove_begin, base::Time remove_end); |
438 | 438 |
439 // Implemented by the caller of 'SearchDownloads' below, and is called when | 439 // Implemented by the caller of 'SearchDownloads' below, and is called when |
440 // the history system has retrieved the search results. | 440 // the history system has retrieved the search results. |
441 typedef Callback2<Handle, std::vector<int64>*>::Type DownloadSearchCallback; | 441 typedef Callback2<Handle, std::vector<int64>*>::Type DownloadSearchCallback; |
442 | 442 |
443 // Search for downloads that match the search text. | 443 // Search for downloads that match the search text. |
444 Handle SearchDownloads(const std::wstring& search_text, | 444 Handle SearchDownloads(const std::wstring& search_text, |
445 CancelableRequestConsumerBase* consumer, | 445 CancelableRequestConsumerBase* consumer, |
446 DownloadSearchCallback* callback); | 446 DownloadSearchCallback* callback); |
447 | 447 |
448 // Visit Segments ------------------------------------------------------------ | 448 // Visit Segments ------------------------------------------------------------ |
449 | 449 |
450 typedef Callback2<Handle, std::vector<PageUsageData*>*>::Type | 450 typedef Callback2<Handle, std::vector<PageUsageData*>*>::Type |
451 SegmentQueryCallback; | 451 SegmentQueryCallback; |
452 | 452 |
453 // Query usage data for all visit segments since the provided time. | 453 // Query usage data for all visit segments since the provided time. |
454 // | 454 // |
455 // The request is performed asynchronously and can be cancelled by using the | 455 // The request is performed asynchronously and can be cancelled by using the |
456 // returned handle. | 456 // returned handle. |
457 // | 457 // |
458 // The vector provided to the callback and its contents is owned by the | 458 // The vector provided to the callback and its contents is owned by the |
459 // history system. It will be deeply deleted after the callback is invoked. | 459 // history system. It will be deeply deleted after the callback is invoked. |
460 // If you want to preserve any PageUsageData instance, simply remove them | 460 // If you want to preserve any PageUsageData instance, simply remove them |
461 // from the vector. | 461 // from the vector. |
462 // | 462 // |
463 // The vector contains a list of PageUsageData. Each PageUsageData ID is set | 463 // The vector contains a list of PageUsageData. Each PageUsageData ID is set |
464 // to the segment ID. The URL and all the other information is set to the page | 464 // to the segment ID. The URL and all the other information is set to the page |
465 // representing the segment. | 465 // representing the segment. |
466 Handle QuerySegmentUsageSince(CancelableRequestConsumerBase* consumer, | 466 Handle QuerySegmentUsageSince(CancelableRequestConsumerBase* consumer, |
467 const Time from_time, | 467 const base::Time from_time, |
468 SegmentQueryCallback* callback); | 468 SegmentQueryCallback* callback); |
469 | 469 |
470 // Set the presentation index for the segment identified by |segment_id|. | 470 // Set the presentation index for the segment identified by |segment_id|. |
471 void SetSegmentPresentationIndex(int64 segment_id, int index); | 471 void SetSegmentPresentationIndex(int64 segment_id, int index); |
472 | 472 |
473 // Keyword search terms ----------------------------------------------------- | 473 // Keyword search terms ----------------------------------------------------- |
474 | 474 |
475 // Sets the search terms for the specified url and keyword. url_id gives the | 475 // Sets the search terms for the specified url and keyword. url_id gives the |
476 // id of the url, keyword_id the id of the keyword and term the search term. | 476 // id of the url, keyword_id the id of the keyword and term the search term. |
477 void SetKeywordSearchTermsForURL(const GURL& url, | 477 void SetKeywordSearchTermsForURL(const GURL& url, |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
526 // into the database. This assumes the URL doesn't exist in the database | 526 // into the database. This assumes the URL doesn't exist in the database |
527 // | 527 // |
528 // Calling this function many times may be slow because each call will | 528 // Calling this function many times may be slow because each call will |
529 // dispatch to the history thread and will be a separate database | 529 // dispatch to the history thread and will be a separate database |
530 // transaction. If this functionality is needed for importing many URLs, a | 530 // transaction. If this functionality is needed for importing many URLs, a |
531 // version that takes an array should probably be added. | 531 // version that takes an array should probably be added. |
532 void AddPageWithDetails(const GURL& url, | 532 void AddPageWithDetails(const GURL& url, |
533 const std::wstring& title, | 533 const std::wstring& title, |
534 int visit_count, | 534 int visit_count, |
535 int typed_count, | 535 int typed_count, |
536 Time last_visit, | 536 base::Time last_visit, |
537 bool hidden); | 537 bool hidden); |
538 | 538 |
539 // The same as AddPageWithDetails() but takes a vector. | 539 // The same as AddPageWithDetails() but takes a vector. |
540 void AddPagesWithDetails(const std::vector<history::URLRow>& info); | 540 void AddPagesWithDetails(const std::vector<history::URLRow>& info); |
541 | 541 |
542 private: | 542 private: |
543 class BackendDelegate; | 543 class BackendDelegate; |
544 friend class BackendDelegate; | 544 friend class BackendDelegate; |
545 friend class history::HistoryBackend; | 545 friend class history::HistoryBackend; |
546 friend class history::HistoryQueryTest; | 546 friend class history::HistoryQueryTest; |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
757 Profile* profile_; | 757 Profile* profile_; |
758 | 758 |
759 // Has the backend finished loading? The backend is loaded once Init has | 759 // Has the backend finished loading? The backend is loaded once Init has |
760 // completed. | 760 // completed. |
761 bool backend_loaded_; | 761 bool backend_loaded_; |
762 | 762 |
763 DISALLOW_EVIL_CONSTRUCTORS(HistoryService); | 763 DISALLOW_EVIL_CONSTRUCTORS(HistoryService); |
764 }; | 764 }; |
765 | 765 |
766 #endif // CHROME_BROWSER_HISTORY_HISTORY_H__ | 766 #endif // CHROME_BROWSER_HISTORY_HISTORY_H__ |
OLD | NEW |