| 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 "sql/init_status.h" | 25 #include "sql/init_status.h" |
| 26 | 26 |
| 27 class BookmarkService; | 27 class BookmarkService; |
| 28 struct DownloadPersistentStoreInfo; | 28 struct DownloadPersistentStoreInfo; |
| 29 class Profile; |
| 29 class TestingProfile; | 30 class TestingProfile; |
| 30 struct ThumbnailScore; | 31 struct ThumbnailScore; |
| 31 | 32 |
| 32 namespace history { | 33 namespace history { |
| 33 | 34 |
| 34 class CommitLaterTask; | 35 class CommitLaterTask; |
| 35 class HistoryPublisher; | 36 class HistoryPublisher; |
| 36 | 37 |
| 37 // *See the .cc file for more information on the design.* | 38 // *See the .cc file for more information on the design.* |
| 38 // | 39 // |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 // See the definition of BroadcastNotificationsCallback above. This function | 97 // See the definition of BroadcastNotificationsCallback above. This function |
| 97 // takes ownership of the callback pointer. | 98 // takes ownership of the callback pointer. |
| 98 // | 99 // |
| 99 // |id| is used to communicate with the delegate, to identify which | 100 // |id| is used to communicate with the delegate, to identify which |
| 100 // backend is calling the method. | 101 // backend is calling the method. |
| 101 // | 102 // |
| 102 // |bookmark_service| is used to determine bookmarked URLs when deleting and | 103 // |bookmark_service| is used to determine bookmarked URLs when deleting and |
| 103 // may be NULL. | 104 // may be NULL. |
| 104 // | 105 // |
| 105 // This constructor is fast and does no I/O, so can be called at any time. | 106 // This constructor is fast and does no I/O, so can be called at any time. |
| 106 HistoryBackend(const FilePath& history_dir, | 107 HistoryBackend(Profile* profile, |
| 108 const FilePath& history_dir, |
| 107 int id, | 109 int id, |
| 108 Delegate* delegate, | 110 Delegate* delegate, |
| 109 BookmarkService* bookmark_service); | 111 BookmarkService* bookmark_service); |
| 110 | 112 |
| 111 // Must be called after creation but before any objects are created. If this | 113 // Must be called after creation but before any objects are created. If this |
| 112 // fails, all other functions will fail as well. (Since this runs on another | 114 // fails, all other functions will fail as well. (Since this runs on another |
| 113 // thread, we don't bother returning failure.) | 115 // thread, we don't bother returning failure.) |
| 114 // | 116 // |
| 115 // |languages| gives a list of language encodings with which the history | 117 // |languages| gives the languages used to break search terms and history |
| 116 // URLs and omnibox searches are interpreted. | 118 // page titles into separate words. |force_fail| can be set during unittests |
| 117 // |force_fail| can be set during unittests to unconditionally fail to init. | 119 // to unconditionally fail to init. |
| 118 void Init(const std::string& languages, bool force_fail); | 120 void Init(const std::string& languages, bool force_fail); |
| 119 | 121 |
| 120 // Notification that the history system is shutting down. This will break | 122 // Notification that the history system is shutting down. This will break |
| 121 // the refs owned by the delegate and any pending transaction so it will | 123 // the refs owned by the delegate and any pending transaction so it will |
| 122 // actually be deleted. | 124 // actually be deleted. |
| 123 void Closing(); | 125 void Closing(); |
| 124 | 126 |
| 125 // See NotifyRenderProcessHostDestruction. | 127 // See NotifyRenderProcessHostDestruction. |
| 126 void NotifyRenderProcessHostDestruction(const void* host); | 128 void NotifyRenderProcessHostDestruction(const void* host); |
| 127 | 129 |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 void UpdateDownload(int64 received_bytes, int32 state, int64 db_handle); | 251 void UpdateDownload(int64 received_bytes, int32 state, int64 db_handle); |
| 250 void UpdateDownloadPath(const FilePath& path, int64 db_handle); | 252 void UpdateDownloadPath(const FilePath& path, int64 db_handle); |
| 251 void CreateDownload(scoped_refptr<DownloadCreateRequest> request, | 253 void CreateDownload(scoped_refptr<DownloadCreateRequest> request, |
| 252 int32 id, | 254 int32 id, |
| 253 const DownloadPersistentStoreInfo& info); | 255 const DownloadPersistentStoreInfo& info); |
| 254 void RemoveDownload(int64 db_handle); | 256 void RemoveDownload(int64 db_handle); |
| 255 void RemoveDownloadsBetween(const base::Time remove_begin, | 257 void RemoveDownloadsBetween(const base::Time remove_begin, |
| 256 const base::Time remove_end); | 258 const base::Time remove_end); |
| 257 void RemoveDownloads(const base::Time remove_end); | 259 void RemoveDownloads(const base::Time remove_end); |
| 258 | 260 |
| 261 // InMemoryURLIndex ---------------------------------------------------------- |
| 262 |
| 263 // Returns the quick history index. |
| 264 history::InMemoryURLIndex* InMemoryIndex() const { |
| 265 return in_memory_url_index_.get(); |
| 266 } |
| 267 |
| 259 // Segment usage ------------------------------------------------------------- | 268 // Segment usage ------------------------------------------------------------- |
| 260 | 269 |
| 261 void QuerySegmentUsage(scoped_refptr<QuerySegmentUsageRequest> request, | 270 void QuerySegmentUsage(scoped_refptr<QuerySegmentUsageRequest> request, |
| 262 const base::Time from_time, | 271 const base::Time from_time, |
| 263 int max_result_count); | 272 int max_result_count); |
| 264 void DeleteOldSegmentData(); | 273 void DeleteOldSegmentData(); |
| 265 void SetSegmentPresentationIndex(SegmentID segment_id, int index); | 274 void SetSegmentPresentationIndex(SegmentID segment_id, int index); |
| 266 | 275 |
| 267 // Keyword search terms ------------------------------------------------------ | 276 // Keyword search terms ------------------------------------------------------ |
| 268 | 277 |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 560 scoped_ptr<HistoryDatabase> db_; | 569 scoped_ptr<HistoryDatabase> db_; |
| 561 scoped_ptr<ThumbnailDatabase> thumbnail_db_; | 570 scoped_ptr<ThumbnailDatabase> thumbnail_db_; |
| 562 | 571 |
| 563 // Stores old history in a larger, slower database. | 572 // Stores old history in a larger, slower database. |
| 564 scoped_ptr<ArchivedDatabase> archived_db_; | 573 scoped_ptr<ArchivedDatabase> archived_db_; |
| 565 | 574 |
| 566 // Full text database manager, possibly NULL if the database could not be | 575 // Full text database manager, possibly NULL if the database could not be |
| 567 // created. | 576 // created. |
| 568 scoped_ptr<TextDatabaseManager> text_database_; | 577 scoped_ptr<TextDatabaseManager> text_database_; |
| 569 | 578 |
| 579 // The index used for quick history lookups. |
| 580 scoped_ptr<history::InMemoryURLIndex> in_memory_url_index_; |
| 581 |
| 570 // Manages expiration between the various databases. | 582 // Manages expiration between the various databases. |
| 571 ExpireHistoryBackend expirer_; | 583 ExpireHistoryBackend expirer_; |
| 572 | 584 |
| 573 // A commit has been scheduled to occur sometime in the future. We can check | 585 // A commit has been scheduled to occur sometime in the future. We can check |
| 574 // non-null-ness to see if there is a commit scheduled in the future, and we | 586 // non-null-ness to see if there is a commit scheduled in the future, and we |
| 575 // can use the pointer to cancel the scheduled commit. There can be only one | 587 // can use the pointer to cancel the scheduled commit. There can be only one |
| 576 // scheduled commit at a time (see ScheduleCommit). | 588 // scheduled commit at a time (see ScheduleCommit). |
| 577 scoped_refptr<CommitLaterTask> scheduled_commit_; | 589 scoped_refptr<CommitLaterTask> scheduled_commit_; |
| 578 | 590 |
| 579 // Maps recent redirect destination pages to the chain of redirects that | 591 // Maps recent redirect destination pages to the chain of redirects that |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 629 // Publishes the history to all indexers which are registered to receive | 641 // Publishes the history to all indexers which are registered to receive |
| 630 // history data from us. Can be NULL if there are no listeners. | 642 // history data from us. Can be NULL if there are no listeners. |
| 631 scoped_ptr<HistoryPublisher> history_publisher_; | 643 scoped_ptr<HistoryPublisher> history_publisher_; |
| 632 | 644 |
| 633 DISALLOW_COPY_AND_ASSIGN(HistoryBackend); | 645 DISALLOW_COPY_AND_ASSIGN(HistoryBackend); |
| 634 }; | 646 }; |
| 635 | 647 |
| 636 } // namespace history | 648 } // namespace history |
| 637 | 649 |
| 638 #endif // CHROME_BROWSER_HISTORY_HISTORY_BACKEND_H_ | 650 #endif // CHROME_BROWSER_HISTORY_HISTORY_BACKEND_H_ |
| OLD | NEW |