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 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 std::string original_icon_url = metadata.content_location_header; | 287 std::string original_icon_url = metadata.content_location_header; |
288 if (original_icon_url.empty()) { | 288 if (original_icon_url.empty()) { |
289 original_icon_url = server_request_url; | 289 original_icon_url = server_request_url; |
290 } | 290 } |
291 | 291 |
292 // Write fetched icons to FaviconService's cache, but only if no icon was | 292 // Write fetched icons to FaviconService's cache, but only if no icon was |
293 // available (clients are encouraged to do this in advance, but meanwhile | 293 // available (clients are encouraged to do this in advance, but meanwhile |
294 // something else could've been written). By marking the icons initially | 294 // something else could've been written). By marking the icons initially |
295 // expired (out-of-date), they will be refetched when we visit the original | 295 // expired (out-of-date), they will be refetched when we visit the original |
296 // page any time in the future. | 296 // page any time in the future. |
297 favicon_service->SetLastResortFavicons(page_url, GURL(original_icon_url), | 297 favicon_service->SetOnDemandFavicons(page_url, GURL(original_icon_url), |
298 favicon_base::IconType::TOUCH_ICON, | 298 favicon_base::IconType::TOUCH_ICON, |
299 image, callback); | 299 image, callback); |
300 } | 300 } |
301 | 301 |
302 } // namespace | 302 } // namespace |
303 | 303 |
304 LargeIconService::LargeIconService( | 304 LargeIconService::LargeIconService( |
305 FaviconService* favicon_service, | 305 FaviconService* favicon_service, |
306 const scoped_refptr<base::TaskRunner>& background_task_runner, | 306 const scoped_refptr<base::TaskRunner>& background_task_runner, |
307 std::unique_ptr<image_fetcher::ImageFetcher> image_fetcher) | 307 std::unique_ptr<image_fetcher::ImageFetcher> image_fetcher) |
308 : favicon_service_(favicon_service), | 308 : favicon_service_(favicon_service), |
309 background_task_runner_(background_task_runner), | 309 background_task_runner_(background_task_runner), |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
412 // TODO(beaudoin): For now this is just a wrapper around | 412 // TODO(beaudoin): For now this is just a wrapper around |
413 // GetLargestRawFaviconForPageURL. Add the logic required to select the best | 413 // GetLargestRawFaviconForPageURL. Add the logic required to select the best |
414 // possible large icon. Also add logic to fetch-on-demand when the URL of | 414 // possible large icon. Also add logic to fetch-on-demand when the URL of |
415 // a large icon is known but its bitmap is not available. | 415 // a large icon is known but its bitmap is not available. |
416 return favicon_service_->GetLargestRawFaviconForPageURL( | 416 return favicon_service_->GetLargestRawFaviconForPageURL( |
417 page_url, large_icon_types_, min_source_size_in_pixel, | 417 page_url, large_icon_types_, min_source_size_in_pixel, |
418 base::Bind(&LargeIconWorker::OnIconLookupComplete, worker), tracker); | 418 base::Bind(&LargeIconWorker::OnIconLookupComplete, worker), tracker); |
419 } | 419 } |
420 | 420 |
421 } // namespace favicon | 421 } // namespace favicon |
OLD | NEW |