OLD | NEW |
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_COMMON_SYSTEM_CHROMEOS_NETWORK_VPN_LIST_VIEW_H_ | 5 #ifndef ASH_COMMON_SYSTEM_CHROMEOS_NETWORK_VPN_LIST_VIEW_H_ |
6 #define ASH_COMMON_SYSTEM_CHROMEOS_NETWORK_VPN_LIST_VIEW_H_ | 6 #define ASH_COMMON_SYSTEM_CHROMEOS_NETWORK_VPN_LIST_VIEW_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 // network" dialog. | 43 // network" dialog. |
44 class VPNListView : public NetworkListViewBase, | 44 class VPNListView : public NetworkListViewBase, |
45 public VpnList::Observer, | 45 public VpnList::Observer, |
46 public ViewClickListener { | 46 public ViewClickListener { |
47 public: | 47 public: |
48 explicit VPNListView(NetworkListDelegate* delegate); | 48 explicit VPNListView(NetworkListDelegate* delegate); |
49 ~VPNListView() override; | 49 ~VPNListView() override; |
50 | 50 |
51 // NetworkListViewBase: | 51 // NetworkListViewBase: |
52 void Update() override; | 52 void Update() override; |
53 bool IsNetworkEntry(views::View* view, | 53 bool IsNetworkEntry(views::View* view, std::string* guid) const override; |
54 std::string* service_path) const override; | |
55 | 54 |
56 // VpnList::Observer: | 55 // VpnList::Observer: |
57 void OnVPNProvidersChanged() override; | 56 void OnVPNProvidersChanged() override; |
58 | 57 |
59 // ViewClickListener: | 58 // ViewClickListener: |
60 void OnViewClicked(views::View* sender) override; | 59 void OnViewClicked(views::View* sender) override; |
61 | 60 |
62 private: | 61 private: |
63 // Adds a network to the list. | 62 // Adds a network to the list. |
64 void AddNetwork(const chromeos::NetworkState* network); | 63 void AddNetwork(const chromeos::NetworkState* network); |
65 | 64 |
66 // Adds the VPN provider identified by |vpn_provider| to the list, along with | 65 // Adds the VPN provider identified by |vpn_provider| to the list, along with |
67 // any networks that belong to this provider. | 66 // any networks that belong to this provider. |
68 void AddProviderAndNetworks( | 67 void AddProviderAndNetworks( |
69 const VPNProvider& vpn_provider, | 68 const VPNProvider& vpn_provider, |
70 const chromeos::NetworkStateHandler::NetworkStateList& networks); | 69 const chromeos::NetworkStateHandler::NetworkStateList& networks); |
71 | 70 |
72 // Adds all available VPN providers and networks to the list. | 71 // Adds all available VPN providers and networks to the list. |
73 void AddProvidersAndNetworks( | 72 void AddProvidersAndNetworks( |
74 const chromeos::NetworkStateHandler::NetworkStateList& networks); | 73 const chromeos::NetworkStateHandler::NetworkStateList& networks); |
75 | 74 |
76 NetworkListDelegate* const delegate_; | 75 NetworkListDelegate* const delegate_; |
77 | 76 |
78 // A mapping from each VPN provider's list entry to the provider. | 77 // A mapping from each VPN provider's list entry to the provider. |
79 std::map<const views::View* const, VPNProvider> provider_view_map_; | 78 std::map<const views::View* const, VPNProvider> provider_view_map_; |
80 | 79 |
81 // A mapping from each network's list entry to the network's service path. | 80 // A mapping from each network's list entry to the network's guid. |
82 std::map<const views::View* const, std::string> | 81 std::map<const views::View* const, std::string> network_view_guid_map_; |
83 network_view_service_path_map_; | |
84 | 82 |
85 // Whether the list is currently empty (i.e., the next entry added will become | 83 // Whether the list is currently empty (i.e., the next entry added will become |
86 // the topmost entry). | 84 // the topmost entry). |
87 bool list_empty_ = true; | 85 bool list_empty_ = true; |
88 | 86 |
89 DISALLOW_COPY_AND_ASSIGN(VPNListView); | 87 DISALLOW_COPY_AND_ASSIGN(VPNListView); |
90 }; | 88 }; |
91 | 89 |
92 } // namespace ash | 90 } // namespace ash |
93 | 91 |
94 #endif // ASH_COMMON_SYSTEM_CHROMEOS_NETWORK_VPN_LIST_VIEW_H_ | 92 #endif // ASH_COMMON_SYSTEM_CHROMEOS_NETWORK_VPN_LIST_VIEW_H_ |
OLD | NEW |