| 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/favicon/favicon_service.h" | 5 #include "chrome/browser/favicon/favicon_service.h" |
| 6 | 6 |
| 7 #include "base/hash.h" | 7 #include "base/hash.h" |
| 8 #include "base/message_loop/message_loop_proxy.h" | 8 #include "base/message_loop/message_loop_proxy.h" |
| 9 #include "chrome/browser/favicon/favicon_types.h" | 9 #include "chrome/browser/favicon/favicon_types.h" |
| 10 #include "chrome/browser/favicon/favicon_util.h" | 10 #include "chrome/browser/favicon/favicon_util.h" |
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 | 307 |
| 308 void FaviconService::RunFaviconImageCallbackWithBitmapResults( | 308 void FaviconService::RunFaviconImageCallbackWithBitmapResults( |
| 309 const FaviconImageCallback& callback, | 309 const FaviconImageCallback& callback, |
| 310 int desired_size_in_dip, | 310 int desired_size_in_dip, |
| 311 const std::vector<chrome::FaviconBitmapResult>& favicon_bitmap_results) { | 311 const std::vector<chrome::FaviconBitmapResult>& favicon_bitmap_results) { |
| 312 chrome::FaviconImageResult image_result; | 312 chrome::FaviconImageResult image_result; |
| 313 image_result.image = FaviconUtil::SelectFaviconFramesFromPNGs( | 313 image_result.image = FaviconUtil::SelectFaviconFramesFromPNGs( |
| 314 favicon_bitmap_results, | 314 favicon_bitmap_results, |
| 315 FaviconUtil::GetFaviconScaleFactors(), | 315 FaviconUtil::GetFaviconScaleFactors(), |
| 316 desired_size_in_dip); | 316 desired_size_in_dip); |
| 317 FaviconUtil::SetFaviconColorSpace(&image_result.image); |
| 318 |
| 317 image_result.icon_url = image_result.image.IsEmpty() ? | 319 image_result.icon_url = image_result.image.IsEmpty() ? |
| 318 GURL() : favicon_bitmap_results[0].icon_url; | 320 GURL() : favicon_bitmap_results[0].icon_url; |
| 319 callback.Run(image_result); | 321 callback.Run(image_result); |
| 320 } | 322 } |
| 321 | 323 |
| 322 void FaviconService::RunFaviconRawCallbackWithBitmapResults( | 324 void FaviconService::RunFaviconRawCallbackWithBitmapResults( |
| 323 const FaviconRawCallback& callback, | 325 const FaviconRawCallback& callback, |
| 324 int desired_size_in_dip, | 326 int desired_size_in_dip, |
| 325 ui::ScaleFactor desired_scale_factor, | 327 ui::ScaleFactor desired_scale_factor, |
| 326 const std::vector<chrome::FaviconBitmapResult>& favicon_bitmap_results) { | 328 const std::vector<chrome::FaviconBitmapResult>& favicon_bitmap_results) { |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 &resized_bitmap_data)) { | 365 &resized_bitmap_data)) { |
| 364 callback.Run(chrome::FaviconBitmapResult()); | 366 callback.Run(chrome::FaviconBitmapResult()); |
| 365 return; | 367 return; |
| 366 } | 368 } |
| 367 | 369 |
| 368 bitmap_result.bitmap_data = base::RefCountedBytes::TakeVector( | 370 bitmap_result.bitmap_data = base::RefCountedBytes::TakeVector( |
| 369 &resized_bitmap_data); | 371 &resized_bitmap_data); |
| 370 callback.Run(bitmap_result); | 372 callback.Run(bitmap_result); |
| 371 } | 373 } |
| 372 | 374 |
| OLD | NEW |