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

Unified Diff: chrome/browser/favicon/favicon_tab_helper.cc

Issue 14322023: Don't request missing favicon on every page request. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync up to r199996 Created 7 years, 7 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
Index: chrome/browser/favicon/favicon_tab_helper.cc
diff --git a/chrome/browser/favicon/favicon_tab_helper.cc b/chrome/browser/favicon/favicon_tab_helper.cc
index 768e950c9c49e1377436549f26eee8530ec9dd0a..754c6e8666c80daf552551d5774ae0c921a70417 100644
--- a/chrome/browser/favicon/favicon_tab_helper.cc
+++ b/chrome/browser/favicon/favicon_tab_helper.cc
@@ -135,6 +135,13 @@ NavigationEntry* FaviconTabHelper::GetActiveEntry() {
}
int FaviconTabHelper::StartDownload(const GURL& url, int image_size) {
+ FaviconService* favicon_service = FaviconServiceFactory::GetForProfile(
+ profile_->GetOriginalProfile(), Profile::IMPLICIT_ACCESS);
+ if (favicon_service && favicon_service->WasUnableToDownloadFavicon(url)) {
+ DVLOG(1) << "Skip Failed FavIcon: " << url;
+ return 0;
+ }
+
return web_contents()->DownloadImage(
url,
true,
@@ -157,8 +164,11 @@ void FaviconTabHelper::NavigateToPendingEntry(
!profile_->IsOffTheRecord()) {
FaviconService* favicon_service = FaviconServiceFactory::GetForProfile(
profile_, Profile::IMPLICIT_ACCESS);
- if (favicon_service)
+ if (favicon_service) {
favicon_service->SetFaviconOutOfDateForPage(url);
+ if (reload_type == NavigationController::RELOAD_IGNORING_CACHE)
+ favicon_service->ClearUnableToDownloadFavicons();
+ }
}
}
@@ -179,9 +189,19 @@ void FaviconTabHelper::DidUpdateFaviconURL(
void FaviconTabHelper::DidDownloadFavicon(
int id,
+ int http_status_code,
const GURL& image_url,
int requested_size,
const std::vector<SkBitmap>& bitmaps) {
+
+ if (bitmaps.empty() && http_status_code == 404) {
+ DVLOG(1) << "Failed to Download Favicon:" << image_url;
+ FaviconService* favicon_service = FaviconServiceFactory::GetForProfile(
+ profile_->GetOriginalProfile(), Profile::IMPLICIT_ACCESS);
+ if (favicon_service)
+ favicon_service->UnableToDownloadFavicon(image_url);
+ }
+
favicon_handler_->OnDidDownloadFavicon(
id, image_url, requested_size, bitmaps);
if (touch_icon_handler_.get()) {
« no previous file with comments | « chrome/browser/favicon/favicon_tab_helper.h ('k') | chrome/browser/notifications/message_center_notification_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698