| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_BACKEND_H_ | 5 #ifndef CHROME_BROWSER_HISTORY_HISTORY_BACKEND_H_ |
| 6 #define CHROME_BROWSER_HISTORY_HISTORY_BACKEND_H_ | 6 #define CHROME_BROWSER_HISTORY_HISTORY_BACKEND_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| 11 | 11 |
| 12 #include "base/file_path.h" | 12 #include "base/file_path.h" |
| 13 #include "base/gtest_prod_util.h" | 13 #include "base/gtest_prod_util.h" |
| 14 #include "base/memory/mru_cache.h" | 14 #include "base/memory/mru_cache.h" |
| 15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
| 16 #include "chrome/browser/history/archived_database.h" | 16 #include "chrome/browser/history/archived_database.h" |
| 17 #include "chrome/browser/history/expire_history_backend.h" | 17 #include "chrome/browser/history/expire_history_backend.h" |
| 18 #include "chrome/browser/history/history_database.h" | 18 #include "chrome/browser/history/history_database.h" |
| 19 #include "chrome/browser/history/history_marshaling.h" | 19 #include "chrome/browser/history/history_marshaling.h" |
| 20 #include "chrome/browser/history/history_types.h" | 20 #include "chrome/browser/history/history_types.h" |
| 21 #include "chrome/browser/history/text_database_manager.h" | 21 #include "chrome/browser/history/text_database_manager.h" |
| 22 #include "chrome/browser/history/thumbnail_database.h" | 22 #include "chrome/browser/history/thumbnail_database.h" |
| 23 #include "chrome/browser/history/visit_tracker.h" | 23 #include "chrome/browser/history/visit_tracker.h" |
| 24 #include "chrome/browser/search_engines/template_url_id.h" | 24 #include "chrome/browser/search_engines/template_url_id.h" |
| 25 #include "content/browser/cancelable_request.h" | 25 #include "content/browser/cancelable_request.h" |
| 26 #include "sql/init_status.h" | 26 #include "sql/init_status.h" |
| 27 | 27 |
| 28 class BookmarkService; | 28 class BookmarkService; |
| 29 struct DownloadPersistentStoreInfo; | 29 struct DownloadPersistentStoreInfo; |
| 30 class Profile; |
| 30 class TestingProfile; | 31 class TestingProfile; |
| 31 struct ThumbnailScore; | 32 struct ThumbnailScore; |
| 32 | 33 |
| 33 namespace history { | 34 namespace history { |
| 34 | 35 |
| 35 class CommitLaterTask; | 36 class CommitLaterTask; |
| 36 class HistoryPublisher; | 37 class HistoryPublisher; |
| 37 | 38 |
| 38 // *See the .cc file for more information on the design.* | 39 // *See the .cc file for more information on the design.* |
| 39 // | 40 // |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 // See the definition of BroadcastNotificationsCallback above. This function | 98 // See the definition of BroadcastNotificationsCallback above. This function |
| 98 // takes ownership of the callback pointer. | 99 // takes ownership of the callback pointer. |
| 99 // | 100 // |
| 100 // |id| is used to communicate with the delegate, to identify which | 101 // |id| is used to communicate with the delegate, to identify which |
| 101 // backend is calling the method. | 102 // backend is calling the method. |
| 102 // | 103 // |
| 103 // |bookmark_service| is used to determine bookmarked URLs when deleting and | 104 // |bookmark_service| is used to determine bookmarked URLs when deleting and |
| 104 // may be NULL. | 105 // may be NULL. |
| 105 // | 106 // |
| 106 // This constructor is fast and does no I/O, so can be called at any time. | 107 // This constructor is fast and does no I/O, so can be called at any time. |
| 107 HistoryBackend(const FilePath& history_dir, | 108 HistoryBackend(Profile* profile, |
| 109 const FilePath& history_dir, |
| 108 int id, | 110 int id, |
| 109 Delegate* delegate, | 111 Delegate* delegate, |
| 110 BookmarkService* bookmark_service); | 112 BookmarkService* bookmark_service); |
| 111 | 113 |
| 112 // Must be called after creation but before any objects are created. If this | 114 // Must be called after creation but before any objects are created. If this |
| 113 // fails, all other functions will fail as well. (Since this runs on another | 115 // fails, all other functions will fail as well. (Since this runs on another |
| 114 // thread, we don't bother returning failure.) | 116 // thread, we don't bother returning failure.) |
| 115 // | 117 // |
| 116 // |languages| gives a list of language encodings with which the history | 118 // |languages| gives a list of language encodings with which the history |
| 117 // URLs and omnibox searches are interpreted. | 119 // URLs and omnibox searches are interpreted. |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 void UpdateDownload(const DownloadPersistentStoreInfo& data); | 252 void UpdateDownload(const DownloadPersistentStoreInfo& data); |
| 251 void UpdateDownloadPath(const FilePath& path, int64 db_handle); | 253 void UpdateDownloadPath(const FilePath& path, int64 db_handle); |
| 252 void CreateDownload(scoped_refptr<DownloadCreateRequest> request, | 254 void CreateDownload(scoped_refptr<DownloadCreateRequest> request, |
| 253 int32 id, | 255 int32 id, |
| 254 const DownloadPersistentStoreInfo& info); | 256 const DownloadPersistentStoreInfo& info); |
| 255 void RemoveDownload(int64 db_handle); | 257 void RemoveDownload(int64 db_handle); |
| 256 void RemoveDownloadsBetween(const base::Time remove_begin, | 258 void RemoveDownloadsBetween(const base::Time remove_begin, |
| 257 const base::Time remove_end); | 259 const base::Time remove_end); |
| 258 void RemoveDownloads(const base::Time remove_end); | 260 void RemoveDownloads(const base::Time remove_end); |
| 259 | 261 |
| 262 // InMemoryURLIndex ---------------------------------------------------------- |
| 263 |
| 264 // Returns the quick history index. |
| 265 history::InMemoryURLIndex* InMemoryIndex() const { |
| 266 return in_memory_url_index_.get(); |
| 267 } |
| 268 |
| 260 // Segment usage ------------------------------------------------------------- | 269 // Segment usage ------------------------------------------------------------- |
| 261 | 270 |
| 262 void QuerySegmentUsage(scoped_refptr<QuerySegmentUsageRequest> request, | 271 void QuerySegmentUsage(scoped_refptr<QuerySegmentUsageRequest> request, |
| 263 const base::Time from_time, | 272 const base::Time from_time, |
| 264 int max_result_count); | 273 int max_result_count); |
| 265 void DeleteOldSegmentData(); | 274 void DeleteOldSegmentData(); |
| 266 void SetSegmentPresentationIndex(SegmentID segment_id, int index); | 275 void SetSegmentPresentationIndex(SegmentID segment_id, int index); |
| 267 | 276 |
| 268 // Keyword search terms ------------------------------------------------------ | 277 // Keyword search terms ------------------------------------------------------ |
| 269 | 278 |
| (...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 567 scoped_ptr<HistoryDatabase> db_; | 576 scoped_ptr<HistoryDatabase> db_; |
| 568 scoped_ptr<ThumbnailDatabase> thumbnail_db_; | 577 scoped_ptr<ThumbnailDatabase> thumbnail_db_; |
| 569 | 578 |
| 570 // Stores old history in a larger, slower database. | 579 // Stores old history in a larger, slower database. |
| 571 scoped_ptr<ArchivedDatabase> archived_db_; | 580 scoped_ptr<ArchivedDatabase> archived_db_; |
| 572 | 581 |
| 573 // Full text database manager, possibly NULL if the database could not be | 582 // Full text database manager, possibly NULL if the database could not be |
| 574 // created. | 583 // created. |
| 575 scoped_ptr<TextDatabaseManager> text_database_; | 584 scoped_ptr<TextDatabaseManager> text_database_; |
| 576 | 585 |
| 586 // The index used for quick history lookups. |
| 587 scoped_ptr<history::InMemoryURLIndex> in_memory_url_index_; |
| 588 |
| 577 // Manages expiration between the various databases. | 589 // Manages expiration between the various databases. |
| 578 ExpireHistoryBackend expirer_; | 590 ExpireHistoryBackend expirer_; |
| 579 | 591 |
| 580 // A commit has been scheduled to occur sometime in the future. We can check | 592 // A commit has been scheduled to occur sometime in the future. We can check |
| 581 // non-null-ness to see if there is a commit scheduled in the future, and we | 593 // non-null-ness to see if there is a commit scheduled in the future, and we |
| 582 // can use the pointer to cancel the scheduled commit. There can be only one | 594 // can use the pointer to cancel the scheduled commit. There can be only one |
| 583 // scheduled commit at a time (see ScheduleCommit). | 595 // scheduled commit at a time (see ScheduleCommit). |
| 584 scoped_refptr<CommitLaterTask> scheduled_commit_; | 596 scoped_refptr<CommitLaterTask> scheduled_commit_; |
| 585 | 597 |
| 586 // Maps recent redirect destination pages to the chain of redirects that | 598 // Maps recent redirect destination pages to the chain of redirects that |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 636 // Publishes the history to all indexers which are registered to receive | 648 // Publishes the history to all indexers which are registered to receive |
| 637 // history data from us. Can be NULL if there are no listeners. | 649 // history data from us. Can be NULL if there are no listeners. |
| 638 scoped_ptr<HistoryPublisher> history_publisher_; | 650 scoped_ptr<HistoryPublisher> history_publisher_; |
| 639 | 651 |
| 640 DISALLOW_COPY_AND_ASSIGN(HistoryBackend); | 652 DISALLOW_COPY_AND_ASSIGN(HistoryBackend); |
| 641 }; | 653 }; |
| 642 | 654 |
| 643 } // namespace history | 655 } // namespace history |
| 644 | 656 |
| 645 #endif // CHROME_BROWSER_HISTORY_HISTORY_BACKEND_H_ | 657 #endif // CHROME_BROWSER_HISTORY_HISTORY_BACKEND_H_ |
| OLD | NEW |