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/chromeos/status/network_menu_icon.h" | 5 #include "chrome/browser/chromeos/status/network_menu_icon.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 #include <map> | 9 #include <map> |
10 #include <utility> | 10 #include <utility> |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 color_(color) { | 264 color_(color) { |
265 } | 265 } |
266 virtual ~NetworkMenuIconSource() {} | 266 virtual ~NetworkMenuIconSource() {} |
267 | 267 |
268 virtual gfx::ImageSkiaRep GetImageForScale( | 268 virtual gfx::ImageSkiaRep GetImageForScale( |
269 ui::ScaleFactor scale_factor) OVERRIDE { | 269 ui::ScaleFactor scale_factor) OVERRIDE { |
270 int width, height; | 270 int width, height; |
271 gfx::ImageSkia* images; | 271 gfx::ImageSkia* images; |
272 if (type_ == NetworkMenuIcon::ARCS) { | 272 if (type_ == NetworkMenuIcon::ARCS) { |
273 if (index_ >= kNumArcsImages) | 273 if (index_ >= kNumArcsImages) |
274 return gfx::ImageSkia(); | 274 return gfx::ImageSkiaRep(); |
275 images = ResourceBundle::GetSharedInstance().GetImageSkiaNamed( | 275 images = ResourceBundle::GetSharedInstance().GetImageSkiaNamed( |
276 color_ == NetworkMenuIcon::COLOR_DARK ? | 276 color_ == NetworkMenuIcon::COLOR_DARK ? |
277 IDR_STATUSBAR_NETWORK_ARCS_DARK : IDR_STATUSBAR_NETWORK_ARCS_LIGHT); | 277 IDR_STATUSBAR_NETWORK_ARCS_DARK : IDR_STATUSBAR_NETWORK_ARCS_LIGHT); |
278 width = images->width(); | 278 width = images->width(); |
279 height = images->height() / kNumArcsImages; | 279 height = images->height() / kNumArcsImages; |
280 } else { | 280 } else { |
281 if (index_ >= kNumBarsImages) | 281 if (index_ >= kNumBarsImages) |
282 return gfx::ImageSkia(); | 282 return gfx::ImageSkiaRep(); |
283 | 283 |
284 images = ResourceBundle::GetSharedInstance().GetImageSkiaNamed( | 284 images = ResourceBundle::GetSharedInstance().GetImageSkiaNamed( |
285 color_ == NetworkMenuIcon::COLOR_DARK ? | 285 color_ == NetworkMenuIcon::COLOR_DARK ? |
286 IDR_STATUSBAR_NETWORK_BARS_DARK : IDR_STATUSBAR_NETWORK_BARS_LIGHT); | 286 IDR_STATUSBAR_NETWORK_BARS_DARK : IDR_STATUSBAR_NETWORK_BARS_LIGHT); |
287 width = images->width(); | 287 width = images->width(); |
288 height = images->height() / kNumBarsImages; | 288 height = images->height() / kNumBarsImages; |
289 } | 289 } |
290 gfx::ImageSkiaRep image_rep = images->GetRepresentation(scale_factor); | 290 gfx::ImageSkiaRep image_rep = images->GetRepresentation(scale_factor); |
291 | 291 |
292 float scale = ui::GetScaleFactorScale(image_rep.scale_factor()); | 292 float scale = ui::GetScaleFactorScale(image_rep.scale_factor()); |
(...skipping 676 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
969 const gfx::ImageSkia NetworkMenuIcon::GetConnectedImage(ImageType type, | 969 const gfx::ImageSkia NetworkMenuIcon::GetConnectedImage(ImageType type, |
970 ResourceColorTheme color) { | 970 ResourceColorTheme color) { |
971 return GetImage(type, NumImages(type) - 1, color); | 971 return GetImage(type, NumImages(type) - 1, color); |
972 } | 972 } |
973 | 973 |
974 int NetworkMenuIcon::NumImages(ImageType type) { | 974 int NetworkMenuIcon::NumImages(ImageType type) { |
975 return (type == ARCS) ? kNumArcsImages : kNumBarsImages; | 975 return (type == ARCS) ? kNumArcsImages : kNumBarsImages; |
976 } | 976 } |
977 | 977 |
978 } // chromeos | 978 } // chromeos |
OLD | NEW |