OLD | NEW |
---|---|
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 Loading... | |
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, includes only |
67 // any thread. | 66 // non-forced URLs. This may be invoked on any thread. |
68 // NOTE: the callback is called immediately if we have the data cached. If | 67 // NOTE: the callback is called immediately if we have the data cached. If |
69 // data is not available yet, callback will later be posted to the thread | 68 // data is not available yet, callback will later be posted to the thread |
70 // called this function. | 69 // called this function. |
71 virtual void GetMostVisitedURLs( | 70 virtual void GetMostVisitedURLs( |
72 const GetMostVisitedURLsCallback& callback) = 0; | 71 const GetMostVisitedURLsCallback& callback) = 0; |
73 | 72 |
73 // Implementation of GetMostVisitedURLs that can retrieve both forced and | |
74 // non-forced URLs. his may be invoked on any thread. | |
brettw
2013/11/08 22:56:07
Spelling "his"
beaudoin
2013/11/11 21:58:09
Done.
| |
75 virtual void GetAllMostVisitedURLs( | |
brettw
2013/11/08 22:56:07
I think that the new parameter should just be adde
beaudoin
2013/11/11 21:58:09
That's what I did first but there are surprisingly
brettw
2013/11/11 22:03:30
8 doesn't sound like many to me. For simple rename
| |
76 const GetMostVisitedURLsCallback& callback, | |
77 bool include_forced_urls) = 0; | |
78 | |
74 // Gets a thumbnail for a given page. Returns true iff we have the thumbnail. | 79 // Gets a thumbnail for a given page. Returns true iff we have the thumbnail. |
75 // This may be invoked on any thread. | 80 // This may be invoked on any thread. |
76 // If an exact thumbnail URL match fails, |prefix_match| specifies whether or | 81 // 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 | 82 // not to try harder by matching the query thumbnail URL as URL prefix (as |
78 // defined by UrlIsPrefix()). | 83 // defined by UrlIsPrefix()). |
79 // As this method may be invoked on any thread the ref count needs to be | 84 // 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*. | 85 // incremented before this method returns, so this takes a scoped_refptr*. |
81 virtual bool GetPageThumbnail( | 86 virtual bool GetPageThumbnail( |
82 const GURL& url, | 87 const GURL& url, |
83 bool prefix_match, | 88 bool prefix_match, |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
127 | 132 |
128 // Returns true if the given URL is known to the top sites service. | 133 // 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. | 134 // This function also returns false if TopSites isn't loaded yet. |
130 virtual bool IsKnownURL(const GURL& url) = 0; | 135 virtual bool IsKnownURL(const GURL& url) = 0; |
131 | 136 |
132 // Follows the cached redirect chain to convert any URL to its | 137 // Follows the cached redirect chain to convert any URL to its |
133 // canonical version. If no redirect chain is known for the URL, | 138 // canonical version. If no redirect chain is known for the URL, |
134 // return it without modification. | 139 // return it without modification. |
135 virtual const std::string& GetCanonicalURLString(const GURL& url) const = 0; | 140 virtual const std::string& GetCanonicalURLString(const GURL& url) const = 0; |
136 | 141 |
137 // Returns true if the top sites list is full (i.e. we already have the | 142 // 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 | 143 // already have the maximum number of non-forced top sites). This function |
139 // TopSites isn't loaded yet. | 144 // also returns false if TopSites isn't loaded yet. |
140 virtual bool IsFull() = 0; | 145 virtual bool IsNonForcedFull() = 0; |
146 | |
147 // Returns true if the top sites list of forced URLs is full (i.e. we already | |
148 // have the maximum number of forced top sites). This function also returns | |
149 // false if TopSites isn't loaded yet. | |
150 virtual bool IsForcedFull() = 0; | |
141 | 151 |
142 virtual bool loaded() const = 0; | 152 virtual bool loaded() const = 0; |
143 | 153 |
144 // Returns the set of prepopulate pages. | 154 // Returns the set of prepopulate pages. |
145 virtual MostVisitedURLList GetPrepopulatePages() = 0; | 155 virtual MostVisitedURLList GetPrepopulatePages() = 0; |
146 | 156 |
147 struct PrepopulatedPage { | 157 struct PrepopulatedPage { |
148 // The string resource for the url. | 158 // The string resource for the url. |
149 int url_id; | 159 int url_id; |
150 // The string resource for the page title. | 160 // The string resource for the page title. |
(...skipping 14 matching lines...) Expand all Loading... | |
165 | 175 |
166 #if defined(OS_ANDROID) | 176 #if defined(OS_ANDROID) |
167 extern const TopSites::PrepopulatedPage kPrepopulatedPages[1]; | 177 extern const TopSites::PrepopulatedPage kPrepopulatedPages[1]; |
168 #else | 178 #else |
169 extern const TopSites::PrepopulatedPage kPrepopulatedPages[2]; | 179 extern const TopSites::PrepopulatedPage kPrepopulatedPages[2]; |
170 #endif | 180 #endif |
171 | 181 |
172 } // namespace history | 182 } // namespace history |
173 | 183 |
174 #endif // CHROME_BROWSER_HISTORY_TOP_SITES_H_ | 184 #endif // CHROME_BROWSER_HISTORY_TOP_SITES_H_ |
OLD | NEW |