OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <math.h> | 7 #include <math.h> |
8 | 8 |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "chrome/browser/chromeos/cros/cros_library.h" | 10 #include "chrome/browser/chromeos/cros/cros_library.h" |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 } | 284 } |
285 } | 285 } |
286 | 286 |
287 // Sets up the various badges: | 287 // Sets up the various badges: |
288 // top_left: Cellular Roaming | 288 // top_left: Cellular Roaming |
289 // top_right: Unused | 289 // top_right: Unused |
290 // bottom_left: VPN | 290 // bottom_left: VPN |
291 // bottom_right: disconnected / secure / technology / warning | 291 // bottom_right: disconnected / secure / technology / warning |
292 void SetBadges(const Network* network) { | 292 void SetBadges(const Network* network) { |
293 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 293 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
| 294 chromeos::NetworkLibrary* cros = |
| 295 chromeos::CrosLibrary::Get()->GetNetworkLibrary(); |
294 | 296 |
295 switch (network->type()) { | 297 switch (network->type()) { |
296 case TYPE_ETHERNET: { | 298 case TYPE_ETHERNET: { |
297 if (network->disconnected()) { | 299 if (network->disconnected()) { |
298 bottom_right_badge_ = | 300 bottom_right_badge_ = |
299 rb.GetBitmapNamed(IDR_STATUSBAR_NETWORK_DISCONNECTED); | 301 rb.GetBitmapNamed(IDR_STATUSBAR_NETWORK_DISCONNECTED); |
300 } | 302 } |
301 break; | 303 break; |
302 } | 304 } |
303 case TYPE_WIFI: { | 305 case TYPE_WIFI: { |
304 const WifiNetwork* wifi = | 306 const WifiNetwork* wifi = |
305 static_cast<const WifiNetwork*>(network); | 307 static_cast<const WifiNetwork*>(network); |
306 if (wifi->encrypted() && !is_status_bar_) | 308 if (wifi->encrypted() && !is_status_bar_) |
307 bottom_right_badge_ = rb.GetBitmapNamed(IDR_STATUSBAR_NETWORK_SECURE); | 309 bottom_right_badge_ = rb.GetBitmapNamed(IDR_STATUSBAR_NETWORK_SECURE); |
308 break; | 310 break; |
309 } | 311 } |
310 case TYPE_CELLULAR: { | 312 case TYPE_CELLULAR: { |
311 const CellularNetwork* cellular = | 313 const CellularNetwork* cellular = |
312 static_cast<const CellularNetwork*>(network); | 314 static_cast<const CellularNetwork*>(network); |
313 if (cellular->roaming_state() == ROAMING_STATE_ROAMING) | 315 if (cellular->roaming_state() == ROAMING_STATE_ROAMING && |
| 316 !cros->IsCellularAlwaysInRoaming()) { |
| 317 // For cellular that always in roaming don't show roaming badge. |
314 top_left_badge_ = rb.GetBitmapNamed(IDR_STATUSBAR_NETWORK_ROAMING); | 318 top_left_badge_ = rb.GetBitmapNamed(IDR_STATUSBAR_NETWORK_ROAMING); |
| 319 } |
315 if (!cellular->connecting()) | 320 if (!cellular->connecting()) |
316 bottom_right_badge_ = BadgeForNetworkTechnology(cellular); | 321 bottom_right_badge_ = BadgeForNetworkTechnology(cellular); |
317 break; | 322 break; |
318 } | 323 } |
319 default: | 324 default: |
320 break; | 325 break; |
321 } | 326 } |
322 } | 327 } |
323 | 328 |
324 // Clears any previous state then sets the base icon and badges. | 329 // Clears any previous state then sets the base icon and badges. |
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
683 ethernet_icon->width(), ethernet_icon->height(), false); | 688 ethernet_icon->width(), ethernet_icon->height(), false); |
684 canvas.DrawBitmapInt(*ethernet_icon, 0, 0); | 689 canvas.DrawBitmapInt(*ethernet_icon, 0, 0); |
685 const SkBitmap* vpn_badge = rb.GetBitmapNamed(kVpnBadgeId); | 690 const SkBitmap* vpn_badge = rb.GetBitmapNamed(kVpnBadgeId); |
686 canvas.DrawBitmapInt(*vpn_badge, kBadgeLeftX, kBadgeBottomY); | 691 canvas.DrawBitmapInt(*vpn_badge, kBadgeLeftX, kBadgeBottomY); |
687 vpn_bitmap = new SkBitmap(canvas.ExtractBitmap()); | 692 vpn_bitmap = new SkBitmap(canvas.ExtractBitmap()); |
688 } | 693 } |
689 return vpn_bitmap; | 694 return vpn_bitmap; |
690 } | 695 } |
691 | 696 |
692 } // chromeos | 697 } // chromeos |
OLD | NEW |