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

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

Issue 2587133003: [ash-md] Removes "Connecting..." suffix from the network / VPN rows (Closed)
Patch Set: [ash-md] Removes 'Connecting...' suffix from the network row (nit) Created 4 years 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/material_design/material_design_controller.h" 7 #include "ash/common/material_design/material_design_controller.h"
8 #include "ash/common/system/chromeos/network/network_icon_animation.h" 8 #include "ash/common/system/chromeos/network/network_icon_animation.h"
9 #include "ash/common/system/chromeos/network/network_icon_animation_observer.h" 9 #include "ash/common/system/chromeos/network/network_icon_animation_observer.h"
10 #include "ash/common/system/tray/tray_constants.h" 10 #include "ash/common/system/tray/tray_constants.h"
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 193
194 SkColor GetDefaultColorForIconType(IconType icon_type) { 194 SkColor GetDefaultColorForIconType(IconType icon_type) {
195 return icon_type == ICON_TYPE_TRAY ? kTrayIconColor : kMenuIconColor; 195 return icon_type == ICON_TYPE_TRAY ? kTrayIconColor : kMenuIconColor;
196 } 196 }
197 197
198 bool IconTypeIsDark(IconType icon_type) { 198 bool IconTypeIsDark(IconType icon_type) {
199 return (icon_type != ICON_TYPE_TRAY); 199 return (icon_type != ICON_TYPE_TRAY);
200 } 200 }
201 201
202 bool IconTypeHasVPNBadge(IconType icon_type) { 202 bool IconTypeHasVPNBadge(IconType icon_type) {
203 return (icon_type != ICON_TYPE_LIST); 203 return (icon_type != ICON_TYPE_LIST && icon_type != ICON_TYPE_MENU_LIST);
204 } 204 }
205 205
206 // This defines how we assemble a network icon. 206 // This defines how we assemble a network icon.
207 class NetworkIconImageSource : public gfx::CanvasImageSource { 207 class NetworkIconImageSource : public gfx::CanvasImageSource {
208 public: 208 public:
209 NetworkIconImageSource(const gfx::ImageSkia& icon, const Badges& badges) 209 NetworkIconImageSource(const gfx::ImageSkia& icon, const Badges& badges)
210 : CanvasImageSource(icon.size(), false), icon_(icon), badges_(badges) {} 210 : CanvasImageSource(icon.size(), false), icon_(icon), badges_(badges) {}
211 ~NetworkIconImageSource() override {} 211 ~NetworkIconImageSource() override {}
212 212
213 // TODO(pkotwicz): Figure out what to do when a new image resolution becomes 213 // TODO(pkotwicz): Figure out what to do when a new image resolution becomes
(...skipping 705 matching lines...) Expand 10 before | Expand all | Expand 10 after
919 ? gfx::CreateVectorIcon(kNetworkVpnIcon, 919 ? gfx::CreateVectorIcon(kNetworkVpnIcon,
920 GetDefaultColorForIconType(ICON_TYPE_LIST)) 920 GetDefaultColorForIconType(ICON_TYPE_LIST))
921 : *ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( 921 : *ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed(
922 IDR_AURA_UBER_TRAY_NETWORK_VPN); 922 IDR_AURA_UBER_TRAY_NETWORK_VPN);
923 } 923 }
924 924
925 base::string16 GetLabelForNetwork(const chromeos::NetworkState* network, 925 base::string16 GetLabelForNetwork(const chromeos::NetworkState* network,
926 IconType icon_type) { 926 IconType icon_type) {
927 DCHECK(network); 927 DCHECK(network);
928 std::string activation_state = network->activation_state(); 928 std::string activation_state = network->activation_state();
929 if (icon_type == ICON_TYPE_LIST) { 929 if (icon_type == ICON_TYPE_LIST || icon_type == ICON_TYPE_MENU_LIST) {
930 // Show "<network>: [Connecting|Activating|Reconnecting]..." 930 // Show "<network>: [Connecting|Activating|Reconnecting]..."
931 // TODO(varkha): Remaining states should migrate to secondary status in the
932 // network item and no longer be part of the label.
933 // See http://crbug.com/676181 .
931 if (network->IsReconnecting()) { 934 if (network->IsReconnecting()) {
932 return l10n_util::GetStringFUTF16( 935 return l10n_util::GetStringFUTF16(
933 IDS_ASH_STATUS_TRAY_NETWORK_LIST_RECONNECTING, 936 IDS_ASH_STATUS_TRAY_NETWORK_LIST_RECONNECTING,
sadrul 2016/12/21 02:05:54 We want to still show "Reconnecting..."?
varkha 2016/12/21 04:36:49 For now yes, this is what the mentioned bug is abo
934 base::UTF8ToUTF16(network->name())); 937 base::UTF8ToUTF16(network->name()));
935 } 938 }
936 if (network->IsConnectingState()) { 939 if (icon_type != ICON_TYPE_MENU_LIST && network->IsConnectingState()) {
937 return l10n_util::GetStringFUTF16( 940 return l10n_util::GetStringFUTF16(
938 IDS_ASH_STATUS_TRAY_NETWORK_LIST_CONNECTING, 941 IDS_ASH_STATUS_TRAY_NETWORK_LIST_CONNECTING,
939 base::UTF8ToUTF16(network->name())); 942 base::UTF8ToUTF16(network->name()));
940 } 943 }
941 if (activation_state == shill::kActivationStateActivating) { 944 if (activation_state == shill::kActivationStateActivating) {
942 return l10n_util::GetStringFUTF16( 945 return l10n_util::GetStringFUTF16(
943 IDS_ASH_STATUS_TRAY_NETWORK_LIST_ACTIVATING, 946 IDS_ASH_STATUS_TRAY_NETWORK_LIST_ACTIVATING,
944 base::UTF8ToUTF16(network->name())); 947 base::UTF8ToUTF16(network->name()));
945 } 948 }
946 // Show "Activate <network>" in list view only. 949 // Show "Activate <network>" in list view only.
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
1082 NetworkHandler::Get()->network_state_handler()->GetVisibleNetworkList( 1085 NetworkHandler::Get()->network_state_handler()->GetVisibleNetworkList(
1083 &networks); 1086 &networks);
1084 std::set<std::string> network_paths; 1087 std::set<std::string> network_paths;
1085 for (NetworkStateHandler::NetworkStateList::iterator iter = networks.begin(); 1088 for (NetworkStateHandler::NetworkStateList::iterator iter = networks.begin();
1086 iter != networks.end(); ++iter) { 1089 iter != networks.end(); ++iter) {
1087 network_paths.insert((*iter)->path()); 1090 network_paths.insert((*iter)->path());
1088 } 1091 }
1089 PurgeIconMap(ICON_TYPE_TRAY, network_paths); 1092 PurgeIconMap(ICON_TYPE_TRAY, network_paths);
1090 PurgeIconMap(ICON_TYPE_DEFAULT_VIEW, network_paths); 1093 PurgeIconMap(ICON_TYPE_DEFAULT_VIEW, network_paths);
1091 PurgeIconMap(ICON_TYPE_LIST, network_paths); 1094 PurgeIconMap(ICON_TYPE_LIST, network_paths);
1095 PurgeIconMap(ICON_TYPE_MENU_LIST, network_paths);
1092 } 1096 }
1093 1097
1094 } // namespace network_icon 1098 } // namespace network_icon
1095 } // namespace ash 1099 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698