Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(110)

Side by Side Diff: ash/common/system/chromeos/network/network_icon.cc

Issue 2696193002: Remove non-md code from tray_vpn.cc (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "ash/common/system/chromeos/network/network_icon.h" 5 #include "ash/common/system/chromeos/network/network_icon.h"
6 6
7 #include "ash/common/system/chromeos/network/network_icon_animation.h" 7 #include "ash/common/system/chromeos/network/network_icon_animation.h"
8 #include "ash/common/system/chromeos/network/network_icon_animation_observer.h" 8 #include "ash/common/system/chromeos/network/network_icon_animation_observer.h"
9 #include "ash/common/system/tray/tray_constants.h" 9 #include "ash/common/system/tray/tray_constants.h"
10 #include "ash/resources/vector_icons/vector_icons.h" 10 #include "ash/resources/vector_icons/vector_icons.h"
(...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after
519 if (network->Matches(NetworkTypePattern::Ethernet())) { 519 if (network->Matches(NetworkTypePattern::Ethernet())) {
520 DCHECK_NE(ICON_TYPE_TRAY, icon_type); 520 DCHECK_NE(ICON_TYPE_TRAY, icon_type);
521 return gfx::CreateVectorIcon(kNetworkEthernetIcon, 521 return gfx::CreateVectorIcon(kNetworkEthernetIcon,
522 GetDefaultColorForIconType(ICON_TYPE_LIST)); 522 GetDefaultColorForIconType(ICON_TYPE_LIST));
523 } else if (network->Matches(NetworkTypePattern::Wireless())) { 523 } else if (network->Matches(NetworkTypePattern::Wireless())) {
524 DCHECK(strength_index > 0); 524 DCHECK(strength_index > 0);
525 return GetImageForIndex(ImageTypeForNetworkType(network->type()), icon_type, 525 return GetImageForIndex(ImageTypeForNetworkType(network->type()), icon_type,
526 strength_index); 526 strength_index);
527 } else if (network->Matches(NetworkTypePattern::VPN())) { 527 } else if (network->Matches(NetworkTypePattern::VPN())) {
528 DCHECK_NE(ICON_TYPE_TRAY, icon_type); 528 DCHECK_NE(ICON_TYPE_TRAY, icon_type);
529 return GetVpnImage(); 529 return gfx::CreateVectorIcon(kNetworkVpnIcon,
530 GetDefaultColorForIconType(ICON_TYPE_LIST));
530 } 531 }
531 532
532 NOTREACHED() << "Request for icon for unsupported type: " << network->type(); 533 NOTREACHED() << "Request for icon for unsupported type: " << network->type();
533 return gfx::ImageSkia(); 534 return gfx::ImageSkia();
534 } 535 }
535 536
536 //------------------------------------------------------------------------------ 537 //------------------------------------------------------------------------------
537 // Get connecting images 538 // Get connecting images
538 539
539 gfx::ImageSkia GetConnectingVpnImage(IconType icon_type) { 540 gfx::ImageSkia GetConnectingVpnImage(IconType icon_type) {
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
772 new SignalStrengthImageSource(ImageTypeForNetworkType(shill::kTypeWifi), 773 new SignalStrengthImageSource(ImageTypeForNetworkType(shill::kTypeWifi),
773 ICON_TYPE_LIST, kNumNetworkImages - 1); 774 ICON_TYPE_LIST, kNumNetworkImages - 1);
774 source->set_color(icon_color); 775 source->set_color(icon_color);
775 gfx::ImageSkia icon = gfx::ImageSkia(source, source->size()); 776 gfx::ImageSkia icon = gfx::ImageSkia(source, source->size());
776 Badges badges; 777 Badges badges;
777 badges.bottom_right = 778 badges.bottom_right =
778 gfx::CreateVectorIcon(kNetworkBadgeAddOtherIcon, badge_color); 779 gfx::CreateVectorIcon(kNetworkBadgeAddOtherIcon, badge_color);
779 return NetworkIconImageSource::CreateImage(icon, badges); 780 return NetworkIconImageSource::CreateImage(icon, badges);
780 } 781 }
781 782
782 gfx::ImageSkia GetVpnImage() {
783 return gfx::CreateVectorIcon(kNetworkVpnIcon,
784 GetDefaultColorForIconType(ICON_TYPE_LIST));
785 }
786
787 base::string16 GetLabelForNetwork(const chromeos::NetworkState* network, 783 base::string16 GetLabelForNetwork(const chromeos::NetworkState* network,
788 IconType icon_type) { 784 IconType icon_type) {
789 DCHECK(network); 785 DCHECK(network);
790 std::string activation_state = network->activation_state(); 786 std::string activation_state = network->activation_state();
791 if (icon_type == ICON_TYPE_LIST || icon_type == ICON_TYPE_MENU_LIST) { 787 if (icon_type == ICON_TYPE_LIST || icon_type == ICON_TYPE_MENU_LIST) {
792 // Show "<network>: [Connecting|Activating|Reconnecting]..." 788 // Show "<network>: [Connecting|Activating|Reconnecting]..."
793 // TODO(varkha): Remaining states should migrate to secondary status in the 789 // TODO(varkha): Remaining states should migrate to secondary status in the
794 // network item and no longer be part of the label. 790 // network item and no longer be part of the label.
795 // See http://crbug.com/676181 . 791 // See http://crbug.com/676181 .
796 if (network->IsReconnecting()) { 792 if (network->IsReconnecting()) {
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
952 network_paths.insert((*iter)->path()); 948 network_paths.insert((*iter)->path());
953 } 949 }
954 PurgeIconMap(ICON_TYPE_TRAY, network_paths); 950 PurgeIconMap(ICON_TYPE_TRAY, network_paths);
955 PurgeIconMap(ICON_TYPE_DEFAULT_VIEW, network_paths); 951 PurgeIconMap(ICON_TYPE_DEFAULT_VIEW, network_paths);
956 PurgeIconMap(ICON_TYPE_LIST, network_paths); 952 PurgeIconMap(ICON_TYPE_LIST, network_paths);
957 PurgeIconMap(ICON_TYPE_MENU_LIST, network_paths); 953 PurgeIconMap(ICON_TYPE_MENU_LIST, network_paths);
958 } 954 }
959 955
960 } // namespace network_icon 956 } // namespace network_icon
961 } // namespace ash 957 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/system/chromeos/network/network_icon.h ('k') | ash/common/system/chromeos/network/tray_vpn.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698