| 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 | 55 |
| 56 namespace visitedlink { | 56 namespace visitedlink { |
| 57 class VisitedLinkMaster; | 57 class VisitedLinkMaster; |
| 58 } | 58 } |
| 59 | 59 |
| 60 namespace history { | 60 namespace history { |
| 61 | 61 |
| 62 class HistoryBackend; | 62 class HistoryBackend; |
| 63 class HistoryClient; | 63 class HistoryClient; |
| 64 class HistoryDatabase; | 64 class HistoryDatabase; |
| 65 struct HistoryDatabaseParams; |
| 65 class HistoryDBTask; | 66 class HistoryDBTask; |
| 66 class HistoryQueryTest; | 67 class HistoryQueryTest; |
| 67 class HistoryServiceObserver; | 68 class HistoryServiceObserver; |
| 68 class HistoryTest; | 69 class HistoryTest; |
| 69 class InMemoryHistoryBackend; | 70 class InMemoryHistoryBackend; |
| 70 class InMemoryURLIndex; | 71 class InMemoryURLIndex; |
| 71 class InMemoryURLIndexTest; | 72 class InMemoryURLIndexTest; |
| 72 class URLDatabase; | 73 class URLDatabase; |
| 73 class VisitFilter; | 74 class VisitFilter; |
| 74 struct DownloadRow; | 75 struct DownloadRow; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 95 // must be valid for the whole lifetime of |HistoryService|. | 96 // must be valid for the whole lifetime of |HistoryService|. |
| 96 explicit HistoryService(history::HistoryClient* client, Profile* profile); | 97 explicit HistoryService(history::HistoryClient* client, Profile* profile); |
| 97 // The empty constructor is provided only for testing. | 98 // The empty constructor is provided only for testing. |
| 98 HistoryService(); | 99 HistoryService(); |
| 99 | 100 |
| 100 ~HistoryService() override; | 101 ~HistoryService() override; |
| 101 | 102 |
| 102 // Initializes the history service, returning true on success. On false, do | 103 // Initializes the history service, returning true on success. On false, do |
| 103 // not call any other functions. The given directory will be used for storing | 104 // not call any other functions. The given directory will be used for storing |
| 104 // the history files. | 105 // the history files. |
| 105 bool Init(const base::FilePath& history_dir) { | 106 bool Init(const history::HistoryDatabaseParams& history_database_params) { |
| 106 return Init(history_dir, false); | 107 return Init(false, history_database_params); |
| 107 } | 108 } |
| 108 | 109 |
| 109 // Triggers the backend to load if it hasn't already, and then returns whether | 110 // Triggers the backend to load if it hasn't already, and then returns whether |
| 110 // it's finished loading. | 111 // it's finished loading. |
| 111 // Note: Virtual needed for mocking. | 112 // Note: Virtual needed for mocking. |
| 112 virtual bool BackendLoaded(); | 113 virtual bool BackendLoaded(); |
| 113 | 114 |
| 114 // Returns true if the backend has finished loading. | 115 // Returns true if the backend has finished loading. |
| 115 bool backend_loaded() const { return backend_loaded_; } | 116 bool backend_loaded() const { return backend_loaded_; } |
| 116 | 117 |
| (...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 559 // Implementation of content::NotificationObserver. | 560 // Implementation of content::NotificationObserver. |
| 560 void Observe(int type, | 561 void Observe(int type, |
| 561 const content::NotificationSource& source, | 562 const content::NotificationSource& source, |
| 562 const content::NotificationDetails& details) override; | 563 const content::NotificationDetails& details) override; |
| 563 | 564 |
| 564 // Implementation of visitedlink::VisitedLinkDelegate. | 565 // Implementation of visitedlink::VisitedLinkDelegate. |
| 565 void RebuildTable(const scoped_refptr<URLEnumerator>& enumerator) override; | 566 void RebuildTable(const scoped_refptr<URLEnumerator>& enumerator) override; |
| 566 | 567 |
| 567 // Low-level Init(). Same as the public version, but adds a |no_db| parameter | 568 // Low-level Init(). Same as the public version, but adds a |no_db| parameter |
| 568 // that is only set by unittests which causes the backend to not init its DB. | 569 // that is only set by unittests which causes the backend to not init its DB. |
| 569 bool Init(const base::FilePath& history_dir, bool no_db); | 570 bool Init(bool no_db, |
| 571 const history::HistoryDatabaseParams& history_database_params); |
| 570 | 572 |
| 571 // Called by the HistoryURLProvider class to schedule an autocomplete, it | 573 // Called by the HistoryURLProvider class to schedule an autocomplete, it |
| 572 // will be called back on the internal history thread with the history | 574 // will be called back on the internal history thread with the history |
| 573 // database so it can query. See history_autocomplete.cc for a diagram. | 575 // database so it can query. See history_autocomplete.cc for a diagram. |
| 574 void ScheduleAutocomplete(const base::Callback< | 576 void ScheduleAutocomplete(const base::Callback< |
| 575 void(history::HistoryBackend*, history::URLDatabase*)>& callback); | 577 void(history::HistoryBackend*, history::URLDatabase*)>& callback); |
| 576 | 578 |
| 577 // Broadcasts the given notification. This is called by the backend so that | 579 // Broadcasts the given notification. This is called by the backend so that |
| 578 // the notification will be broadcast on the main thread. | 580 // the notification will be broadcast on the main thread. |
| 579 void BroadcastNotificationsHelper( | 581 void BroadcastNotificationsHelper( |
| (...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 913 | 915 |
| 914 history::DeleteDirectiveHandler delete_directive_handler_; | 916 history::DeleteDirectiveHandler delete_directive_handler_; |
| 915 | 917 |
| 916 // All vended weak pointers are invalidated in Cleanup(). | 918 // All vended weak pointers are invalidated in Cleanup(). |
| 917 base::WeakPtrFactory<HistoryService> weak_ptr_factory_; | 919 base::WeakPtrFactory<HistoryService> weak_ptr_factory_; |
| 918 | 920 |
| 919 DISALLOW_COPY_AND_ASSIGN(HistoryService); | 921 DISALLOW_COPY_AND_ASSIGN(HistoryService); |
| 920 }; | 922 }; |
| 921 | 923 |
| 922 #endif // CHROME_BROWSER_HISTORY_HISTORY_SERVICE_H_ | 924 #endif // CHROME_BROWSER_HISTORY_HISTORY_SERVICE_H_ |
| OLD | NEW |