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

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: Fixed crash during device-local account login. 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
« no previous file with comments | « ash/system/chromeos/network/DEPS ('k') | ash/system/chromeos/network/vpn_delegate.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 chromeos {
16 class NetworkState;
17 }
18
19 namespace ash {
20
21 // Describes a VPN provider.
22 struct ASH_EXPORT VPNProvider {
23 struct Key {
24 // Constructs a key for the built-in VPN provider.
25 Key();
26
27 // Constructs a key for a third-party VPN provider.
28 explicit Key(const std::string& extension_id);
29
30 bool operator==(const Key& other) const;
31
32 // Indicates whether |network| belongs to this VPN provider.
33 bool MatchesNetwork(const chromeos::NetworkState& network) const;
34
35 // Whether this key represents a built-in or third-party VPN provider.
36 bool third_party;
37
38 // ID of the extension that implements this provider. Used for third-party
39 // VPN providers only.
40 std::string extension_id;
41 };
42
43 VPNProvider(const Key& key, const std::string& name);
44
45 // Key that uniquely identifies this VPN provider.
46 Key key;
47
48 // Human-readable name.
49 std::string name;
50 };
51
52 // This delegate provides UI code in ash, e.g. |VPNList|, with access to the
53 // list of VPN providers enabled in the primary user's profile. The delegate
54 // furthermore allows the UI code to request that a VPN provider show its "add
55 // network" dialog.
56 class ASH_EXPORT VPNDelegate {
57 public:
58 // An observer that is notified whenever the list of VPN providers enabled in
59 // the primary user's profile changes.
60 class Observer {
61 public:
62 virtual void OnVPNProvidersChanged() = 0;
63
64 protected:
65 virtual ~Observer();
66
67 private:
68 DISALLOW_ASSIGN(Observer);
69 };
70
71 VPNDelegate();
72 virtual ~VPNDelegate();
73
74 // Returns |true| if at least one third-party VPN provider is enabled in the
75 // primary user's profile, in addition to the built-in OpenVPN/L2TP provider.
76 virtual bool HaveThirdPartyVPNProviders() const = 0;
77
78 // Returns the list of VPN providers enabled in the primary user's profile.
79 virtual const std::vector<VPNProvider>& GetVPNProviders() const = 0;
80
81 // Requests that the VPN provider identified by |key| show its "add network"
82 // dialog.
83 virtual void ShowAddPage(const VPNProvider::Key& key) = 0;
84
85 void AddObserver(Observer* observer);
86 void RemoveObserver(Observer* observer);
87
88 protected:
89 // Notify observers that the list of VPN providers enabled in the primary
90 // user's profile has changed.
91 void NotifyObservers();
92
93 private:
94 ObserverList<Observer, true> observer_list_;
95
96 DISALLOW_COPY_AND_ASSIGN(VPNDelegate);
97 };
98
99 } // namespace ash
100
101 #endif // ASH_SYSTEM_CHROMEOS_NETWORK_VPN_DELEGATE_H
OLDNEW
« no previous file with comments | « ash/system/chromeos/network/DEPS ('k') | ash/system/chromeos/network/vpn_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698