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

Side by Side Diff: chrome/browser/history/top_sites.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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_TOP_SITES_H_ 5 #ifndef CHROME_BROWSER_HISTORY_TOP_SITES_H_
6 #define CHROME_BROWSER_HISTORY_TOP_SITES_H_ 6 #define CHROME_BROWSER_HISTORY_TOP_SITES_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/gtest_prod_util.h" 10 #include "base/gtest_prod_util.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 54
55 // While testing the history system, we want to set the thumbnail to a piece 55 // While testing the history system, we want to set the thumbnail to a piece
56 // of static memory. 56 // of static memory.
57 virtual bool SetPageThumbnailToJPEGBytes( 57 virtual bool SetPageThumbnailToJPEGBytes(
58 const GURL& url, 58 const GURL& url,
59 const base::RefCountedMemory* memory, 59 const base::RefCountedMemory* memory,
60 const ThumbnailScore& score) = 0; 60 const ThumbnailScore& score) = 0;
61 61
62 typedef base::Callback<void(const MostVisitedURLList&)> 62 typedef base::Callback<void(const MostVisitedURLList&)>
63 GetMostVisitedURLsCallback; 63 GetMostVisitedURLsCallback;
64 typedef std::vector<GetMostVisitedURLsCallback> PendingCallbacks;
65 64
66 // Returns a list of most visited URLs via a callback. This may be invoked on 65 // Returns a list of most visited URLs via a callback, if
67 // any thread. 66 // |include_forced_urls| is false includes only non-forced URLs. This may be
68 // NOTE: the callback is called immediately if we have the data cached. If 67 // invoked on any thread. NOTE: the callback is called immediately if we have
69 // data is not available yet, callback will later be posted to the thread 68 // the data cached. If data is not available yet, callback will later be
70 // called this function. 69 // posted to the thread called this function.
71 virtual void GetMostVisitedURLs( 70 virtual void GetMostVisitedURLs(
72 const GetMostVisitedURLsCallback& callback) = 0; 71 const GetMostVisitedURLsCallback& callback,
72 bool include_forced_urls) = 0;
73 73
74 // Gets a thumbnail for a given page. Returns true iff we have the thumbnail. 74 // Gets a thumbnail for a given page. Returns true iff we have the thumbnail.
75 // This may be invoked on any thread. 75 // This may be invoked on any thread.
76 // If an exact thumbnail URL match fails, |prefix_match| specifies whether or 76 // If an exact thumbnail URL match fails, |prefix_match| specifies whether or
77 // not to try harder by matching the query thumbnail URL as URL prefix (as 77 // not to try harder by matching the query thumbnail URL as URL prefix (as
78 // defined by UrlIsPrefix()). 78 // defined by UrlIsPrefix()).
79 // As this method may be invoked on any thread the ref count needs to be 79 // As this method may be invoked on any thread the ref count needs to be
80 // incremented before this method returns, so this takes a scoped_refptr*. 80 // incremented before this method returns, so this takes a scoped_refptr*.
81 virtual bool GetPageThumbnail( 81 virtual bool GetPageThumbnail(
82 const GURL& url, 82 const GURL& url,
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 127
128 // Returns true if the given URL is known to the top sites service. 128 // Returns true if the given URL is known to the top sites service.
129 // This function also returns false if TopSites isn't loaded yet. 129 // This function also returns false if TopSites isn't loaded yet.
130 virtual bool IsKnownURL(const GURL& url) = 0; 130 virtual bool IsKnownURL(const GURL& url) = 0;
131 131
132 // Follows the cached redirect chain to convert any URL to its 132 // Follows the cached redirect chain to convert any URL to its
133 // canonical version. If no redirect chain is known for the URL, 133 // canonical version. If no redirect chain is known for the URL,
134 // return it without modification. 134 // return it without modification.
135 virtual const std::string& GetCanonicalURLString(const GURL& url) const = 0; 135 virtual const std::string& GetCanonicalURLString(const GURL& url) const = 0;
136 136
137 // Returns true if the top sites list is full (i.e. we already have the 137 // Returns true if the top sites list of non-forced URLs is full (i.e. we
138 // maximum number of top sites). This function also returns false if 138 // already have the maximum number of non-forced top sites). This function
139 // TopSites isn't loaded yet. 139 // also returns false if TopSites isn't loaded yet.
140 virtual bool IsFull() = 0; 140 virtual bool IsNonForcedFull() = 0;
141
142 // Returns true if the top sites list of forced URLs is full (i.e. we already
143 // have the maximum number of forced top sites). This function also returns
144 // false if TopSites isn't loaded yet.
145 virtual bool IsForcedFull() = 0;
141 146
142 virtual bool loaded() const = 0; 147 virtual bool loaded() const = 0;
143 148
144 // Returns the set of prepopulate pages. 149 // Returns the set of prepopulate pages.
145 virtual MostVisitedURLList GetPrepopulatePages() = 0; 150 virtual MostVisitedURLList GetPrepopulatePages() = 0;
146 151
147 struct PrepopulatedPage { 152 struct PrepopulatedPage {
148 // The string resource for the url. 153 // The string resource for the url.
149 int url_id; 154 int url_id;
150 // The string resource for the page title. 155 // The string resource for the page title.
(...skipping 14 matching lines...) Expand all
165 170
166 #if defined(OS_ANDROID) 171 #if defined(OS_ANDROID)
167 extern const TopSites::PrepopulatedPage kPrepopulatedPages[1]; 172 extern const TopSites::PrepopulatedPage kPrepopulatedPages[1];
168 #else 173 #else
169 extern const TopSites::PrepopulatedPage kPrepopulatedPages[2]; 174 extern const TopSites::PrepopulatedPage kPrepopulatedPages[2];
170 #endif 175 #endif
171 176
172 } // namespace history 177 } // namespace history
173 178
174 #endif // CHROME_BROWSER_HISTORY_TOP_SITES_H_ 179 #endif // CHROME_BROWSER_HISTORY_TOP_SITES_H_
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/top_sites/top_sites_apitest.cc ('k') | chrome/browser/history/top_sites_cache.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698