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

Side by Side Diff: components/favicon/core/large_icon_service.cc

Issue 2891333002: Introduce dedicated enum value for icons from Web Manifests (Closed)
Patch Set: Created 3 years, 7 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 unified diff | Download patch
OLDNEW
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 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
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->SetLastResortFavicons(page_url, GURL(original_icon_url),
298 favicon_base::IconType::TOUCH_ICON, 298 favicon_base::IconType::TOUCH_ICON,
pkotwicz 2017/05/24 14:27:44 Shouldn't this be IconType::WEB_MANIFEST_ICON
mastiz 2017/05/25 11:14:16 Why? Both are hacky, but WEB_MANIFEST_ICON seems e
pkotwicz 2017/05/26 14:49:56 I see now. Sorry for the error on my part.
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),
310 image_fetcher_(std::move(image_fetcher)) { 310 image_fetcher_(std::move(image_fetcher)) {
311 large_icon_types_.push_back(favicon_base::IconType::WEB_MANIFEST_ICON);
311 large_icon_types_.push_back(favicon_base::IconType::FAVICON); 312 large_icon_types_.push_back(favicon_base::IconType::FAVICON);
312 large_icon_types_.push_back(favicon_base::IconType::TOUCH_ICON); 313 large_icon_types_.push_back(favicon_base::IconType::TOUCH_ICON);
313 large_icon_types_.push_back(favicon_base::IconType::TOUCH_PRECOMPOSED_ICON); 314 large_icon_types_.push_back(favicon_base::IconType::TOUCH_PRECOMPOSED_ICON);
314 } 315 }
315 316
316 LargeIconService::~LargeIconService() { 317 LargeIconService::~LargeIconService() {
317 } 318 }
318 319
319 base::CancelableTaskTracker::TaskId 320 base::CancelableTaskTracker::TaskId
320 LargeIconService::GetLargeIconOrFallbackStyle( 321 LargeIconService::GetLargeIconOrFallbackStyle(
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 // TODO(beaudoin): For now this is just a wrapper around 389 // TODO(beaudoin): For now this is just a wrapper around
389 // GetLargestRawFaviconForPageURL. Add the logic required to select the best 390 // GetLargestRawFaviconForPageURL. Add the logic required to select the best
390 // possible large icon. Also add logic to fetch-on-demand when the URL of 391 // possible large icon. Also add logic to fetch-on-demand when the URL of
391 // a large icon is known but its bitmap is not available. 392 // a large icon is known but its bitmap is not available.
392 return favicon_service_->GetLargestRawFaviconForPageURL( 393 return favicon_service_->GetLargestRawFaviconForPageURL(
393 page_url, large_icon_types_, min_source_size_in_pixel, 394 page_url, large_icon_types_, min_source_size_in_pixel,
394 base::Bind(&LargeIconWorker::OnIconLookupComplete, worker), tracker); 395 base::Bind(&LargeIconWorker::OnIconLookupComplete, worker), tracker);
395 } 396 }
396 397
397 } // namespace favicon 398 } // namespace favicon
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698