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