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

Side by Side Diff: ash/common/system/chromeos/network/network_list_md.h

Issue 2698473007: Convert path usage in NetworkListViewBase subclasses to use guids. (Closed)
Patch Set: Tweak NetworkPortalNotificationControllerTest to create GUIDs for new NetworkStates. Created 3 years, 10 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 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_COMMON_SYSTEM_CHROMEOS_NETWORK_NETWORK_LIST_MD_H_ 5 #ifndef ASH_COMMON_SYSTEM_CHROMEOS_NETWORK_NETWORK_LIST_MD_H_
6 #define ASH_COMMON_SYSTEM_CHROMEOS_NETWORK_NETWORK_LIST_MD_H_ 6 #define ASH_COMMON_SYSTEM_CHROMEOS_NETWORK_NETWORK_LIST_MD_H_
7 7
8 #include <map> 8 #include <map>
9 #include <memory> 9 #include <memory>
10 #include <set> 10 #include <set>
(...skipping 24 matching lines...) Expand all
35 class NetworkListViewMd : public NetworkListViewBase, 35 class NetworkListViewMd : public NetworkListViewBase,
36 public network_icon::AnimationObserver { 36 public network_icon::AnimationObserver {
37 public: 37 public:
38 class SectionHeaderRowView; 38 class SectionHeaderRowView;
39 39
40 explicit NetworkListViewMd(NetworkListDelegate* delegate); 40 explicit NetworkListViewMd(NetworkListDelegate* delegate);
41 ~NetworkListViewMd() override; 41 ~NetworkListViewMd() override;
42 42
43 // NetworkListViewBase: 43 // NetworkListViewBase:
44 void Update() override; 44 void Update() override;
45 bool IsNetworkEntry(views::View* view, 45 bool IsNetworkEntry(views::View* view, std::string* guid) const override;
46 std::string* service_path) const override;
47 46
48 private: 47 private:
49 // Clears |network_list_| and adds to it |networks| that match |delegate_|'s 48 // Clears |network_list_| and adds to it |networks| that match |delegate_|'s
50 // network type pattern. 49 // network type pattern.
51 void UpdateNetworks( 50 void UpdateNetworks(
52 const chromeos::NetworkStateHandler::NetworkStateList& networks); 51 const chromeos::NetworkStateHandler::NetworkStateList& networks);
53 52
54 // Updates |network_list_| entries and sets |this| to observe network icon 53 // Updates |network_list_| entries and sets |this| to observe network icon
55 // animations when any of the networks are in connecting state. 54 // animations when any of the networks are in connecting state.
56 void UpdateNetworkIcons(); 55 void UpdateNetworkIcons();
57 56
58 // Orders entries in |network_list_| such that higher priority network types 57 // Orders entries in |network_list_| such that higher priority network types
59 // are at the top of the list. 58 // are at the top of the list.
60 void OrderNetworks(); 59 void OrderNetworks();
61 60
62 // Refreshes a list of child views, updates |network_map_| and 61 // Refreshes a list of child views, updates |network_map_| and
63 // |service_path_map_| and performs layout making sure selected view if any is 62 // |network_guid_map_| and performs layout making sure selected view if any is
64 // scrolled into view. 63 // scrolled into view.
65 void UpdateNetworkListInternal(); 64 void UpdateNetworkListInternal();
66 65
67 // Adds new or updates existing child views including header row and messages. 66 // Adds new or updates existing child views including header row and messages.
68 // Returns a set of service paths for the added network connections. 67 // Returns a set of guids for the added network connections.
69 std::unique_ptr<std::set<std::string>> UpdateNetworkListEntries(); 68 std::unique_ptr<std::set<std::string>> UpdateNetworkListEntries();
70 69
71 // Adds or updates child views representing the network connections when 70 // Adds or updates child views representing the network connections when
72 // |is_wifi| is matching the attribute of a network connection starting at 71 // |is_wifi| is matching the attribute of a network connection starting at
73 // |child_index|. Returns a set of service paths for the added network 72 // |child_index|. Returns a set of guids for the added network
74 // connections. 73 // connections.
75 std::unique_ptr<std::set<std::string>> UpdateNetworkChildren( 74 std::unique_ptr<std::set<std::string>> UpdateNetworkChildren(
76 NetworkInfo::Type type, 75 NetworkInfo::Type type,
77 int child_index); 76 int child_index);
78 void UpdateNetworkChild(int index, const NetworkInfo* info); 77 void UpdateNetworkChild(int index, const NetworkInfo* info);
79 78
80 // Reorders children of |container()| as necessary placing |view| at |index|. 79 // Reorders children of |container()| as necessary placing |view| at |index|.
81 void PlaceViewAtIndex(views::View* view, int index); 80 void PlaceViewAtIndex(views::View* view, int index);
82 81
83 // Creates a Label with text specified by |message_id| and adds it to 82 // Creates a Label with text specified by |message_id| and adds it to
(...skipping 28 matching lines...) Expand all
112 SectionHeaderRowView* wifi_header_view_; 111 SectionHeaderRowView* wifi_header_view_;
113 views::Separator* cellular_separator_view_; 112 views::Separator* cellular_separator_view_;
114 views::Separator* wifi_separator_view_; 113 views::Separator* wifi_separator_view_;
115 114
116 // An owned list of network info. 115 // An owned list of network info.
117 std::vector<std::unique_ptr<NetworkInfo>> network_list_; 116 std::vector<std::unique_ptr<NetworkInfo>> network_list_;
118 117
119 using NetworkMap = std::map<views::View*, std::string>; 118 using NetworkMap = std::map<views::View*, std::string>;
120 NetworkMap network_map_; 119 NetworkMap network_map_;
121 120
122 // A map of network service paths to their view. 121 // A map of network guids to their view.
123 typedef std::map<std::string, views::View*> ServicePathMap; 122 typedef std::map<std::string, views::View*> NetworkGuidMap;
124 ServicePathMap service_path_map_; 123 NetworkGuidMap network_guid_map_;
125 124
126 DISALLOW_COPY_AND_ASSIGN(NetworkListViewMd); 125 DISALLOW_COPY_AND_ASSIGN(NetworkListViewMd);
127 }; 126 };
128 127
129 } // namespace ash 128 } // namespace ash
130 129
131 #endif // ASH_COMMON_SYSTEM_CHROMEOS_NETWORK_NETWORK_LIST_MD_H_ 130 #endif // ASH_COMMON_SYSTEM_CHROMEOS_NETWORK_NETWORK_LIST_MD_H_
OLDNEW
« no previous file with comments | « ash/common/system/chromeos/network/network_list.cc ('k') | ash/common/system/chromeos/network/network_list_md.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698