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

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

Issue 2853143002: Simplify code for VPN entries in system menu (Closed)
Patch Set: Removed unnecessary return Created 3 years, 7 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
1 // Copyright 2015 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef ASH_SYSTEM_NETWORK_VPN_LIST_VIEW_H_ 5 #ifndef ASH_SYSTEM_NETWORK_VPN_LIST_VIEW_H_
6 #define ASH_SYSTEM_NETWORK_VPN_LIST_VIEW_H_ 6 #define ASH_SYSTEM_NETWORK_VPN_LIST_VIEW_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 10
11 #include "ash/system/network/network_list_view_base.h" 11 #include "ash/system/network/network_list_view_base.h"
12 #include "ash/system/network/vpn_list.h" 12 #include "ash/system/network/vpn_list.h"
13 #include "ash/system/tray/view_click_listener.h"
14 #include "base/macros.h" 13 #include "base/macros.h"
15 #include "chromeos/network/network_state_handler.h" 14 #include "chromeos/network/network_state_handler.h"
16 15
17 namespace chromeos { 16 namespace chromeos {
18 class NetworkState; 17 class NetworkState;
19 } 18 }
20 19
21 namespace views { 20 namespace views {
22 class View; 21 class View;
23 } 22 }
24 23
25 namespace ash { 24 namespace ash {
26 namespace tray { 25 namespace tray {
27 class NetworkStateListDetailedView; 26 class NetworkStateListDetailedView;
28 } 27 }
29 28
30 // A list of VPN providers and networks that shows VPN providers and networks in 29 // A list of VPN providers and networks that shows VPN providers and networks in
31 // a hierarchical layout, allowing the user to see at a glance which provider a 30 // a hierarchical layout, allowing the user to see at a glance which provider a
32 // network belongs to. The only exception is the currently connected or 31 // network belongs to. The only exception is the currently connected or
33 // connecting network, which is detached from its provider and moved to the top. 32 // connecting network, which is detached from its provider and moved to the top.
34 // If there is a connected network, a disconnect button is shown next to its 33 // If there is a connected network, a disconnect button is shown next to its
35 // name. 34 // name.
36 // 35 //
37 // Disconnected networks are arranged in shill's priority order within each 36 // Disconnected networks are arranged in shill's priority order within each
38 // provider and the providers are arranged in the order of their highest 37 // provider and the providers are arranged in the order of their highest
39 // priority network. Clicking on a disconnected network triggers a connection 38 // priority network. Clicking on a disconnected network triggers a connection
40 // attempt. Clicking on the currently connected or connecting network shows its 39 // attempt. Clicking on the currently connected or connecting network shows its
41 // configuration dialog. Clicking on a provider shows the provider's "add 40 // configuration dialog. Clicking on a provider shows the provider's "add
42 // network" dialog. 41 // network" dialog.
43 class VPNListView : public NetworkListViewBase, 42 class VPNListView : public NetworkListViewBase, public VpnList::Observer {
44 public VpnList::Observer,
45 public ViewClickListener {
46 public: 43 public:
47 explicit VPNListView(tray::NetworkStateListDetailedView* detailed_view); 44 explicit VPNListView(tray::NetworkStateListDetailedView* detailed_view);
48 ~VPNListView() override; 45 ~VPNListView() override;
49 46
50 // NetworkListViewBase: 47 // NetworkListViewBase:
51 void Update() override; 48 void Update() override;
52 bool IsNetworkEntry(views::View* view, std::string* guid) const override; 49 bool IsNetworkEntry(views::View* view, std::string* guid) const override;
53 50
54 // VpnList::Observer: 51 // VpnList::Observer:
55 void OnVPNProvidersChanged() override; 52 void OnVPNProvidersChanged() override;
56 53
57 // ViewClickListener:
58 void OnViewClicked(views::View* sender) override;
59
60 private: 54 private:
61 // Adds a network to the list. 55 // Adds a network to the list.
62 void AddNetwork(const chromeos::NetworkState* network); 56 void AddNetwork(const chromeos::NetworkState* network);
63 57
64 // Adds the VPN provider identified by |vpn_provider| to the list, along with 58 // Adds the VPN provider identified by |vpn_provider| to the list, along with
65 // any networks that belong to this provider. 59 // any networks that belong to this provider.
66 void AddProviderAndNetworks( 60 void AddProviderAndNetworks(
67 const VPNProvider& vpn_provider, 61 const VPNProvider& vpn_provider,
68 const chromeos::NetworkStateHandler::NetworkStateList& networks); 62 const chromeos::NetworkStateHandler::NetworkStateList& networks);
69 63
(...skipping 10 matching lines...) Expand all
80 // Whether the list is currently empty (i.e., the next entry added will become 74 // Whether the list is currently empty (i.e., the next entry added will become
81 // the topmost entry). 75 // the topmost entry).
82 bool list_empty_ = true; 76 bool list_empty_ = true;
83 77
84 DISALLOW_COPY_AND_ASSIGN(VPNListView); 78 DISALLOW_COPY_AND_ASSIGN(VPNListView);
85 }; 79 };
86 80
87 } // namespace ash 81 } // namespace ash
88 82
89 #endif // ASH_SYSTEM_NETWORK_VPN_LIST_VIEW_H_ 83 #endif // ASH_SYSTEM_NETWORK_VPN_LIST_VIEW_H_
OLDNEW
« no previous file with comments | « ash/system/network/network_state_list_detailed_view.cc ('k') | ash/system/network/vpn_list_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698