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

Unified Diff: ash/system/chromeos/network/tray_vpn.cc

Issue 980943005: Add ash UI for third-party VPNs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@f_2_407541_434711_remove_combined_name
Patch Set: Created 5 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: ash/system/chromeos/network/tray_vpn.cc
diff --git a/ash/system/chromeos/network/tray_vpn.cc b/ash/system/chromeos/network/tray_vpn.cc
index 1ac509c2eb8e13620ade93192969c291c6b5ba93..2a240b965a216722882d40bef65da52d5ae76557 100644
--- a/ash/system/chromeos/network/tray_vpn.cc
+++ b/ash/system/chromeos/network/tray_vpn.cc
@@ -8,6 +8,7 @@
#include "ash/session/session_state_delegate.h"
#include "ash/shell.h"
#include "ash/system/chromeos/network/network_state_list_detailed_view.h"
+#include "ash/system/chromeos/network/vpn_delegate.h"
#include "ash/system/tray/system_tray.h"
#include "ash/system/tray/system_tray_delegate.h"
#include "ash/system/tray/tray_constants.h"
@@ -21,6 +22,7 @@
#include "ui/base/l10n/l10n_util.h"
#include "ui/chromeos/network/network_icon.h"
#include "ui/chromeos/network/network_icon_animation.h"
+#include "ui/chromeos/network/network_icon_animation_observer.h"
using chromeos::NetworkHandler;
using chromeos::NetworkState;
@@ -43,12 +45,19 @@ class VpnDefaultView : public TrayItemMore,
}
static bool ShouldShow() {
- // Do not show VPN line in uber tray bubble if VPN is not configured.
- NetworkStateHandler* handler =
+ // Show the VPN entry in the ash tray bubble if at least one third-party VPN
+ // provider is installed.
+ if (Shell::GetInstance()
+ ->system_tray_delegate()
+ ->GetVPNDelegate()
+ ->HaveThirdPartyVPNProviders()) {
+ return true;
+ }
+
+ // Also show the VPN entry if at least one VPN network is configured.
+ NetworkStateHandler* const handler =
NetworkHandler::Get()->network_state_handler();
- const NetworkState* vpn =
- handler->FirstNetworkByType(NetworkTypePattern::VPN());
- return vpn != NULL;
+ return handler->FirstNetworkByType(NetworkTypePattern::VPN());
stevenjb 2015/03/10 23:41:11 nit: I'm not a huge fan of the implicit cast to bo
oshima 2015/03/10 23:48:17 Yes, this is discouraged, although the following p
bartfab (slow) 2015/03/11 11:14:09 Done.
}
void Update() {

Powered by Google App Engine
This is Rietveld 408576698