| 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/material_design/material_design_controller.h" | |
| 8 #include "ash/common/session/session_state_delegate.h" | 7 #include "ash/common/session/session_state_delegate.h" |
| 9 #include "ash/common/system/chromeos/network/network_icon.h" | 8 #include "ash/common/system/chromeos/network/network_icon.h" |
| 10 #include "ash/common/system/chromeos/network/network_icon_animation.h" | 9 #include "ash/common/system/chromeos/network/network_icon_animation.h" |
| 11 #include "ash/common/system/chromeos/network/network_icon_animation_observer.h" | 10 #include "ash/common/system/chromeos/network/network_icon_animation_observer.h" |
| 12 #include "ash/common/system/chromeos/network/network_state_list_detailed_view.h" | 11 #include "ash/common/system/chromeos/network/network_state_list_detailed_view.h" |
| 13 #include "ash/common/system/chromeos/network/vpn_list.h" | 12 #include "ash/common/system/chromeos/network/vpn_list.h" |
| 14 #include "ash/common/system/tray/system_tray.h" | 13 #include "ash/common/system/tray/system_tray.h" |
| 15 #include "ash/common/system/tray/system_tray_delegate.h" | 14 #include "ash/common/system/tray/system_tray_delegate.h" |
| 16 #include "ash/common/system/tray/tray_constants.h" | 15 #include "ash/common/system/tray/tray_constants.h" |
| 17 #include "ash/common/system/tray/tray_item_more.h" | 16 #include "ash/common/system/tray/tray_item_more.h" |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 (vpn->IsConnectedState() || vpn->IsConnectingState()); | 106 (vpn->IsConnectedState() || vpn->IsConnectingState()); |
| 108 } | 107 } |
| 109 | 108 |
| 110 void GetNetworkStateHandlerImageAndLabel(gfx::ImageSkia* image, | 109 void GetNetworkStateHandlerImageAndLabel(gfx::ImageSkia* image, |
| 111 base::string16* label, | 110 base::string16* label, |
| 112 bool* animating) { | 111 bool* animating) { |
| 113 NetworkStateHandler* handler = | 112 NetworkStateHandler* handler = |
| 114 NetworkHandler::Get()->network_state_handler(); | 113 NetworkHandler::Get()->network_state_handler(); |
| 115 const NetworkState* vpn = | 114 const NetworkState* vpn = |
| 116 handler->FirstNetworkByType(NetworkTypePattern::VPN()); | 115 handler->FirstNetworkByType(NetworkTypePattern::VPN()); |
| 117 if (MaterialDesignController::IsSystemTrayMenuMaterial()) { | 116 *image = gfx::CreateVectorIcon( |
| 118 *image = gfx::CreateVectorIcon( | 117 kNetworkVpnIcon, TrayPopupItemStyle::GetIconColor( |
| 119 kNetworkVpnIcon, TrayPopupItemStyle::GetIconColor( | 118 vpn && vpn->IsConnectedState() |
| 120 vpn && vpn->IsConnectedState() | 119 ? TrayPopupItemStyle::ColorStyle::ACTIVE |
| 121 ? TrayPopupItemStyle::ColorStyle::ACTIVE | 120 : TrayPopupItemStyle::ColorStyle::INACTIVE)); |
| 122 : TrayPopupItemStyle::ColorStyle::INACTIVE)); | |
| 123 } else { | |
| 124 *image = network_icon::GetVpnImage(); | |
| 125 } | |
| 126 if (!IsVpnConnected()) { | 121 if (!IsVpnConnected()) { |
| 127 if (label) { | 122 if (label) { |
| 128 *label = | 123 *label = |
| 129 l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_VPN_DISCONNECTED); | 124 l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_VPN_DISCONNECTED); |
| 130 } | 125 } |
| 131 *animating = false; | 126 *animating = false; |
| 132 return; | 127 return; |
| 133 } | 128 } |
| 134 *animating = vpn->IsConnectingState(); | 129 *animating = vpn->IsConnectingState(); |
| 135 if (label) { | 130 if (label) { |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 void TrayVPN::UpdateAfterShelfAlignmentChange(ShelfAlignment alignment) {} | 196 void TrayVPN::UpdateAfterShelfAlignmentChange(ShelfAlignment alignment) {} |
| 202 | 197 |
| 203 void TrayVPN::NetworkStateChanged() { | 198 void TrayVPN::NetworkStateChanged() { |
| 204 if (default_) | 199 if (default_) |
| 205 default_->Update(); | 200 default_->Update(); |
| 206 if (detailed_) | 201 if (detailed_) |
| 207 detailed_->Update(); | 202 detailed_->Update(); |
| 208 } | 203 } |
| 209 | 204 |
| 210 } // namespace ash | 205 } // namespace ash |
| OLD | NEW |