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 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
187 break; | 187 break; |
188 case 32: | 188 case 32: |
189 favicon_index = SIZE_32; | 189 favicon_index = SIZE_32; |
190 resource_id = IDR_DEFAULT_FAVICON_32; | 190 resource_id = IDR_DEFAULT_FAVICON_32; |
191 break; | 191 break; |
192 default: | 192 default: |
193 favicon_index = SIZE_16; | 193 favicon_index = SIZE_16; |
194 resource_id = IDR_DEFAULT_FAVICON; | 194 resource_id = IDR_DEFAULT_FAVICON; |
195 break; | 195 break; |
196 } | 196 } |
197 | |
198 ui::ScaleFactor resource_scale_factor = | |
199 ui::GetSupportedScaleFactor(icon_request.device_scale_factor); | |
Peter Kasting
2016/12/02 21:27:01
Nit: I'd just inline this below.
| |
197 base::RefCountedMemory* default_favicon = | 200 base::RefCountedMemory* default_favicon = |
198 default_favicons_[favicon_index].get(); | 201 ResourceBundle::GetSharedInstance().LoadDataResourceBytesForScale( |
199 | 202 resource_id, resource_scale_factor); |
200 if (!default_favicon) { | |
201 ui::ScaleFactor resource_scale_factor = | |
202 ui::GetSupportedScaleFactor(icon_request.device_scale_factor); | |
203 default_favicon = | |
204 ResourceBundle::GetSharedInstance().LoadDataResourceBytesForScale( | |
205 resource_id, resource_scale_factor); | |
206 default_favicons_[favicon_index] = default_favicon; | |
207 } | |
208 | 203 |
209 icon_request.callback.Run(default_favicon); | 204 icon_request.callback.Run(default_favicon); |
210 } | 205 } |
OLD | NEW |