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

Side by Side Diff: chrome/browser/ui/webui/options/chromeos/internet_options_handler.cc

Issue 23712002: Cleanup network type matching. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/browser/ui/webui/options/chromeos/internet_options_handler.h" 5 #include "chrome/browser/ui/webui/options/chromeos/internet_options_handler.h"
6 6
7 #include <ctype.h> 7 #include <ctype.h>
8 8
9 #include <map> 9 #include <map>
10 #include <string> 10 #include <string>
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 : service_path_(network->path()), 431 : service_path_(network->path()),
432 name_(network->name()), 432 name_(network->name()),
433 connecting_(network->IsConnectingState()), 433 connecting_(network->IsConnectingState()),
434 connected_(network->IsConnectedState()), 434 connected_(network->IsConnectedState()),
435 connectable_(network->connectable()), 435 connectable_(network->connectable()),
436 connection_type_(network->type()), 436 connection_type_(network->type()),
437 remembered_(false), 437 remembered_(false),
438 shared_(false), 438 shared_(false),
439 activation_state_(network->activation_state()), 439 activation_state_(network->activation_state()),
440 policy_managed_(network->IsManaged()) { 440 policy_managed_(network->IsManaged()) {
441 if (network->type() == flimflam::kTypeEthernet) 441 if (network->IsTypeEthernet())
442 name_ = l10n_util::GetStringUTF8(IDS_STATUSBAR_NETWORK_DEVICE_ETHERNET); 442 name_ = l10n_util::GetStringUTF8(IDS_STATUSBAR_NETWORK_DEVICE_ETHERNET);
443 gfx::ImageSkia icon = ash::network_icon::GetImageForNetwork( 443 gfx::ImageSkia icon = ash::network_icon::GetImageForNetwork(
444 network, ash::network_icon::ICON_TYPE_LIST); 444 network, ash::network_icon::ICON_TYPE_LIST);
445 SetIcon(icon, icon_scale_factor); 445 SetIcon(icon, icon_scale_factor);
446 } 446 }
447 447
448 NetworkInfoDictionary::NetworkInfoDictionary(const FavoriteState* favorite, 448 NetworkInfoDictionary::NetworkInfoDictionary(const FavoriteState* favorite,
449 ui::ScaleFactor icon_scale_factor) 449 ui::ScaleFactor icon_scale_factor)
450 : service_path_(favorite->path()), 450 : service_path_(favorite->path()),
451 name_(favorite->name()), 451 name_(favorite->name()),
452 connecting_(false), 452 connecting_(false),
453 connected_(false), 453 connected_(false),
454 connectable_(false), 454 connectable_(false),
455 connection_type_(favorite->type()), 455 connection_type_(favorite->type()),
456 remembered_(true), 456 remembered_(true),
457 shared_(!favorite->IsPrivate()), 457 shared_(!favorite->IsPrivate()),
458 policy_managed_(favorite->IsManaged()) { 458 policy_managed_(favorite->IsManaged()) {
459 if (favorite->type() == flimflam::kTypeEthernet) 459 if (favorite->IsTypeEthernet())
460 name_ = l10n_util::GetStringUTF8(IDS_STATUSBAR_NETWORK_DEVICE_ETHERNET); 460 name_ = l10n_util::GetStringUTF8(IDS_STATUSBAR_NETWORK_DEVICE_ETHERNET);
461 gfx::ImageSkia icon = ash::network_icon::GetImageForDisconnectedNetwork( 461 gfx::ImageSkia icon = ash::network_icon::GetImageForDisconnectedNetwork(
462 ash::network_icon::ICON_TYPE_LIST, favorite->type()); 462 ash::network_icon::ICON_TYPE_LIST, favorite->type());
463 SetIcon(icon, icon_scale_factor); 463 SetIcon(icon, icon_scale_factor);
464 } 464 }
465 465
466 base::DictionaryValue* NetworkInfoDictionary::BuildDictionary() { 466 base::DictionaryValue* NetworkInfoDictionary::BuildDictionary() {
467 std::string status; 467 std::string status;
468 if (remembered_) { 468 if (remembered_) {
469 if (shared_) 469 if (shared_)
(...skipping 1058 matching lines...) Expand 10 before | Expand all | Expand 10 after
1528 std::string type = network->type(); 1528 std::string type = network->type();
1529 dictionary.SetString(kTagType, type); 1529 dictionary.SetString(kTagType, type);
1530 dictionary.SetString(kTagServicePath, network->path()); 1530 dictionary.SetString(kTagServicePath, network->path());
1531 dictionary.SetString(kTagNameServerType, name_server_type); 1531 dictionary.SetString(kTagNameServerType, name_server_type);
1532 dictionary.SetString(kTagNameServersGoogle, kGoogleNameServers); 1532 dictionary.SetString(kTagNameServersGoogle, kGoogleNameServers);
1533 1533
1534 // Only show proxy for remembered networks. 1534 // Only show proxy for remembered networks.
1535 dictionary.SetBoolean(kTagShowProxy, !network->profile_path().empty()); 1535 dictionary.SetBoolean(kTagShowProxy, !network->profile_path().empty());
1536 1536
1537 // Enable static ip config for ethernet. For wifi, enable if flag is set. 1537 // Enable static ip config for ethernet. For wifi, enable if flag is set.
1538 bool staticIPConfig = type == flimflam::kTypeEthernet || 1538 bool staticIPConfig = network->IsTypeEthernet() ||
1539 (type == flimflam::kTypeWifi && 1539 (type == flimflam::kTypeWifi &&
1540 CommandLine::ForCurrentProcess()->HasSwitch( 1540 CommandLine::ForCurrentProcess()->HasSwitch(
1541 chromeos::switches::kEnableStaticIPConfig)); 1541 chromeos::switches::kEnableStaticIPConfig));
1542 dictionary.SetBoolean(kTagShowStaticIPConfig, staticIPConfig); 1542 dictionary.SetBoolean(kTagShowStaticIPConfig, staticIPConfig);
1543 1543
1544 dictionary.SetBoolean(kTagShowPreferred, !network->profile_path().empty()); 1544 dictionary.SetBoolean(kTagShowPreferred, !network->profile_path().empty());
1545 bool preferred = network->priority() > 0; 1545 bool preferred = network->priority() > 0;
1546 SetValueDictionary(&dictionary, kTagPreferred, 1546 SetValueDictionary(&dictionary, kTagPreferred,
1547 new base::FundamentalValue(preferred), 1547 new base::FundamentalValue(preferred),
1548 property_ui_data); 1548 property_ui_data);
1549 1549
1550 NetworkPropertyUIData auto_connect_ui_data(onc_source); 1550 NetworkPropertyUIData auto_connect_ui_data(onc_source);
1551 std::string onc_path_to_auto_connect; 1551 std::string onc_path_to_auto_connect;
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after
2011 cellular && cellular->support_network_scan()); 2011 cellular && cellular->support_network_scan());
2012 2012
2013 dictionary->SetBoolean(kTagWimaxAvailable, 2013 dictionary->SetBoolean(kTagWimaxAvailable,
2014 handler->IsTechnologyAvailable(flimflam::kTypeWimax)); 2014 handler->IsTechnologyAvailable(flimflam::kTypeWimax));
2015 dictionary->SetBoolean(kTagWimaxEnabled, 2015 dictionary->SetBoolean(kTagWimaxEnabled,
2016 handler->IsTechnologyEnabled(flimflam::kTypeWimax)); 2016 handler->IsTechnologyEnabled(flimflam::kTypeWimax));
2017 } 2017 }
2018 2018
2019 } // namespace options 2019 } // namespace options
2020 } // namespace chromeos 2020 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698