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 "ash/common/system/chromeos/network/tray_vpn.h" | 5 #include "ash/common/system/chromeos/network/tray_vpn.h" |
6 | 6 |
7 #include "ash/common/session/session_state_delegate.h" | 7 #include "ash/common/session/session_state_delegate.h" |
8 #include "ash/common/system/chromeos/network/network_state_list_detailed_view.h" | 8 #include "ash/common/system/chromeos/network/network_state_list_detailed_view.h" |
9 #include "ash/common/system/chromeos/network/vpn_delegate.h" | 9 #include "ash/common/system/chromeos/network/vpn_delegate.h" |
10 #include "ash/common/system/tray/system_tray.h" | 10 #include "ash/common/system/tray/system_tray.h" |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 void NetworkIconChanged() override { Update(); } | 80 void NetworkIconChanged() override { Update(); } |
81 | 81 |
82 private: | 82 private: |
83 void GetNetworkStateHandlerImageAndLabel(gfx::ImageSkia* image, | 83 void GetNetworkStateHandlerImageAndLabel(gfx::ImageSkia* image, |
84 base::string16* label, | 84 base::string16* label, |
85 bool* animating) { | 85 bool* animating) { |
86 NetworkStateHandler* handler = | 86 NetworkStateHandler* handler = |
87 NetworkHandler::Get()->network_state_handler(); | 87 NetworkHandler::Get()->network_state_handler(); |
88 const NetworkState* vpn = | 88 const NetworkState* vpn = |
89 handler->FirstNetworkByType(NetworkTypePattern::VPN()); | 89 handler->FirstNetworkByType(NetworkTypePattern::VPN()); |
| 90 *image = ui::network_icon::GetVpnImage(); |
90 if (!vpn || (!vpn->IsConnectedState() && !vpn->IsConnectingState())) { | 91 if (!vpn || (!vpn->IsConnectedState() && !vpn->IsConnectingState())) { |
91 *image = ui::network_icon::GetImageForDisconnectedNetwork( | |
92 ui::network_icon::ICON_TYPE_DEFAULT_VIEW, shill::kTypeVPN); | |
93 if (label) { | 92 if (label) { |
94 *label = | 93 *label = |
95 l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_VPN_DISCONNECTED); | 94 l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_VPN_DISCONNECTED); |
96 } | 95 } |
97 *animating = false; | 96 *animating = false; |
98 return; | 97 return; |
99 } | 98 } |
100 *animating = vpn->IsConnectingState(); | 99 *animating = vpn->IsConnectingState(); |
101 *image = ui::network_icon::GetImageForNetwork( | |
102 vpn, ui::network_icon::ICON_TYPE_DEFAULT_VIEW); | |
103 if (label) { | 100 if (label) { |
104 *label = ui::network_icon::GetLabelForNetwork( | 101 *label = ui::network_icon::GetLabelForNetwork( |
105 vpn, ui::network_icon::ICON_TYPE_DEFAULT_VIEW); | 102 vpn, ui::network_icon::ICON_TYPE_DEFAULT_VIEW); |
106 } | 103 } |
107 } | 104 } |
108 | 105 |
109 DISALLOW_COPY_AND_ASSIGN(VpnDefaultView); | 106 DISALLOW_COPY_AND_ASSIGN(VpnDefaultView); |
110 }; | 107 }; |
111 | 108 |
112 } // namespace tray | 109 } // namespace tray |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 void TrayVPN::UpdateAfterShelfAlignmentChange(ShelfAlignment alignment) {} | 166 void TrayVPN::UpdateAfterShelfAlignmentChange(ShelfAlignment alignment) {} |
170 | 167 |
171 void TrayVPN::NetworkStateChanged() { | 168 void TrayVPN::NetworkStateChanged() { |
172 if (default_) | 169 if (default_) |
173 default_->Update(); | 170 default_->Update(); |
174 if (detailed_) | 171 if (detailed_) |
175 detailed_->Update(); | 172 detailed_->Update(); |
176 } | 173 } |
177 | 174 |
178 } // namespace ash | 175 } // namespace ash |
OLD | NEW |