| 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/system/chromeos/network/tray_vpn.h" | 5 #include "ash/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/tray/system_tray_delegate.h" | 8 #include "ash/common/system/tray/system_tray_delegate.h" |
| 9 #include "ash/common/system/tray/tray_constants.h" | 9 #include "ash/common/system/tray/tray_constants.h" |
| 10 #include "ash/common/wm_shell.h" |
| 10 #include "ash/metrics/user_metrics_recorder.h" | 11 #include "ash/metrics/user_metrics_recorder.h" |
| 11 #include "ash/shell.h" | 12 #include "ash/shell.h" |
| 12 #include "ash/system/chromeos/network/network_state_list_detailed_view.h" | 13 #include "ash/system/chromeos/network/network_state_list_detailed_view.h" |
| 13 #include "ash/system/chromeos/network/vpn_delegate.h" | 14 #include "ash/system/chromeos/network/vpn_delegate.h" |
| 14 #include "ash/system/tray/system_tray.h" | 15 #include "ash/system/tray/system_tray.h" |
| 15 #include "ash/system/tray/tray_item_more.h" | 16 #include "ash/system/tray/tray_item_more.h" |
| 16 #include "ash/system/tray/tray_popup_label_button.h" | 17 #include "ash/system/tray/tray_popup_label_button.h" |
| 17 #include "chromeos/network/network_state.h" | 18 #include "chromeos/network/network_state.h" |
| 18 #include "chromeos/network/network_state_handler.h" | 19 #include "chromeos/network/network_state_handler.h" |
| 19 #include "grit/ash_strings.h" | 20 #include "grit/ash_strings.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 40 Update(); | 41 Update(); |
| 41 } | 42 } |
| 42 | 43 |
| 43 ~VpnDefaultView() override { | 44 ~VpnDefaultView() override { |
| 44 ui::network_icon::NetworkIconAnimation::GetInstance()->RemoveObserver(this); | 45 ui::network_icon::NetworkIconAnimation::GetInstance()->RemoveObserver(this); |
| 45 } | 46 } |
| 46 | 47 |
| 47 static bool ShouldShow() { | 48 static bool ShouldShow() { |
| 48 // Show the VPN entry in the ash tray bubble if at least one third-party VPN | 49 // Show the VPN entry in the ash tray bubble if at least one third-party VPN |
| 49 // provider is installed. | 50 // provider is installed. |
| 50 if (Shell::GetInstance() | 51 if (WmShell::Get() |
| 51 ->system_tray_delegate() | 52 ->system_tray_delegate() |
| 52 ->GetVPNDelegate() | 53 ->GetVPNDelegate() |
| 53 ->HaveThirdPartyVPNProviders()) { | 54 ->HaveThirdPartyVPNProviders()) { |
| 54 return true; | 55 return true; |
| 55 } | 56 } |
| 56 | 57 |
| 57 // Also show the VPN entry if at least one VPN network is configured. | 58 // Also show the VPN entry if at least one VPN network is configured. |
| 58 NetworkStateHandler* const handler = | 59 NetworkStateHandler* const handler = |
| 59 NetworkHandler::Get()->network_state_handler(); | 60 NetworkHandler::Get()->network_state_handler(); |
| 60 if (handler->FirstNetworkByType(NetworkTypePattern::VPN())) | 61 if (handler->FirstNetworkByType(NetworkTypePattern::VPN())) |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 void TrayVPN::UpdateAfterShelfAlignmentChange(ShelfAlignment alignment) {} | 173 void TrayVPN::UpdateAfterShelfAlignmentChange(ShelfAlignment alignment) {} |
| 173 | 174 |
| 174 void TrayVPN::NetworkStateChanged() { | 175 void TrayVPN::NetworkStateChanged() { |
| 175 if (default_) | 176 if (default_) |
| 176 default_->Update(); | 177 default_->Update(); |
| 177 if (detailed_) | 178 if (detailed_) |
| 178 detailed_->Update(); | 179 detailed_->Update(); |
| 179 } | 180 } |
| 180 | 181 |
| 181 } // namespace ash | 182 } // namespace ash |
| OLD | NEW |