| 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 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 #include "sql/init_status.h" | 27 #include "sql/init_status.h" |
| 28 | 28 |
| 29 #if defined(OS_ANDROID) | 29 #if defined(OS_ANDROID) |
| 30 #include "chrome/browser/history/android/android_history_provider_service.h" | 30 #include "chrome/browser/history/android/android_history_provider_service.h" |
| 31 #endif | 31 #endif |
| 32 | 32 |
| 33 class BookmarkService; | 33 class BookmarkService; |
| 34 class FilePath; | 34 class FilePath; |
| 35 class GURL; | 35 class GURL; |
| 36 class HistoryURLProvider; | 36 class HistoryURLProvider; |
| 37 struct HistoryURLProviderParams; | |
| 38 class PageUsageData; | 37 class PageUsageData; |
| 39 class PageUsageRequest; | 38 class PageUsageRequest; |
| 40 class Profile; | 39 class Profile; |
| 40 struct DownloadPersistentStoreInfo; |
| 41 struct HistoryURLProviderParams; |
| 41 | 42 |
| 42 namespace base { | 43 namespace base { |
| 43 class Thread; | 44 class Thread; |
| 44 class Time; | 45 class Time; |
| 45 } | 46 } |
| 46 | 47 |
| 47 namespace content { | |
| 48 struct DownloadPersistentStoreInfo; | |
| 49 } | |
| 50 | 48 |
| 51 namespace history { | 49 namespace history { |
| 52 class InMemoryHistoryBackend; | 50 class InMemoryHistoryBackend; |
| 53 class InMemoryURLIndex; | 51 class InMemoryURLIndex; |
| 54 class InMemoryURLIndexTest; | 52 class InMemoryURLIndexTest; |
| 55 class HistoryAddPageArgs; | 53 class HistoryAddPageArgs; |
| 56 class HistoryBackend; | 54 class HistoryBackend; |
| 57 class HistoryDatabase; | 55 class HistoryDatabase; |
| 58 struct HistoryDetails; | 56 struct HistoryDetails; |
| 59 class HistoryQueryTest; | 57 class HistoryQueryTest; |
| (...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 439 // Downloads ----------------------------------------------------------------- | 437 // Downloads ----------------------------------------------------------------- |
| 440 | 438 |
| 441 // Implemented by the caller of 'CreateDownload' below, and is called when the | 439 // Implemented by the caller of 'CreateDownload' below, and is called when the |
| 442 // history service has created a new entry for a download in the history db. | 440 // history service has created a new entry for a download in the history db. |
| 443 typedef base::Callback<void(int32, int64)> DownloadCreateCallback; | 441 typedef base::Callback<void(int32, int64)> DownloadCreateCallback; |
| 444 | 442 |
| 445 // Begins a history request to create a new persistent entry for a download. | 443 // Begins a history request to create a new persistent entry for a download. |
| 446 // 'info' contains all the download's creation state, and 'callback' runs | 444 // 'info' contains all the download's creation state, and 'callback' runs |
| 447 // when the history service request is complete. | 445 // when the history service request is complete. |
| 448 Handle CreateDownload(int32 id, | 446 Handle CreateDownload(int32 id, |
| 449 const content::DownloadPersistentStoreInfo& info, | 447 const DownloadPersistentStoreInfo& info, |
| 450 CancelableRequestConsumerBase* consumer, | 448 CancelableRequestConsumerBase* consumer, |
| 451 const DownloadCreateCallback& callback); | 449 const DownloadCreateCallback& callback); |
| 452 | 450 |
| 453 // Implemented by the caller of 'GetNextDownloadId' below. | 451 // Implemented by the caller of 'GetNextDownloadId' below. |
| 454 typedef base::Callback<void(int)> DownloadNextIdCallback; | 452 typedef base::Callback<void(int)> DownloadNextIdCallback; |
| 455 | 453 |
| 456 // Runs the callback with the next available download id. | 454 // Runs the callback with the next available download id. |
| 457 Handle GetNextDownloadId(CancelableRequestConsumerBase* consumer, | 455 Handle GetNextDownloadId(CancelableRequestConsumerBase* consumer, |
| 458 const DownloadNextIdCallback& callback); | 456 const DownloadNextIdCallback& callback); |
| 459 | 457 |
| 460 // Implemented by the caller of 'QueryDownloads' below, and is called when the | 458 // Implemented by the caller of 'QueryDownloads' below, and is called when the |
| 461 // history service has retrieved a list of all download state. The call | 459 // history service has retrieved a list of all download state. The call |
| 462 typedef base::Callback<void( | 460 typedef base::Callback<void( |
| 463 std::vector<content::DownloadPersistentStoreInfo>*)> | 461 std::vector<DownloadPersistentStoreInfo>*)> |
| 464 DownloadQueryCallback; | 462 DownloadQueryCallback; |
| 465 | 463 |
| 466 // Begins a history request to retrieve the state of all downloads in the | 464 // Begins a history request to retrieve the state of all downloads in the |
| 467 // history db. 'callback' runs when the history service request is complete, | 465 // history db. 'callback' runs when the history service request is complete, |
| 468 // at which point 'info' contains an array of DownloadPersistentStoreInfo, one | 466 // at which point 'info' contains an array of DownloadPersistentStoreInfo, one |
| 469 // per download. | 467 // per download. |
| 470 Handle QueryDownloads(CancelableRequestConsumerBase* consumer, | 468 Handle QueryDownloads(CancelableRequestConsumerBase* consumer, |
| 471 const DownloadQueryCallback& callback); | 469 const DownloadQueryCallback& callback); |
| 472 | 470 |
| 473 // Begins a request to clean up entries that has been corrupted (because of | 471 // Begins a request to clean up entries that has been corrupted (because of |
| 474 // the crash, for example). | 472 // the crash, for example). |
| 475 void CleanUpInProgressEntries(); | 473 void CleanUpInProgressEntries(); |
| 476 | 474 |
| 477 // Called to update the history service about the current state of a download. | 475 // Called to update the history service about the current state of a download. |
| 478 // This is a 'fire and forget' query, so just pass the relevant state info to | 476 // This is a 'fire and forget' query, so just pass the relevant state info to |
| 479 // the database with no need for a callback. | 477 // the database with no need for a callback. |
| 480 void UpdateDownload(const content::DownloadPersistentStoreInfo& data); | 478 void UpdateDownload(const DownloadPersistentStoreInfo& data); |
| 481 | 479 |
| 482 // Called to update the history service about the path of a download. | 480 // Permanently remove a set of downloads from the history system. This is a |
| 483 // This is a 'fire and forget' query. | 481 // 'fire and forget' operation. |
| 484 void UpdateDownloadPath(const FilePath& path, int64 db_handle); | 482 void RemoveDownloads(const std::set<int64>& handles); |
| 485 | |
| 486 // Permanently remove a download from the history system. This is a 'fire and | |
| 487 // forget' operation. | |
| 488 void RemoveDownload(int64 db_handle); | |
| 489 | |
| 490 // Permanently removes all completed download from the history system within | |
| 491 // the specified range. This function does not delete downloads that are in | |
| 492 // progress or in the process of being cancelled. This is a 'fire and forget' | |
| 493 // operation. You can pass is_null times to get unbounded time in either or | |
| 494 // both directions. | |
| 495 void RemoveDownloadsBetween(base::Time remove_begin, base::Time remove_end); | |
| 496 | 483 |
| 497 // Visit Segments ------------------------------------------------------------ | 484 // Visit Segments ------------------------------------------------------------ |
| 498 | 485 |
| 499 typedef base::Callback<void(Handle, std::vector<PageUsageData*>*)> | 486 typedef base::Callback<void(Handle, std::vector<PageUsageData*>*)> |
| 500 SegmentQueryCallback; | 487 SegmentQueryCallback; |
| 501 | 488 |
| 502 // Query usage data for all visit segments since the provided time. | 489 // Query usage data for all visit segments since the provided time. |
| 503 // | 490 // |
| 504 // The request is performed asynchronously and can be cancelled by using the | 491 // The request is performed asynchronously and can be cancelled by using the |
| 505 // returned handle. | 492 // returned handle. |
| (...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 950 // The index used for quick history lookups. | 937 // The index used for quick history lookups. |
| 951 scoped_ptr<history::InMemoryURLIndex> in_memory_url_index_; | 938 scoped_ptr<history::InMemoryURLIndex> in_memory_url_index_; |
| 952 | 939 |
| 953 scoped_refptr<ObserverListThreadSafe<history::VisitDatabaseObserver> > | 940 scoped_refptr<ObserverListThreadSafe<history::VisitDatabaseObserver> > |
| 954 visit_database_observers_; | 941 visit_database_observers_; |
| 955 | 942 |
| 956 DISALLOW_COPY_AND_ASSIGN(HistoryService); | 943 DISALLOW_COPY_AND_ASSIGN(HistoryService); |
| 957 }; | 944 }; |
| 958 | 945 |
| 959 #endif // CHROME_BROWSER_HISTORY_HISTORY_H_ | 946 #endif // CHROME_BROWSER_HISTORY_HISTORY_H_ |
| OLD | NEW |