| 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_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 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 class TestingProfile; | 30 class TestingProfile; |
| 31 class TypedUrlSyncableService; | 31 class TypedUrlSyncableService; |
| 32 struct ThumbnailScore; | 32 struct ThumbnailScore; |
| 33 | 33 |
| 34 namespace history { | 34 namespace history { |
| 35 #if defined(OS_ANDROID) | 35 #if defined(OS_ANDROID) |
| 36 class AndroidProviderBackend; | 36 class AndroidProviderBackend; |
| 37 #endif | 37 #endif |
| 38 | 38 |
| 39 class CommitLaterTask; | 39 class CommitLaterTask; |
| 40 class HistoryPublisher; | |
| 41 class PageCollector; | |
| 42 class VisitFilter; | 40 class VisitFilter; |
| 43 struct DownloadRow; | 41 struct DownloadRow; |
| 44 | 42 |
| 45 // The maximum number of icons URLs per page which can be stored in the | 43 // The maximum number of icons URLs per page which can be stored in the |
| 46 // thumbnail database. | 44 // thumbnail database. |
| 47 static const size_t kMaxFaviconsPerPage = 8; | 45 static const size_t kMaxFaviconsPerPage = 8; |
| 48 | 46 |
| 49 // The maximum number of bitmaps for a single icon URL which can be stored in | 47 // The maximum number of bitmaps for a single icon URL which can be stored in |
| 50 // the thumbnail database. | 48 // the thumbnail database. |
| 51 static const size_t kMaxFaviconBitmapsPerIconURL = 8; | 49 static const size_t kMaxFaviconBitmapsPerIconURL = 8; |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 // The page can be identified by the combination of the pointer to | 150 // The page can be identified by the combination of the pointer to |
| 153 // a RenderProcessHost, the page id and the url. | 151 // a RenderProcessHost, the page id and the url. |
| 154 // | 152 // |
| 155 // The given pointer will not be dereferenced, it is only used for | 153 // The given pointer will not be dereferenced, it is only used for |
| 156 // identification purposes, hence it is a void*. | 154 // identification purposes, hence it is a void*. |
| 157 void UpdateWithPageEndTime(const void* host, | 155 void UpdateWithPageEndTime(const void* host, |
| 158 int32 page_id, | 156 int32 page_id, |
| 159 const GURL& url, | 157 const GURL& url, |
| 160 base::Time end_ts); | 158 base::Time end_ts); |
| 161 | 159 |
| 162 | |
| 163 // Indexing ------------------------------------------------------------------ | |
| 164 | |
| 165 void SetPageContents(const GURL& url, const string16& contents); | |
| 166 | |
| 167 // Querying ------------------------------------------------------------------ | 160 // Querying ------------------------------------------------------------------ |
| 168 | 161 |
| 169 // ScheduleAutocomplete() never frees |provider| (which is globally live). | 162 // ScheduleAutocomplete() never frees |provider| (which is globally live). |
| 170 // It passes |params| on to the autocomplete system which will eventually | 163 // It passes |params| on to the autocomplete system which will eventually |
| 171 // free it. | 164 // free it. |
| 172 void ScheduleAutocomplete(HistoryURLProvider* provider, | 165 void ScheduleAutocomplete(HistoryURLProvider* provider, |
| 173 HistoryURLProviderParams* params); | 166 HistoryURLProviderParams* params); |
| 174 | 167 |
| 175 void IterateURLs( | 168 void IterateURLs( |
| 176 const scoped_refptr<visitedlink::VisitedLinkDelegate::URLEnumerator>& | 169 const scoped_refptr<visitedlink::VisitedLinkDelegate::URLEnumerator>& |
| (...skipping 662 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 839 // not be opened, all users must first check for NULL and return immediately | 832 // not be opened, all users must first check for NULL and return immediately |
| 840 // if it is. The thumbnail DB may be NULL when the history one isn't, but not | 833 // if it is. The thumbnail DB may be NULL when the history one isn't, but not |
| 841 // vice-versa. | 834 // vice-versa. |
| 842 scoped_ptr<HistoryDatabase> db_; | 835 scoped_ptr<HistoryDatabase> db_; |
| 843 bool scheduled_kill_db_; // Database is being killed due to error. | 836 bool scheduled_kill_db_; // Database is being killed due to error. |
| 844 scoped_ptr<ThumbnailDatabase> thumbnail_db_; | 837 scoped_ptr<ThumbnailDatabase> thumbnail_db_; |
| 845 | 838 |
| 846 // Stores old history in a larger, slower database. | 839 // Stores old history in a larger, slower database. |
| 847 scoped_ptr<ArchivedDatabase> archived_db_; | 840 scoped_ptr<ArchivedDatabase> archived_db_; |
| 848 | 841 |
| 849 // Helper to collect page data for vending to history_publisher_. | |
| 850 scoped_ptr<PageCollector> page_collector_; | |
| 851 | |
| 852 // Manages expiration between the various databases. | 842 // Manages expiration between the various databases. |
| 853 ExpireHistoryBackend expirer_; | 843 ExpireHistoryBackend expirer_; |
| 854 | 844 |
| 855 // A commit has been scheduled to occur sometime in the future. We can check | 845 // A commit has been scheduled to occur sometime in the future. We can check |
| 856 // non-null-ness to see if there is a commit scheduled in the future, and we | 846 // non-null-ness to see if there is a commit scheduled in the future, and we |
| 857 // can use the pointer to cancel the scheduled commit. There can be only one | 847 // can use the pointer to cancel the scheduled commit. There can be only one |
| 858 // scheduled commit at a time (see ScheduleCommit). | 848 // scheduled commit at a time (see ScheduleCommit). |
| 859 scoped_refptr<CommitLaterTask> scheduled_commit_; | 849 scoped_refptr<CommitLaterTask> scheduled_commit_; |
| 860 | 850 |
| 861 // Maps recent redirect destination pages to the chain of redirects that | 851 // Maps recent redirect destination pages to the chain of redirects that |
| (...skipping 26 matching lines...) Expand all Loading... |
| 888 // done. | 878 // done. |
| 889 std::list<HistoryDBTaskRequest*> db_task_requests_; | 879 std::list<HistoryDBTaskRequest*> db_task_requests_; |
| 890 | 880 |
| 891 // Used to determine if a URL is bookmarked. This is owned by the Profile and | 881 // Used to determine if a URL is bookmarked. This is owned by the Profile and |
| 892 // may be NULL (during testing). | 882 // may be NULL (during testing). |
| 893 // | 883 // |
| 894 // Use GetBookmarkService to access this, which makes sure the service is | 884 // Use GetBookmarkService to access this, which makes sure the service is |
| 895 // loaded. | 885 // loaded. |
| 896 BookmarkService* bookmark_service_; | 886 BookmarkService* bookmark_service_; |
| 897 | 887 |
| 898 // Publishes the history to all indexers which are registered to receive | |
| 899 // history data from us. Can be NULL if there are no listeners. | |
| 900 scoped_ptr<HistoryPublisher> history_publisher_; | |
| 901 | |
| 902 #if defined(OS_ANDROID) | 888 #if defined(OS_ANDROID) |
| 903 // Used to provide the Android ContentProvider APIs. | 889 // Used to provide the Android ContentProvider APIs. |
| 904 scoped_ptr<AndroidProviderBackend> android_provider_backend_; | 890 scoped_ptr<AndroidProviderBackend> android_provider_backend_; |
| 905 | 891 |
| 906 // Used to provide UMA on the number of page visits that are to the most | 892 // Used to provide UMA on the number of page visits that are to the most |
| 907 // visited URLs. This is here because the backend both has access to this | 893 // visited URLs. This is here because the backend both has access to this |
| 908 // information and is notified of page visits. The top sites service should | 894 // information and is notified of page visits. The top sites service should |
| 909 // be used instead whenever possible. | 895 // be used instead whenever possible. |
| 910 std::map<GURL, int> most_visited_urls_map_; | 896 std::map<GURL, int> most_visited_urls_map_; |
| 911 #endif | 897 #endif |
| 912 | 898 |
| 913 // Used to manage syncing of the typed urls datatype. This will be NULL | 899 // Used to manage syncing of the typed urls datatype. This will be NULL |
| 914 // before Init is called. | 900 // before Init is called. |
| 915 scoped_ptr<TypedUrlSyncableService> typed_url_syncable_service_; | 901 scoped_ptr<TypedUrlSyncableService> typed_url_syncable_service_; |
| 916 | 902 |
| 917 // Listens for the system being under memory pressure. | 903 // Listens for the system being under memory pressure. |
| 918 scoped_ptr<base::MemoryPressureListener> memory_pressure_listener_; | 904 scoped_ptr<base::MemoryPressureListener> memory_pressure_listener_; |
| 919 | 905 |
| 920 DISALLOW_COPY_AND_ASSIGN(HistoryBackend); | 906 DISALLOW_COPY_AND_ASSIGN(HistoryBackend); |
| 921 }; | 907 }; |
| 922 | 908 |
| 923 } // namespace history | 909 } // namespace history |
| 924 | 910 |
| 925 #endif // CHROME_BROWSER_HISTORY_HISTORY_BACKEND_H_ | 911 #endif // CHROME_BROWSER_HISTORY_HISTORY_BACKEND_H_ |
| OLD | NEW |