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

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

Issue 2957043002: Add a row in the network tray to inform users to turn Bluetooth on to enable Tether. (Closed)
Patch Set: khorimoto@ comments Created 3 years, 5 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_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_state_list_detailed_view.h" 16 #include "ash/system/network/network_state_list_detailed_view.h"
17 #include "ash/system/tray/tray_info_label.h"
17 #include "base/macros.h" 18 #include "base/macros.h"
18 #include "chromeos/network/network_state_handler.h" 19 #include "chromeos/network/network_state_handler.h"
19 #include "chromeos/network/network_type_pattern.h" 20 #include "chromeos/network/network_type_pattern.h"
20 21
21 namespace views { 22 namespace views {
22 class Separator; 23 class Separator;
23 class View; 24 class View;
24 } 25 }
25 26
26 namespace ash { 27 namespace ash {
27 class HoverHighlightView; 28 class HoverHighlightView;
28 class TriView; 29 class TriView;
29 30
30 namespace tray { 31 namespace tray {
31 32
32 // 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
33 // network types except VPNs. For VPNs, see the |VPNList| class. 34 // network types except VPNs. For VPNs, see the |VPNList| class.
34 class NetworkListView : public NetworkStateListDetailedView, 35 class NetworkListView : public NetworkStateListDetailedView,
35 public network_icon::AnimationObserver { 36 public network_icon::AnimationObserver,
37 public TrayInfoLabel::Delegate {
36 public: 38 public:
37 class SectionHeaderRowView; 39 class SectionHeaderRowView;
38 40
39 NetworkListView(SystemTrayItem* owner, LoginStatus login); 41 NetworkListView(SystemTrayItem* owner, LoginStatus login);
40 ~NetworkListView() override; 42 ~NetworkListView() override;
41 43
42 // NetworkStateListDetailedView: 44 // NetworkStateListDetailedView:
43 void UpdateNetworkList() override; 45 void UpdateNetworkList() override;
44 bool IsNetworkEntry(views::View* view, std::string* guid) const override; 46 bool IsNetworkEntry(views::View* view, std::string* guid) const override;
45 47
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 void PlaceViewAtIndex(views::View* view, int index); 99 void PlaceViewAtIndex(views::View* view, int index);
98 100
99 // Creates an info label with text specified by |message_id| and adds it to 101 // Creates an info label with text specified by |message_id| and adds it to
100 // |scroll_content()| if necessary or updates the text and reorders the 102 // |scroll_content()| if necessary or updates the text and reorders the
101 // |scroll_content()| placing the info label at |insertion_index|. When 103 // |scroll_content()| placing the info label at |insertion_index|. When
102 // |message_id| is zero removes the |*info_label_ptr| from the 104 // |message_id| is zero removes the |*info_label_ptr| from the
103 // |scroll_content()| and destroys it. |info_label_ptr| is an in/out parameter 105 // |scroll_content()| and destroys it. |info_label_ptr| is an in/out parameter
104 // and is only modified if the info label is created or destroyed. 106 // and is only modified if the info label is created or destroyed.
105 void UpdateInfoLabel(int message_id, 107 void UpdateInfoLabel(int message_id,
106 int insertion_index, 108 int insertion_index,
107 InfoLabel** info_label_ptr); 109 TrayInfoLabel** info_label_ptr);
108 110
109 // Creates a cellular/tether/Wi-Fi header row |view| and adds it to 111 // Creates a cellular/tether/Wi-Fi header row |view| and adds it to
110 // |scroll_content()| if necessary and reorders the |scroll_content()| placing 112 // |scroll_content()| if necessary and reorders the |scroll_content()| placing
111 // the |view| at |child_index|. Returns the index where the next child should 113 // the |view| at |child_index|. Returns the index where the next child should
112 // be inserted, i.e., the index directly after the last inserted child. 114 // be inserted, i.e., the index directly after the last inserted child.
113 int UpdateSectionHeaderRow(chromeos::NetworkTypePattern pattern, 115 int UpdateSectionHeaderRow(chromeos::NetworkTypePattern pattern,
114 bool enabled, 116 bool enabled,
115 int child_index, 117 int child_index,
116 SectionHeaderRowView** view, 118 SectionHeaderRowView** view,
117 views::Separator** separator_view); 119 views::Separator** separator_view);
118 120
121 // TrayInfoLabel::Delegate:
122 void OnLabelClicked(int message_id) override;
123 bool IsLabelClickable(int message_id) const override;
124
119 // network_icon::AnimationObserver: 125 // network_icon::AnimationObserver:
120 void NetworkIconChanged() override; 126 void NetworkIconChanged() override;
121 127
122 // Returns true if the info should be updated to the view for network, 128 // Returns true if the info should be updated to the view for network,
123 // otherwise false. 129 // otherwise false.
124 bool NeedUpdateViewForNetwork(const NetworkInfo& info) const; 130 bool NeedUpdateViewForNetwork(const NetworkInfo& info) const;
125 131
126 bool needs_relayout_; 132 bool needs_relayout_;
127 133
128 InfoLabel* no_wifi_networks_view_; 134 TrayInfoLabel* no_wifi_networks_view_;
129 InfoLabel* no_mobile_networks_view_; 135 TrayInfoLabel* no_mobile_networks_view_;
130 SectionHeaderRowView* mobile_header_view_; 136 SectionHeaderRowView* mobile_header_view_;
131 SectionHeaderRowView* wifi_header_view_; 137 SectionHeaderRowView* wifi_header_view_;
132 views::Separator* mobile_separator_view_; 138 views::Separator* mobile_separator_view_;
133 views::Separator* wifi_separator_view_; 139 views::Separator* wifi_separator_view_;
134 TriView* connection_warning_; 140 TriView* connection_warning_;
135 141
136 // An owned list of network info. 142 // An owned list of network info.
137 std::vector<std::unique_ptr<NetworkInfo>> network_list_; 143 std::vector<std::unique_ptr<NetworkInfo>> network_list_;
138 144
139 using NetworkMap = std::map<views::View*, std::string>; 145 using NetworkMap = std::map<views::View*, std::string>;
140 NetworkMap network_map_; 146 NetworkMap network_map_;
141 147
142 // A map of network guids to their view. 148 // A map of network guids to their view.
143 using NetworkGuidMap = std::map<std::string, HoverHighlightView*>; 149 using NetworkGuidMap = std::map<std::string, HoverHighlightView*>;
144 NetworkGuidMap network_guid_map_; 150 NetworkGuidMap network_guid_map_;
145 151
146 // Save a map of network guids to their infos against current |network_list_|. 152 // Save a map of network guids to their infos against current |network_list_|.
147 using NetworkInfoMap = std::map<std::string, std::unique_ptr<NetworkInfo>>; 153 using NetworkInfoMap = std::map<std::string, std::unique_ptr<NetworkInfo>>;
148 NetworkInfoMap last_network_info_map_; 154 NetworkInfoMap last_network_info_map_;
149 155
150 DISALLOW_COPY_AND_ASSIGN(NetworkListView); 156 DISALLOW_COPY_AND_ASSIGN(NetworkListView);
151 }; 157 };
152 158
153 } // namespace tray 159 } // namespace tray
154 } // namespace ash 160 } // namespace ash
155 161
156 #endif // ASH_SYSTEM_NETWORK_NETWORK_LIST_H_ 162 #endif // ASH_SYSTEM_NETWORK_NETWORK_LIST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698