| 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 "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "base/metrics/histogram_macros.h" | 10 #include "base/metrics/histogram_macros.h" |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 if (!HasResultDefaultBackgroundColor(result)) { | 212 if (!HasResultDefaultBackgroundColor(result)) { |
| 213 // We should only fetch for default "gray" tiles so that we never overrite | 213 // We should only fetch for default "gray" tiles so that we never overrite |
| 214 // any favicon of any size. | 214 // any favicon of any size. |
| 215 FinishRequestAndNotifyIconAvailable(page_url, /*newly_available=*/false); | 215 FinishRequestAndNotifyIconAvailable(page_url, /*newly_available=*/false); |
| 216 return; | 216 return; |
| 217 } | 217 } |
| 218 | 218 |
| 219 large_icon_service_ | 219 large_icon_service_ |
| 220 ->GetLargeIconOrFallbackStyleFromGoogleServerSkippingLocalCache( | 220 ->GetLargeIconOrFallbackStyleFromGoogleServerSkippingLocalCache( |
| 221 page_url, kTileIconMinSizePx, kTileIconDesiredSizePx, | 221 page_url, kTileIconMinSizePx, kTileIconDesiredSizePx, |
| 222 /*may_page_url_be_private=*/true, |
| 222 base::Bind(&IconCacherImpl::OnMostLikelyFaviconDownloaded, | 223 base::Bind(&IconCacherImpl::OnMostLikelyFaviconDownloaded, |
| 223 weak_ptr_factory_.GetWeakPtr(), page_url)); | 224 weak_ptr_factory_.GetWeakPtr(), page_url)); |
| 224 } | 225 } |
| 225 | 226 |
| 226 void IconCacherImpl::OnMostLikelyFaviconDownloaded(const GURL& request_url, | 227 void IconCacherImpl::OnMostLikelyFaviconDownloaded(const GURL& request_url, |
| 227 bool success) { | 228 bool success) { |
| 228 UMA_HISTOGRAM_BOOLEAN("NewTabPage.TileFaviconFetchSuccess.Server", success); | 229 UMA_HISTOGRAM_BOOLEAN("NewTabPage.TileFaviconFetchSuccess.Server", success); |
| 229 FinishRequestAndNotifyIconAvailable(request_url, success); | 230 FinishRequestAndNotifyIconAvailable(request_url, success); |
| 230 } | 231 } |
| 231 | 232 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 246 return; | 247 return; |
| 247 } | 248 } |
| 248 for (const base::Closure& callback : callbacks) { | 249 for (const base::Closure& callback : callbacks) { |
| 249 if (callback) { | 250 if (callback) { |
| 250 callback.Run(); | 251 callback.Run(); |
| 251 } | 252 } |
| 252 } | 253 } |
| 253 } | 254 } |
| 254 | 255 |
| 255 } // namespace ntp_tiles | 256 } // namespace ntp_tiles |
| OLD | NEW |