OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/manifest/manifest_icon_selector.h" | 5 #include "chrome/browser/manifest/manifest_icon_selector.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <cmath> | 10 #include <cmath> |
11 #include <limits> | 11 #include <limits> |
12 | 12 |
13 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
14 #include "components/mime_util/mime_util.h" | 14 #include "components/mime_util/mime_util.h" |
15 #include "content/public/browser/web_contents.h" | 15 #include "content/public/browser/web_contents.h" |
16 #include "ui/gfx/screen.h" | 16 #include "ui/display/screen.h" |
17 | 17 |
18 using content::Manifest; | 18 using content::Manifest; |
19 | 19 |
20 ManifestIconSelector::ManifestIconSelector(int ideal_icon_size_in_px, | 20 ManifestIconSelector::ManifestIconSelector(int ideal_icon_size_in_px, |
21 int minimum_icon_size_in_px) | 21 int minimum_icon_size_in_px) |
22 : ideal_icon_size_in_px_(ideal_icon_size_in_px), | 22 : ideal_icon_size_in_px_(ideal_icon_size_in_px), |
23 minimum_icon_size_in_px_(minimum_icon_size_in_px) { | 23 minimum_icon_size_in_px_(minimum_icon_size_in_px) { |
24 } | 24 } |
25 | 25 |
26 bool ManifestIconSelector::IconSizesContainsPreferredSize( | 26 bool ManifestIconSelector::IconSizesContainsPreferredSize( |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 int index = selector.FindBestMatchingIcon(icons); | 147 int index = selector.FindBestMatchingIcon(icons); |
148 if (index == -1) | 148 if (index == -1) |
149 return GURL(); | 149 return GURL(); |
150 return icons[index].src; | 150 return icons[index].src; |
151 } | 151 } |
152 | 152 |
153 // static | 153 // static |
154 int ManifestIconSelector::ConvertIconSizeFromDpToPx(int icon_size_in_dp) { | 154 int ManifestIconSelector::ConvertIconSizeFromDpToPx(int icon_size_in_dp) { |
155 return static_cast<int>(round( | 155 return static_cast<int>(round( |
156 icon_size_in_dp * | 156 icon_size_in_dp * |
157 gfx::Screen::GetScreen()->GetPrimaryDisplay().device_scale_factor())); | 157 display::Screen::GetScreen()->GetPrimaryDisplay().device_scale_factor())); |
158 } | 158 } |
OLD | NEW |