Chromium Code Reviews| 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..50e7af437065b5a5674690d696e4e0e3755cc682 |
| --- /dev/null |
| +++ b/ash/system/chromeos/network/vpn_delegate.h |
| @@ -0,0 +1,77 @@ |
| +// 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 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. The empty string is also a valid ID. |
|
stevenjb
2015/03/11 16:52:52
The empty string is used to indicate a built-in VP
bartfab (slow)
2015/03/11 17:27:04
I wanted to make it as opaque as possible. I docum
stevenjb
2015/03/11 18:23:02
I don't think "as opaque as possible" is a good ob
bartfab (slow)
2015/03/11 18:27:14
The NetworkState annotates each VPN network with i
stevenjb
2015/03/11 18:36:23
I don't understand. id is populated in vpn_delegat
bartfab (slow)
2015/03/11 22:36:26
For networks using a third-party VPN provider, I n
|
| + const std::string id; |
| +}; |
| + |
| +// This delegate provides UI code in ash, e.g. |VPNList|, with access to the |
| +// list of 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 VPN providers enabled in |
| + // the primary user's profile changes. |
| + class Observer { |
| + public: |
| + virtual void OnVPNProvidersChanged() = 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, in addition to the built-in OpenVPN/L2TP provider. |
| + virtual bool HaveThirdPartyVPNProviders() const = 0; |
| + |
| + // Returns the list of VPN providers enabled in the primary user's profile. |
| + virtual const std::vector<VPNProvider>& GetVPNProviders() const = 0; |
| + |
| + // Requests that the VPN provider identified by |id| show its "add network" |
| + // dialog. |
| + virtual void ShowAddPage(const std::string& id) = 0; |
| + |
| + void AddObserver(Observer* observer); |
| + void RemoveObserver(Observer* observer); |
| + |
| + protected: |
| + // Notify observers that the list of 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 |