OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/ui/webui/favicon_source.h" | 5 #include "chrome/browser/ui/webui/favicon_source.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
78 return; | 78 return; |
79 } | 79 } |
80 | 80 |
81 GURL url(parsed.url); | 81 GURL url(parsed.url); |
82 int desired_size_in_pixel = | 82 int desired_size_in_pixel = |
83 std::ceil(parsed.size_in_dip * parsed.device_scale_factor); | 83 std::ceil(parsed.size_in_dip * parsed.device_scale_factor); |
84 | 84 |
85 if (parsed.is_icon_url) { | 85 if (parsed.is_icon_url) { |
86 // TODO(michaelbai): Change GetRawFavicon to support combination of | 86 // TODO(michaelbai): Change GetRawFavicon to support combination of |
87 // IconType. | 87 // IconType. |
88 favicon_service->GetRawFavicon( | 88 favicon_service->GetRawFavicon( |
pkotwicz
2015/01/21 19:44:15
Can you move this change to a separate CL
huangs
2015/01/22 01:13:27
Done.
| |
89 url, | 89 url, |
90 favicon_base::FAVICON, | 90 favicon_base::FAVICON, |
91 desired_size_in_pixel, | 91 desired_size_in_pixel, |
92 base::Bind( | 92 base::Bind( |
93 &FaviconSource::OnFaviconDataAvailable, | 93 &FaviconSource::OnFaviconDataAvailable, |
94 base::Unretained(this), | 94 base::Unretained(this), |
95 IconRequest( | 95 IconRequest( |
96 callback, url, parsed.size_in_dip, parsed.device_scale_factor)), | 96 callback, url, parsed.size_in_dip, parsed.device_scale_factor)), |
97 &cancelable_task_tracker_); | 97 &cancelable_task_tracker_); |
98 } else { | 98 } else { |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
198 ui::ScaleFactor resource_scale_factor = | 198 ui::ScaleFactor resource_scale_factor = |
199 ui::GetSupportedScaleFactor(icon_request.device_scale_factor); | 199 ui::GetSupportedScaleFactor(icon_request.device_scale_factor); |
200 default_favicon = | 200 default_favicon = |
201 ResourceBundle::GetSharedInstance().LoadDataResourceBytesForScale( | 201 ResourceBundle::GetSharedInstance().LoadDataResourceBytesForScale( |
202 resource_id, resource_scale_factor); | 202 resource_id, resource_scale_factor); |
203 default_favicons_[favicon_index] = default_favicon; | 203 default_favicons_[favicon_index] = default_favicon; |
204 } | 204 } |
205 | 205 |
206 icon_request.callback.Run(default_favicon); | 206 icon_request.callback.Run(default_favicon); |
207 } | 207 } |
OLD | NEW |