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

Side by Side Diff: ash/system/chromeos/network/vpn_delegate.cc

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/vpn_delegate.h ('k') | ash/system/tray/system_tray_delegate.h » ('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 #include "ash/system/chromeos/network/vpn_delegate.h"
6
7 #include "chromeos/network/network_state.h"
8 #include "third_party/cros_system_api/dbus/service_constants.h"
9
10 namespace ash {
11
12 VPNProvider::Key::Key() : third_party(false) {
13 }
14
15 VPNProvider::Key::Key(const std::string& extension_id)
16 : third_party(true), extension_id(extension_id) {
17 }
18
19 bool VPNProvider::Key::operator==(const Key& other) const {
20 return other.third_party == third_party && other.extension_id == extension_id;
21 }
22
23 bool VPNProvider::Key::MatchesNetwork(
24 const chromeos::NetworkState& network) const {
25 if (network.type() != shill::kTypeVPN)
26 return false;
27 if (third_party)
28 return network.vpn_provider_extension_id() == extension_id;
29 // Currently, all networks with an empty |vpn_provider_extension_id| use a
30 // single built-in VPN providers. In the future, we may distinguish between
31 // multiple built-in providers based on the |Provider.Type| property.
32 return network.vpn_provider_extension_id().empty();
33 }
34
35 VPNProvider::VPNProvider(const Key& key, const std::string& name)
36 : key(key), name(name) {
37 }
38
39 VPNDelegate::Observer::~Observer() {
40 }
41
42 VPNDelegate::VPNDelegate() {
43 }
44
45 VPNDelegate::~VPNDelegate() {
46 }
47
48 void VPNDelegate::AddObserver(Observer* observer) {
49 observer_list_.AddObserver(observer);
50 }
51
52 void VPNDelegate::RemoveObserver(Observer* observer) {
53 observer_list_.RemoveObserver(observer);
54 }
55
56 void VPNDelegate::NotifyObservers() {
57 FOR_EACH_OBSERVER(Observer, observer_list_, OnVPNProvidersChanged());
58 }
59
60 } // namespace ash
OLDNEW
« no previous file with comments | « ash/system/chromeos/network/vpn_delegate.h ('k') | ash/system/tray/system_tray_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698