Eliminate ash/system/network/vpn_util.cc

These utility functions are now only used in one file and can be
moved there.

Bug: 862420
Change-Id: I747ad7d8180bf6b7c85b88c7d401a38837838320
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1612560
Commit-Queue: Steven Bennetts <stevenjb@chromium.org>
Reviewed-by: Kyle Horimoto <khorimoto@chromium.org>
Cr-Commit-Position: refs/heads/master@{#661401}
diff --git a/ash/BUILD.gn b/ash/BUILD.gn
index 2d51ba8..b3d07e3d 100644
--- a/ash/BUILD.gn
+++ b/ash/BUILD.gn
@@ -776,8 +776,6 @@
     "system/network/vpn_list.h",
     "system/network/vpn_list_view.cc",
     "system/network/vpn_list_view.h",
-    "system/network/vpn_util.cc",
-    "system/network/vpn_util.h",
     "system/network/wifi_toggle_notification_controller.cc",
     "system/network/wifi_toggle_notification_controller.h",
     "system/night_light/night_light_controller.cc",
diff --git a/ash/system/network/vpn_feature_pod_controller.cc b/ash/system/network/vpn_feature_pod_controller.cc
index 3a98617..c530a61 100644
--- a/ash/system/network/vpn_feature_pod_controller.cc
+++ b/ash/system/network/vpn_feature_pod_controller.cc
@@ -10,7 +10,6 @@
 #include "ash/strings/grit/ash_strings.h"
 #include "ash/system/network/network_icon.h"
 #include "ash/system/network/vpn_list.h"
-#include "ash/system/network/vpn_util.h"
 #include "ash/system/tray/tray_constants.h"
 #include "ash/system/unified/feature_pod_button.h"
 #include "ash/system/unified/unified_system_tray_controller.h"
@@ -26,6 +25,41 @@
 
 namespace ash {
 
+namespace {
+
+bool IsVPNVisibleInSystemTray() {
+  LoginStatus login_status = Shell::Get()->session_controller()->login_status();
+  if (login_status == LoginStatus::NOT_LOGGED_IN)
+    return false;
+
+  // Show the VPN entry in the ash tray bubble if at least one third-party VPN
+  // provider is installed.
+  if (Shell::Get()->vpn_list()->HaveThirdPartyOrArcVPNProviders())
+    return true;
+
+  // Also show the VPN entry if at least one VPN network is configured.
+  NetworkStateHandler* const handler =
+      NetworkHandler::Get()->network_state_handler();
+  if (handler->FirstNetworkByType(NetworkTypePattern::VPN()))
+    return true;
+  return false;
+}
+
+bool IsVPNEnabled() {
+  NetworkStateHandler* handler = NetworkHandler::Get()->network_state_handler();
+  return handler->FirstNetworkByType(NetworkTypePattern::VPN());
+}
+
+bool IsVPNConnected() {
+  NetworkStateHandler* handler = NetworkHandler::Get()->network_state_handler();
+  const NetworkState* vpn =
+      handler->FirstNetworkByType(NetworkTypePattern::VPN());
+  return IsVPNEnabled() &&
+         (vpn->IsConnectedState() || vpn->IsConnectingState());
+}
+
+}  // namespace
+
 VPNFeaturePodController::VPNFeaturePodController(
     UnifiedSystemTrayController* tray_controller)
     : network_state_observer_(std::make_unique<TrayNetworkStateObserver>(this)),
@@ -63,14 +97,14 @@
   if (!chromeos::NetworkHandler::IsInitialized())
     return;
 
-  button_->SetVisible(vpn_util::IsVPNVisibleInSystemTray());
+  button_->SetVisible(IsVPNVisibleInSystemTray());
   if (!button_->GetVisible())
     return;
 
   button_->SetSubLabel(l10n_util::GetStringUTF16(
-      vpn_util::IsVPNConnected() ? IDS_ASH_STATUS_TRAY_VPN_CONNECTED_SHORT
-                                 : IDS_ASH_STATUS_TRAY_VPN_DISCONNECTED_SHORT));
-  button_->SetToggled(vpn_util::IsVPNEnabled() && vpn_util::IsVPNConnected());
+      IsVPNConnected() ? IDS_ASH_STATUS_TRAY_VPN_CONNECTED_SHORT
+                       : IDS_ASH_STATUS_TRAY_VPN_DISCONNECTED_SHORT));
+  button_->SetToggled(IsVPNEnabled() && IsVPNConnected());
 }
 
 }  // namespace ash
diff --git a/ash/system/network/vpn_util.cc b/ash/system/network/vpn_util.cc
deleted file mode 100644
index 45bb5fb..0000000
--- a/ash/system/network/vpn_util.cc
+++ /dev/null
@@ -1,53 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "ash/system/network/vpn_util.h"
-
-#include "ash/session/session_controller_impl.h"
-#include "ash/shell.h"
-#include "ash/system/network/vpn_list.h"
-#include "chromeos/network/network_state.h"
-#include "chromeos/network/network_state_handler.h"
-
-using chromeos::NetworkHandler;
-using chromeos::NetworkState;
-using chromeos::NetworkStateHandler;
-using chromeos::NetworkTypePattern;
-
-namespace ash {
-namespace vpn_util {
-
-bool IsVPNVisibleInSystemTray() {
-  LoginStatus login_status = Shell::Get()->session_controller()->login_status();
-  if (login_status == LoginStatus::NOT_LOGGED_IN)
-    return false;
-
-  // Show the VPN entry in the ash tray bubble if at least one third-party VPN
-  // provider is installed.
-  if (Shell::Get()->vpn_list()->HaveThirdPartyOrArcVPNProviders())
-    return true;
-
-  // Also show the VPN entry if at least one VPN network is configured.
-  NetworkStateHandler* const handler =
-      NetworkHandler::Get()->network_state_handler();
-  if (handler->FirstNetworkByType(NetworkTypePattern::VPN()))
-    return true;
-  return false;
-}
-
-bool IsVPNEnabled() {
-  NetworkStateHandler* handler = NetworkHandler::Get()->network_state_handler();
-  return handler->FirstNetworkByType(NetworkTypePattern::VPN());
-}
-
-bool IsVPNConnected() {
-  NetworkStateHandler* handler = NetworkHandler::Get()->network_state_handler();
-  const NetworkState* vpn =
-      handler->FirstNetworkByType(NetworkTypePattern::VPN());
-  return IsVPNEnabled() &&
-         (vpn->IsConnectedState() || vpn->IsConnectingState());
-}
-
-}  // namespace vpn_util
-}  // namespace ash
diff --git a/ash/system/network/vpn_util.h b/ash/system/network/vpn_util.h
deleted file mode 100644
index d2fdc03..0000000
--- a/ash/system/network/vpn_util.h
+++ /dev/null
@@ -1,18 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef ASH_SYSTEM_NETWORK_VPN_UTIL_H_
-#define ASH_SYSTEM_NETWORK_VPN_UTIL_H_
-
-namespace ash {
-namespace vpn_util {
-
-extern bool IsVPNVisibleInSystemTray();
-extern bool IsVPNEnabled();
-extern bool IsVPNConnected();
-
-}  // namespace vpn_util
-}  // namespace ash
-
-#endif  // ASH_SYSTEM_NETWORK_VPN_UTIL_H_