Chromium Code Reviews| 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_H_ | 5 #ifndef CHROME_BROWSER_HISTORY_HISTORY_H_ |
| 6 #define CHROME_BROWSER_HISTORY_HISTORY_H_ | 6 #define CHROME_BROWSER_HISTORY_HISTORY_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <set> | 9 #include <set> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 149 void NotifyRenderProcessHostDestruction(const void* host); | 149 void NotifyRenderProcessHostDestruction(const void* host); |
| 150 | 150 |
| 151 // Triggers the backend to load if it hasn't already, and then returns the | 151 // Triggers the backend to load if it hasn't already, and then returns the |
| 152 // in-memory URL database. The returned pointer MAY BE NULL if the in-memory | 152 // in-memory URL database. The returned pointer MAY BE NULL if the in-memory |
| 153 // database has not been loaded yet. This pointer is owned by the history | 153 // database has not been loaded yet. This pointer is owned by the history |
| 154 // system. Callers should not store or cache this value. | 154 // system. Callers should not store or cache this value. |
| 155 // | 155 // |
| 156 // TODO(brettw) this should return the InMemoryHistoryBackend. | 156 // TODO(brettw) this should return the InMemoryHistoryBackend. |
| 157 history::URLDatabase* InMemoryDatabase(); | 157 history::URLDatabase* InMemoryDatabase(); |
| 158 | 158 |
| 159 // Return the quick history index. | 159 // Returns the history database if it has been set, otherwise NULL. |
| 160 history::InMemoryURLIndex* InMemoryIndex(); | 160 history::URLDatabase* HistoryDatabase(); |
| 161 | 161 |
| 162 // Navigation ---------------------------------------------------------------- | 162 // Navigation ---------------------------------------------------------------- |
| 163 | 163 |
| 164 // Adds the given canonical URL to history with the current time as the visit | 164 // Adds the given canonical URL to history with the current time as the visit |
| 165 // time. Referrer may be the empty string. | 165 // time. Referrer may be the empty string. |
| 166 // | 166 // |
| 167 // The supplied render process host is used to scope the given page ID. Page | 167 // The supplied render process host is used to scope the given page ID. Page |
| 168 // IDs are only unique inside a given render process, so we need that to | 168 // IDs are only unique inside a given render process, so we need that to |
| 169 // differentiate them. This pointer should not be dereferenced by the history | 169 // differentiate them. This pointer should not be dereferenced by the history |
| 170 // system. Since render view host pointers may be reused (if one gets deleted | 170 // system. Since render view host pointers may be reused (if one gets deleted |
| (...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 508 // specified text. The matching is case insensitive. The results are ordered | 508 // specified text. The matching is case insensitive. The results are ordered |
| 509 // in descending order up to |max_count| with the most recent search term | 509 // in descending order up to |max_count| with the most recent search term |
| 510 // first. | 510 // first. |
| 511 Handle GetMostRecentKeywordSearchTerms( | 511 Handle GetMostRecentKeywordSearchTerms( |
| 512 TemplateURLID keyword_id, | 512 TemplateURLID keyword_id, |
| 513 const string16& prefix, | 513 const string16& prefix, |
| 514 int max_count, | 514 int max_count, |
| 515 CancelableRequestConsumerBase* consumer, | 515 CancelableRequestConsumerBase* consumer, |
| 516 const GetMostRecentKeywordSearchTermsCallback& callback); | 516 const GetMostRecentKeywordSearchTermsCallback& callback); |
| 517 | 517 |
| 518 // InMemoryURLIndex ---------------------------------------------------------- | |
| 519 | |
| 520 // Returns the quick history index. | |
| 521 history::InMemoryURLIndex* InMemoryIndex() const; | |
|
Peter Kasting
2011/11/21 19:07:50
Nit: const mehtods should not return non-const poi
mrossetti
2011/11/21 21:53:25
Done.
| |
| 522 | |
| 518 // Bookmarks ----------------------------------------------------------------- | 523 // Bookmarks ----------------------------------------------------------------- |
| 519 | 524 |
| 520 // Notification that a URL is no longer bookmarked. | 525 // Notification that a URL is no longer bookmarked. |
| 521 void URLsNoLongerBookmarked(const std::set<GURL>& urls); | 526 void URLsNoLongerBookmarked(const std::set<GURL>& urls); |
| 522 | 527 |
| 523 // Generic Stuff ------------------------------------------------------------- | 528 // Generic Stuff ------------------------------------------------------------- |
| 524 | 529 |
| 525 // Schedules a HistoryDBTask for running on the history backend thread. See | 530 // Schedules a HistoryDBTask for running on the history backend thread. See |
| 526 // HistoryDBTask for details on what this does. | 531 // HistoryDBTask for details on what this does. |
| 527 virtual void ScheduleDBTask(HistoryDBTask* task, | 532 virtual void ScheduleDBTask(HistoryDBTask* task, |
| (...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 847 // | 852 // |
| 848 // This pointer will be NULL once Cleanup() has been called, meaning no | 853 // This pointer will be NULL once Cleanup() has been called, meaning no |
| 849 // more calls should be made to the history thread. | 854 // more calls should be made to the history thread. |
| 850 scoped_refptr<history::HistoryBackend> history_backend_; | 855 scoped_refptr<history::HistoryBackend> history_backend_; |
| 851 | 856 |
| 852 // A cache of the user-typed URLs kept in memory that is used by the | 857 // A cache of the user-typed URLs kept in memory that is used by the |
| 853 // autocomplete system. This will be NULL until the database has been created | 858 // autocomplete system. This will be NULL until the database has been created |
| 854 // on the background thread. | 859 // on the background thread. |
| 855 scoped_ptr<history::InMemoryHistoryBackend> in_memory_backend_; | 860 scoped_ptr<history::InMemoryHistoryBackend> in_memory_backend_; |
| 856 | 861 |
| 862 // The index used for quick history lookups. | |
| 863 scoped_ptr<history::InMemoryURLIndex> in_memory_url_index_; | |
| 864 | |
| 857 // The profile, may be null when testing. | 865 // The profile, may be null when testing. |
| 858 Profile* profile_; | 866 Profile* profile_; |
| 859 | 867 |
| 860 // Has the backend finished loading? The backend is loaded once Init has | 868 // Has the backend finished loading? The backend is loaded once Init has |
| 861 // completed. | 869 // completed. |
| 862 bool backend_loaded_; | 870 bool backend_loaded_; |
| 863 | 871 |
| 864 // The id of the current backend. This is only valid when history_backend_ | 872 // The id of the current backend. This is only valid when history_backend_ |
| 865 // is not NULL. | 873 // is not NULL. |
| 866 int current_backend_id_; | 874 int current_backend_id_; |
| 867 | 875 |
| 868 // Cached values from Init(), used whenever we need to reload the backend. | 876 // Cached values from Init(), used whenever we need to reload the backend. |
| 869 FilePath history_dir_; | 877 FilePath history_dir_; |
| 870 BookmarkService* bookmark_service_; | 878 BookmarkService* bookmark_service_; |
| 871 bool no_db_; | 879 bool no_db_; |
| 872 | 880 |
| 873 // True if needs top site migration. | 881 // True if needs top site migration. |
| 874 bool needs_top_sites_migration_; | 882 bool needs_top_sites_migration_; |
| 875 | 883 |
| 876 DISALLOW_COPY_AND_ASSIGN(HistoryService); | 884 DISALLOW_COPY_AND_ASSIGN(HistoryService); |
| 877 }; | 885 }; |
| 878 | 886 |
| 879 #endif // CHROME_BROWSER_HISTORY_HISTORY_H_ | 887 #endif // CHROME_BROWSER_HISTORY_HISTORY_H_ |
| OLD | NEW |