OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "extensions/browser/image_loader.h" | 5 #include "extensions/browser/image_loader.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <vector> | 10 #include <vector> |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 const Extension* extension, | 237 const Extension* extension, |
238 const gfx::Size& dip_size, | 238 const gfx::Size& dip_size, |
239 const ImageLoaderImageCallback& callback) { | 239 const ImageLoaderImageCallback& callback) { |
240 std::vector<ImageRepresentation> info_list; | 240 std::vector<ImageRepresentation> info_list; |
241 | 241 |
242 std::set<float> scales; | 242 std::set<float> scales; |
243 for (auto scale : ui::GetSupportedScaleFactors()) | 243 for (auto scale : ui::GetSupportedScaleFactors()) |
244 scales.insert(ui::GetScaleForScaleFactor(scale)); | 244 scales.insert(ui::GetScaleForScaleFactor(scale)); |
245 | 245 |
246 // There may not be a screen in unit tests. | 246 // There may not be a screen in unit tests. |
247 auto screen = display::Screen::GetScreen(); | 247 auto* screen = display::Screen::GetScreen(); |
248 if (screen) { | 248 if (screen) { |
249 for (const auto& display : screen->GetAllDisplays()) | 249 for (const auto& display : screen->GetAllDisplays()) |
250 scales.insert(display.device_scale_factor()); | 250 scales.insert(display.device_scale_factor()); |
251 } | 251 } |
252 | 252 |
253 for (auto scale : scales) { | 253 for (auto scale : scales) { |
254 const gfx::Size px_size = gfx::ScaleToFlooredSize(dip_size, scale); | 254 const gfx::Size px_size = gfx::ScaleToFlooredSize(dip_size, scale); |
255 ExtensionResource image = IconsInfo::GetIconResource( | 255 ExtensionResource image = IconsInfo::GetIconResource( |
256 extension, px_size.width(), ExtensionIconSet::MATCH_BIGGER); | 256 extension, px_size.width(), ExtensionIconSet::MATCH_BIGGER); |
257 info_list.push_back(ImageRepresentation( | 257 info_list.push_back(ImageRepresentation( |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
340 it != image_skia_map.end(); | 340 it != image_skia_map.end(); |
341 ++it) { | 341 ++it) { |
342 it->second.MakeThreadSafe(); | 342 it->second.MakeThreadSafe(); |
343 image_family.Add(it->second); | 343 image_family.Add(it->second); |
344 } | 344 } |
345 | 345 |
346 callback.Run(image_family); | 346 callback.Run(image_family); |
347 } | 347 } |
348 | 348 |
349 } // namespace extensions | 349 } // namespace extensions |
OLD | NEW |