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

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: 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
Daniel Erat 2015/03/09 19:46:19 nit: declare d'tor here and add empty implementati
bartfab (slow) 2015/03/09 21:04:23 Done.
21 // Human-readable name.
22 const std::string name;
23 // Opaque ID.
24 const std::string id;
25 };
26
27 // This delegate provides UI code in ash, e.g. |VPNList|, with access to the
28 // list of third-party VPN providers enabled in the primary user's profile.
29 // The delegate furthermore allows the UI code to request that a VPN provider
30 // show its "add network" dialog.
31 class ASH_EXPORT VPNDelegate {
32 public:
33 // An observer that is notified whenever the list of third-party VPN providers
34 // enabled in the primary user's profile changes.
35 class Observer {
36 public:
37 virtual void OnThirdPartyVPNProvidersChanged() = 0;
38
39 protected:
40 virtual ~Observer();
41
42 private:
43 DISALLOW_ASSIGN(Observer);
44 };
45
46 VPNDelegate();
47 virtual ~VPNDelegate();
48
49 // Returns |true| if at least one third-party VPN provider is enabled in the
50 // primary user's profile.
51 virtual bool HaveThirdPartyVPNProviders() const = 0;
52
53 // Returns the list of third-party VPN providers enabled in the primary user's
54 // profile.
55 virtual std::vector<VPNProvider> GetThirdPartyVPNProviders() const = 0;
56
57 // Requests that the VPN provider identified by |id| show its "add network"
58 // dialog. If |id| is an empty string, the built-in dialog for adding an
59 // OpenVPN or L2TP VPN is shown.
60 virtual void ShowAddPage(const std::string& id) = 0;
61
62 void AddObserver(Observer* observer);
63 void RemoveObserver(Observer* observer);
64
65 protected:
66 // Notify observers that the list of third-party VPN providers enabled in the
67 // primary user's profile has changed.
68 void NotifyObservers();
69
70 private:
71 ObserverList<Observer, true> observer_list_;
72
73 DISALLOW_COPY_AND_ASSIGN(VPNDelegate);
74 };
75
76 } // namespace ash
77
78 #endif // ASH_SYSTEM_CHROMEOS_NETWORK_VPN_DELEGATE_H
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698