| 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_H_ | 5 #ifndef CHROME_BROWSER_HISTORY_HISTORY_H_ |
| 6 #define CHROME_BROWSER_HISTORY_HISTORY_H_ | 6 #define CHROME_BROWSER_HISTORY_HISTORY_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/bind.h" | 12 #include "base/bind.h" |
| 13 #include "base/callback.h" | 13 #include "base/callback.h" |
| 14 #include "base/file_path.h" | 14 #include "base/file_path.h" |
| 15 #include "base/logging.h" | 15 #include "base/logging.h" |
| 16 #include "base/memory/ref_counted.h" | 16 #include "base/memory/ref_counted.h" |
| 17 #include "base/memory/scoped_ptr.h" | 17 #include "base/memory/scoped_ptr.h" |
| 18 #include "base/memory/weak_ptr.h" | 18 #include "base/memory/weak_ptr.h" |
| 19 #include "base/observer_list.h" | 19 #include "base/observer_list.h" |
| 20 #include "base/string16.h" | 20 #include "base/string16.h" |
| 21 #include "base/time.h" | 21 #include "base/time.h" |
| 22 #include "base/threading/thread_checker.h" | 22 #include "base/threading/thread_checker.h" |
| 23 #include "chrome/browser/common/cancelable_request.h" | 23 #include "chrome/browser/common/cancelable_request.h" |
| 24 #include "chrome/browser/favicon/favicon_service.h" | 24 #include "chrome/browser/favicon/favicon_service.h" |
| 25 #include "chrome/browser/history/history_types.h" | 25 #include "chrome/browser/history/history_types.h" |
| 26 #include "chrome/browser/profiles/profile_keyed_service.h" | 26 #include "chrome/browser/profiles/profile_keyed_service.h" |
| 27 #include "chrome/browser/search_engines/template_url_id.h" | 27 #include "chrome/browser/search_engines/template_url_id.h" |
| 28 #include "chrome/browser/visitedlink/visitedlink_delegate.h" | |
| 29 #include "chrome/common/cancelable_task_tracker.h" | 28 #include "chrome/common/cancelable_task_tracker.h" |
| 30 #include "chrome/common/ref_counted_util.h" | 29 #include "chrome/common/ref_counted_util.h" |
| 30 #include "components/visitedlink/browser/visitedlink_delegate.h" |
| 31 #include "content/public/browser/notification_observer.h" | 31 #include "content/public/browser/notification_observer.h" |
| 32 #include "content/public/browser/notification_registrar.h" | 32 #include "content/public/browser/notification_registrar.h" |
| 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; | 43 class FilePath; |
| 44 class GURL; | 44 class GURL; |
| 45 class HistoryURLProvider; | 45 class HistoryURLProvider; |
| 46 class PageUsageData; | 46 class PageUsageData; |
| 47 class PageUsageRequest; | 47 class PageUsageRequest; |
| 48 class Profile; | 48 class Profile; |
| 49 class VisitedLinkMaster; | |
| 50 struct HistoryURLProviderParams; | 49 struct HistoryURLProviderParams; |
| 51 | 50 |
| 52 namespace base { | 51 namespace base { |
| 53 class Thread; | 52 class Thread; |
| 54 } | 53 } |
| 55 | 54 |
| 55 namespace components { |
| 56 class VisitedLinkMaster; |
| 57 } // namespace components |
| 58 |
| 56 | 59 |
| 57 namespace history { | 60 namespace history { |
| 58 | 61 |
| 59 class HistoryBackend; | 62 class HistoryBackend; |
| 60 class HistoryDatabase; | 63 class HistoryDatabase; |
| 61 class HistoryQueryTest; | 64 class HistoryQueryTest; |
| 62 class InMemoryHistoryBackend; | 65 class InMemoryHistoryBackend; |
| 63 class InMemoryURLIndex; | 66 class InMemoryURLIndex; |
| 64 class InMemoryURLIndexTest; | 67 class InMemoryURLIndexTest; |
| 65 class URLDatabase; | 68 class URLDatabase; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 | 106 |
| 104 // The history service records page titles, and visit times, as well as | 107 // The history service records page titles, and visit times, as well as |
| 105 // (eventually) information about autocomplete. | 108 // (eventually) information about autocomplete. |
| 106 // | 109 // |
| 107 // This service is thread safe. Each request callback is invoked in the | 110 // This service is thread safe. Each request callback is invoked in the |
| 108 // thread that made the request. | 111 // thread that made the request. |
| 109 class HistoryService : public CancelableRequestProvider, | 112 class HistoryService : public CancelableRequestProvider, |
| 110 public content::NotificationObserver, | 113 public content::NotificationObserver, |
| 111 public syncer::SyncableService, | 114 public syncer::SyncableService, |
| 112 public ProfileKeyedService, | 115 public ProfileKeyedService, |
| 113 public VisitedLinkDelegate { | 116 public components::VisitedLinkDelegate { |
| 114 public: | 117 public: |
| 115 // Miscellaneous commonly-used types. | 118 // Miscellaneous commonly-used types. |
| 116 typedef std::vector<PageUsageData*> PageUsageDataList; | 119 typedef std::vector<PageUsageData*> PageUsageDataList; |
| 117 | 120 |
| 118 // Must call Init after construction. | 121 // Must call Init after construction. |
| 119 explicit HistoryService(Profile* profile); | 122 explicit HistoryService(Profile* profile); |
| 120 // The empty constructor is provided only for testing. | 123 // The empty constructor is provided only for testing. |
| 121 HistoryService(); | 124 HistoryService(); |
| 122 | 125 |
| 123 virtual ~HistoryService(); | 126 virtual ~HistoryService(); |
| (...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 650 template<typename Info, typename Callback> friend class DownloadRequest; | 653 template<typename Info, typename Callback> friend class DownloadRequest; |
| 651 friend class PageUsageRequest; | 654 friend class PageUsageRequest; |
| 652 friend class RedirectRequest; | 655 friend class RedirectRequest; |
| 653 friend class TestingProfile; | 656 friend class TestingProfile; |
| 654 | 657 |
| 655 // Implementation of content::NotificationObserver. | 658 // Implementation of content::NotificationObserver. |
| 656 virtual void Observe(int type, | 659 virtual void Observe(int type, |
| 657 const content::NotificationSource& source, | 660 const content::NotificationSource& source, |
| 658 const content::NotificationDetails& details) OVERRIDE; | 661 const content::NotificationDetails& details) OVERRIDE; |
| 659 | 662 |
| 660 // Implementation of VisitedLinkDelegate. | 663 // Implementation of components::VisitedLinkDelegate. |
| 661 virtual bool AreEquivalentContexts( | 664 virtual bool AreEquivalentContexts( |
| 662 content::BrowserContext* context1, | 665 content::BrowserContext* context1, |
| 663 content::BrowserContext* context2) OVERRIDE; | 666 content::BrowserContext* context2) OVERRIDE; |
| 664 virtual void RebuildTable(scoped_refptr<URLEnumerator> enumerator) OVERRIDE; | 667 virtual void RebuildTable(scoped_refptr<URLEnumerator> enumerator) OVERRIDE; |
| 665 | 668 |
| 666 // Low-level Init(). Same as the public version, but adds a |no_db| parameter | 669 // Low-level Init(). Same as the public version, but adds a |no_db| parameter |
| 667 // that is only set by unittests which causes the backend to not init its DB. | 670 // that is only set by unittests which causes the backend to not init its DB. |
| 668 bool Init(const FilePath& history_dir, | 671 bool Init(const FilePath& history_dir, |
| 669 BookmarkService* bookmark_service, | 672 BookmarkService* bookmark_service, |
| 670 bool no_db); | 673 bool no_db); |
| (...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1082 scoped_ptr<history::InMemoryHistoryBackend> in_memory_backend_; | 1085 scoped_ptr<history::InMemoryHistoryBackend> in_memory_backend_; |
| 1083 | 1086 |
| 1084 // Used to propagate local delete directives to sync. | 1087 // Used to propagate local delete directives to sync. |
| 1085 scoped_ptr<syncer::SyncChangeProcessor> sync_change_processor_; | 1088 scoped_ptr<syncer::SyncChangeProcessor> sync_change_processor_; |
| 1086 | 1089 |
| 1087 // The profile, may be null when testing. | 1090 // The profile, may be null when testing. |
| 1088 Profile* profile_; | 1091 Profile* profile_; |
| 1089 | 1092 |
| 1090 // Used for propagating link highlighting data across renderers. May be null | 1093 // Used for propagating link highlighting data across renderers. May be null |
| 1091 // in tests. | 1094 // in tests. |
| 1092 scoped_ptr<VisitedLinkMaster> visitedlink_master_; | 1095 scoped_ptr<components::VisitedLinkMaster> visitedlink_master_; |
| 1093 | 1096 |
| 1094 // Has the backend finished loading? The backend is loaded once Init has | 1097 // Has the backend finished loading? The backend is loaded once Init has |
| 1095 // completed. | 1098 // completed. |
| 1096 bool backend_loaded_; | 1099 bool backend_loaded_; |
| 1097 | 1100 |
| 1098 // The id of the current backend. This is only valid when history_backend_ | 1101 // The id of the current backend. This is only valid when history_backend_ |
| 1099 // is not NULL. | 1102 // is not NULL. |
| 1100 int current_backend_id_; | 1103 int current_backend_id_; |
| 1101 | 1104 |
| 1102 // Cached values from Init(), used whenever we need to reload the backend. | 1105 // Cached values from Init(), used whenever we need to reload the backend. |
| 1103 FilePath history_dir_; | 1106 FilePath history_dir_; |
| 1104 BookmarkService* bookmark_service_; | 1107 BookmarkService* bookmark_service_; |
| 1105 bool no_db_; | 1108 bool no_db_; |
| 1106 | 1109 |
| 1107 // True if needs top site migration. | 1110 // True if needs top site migration. |
| 1108 bool needs_top_sites_migration_; | 1111 bool needs_top_sites_migration_; |
| 1109 | 1112 |
| 1110 // The index used for quick history lookups. | 1113 // The index used for quick history lookups. |
| 1111 // TODO(mrossetti): Move in_memory_url_index out of history_service. | 1114 // TODO(mrossetti): Move in_memory_url_index out of history_service. |
| 1112 // See http://crbug.com/138321 | 1115 // See http://crbug.com/138321 |
| 1113 scoped_ptr<history::InMemoryURLIndex> in_memory_url_index_; | 1116 scoped_ptr<history::InMemoryURLIndex> in_memory_url_index_; |
| 1114 | 1117 |
| 1115 ObserverList<history::VisitDatabaseObserver> visit_database_observers_; | 1118 ObserverList<history::VisitDatabaseObserver> visit_database_observers_; |
| 1116 | 1119 |
| 1117 DISALLOW_COPY_AND_ASSIGN(HistoryService); | 1120 DISALLOW_COPY_AND_ASSIGN(HistoryService); |
| 1118 }; | 1121 }; |
| 1119 | 1122 |
| 1120 #endif // CHROME_BROWSER_HISTORY_HISTORY_H_ | 1123 #endif // CHROME_BROWSER_HISTORY_HISTORY_H_ |
| OLD | NEW |