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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 // be forwarded to the HistoryServiceObservers in the correct thread. | 137 // be forwarded to the HistoryServiceObservers in the correct thread. |
138 virtual void NotifyURLVisited(ui::PageTransition transition, | 138 virtual void NotifyURLVisited(ui::PageTransition transition, |
139 const URLRow& row, | 139 const URLRow& row, |
140 const RedirectList& redirects, | 140 const RedirectList& redirects, |
141 base::Time visit_time) = 0; | 141 base::Time visit_time) = 0; |
142 | 142 |
143 // Notify HistoryService that some URLs have been modified. The event will | 143 // Notify HistoryService that some URLs have been modified. The event will |
144 // be forwarded to the HistoryServiceObservers in the correct thread. | 144 // be forwarded to the HistoryServiceObservers in the correct thread. |
145 virtual void NotifyURLsModified(const URLRows& changed_urls) = 0; | 145 virtual void NotifyURLsModified(const URLRows& changed_urls) = 0; |
146 | 146 |
| 147 // Notify HistoryService that some or all of the URLs have been deleted. |
| 148 // The event will be forwarded to the HistoryServiceObservers in the correct |
| 149 // thread. |
| 150 virtual void NotifyURLsDeleted(bool all_history, |
| 151 bool expired, |
| 152 const URLRows& deleted_rows, |
| 153 const std::set<GURL>& favicon_urls) = 0; |
| 154 |
147 // Notify HistoryService that some keyword has been searched using omnibox. | 155 // Notify HistoryService that some keyword has been searched using omnibox. |
148 // The event will be forwarded to the HistoryServiceObservers in the correct | 156 // The event will be forwarded to the HistoryServiceObservers in the correct |
149 // thread. | 157 // thread. |
150 virtual void NotifyKeywordSearchTermUpdated(const URLRow& row, | 158 virtual void NotifyKeywordSearchTermUpdated(const URLRow& row, |
151 KeywordID keyword_id, | 159 KeywordID keyword_id, |
152 const base::string16& term) = 0; | 160 const base::string16& term) = 0; |
153 | 161 |
154 // Notify HistoryService that keyword search term has been deleted. | 162 // Notify HistoryService that keyword search term has been deleted. |
155 // The event will be forwarded to the HistoryServiceObservers in the correct | 163 // The event will be forwarded to the HistoryServiceObservers in the correct |
156 // thread. | 164 // thread. |
157 virtual void NotifyKeywordSearchTermDeleted(URLID url_id) = 0; | 165 virtual void NotifyKeywordSearchTermDeleted(URLID url_id) = 0; |
158 | 166 |
159 // Broadcasts the specified notification to the notification service. | |
160 // This is implemented here because notifications must only be sent from | |
161 // the main thread. This is the only method that doesn't identify the | |
162 // caller because notifications must always be sent. | |
163 virtual void BroadcastNotifications(int type, | |
164 scoped_ptr<HistoryDetails> details) = 0; | |
165 | |
166 // Invoked when the backend has finished loading the db. | 167 // Invoked when the backend has finished loading the db. |
167 virtual void DBLoaded() = 0; | 168 virtual void DBLoaded() = 0; |
168 }; | 169 }; |
169 | 170 |
170 // Init must be called to complete object creation. This object can be | 171 // Init must be called to complete object creation. This object can be |
171 // constructed on any thread, but all other functions including Init() must | 172 // constructed on any thread, but all other functions including Init() must |
172 // be called on the history thread. | 173 // be called on the history thread. |
173 // | 174 // |
174 // |history_dir| is the directory where the history files will be placed. | 175 // |history_dir| is the directory where the history files will be placed. |
175 // See the definition of BroadcastNotificationsCallback above. This function | 176 // See the definition of BroadcastNotificationsCallback above. This function |
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
590 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, GetFaviconsFromDBIconType); | 591 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, GetFaviconsFromDBIconType); |
591 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, GetFaviconsFromDBExpired); | 592 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, GetFaviconsFromDBExpired); |
592 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, | 593 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, |
593 UpdateFaviconMappingsAndFetchNoDB); | 594 UpdateFaviconMappingsAndFetchNoDB); |
594 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, | 595 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, |
595 CloneFaviconIsRestrictedToSameDomain); | 596 CloneFaviconIsRestrictedToSameDomain); |
596 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, QueryFilteredURLs); | 597 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, QueryFilteredURLs); |
597 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, UpdateVisitDuration); | 598 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, UpdateVisitDuration); |
598 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, ExpireHistoryForTimes); | 599 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, ExpireHistoryForTimes); |
599 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, DeleteFTSIndexDatabases); | 600 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, DeleteFTSIndexDatabases); |
600 | 601 FRIEND_TEST_ALL_PREFIXES(ProfileSyncServiceTypedUrlTest, |
| 602 ProcessUserChangeRemove); |
601 friend class ::TestingProfile; | 603 friend class ::TestingProfile; |
602 | 604 |
603 // Computes the name of the specified database on disk. | 605 // Computes the name of the specified database on disk. |
604 base::FilePath GetArchivedFileName() const; | 606 base::FilePath GetArchivedFileName() const; |
605 base::FilePath GetThumbnailFileName() const; | 607 base::FilePath GetThumbnailFileName() const; |
606 | 608 |
607 // Returns the name of the Favicons database. This is the new name | 609 // Returns the name of the Favicons database. This is the new name |
608 // of the Thumbnails database. | 610 // of the Thumbnails database. |
609 base::FilePath GetFaviconsFileName() const; | 611 base::FilePath GetFaviconsFileName() const; |
610 | 612 |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
791 // redirects. | 793 // redirects. |
792 void SendFaviconChangedNotificationForPageAndRedirects( | 794 void SendFaviconChangedNotificationForPageAndRedirects( |
793 const GURL& page_url); | 795 const GURL& page_url); |
794 | 796 |
795 // Generic stuff ------------------------------------------------------------- | 797 // Generic stuff ------------------------------------------------------------- |
796 | 798 |
797 // Processes the next scheduled HistoryDBTask, scheduling this method | 799 // Processes the next scheduled HistoryDBTask, scheduling this method |
798 // to be invoked again if there are more tasks that need to run. | 800 // to be invoked again if there are more tasks that need to run. |
799 void ProcessDBTaskImpl(); | 801 void ProcessDBTaskImpl(); |
800 | 802 |
801 // Broadcasts the specified notification to the notification service on both | |
802 // the main thread and the history thread if a notification service is | |
803 // running. | |
804 void BroadcastNotifications(int type, scoped_ptr<HistoryDetails> details); | |
805 | |
806 // HistoryBackendNotifier: | 803 // HistoryBackendNotifier: |
807 void NotifyFaviconChanged(const std::set<GURL>& urls) override; | 804 void NotifyFaviconChanged(const std::set<GURL>& urls) override; |
808 void NotifyURLVisited(ui::PageTransition transition, | 805 void NotifyURLVisited(ui::PageTransition transition, |
809 const URLRow& row, | 806 const URLRow& row, |
810 const RedirectList& redirects, | 807 const RedirectList& redirects, |
811 base::Time visit_time) override; | 808 base::Time visit_time) override; |
812 void NotifyURLsModified(const URLRows& rows) override; | 809 void NotifyURLsModified(const URLRows& rows) override; |
813 void NotifyURLsDeleted(bool all_history, | 810 void NotifyURLsDeleted(bool all_history, |
814 bool expired, | 811 bool expired, |
815 const URLRows& rows, | 812 const URLRows& rows, |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
926 | 923 |
927 // List of observers | 924 // List of observers |
928 ObserverList<HistoryBackendObserver> observers_; | 925 ObserverList<HistoryBackendObserver> observers_; |
929 | 926 |
930 DISALLOW_COPY_AND_ASSIGN(HistoryBackend); | 927 DISALLOW_COPY_AND_ASSIGN(HistoryBackend); |
931 }; | 928 }; |
932 | 929 |
933 } // namespace history | 930 } // namespace history |
934 | 931 |
935 #endif // CHROME_BROWSER_HISTORY_HISTORY_BACKEND_H_ | 932 #endif // CHROME_BROWSER_HISTORY_HISTORY_BACKEND_H_ |
OLD | NEW |