| Index: chrome/browser/history/top_sites.h
|
| diff --git a/chrome/browser/history/top_sites.h b/chrome/browser/history/top_sites.h
|
| index bd406f10a9f164847396d6342d397cdffdb567e4..361fde83154a6975b1a376a65feb110ebd356abb 100644
|
| --- a/chrome/browser/history/top_sites.h
|
| +++ b/chrome/browser/history/top_sites.h
|
| @@ -13,10 +13,11 @@
|
| #include "base/basictypes.h"
|
| #include "base/gtest_prod_util.h"
|
| #include "base/lock.h"
|
| -#include "base/time.h"
|
| -#include "base/timer.h"
|
| #include "base/ref_counted.h"
|
| #include "base/ref_counted_memory.h"
|
| +#include "base/scoped_ptr.h"
|
| +#include "base/time.h"
|
| +#include "base/timer.h"
|
| #include "chrome/browser/browser_thread.h"
|
| #include "chrome/browser/cancelable_request.h"
|
| #include "chrome/browser/history/history_types.h"
|
| @@ -141,6 +142,10 @@ class TopSites
|
| const MostVisitedURLList& new_list,
|
| TopSitesDelta* delta);
|
|
|
| + // For use only in testing. Refreshes the top sites list and invokes the
|
| + // callback on the UI thread when done. Should be called on the UI thread.
|
| + void RefreshAndCallback(Callback0::Type* callback);
|
| +
|
| private:
|
| friend class base::RefCountedThreadSafe<TopSites>;
|
| friend class TopSitesTest;
|
| @@ -203,8 +208,12 @@ class TopSites
|
| const RefCountedBytes* thumbnail,
|
| const ThumbnailScore& score);
|
|
|
| - // Query history service for the list of available thumbnails.
|
| - void StartQueryForMostVisited();
|
| + // Query history service for the list of available thumbnails. Returns the
|
| + // handle for the request, or NULL if a request could not be made.
|
| + CancelableRequestProvider::Handle StartQueryForMostVisited();
|
| +
|
| + // Called by our timer. Starts the query for the most visited sites.
|
| + void TimerFired();
|
|
|
| // Finds the given URL in the redirect chain for the given TopSite, and
|
| // returns the distance from the destination in hops that the given URL is.
|
| @@ -291,6 +300,10 @@ class TopSites
|
| // pinned urls applied (|cache_| does not).
|
| scoped_ptr<TopSitesCache> thread_safe_cache_;
|
|
|
| + // Invokes the callback signaling the cache has been completely refreshed.
|
| + // This is only used for testing.
|
| + void InvokeRefreshCallback(CancelableRequestProvider::Handle handle);
|
| +
|
| Profile* profile_;
|
|
|
| // Lock used to access |thread_safe_cache_|.
|
| @@ -344,6 +357,14 @@ class TopSites
|
| // Are we loaded?
|
| bool loaded_;
|
|
|
| + // For testing use only. The history request handle that is being waited upon.
|
| + // Should be accessed on the UI thread.
|
| + CancelableRequestProvider::Handle handle_to_wait_for_;
|
| +
|
| + // For testing use only. The callback to invoke after a refresh has occurred.
|
| + // Should be accessed on the UI thread.
|
| + scoped_ptr<Callback0::Type> refresh_callback_;
|
| +
|
| DISALLOW_COPY_AND_ASSIGN(TopSites);
|
| };
|
|
|
|
|