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