| 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_handler.h" | 5 #include "chrome/browser/favicon/favicon_handler.h" |
| 6 | 6 |
| 7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 // - Favicons inserted into the history backend by sync. | 120 // - Favicons inserted into the history backend by sync. |
| 121 // - Favicons for imported bookmarks. | 121 // - Favicons for imported bookmarks. |
| 122 std::vector<gfx::Size> favicon_sizes; | 122 std::vector<gfx::Size> favicon_sizes; |
| 123 for (size_t i = 0; i < bitmap_results.size(); ++i) | 123 for (size_t i = 0; i < bitmap_results.size(); ++i) |
| 124 favicon_sizes.push_back(bitmap_results[i].pixel_size); | 124 favicon_sizes.push_back(bitmap_results[i].pixel_size); |
| 125 | 125 |
| 126 std::vector<ui::ScaleFactor> scale_factors = | 126 std::vector<ui::ScaleFactor> scale_factors = |
| 127 FaviconUtil::GetFaviconScaleFactors(); | 127 FaviconUtil::GetFaviconScaleFactors(); |
| 128 for (size_t i = 0; i < scale_factors.size(); ++i) { | 128 for (size_t i = 0; i < scale_factors.size(); ++i) { |
| 129 int edge_size_in_pixel = floor( | 129 int edge_size_in_pixel = floor( |
| 130 desired_size_in_dip * ui::GetImageScale(scale_factors[i])); | 130 desired_size_in_dip * ui::GetScaleForScaleFactor(scale_factors[i])); |
| 131 std::vector<gfx::Size>::iterator it = std::find(favicon_sizes.begin(), | 131 std::vector<gfx::Size>::iterator it = std::find(favicon_sizes.begin(), |
| 132 favicon_sizes.end(), gfx::Size(edge_size_in_pixel, edge_size_in_pixel)); | 132 favicon_sizes.end(), gfx::Size(edge_size_in_pixel, edge_size_in_pixel)); |
| 133 if (it == favicon_sizes.end()) | 133 if (it == favicon_sizes.end()) |
| 134 return true; | 134 return true; |
| 135 } | 135 } |
| 136 return false; | 136 return false; |
| 137 } | 137 } |
| 138 | 138 |
| 139 // Returns true if at least one of |bitmap_results| is valid. | 139 // Returns true if at least one of |bitmap_results| is valid. |
| 140 bool HasValidResult( | 140 bool HasValidResult( |
| (...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 684 } else { | 684 } else { |
| 685 gfx::Size largest = i->icon_sizes[index]; | 685 gfx::Size largest = i->icon_sizes[index]; |
| 686 i->icon_sizes.clear(); | 686 i->icon_sizes.clear(); |
| 687 i->icon_sizes.push_back(largest); | 687 i->icon_sizes.push_back(largest); |
| 688 ++i; | 688 ++i; |
| 689 } | 689 } |
| 690 } | 690 } |
| 691 std::stable_sort(image_urls_.begin(), image_urls_.end(), | 691 std::stable_sort(image_urls_.begin(), image_urls_.end(), |
| 692 CompareIconSize); | 692 CompareIconSize); |
| 693 } | 693 } |
| OLD | NEW |