| 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_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_state_list_detailed_view.h" |
| 12 #include "ash/system/network/vpn_list.h" | 12 #include "ash/system/network/vpn_list.h" |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "chromeos/network/network_state_handler.h" | 14 #include "chromeos/network/network_state_handler.h" |
| 15 | 15 |
| 16 namespace chromeos { | 16 namespace chromeos { |
| 17 class NetworkState; | 17 class NetworkState; |
| 18 } | 18 } |
| 19 | 19 |
| 20 namespace views { | 20 namespace views { |
| 21 class View; | 21 class View; |
| 22 } | 22 } |
| 23 | 23 |
| 24 namespace ash { | 24 namespace ash { |
| 25 namespace tray { | 25 namespace tray { |
| 26 class NetworkStateListDetailedView; | |
| 27 } | |
| 28 | 26 |
| 29 // A list of VPN providers and networks that shows VPN providers and networks in | 27 // A list of VPN providers and networks that shows VPN providers and networks in |
| 30 // a hierarchical layout, allowing the user to see at a glance which provider a | 28 // a hierarchical layout, allowing the user to see at a glance which provider a |
| 31 // network belongs to. The only exception is the currently connected or | 29 // network belongs to. The only exception is the currently connected or |
| 32 // connecting network, which is detached from its provider and moved to the top. | 30 // connecting network, which is detached from its provider and moved to the top. |
| 33 // If there is a connected network, a disconnect button is shown next to its | 31 // If there is a connected network, a disconnect button is shown next to its |
| 34 // name. | 32 // name. |
| 35 // | 33 // |
| 36 // Disconnected networks are arranged in shill's priority order within each | 34 // Disconnected networks are arranged in shill's priority order within each |
| 37 // provider and the providers are arranged in the order of their highest | 35 // provider and the providers are arranged in the order of their highest |
| 38 // priority network. Clicking on a disconnected network triggers a connection | 36 // priority network. Clicking on a disconnected network triggers a connection |
| 39 // attempt. Clicking on the currently connected or connecting network shows its | 37 // attempt. Clicking on the currently connected or connecting network shows its |
| 40 // configuration dialog. Clicking on a provider shows the provider's "add | 38 // configuration dialog. Clicking on a provider shows the provider's "add |
| 41 // network" dialog. | 39 // network" dialog. |
| 42 class VPNListView : public NetworkListViewBase, public VpnList::Observer { | 40 class VPNListView : public NetworkStateListDetailedView, |
| 41 public VpnList::Observer { |
| 43 public: | 42 public: |
| 44 explicit VPNListView(tray::NetworkStateListDetailedView* detailed_view); | 43 VPNListView(SystemTrayItem* owner, LoginStatus login); |
| 45 ~VPNListView() override; | 44 ~VPNListView() override; |
| 46 | 45 |
| 47 // NetworkListViewBase: | 46 // NetworkStateListDetailedView: |
| 48 void Update() override; | 47 void UpdateNetworkList() override; |
| 49 bool IsNetworkEntry(views::View* view, std::string* guid) const override; | 48 bool IsNetworkEntry(views::View* view, std::string* guid) const override; |
| 50 | 49 |
| 51 // VpnList::Observer: | 50 // VpnList::Observer: |
| 52 void OnVPNProvidersChanged() override; | 51 void OnVPNProvidersChanged() override; |
| 53 | 52 |
| 54 private: | 53 private: |
| 55 // Adds a network to the list. | 54 // Adds a network to the list. |
| 56 void AddNetwork(const chromeos::NetworkState* network); | 55 void AddNetwork(const chromeos::NetworkState* network); |
| 57 | 56 |
| 58 // Adds the VPN provider identified by |vpn_provider| to the list, along with | 57 // Adds the VPN provider identified by |vpn_provider| to the list, along with |
| (...skipping 12 matching lines...) Expand all Loading... |
| 71 // A mapping from each network's list entry to the network's guid. | 70 // A mapping from each network's list entry to the network's guid. |
| 72 std::map<const views::View* const, std::string> network_view_guid_map_; | 71 std::map<const views::View* const, std::string> network_view_guid_map_; |
| 73 | 72 |
| 74 // Whether the list is currently empty (i.e., the next entry added will become | 73 // Whether the list is currently empty (i.e., the next entry added will become |
| 75 // the topmost entry). | 74 // the topmost entry). |
| 76 bool list_empty_ = true; | 75 bool list_empty_ = true; |
| 77 | 76 |
| 78 DISALLOW_COPY_AND_ASSIGN(VPNListView); | 77 DISALLOW_COPY_AND_ASSIGN(VPNListView); |
| 79 }; | 78 }; |
| 80 | 79 |
| 80 } // namespace tray |
| 81 } // namespace ash | 81 } // namespace ash |
| 82 | 82 |
| 83 #endif // ASH_SYSTEM_NETWORK_VPN_LIST_VIEW_H_ | 83 #endif // ASH_SYSTEM_NETWORK_VPN_LIST_VIEW_H_ |
| OLD | NEW |