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 "components/favicon/core/favicon_service.h" | 5 #include "components/favicon/core/favicon_service.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <cmath> | 8 #include <cmath> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 std::vector<float> scales = favicon_base::GetFaviconScales(); | 43 std::vector<float> scales = favicon_base::GetFaviconScales(); |
44 std::vector<int> sizes_in_pixel; | 44 std::vector<int> sizes_in_pixel; |
45 for (size_t i = 0; i < scales.size(); ++i) { | 45 for (size_t i = 0; i < scales.size(); ++i) { |
46 sizes_in_pixel.push_back(std::ceil(size_in_dip * scales[i])); | 46 sizes_in_pixel.push_back(std::ceil(size_in_dip * scales[i])); |
47 } | 47 } |
48 return sizes_in_pixel; | 48 return sizes_in_pixel; |
49 } | 49 } |
50 | 50 |
51 } // namespace | 51 } // namespace |
52 | 52 |
53 FaviconService::FaviconService(scoped_ptr<FaviconClient> favicon_client, | 53 FaviconService::FaviconService(std::unique_ptr<FaviconClient> favicon_client, |
54 history::HistoryService* history_service) | 54 history::HistoryService* history_service) |
55 : favicon_client_(std::move(favicon_client)), | 55 : favicon_client_(std::move(favicon_client)), |
56 history_service_(history_service) {} | 56 history_service_(history_service) {} |
57 | 57 |
58 FaviconService::~FaviconService() { | 58 FaviconService::~FaviconService() { |
59 } | 59 } |
60 | 60 |
61 // static | 61 // static |
62 void FaviconService::FaviconResultsCallbackRunner( | 62 void FaviconService::FaviconResultsCallbackRunner( |
63 const favicon_base::FaviconResultsCallback& callback, | 63 const favicon_base::FaviconResultsCallback& callback, |
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
367 callback.Run(favicon_base::FaviconRawBitmapResult()); | 367 callback.Run(favicon_base::FaviconRawBitmapResult()); |
368 return; | 368 return; |
369 } | 369 } |
370 | 370 |
371 bitmap_result.bitmap_data = base::RefCountedBytes::TakeVector( | 371 bitmap_result.bitmap_data = base::RefCountedBytes::TakeVector( |
372 &resized_bitmap_data); | 372 &resized_bitmap_data); |
373 callback.Run(bitmap_result); | 373 callback.Run(bitmap_result); |
374 } | 374 } |
375 | 375 |
376 } // namespace favicon | 376 } // namespace favicon |
OLD | NEW |