OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/ntp_tiles/icon_cacher_impl.h" | 5 #include "components/ntp_tiles/icon_cacher_impl.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "components/favicon/core/favicon_service.h" | 9 #include "components/favicon/core/favicon_service.h" |
10 #include "components/favicon/core/favicon_util.h" | 10 #include "components/favicon/core/favicon_util.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 // For images with multiple frames, prefer one of size 128x128px. | 42 // For images with multiple frames, prefer one of size 128x128px. |
43 image_fetcher_->SetDesiredImageFrameSize(gfx::Size(128, 128)); | 43 image_fetcher_->SetDesiredImageFrameSize(gfx::Size(128, 128)); |
44 } | 44 } |
45 | 45 |
46 IconCacherImpl::~IconCacherImpl() = default; | 46 IconCacherImpl::~IconCacherImpl() = default; |
47 | 47 |
48 void IconCacherImpl::StartFetch( | 48 void IconCacherImpl::StartFetch( |
49 PopularSites::Site site, | 49 PopularSites::Site site, |
50 const base::Closure& icon_available, | 50 const base::Closure& icon_available, |
51 const base::Closure& preliminary_icon_available) { | 51 const base::Closure& preliminary_icon_available) { |
| 52 // Copy values from |site| before it is moved. |
| 53 GURL site_url = site.url; |
| 54 favicon_base::IconType icon_type = IconType(site); |
52 favicon::GetFaviconImageForPageURL( | 55 favicon::GetFaviconImageForPageURL( |
53 favicon_service_, site.url, IconType(site), | 56 favicon_service_, site_url, icon_type, |
54 base::Bind(&IconCacherImpl::OnGetFaviconImageForPageURLFinished, | 57 base::Bind(&IconCacherImpl::OnGetFaviconImageForPageURLFinished, |
55 base::Unretained(this), std::move(site), icon_available, | 58 base::Unretained(this), std::move(site), icon_available, |
56 preliminary_icon_available), | 59 preliminary_icon_available), |
57 &tracker_); | 60 &tracker_); |
58 } | 61 } |
59 | 62 |
60 void IconCacherImpl::OnGetFaviconImageForPageURLFinished( | 63 void IconCacherImpl::OnGetFaviconImageForPageURLFinished( |
61 PopularSites::Site site, | 64 PopularSites::Site site, |
62 const base::Closure& icon_available, | 65 const base::Closure& icon_available, |
63 const base::Closure& preliminary_icon_available, | 66 const base::Closure& preliminary_icon_available, |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 bool IconCacherImpl::ProvideDefaultIcon(const PopularSites::Site& site) { | 101 bool IconCacherImpl::ProvideDefaultIcon(const PopularSites::Site& site) { |
99 if (site.default_icon_resource < 0) { | 102 if (site.default_icon_resource < 0) { |
100 return false; | 103 return false; |
101 } | 104 } |
102 SaveIconForSite(site, ResourceBundle::GetSharedInstance().GetNativeImageNamed( | 105 SaveIconForSite(site, ResourceBundle::GetSharedInstance().GetNativeImageNamed( |
103 site.default_icon_resource)); | 106 site.default_icon_resource)); |
104 return true; | 107 return true; |
105 } | 108 } |
106 | 109 |
107 } // namespace ntp_tiles | 110 } // namespace ntp_tiles |
OLD | NEW |