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

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

Issue 2810733002: [LargeIconService] Store downloaded icons under original URL (Closed)
Patch Set: Created 3 years, 8 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 | « no previous file | components/favicon/core/large_icon_service_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/favicon/core/large_icon_service.cc
diff --git a/components/favicon/core/large_icon_service.cc b/components/favicon/core/large_icon_service.cc
index 0153ddf34304ffb213863c0486a01a34ff20a270..ddfa1c16050a1df290a3261bb696ed280ff98d4a 100644
--- a/components/favicon/core/large_icon_service.cc
+++ b/components/favicon/core/large_icon_service.cc
@@ -21,6 +21,7 @@
#include "components/favicon_base/fallback_icon_style.h"
#include "components/favicon_base/favicon_types.h"
#include "components/favicon_base/favicon_util.h"
+#include "components/image_fetcher/core/request_metadata.h"
#include "skia/ext/image_operations.h"
#include "ui/gfx/codec/png_codec.h"
#include "ui/gfx/geometry/size.h"
@@ -231,17 +232,18 @@ void OnFetchIconFromGoogleServerComplete(
return;
}
- // TODO(crbug.com/699542): Extract the original icon url from the response
- // headers if available and use it instead of |icon_url|. Possibly the type
- // too, because using TOUCH_ICON is a hacky way that allows us to not
- // interfere with sync.
+ // Get the original favicon URL from Content-Location http header (if given).
+ std::string original_icon_url = metadata.content_location_header;
+ if (original_icon_url.empty()) {
+ original_icon_url = icon_url; // Use the favicon server url as fallback.
+ }
// Write fetched icons to FaviconService's cache, but only if no icon was
// available (clients are encouraged to do this in advance, but meanwhile
// something else could've been written). By marking the icons initially
// expired (out-of-date), they will be refetched when we visit the original
// page any time in the future.
- favicon_service->SetLastResortFavicons(page_url, GURL(icon_url),
+ favicon_service->SetLastResortFavicons(page_url, GURL(original_icon_url),
favicon_base::IconType::TOUCH_ICON,
image, callback);
}
« no previous file with comments | « no previous file | components/favicon/core/large_icon_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698