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

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

Issue 2828893002: [Ash] Remove |highlight| field from NetworkInfo struct (Closed)
Patch Set: Created 3 years, 8 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/system/network/network_info.cc ('k') | no next file » | 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 #include "ash/system/network/network_list.h" 5 #include "ash/system/network/network_list.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "ash/strings/grit/ash_strings.h" 9 #include "ash/strings/grit/ash_strings.h"
10 #include "ash/system/network/network_icon.h" 10 #include "ash/system/network/network_icon.h"
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 const int order1 = 364 const int order1 =
365 GetOrder(handler_->GetNetworkStateFromGuid(network1->guid)); 365 GetOrder(handler_->GetNetworkStateFromGuid(network1->guid));
366 const int order2 = 366 const int order2 =
367 GetOrder(handler_->GetNetworkStateFromGuid(network2->guid)); 367 GetOrder(handler_->GetNetworkStateFromGuid(network2->guid));
368 if (order1 != order2) 368 if (order1 != order2)
369 return order1 < order2; 369 return order1 < order2;
370 if (network1->connected != network2->connected) 370 if (network1->connected != network2->connected)
371 return network1->connected; 371 return network1->connected;
372 if (network1->connecting != network2->connecting) 372 if (network1->connecting != network2->connecting)
373 return network1->connecting; 373 return network1->connecting;
374 if (network1->highlight != network2->highlight)
tdanderson 2017/04/19 20:45:59 note: this is not just lazily deleting code; based
375 return network1->highlight;
376 return network1->guid.compare(network2->guid) < 0; 374 return network1->guid.compare(network2->guid) < 0;
377 } 375 }
378 376
379 private: 377 private:
380 static int GetOrder(const chromeos::NetworkState* network) { 378 static int GetOrder(const chromeos::NetworkState* network) {
381 if (!network) 379 if (!network)
382 return 999; 380 return 999;
383 if (network->Matches(NetworkTypePattern::Ethernet())) 381 if (network->Matches(NetworkTypePattern::Ethernet()))
384 return 0; 382 return 0;
385 if (network->Matches(NetworkTypePattern::Cellular())) 383 if (network->Matches(NetworkTypePattern::Cellular()))
(...skipping 26 matching lines...) Expand all
412 bool prohibited_by_policy = IsProhibitedByPolicy(network); 410 bool prohibited_by_policy = IsProhibitedByPolicy(network);
413 info->label = network_icon::GetLabelForNetwork( 411 info->label = network_icon::GetLabelForNetwork(
414 network, network_icon::ICON_TYPE_MENU_LIST); 412 network, network_icon::ICON_TYPE_MENU_LIST);
415 info->image = 413 info->image =
416 network_icon::GetImageForNetwork(network, network_icon::ICON_TYPE_LIST); 414 network_icon::GetImageForNetwork(network, network_icon::ICON_TYPE_LIST);
417 info->disable = 415 info->disable =
418 (network->activation_state() == shill::kActivationStateActivating) || 416 (network->activation_state() == shill::kActivationStateActivating) ||
419 prohibited_by_policy; 417 prohibited_by_policy;
420 info->connected = network->IsConnectedState(); 418 info->connected = network->IsConnectedState();
421 info->connecting = network->IsConnectingState(); 419 info->connecting = network->IsConnectingState();
422 info->highlight = info->connected || info->connecting;
423 if (network->Matches(NetworkTypePattern::WiFi())) 420 if (network->Matches(NetworkTypePattern::WiFi()))
424 info->type = NetworkInfo::Type::WIFI; 421 info->type = NetworkInfo::Type::WIFI;
425 else if (network->Matches(NetworkTypePattern::Cellular())) 422 else if (network->Matches(NetworkTypePattern::Cellular()))
426 info->type = NetworkInfo::Type::CELLULAR; 423 info->type = NetworkInfo::Type::CELLULAR;
427 else if (network->Matches(NetworkTypePattern::Tether())) 424 else if (network->Matches(NetworkTypePattern::Tether()))
428 info->type = NetworkInfo::Type::TETHER; 425 info->type = NetworkInfo::Type::TETHER;
429 if (prohibited_by_policy) { 426 if (prohibited_by_policy) {
430 info->tooltip = 427 info->tooltip =
431 l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_NETWORK_PROHIBITED); 428 l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_NETWORK_PROHIBITED);
432 } 429 }
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
674 if (found == last_network_info_map_.end()) { 671 if (found == last_network_info_map_.end()) {
675 // If we cannot find |info| in |last_network_info_map_|, just return true 672 // If we cannot find |info| in |last_network_info_map_|, just return true
676 // since this is a new network so we have nothing to compare. 673 // since this is a new network so we have nothing to compare.
677 return true; 674 return true;
678 } else { 675 } else {
679 return *found->second != info; 676 return *found->second != info;
680 } 677 }
681 } 678 }
682 679
683 } // namespace ash 680 } // namespace ash
OLDNEW
« no previous file with comments | « ash/system/network/network_info.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698