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 "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
10 #include "chrome/browser/favicon/favicon_service_factory.h" | 10 #include "chrome/browser/favicon/favicon_service_factory.h" |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 if (bitmap_result.is_valid()) { | 246 if (bitmap_result.is_valid()) { |
247 // Forward the data along to the networking system. | 247 // Forward the data along to the networking system. |
248 request.callback.Run(bitmap_result.bitmap_data); | 248 request.callback.Run(bitmap_result.bitmap_data); |
249 } else if (!HandleMissingResource(request)) { | 249 } else if (!HandleMissingResource(request)) { |
250 SendDefaultResponse(request); | 250 SendDefaultResponse(request); |
251 } | 251 } |
252 } | 252 } |
253 | 253 |
254 void FaviconSource::SendDefaultResponse( | 254 void FaviconSource::SendDefaultResponse( |
255 const content::URLDataSource::GotDataCallback& callback) { | 255 const content::URLDataSource::GotDataCallback& callback) { |
256 SendDefaultResponse(IconRequest(callback, | 256 SendDefaultResponse( |
257 "", | 257 IconRequest(callback, std::string(), 16, ui::SCALE_FACTOR_100P)); |
258 16, | |
259 ui::SCALE_FACTOR_100P)); | |
260 } | 258 } |
261 | 259 |
262 void FaviconSource::SendDefaultResponse(const IconRequest& icon_request) { | 260 void FaviconSource::SendDefaultResponse(const IconRequest& icon_request) { |
263 int favicon_index; | 261 int favicon_index; |
264 int resource_id; | 262 int resource_id; |
265 switch (icon_request.size_in_dip) { | 263 switch (icon_request.size_in_dip) { |
266 case 64: | 264 case 64: |
267 favicon_index = SIZE_64; | 265 favicon_index = SIZE_64; |
268 resource_id = IDR_DEFAULT_FAVICON_64; | 266 resource_id = IDR_DEFAULT_FAVICON_64; |
269 break; | 267 break; |
(...skipping 10 matching lines...) Expand all Loading... |
280 | 278 |
281 if (!default_favicon) { | 279 if (!default_favicon) { |
282 ui::ScaleFactor scale_factor = icon_request.scale_factor; | 280 ui::ScaleFactor scale_factor = icon_request.scale_factor; |
283 default_favicon = ResourceBundle::GetSharedInstance() | 281 default_favicon = ResourceBundle::GetSharedInstance() |
284 .LoadDataResourceBytesForScale(resource_id, scale_factor); | 282 .LoadDataResourceBytesForScale(resource_id, scale_factor); |
285 default_favicons_[favicon_index] = default_favicon; | 283 default_favicons_[favicon_index] = default_favicon; |
286 } | 284 } |
287 | 285 |
288 icon_request.callback.Run(default_favicon); | 286 icon_request.callback.Run(default_favicon); |
289 } | 287 } |
OLD | NEW |