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

Unified Diff: components/favicon/core/favicon_handler.cc

Issue 2728893004: Move WasUnableToDownload logic to FaviconHandler (Closed)
Patch Set: Reverted accidental changes. Created 3 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/favicon/core/favicon_driver_impl.cc ('k') | components/favicon/ios/web_favicon_driver.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/favicon/core/favicon_handler.cc
diff --git a/components/favicon/core/favicon_handler.cc b/components/favicon/core/favicon_handler.cc
index adbb5df8e2a4b4c769f4cca819fc95f424a78fda..9c6579991758ab72fccde337bbea74767f105dc5 100644
--- a/components/favicon/core/favicon_handler.cc
+++ b/components/favicon/core/favicon_handler.cc
@@ -661,6 +661,15 @@ void FaviconHandler::OnFaviconData(const std::vector<
void FaviconHandler::ScheduleDownload(const GURL& image_url,
favicon_base::IconType icon_type) {
DCHECK(image_url.is_valid());
+ if (service_ && service_->WasUnableToDownloadFavicon(image_url)) {
+ DVLOG(1) << "Skip Failed FavIcon: " << image_url;
+ // Registration in download_requests_ is needed to prevent
+ // OnDidDownloadFavicon() from returning early.
+ download_requests_[0] = DownloadRequest(image_url, icon_type);
+ OnDidDownloadFavicon(0, 0, image_url, std::vector<SkBitmap>(),
+ std::vector<gfx::Size>());
+ return;
+ }
// A max bitmap size is specified to avoid receiving huge bitmaps in
// OnDidDownloadFavicon(). See FaviconDriver::StartDownload()
// for more details about the max bitmap size.
@@ -673,6 +682,8 @@ void FaviconHandler::ScheduleDownload(const GURL& image_url,
DCHECK(download_requests_.find(download_id) == download_requests_.end());
download_requests_[download_id] = DownloadRequest(image_url, icon_type);
+ // TODO(mastiz): Remove the download_id == 0 handling because it's not used
+ // in production code, only tests.
if (download_id == 0) {
// If DownloadFavicon() did not start a download, it returns a download id
// of 0. We still need to call OnDidDownloadFavicon() because the method is
« no previous file with comments | « components/favicon/core/favicon_driver_impl.cc ('k') | components/favicon/ios/web_favicon_driver.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698