| Index: ash/system/chromeos/network/vpn_list_view.h
|
| diff --git a/ash/system/chromeos/network/vpn_list_view.h b/ash/system/chromeos/network/vpn_list_view.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..3b3edd455203d4b5cb3330387c6d0411955cca00
|
| --- /dev/null
|
| +++ b/ash/system/chromeos/network/vpn_list_view.h
|
| @@ -0,0 +1,90 @@
|
| +// 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.
|
| +
|
| +#ifndef ASH_SYSTEM_CHROMEOS_NETWORK_VPN_LIST_VIEW_H_
|
| +#define ASH_SYSTEM_CHROMEOS_NETWORK_VPN_LIST_VIEW_H_
|
| +
|
| +#include <map>
|
| +#include <string>
|
| +
|
| +#include "ash/system/chromeos/network/vpn_delegate.h"
|
| +#include "ash/system/tray/view_click_listener.h"
|
| +#include "base/macros.h"
|
| +#include "chromeos/network/network_state_handler.h"
|
| +#include "ui/chromeos/network/network_list_view_base.h"
|
| +
|
| +namespace ui {
|
| +class NetworkListDelegate;
|
| +}
|
| +
|
| +namespace views {
|
| +class View;
|
| +}
|
| +
|
| +namespace ash {
|
| +
|
| +class HoverHighlightView;
|
| +
|
| +// A list of available VPN providers and networks. The list uses a hierarchical
|
| +// layout, allowing the user to see at a glance which provider a network belongs
|
| +// to. The only exception is the currently connected or connecting network,
|
| +// which is disconnected from its provider and moved to the top. If there is a
|
| +// connected or connecting network, a disconnect button is shown directly
|
| +// underneath it.
|
| +//
|
| +// Disconnected networks are arranged in shill's priority order within each
|
| +// provider and the providers are arranged in the order of their highest
|
| +// priority network. Clicking on a disconnected network triggers a connection
|
| +// attempt. Clicking on the currently connected or connecting network shows its
|
| +// configuration dialog. Clicking on a provider shows the provider's "add
|
| +// network" dialog.
|
| +class VPNListView : public ui::NetworkListViewBase,
|
| + public VPNDelegate::Observer,
|
| + public ViewClickListener {
|
| + public:
|
| + explicit VPNListView(ui::NetworkListDelegate* delegate);
|
| + ~VPNListView() override;
|
| +
|
| + // ui::NetworkListViewBase:
|
| + void Update() override;
|
| + bool IsNetworkEntry(views::View* view,
|
| + std::string* service_path) const override;
|
| +
|
| + // VPNDelegate::Observer:
|
| + void OnThirdPartyVPNProvidersChanged() override;
|
| +
|
| + // ViewClickListener:
|
| + void OnViewClicked(views::View* sender) override;
|
| +
|
| + private:
|
| + // Adds the provider identified by |name| and |id| to the list, along with any
|
| + // networks that belong to this provider.
|
| + void AddProviderAndNetworks(
|
| + const std::string& name,
|
| + const std::string& id,
|
| + const chromeos::NetworkStateHandler::NetworkStateList& networks);
|
| +
|
| + ui::NetworkListDelegate* const delegate_;
|
| +
|
| + // The service path of the currently connected or connecting network, or an
|
| + // empty string if there is no connected or connecting network.
|
| + std::string connected_or_connecting_service_path_;
|
| +
|
| + // The disconnect button shown underneath the currently connected or
|
| + // connecting network, or a nullptr if there is no connected or connecting
|
| + // network.
|
| + const HoverHighlightView* disconnect_button_ = nullptr;
|
| +
|
| + // A mapping from each VPN provider's list entry to the provider's ID.
|
| + std::map<const views::View*, std::string> provider_view_id_map_;
|
| +
|
| + // A mapping from each network's list entry to the network's service path.
|
| + std::map<const views::View*, std::string> network_view_service_path_map_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(VPNListView);
|
| +};
|
| +
|
| +} // namespace ash
|
| +
|
| +#endif // ASH_SYSTEM_CHROMEOS_NETWORK_VPN_LIST_VIEW_H_
|
|
|