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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <set> | 9 #include <set> |
10 #include <vector> | 10 #include <vector> |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 // discard it. | 246 // discard it. |
247 void SetPageContents(const GURL& url, const string16& contents); | 247 void SetPageContents(const GURL& url, const string16& contents); |
248 | 248 |
249 // Querying ------------------------------------------------------------------ | 249 // Querying ------------------------------------------------------------------ |
250 | 250 |
251 // Callback class that a client can implement to iterate over URLs. The | 251 // Callback class that a client can implement to iterate over URLs. The |
252 // callbacks WILL BE CALLED ON THE BACKGROUND THREAD! Your implementation | 252 // callbacks WILL BE CALLED ON THE BACKGROUND THREAD! Your implementation |
253 // should handle this appropriately. | 253 // should handle this appropriately. |
254 class URLEnumerator { | 254 class URLEnumerator { |
255 public: | 255 public: |
256 virtual ~URLEnumerator() {} | |
257 | |
258 // Indicates that a URL is available. There will be exactly one call for | 256 // Indicates that a URL is available. There will be exactly one call for |
259 // every URL in history. | 257 // every URL in history. |
260 virtual void OnURL(const GURL& url) = 0; | 258 virtual void OnURL(const GURL& url) = 0; |
261 | 259 |
262 // Indicates we are done iterating over URLs. Once called, there will be no | 260 // Indicates we are done iterating over URLs. Once called, there will be no |
263 // more callbacks made. This call is guaranteed to occur, even if there are | 261 // more callbacks made. This call is guaranteed to occur, even if there are |
264 // no URLs. If all URLs were iterated, success will be true. | 262 // no URLs. If all URLs were iterated, success will be true. |
265 virtual void OnComplete(bool success) = 0; | 263 virtual void OnComplete(bool success) = 0; |
| 264 |
| 265 protected: |
| 266 virtual ~URLEnumerator() {} |
266 }; | 267 }; |
267 | 268 |
268 // Enumerate all URLs in history. The given iterator will be owned by the | 269 // Enumerate all URLs in history. The given iterator will be owned by the |
269 // caller, so the caller should ensure it exists until OnComplete is called. | 270 // caller, so the caller should ensure it exists until OnComplete is called. |
270 // You should not generally use this since it will be slow to slurp all URLs | 271 // You should not generally use this since it will be slow to slurp all URLs |
271 // in from the database. It is designed for rebuilding the visited link | 272 // in from the database. It is designed for rebuilding the visited link |
272 // database from history. | 273 // database from history. |
273 void IterateURLs(URLEnumerator* iterator); | 274 void IterateURLs(URLEnumerator* iterator); |
274 | 275 |
275 // Returns the information about the requested URL. If the URL is found, | 276 // Returns the information about the requested URL. If the URL is found, |
(...skipping 674 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
950 // The index used for quick history lookups. | 951 // The index used for quick history lookups. |
951 scoped_ptr<history::InMemoryURLIndex> in_memory_url_index_; | 952 scoped_ptr<history::InMemoryURLIndex> in_memory_url_index_; |
952 | 953 |
953 scoped_refptr<ObserverListThreadSafe<history::VisitDatabaseObserver> > | 954 scoped_refptr<ObserverListThreadSafe<history::VisitDatabaseObserver> > |
954 visit_database_observers_; | 955 visit_database_observers_; |
955 | 956 |
956 DISALLOW_COPY_AND_ASSIGN(HistoryService); | 957 DISALLOW_COPY_AND_ASSIGN(HistoryService); |
957 }; | 958 }; |
958 | 959 |
959 #endif // CHROME_BROWSER_HISTORY_HISTORY_H_ | 960 #endif // CHROME_BROWSER_HISTORY_HISTORY_H_ |
OLD | NEW |