| 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 "ui/chromeos/network/network_icon.h" | 5 #include "ui/chromeos/network/network_icon.h" |
| 6 | 6 |
| 7 #include "base/macros.h" | 7 #include "base/macros.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "chromeos/network/device_state.h" | 9 #include "chromeos/network/device_state.h" |
| 10 #include "chromeos/network/network_connection_handler.h" | 10 #include "chromeos/network/network_connection_handler.h" |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 public: | 223 public: |
| 224 NetworkIconImageSource(const gfx::ImageSkia& icon, const Badges& badges) | 224 NetworkIconImageSource(const gfx::ImageSkia& icon, const Badges& badges) |
| 225 : icon_(icon), | 225 : icon_(icon), |
| 226 badges_(badges) { | 226 badges_(badges) { |
| 227 } | 227 } |
| 228 ~NetworkIconImageSource() override {} | 228 ~NetworkIconImageSource() override {} |
| 229 | 229 |
| 230 // TODO(pkotwicz): Figure out what to do when a new image resolution becomes | 230 // TODO(pkotwicz): Figure out what to do when a new image resolution becomes |
| 231 // available. | 231 // available. |
| 232 gfx::ImageSkiaRep GetImageForScale(float scale) override { | 232 gfx::ImageSkiaRep GetImageForScale(float scale) override { |
| 233 gfx::ImageSkiaRep icon_rep = icon_.GetRepresentation(scale); | 233 gfx::Canvas canvas(icon_.size(), scale, false); |
| 234 if (icon_rep.is_null()) | 234 canvas.DrawImageInt(icon_, 0, 0); |
| 235 return gfx::ImageSkiaRep(); | 235 |
| 236 gfx::Canvas canvas(icon_rep, false); | |
| 237 if (badges_.top_left) | 236 if (badges_.top_left) |
| 238 canvas.DrawImageInt(*badges_.top_left, 0, 0); | 237 canvas.DrawImageInt(*badges_.top_left, 0, 0); |
| 239 if (badges_.top_right) | 238 if (badges_.top_right) |
| 240 canvas.DrawImageInt(*badges_.top_right, | 239 canvas.DrawImageInt(*badges_.top_right, |
| 241 icon_.width() - badges_.top_right->width(), 0); | 240 icon_.width() - badges_.top_right->width(), 0); |
| 242 if (badges_.bottom_left) { | 241 if (badges_.bottom_left) { |
| 243 canvas.DrawImageInt(*badges_.bottom_left, | 242 canvas.DrawImageInt(*badges_.bottom_left, |
| 244 0, icon_.height() - badges_.bottom_left->height()); | 243 0, icon_.height() - badges_.bottom_left->height()); |
| 245 } | 244 } |
| 246 if (badges_.bottom_right) { | 245 if (badges_.bottom_right) { |
| (...skipping 653 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 900 iter != networks.end(); ++iter) { | 899 iter != networks.end(); ++iter) { |
| 901 network_paths.insert((*iter)->path()); | 900 network_paths.insert((*iter)->path()); |
| 902 } | 901 } |
| 903 PurgeIconMap(ICON_TYPE_TRAY, network_paths); | 902 PurgeIconMap(ICON_TYPE_TRAY, network_paths); |
| 904 PurgeIconMap(ICON_TYPE_DEFAULT_VIEW, network_paths); | 903 PurgeIconMap(ICON_TYPE_DEFAULT_VIEW, network_paths); |
| 905 PurgeIconMap(ICON_TYPE_LIST, network_paths); | 904 PurgeIconMap(ICON_TYPE_LIST, network_paths); |
| 906 } | 905 } |
| 907 | 906 |
| 908 } // namespace network_icon | 907 } // namespace network_icon |
| 909 } // namespace ui | 908 } // namespace ui |
| OLD | NEW |