| OLD | NEW |
| 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 Loading... |
| 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 1082 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1555 dictionary->SetString(kTagServiceName, network->name()); | 1555 dictionary->SetString(kTagServiceName, network->name()); |
| 1556 dictionary->SetBoolean(kTagConnecting, network->IsConnectingState()); | 1556 dictionary->SetBoolean(kTagConnecting, network->IsConnectingState()); |
| 1557 dictionary->SetBoolean(kTagConnected, network->IsConnectedState()); | 1557 dictionary->SetBoolean(kTagConnected, network->IsConnectedState()); |
| 1558 dictionary->SetString(kTagConnectionState, | 1558 dictionary->SetString(kTagConnectionState, |
| 1559 ConnectionStateString(network->connection_state())); | 1559 ConnectionStateString(network->connection_state())); |
| 1560 dictionary->SetString(kTagNetworkName, network->name()); | 1560 dictionary->SetString(kTagNetworkName, network->name()); |
| 1561 dictionary->SetString(kTagErrorState, | 1561 dictionary->SetString(kTagErrorState, |
| 1562 ash::network_connect::ErrorString(network->error())); | 1562 ash::network_connect::ErrorString(network->error())); |
| 1563 | 1563 |
| 1564 dictionary->SetBoolean(kTagRemembered, !network->profile_path().empty()); | 1564 dictionary->SetBoolean(kTagRemembered, !network->profile_path().empty()); |
| 1565 bool shared = network->IsShared(); | 1565 bool shared = !network->IsPrivate(); |
| 1566 dictionary->SetBoolean(kTagShared, shared); | 1566 dictionary->SetBoolean(kTagShared, shared); |
| 1567 | 1567 |
| 1568 const std::string& type = network->type(); | 1568 const std::string& type = network->type(); |
| 1569 const NetworkState* connected_network = | 1569 const NetworkState* connected_network = |
| 1570 NetworkHandler::Get()->network_state_handler()->ConnectedNetworkByType( | 1570 NetworkHandler::Get()->network_state_handler()->ConnectedNetworkByType( |
| 1571 type); | 1571 type); |
| 1572 | 1572 |
| 1573 dictionary->SetBoolean(kTagDeviceConnected, connected_network != NULL); | 1573 dictionary->SetBoolean(kTagDeviceConnected, connected_network != NULL); |
| 1574 | 1574 |
| 1575 if (type == flimflam::kTypeWifi) | 1575 if (type == flimflam::kTypeWifi) |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1626 kTagLanguage, dictionary); | 1626 kTagLanguage, dictionary); |
| 1627 } | 1627 } |
| 1628 | 1628 |
| 1629 void PopulateCellularDetails(const NetworkState* cellular, | 1629 void PopulateCellularDetails(const NetworkState* cellular, |
| 1630 const base::DictionaryValue& shill_properties, | 1630 const base::DictionaryValue& shill_properties, |
| 1631 base::DictionaryValue* dictionary) { | 1631 base::DictionaryValue* dictionary) { |
| 1632 dictionary->SetBoolean(kTagCarrierSelectFlag, | 1632 dictionary->SetBoolean(kTagCarrierSelectFlag, |
| 1633 CommandLine::ForCurrentProcess()->HasSwitch( | 1633 CommandLine::ForCurrentProcess()->HasSwitch( |
| 1634 chromeos::switches::kEnableCarrierSwitching)); | 1634 chromeos::switches::kEnableCarrierSwitching)); |
| 1635 // Cellular network / connection settings. | 1635 // Cellular network / connection settings. |
| 1636 dictionary->SetString(kTagNetworkTechnology, cellular->technology()); | 1636 dictionary->SetString(kTagNetworkTechnology, cellular->network_technology()); |
| 1637 dictionary->SetString(kTagActivationState, | 1637 dictionary->SetString(kTagActivationState, |
| 1638 ActivationStateString(cellular->activation_state())); | 1638 ActivationStateString(cellular->activation_state())); |
| 1639 dictionary->SetString(kTagRoamingState, | 1639 dictionary->SetString(kTagRoamingState, |
| 1640 RoamingStateString(cellular->roaming())); | 1640 RoamingStateString(cellular->roaming())); |
| 1641 bool restricted = cellular->connection_state() == flimflam::kStatePortal; | 1641 bool restricted = cellular->connection_state() == flimflam::kStatePortal; |
| 1642 dictionary->SetString(kTagRestrictedPool, | 1642 dictionary->SetString(kTagRestrictedPool, |
| 1643 restricted ? | 1643 restricted ? |
| 1644 l10n_util::GetStringUTF8( | 1644 l10n_util::GetStringUTF8( |
| 1645 IDS_CONFIRM_MESSAGEBOX_YES_BUTTON_LABEL) : | 1645 IDS_CONFIRM_MESSAGEBOX_YES_BUTTON_LABEL) : |
| 1646 l10n_util::GetStringUTF8( | 1646 l10n_util::GetStringUTF8( |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1778 const MobileConfig::Carrier* carrier = | 1778 const MobileConfig::Carrier* carrier = |
| 1779 MobileConfig::GetInstance()->GetCarrier(carrier_id); | 1779 MobileConfig::GetInstance()->GetCarrier(carrier_id); |
| 1780 if (carrier && carrier->show_portal_button()) { | 1780 if (carrier && carrier->show_portal_button()) { |
| 1781 // The button should be shown for a LTE network even when the LTE network | 1781 // The button should be shown for a LTE network even when the LTE network |
| 1782 // is not connected, but CrOS is online. This is done to enable users to | 1782 // is not connected, but CrOS is online. This is done to enable users to |
| 1783 // update their plan even if they are out of credits. | 1783 // update their plan even if they are out of credits. |
| 1784 // The button should not be shown when the device's mdn is not set, | 1784 // The button should not be shown when the device's mdn is not set, |
| 1785 // because the network's proper portal url cannot be generated without it | 1785 // because the network's proper portal url cannot be generated without it |
| 1786 const NetworkState* default_network = | 1786 const NetworkState* default_network = |
| 1787 NetworkHandler::Get()->network_state_handler()->DefaultNetwork(); | 1787 NetworkHandler::Get()->network_state_handler()->DefaultNetwork(); |
| 1788 const std::string& technology = cellular->network_technology(); |
| 1788 bool force_show_view_account_button = | 1789 bool force_show_view_account_button = |
| 1789 (cellular->technology() == flimflam::kNetworkTechnologyLte || | 1790 (technology == flimflam::kNetworkTechnologyLte || |
| 1790 cellular->technology() == flimflam::kNetworkTechnologyLteAdvanced) && | 1791 technology == flimflam::kNetworkTechnologyLteAdvanced) && |
| 1791 default_network && | 1792 default_network && |
| 1792 !mdn.empty(); | 1793 !mdn.empty(); |
| 1793 | 1794 |
| 1794 // The button will trigger ShowMorePlanInfoCallback() which will open | 1795 // The button will trigger ShowMorePlanInfoCallback() which will open |
| 1795 // carrier specific portal. | 1796 // carrier specific portal. |
| 1796 if (cellular->IsConnectedState() || force_show_view_account_button) | 1797 if (cellular->IsConnectedState() || force_show_view_account_button) |
| 1797 dictionary->SetBoolean(kTagShowViewAccountButton, true); | 1798 dictionary->SetBoolean(kTagShowViewAccountButton, true); |
| 1798 } | 1799 } |
| 1799 } | 1800 } |
| 1800 } | 1801 } |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1966 cellular && cellular->support_network_scan()); | 1967 cellular && cellular->support_network_scan()); |
| 1967 | 1968 |
| 1968 dictionary->SetBoolean(kTagWimaxAvailable, | 1969 dictionary->SetBoolean(kTagWimaxAvailable, |
| 1969 handler->IsTechnologyAvailable(flimflam::kTypeWimax)); | 1970 handler->IsTechnologyAvailable(flimflam::kTypeWimax)); |
| 1970 dictionary->SetBoolean(kTagWimaxEnabled, | 1971 dictionary->SetBoolean(kTagWimaxEnabled, |
| 1971 handler->IsTechnologyEnabled(flimflam::kTypeWimax)); | 1972 handler->IsTechnologyEnabled(flimflam::kTypeWimax)); |
| 1972 } | 1973 } |
| 1973 | 1974 |
| 1974 } // namespace options | 1975 } // namespace options |
| 1975 } // namespace chromeos | 1976 } // namespace chromeos |
| OLD | NEW |