OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef ASH_SYSTEM_CHROMEOS_NETWORK_VPN_DELEGATE_H | |
6 #define ASH_SYSTEM_CHROMEOS_NETWORK_VPN_DELEGATE_H | |
7 | |
8 #include <string> | |
9 #include <vector> | |
10 | |
11 #include "ash/ash_export.h" | |
12 #include "base/macros.h" | |
13 #include "base/observer_list.h" | |
14 | |
15 namespace ash { | |
16 | |
17 // Describes a VPN provider. | |
18 struct ASH_EXPORT VPNProvider { | |
19 VPNProvider(const std::string& name, const std::string& id); | |
20 ~VPNProvider(); | |
21 | |
22 // Human-readable name. | |
23 const std::string name; | |
24 // 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
| |
25 const std::string id; | |
26 }; | |
27 | |
28 // This delegate provides UI code in ash, e.g. |VPNList|, with access to the | |
29 // list of VPN providers enabled in the primary user's profile. The delegate | |
30 // furthermore allows the UI code to request that a VPN provider show its "add | |
31 // network" dialog. | |
32 class ASH_EXPORT VPNDelegate { | |
33 public: | |
34 // An observer that is notified whenever the list of VPN providers enabled in | |
35 // the primary user's profile changes. | |
36 class Observer { | |
37 public: | |
38 virtual void OnVPNProvidersChanged() = 0; | |
39 | |
40 protected: | |
41 virtual ~Observer(); | |
42 | |
43 private: | |
44 DISALLOW_ASSIGN(Observer); | |
45 }; | |
46 | |
47 VPNDelegate(); | |
48 virtual ~VPNDelegate(); | |
49 | |
50 // Returns |true| if at least one third-party VPN provider is enabled in the | |
51 // primary user's profile, in addition to the built-in OpenVPN/L2TP provider. | |
52 virtual bool HaveThirdPartyVPNProviders() const = 0; | |
53 | |
54 // Returns the list of VPN providers enabled in the primary user's profile. | |
55 virtual const std::vector<VPNProvider>& GetVPNProviders() const = 0; | |
56 | |
57 // Requests that the VPN provider identified by |id| show its "add network" | |
58 // dialog. | |
59 virtual void ShowAddPage(const std::string& id) = 0; | |
60 | |
61 void AddObserver(Observer* observer); | |
62 void RemoveObserver(Observer* observer); | |
63 | |
64 protected: | |
65 // Notify observers that the list of VPN providers enabled in the primary | |
66 // user's profile has changed. | |
67 void NotifyObservers(); | |
68 | |
69 private: | |
70 ObserverList<Observer, true> observer_list_; | |
71 | |
72 DISALLOW_COPY_AND_ASSIGN(VPNDelegate); | |
73 }; | |
74 | |
75 } // namespace ash | |
76 | |
77 #endif // ASH_SYSTEM_CHROMEOS_NETWORK_VPN_DELEGATE_H | |
OLD | NEW |