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 <cmath> | 7 #include <cmath> |
8 | 8 |
9 #include "base/hash.h" | 9 #include "base/hash.h" |
10 #include "base/message_loop/message_loop_proxy.h" | 10 #include "base/message_loop/message_loop_proxy.h" |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 std::vector<int> sizes_in_pixel; | 71 std::vector<int> sizes_in_pixel; |
72 for (size_t i = 0; i < scales.size(); ++i) { | 72 for (size_t i = 0; i < scales.size(); ++i) { |
73 sizes_in_pixel.push_back(std::ceil(size_in_dip * scales[i])); | 73 sizes_in_pixel.push_back(std::ceil(size_in_dip * scales[i])); |
74 } | 74 } |
75 return sizes_in_pixel; | 75 return sizes_in_pixel; |
76 } | 76 } |
77 | 77 |
78 } // namespace | 78 } // namespace |
79 | 79 |
80 FaviconService::FaviconService(Profile* profile, FaviconClient* favicon_client) | 80 FaviconService::FaviconService(Profile* profile, FaviconClient* favicon_client) |
81 : history_service_( | 81 : history_service_(HistoryServiceFactory::GetForProfile( |
82 HistoryServiceFactory::GetForProfile(profile, | 82 profile, |
83 Profile::EXPLICIT_ACCESS)), | 83 ServiceAccessType::EXPLICIT_ACCESS)), |
84 profile_(profile), | 84 profile_(profile), |
85 favicon_client_(favicon_client) { | 85 favicon_client_(favicon_client) { |
86 } | 86 } |
87 | 87 |
88 // static | 88 // static |
89 void FaviconService::FaviconResultsCallbackRunner( | 89 void FaviconService::FaviconResultsCallbackRunner( |
90 const favicon_base::FaviconResultsCallback& callback, | 90 const favicon_base::FaviconResultsCallback& callback, |
91 const std::vector<favicon_base::FaviconRawBitmapResult>* results) { | 91 const std::vector<favicon_base::FaviconRawBitmapResult>* results) { |
92 callback.Run(*results); | 92 callback.Run(*results); |
93 } | 93 } |
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
418 if (!gfx::PNGCodec::EncodeBGRASkBitmap(resized_image.AsBitmap(), false, | 418 if (!gfx::PNGCodec::EncodeBGRASkBitmap(resized_image.AsBitmap(), false, |
419 &resized_bitmap_data)) { | 419 &resized_bitmap_data)) { |
420 callback.Run(favicon_base::FaviconRawBitmapResult()); | 420 callback.Run(favicon_base::FaviconRawBitmapResult()); |
421 return; | 421 return; |
422 } | 422 } |
423 | 423 |
424 bitmap_result.bitmap_data = base::RefCountedBytes::TakeVector( | 424 bitmap_result.bitmap_data = base::RefCountedBytes::TakeVector( |
425 &resized_bitmap_data); | 425 &resized_bitmap_data); |
426 callback.Run(bitmap_result); | 426 callback.Run(bitmap_result); |
427 } | 427 } |
OLD | NEW |