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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 // TODO(beaudoin): For now this is just a wrapper around | 398 // TODO(beaudoin): For now this is just a wrapper around |
399 // GetLargestRawFaviconForPageURL. Add the logic required to select the best | 399 // GetLargestRawFaviconForPageURL. Add the logic required to select the best |
400 // possible large icon. Also add logic to fetch-on-demand when the URL of | 400 // possible large icon. Also add logic to fetch-on-demand when the URL of |
401 // a large icon is known but its bitmap is not available. | 401 // a large icon is known but its bitmap is not available. |
402 return favicon_service_->GetLargestRawFaviconForPageURL( | 402 return favicon_service_->GetLargestRawFaviconForPageURL( |
403 page_url, large_icon_types_, max_size_in_pixel, | 403 page_url, large_icon_types_, max_size_in_pixel, |
404 base::Bind(&LargeIconWorker::OnIconLookupComplete, worker), tracker); | 404 base::Bind(&LargeIconWorker::OnIconLookupComplete, worker), tracker); |
405 } | 405 } |
406 | 406 |
407 } // namespace favicon | 407 } // namespace favicon |
OLD | NEW |