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_FAVICON_FAVICON_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_FAVICON_FAVICON_HANDLER_H_ |
6 #define CHROME_BROWSER_FAVICON_FAVICON_HANDLER_H_ | 6 #define CHROME_BROWSER_FAVICON_FAVICON_HANDLER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 | 131 |
132 // Asks the render to download favicon, returns the request id. | 132 // Asks the render to download favicon, returns the request id. |
133 virtual int DownloadFavicon(const GURL& image_url, int image_size); | 133 virtual int DownloadFavicon(const GURL& image_url, int image_size); |
134 | 134 |
135 // Ask the favicon from history | 135 // Ask the favicon from history |
136 virtual void UpdateFaviconMappingAndFetch( | 136 virtual void UpdateFaviconMappingAndFetch( |
137 const GURL& page_url, | 137 const GURL& page_url, |
138 const GURL& icon_url, | 138 const GURL& icon_url, |
139 history::IconType icon_type, | 139 history::IconType icon_type, |
140 CancelableRequestConsumerBase* consumer, | 140 CancelableRequestConsumerBase* consumer, |
141 const FaviconService::FaviconDataCallback& callback); | 141 const FaviconService::FaviconResultsCallback& callback); |
142 | 142 |
143 virtual void GetFavicon( | 143 virtual void GetFavicon( |
144 const GURL& icon_url, | 144 const GURL& icon_url, |
145 history::IconType icon_type, | 145 history::IconType icon_type, |
146 CancelableRequestConsumerBase* consumer, | 146 CancelableRequestConsumerBase* consumer, |
147 const FaviconService::FaviconDataCallback& callback); | 147 const FaviconService::FaviconResultsCallback& callback); |
148 | 148 |
149 virtual void GetFaviconForURL( | 149 virtual void GetFaviconForURL( |
150 const GURL& page_url, | 150 const GURL& page_url, |
151 int icon_types, | 151 int icon_types, |
152 CancelableRequestConsumerBase* consumer, | 152 CancelableRequestConsumerBase* consumer, |
153 const FaviconService::FaviconDataCallback& callback); | 153 const FaviconService::FaviconResultsCallback& callback); |
154 | 154 |
155 virtual void SetHistoryFavicon(const GURL& page_url, | 155 virtual void SetHistoryFavicon(const GURL& page_url, |
156 const GURL& icon_url, | 156 const GURL& icon_url, |
157 const std::vector<unsigned char>& image_data, | 157 const std::vector<unsigned char>& image_data, |
158 history::IconType icon_type); | 158 history::IconType icon_type); |
159 | 159 |
160 virtual FaviconService* GetFaviconService(); | 160 virtual FaviconService* GetFaviconService(); |
161 | 161 |
162 // Returns true if the favicon should be saved. | 162 // Returns true if the favicon should be saved. |
163 virtual bool ShouldSaveFavicon(const GURL& url); | 163 virtual bool ShouldSaveFavicon(const GURL& url); |
(...skipping 27 matching lines...) Expand all Loading... |
191 history::IconType icon_type); | 191 history::IconType icon_type); |
192 | 192 |
193 GURL url; | 193 GURL url; |
194 GURL image_url; | 194 GURL image_url; |
195 gfx::Image image; | 195 gfx::Image image; |
196 float score; | 196 float score; |
197 history::IconType icon_type; | 197 history::IconType icon_type; |
198 }; | 198 }; |
199 | 199 |
200 // See description above class for details. | 200 // See description above class for details. |
201 void OnFaviconDataForInitialURL(FaviconService::Handle handle, | 201 void OnFaviconDataForInitialURL( |
202 history::FaviconData favicon); | 202 FaviconService::Handle handle, |
| 203 std::vector<history::FaviconBitmapResult> favicon_bitmap_results, |
| 204 history::IconURLSizesMap icon_url_sizes); |
203 | 205 |
204 // If the favicon has expired, asks the renderer to download the favicon. | 206 // If the favicon has expired, asks the renderer to download the favicon. |
205 // Otherwise asks history to update the mapping between page url and icon | 207 // Otherwise asks history to update the mapping between page url and icon |
206 // url with a callback to OnFaviconData when done. | 208 // url with a callback to OnFaviconData when done. |
207 void DownloadFaviconOrAskHistory(const GURL& page_url, | 209 void DownloadFaviconOrAskHistory(const GURL& page_url, |
208 const GURL& icon_url, | 210 const GURL& icon_url, |
209 history::IconType icon_type); | 211 history::IconType icon_type); |
210 | 212 |
211 // See description above class for details. | 213 // See description above class for details. |
212 void OnFaviconData(FaviconService::Handle handle, | 214 void OnFaviconData( |
213 history::FaviconData favicon); | 215 FaviconService::Handle handle, |
| 216 std::vector<history::FaviconBitmapResult> favicon_bitmap_results, |
| 217 history::IconURLSizesMap icon_url_sizes); |
214 | 218 |
215 // Schedules a download for the specified entry. This adds the request to | 219 // Schedules a download for the specified entry. This adds the request to |
216 // download_requests_. | 220 // download_requests_. |
217 int ScheduleDownload(const GURL& url, | 221 int ScheduleDownload(const GURL& url, |
218 const GURL& image_url, | 222 const GURL& image_url, |
219 int image_size, | 223 int image_size, |
220 history::IconType icon_type, | 224 history::IconType icon_type, |
221 const FaviconTabHelper::ImageDownloadCallback& callback); | 225 const FaviconTabHelper::ImageDownloadCallback& callback); |
222 | 226 |
223 // Updates |favicon_candidate_| and returns true if it is an exact match. | 227 // Updates |favicon_candidate_| and returns true if it is an exact match. |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 // Requests to the renderer to download favicons. | 282 // Requests to the renderer to download favicons. |
279 typedef std::map<int, DownloadRequest> DownloadRequests; | 283 typedef std::map<int, DownloadRequest> DownloadRequests; |
280 DownloadRequests download_requests_; | 284 DownloadRequests download_requests_; |
281 | 285 |
282 // The combination of the supported icon types. | 286 // The combination of the supported icon types. |
283 const int icon_types_; | 287 const int icon_types_; |
284 | 288 |
285 // The prioritized favicon candidates from the page back from the renderer. | 289 // The prioritized favicon candidates from the page back from the renderer. |
286 std::deque<FaviconURL> image_urls_; | 290 std::deque<FaviconURL> image_urls_; |
287 | 291 |
288 // The FaviconData from history. | 292 // The FaviconBitmapResults from history. |
289 history::FaviconData history_icon_; | 293 std::vector<history::FaviconBitmapResult> history_results_; |
290 | 294 |
291 // The Profile associated with this handler. | 295 // The Profile associated with this handler. |
292 Profile* profile_; | 296 Profile* profile_; |
293 | 297 |
294 // This handler's delegate. | 298 // This handler's delegate. |
295 FaviconHandlerDelegate* delegate_; // weak | 299 FaviconHandlerDelegate* delegate_; // weak |
296 | 300 |
297 // Current favicon candidate. | 301 // Current favicon candidate. |
298 FaviconCandidate favicon_candidate_; | 302 FaviconCandidate favicon_candidate_; |
299 | 303 |
300 DISALLOW_COPY_AND_ASSIGN(FaviconHandler); | 304 DISALLOW_COPY_AND_ASSIGN(FaviconHandler); |
301 }; | 305 }; |
302 | 306 |
303 #endif // CHROME_BROWSER_FAVICON_FAVICON_HANDLER_H_ | 307 #endif // CHROME_BROWSER_FAVICON_FAVICON_HANDLER_H_ |
OLD | NEW |