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

Side by Side Diff: chrome/browser/favicon/favicon_handler.h

Issue 934693002: Reload favicon from HTTP cache on Ctrl+Refresh (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 months 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
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_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 <deque> 8 #include <deque>
9 #include <map> 9 #include <map>
10 #include <vector> 10 #include <vector>
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 int id, 106 int id,
107 const GURL& image_url, 107 const GURL& image_url,
108 const std::vector<SkBitmap>& bitmaps, 108 const std::vector<SkBitmap>& bitmaps,
109 const std::vector<gfx::Size>& original_bitmap_sizes); 109 const std::vector<gfx::Size>& original_bitmap_sizes);
110 110
111 // For testing. 111 // For testing.
112 const std::vector<favicon::FaviconURL>& image_urls() const { 112 const std::vector<favicon::FaviconURL>& image_urls() const {
113 return image_urls_; 113 return image_urls_;
114 } 114 }
115 115
116 // For testing. Returns whether there are any pending FaviconService requests.
sky 2015/02/19 18:08:10 This class already has a friend for testing, can y
pkotwicz 2015/02/19 21:29:57 Thanks for the suggestion. FaviconHandler now has
117 bool HasPendingFaviconServiceRequestsForTest() const;
118
119 // For testing. Returns whether there are any pending downloads.
120 bool HasPendingDownloadsForTest() const;
121
116 protected: 122 protected:
117 // These virtual methods make FaviconHandler testable and are overridden by 123 // These virtual methods make FaviconHandler testable and are overridden by
118 // TestFaviconHandler. 124 // TestFaviconHandler.
119 125
120 // Asks the render to download favicon, returns the request id. 126 // Asks the render to download favicon, returns the request id.
121 virtual int DownloadFavicon(const GURL& image_url, int max_bitmap_size); 127 virtual int DownloadFavicon(const GURL& image_url, int max_bitmap_size);
122 128
123 // Ask the favicon from history 129 // Ask the favicon from history
124 virtual void UpdateFaviconMappingAndFetch( 130 virtual void UpdateFaviconMappingAndFetch(
125 const GURL& page_url, 131 const GURL& page_url,
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 // Additionally removes any entries whose sizes are all greater than the max 257 // Additionally removes any entries whose sizes are all greater than the max
252 // allowed size. 258 // allowed size.
253 void SortAndPruneImageUrls(); 259 void SortAndPruneImageUrls();
254 260
255 // Used for FaviconService requests. 261 // Used for FaviconService requests.
256 base::CancelableTaskTracker cancelable_task_tracker_; 262 base::CancelableTaskTracker cancelable_task_tracker_;
257 263
258 // URL of the page we're requesting the favicon for. 264 // URL of the page we're requesting the favicon for.
259 GURL url_; 265 GURL url_;
260 266
261 // Whether we got the initial response for the favicon back from the renderer. 267 // Whether we are waiting for data from the FaviconService.
268 bool waiting_for_favicon_service_data_;
269
270 // Whether we got data back for the initial request to the FaviconService.
262 bool got_favicon_from_history_; 271 bool got_favicon_from_history_;
263 272
264 // Whether the favicon is out of date or the favicon data in 273 // Whether the favicon is out of date or the favicon data in
265 // |history_results_| is known to be incomplete. If true, it means history 274 // |history_results_| is known to be incomplete. If true, it means history
266 // knows about the favicon, but we need to download the favicon because the 275 // knows about the favicon, but we need to download the favicon because the
267 // icon has expired or the data in the database is incomplete. 276 // icon has expired or the data in the database is incomplete.
268 bool favicon_expired_or_incomplete_; 277 bool favicon_expired_or_incomplete_;
269 278
270 // Requests to the renderer to download favicons. 279 // Requests to the renderer to download favicons.
271 typedef std::map<int, DownloadRequest> DownloadRequests; 280 typedef std::map<int, DownloadRequest> DownloadRequests;
(...skipping 20 matching lines...) Expand all
292 // Best image we've seen so far. As images are downloaded from the page they 301 // Best image we've seen so far. As images are downloaded from the page they
293 // are stored here. When there is an exact match, or no more images are 302 // are stored here. When there is an exact match, or no more images are
294 // available the favicon service and the current page are updated (assuming 303 // available the favicon service and the current page are updated (assuming
295 // the image is for a favicon). 304 // the image is for a favicon).
296 FaviconCandidate best_favicon_candidate_; 305 FaviconCandidate best_favicon_candidate_;
297 306
298 DISALLOW_COPY_AND_ASSIGN(FaviconHandler); 307 DISALLOW_COPY_AND_ASSIGN(FaviconHandler);
299 }; 308 };
300 309
301 #endif // CHROME_BROWSER_FAVICON_FAVICON_HANDLER_H_ 310 #endif // CHROME_BROWSER_FAVICON_FAVICON_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698