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

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

Issue 1119163003: Save large icons to a new LARGE_ICON type Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: yet more clarifying comments Created 5 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 "components/favicon/core/favicon_service.h" 7 #include "components/favicon/core/favicon_service.h"
8 #include "components/favicon_base/fallback_icon_style.h" 8 #include "components/favicon_base/fallback_icon_style.h"
9 #include "components/favicon_base/favicon_types.h" 9 #include "components/favicon_base/favicon_types.h"
10 #include "skia/ext/image_operations.h" 10 #include "skia/ext/image_operations.h"
11 #include "ui/gfx/codec/png_codec.h" 11 #include "ui/gfx/codec/png_codec.h"
12 #include "ui/gfx/geometry/size.h" 12 #include "ui/gfx/geometry/size.h"
13 13
14 namespace favicon { 14 namespace favicon {
15 15
16 LargeIconService::LargeIconService(FaviconService* favicon_service) 16 LargeIconService::LargeIconService(FaviconService* favicon_service)
17 : favicon_service_(favicon_service) { 17 : favicon_service_(favicon_service) {
18 large_icon_types_.push_back(favicon_base::IconType::FAVICON); 18 large_icon_types_.push_back(favicon_base::IconType::FAVICON);
19 large_icon_types_.push_back(favicon_base::IconType::TOUCH_ICON); 19 large_icon_types_.push_back(favicon_base::IconType::TOUCH_ICON);
20 large_icon_types_.push_back(favicon_base::IconType::TOUCH_PRECOMPOSED_ICON); 20 large_icon_types_.push_back(favicon_base::IconType::TOUCH_PRECOMPOSED_ICON);
21 large_icon_types_.push_back(favicon_base::IconType::LARGE_ICON);
21 } 22 }
22 23
23 LargeIconService::~LargeIconService() { 24 LargeIconService::~LargeIconService() {
24 } 25 }
25 26
26 base::CancelableTaskTracker::TaskId 27 base::CancelableTaskTracker::TaskId
27 LargeIconService::GetLargeIconOrFallbackStyle( 28 LargeIconService::GetLargeIconOrFallbackStyle(
28 const GURL& page_url, 29 const GURL& page_url,
29 int desired_size_in_pixel, 30 int desired_size_in_pixel,
30 const favicon_base::LargeIconCallback& callback, 31 const favicon_base::LargeIconCallback& callback,
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 // Failed to resize |bitmap_result|, so compute fallback icon style. 99 // Failed to resize |bitmap_result|, so compute fallback icon style.
99 favicon_base::LargeIconResult result(new favicon_base::FallbackIconStyle()); 100 favicon_base::LargeIconResult result(new favicon_base::FallbackIconStyle());
100 if (bitmap_result.is_valid()) { 101 if (bitmap_result.is_valid()) {
101 favicon_base::SetDominantColorAsBackground( 102 favicon_base::SetDominantColorAsBackground(
102 bitmap_result.bitmap_data, result.fallback_icon_style.get()); 103 bitmap_result.bitmap_data, result.fallback_icon_style.get());
103 } 104 }
104 callback.Run(result); 105 callback.Run(result);
105 } 106 }
106 107
107 } // namespace favicon 108 } // namespace favicon
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698