shill: vpn: Auto-connect at most one service at a time, only when online.

This patch suppresses auto-connect for non-primary technologies (such
as VPN) while the system is offline. Also, don't auto-connect a VPN
service if there's already an active (connecting or connected) VPN
service.

Cleanup Manager's online/offline API a bit.

BUG=chromium-os:38229
TEST=unit tests

Change-Id: Iedd3879cf45c8b509a956415c7de5e5ba1af4652
Reviewed-on: https://gerrit.chromium.org/gerrit/42226
Tested-by: Darin Petkov <petkov@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
Commit-Queue: Darin Petkov <petkov@chromium.org>
diff --git a/vpn_provider.cc b/vpn_provider.cc
index 0fce3df..754b1a1 100644
--- a/vpn_provider.cc
+++ b/vpn_provider.cc
@@ -186,4 +186,14 @@
   return NULL;
 }
 
+bool VPNProvider::HasActiveService() const {
+  for (vector<VPNServiceRefPtr>::const_iterator it = services_.begin();
+       it != services_.end(); ++it) {
+    if ((*it)->IsConnecting() || (*it)->IsConnected()) {
+      return true;
+    }
+  }
+  return false;
+}
+
 }  // namespace shill