| 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_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_HISTORY_HISTORY_SERVICE_H_ |
| 6 #define CHROME_BROWSER_HISTORY_HISTORY_SERVICE_H_ | 6 #define CHROME_BROWSER_HISTORY_HISTORY_SERVICE_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 #include "content/public/common/page_transition_types.h" | 33 #include "content/public/common/page_transition_types.h" |
| 34 #include "sql/init_status.h" | 34 #include "sql/init_status.h" |
| 35 #include "sync/api/syncable_service.h" | 35 #include "sync/api/syncable_service.h" |
| 36 #include "ui/base/layout.h" | 36 #include "ui/base/layout.h" |
| 37 | 37 |
| 38 #if defined(OS_ANDROID) | 38 #if defined(OS_ANDROID) |
| 39 #include "chrome/browser/history/android/android_history_provider_service.h" | 39 #include "chrome/browser/history/android/android_history_provider_service.h" |
| 40 #endif | 40 #endif |
| 41 | 41 |
| 42 class BookmarkService; | 42 class BookmarkService; |
| 43 class FilePath; | |
| 44 class GURL; | 43 class GURL; |
| 45 class HistoryURLProvider; | 44 class HistoryURLProvider; |
| 46 class PageUsageData; | 45 class PageUsageData; |
| 47 class PageUsageRequest; | 46 class PageUsageRequest; |
| 48 class Profile; | 47 class Profile; |
| 49 struct HistoryURLProviderParams; | 48 struct HistoryURLProviderParams; |
| 50 | 49 |
| 51 namespace base { | 50 namespace base { |
| 51 class FilePath; |
| 52 class Thread; | 52 class Thread; |
| 53 } | 53 } |
| 54 | 54 |
| 55 namespace components { | 55 namespace components { |
| 56 class VisitedLinkMaster; | 56 class VisitedLinkMaster; |
| 57 } // namespace components | 57 } // namespace components |
| 58 | 58 |
| 59 | 59 |
| 60 namespace history { | 60 namespace history { |
| 61 | 61 |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 explicit HistoryService(Profile* profile); | 122 explicit HistoryService(Profile* profile); |
| 123 // The empty constructor is provided only for testing. | 123 // The empty constructor is provided only for testing. |
| 124 HistoryService(); | 124 HistoryService(); |
| 125 | 125 |
| 126 virtual ~HistoryService(); | 126 virtual ~HistoryService(); |
| 127 | 127 |
| 128 // Initializes the history service, returning true on success. On false, do | 128 // Initializes the history service, returning true on success. On false, do |
| 129 // not call any other functions. The given directory will be used for storing | 129 // not call any other functions. The given directory will be used for storing |
| 130 // the history files. The BookmarkService is used when deleting URLs to | 130 // the history files. The BookmarkService is used when deleting URLs to |
| 131 // test if a URL is bookmarked; it may be NULL during testing. | 131 // test if a URL is bookmarked; it may be NULL during testing. |
| 132 bool Init(const FilePath& history_dir, BookmarkService* bookmark_service) { | 132 bool Init(const base::FilePath& history_dir, BookmarkService* bookmark_service
) { |
| 133 return Init(history_dir, bookmark_service, false); | 133 return Init(history_dir, bookmark_service, false); |
| 134 } | 134 } |
| 135 | 135 |
| 136 // Triggers the backend to load if it hasn't already, and then returns whether | 136 // Triggers the backend to load if it hasn't already, and then returns whether |
| 137 // it's finished loading. | 137 // it's finished loading. |
| 138 // Note: Virtual needed for mocking. | 138 // Note: Virtual needed for mocking. |
| 139 virtual bool BackendLoaded(); | 139 virtual bool BackendLoaded(); |
| 140 | 140 |
| 141 // Returns true if the backend has finished loading. | 141 // Returns true if the backend has finished loading. |
| 142 bool backend_loaded() const { return backend_loaded_; } | 142 bool backend_loaded() const { return backend_loaded_; } |
| (...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 659 virtual void Observe(int type, | 659 virtual void Observe(int type, |
| 660 const content::NotificationSource& source, | 660 const content::NotificationSource& source, |
| 661 const content::NotificationDetails& details) OVERRIDE; | 661 const content::NotificationDetails& details) OVERRIDE; |
| 662 | 662 |
| 663 // Implementation of components::VisitedLinkDelegate. | 663 // Implementation of components::VisitedLinkDelegate. |
| 664 virtual void RebuildTable( | 664 virtual void RebuildTable( |
| 665 const scoped_refptr<URLEnumerator>& enumerator) OVERRIDE; | 665 const scoped_refptr<URLEnumerator>& enumerator) OVERRIDE; |
| 666 | 666 |
| 667 // Low-level Init(). Same as the public version, but adds a |no_db| parameter | 667 // Low-level Init(). Same as the public version, but adds a |no_db| parameter |
| 668 // that is only set by unittests which causes the backend to not init its DB. | 668 // that is only set by unittests which causes the backend to not init its DB. |
| 669 bool Init(const FilePath& history_dir, | 669 bool Init(const base::FilePath& history_dir, |
| 670 BookmarkService* bookmark_service, | 670 BookmarkService* bookmark_service, |
| 671 bool no_db); | 671 bool no_db); |
| 672 | 672 |
| 673 // Called by the HistoryURLProvider class to schedule an autocomplete, it | 673 // Called by the HistoryURLProvider class to schedule an autocomplete, it |
| 674 // will be called back on the internal history thread with the history | 674 // will be called back on the internal history thread with the history |
| 675 // database so it can query. See history_autocomplete.cc for a diagram. | 675 // database so it can query. See history_autocomplete.cc for a diagram. |
| 676 void ScheduleAutocomplete(HistoryURLProvider* provider, | 676 void ScheduleAutocomplete(HistoryURLProvider* provider, |
| 677 HistoryURLProviderParams* params); | 677 HistoryURLProviderParams* params); |
| 678 | 678 |
| 679 // Broadcasts the given notification. This is called by the backend so that | 679 // Broadcasts the given notification. This is called by the backend so that |
| (...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1087 | 1087 |
| 1088 // Has the backend finished loading? The backend is loaded once Init has | 1088 // Has the backend finished loading? The backend is loaded once Init has |
| 1089 // completed. | 1089 // completed. |
| 1090 bool backend_loaded_; | 1090 bool backend_loaded_; |
| 1091 | 1091 |
| 1092 // The id of the current backend. This is only valid when history_backend_ | 1092 // The id of the current backend. This is only valid when history_backend_ |
| 1093 // is not NULL. | 1093 // is not NULL. |
| 1094 int current_backend_id_; | 1094 int current_backend_id_; |
| 1095 | 1095 |
| 1096 // Cached values from Init(), used whenever we need to reload the backend. | 1096 // Cached values from Init(), used whenever we need to reload the backend. |
| 1097 FilePath history_dir_; | 1097 base::FilePath history_dir_; |
| 1098 BookmarkService* bookmark_service_; | 1098 BookmarkService* bookmark_service_; |
| 1099 bool no_db_; | 1099 bool no_db_; |
| 1100 | 1100 |
| 1101 // True if needs top site migration. | 1101 // True if needs top site migration. |
| 1102 bool needs_top_sites_migration_; | 1102 bool needs_top_sites_migration_; |
| 1103 | 1103 |
| 1104 // The index used for quick history lookups. | 1104 // The index used for quick history lookups. |
| 1105 // TODO(mrossetti): Move in_memory_url_index out of history_service. | 1105 // TODO(mrossetti): Move in_memory_url_index out of history_service. |
| 1106 // See http://crbug.com/138321 | 1106 // See http://crbug.com/138321 |
| 1107 scoped_ptr<history::InMemoryURLIndex> in_memory_url_index_; | 1107 scoped_ptr<history::InMemoryURLIndex> in_memory_url_index_; |
| 1108 | 1108 |
| 1109 ObserverList<history::VisitDatabaseObserver> visit_database_observers_; | 1109 ObserverList<history::VisitDatabaseObserver> visit_database_observers_; |
| 1110 | 1110 |
| 1111 DISALLOW_COPY_AND_ASSIGN(HistoryService); | 1111 DISALLOW_COPY_AND_ASSIGN(HistoryService); |
| 1112 }; | 1112 }; |
| 1113 | 1113 |
| 1114 #endif // CHROME_BROWSER_HISTORY_HISTORY_SERVICE_H_ | 1114 #endif // CHROME_BROWSER_HISTORY_HISTORY_SERVICE_H_ |
| OLD | NEW |