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

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

Issue 2843163003: Remove NetworkListDelegate (Closed)
Patch Set: Addressed review comments 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
« no previous file with comments | « ash/BUILD.gn ('k') | ash/system/network/network_list.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_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>
11 #include <string> 11 #include <string>
12 #include <vector> 12 #include <vector>
13 13
14 #include "ash/system/network/network_icon_animation_observer.h" 14 #include "ash/system/network/network_icon_animation_observer.h"
15 #include "ash/system/network/network_info.h" 15 #include "ash/system/network/network_info.h"
16 #include "ash/system/network/network_list_view_base.h" 16 #include "ash/system/network/network_list_view_base.h"
17 #include "base/macros.h" 17 #include "base/macros.h"
18 #include "chromeos/network/network_state_handler.h" 18 #include "chromeos/network/network_state_handler.h"
19 #include "chromeos/network/network_type_pattern.h" 19 #include "chromeos/network/network_type_pattern.h"
20 #include "ui/gfx/image/image_skia.h" 20 #include "ui/gfx/image/image_skia.h"
21 21
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 class HoverHighlightView;
30 struct NetworkInfo; 30 struct NetworkInfo;
31 class NetworkListDelegate;
32 class TriView; 31 class TriView;
33 32
34 // A list of available networks of a given type. This class is used for all 33 // A list of available networks of a given type. This class is used for all
35 // network types except VPNs. For VPNs, see the |VPNList| class. 34 // network types except VPNs. For VPNs, see the |VPNList| class.
36 class NetworkListView : public NetworkListViewBase, 35 class NetworkListView : public NetworkListViewBase,
37 public network_icon::AnimationObserver { 36 public network_icon::AnimationObserver {
38 public: 37 public:
39 class SectionHeaderRowView; 38 class SectionHeaderRowView;
40 39
41 explicit NetworkListView(NetworkListDelegate* delegate); 40 explicit NetworkListView(tray::NetworkStateListDetailedView* detailed_view);
42 ~NetworkListView() override; 41 ~NetworkListView() override;
43 42
44 // NetworkListViewBase: 43 // NetworkListViewBase:
45 void Update() override; 44 void Update() override;
46 bool IsNetworkEntry(views::View* view, std::string* guid) const override; 45 bool IsNetworkEntry(views::View* view, std::string* guid) 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(
(...skipping 13 matching lines...) Expand all
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 guids 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 // Creates the view which displays a warning message, if a VPN or proxy is 70 // Creates the view which displays a warning message, if a VPN or proxy is
72 // being used. 71 // being used.
73 TriView* CreateConnectionWarning(); 72 TriView* CreateConnectionWarning();
74 73
74 // Creates and returns a View with the information in |info|.
75 HoverHighlightView* CreateViewForNetwork(const NetworkInfo& info);
76
77 // Updates |view| with the information in |info|. Note that |view| is
78 // guaranteed to be a View returned from |CreateViewForNetwork()|.
79 void UpdateViewForNetwork(HoverHighlightView* view, const NetworkInfo& info);
80
81 // Creates the view of an extra icon appearing next to the network name
82 // indicating that the network is controlled by an extension. If no extension
83 // is registered for this network, returns |nullptr|.
84 views::View* CreateControlledByExtensionView(const NetworkInfo& info);
85
75 // Adds or updates child views representing the network connections when 86 // Adds or updates child views representing the network connections when
76 // |is_wifi| is matching the attribute of a network connection starting at 87 // |is_wifi| is matching the attribute of a network connection starting at
77 // |child_index|. Returns a set of guids for the added network 88 // |child_index|. Returns a set of guids for the added network
78 // connections. 89 // connections.
79 std::unique_ptr<std::set<std::string>> UpdateNetworkChildren( 90 std::unique_ptr<std::set<std::string>> UpdateNetworkChildren(
80 NetworkInfo::Type type, 91 NetworkInfo::Type type,
81 int child_index); 92 int child_index);
82 void UpdateNetworkChild(int index, const NetworkInfo* info); 93 void UpdateNetworkChild(int index, const NetworkInfo* info);
83 94
84 // Reorders children of |container()| as necessary placing |view| at |index|. 95 // Reorders children of |container()| as necessary placing |view| at |index|.
(...skipping 20 matching lines...) Expand all
105 views::Separator** separator_view); 116 views::Separator** separator_view);
106 117
107 // network_icon::AnimationObserver: 118 // network_icon::AnimationObserver:
108 void NetworkIconChanged() override; 119 void NetworkIconChanged() override;
109 120
110 // Returns true if the info should be updated to the view for network, 121 // Returns true if the info should be updated to the view for network,
111 // otherwise false. 122 // otherwise false.
112 bool NeedUpdateViewForNetwork(const NetworkInfo& info) const; 123 bool NeedUpdateViewForNetwork(const NetworkInfo& info) const;
113 124
114 bool needs_relayout_; 125 bool needs_relayout_;
115 NetworkListDelegate* delegate_;
116 126
117 views::Label* no_wifi_networks_view_; 127 views::Label* no_wifi_networks_view_;
118 views::Label* no_cellular_networks_view_; 128 views::Label* no_cellular_networks_view_;
119 SectionHeaderRowView* cellular_header_view_; 129 SectionHeaderRowView* cellular_header_view_;
120 SectionHeaderRowView* tether_header_view_; 130 SectionHeaderRowView* tether_header_view_;
121 SectionHeaderRowView* wifi_header_view_; 131 SectionHeaderRowView* wifi_header_view_;
122 views::Separator* cellular_separator_view_; 132 views::Separator* cellular_separator_view_;
123 views::Separator* tether_separator_view_; 133 views::Separator* tether_separator_view_;
124 views::Separator* wifi_separator_view_; 134 views::Separator* wifi_separator_view_;
125 TriView* connection_warning_; 135 TriView* connection_warning_;
126 136
127 // An owned list of network info. 137 // An owned list of network info.
128 std::vector<std::unique_ptr<NetworkInfo>> network_list_; 138 std::vector<std::unique_ptr<NetworkInfo>> network_list_;
129 139
130 using NetworkMap = std::map<views::View*, std::string>; 140 using NetworkMap = std::map<views::View*, std::string>;
131 NetworkMap network_map_; 141 NetworkMap network_map_;
132 142
133 // A map of network guids to their view. 143 // A map of network guids to their view.
134 using NetworkGuidMap = std::map<std::string, views::View*>; 144 using NetworkGuidMap = std::map<std::string, HoverHighlightView*>;
135 NetworkGuidMap network_guid_map_; 145 NetworkGuidMap network_guid_map_;
136 146
137 // Save a map of network guids to their infos against current |network_list_|. 147 // Save a map of network guids to their infos against current |network_list_|.
138 using NetworkInfoMap = std::map<std::string, std::unique_ptr<NetworkInfo>>; 148 using NetworkInfoMap = std::map<std::string, std::unique_ptr<NetworkInfo>>;
139 NetworkInfoMap last_network_info_map_; 149 NetworkInfoMap last_network_info_map_;
140 150
141 DISALLOW_COPY_AND_ASSIGN(NetworkListView); 151 DISALLOW_COPY_AND_ASSIGN(NetworkListView);
142 }; 152 };
143 153
144 } // namespace ash 154 } // namespace ash
145 155
146 #endif // ASH_SYSTEM_NETWORK_NETWORK_LIST_H_ 156 #endif // ASH_SYSTEM_NETWORK_NETWORK_LIST_H_
OLDNEW
« no previous file with comments | « ash/BUILD.gn ('k') | ash/system/network/network_list.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698