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

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

Issue 21030006: NetworkState cleanup, pass properties to InitialPropertiesReceived (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 years, 4 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 441 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 452
453 NetworkInfoDictionary::NetworkInfoDictionary(const FavoriteState* favorite, 453 NetworkInfoDictionary::NetworkInfoDictionary(const FavoriteState* favorite,
454 ui::ScaleFactor icon_scale_factor) 454 ui::ScaleFactor icon_scale_factor)
455 : service_path_(favorite->path()), 455 : service_path_(favorite->path()),
456 name_(favorite->name()), 456 name_(favorite->name()),
457 connecting_(false), 457 connecting_(false),
458 connected_(false), 458 connected_(false),
459 connectable_(false), 459 connectable_(false),
460 connection_type_(favorite->type()), 460 connection_type_(favorite->type()),
461 remembered_(true), 461 remembered_(true),
462 shared_(favorite->IsShared()), 462 shared_(!favorite->IsPrivate()),
463 policy_managed_(favorite->IsManaged()) { 463 policy_managed_(favorite->IsManaged()) {
464 if (favorite->type() == flimflam::kTypeEthernet) 464 if (favorite->type() == flimflam::kTypeEthernet)
465 name_ = l10n_util::GetStringUTF8(IDS_STATUSBAR_NETWORK_DEVICE_ETHERNET); 465 name_ = l10n_util::GetStringUTF8(IDS_STATUSBAR_NETWORK_DEVICE_ETHERNET);
466 gfx::ImageSkia icon = ash::network_icon::GetImageForDisconnectedNetwork( 466 gfx::ImageSkia icon = ash::network_icon::GetImageForDisconnectedNetwork(
467 ash::network_icon::ICON_TYPE_LIST, favorite->type()); 467 ash::network_icon::ICON_TYPE_LIST, favorite->type());
468 SetIcon(icon, icon_scale_factor); 468 SetIcon(icon, icon_scale_factor);
469 } 469 }
470 470
471 base::DictionaryValue* NetworkInfoDictionary::BuildDictionary() { 471 base::DictionaryValue* NetworkInfoDictionary::BuildDictionary() {
472 std::string status; 472 std::string status;
(...skipping 1073 matching lines...) Expand 10 before | Expand all | Expand 10 after
1546 dictionary->SetString(kTagServiceName, network->name()); 1546 dictionary->SetString(kTagServiceName, network->name());
1547 dictionary->SetBoolean(kTagConnecting, network->IsConnectingState()); 1547 dictionary->SetBoolean(kTagConnecting, network->IsConnectingState());
1548 dictionary->SetBoolean(kTagConnected, network->IsConnectedState()); 1548 dictionary->SetBoolean(kTagConnected, network->IsConnectedState());
1549 dictionary->SetString(kTagConnectionState, 1549 dictionary->SetString(kTagConnectionState,
1550 ConnectionStateString(network->connection_state())); 1550 ConnectionStateString(network->connection_state()));
1551 dictionary->SetString(kTagNetworkName, network->name()); 1551 dictionary->SetString(kTagNetworkName, network->name());
1552 dictionary->SetString(kTagErrorState, 1552 dictionary->SetString(kTagErrorState,
1553 ash::network_connect::ErrorString(network->error())); 1553 ash::network_connect::ErrorString(network->error()));
1554 1554
1555 dictionary->SetBoolean(kTagRemembered, !network->profile_path().empty()); 1555 dictionary->SetBoolean(kTagRemembered, !network->profile_path().empty());
1556 bool shared = network->IsShared(); 1556 bool shared = !network->IsPrivate();
1557 dictionary->SetBoolean(kTagShared, shared); 1557 dictionary->SetBoolean(kTagShared, shared);
1558 1558
1559 const std::string& type = network->type(); 1559 const std::string& type = network->type();
1560 const NetworkState* connected_network = 1560 const NetworkState* connected_network =
1561 NetworkHandler::Get()->network_state_handler()->ConnectedNetworkByType( 1561 NetworkHandler::Get()->network_state_handler()->ConnectedNetworkByType(
1562 type); 1562 type);
1563 1563
1564 dictionary->SetBoolean(kTagDeviceConnected, connected_network != NULL); 1564 dictionary->SetBoolean(kTagDeviceConnected, connected_network != NULL);
1565 1565
1566 if (type == flimflam::kTypeWifi) 1566 if (type == flimflam::kTypeWifi)
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
1619 return dictionary; 1619 return dictionary;
1620 } 1620 }
1621 1621
1622 void PopulateCellularDetails(const NetworkState* cellular, 1622 void PopulateCellularDetails(const NetworkState* cellular,
1623 const base::DictionaryValue& shill_properties, 1623 const base::DictionaryValue& shill_properties,
1624 base::DictionaryValue* dictionary) { 1624 base::DictionaryValue* dictionary) {
1625 dictionary->SetBoolean(kTagCarrierSelectFlag, 1625 dictionary->SetBoolean(kTagCarrierSelectFlag,
1626 CommandLine::ForCurrentProcess()->HasSwitch( 1626 CommandLine::ForCurrentProcess()->HasSwitch(
1627 chromeos::switches::kEnableCarrierSwitching)); 1627 chromeos::switches::kEnableCarrierSwitching));
1628 // Cellular network / connection settings. 1628 // Cellular network / connection settings.
1629 dictionary->SetString(kTagNetworkTechnology, cellular->technology()); 1629 dictionary->SetString(kTagNetworkTechnology, cellular->network_technology());
1630 dictionary->SetString(kTagActivationState, 1630 dictionary->SetString(kTagActivationState,
1631 ActivationStateString(cellular->activation_state())); 1631 ActivationStateString(cellular->activation_state()));
1632 dictionary->SetString(kTagRoamingState, 1632 dictionary->SetString(kTagRoamingState,
1633 RoamingStateString(cellular->roaming())); 1633 RoamingStateString(cellular->roaming()));
1634 bool restricted = cellular->connection_state() == flimflam::kStatePortal; 1634 bool restricted = cellular->connection_state() == flimflam::kStatePortal;
1635 dictionary->SetString(kTagRestrictedPool, 1635 dictionary->SetString(kTagRestrictedPool,
1636 restricted ? 1636 restricted ?
1637 l10n_util::GetStringUTF8( 1637 l10n_util::GetStringUTF8(
1638 IDS_CONFIRM_MESSAGEBOX_YES_BUTTON_LABEL) : 1638 IDS_CONFIRM_MESSAGEBOX_YES_BUTTON_LABEL) :
1639 l10n_util::GetStringUTF8( 1639 l10n_util::GetStringUTF8(
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
1766 const MobileConfig::Carrier* carrier = 1766 const MobileConfig::Carrier* carrier =
1767 MobileConfig::GetInstance()->GetCarrier(carrier_id); 1767 MobileConfig::GetInstance()->GetCarrier(carrier_id);
1768 if (carrier && carrier->show_portal_button()) { 1768 if (carrier && carrier->show_portal_button()) {
1769 // The button should be shown for a LTE network even when the LTE network 1769 // The button should be shown for a LTE network even when the LTE network
1770 // is not connected, but CrOS is online. This is done to enable users to 1770 // is not connected, but CrOS is online. This is done to enable users to
1771 // update their plan even if they are out of credits. 1771 // update their plan even if they are out of credits.
1772 // The button should not be shown when the device's mdn is not set, 1772 // The button should not be shown when the device's mdn is not set,
1773 // because the network's proper portal url cannot be generated without it 1773 // because the network's proper portal url cannot be generated without it
1774 const NetworkState* default_network = 1774 const NetworkState* default_network =
1775 NetworkHandler::Get()->network_state_handler()->DefaultNetwork(); 1775 NetworkHandler::Get()->network_state_handler()->DefaultNetwork();
1776 const std::string& technology = cellular->network_technology();
1776 bool force_show_view_account_button = 1777 bool force_show_view_account_button =
1777 (cellular->technology() == flimflam::kNetworkTechnologyLte || 1778 (technology == flimflam::kNetworkTechnologyLte ||
1778 cellular->technology() == flimflam::kNetworkTechnologyLteAdvanced) && 1779 technology == flimflam::kNetworkTechnologyLteAdvanced) &&
1779 default_network && 1780 default_network &&
1780 !mdn.empty(); 1781 !mdn.empty();
1781 1782
1782 // The button will trigger ShowMorePlanInfoCallback() which will open 1783 // The button will trigger ShowMorePlanInfoCallback() which will open
1783 // carrier specific portal. 1784 // carrier specific portal.
1784 if (cellular->IsConnectedState() || force_show_view_account_button) 1785 if (cellular->IsConnectedState() || force_show_view_account_button)
1785 dictionary->SetBoolean(kTagShowViewAccountButton, true); 1786 dictionary->SetBoolean(kTagShowViewAccountButton, true);
1786 } 1787 }
1787 } 1788 }
1788 } 1789 }
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
1954 cellular && cellular->support_network_scan()); 1955 cellular && cellular->support_network_scan());
1955 1956
1956 dictionary->SetBoolean(kTagWimaxAvailable, 1957 dictionary->SetBoolean(kTagWimaxAvailable,
1957 handler->IsTechnologyAvailable(flimflam::kTypeWimax)); 1958 handler->IsTechnologyAvailable(flimflam::kTypeWimax));
1958 dictionary->SetBoolean(kTagWimaxEnabled, 1959 dictionary->SetBoolean(kTagWimaxEnabled,
1959 handler->IsTechnologyEnabled(flimflam::kTypeWimax)); 1960 handler->IsTechnologyEnabled(flimflam::kTypeWimax));
1960 } 1961 }
1961 1962
1962 } // namespace options 1963 } // namespace options
1963 } // namespace chromeos 1964 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698