| Index: ash/common/system/chromeos/network/vpn_delegate.cc
|
| diff --git a/ash/common/system/chromeos/network/vpn_delegate.cc b/ash/common/system/chromeos/network/vpn_delegate.cc
|
| deleted file mode 100644
|
| index 44fa49c969884a365c90168c7a4e830e77f7a35b..0000000000000000000000000000000000000000
|
| --- a/ash/common/system/chromeos/network/vpn_delegate.cc
|
| +++ /dev/null
|
| @@ -1,87 +0,0 @@
|
| -// Copyright 2015 The Chromium Authors. All rights reserved.
|
| -// Use of this source code is governed by a BSD-style license that can be
|
| -// found in the LICENSE file.
|
| -
|
| -#include "ash/common/system/chromeos/network/vpn_delegate.h"
|
| -
|
| -#include "ash/common/strings/grit/ash_strings.h"
|
| -#include "chromeos/network/network_state.h"
|
| -#include "third_party/cros_system_api/dbus/service_constants.h"
|
| -#include "ui/base/l10n/l10n_util.h"
|
| -
|
| -namespace ash {
|
| -
|
| -VPNProvider::Key::Key() : third_party(false) {}
|
| -
|
| -VPNProvider::Key::Key(const std::string& extension_id)
|
| - : third_party(true), extension_id(extension_id) {}
|
| -
|
| -bool VPNProvider::Key::operator==(const Key& other) const {
|
| - return other.third_party == third_party && other.extension_id == extension_id;
|
| -}
|
| -
|
| -bool VPNProvider::Key::MatchesNetwork(
|
| - const chromeos::NetworkState& network) const {
|
| - if (network.type() != shill::kTypeVPN)
|
| - return false;
|
| - const bool network_uses_third_party_provider =
|
| - network.vpn_provider_type() == shill::kProviderThirdPartyVpn;
|
| - if (!third_party)
|
| - return !network_uses_third_party_provider;
|
| - return network_uses_third_party_provider &&
|
| - network.third_party_vpn_provider_extension_id() == extension_id;
|
| -}
|
| -
|
| -VPNProvider::VPNProvider(const Key& key, const std::string& name)
|
| - : key(key), name(name) {}
|
| -
|
| -bool VPNProvider::operator==(const VPNProvider& other) const {
|
| - return key == other.key && name == other.name;
|
| -}
|
| -
|
| -VPNDelegate::Observer::~Observer() {}
|
| -
|
| -VPNDelegate::VPNDelegate() {
|
| - AddBuiltInProvider();
|
| -}
|
| -
|
| -VPNDelegate::~VPNDelegate() {}
|
| -
|
| -bool VPNDelegate::HaveThirdPartyVPNProviders() const {
|
| - for (const VPNProvider& provider : vpn_providers_) {
|
| - if (provider.key.third_party)
|
| - return true;
|
| - }
|
| - return false;
|
| -}
|
| -
|
| -void VPNDelegate::AddObserver(Observer* observer) {
|
| - observer_list_.AddObserver(observer);
|
| -}
|
| -
|
| -void VPNDelegate::RemoveObserver(Observer* observer) {
|
| - observer_list_.RemoveObserver(observer);
|
| -}
|
| -
|
| -void VPNDelegate::SetThirdPartyVpnProviders(
|
| - const std::vector<VPNProvider>& providers) {
|
| - // Reset the list with the extension-backed providers.
|
| - vpn_providers_ = providers;
|
| - AddBuiltInProvider();
|
| - NotifyObservers();
|
| -}
|
| -
|
| -void VPNDelegate::NotifyObservers() {
|
| - for (auto& observer : observer_list_)
|
| - observer.OnVPNProvidersChanged();
|
| -}
|
| -
|
| -void VPNDelegate::AddBuiltInProvider() {
|
| - // The VPNProvider::Key() constructor generates a key that identifies that
|
| - // built-in provider and has no extension ID.
|
| - vpn_providers_.push_back(VPNProvider(
|
| - VPNProvider::Key(),
|
| - l10n_util::GetStringUTF8(IDS_ASH_STATUS_TRAY_VPN_BUILT_IN_PROVIDER)));
|
| -}
|
| -
|
| -} // namespace ash
|
|
|