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

Side by Side Diff: ash/common/system/chromeos/network/vpn_list.h

Issue 2734653002: chromeos: Move files in //ash/common to //ash (Closed)
Patch Set: fix a11y tests, fix docs Created 3 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_COMMON_SYSTEM_CHROMEOS_NETWORK_VPN_LIST_H_
6 #define ASH_COMMON_SYSTEM_CHROMEOS_NETWORK_VPN_LIST_H_
7
8 #include <string>
9 #include <vector>
10
11 #include "ash/ash_export.h"
12 #include "ash/public/interfaces/vpn_list.mojom.h"
13 #include "base/macros.h"
14 #include "base/observer_list.h"
15 #include "mojo/public/cpp/bindings/binding_set.h"
16
17 namespace ash {
18
19 // Describes a VPN provider.
20 struct ASH_EXPORT VPNProvider {
21 // Constructs the built-in VPN provider.
22 VPNProvider();
23
24 // Constructs a third-party VPN provider.
25 VPNProvider(const std::string& extension_id,
26 const std::string& third_party_provider_name);
27
28 bool operator==(const VPNProvider& other) const;
29
30 // Whether this key represents a built-in or third-party VPN provider.
31 bool third_party;
32
33 // ID of the extension that implements this provider. Used for third-party
34 // VPN providers only.
35 std::string extension_id;
36
37 // Human-readable name if |third_party| is true, otherwise empty.
38 std::string third_party_provider_name;
39 };
40
41 // This delegate provides UI code in ash, e.g. |VPNListView|, with access to the
42 // list of VPN providers enabled in the primary user's profile. The delegate
43 // furthermore allows the UI code to request that a VPN provider show its "add
44 // network" dialog.
45 class ASH_EXPORT VpnList : public mojom::VpnList {
46 public:
47 // An observer that is notified whenever the list of VPN providers enabled in
48 // the primary user's profile changes.
49 class Observer {
50 public:
51 virtual void OnVPNProvidersChanged() = 0;
52
53 protected:
54 virtual ~Observer();
55
56 private:
57 DISALLOW_ASSIGN(Observer);
58 };
59
60 VpnList();
61 ~VpnList() override;
62
63 const std::vector<VPNProvider>& vpn_providers() { return vpn_providers_; }
64
65 // Returns |true| if at least one third-party VPN provider is enabled in the
66 // primary user's profile, in addition to the built-in OpenVPN/L2TP provider.
67 bool HaveThirdPartyVPNProviders() const;
68
69 void AddObserver(Observer* observer);
70 void RemoveObserver(Observer* observer);
71
72 // Binds the mojom::VpnList interface to this object.
73 void BindRequest(mojom::VpnListRequest request);
74
75 // mojom::VpnList:
76 void SetThirdPartyVpnProviders(
77 std::vector<mojom::ThirdPartyVpnProviderPtr> providers) override;
78
79 private:
80 // Notify observers that the list of VPN providers enabled in the primary
81 // user's profile has changed.
82 void NotifyObservers();
83
84 // Adds the built-in OpenVPN/L2TP provider to |vpn_providers_|.
85 void AddBuiltInProvider();
86
87 // Bindings for the mojom::VpnList interface.
88 mojo::BindingSet<mojom::VpnList> bindings_;
89
90 // Cache of VPN providers, including the built-in OpenVPN/L2TP provider and
91 // other providers added by extensions in the primary user's profile.
92 std::vector<VPNProvider> vpn_providers_;
93
94 base::ObserverList<Observer> observer_list_;
95
96 DISALLOW_COPY_AND_ASSIGN(VpnList);
97 };
98
99 } // namespace ash
100
101 #endif // ASH_COMMON_SYSTEM_CHROMEOS_NETWORK_VPN_LIST_H_
OLDNEW
« no previous file with comments | « ash/common/system/chromeos/network/tray_vpn.cc ('k') | ash/common/system/chromeos/network/vpn_list.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698