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

Side by Side Diff: ash/system/chromeos/network/vpn_list_view.h

Issue 980943005: Add ash UI for third-party VPNs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@f_2_407541_434711_remove_combined_name
Patch Set: 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
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_SYSTEM_CHROMEOS_NETWORK_VPN_LIST_VIEW_H_
6 #define ASH_SYSTEM_CHROMEOS_NETWORK_VPN_LIST_VIEW_H_
7
8 #include <map>
9 #include <string>
10
11 #include "ash/system/chromeos/network/vpn_delegate.h"
12 #include "ash/system/tray/view_click_listener.h"
13 #include "base/macros.h"
14 #include "chromeos/network/network_state_handler.h"
15 #include "ui/chromeos/network/network_list_view_base.h"
16
17 namespace ui {
18 class NetworkListDelegate;
19 }
20
21 namespace views {
22 class View;
23 }
24
25 namespace ash {
26
27 class HoverHighlightView;
28
29 // A list of available VPN providers and networks. The list uses a hierarchical
30 // layout, allowing the user to see at a glance which provider a network belongs
31 // to. The only exception is the currently connected or connecting network,
32 // which is disconnected from its provider and moved to the top. If there is a
33 // connected or connecting network, a disconnect button is shown directly
34 // underneath it.
35 //
36 // Disconnected networks are arranged in shill's priority order within each
37 // provider and the providers are arranged in the order of their highest
38 // priority network. Clicking on a disconnected network triggers a connection
39 // attempt. Clicking on the currently connected or connecting network shows its
40 // configuration dialog. Clicking on a provider shows the provider's "add
41 // network" dialog.
42 class VPNListView : public ui::NetworkListViewBase,
43 public VPNDelegate::Observer,
44 public ViewClickListener {
45 public:
46 explicit VPNListView(ui::NetworkListDelegate* delegate);
47 ~VPNListView() override;
48
49 // ui::NetworkListViewBase:
50 void Update() override;
51 bool IsNetworkEntry(views::View* view,
52 std::string* service_path) const override;
53
54 // VPNDelegate::Observer:
55 void OnThirdPartyVPNProvidersChanged() override;
56
57 // ViewClickListener:
58 void OnViewClicked(views::View* sender) override;
59
60 private:
61 // Adds the provider identified by |name| and |id| to the list, along with any
62 // networks that belong to this provider.
63 void AddProviderAndNetworks(
64 const std::string& name,
65 const std::string& id,
66 const chromeos::NetworkStateHandler::NetworkStateList& networks);
67
68 ui::NetworkListDelegate* const delegate_;
69
70 // The service path of the currently connected or connecting network, or an
71 // empty string if there is no connected or connecting network.
72 std::string connected_or_connecting_service_path_;
73
74 // The disconnect button shown underneath the currently connected or
75 // connecting network, or a nullptr if there is no connected or connecting
76 // network.
77 const HoverHighlightView* disconnect_button_ = nullptr;
78
79 // A mapping from each VPN provider's list entry to the provider's ID.
80 std::map<const views::View*, std::string> provider_view_id_map_;
81
82 // A mapping from each network's list entry to the network's service path.
83 std::map<const views::View*, std::string> network_view_service_path_map_;
84
85 DISALLOW_COPY_AND_ASSIGN(VPNListView);
86 };
87
88 } // namespace ash
89
90 #endif // ASH_SYSTEM_CHROMEOS_NETWORK_VPN_LIST_VIEW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698