| 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 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 const Extension* extension, | 239 const Extension* extension, |
| 240 const gfx::Size& dip_size, | 240 const gfx::Size& dip_size, |
| 241 const ImageLoaderImageCallback& callback) { | 241 const ImageLoaderImageCallback& callback) { |
| 242 std::vector<ImageRepresentation> info_list; | 242 std::vector<ImageRepresentation> info_list; |
| 243 | 243 |
| 244 std::set<float> scales; | 244 std::set<float> scales; |
| 245 for (auto scale : ui::GetSupportedScaleFactors()) | 245 for (auto scale : ui::GetSupportedScaleFactors()) |
| 246 scales.insert(ui::GetScaleForScaleFactor(scale)); | 246 scales.insert(ui::GetScaleForScaleFactor(scale)); |
| 247 | 247 |
| 248 // There may not be a screen in unit tests. | 248 // There may not be a screen in unit tests. |
| 249 auto screen = display::Screen::GetScreen(); | 249 auto* screen = display::Screen::GetScreen(); |
| 250 if (screen) { | 250 if (screen) { |
| 251 for (const auto& display : screen->GetAllDisplays()) | 251 for (const auto& display : screen->GetAllDisplays()) |
| 252 scales.insert(display.device_scale_factor()); | 252 scales.insert(display.device_scale_factor()); |
| 253 } | 253 } |
| 254 | 254 |
| 255 for (auto scale : scales) { | 255 for (auto scale : scales) { |
| 256 const gfx::Size px_size = gfx::ScaleToFlooredSize(dip_size, scale); | 256 const gfx::Size px_size = gfx::ScaleToFlooredSize(dip_size, scale); |
| 257 ExtensionResource image = IconsInfo::GetIconResource( | 257 ExtensionResource image = IconsInfo::GetIconResource( |
| 258 extension, px_size.width(), ExtensionIconSet::MATCH_BIGGER); | 258 extension, px_size.width(), ExtensionIconSet::MATCH_BIGGER); |
| 259 info_list.push_back(ImageRepresentation( | 259 info_list.push_back(ImageRepresentation( |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 it != image_skia_map.end(); | 345 it != image_skia_map.end(); |
| 346 ++it) { | 346 ++it) { |
| 347 it->second.MakeThreadSafe(); | 347 it->second.MakeThreadSafe(); |
| 348 image_family.Add(it->second); | 348 image_family.Add(it->second); |
| 349 } | 349 } |
| 350 | 350 |
| 351 callback.Run(image_family); | 351 callback.Run(image_family); |
| 352 } | 352 } |
| 353 | 353 |
| 354 } // namespace extensions | 354 } // namespace extensions |
| OLD | NEW |