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

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: Corrected minor spacing problem. 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
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 0ce730848c5178ae48d2d19f9723bc79bfca629b..e133f5f02eebc50c13c41de8ed1ab2c0ef713314 100644
--- a/chrome/browser/history/top_sites_cache.h
+++ b/chrome/browser/history/top_sites_cache.h
@@ -45,7 +45,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_; }
@@ -86,6 +87,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 GetNbNonForcedURLs() const;
brettw 2013/11/08 22:56:07 "Nb"?
beaudoin 2013/11/11 21:58:09 Done.
+
+ // Returns the number of forced URLs in the cache.
+ size_t GetNbForcedURLs() const;
+
private:
// The entries in CanonicalURLs, see CanonicalURLs for details. The second
// argument gives the index of the URL into MostVisitedURLs redirects.
@@ -124,6 +131,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();
@@ -136,7 +146,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 nb_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.

Powered by Google App Engine
This is Rietveld 408576698