| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_NETWORK_LIST_H_ | 5 #ifndef ASH_SYSTEM_NETWORK_NETWORK_LIST_H_ |
| 6 #define ASH_SYSTEM_NETWORK_NETWORK_LIST_H_ | 6 #define ASH_SYSTEM_NETWORK_NETWORK_LIST_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 namespace views { | 22 namespace views { |
| 23 class Label; | 23 class Label; |
| 24 class Separator; | 24 class Separator; |
| 25 class View; | 25 class View; |
| 26 } | 26 } |
| 27 | 27 |
| 28 namespace ash { | 28 namespace ash { |
| 29 | 29 |
| 30 struct NetworkInfo; | 30 struct NetworkInfo; |
| 31 class NetworkListDelegate; | 31 class NetworkListDelegate; |
| 32 class TriView; |
| 32 | 33 |
| 33 // A list of available networks of a given type. This class is used for all | 34 // A list of available networks of a given type. This class is used for all |
| 34 // network types except VPNs. For VPNs, see the |VPNList| class. | 35 // network types except VPNs. For VPNs, see the |VPNList| class. |
| 35 class NetworkListView : public NetworkListViewBase, | 36 class NetworkListView : public NetworkListViewBase, |
| 36 public network_icon::AnimationObserver { | 37 public network_icon::AnimationObserver { |
| 37 public: | 38 public: |
| 38 class SectionHeaderRowView; | 39 class SectionHeaderRowView; |
| 39 | 40 |
| 40 explicit NetworkListView(NetworkListDelegate* delegate); | 41 explicit NetworkListView(NetworkListDelegate* delegate); |
| 41 ~NetworkListView() override; | 42 ~NetworkListView() override; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 60 | 61 |
| 61 // Refreshes a list of child views, updates |network_map_| and | 62 // Refreshes a list of child views, updates |network_map_| and |
| 62 // |network_guid_map_| and performs layout making sure selected view if any is | 63 // |network_guid_map_| and performs layout making sure selected view if any is |
| 63 // scrolled into view. | 64 // scrolled into view. |
| 64 void UpdateNetworkListInternal(); | 65 void UpdateNetworkListInternal(); |
| 65 | 66 |
| 66 // Adds new or updates existing child views including header row and messages. | 67 // Adds new or updates existing child views including header row and messages. |
| 67 // Returns a set of guids for the added network connections. | 68 // Returns a set of guids for the added network connections. |
| 68 std::unique_ptr<std::set<std::string>> UpdateNetworkListEntries(); | 69 std::unique_ptr<std::set<std::string>> UpdateNetworkListEntries(); |
| 69 | 70 |
| 71 // Creates the view which displays a warning message, if a VPN or proxy is |
| 72 // being used. |
| 73 TriView* CreateConnectionWarning(); |
| 74 |
| 70 // Adds or updates child views representing the network connections when | 75 // Adds or updates child views representing the network connections when |
| 71 // |is_wifi| is matching the attribute of a network connection starting at | 76 // |is_wifi| is matching the attribute of a network connection starting at |
| 72 // |child_index|. Returns a set of guids for the added network | 77 // |child_index|. Returns a set of guids for the added network |
| 73 // connections. | 78 // connections. |
| 74 std::unique_ptr<std::set<std::string>> UpdateNetworkChildren( | 79 std::unique_ptr<std::set<std::string>> UpdateNetworkChildren( |
| 75 NetworkInfo::Type type, | 80 NetworkInfo::Type type, |
| 76 int child_index); | 81 int child_index); |
| 77 void UpdateNetworkChild(int index, const NetworkInfo* info); | 82 void UpdateNetworkChild(int index, const NetworkInfo* info); |
| 78 | 83 |
| 79 // Reorders children of |container()| as necessary placing |view| at |index|. | 84 // Reorders children of |container()| as necessary placing |view| at |index|. |
| (...skipping 30 matching lines...) Expand all Loading... |
| 110 NetworkListDelegate* delegate_; | 115 NetworkListDelegate* delegate_; |
| 111 | 116 |
| 112 views::Label* no_wifi_networks_view_; | 117 views::Label* no_wifi_networks_view_; |
| 113 views::Label* no_cellular_networks_view_; | 118 views::Label* no_cellular_networks_view_; |
| 114 SectionHeaderRowView* cellular_header_view_; | 119 SectionHeaderRowView* cellular_header_view_; |
| 115 SectionHeaderRowView* tether_header_view_; | 120 SectionHeaderRowView* tether_header_view_; |
| 116 SectionHeaderRowView* wifi_header_view_; | 121 SectionHeaderRowView* wifi_header_view_; |
| 117 views::Separator* cellular_separator_view_; | 122 views::Separator* cellular_separator_view_; |
| 118 views::Separator* tether_separator_view_; | 123 views::Separator* tether_separator_view_; |
| 119 views::Separator* wifi_separator_view_; | 124 views::Separator* wifi_separator_view_; |
| 125 TriView* connection_warning_; |
| 120 | 126 |
| 121 // An owned list of network info. | 127 // An owned list of network info. |
| 122 std::vector<std::unique_ptr<NetworkInfo>> network_list_; | 128 std::vector<std::unique_ptr<NetworkInfo>> network_list_; |
| 123 | 129 |
| 124 using NetworkMap = std::map<views::View*, std::string>; | 130 using NetworkMap = std::map<views::View*, std::string>; |
| 125 NetworkMap network_map_; | 131 NetworkMap network_map_; |
| 126 | 132 |
| 127 // A map of network guids to their view. | 133 // A map of network guids to their view. |
| 128 using NetworkGuidMap = std::map<std::string, views::View*>; | 134 using NetworkGuidMap = std::map<std::string, views::View*>; |
| 129 NetworkGuidMap network_guid_map_; | 135 NetworkGuidMap network_guid_map_; |
| 130 | 136 |
| 131 // Save a map of network guids to their infos against current |network_list_|. | 137 // Save a map of network guids to their infos against current |network_list_|. |
| 132 using NetworkInfoMap = std::map<std::string, std::unique_ptr<NetworkInfo>>; | 138 using NetworkInfoMap = std::map<std::string, std::unique_ptr<NetworkInfo>>; |
| 133 NetworkInfoMap last_network_info_map_; | 139 NetworkInfoMap last_network_info_map_; |
| 134 | 140 |
| 135 DISALLOW_COPY_AND_ASSIGN(NetworkListView); | 141 DISALLOW_COPY_AND_ASSIGN(NetworkListView); |
| 136 }; | 142 }; |
| 137 | 143 |
| 138 } // namespace ash | 144 } // namespace ash |
| 139 | 145 |
| 140 #endif // ASH_SYSTEM_NETWORK_NETWORK_LIST_H_ | 146 #endif // ASH_SYSTEM_NETWORK_NETWORK_LIST_H_ |
| OLD | NEW |