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

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

Issue 2513673004: Reland: chromeos: Convert ash VPNDelegate interface to mojo (Closed)
Patch Set: fix manifest for reland 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
« no previous file with comments | « ash/common/mojo_interface_factory.cc ('k') | ash/common/system/chromeos/network/vpn_delegate.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/material_design/material_design_controller.h" 7 #include "ash/common/material_design/material_design_controller.h"
8 #include "ash/common/session/session_state_delegate.h" 8 #include "ash/common/session/session_state_delegate.h"
9 #include "ash/common/system/chromeos/network/network_icon.h" 9 #include "ash/common/system/chromeos/network/network_icon.h"
10 #include "ash/common/system/chromeos/network/network_icon_animation.h" 10 #include "ash/common/system/chromeos/network/network_icon_animation.h"
11 #include "ash/common/system/chromeos/network/network_icon_animation_observer.h" 11 #include "ash/common/system/chromeos/network/network_icon_animation_observer.h"
12 #include "ash/common/system/chromeos/network/network_state_list_detailed_view.h" 12 #include "ash/common/system/chromeos/network/network_state_list_detailed_view.h"
13 #include "ash/common/system/chromeos/network/vpn_delegate.h" 13 #include "ash/common/system/chromeos/network/vpn_list.h"
14 #include "ash/common/system/tray/system_tray.h" 14 #include "ash/common/system/tray/system_tray.h"
15 #include "ash/common/system/tray/system_tray_delegate.h" 15 #include "ash/common/system/tray/system_tray_delegate.h"
16 #include "ash/common/system/tray/tray_constants.h" 16 #include "ash/common/system/tray/tray_constants.h"
17 #include "ash/common/system/tray/tray_item_more.h" 17 #include "ash/common/system/tray/tray_item_more.h"
18 #include "ash/common/system/tray/tray_popup_item_style.h" 18 #include "ash/common/system/tray/tray_popup_item_style.h"
19 #include "ash/common/system/tray/tray_popup_label_button.h" 19 #include "ash/common/system/tray/tray_popup_label_button.h"
20 #include "ash/common/wm_shell.h" 20 #include "ash/common/wm_shell.h"
21 #include "ash/resources/vector_icons/vector_icons.h" 21 #include "ash/resources/vector_icons/vector_icons.h"
22 #include "chromeos/network/network_state.h" 22 #include "chromeos/network/network_state.h"
23 #include "chromeos/network/network_state_handler.h" 23 #include "chromeos/network/network_state_handler.h"
(...skipping 14 matching lines...) Expand all
38 public network_icon::AnimationObserver { 38 public network_icon::AnimationObserver {
39 public: 39 public:
40 VpnDefaultView(SystemTrayItem* owner, bool show_more) 40 VpnDefaultView(SystemTrayItem* owner, bool show_more)
41 : TrayItemMore(owner, show_more) {} 41 : TrayItemMore(owner, show_more) {}
42 42
43 ~VpnDefaultView() override { 43 ~VpnDefaultView() override {
44 network_icon::NetworkIconAnimation::GetInstance()->RemoveObserver(this); 44 network_icon::NetworkIconAnimation::GetInstance()->RemoveObserver(this);
45 } 45 }
46 46
47 static bool ShouldShow() { 47 static bool ShouldShow() {
48 VPNDelegate* vpn_delegate =
49 WmShell::Get()->system_tray_delegate()->GetVPNDelegate();
50 // Tests may not have a VPN delegate. They should not show the VPN entry.
51 if (!vpn_delegate)
52 return false;
53
54 // Show the VPN entry in the ash tray bubble if at least one third-party VPN 48 // Show the VPN entry in the ash tray bubble if at least one third-party VPN
55 // provider is installed. 49 // provider is installed.
56 if (vpn_delegate->HaveThirdPartyVPNProviders()) 50 if (WmShell::Get()->vpn_list()->HaveThirdPartyVPNProviders())
57 return true; 51 return true;
58 52
59 // Also show the VPN entry if at least one VPN network is configured. 53 // Also show the VPN entry if at least one VPN network is configured.
60 NetworkStateHandler* const handler = 54 NetworkStateHandler* const handler =
61 NetworkHandler::Get()->network_state_handler(); 55 NetworkHandler::Get()->network_state_handler();
62 if (handler->FirstNetworkByType(NetworkTypePattern::VPN())) 56 if (handler->FirstNetworkByType(NetworkTypePattern::VPN()))
63 return true; 57 return true;
64 return false; 58 return false;
65 } 59 }
66 60
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 void TrayVPN::UpdateAfterShelfAlignmentChange(ShelfAlignment alignment) {} 203 void TrayVPN::UpdateAfterShelfAlignmentChange(ShelfAlignment alignment) {}
210 204
211 void TrayVPN::NetworkStateChanged() { 205 void TrayVPN::NetworkStateChanged() {
212 if (default_) 206 if (default_)
213 default_->Update(); 207 default_->Update();
214 if (detailed_) 208 if (detailed_)
215 detailed_->Update(); 209 detailed_->Update();
216 } 210 }
217 211
218 } // namespace ash 212 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/mojo_interface_factory.cc ('k') | ash/common/system/chromeos/network/vpn_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698