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

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

Issue 2422453002: mutash: Convert ScreenShareTest/ScreenCaptureTest to AshTest (Closed)
Patch Set: rebase Created 4 years, 2 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/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 25 matching lines...) Expand all
36 public ui::network_icon::AnimationObserver { 36 public ui::network_icon::AnimationObserver {
37 public: 37 public:
38 VpnDefaultView(SystemTrayItem* owner, bool show_more) 38 VpnDefaultView(SystemTrayItem* owner, bool show_more)
39 : TrayItemMore(owner, show_more) {} 39 : TrayItemMore(owner, show_more) {}
40 40
41 ~VpnDefaultView() override { 41 ~VpnDefaultView() override {
42 ui::network_icon::NetworkIconAnimation::GetInstance()->RemoveObserver(this); 42 ui::network_icon::NetworkIconAnimation::GetInstance()->RemoveObserver(this);
43 } 43 }
44 44
45 static bool ShouldShow() { 45 static bool ShouldShow() {
46 VPNDelegate* vpn_delegate =
47 WmShell::Get()->system_tray_delegate()->GetVPNDelegate();
48 // Tests may not have a VPN delegate. They should not show the VPN entry.
49 if (!vpn_delegate)
50 return false;
51
46 // Show the VPN entry in the ash tray bubble if at least one third-party VPN 52 // Show the VPN entry in the ash tray bubble if at least one third-party VPN
47 // provider is installed. 53 // provider is installed.
48 if (WmShell::Get() 54 if (vpn_delegate->HaveThirdPartyVPNProviders())
49 ->system_tray_delegate()
50 ->GetVPNDelegate()
51 ->HaveThirdPartyVPNProviders()) {
52 return true; 55 return true;
53 }
54 56
55 // Also show the VPN entry if at least one VPN network is configured. 57 // Also show the VPN entry if at least one VPN network is configured.
56 NetworkStateHandler* const handler = 58 NetworkStateHandler* const handler =
57 NetworkHandler::Get()->network_state_handler(); 59 NetworkHandler::Get()->network_state_handler();
58 if (handler->FirstNetworkByType(NetworkTypePattern::VPN())) 60 if (handler->FirstNetworkByType(NetworkTypePattern::VPN()))
59 return true; 61 return true;
60 return false; 62 return false;
61 } 63 }
62 64
63 void Update() { 65 void Update() {
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 void TrayVPN::UpdateAfterShelfAlignmentChange(ShelfAlignment alignment) {} 201 void TrayVPN::UpdateAfterShelfAlignmentChange(ShelfAlignment alignment) {}
200 202
201 void TrayVPN::NetworkStateChanged() { 203 void TrayVPN::NetworkStateChanged() {
202 if (default_) 204 if (default_)
203 default_->Update(); 205 default_->Update();
204 if (detailed_) 206 if (detailed_)
205 detailed_->Update(); 207 detailed_->Update();
206 } 208 }
207 209
208 } // namespace ash 210 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/BUILD.gn ('k') | ash/common/system/chromeos/screen_security/screen_tray_item_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698