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

Side by Side 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 unified diff | Download patch
OLDNEW
(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 third-party 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.
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 third-party VPN providers enabled in the primary user's profile.
30 // The delegate furthermore allows the UI code to request that a VPN provider
31 // show its "add network" dialog.
32 class ASH_EXPORT VPNDelegate {
33 public:
34 // An observer that is notified whenever the list of third-party VPN providers
35 // enabled in the primary user's profile changes.
36 class Observer {
37 public:
38 virtual void OnThirdPartyVPNProvidersChanged() = 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.
52 virtual bool HaveThirdPartyVPNProviders() const = 0;
53
54 // Returns the list of third-party VPN providers enabled in the primary user's
55 // profile.
56 virtual std::vector<VPNProvider> GetThirdPartyVPNProviders() const = 0;
57
58 // Requests that the VPN provider identified by |id| show its "add network"
59 // dialog. If |id| is an empty string, the built-in dialog for adding an
60 // OpenVPN or L2TP VPN is shown.
61 virtual void ShowAddPage(const std::string& id) = 0;
62
63 void AddObserver(Observer* observer);
64 void RemoveObserver(Observer* observer);
65
66 protected:
67 // Notify observers that the list of third-party VPN providers enabled in the
68 // primary user's profile has changed.
69 void NotifyObservers();
70
71 private:
72 ObserverList<Observer, true> observer_list_;
73
74 DISALLOW_COPY_AND_ASSIGN(VPNDelegate);
75 };
76
77 } // namespace ash
78
79 #endif // ASH_SYSTEM_CHROMEOS_NETWORK_VPN_DELEGATE_H
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698