| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_VISITEDLINK_VISITEDLINK_DELEGATE_H_ | |
| 6 #define CHROME_BROWSER_VISITEDLINK_VISITEDLINK_DELEGATE_H_ | |
| 7 | |
| 8 #include "base/memory/ref_counted.h" | |
| 9 | |
| 10 class GURL; | |
| 11 | |
| 12 namespace content { | |
| 13 class BrowserContext; | |
| 14 } // namespace content | |
| 15 | |
| 16 // Delegate class that clients of VisitedLinkMaster must implement. | |
| 17 class VisitedLinkDelegate { | |
| 18 public: | |
| 19 // Returns true when the two BrowserContexts are equivalent. | |
| 20 virtual bool AreEquivalentContexts(content::BrowserContext* context1, | |
| 21 content::BrowserContext* context2) = 0; | |
| 22 | |
| 23 // See RebuildTable. | |
| 24 class URLEnumerator : public base::RefCountedThreadSafe<URLEnumerator> { | |
| 25 public: | |
| 26 // Call this with each URL to rebuild the table. | |
| 27 virtual void OnURL(const GURL& url) = 0; | |
| 28 | |
| 29 // This must be called by Delegate after RebuildTable is called. |success| | |
| 30 // indicates all URLs have been returned successfully. The URLEnumerator | |
| 31 // object cannot be used by the delegate after this call. | |
| 32 virtual void OnComplete(bool success) = 0; | |
| 33 | |
| 34 protected: | |
| 35 virtual ~URLEnumerator() {} | |
| 36 | |
| 37 private: | |
| 38 friend class base::RefCountedThreadSafe<URLEnumerator>; | |
| 39 }; | |
| 40 | |
| 41 // Delegate class is responsible for persisting the list of visited URLs | |
| 42 // across browser runs. This is called by VisitedLinkMaster to repopulate | |
| 43 // its internal table. Note that methods on enumerator can be called on any | |
| 44 // thread but the delegate is responsible for synchronizating the calls. | |
| 45 virtual void RebuildTable(scoped_refptr<URLEnumerator> enumerator) = 0; | |
| 46 | |
| 47 protected: | |
| 48 | |
| 49 virtual ~VisitedLinkDelegate() {} | |
| 50 }; | |
| 51 | |
| 52 #endif // CHROME_BROWSER_VISITEDLINK_VISITEDLINK_DELEGATE_H_ | |
| OLD | NEW |