Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(887)

Unified Diff: chrome/browser/history/top_sites_cache.h

Issue 53283004: Adding support for forced URLs to TopSites. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Removed GetAllMostVisited. Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/history/top_sites.h ('k') | chrome/browser/history/top_sites_cache.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/history/top_sites_cache.h
diff --git a/chrome/browser/history/top_sites_cache.h b/chrome/browser/history/top_sites_cache.h
index f66d0f07f3cb2605914c10c791352c67c7a308c3..1269d3b8bb36bca2fafc0a76791090339c4bbde3 100644
--- a/chrome/browser/history/top_sites_cache.h
+++ b/chrome/browser/history/top_sites_cache.h
@@ -42,7 +42,8 @@ class TopSitesCache {
TopSitesCache();
~TopSitesCache();
- // The top sites.
+ // Set the top sites. In |top_sites| all forced URLs must appear before
+ // non-forced URLs. This is only checked in debug.
void SetTopSites(const MostVisitedURLList& top_sites);
const MostVisitedURLList& top_sites() const { return top_sites_; }
@@ -79,6 +80,12 @@ class TopSitesCache {
// Returns the index into |top_sites_| for |url|.
size_t GetURLIndex(const GURL& url) const;
+ // Returns the number of non-forced URLs in the cache.
+ size_t GetNumNonForcedURLs() const;
+
+ // Returns the number of forced URLs in the cache.
+ size_t GetNumForcedURLs() const;
+
private:
// The entries in CanonicalURLs, see CanonicalURLs for details. The second
// argument gives the index of the URL into MostVisitedURLs redirects.
@@ -117,6 +124,9 @@ class TopSitesCache {
typedef std::map<CanonicalURLEntry, size_t,
CanonicalURLComparator> CanonicalURLs;
+ // Count the number of forced URLs.
+ void CountForcedURLs();
+
// Generates the set of canonical urls from |top_sites_|.
void GenerateCanonicalURLs();
@@ -129,7 +139,12 @@ class TopSitesCache {
// Returns the GURL corresponding to an iterator in |canonical_urls_|.
const GURL& GetURLFromIterator(CanonicalURLs::const_iterator it) const;
- // The top sites.
+ // The number of top sites with forced URLs.
+ size_t num_forced_urls_;
+
+ // The top sites. This list must always contain the forced URLs first followed
+ // by the non-forced URLs. This is not strictly enforced but is checked in
+ // debug.
MostVisitedURLList top_sites_;
// The images. These map from canonical url to image.
« no previous file with comments | « chrome/browser/history/top_sites.h ('k') | chrome/browser/history/top_sites_cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698