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

Unified Diff: ash/system/chromeos/network/vpn_delegate.h

Issue 984863005: Add ash::VPNDelegate and Chrome OS implementation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments. 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/vpn_delegate.h
diff --git a/ash/system/chromeos/network/vpn_delegate.h b/ash/system/chromeos/network/vpn_delegate.h
new file mode 100644
index 0000000000000000000000000000000000000000..9f28079fc3baecb5321ac6dfd44475e7d693f418
--- /dev/null
+++ b/ash/system/chromeos/network/vpn_delegate.h
@@ -0,0 +1,79 @@
+// Copyright 2015 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_CHROMEOS_NETWORK_VPN_DELEGATE_H
+#define ASH_SYSTEM_CHROMEOS_NETWORK_VPN_DELEGATE_H
+
+#include <string>
+#include <vector>
+
+#include "ash/ash_export.h"
+#include "base/macros.h"
+#include "base/observer_list.h"
+
+namespace ash {
+
+// Describes a third-party VPN provider.
+struct ASH_EXPORT VPNProvider {
+ VPNProvider(const std::string& name, const std::string& id);
+ ~VPNProvider();
+
+ // Human-readable name.
+ const std::string name;
+ // Opaque ID.
+ const std::string id;
+};
+
+// This delegate provides UI code in ash, e.g. |VPNList|, with access to the
+// list of third-party VPN providers enabled in the primary user's profile.
+// The delegate furthermore allows the UI code to request that a VPN provider
+// show its "add network" dialog.
+class ASH_EXPORT VPNDelegate {
+ public:
+ // An observer that is notified whenever the list of third-party VPN providers
+ // enabled in the primary user's profile changes.
+ class Observer {
+ public:
+ virtual void OnThirdPartyVPNProvidersChanged() = 0;
+
+ protected:
+ virtual ~Observer();
+
+ private:
+ DISALLOW_ASSIGN(Observer);
+ };
+
+ VPNDelegate();
+ virtual ~VPNDelegate();
+
+ // Returns |true| if at least one third-party VPN provider is enabled in the
+ // primary user's profile.
+ virtual bool HaveThirdPartyVPNProviders() const = 0;
+
+ // Returns the list of third-party VPN providers enabled in the primary user's
+ // profile.
+ virtual std::vector<VPNProvider> GetThirdPartyVPNProviders() const = 0;
+
+ // Requests that the VPN provider identified by |id| show its "add network"
+ // dialog. If |id| is an empty string, the built-in dialog for adding an
+ // OpenVPN or L2TP VPN is shown.
+ virtual void ShowAddPage(const std::string& id) = 0;
+
+ void AddObserver(Observer* observer);
+ void RemoveObserver(Observer* observer);
+
+ protected:
+ // Notify observers that the list of third-party VPN providers enabled in the
+ // primary user's profile has changed.
+ void NotifyObservers();
+
+ private:
+ ObserverList<Observer, true> observer_list_;
+
+ DISALLOW_COPY_AND_ASSIGN(VPNDelegate);
+};
+
+} // namespace ash
+
+#endif // ASH_SYSTEM_CHROMEOS_NETWORK_VPN_DELEGATE_H

Powered by Google App Engine
This is Rietveld 408576698