| 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/location.h" | 10 #include "base/location.h" |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 } | 247 } |
| 248 | 248 |
| 249 } // namespace | 249 } // namespace |
| 250 | 250 |
| 251 LargeIconService::LargeIconService( | 251 LargeIconService::LargeIconService( |
| 252 FaviconService* favicon_service, | 252 FaviconService* favicon_service, |
| 253 const scoped_refptr<base::TaskRunner>& background_task_runner, | 253 const scoped_refptr<base::TaskRunner>& background_task_runner, |
| 254 std::unique_ptr<image_fetcher::ImageFetcher> image_fetcher) | 254 std::unique_ptr<image_fetcher::ImageFetcher> image_fetcher) |
| 255 : favicon_service_(favicon_service), | 255 : favicon_service_(favicon_service), |
| 256 background_task_runner_(background_task_runner), | 256 background_task_runner_(background_task_runner), |
| 257 image_fetcher_(std::move(image_fetcher)) { | 257 image_fetcher_(std::move(image_fetcher)) {} |
| 258 large_icon_types_.push_back(favicon_base::IconType::FAVICON); | |
| 259 large_icon_types_.push_back(favicon_base::IconType::TOUCH_ICON); | |
| 260 large_icon_types_.push_back(favicon_base::IconType::TOUCH_PRECOMPOSED_ICON); | |
| 261 } | |
| 262 | 258 |
| 263 LargeIconService::~LargeIconService() { | 259 LargeIconService::~LargeIconService() { |
| 264 } | 260 } |
| 265 | 261 |
| 266 base::CancelableTaskTracker::TaskId | 262 base::CancelableTaskTracker::TaskId |
| 267 LargeIconService::GetLargeIconOrFallbackStyle( | 263 LargeIconService::GetLargeIconOrFallbackStyle( |
| 268 const GURL& page_url, | 264 const GURL& page_url, |
| 269 int min_source_size_in_pixel, | 265 int min_source_size_in_pixel, |
| 270 int desired_size_in_pixel, | 266 int desired_size_in_pixel, |
| 271 const favicon_base::LargeIconCallback& raw_bitmap_callback, | 267 const favicon_base::LargeIconCallback& raw_bitmap_callback, |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 | 324 |
| 329 scoped_refptr<LargeIconWorker> worker = new LargeIconWorker( | 325 scoped_refptr<LargeIconWorker> worker = new LargeIconWorker( |
| 330 min_source_size_in_pixel, desired_size_in_pixel, raw_bitmap_callback, | 326 min_source_size_in_pixel, desired_size_in_pixel, raw_bitmap_callback, |
| 331 image_callback, background_task_runner_, tracker); | 327 image_callback, background_task_runner_, tracker); |
| 332 | 328 |
| 333 // TODO(beaudoin): For now this is just a wrapper around | 329 // TODO(beaudoin): For now this is just a wrapper around |
| 334 // GetLargestRawFaviconForPageURL. Add the logic required to select the best | 330 // GetLargestRawFaviconForPageURL. Add the logic required to select the best |
| 335 // possible large icon. Also add logic to fetch-on-demand when the URL of | 331 // possible large icon. Also add logic to fetch-on-demand when the URL of |
| 336 // a large icon is known but its bitmap is not available. | 332 // a large icon is known but its bitmap is not available. |
| 337 return favicon_service_->GetLargestRawFaviconForPageURL( | 333 return favicon_service_->GetLargestRawFaviconForPageURL( |
| 338 page_url, large_icon_types_, min_source_size_in_pixel, | 334 page_url, base::Bind(&LargeIconWorker::OnIconLookupComplete, worker), |
| 339 base::Bind(&LargeIconWorker::OnIconLookupComplete, worker), tracker); | 335 tracker); |
| 340 } | 336 } |
| 341 | 337 |
| 342 } // namespace favicon | 338 } // namespace favicon |
| OLD | NEW |