| 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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 // Sets the in-memory history backend. The in-memory backend is created by | 113 // Sets the in-memory history backend. The in-memory backend is created by |
| 114 // the main backend. For non-unit tests, this happens on the background | 114 // the main backend. For non-unit tests, this happens on the background |
| 115 // thread. It is to be used on the main thread, so this would transfer | 115 // thread. It is to be used on the main thread, so this would transfer |
| 116 // it to the history service. Unit tests can override this behavior. | 116 // it to the history service. Unit tests can override this behavior. |
| 117 // | 117 // |
| 118 // This function is NOT guaranteed to be called. If there is an error, | 118 // This function is NOT guaranteed to be called. If there is an error, |
| 119 // there may be no in-memory database. | 119 // there may be no in-memory database. |
| 120 virtual void SetInMemoryBackend( | 120 virtual void SetInMemoryBackend( |
| 121 scoped_ptr<InMemoryHistoryBackend> backend) = 0; | 121 scoped_ptr<InMemoryHistoryBackend> backend) = 0; |
| 122 | 122 |
| 123 // Notify HistoryService that VisitDatabase was changed. The event will be |
| 124 // forwarded to the history::HistoryServiceObservers in the UI thread. |
| 125 virtual void NotifyAddVisit(const history::BriefVisitInfo& info) = 0; |
| 126 |
| 123 // Notify HistoryService that some URLs favicon changed that will forward | 127 // Notify HistoryService that some URLs favicon changed that will forward |
| 124 // the events to the FaviconChangedObservers in the correct thread. | 128 // the events to the FaviconChangedObservers in the correct thread. |
| 125 virtual void NotifyFaviconChanged(const std::set<GURL>& urls) = 0; | 129 virtual void NotifyFaviconChanged(const std::set<GURL>& urls) = 0; |
| 126 | 130 |
| 127 // Broadcasts the specified notification to the notification service. | 131 // Broadcasts the specified notification to the notification service. |
| 128 // This is implemented here because notifications must only be sent from | 132 // This is implemented here because notifications must only be sent from |
| 129 // the main thread. This is the only method that doesn't identify the | 133 // the main thread. This is the only method that doesn't identify the |
| 130 // caller because notifications must always be sent. | 134 // caller because notifications must always be sent. |
| 131 virtual void BroadcastNotifications(int type, | 135 virtual void BroadcastNotifications(int type, |
| 132 scoped_ptr<HistoryDetails> details) = 0; | 136 scoped_ptr<HistoryDetails> details) = 0; |
| 133 | 137 |
| 134 // Invoked when the backend has finished loading the db. | 138 // Invoked when the backend has finished loading the db. |
| 135 virtual void DBLoaded() = 0; | 139 virtual void DBLoaded() = 0; |
| 136 | |
| 137 virtual void NotifyVisitDBObserversOnAddVisit( | |
| 138 const history::BriefVisitInfo& info) = 0; | |
| 139 }; | 140 }; |
| 140 | 141 |
| 141 // Init must be called to complete object creation. This object can be | 142 // Init must be called to complete object creation. This object can be |
| 142 // constructed on any thread, but all other functions including Init() must | 143 // constructed on any thread, but all other functions including Init() must |
| 143 // be called on the history thread. | 144 // be called on the history thread. |
| 144 // | 145 // |
| 145 // |history_dir| is the directory where the history files will be placed. | 146 // |history_dir| is the directory where the history files will be placed. |
| 146 // See the definition of BroadcastNotificationsCallback above. This function | 147 // See the definition of BroadcastNotificationsCallback above. This function |
| 147 // takes ownership of the callback pointer. | 148 // takes ownership of the callback pointer. |
| 148 // | 149 // |
| (...skipping 743 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 892 | 893 |
| 893 // Listens for the system being under memory pressure. | 894 // Listens for the system being under memory pressure. |
| 894 scoped_ptr<base::MemoryPressureListener> memory_pressure_listener_; | 895 scoped_ptr<base::MemoryPressureListener> memory_pressure_listener_; |
| 895 | 896 |
| 896 DISALLOW_COPY_AND_ASSIGN(HistoryBackend); | 897 DISALLOW_COPY_AND_ASSIGN(HistoryBackend); |
| 897 }; | 898 }; |
| 898 | 899 |
| 899 } // namespace history | 900 } // namespace history |
| 900 | 901 |
| 901 #endif // CHROME_BROWSER_HISTORY_HISTORY_BACKEND_H_ | 902 #endif // CHROME_BROWSER_HISTORY_HISTORY_BACKEND_H_ |
| OLD | NEW |