| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include "ui/chromeos/network/network_list.h" | 5 #include "ui/chromeos/network/network_list.h" |
| 6 | 6 |
| 7 #include "chromeos/dbus/dbus_thread_manager.h" | 7 #include "chromeos/dbus/dbus_thread_manager.h" |
| 8 #include "chromeos/dbus/power_manager/power_supply_properties.pb.h" | 8 #include "chromeos/dbus/power_manager/power_supply_properties.pb.h" |
| 9 #include "chromeos/dbus/power_manager_client.h" | 9 #include "chromeos/dbus/power_manager_client.h" |
| 10 #include "chromeos/network/network_state.h" | 10 #include "chromeos/network/network_state.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 using chromeos::NetworkHandler; | 24 using chromeos::NetworkHandler; |
| 25 using chromeos::NetworkStateHandler; | 25 using chromeos::NetworkStateHandler; |
| 26 using chromeos::NetworkTypePattern; | 26 using chromeos::NetworkTypePattern; |
| 27 | 27 |
| 28 namespace ui { | 28 namespace ui { |
| 29 | 29 |
| 30 // NetworkListView: | 30 // NetworkListView: |
| 31 | 31 |
| 32 NetworkListView::NetworkListView(NetworkListDelegate* delegate) | 32 NetworkListView::NetworkListView(NetworkListDelegate* delegate) |
| 33 : delegate_(delegate), | 33 : delegate_(delegate), |
| 34 scanning_view_(NULL), | |
| 35 no_wifi_networks_view_(NULL), | 34 no_wifi_networks_view_(NULL), |
| 36 no_cellular_networks_view_(NULL) { | 35 no_cellular_networks_view_(NULL) { |
| 37 CHECK(delegate_); | 36 CHECK(delegate_); |
| 38 } | 37 } |
| 39 | 38 |
| 40 NetworkListView::~NetworkListView() { | 39 NetworkListView::~NetworkListView() { |
| 41 network_icon::NetworkIconAnimation::GetInstance()->RemoveObserver(this); | 40 network_icon::NetworkIconAnimation::GetInstance()->RemoveObserver(this); |
| 42 } | 41 } |
| 43 | 42 |
| 44 void NetworkListView::Update() { | 43 void NetworkListView::Update() { |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 int message_id = 0; | 184 int message_id = 0; |
| 186 if (network_list_.empty()) { | 185 if (network_list_.empty()) { |
| 187 message_id = handler->IsTechnologyEnabled(NetworkTypePattern::WiFi()) | 186 message_id = handler->IsTechnologyEnabled(NetworkTypePattern::WiFi()) |
| 188 ? IDS_ASH_STATUS_TRAY_NETWORK_WIFI_ENABLED | 187 ? IDS_ASH_STATUS_TRAY_NETWORK_WIFI_ENABLED |
| 189 : IDS_ASH_STATUS_TRAY_NETWORK_WIFI_DISABLED; | 188 : IDS_ASH_STATUS_TRAY_NETWORK_WIFI_DISABLED; |
| 190 } | 189 } |
| 191 needs_relayout |= | 190 needs_relayout |= |
| 192 UpdateInfoLabel(message_id, index, &no_wifi_networks_view_); | 191 UpdateInfoLabel(message_id, index, &no_wifi_networks_view_); |
| 193 if (message_id) | 192 if (message_id) |
| 194 ++index; | 193 ++index; |
| 195 | |
| 196 // "Wifi Scanning" | |
| 197 message_id = 0; | |
| 198 if (handler->GetScanningByType(NetworkTypePattern::WiFi())) | |
| 199 message_id = IDS_ASH_STATUS_TRAY_WIFI_SCANNING_MESSAGE; | |
| 200 needs_relayout |= UpdateInfoLabel(message_id, index, &scanning_view_); | |
| 201 if (message_id) | |
| 202 ++index; | |
| 203 } | 194 } |
| 204 | 195 |
| 205 // Un-highlighted networks | 196 // Un-highlighted networks |
| 206 needs_relayout |= UpdateNetworkChildren(new_service_paths, &index, | 197 needs_relayout |= UpdateNetworkChildren(new_service_paths, &index, |
| 207 false /* not highlighted */); | 198 false /* not highlighted */); |
| 208 | 199 |
| 209 // No networks or other messages (fallback) | 200 // No networks or other messages (fallback) |
| 210 if (index == 0) { | 201 if (index == 0) { |
| 211 needs_relayout |= UpdateInfoLabel(IDS_ASH_STATUS_TRAY_NO_NETWORKS, index, | 202 needs_relayout |= UpdateInfoLabel(IDS_ASH_STATUS_TRAY_NO_NETWORKS, index, |
| 212 &scanning_view_); | 203 &no_wifi_networks_view_); |
| 213 } | 204 } |
| 214 | 205 |
| 215 return needs_relayout; | 206 return needs_relayout; |
| 216 } | 207 } |
| 217 | 208 |
| 218 bool NetworkListView::UpdateNetworkChildren( | 209 bool NetworkListView::UpdateNetworkChildren( |
| 219 std::set<std::string>* new_service_paths, | 210 std::set<std::string>* new_service_paths, |
| 220 int* child_index, | 211 int* child_index, |
| 221 bool highlighted) { | 212 bool highlighted) { |
| 222 bool needs_relayout = false; | 213 bool needs_relayout = false; |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 needs_relayout = true; | 277 needs_relayout = true; |
| 287 } | 278 } |
| 288 return needs_relayout; | 279 return needs_relayout; |
| 289 } | 280 } |
| 290 | 281 |
| 291 void NetworkListView::NetworkIconChanged() { | 282 void NetworkListView::NetworkIconChanged() { |
| 292 Update(); | 283 Update(); |
| 293 } | 284 } |
| 294 | 285 |
| 295 } // namespace ui | 286 } // namespace ui |
| OLD | NEW |