| Index: ash/common/system/chromeos/network/vpn_list.h
|
| diff --git a/ash/common/system/chromeos/network/vpn_delegate.h b/ash/common/system/chromeos/network/vpn_list.h
|
| similarity index 74%
|
| rename from ash/common/system/chromeos/network/vpn_delegate.h
|
| rename to ash/common/system/chromeos/network/vpn_list.h
|
| index 94ca69c7eb54f4e9b388d4db21566c8ccbd7afc5..8ad924ed652990065a8d9d45a2c1f76e660a7359 100644
|
| --- a/ash/common/system/chromeos/network/vpn_delegate.h
|
| +++ b/ash/common/system/chromeos/network/vpn_list.h
|
| @@ -2,15 +2,17 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#ifndef ASH_COMMON_SYSTEM_CHROMEOS_NETWORK_VPN_DELEGATE_H_
|
| -#define ASH_COMMON_SYSTEM_CHROMEOS_NETWORK_VPN_DELEGATE_H_
|
| +#ifndef ASH_COMMON_SYSTEM_CHROMEOS_NETWORK_VPN_LIST_H_
|
| +#define ASH_COMMON_SYSTEM_CHROMEOS_NETWORK_VPN_LIST_H_
|
|
|
| #include <string>
|
| #include <vector>
|
|
|
| #include "ash/ash_export.h"
|
| +#include "ash/public/interfaces/vpn_list.mojom.h"
|
| #include "base/macros.h"
|
| #include "base/observer_list.h"
|
| +#include "mojo/public/cpp/bindings/binding_set.h"
|
|
|
| namespace chromeos {
|
| class NetworkState;
|
| @@ -55,9 +57,7 @@ struct ASH_EXPORT VPNProvider {
|
| // list of VPN providers enabled in the primary user's profile. The delegate
|
| // furthermore allows the UI code to request that a VPN provider show its "add
|
| // network" dialog.
|
| -// TODO(jamescook): Rename this to VpnList as part of mojo conversion because it
|
| -// won't be a delegate anymore.
|
| -class ASH_EXPORT VPNDelegate {
|
| +class ASH_EXPORT VpnList : public mojom::VpnList {
|
| public:
|
| // An observer that is notified whenever the list of VPN providers enabled in
|
| // the primary user's profile changes.
|
| @@ -72,8 +72,8 @@ class ASH_EXPORT VPNDelegate {
|
| DISALLOW_ASSIGN(Observer);
|
| };
|
|
|
| - VPNDelegate();
|
| - virtual ~VPNDelegate();
|
| + VpnList();
|
| + ~VpnList() override;
|
|
|
| const std::vector<VPNProvider>& vpn_providers() { return vpn_providers_; }
|
|
|
| @@ -83,15 +83,18 @@ class ASH_EXPORT VPNDelegate {
|
|
|
| // Requests that the VPN provider identified by |key| show its "add network"
|
| // dialog.
|
| - virtual void ShowAddPage(const VPNProvider::Key& key) = 0;
|
| + void ShowAddPage(const VPNProvider::Key& key);
|
|
|
| void AddObserver(Observer* observer);
|
| void RemoveObserver(Observer* observer);
|
|
|
| - // Sets the list of extension-backed VPN providers. The list may be empty.
|
| - // Notifies observers. Public for testing.
|
| - // TODO(jamescook): Convert to mojo interface.
|
| - void SetThirdPartyVpnProviders(const std::vector<VPNProvider>& providers);
|
| + // Binds the mojom::VpnList interface to this object.
|
| + void BindRequest(mojom::VpnListRequest request);
|
| +
|
| + // mojom::VpnList:
|
| + void SetClient(mojom::VpnListClientPtr client) override;
|
| + void SetThirdPartyVpnProviders(
|
| + std::vector<mojom::ThirdPartyVpnProviderPtr> providers) override;
|
|
|
| private:
|
| // Notify observers that the list of VPN providers enabled in the primary
|
| @@ -101,15 +104,21 @@ class ASH_EXPORT VPNDelegate {
|
| // Adds the built-in OpenVPN/L2TP provider to |vpn_providers_|.
|
| void AddBuiltInProvider();
|
|
|
| + // May be null in tests or when Chrome is not running.
|
| + mojom::VpnListClientPtr vpn_list_client_;
|
| +
|
| + // Bindings for the mojom::VpnList interface.
|
| + mojo::BindingSet<mojom::VpnList> bindings_;
|
| +
|
| // Cache of VPN providers, including the built-in OpenVPN/L2TP provider and
|
| // other providers added by extensions in the primary user's profile.
|
| std::vector<VPNProvider> vpn_providers_;
|
|
|
| base::ObserverList<Observer> observer_list_;
|
|
|
| - DISALLOW_COPY_AND_ASSIGN(VPNDelegate);
|
| + DISALLOW_COPY_AND_ASSIGN(VpnList);
|
| };
|
|
|
| } // namespace ash
|
|
|
| -#endif // ASH_COMMON_SYSTEM_CHROMEOS_NETWORK_VPN_DELEGATE_H_
|
| +#endif // ASH_COMMON_SYSTEM_CHROMEOS_NETWORK_VPN_LIST_H_
|
|
|