| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #include "components/favicon/core/large_icon_service.h" | 5 #include "components/favicon/core/large_icon_service.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/feature_list.h" | 10 #include "base/feature_list.h" |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 std::string original_icon_url = metadata.content_location_header; | 290 std::string original_icon_url = metadata.content_location_header; |
| 291 if (original_icon_url.empty()) { | 291 if (original_icon_url.empty()) { |
| 292 original_icon_url = server_request_url; | 292 original_icon_url = server_request_url; |
| 293 } | 293 } |
| 294 | 294 |
| 295 // Write fetched icons to FaviconService's cache, but only if no icon was | 295 // Write fetched icons to FaviconService's cache, but only if no icon was |
| 296 // available (clients are encouraged to do this in advance, but meanwhile | 296 // available (clients are encouraged to do this in advance, but meanwhile |
| 297 // something else could've been written). By marking the icons initially | 297 // something else could've been written). By marking the icons initially |
| 298 // expired (out-of-date), they will be refetched when we visit the original | 298 // expired (out-of-date), they will be refetched when we visit the original |
| 299 // page any time in the future. | 299 // page any time in the future. |
| 300 favicon_service->SetLastResortFavicons(page_url, GURL(original_icon_url), | 300 favicon_service->SetOnDemandFavicons(page_url, GURL(original_icon_url), |
| 301 favicon_base::IconType::TOUCH_ICON, | 301 favicon_base::IconType::TOUCH_ICON, |
| 302 image, callback); | 302 image, callback); |
| 303 } | 303 } |
| 304 | 304 |
| 305 } // namespace | 305 } // namespace |
| 306 | 306 |
| 307 LargeIconService::LargeIconService( | 307 LargeIconService::LargeIconService( |
| 308 FaviconService* favicon_service, | 308 FaviconService* favicon_service, |
| 309 const scoped_refptr<base::TaskRunner>& background_task_runner, | 309 const scoped_refptr<base::TaskRunner>& background_task_runner, |
| 310 std::unique_ptr<image_fetcher::ImageFetcher> image_fetcher) | 310 std::unique_ptr<image_fetcher::ImageFetcher> image_fetcher) |
| 311 : favicon_service_(favicon_service), | 311 : favicon_service_(favicon_service), |
| 312 background_task_runner_(background_task_runner), | 312 background_task_runner_(background_task_runner), |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 396 // TODO(beaudoin): For now this is just a wrapper around | 396 // TODO(beaudoin): For now this is just a wrapper around |
| 397 // GetLargestRawFaviconForPageURL. Add the logic required to select the best | 397 // GetLargestRawFaviconForPageURL. Add the logic required to select the best |
| 398 // possible large icon. Also add logic to fetch-on-demand when the URL of | 398 // possible large icon. Also add logic to fetch-on-demand when the URL of |
| 399 // a large icon is known but its bitmap is not available. | 399 // a large icon is known but its bitmap is not available. |
| 400 return favicon_service_->GetLargestRawFaviconForPageURL( | 400 return favicon_service_->GetLargestRawFaviconForPageURL( |
| 401 page_url, large_icon_types_, min_source_size_in_pixel, | 401 page_url, large_icon_types_, min_source_size_in_pixel, |
| 402 base::Bind(&LargeIconWorker::OnIconLookupComplete, worker), tracker); | 402 base::Bind(&LargeIconWorker::OnIconLookupComplete, worker), tracker); |
| 403 } | 403 } |
| 404 | 404 |
| 405 } // namespace favicon | 405 } // namespace favicon |
| OLD | NEW |