| 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 10 matching lines...) Expand all Loading... |
| 21 #include "chrome/browser/chromeos/mobile_config.h" | 21 #include "chrome/browser/chromeos/mobile_config.h" |
| 22 #include "chrome/browser/chromeos/net/onc_utils.h" | 22 #include "chrome/browser/chromeos/net/onc_utils.h" |
| 23 #include "chrome/browser/chromeos/options/network_config_view.h" | 23 #include "chrome/browser/chromeos/options/network_config_view.h" |
| 24 #include "chrome/browser/chromeos/options/network_property_ui_data.h" | 24 #include "chrome/browser/chromeos/options/network_property_ui_data.h" |
| 25 #include "chrome/browser/chromeos/settings/cros_settings.h" | 25 #include "chrome/browser/chromeos/settings/cros_settings.h" |
| 26 #include "chrome/browser/chromeos/sim_dialog_delegate.h" | 26 #include "chrome/browser/chromeos/sim_dialog_delegate.h" |
| 27 #include "chrome/browser/chromeos/ui/choose_mobile_network_dialog.h" | 27 #include "chrome/browser/chromeos/ui/choose_mobile_network_dialog.h" |
| 28 #include "chrome/browser/chromeos/ui/mobile_config_ui.h" | 28 #include "chrome/browser/chromeos/ui/mobile_config_ui.h" |
| 29 #include "chrome/browser/chromeos/ui_proxy_config_service.h" | 29 #include "chrome/browser/chromeos/ui_proxy_config_service.h" |
| 30 #include "chrome/browser/profiles/profile.h" | 30 #include "chrome/browser/profiles/profile.h" |
| 31 #include "chrome/browser/ui/webui/chromeos/mobile_setup_dialog.h" |
| 31 #include "chrome/browser/ui/webui/options/chromeos/internet_options_handler_stri
ngs.h" | 32 #include "chrome/browser/ui/webui/options/chromeos/internet_options_handler_stri
ngs.h" |
| 32 #include "chromeos/chromeos_switches.h" | 33 #include "chromeos/chromeos_switches.h" |
| 33 #include "chromeos/network/device_state.h" | 34 #include "chromeos/network/device_state.h" |
| 34 #include "chromeos/network/managed_network_configuration_handler.h" | 35 #include "chromeos/network/managed_network_configuration_handler.h" |
| 35 #include "chromeos/network/network_configuration_handler.h" | 36 #include "chromeos/network/network_configuration_handler.h" |
| 36 #include "chromeos/network/network_connection_handler.h" | 37 #include "chromeos/network/network_connection_handler.h" |
| 37 #include "chromeos/network/network_device_handler.h" | 38 #include "chromeos/network/network_device_handler.h" |
| 38 #include "chromeos/network/network_event_log.h" | 39 #include "chromeos/network/network_event_log.h" |
| 39 #include "chromeos/network/network_ip_config.h" | 40 #include "chromeos/network/network_ip_config.h" |
| 40 #include "chromeos/network/network_profile.h" | 41 #include "chromeos/network/network_profile.h" |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 const char kSetIPConfigMessage[] = "setIPConfig"; | 125 const char kSetIPConfigMessage[] = "setIPConfig"; |
| 125 const char kSetPreferNetworkMessage[] = "setPreferNetwork"; | 126 const char kSetPreferNetworkMessage[] = "setPreferNetwork"; |
| 126 const char kSetServerHostname[] = "setServerHostname"; | 127 const char kSetServerHostname[] = "setServerHostname"; |
| 127 const char kSetSimCardLockMessage[] = "setSimCardLock"; | 128 const char kSetSimCardLockMessage[] = "setSimCardLock"; |
| 128 const char kShowMorePlanInfoMessage[] = "showMorePlanInfo"; | 129 const char kShowMorePlanInfoMessage[] = "showMorePlanInfo"; |
| 129 | 130 |
| 130 // These are strings used to communicate with JavaScript. | 131 // These are strings used to communicate with JavaScript. |
| 131 const char kTagActivate[] = "activate"; | 132 const char kTagActivate[] = "activate"; |
| 132 const char kTagActivationState[] = "activationState"; | 133 const char kTagActivationState[] = "activationState"; |
| 133 const char kTagAddConnection[] = "add"; | 134 const char kTagAddConnection[] = "add"; |
| 134 const char kTagApn[] = "apn"; | |
| 135 const char kTagCarrierSelectFlag[] = "showCarrierSelect"; | 135 const char kTagCarrierSelectFlag[] = "showCarrierSelect"; |
| 136 const char kTagCarrierUrl[] = "carrierUrl"; | 136 const char kTagCarrierUrl[] = "carrierUrl"; |
| 137 const char kTagCellularAvailable[] = "cellularAvailable"; | 137 const char kTagCellularAvailable[] = "cellularAvailable"; |
| 138 const char kTagCellularEnabled[] = "cellularEnabled"; | 138 const char kTagCellularEnabled[] = "cellularEnabled"; |
| 139 const char kTagCellularSupportsScan[] = "cellularSupportsScan"; | 139 const char kTagCellularSupportsScan[] = "cellularSupportsScan"; |
| 140 const char kTagConfigure[] = "configure"; | 140 const char kTagConfigure[] = "configure"; |
| 141 const char kTagConnect[] = "connect"; | 141 const char kTagConnect[] = "connect"; |
| 142 const char kTagControlledBy[] = "controlledBy"; | 142 const char kTagControlledBy[] = "controlledBy"; |
| 143 const char kTagDeviceConnected[] = "deviceConnected"; | 143 const char kTagDeviceConnected[] = "deviceConnected"; |
| 144 const char kTagDisconnect[] = "disconnect"; | 144 const char kTagDisconnect[] = "disconnect"; |
| 145 const char kTagErrorMessage[] = "errorMessage"; | 145 const char kTagErrorMessage[] = "errorMessage"; |
| 146 const char kTagForget[] = "forget"; | 146 const char kTagForget[] = "forget"; |
| 147 const char kTagLanguage[] = "language"; | |
| 148 const char kTagLastGoodApn[] = "lastGoodApn"; | |
| 149 const char kTagLocalizedName[] = "localizedName"; | |
| 150 const char kTagName[] = "name"; | |
| 151 const char kTagNameServersGoogle[] = "nameServersGoogle"; | 147 const char kTagNameServersGoogle[] = "nameServersGoogle"; |
| 152 const char kTagNameServerType[] = "nameServerType"; | 148 const char kTagNameServerType[] = "nameServerType"; |
| 153 const char kTagNetworkId[] = "networkId"; | |
| 154 const char kTagOptions[] = "options"; | 149 const char kTagOptions[] = "options"; |
| 155 const char kTagPassword[] = "password"; | |
| 156 const char kTagPolicy[] = "policy"; | 150 const char kTagPolicy[] = "policy"; |
| 157 const char kTagProviderApnList[] = "providerApnList"; | |
| 158 const char kTagRecommended[] = "recommended"; | 151 const char kTagRecommended[] = "recommended"; |
| 159 const char kTagRecommendedValue[] = "recommendedValue"; | 152 const char kTagRecommendedValue[] = "recommendedValue"; |
| 160 const char kTagRemembered[] = "remembered"; | 153 const char kTagRemembered[] = "remembered"; |
| 161 const char kTagRememberedList[] = "rememberedList"; | 154 const char kTagRememberedList[] = "rememberedList"; |
| 162 const char kTagRestrictedPool[] = "restrictedPool"; | 155 const char kTagRestrictedPool[] = "restrictedPool"; |
| 163 const char kTagRoamingState[] = "roamingState"; | 156 const char kTagRoamingState[] = "roamingState"; |
| 164 const char kTagCarriers[] = "carriers"; | 157 const char kTagCarriers[] = "carriers"; |
| 165 const char kTagCurrentCarrierIndex[] = "currentCarrierIndex"; | 158 const char kTagCurrentCarrierIndex[] = "currentCarrierIndex"; |
| 166 const char kTagShared[] = "shared"; | 159 const char kTagShared[] = "shared"; |
| 167 const char kTagShowActivateButton[] = "showActivateButton"; | 160 const char kTagShowActivateButton[] = "showActivateButton"; |
| 168 const char kTagShowViewAccountButton[] = "showViewAccountButton"; | 161 const char kTagShowViewAccountButton[] = "showViewAccountButton"; |
| 169 const char kTagSimCardLockEnabled[] = "simCardLockEnabled"; | |
| 170 const char kTagSupportUrl[] = "supportUrl"; | |
| 171 const char kTagTrue[] = "true"; | 162 const char kTagTrue[] = "true"; |
| 172 const char kTagUsername[] = "username"; | |
| 173 const char kTagValue[] = "value"; | 163 const char kTagValue[] = "value"; |
| 174 const char kTagVpnList[] = "vpnList"; | 164 const char kTagVpnList[] = "vpnList"; |
| 175 const char kTagWifiAvailable[] = "wifiAvailable"; | 165 const char kTagWifiAvailable[] = "wifiAvailable"; |
| 176 const char kTagWifiEnabled[] = "wifiEnabled"; | 166 const char kTagWifiEnabled[] = "wifiEnabled"; |
| 177 const char kTagWimaxAvailable[] = "wimaxAvailable"; | 167 const char kTagWimaxAvailable[] = "wimaxAvailable"; |
| 178 const char kTagWimaxEnabled[] = "wimaxEnabled"; | 168 const char kTagWimaxEnabled[] = "wimaxEnabled"; |
| 179 const char kTagWiredList[] = "wiredList"; | 169 const char kTagWiredList[] = "wiredList"; |
| 180 const char kTagWirelessList[] = "wirelessList"; | 170 const char kTagWirelessList[] = "wirelessList"; |
| 181 | 171 |
| 182 const int kPreferredPriority = 1; | 172 const int kPreferredPriority = 1; |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 407 void SetTranslatedDictionary(const char* settings_dict_key, | 397 void SetTranslatedDictionary(const char* settings_dict_key, |
| 408 const std::string& value, | 398 const std::string& value, |
| 409 const std::string& translated_value, | 399 const std::string& translated_value, |
| 410 base::DictionaryValue* settings_dict) { | 400 base::DictionaryValue* settings_dict) { |
| 411 base::DictionaryValue* dict = new base::DictionaryValue(); | 401 base::DictionaryValue* dict = new base::DictionaryValue(); |
| 412 settings_dict->Set(settings_dict_key, dict); | 402 settings_dict->Set(settings_dict_key, dict); |
| 413 dict->SetString(::onc::kAugmentationActiveSetting, value); | 403 dict->SetString(::onc::kAugmentationActiveSetting, value); |
| 414 dict->SetString(kTranslatedKey, translated_value); | 404 dict->SetString(kTranslatedKey, translated_value); |
| 415 } | 405 } |
| 416 | 406 |
| 417 std::string CopyStringFromDictionary(const base::DictionaryValue& source, | |
| 418 const std::string& src_key, | |
| 419 const std::string& dest_key, | |
| 420 base::DictionaryValue* dest) { | |
| 421 std::string string_value; | |
| 422 if (source.GetStringWithoutPathExpansion(src_key, &string_value)) | |
| 423 dest->SetStringWithoutPathExpansion(dest_key, string_value); | |
| 424 return string_value; | |
| 425 } | |
| 426 | |
| 427 // Fills |dictionary| with the configuration details of |vpn|. |onc| is required | 407 // Fills |dictionary| with the configuration details of |vpn|. |onc| is required |
| 428 // for augmenting the policy-managed information. | 408 // for augmenting the policy-managed information. |
| 429 void PopulateVPNDetails(const NetworkState* vpn, | 409 void PopulateVPNDetails(const NetworkState* vpn, |
| 430 const base::DictionaryValue& shill_properties, | 410 const base::DictionaryValue& shill_properties, |
| 431 base::DictionaryValue* dictionary) { | 411 base::DictionaryValue* dictionary) { |
| 432 // Name and Remembered are set in PopulateConnectionDetails(). | 412 // Name and Remembered are set in PopulateConnectionDetails(). |
| 433 // Provider properties are stored in the "Provider" dictionary. | 413 // Provider properties are stored in the "Provider" dictionary. |
| 434 const base::DictionaryValue* shill_provider_properties = NULL; | 414 const base::DictionaryValue* shill_provider_properties = NULL; |
| 435 if (!shill_properties.GetDictionaryWithoutPathExpansion( | 415 if (!shill_properties.GetDictionaryWithoutPathExpansion( |
| 436 shill::kProviderProperty, &shill_provider_properties)) { | 416 shill::kProviderProperty, &shill_provider_properties)) { |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 499 // the Generic UMTS carrier option if present. | 479 // the Generic UMTS carrier option if present. |
| 500 if (gsm && (value == shill::kCarrierGenericUMTS)) | 480 if (gsm && (value == shill::kCarrierGenericUMTS)) |
| 501 return index; | 481 return index; |
| 502 // For other carriers, the service name will match the carrier name. | 482 // For other carriers, the service name will match the carrier name. |
| 503 if (value == device->carrier()) | 483 if (value == device->carrier()) |
| 504 return index; | 484 return index; |
| 505 } | 485 } |
| 506 return -1; | 486 return -1; |
| 507 } | 487 } |
| 508 | 488 |
| 509 void CreateDictionaryFromCellularApn(const base::DictionaryValue* apn, | |
| 510 base::DictionaryValue* dictionary) { | |
| 511 CopyStringFromDictionary(*apn, shill::kApnProperty, kTagApn, dictionary); | |
| 512 CopyStringFromDictionary( | |
| 513 *apn, shill::kApnNetworkIdProperty, kTagNetworkId, dictionary); | |
| 514 CopyStringFromDictionary( | |
| 515 *apn, shill::kApnUsernameProperty, kTagUsername, dictionary); | |
| 516 CopyStringFromDictionary( | |
| 517 *apn, shill::kApnPasswordProperty, kTagPassword, dictionary); | |
| 518 CopyStringFromDictionary(*apn, shill::kApnNameProperty, kTagName, dictionary); | |
| 519 CopyStringFromDictionary( | |
| 520 *apn, shill::kApnLocalizedNameProperty, kTagLocalizedName, dictionary); | |
| 521 CopyStringFromDictionary( | |
| 522 *apn, shill::kApnLanguageProperty, kTagLanguage, dictionary); | |
| 523 } | |
| 524 | |
| 525 void PopulateCellularDetails(const NetworkState* cellular, | 489 void PopulateCellularDetails(const NetworkState* cellular, |
| 526 const base::DictionaryValue& shill_properties, | |
| 527 base::DictionaryValue* dictionary) { | 490 base::DictionaryValue* dictionary) { |
| 528 dictionary->SetBoolean(kTagCarrierSelectFlag, | 491 dictionary->SetBoolean(kTagCarrierSelectFlag, |
| 529 CommandLine::ForCurrentProcess()->HasSwitch( | 492 CommandLine::ForCurrentProcess()->HasSwitch( |
| 530 chromeos::switches::kEnableCarrierSwitching)); | 493 chromeos::switches::kEnableCarrierSwitching)); |
| 531 // Cellular network / connection settings. | 494 // Cellular network / connection settings. |
| 532 dictionary->SetString(kTagActivationState, | 495 dictionary->SetString(kTagActivationState, |
| 533 internet_options_strings::ActivationStateString( | 496 internet_options_strings::ActivationStateString( |
| 534 cellular->activation_state())); | 497 cellular->activation_state())); |
| 535 dictionary->SetString(kTagRoamingState, | 498 dictionary->SetString(kTagRoamingState, |
| 536 internet_options_strings::RoamingStateString( | 499 internet_options_strings::RoamingStateString( |
| 537 cellular->roaming())); | 500 cellular->roaming())); |
| 538 dictionary->SetString(kTagRestrictedPool, | 501 dictionary->SetString(kTagRestrictedPool, |
| 539 internet_options_strings::RestrictedStateString( | 502 internet_options_strings::RestrictedStateString( |
| 540 cellular->connection_state())); | 503 cellular->connection_state())); |
| 541 | 504 |
| 542 const base::DictionaryValue* olp = NULL; | |
| 543 if (shill_properties.GetDictionaryWithoutPathExpansion( | |
| 544 shill::kPaymentPortalProperty, &olp)) { | |
| 545 std::string url; | |
| 546 olp->GetStringWithoutPathExpansion(shill::kPaymentPortalURL, &url); | |
| 547 dictionary->SetString(kTagSupportUrl, url); | |
| 548 } | |
| 549 | |
| 550 base::DictionaryValue* apn = new base::DictionaryValue; | |
| 551 const base::DictionaryValue* source_apn = NULL; | |
| 552 if (shill_properties.GetDictionaryWithoutPathExpansion( | |
| 553 shill::kCellularApnProperty, &source_apn)) { | |
| 554 CreateDictionaryFromCellularApn(source_apn, apn); | |
| 555 } | |
| 556 dictionary->Set(kTagApn, apn); | |
| 557 | |
| 558 base::DictionaryValue* last_good_apn = new base::DictionaryValue; | |
| 559 if (shill_properties.GetDictionaryWithoutPathExpansion( | |
| 560 shill::kCellularLastGoodApnProperty, &source_apn)) { | |
| 561 CreateDictionaryFromCellularApn(source_apn, last_good_apn); | |
| 562 } | |
| 563 dictionary->Set(kTagLastGoodApn, last_good_apn); | |
| 564 | |
| 565 // These default to empty and are only set if device != NULL. | 505 // These default to empty and are only set if device != NULL. |
| 566 std::string carrier_id; | 506 std::string carrier_id; |
| 567 std::string mdn; | 507 std::string mdn; |
| 568 | 508 |
| 569 // Device settings. | 509 // Device settings. |
| 570 const DeviceState* device = | 510 const DeviceState* device = |
| 571 NetworkHandler::Get()->network_state_handler()->GetDeviceState( | 511 NetworkHandler::Get()->network_state_handler()->GetDeviceState( |
| 572 cellular->device_path()); | 512 cellular->device_path()); |
| 573 if (device) { | 513 if (device) { |
| 574 const base::DictionaryValue& device_properties = device->properties(); | 514 const base::DictionaryValue& device_properties = device->properties(); |
| 575 ::onc::ONCSource onc_source; | |
| 576 NetworkHandler::Get()->managed_network_configuration_handler()-> | |
| 577 FindPolicyByGUID(LoginState::Get()->primary_user_hash(), | |
| 578 cellular->guid(), &onc_source); | |
| 579 const NetworkPropertyUIData cellular_property_ui_data(onc_source); | |
| 580 SetValueDictionary(kTagSimCardLockEnabled, | |
| 581 new base::FundamentalValue(device->sim_lock_enabled()), | |
| 582 cellular_property_ui_data, | |
| 583 dictionary); | |
| 584 | 515 |
| 585 carrier_id = device->home_provider_id(); | 516 carrier_id = device->home_provider_id(); |
| 586 device_properties.GetStringWithoutPathExpansion(shill::kMdnProperty, &mdn); | 517 device_properties.GetStringWithoutPathExpansion(shill::kMdnProperty, &mdn); |
| 587 | 518 |
| 588 MobileConfig* config = MobileConfig::GetInstance(); | 519 MobileConfig* config = MobileConfig::GetInstance(); |
| 589 if (config->IsReady()) { | 520 if (config->IsReady()) { |
| 590 const MobileConfig::Carrier* carrier = config->GetCarrier(carrier_id); | 521 const MobileConfig::Carrier* carrier = config->GetCarrier(carrier_id); |
| 591 if (carrier && !carrier->top_up_url().empty()) | 522 if (carrier && !carrier->top_up_url().empty()) |
| 592 dictionary->SetString(kTagCarrierUrl, carrier->top_up_url()); | 523 dictionary->SetString(kTagCarrierUrl, carrier->top_up_url()); |
| 593 } | 524 } |
| 594 | 525 |
| 595 base::ListValue* apn_list_value = new base::ListValue(); | |
| 596 const base::ListValue* apn_list; | |
| 597 if (device_properties.GetListWithoutPathExpansion( | |
| 598 shill::kCellularApnListProperty, &apn_list)) { | |
| 599 for (base::ListValue::const_iterator iter = apn_list->begin(); | |
| 600 iter != apn_list->end(); | |
| 601 ++iter) { | |
| 602 const base::DictionaryValue* dict; | |
| 603 if ((*iter)->GetAsDictionary(&dict)) { | |
| 604 base::DictionaryValue* apn = new base::DictionaryValue; | |
| 605 CreateDictionaryFromCellularApn(dict, apn); | |
| 606 apn_list_value->Append(apn); | |
| 607 } | |
| 608 } | |
| 609 } | |
| 610 SetValueDictionary(kTagProviderApnList, | |
| 611 apn_list_value, | |
| 612 cellular_property_ui_data, | |
| 613 dictionary); | |
| 614 const base::ListValue* supported_carriers; | 526 const base::ListValue* supported_carriers; |
| 615 if (device_properties.GetListWithoutPathExpansion( | 527 if (device_properties.GetListWithoutPathExpansion( |
| 616 shill::kSupportedCarriersProperty, &supported_carriers)) { | 528 shill::kSupportedCarriersProperty, &supported_carriers)) { |
| 617 dictionary->Set(kTagCarriers, supported_carriers->DeepCopy()); | 529 dictionary->Set(kTagCarriers, supported_carriers->DeepCopy()); |
| 618 dictionary->SetInteger( | 530 dictionary->SetInteger( |
| 619 kTagCurrentCarrierIndex, | 531 kTagCurrentCarrierIndex, |
| 620 FindCurrentCarrierIndex(supported_carriers, device)); | 532 FindCurrentCarrierIndex(supported_carriers, device)); |
| 621 } else { | 533 } else { |
| 622 // In case of any error, set the current carrier tag to -1 indicating | 534 // In case of any error, set the current carrier tag to -1 indicating |
| 623 // to the JS code to fallback to a single carrier. | 535 // to the JS code to fallback to a single carrier. |
| 624 dictionary->SetInteger(kTagCurrentCarrierIndex, -1); | 536 dictionary->SetInteger(kTagCurrentCarrierIndex, -1); |
| 625 } | 537 } |
| 626 } | 538 } |
| 627 | 539 |
| 628 // Don't show any account management related buttons if the activation | 540 // Don't show any account management related buttons if the activation |
| 629 // state is unknown or no payment portal URL is available. | 541 // state is unknown. |
| 630 std::string support_url; | 542 if (cellular->activation_state() == shill::kActivationStateUnknown) { |
| 631 if (cellular->activation_state() == shill::kActivationStateUnknown || | 543 VLOG(2) << "Activation state unknown. Don't display buttons."; |
| 632 !dictionary->GetString(kTagSupportUrl, &support_url) || | |
| 633 support_url.empty()) { | |
| 634 VLOG(2) << "No support URL is available. Don't display buttons."; | |
| 635 return; | 544 return; |
| 636 } | 545 } |
| 637 | 546 |
| 638 if (cellular->activation_state() != shill::kActivationStateActivating && | 547 if (cellular->activation_state() != shill::kActivationStateActivating && |
| 639 cellular->activation_state() != shill::kActivationStateActivated) { | 548 cellular->activation_state() != shill::kActivationStateActivated) { |
| 640 dictionary->SetBoolean(kTagShowActivateButton, true); | 549 dictionary->SetBoolean(kTagShowActivateButton, true); |
| 641 } else { | 550 } else { |
| 642 bool may_show_portal_button = false; | 551 // TODO(stevenjb): Determine if we actually need this check. The payment url |
| 552 // property is commented as 'Deprecated' in service_constants.h and appears |
| 553 // to be unset in Shill, but we still reference it in mobile_setup.cc. |
| 554 bool may_show_portal_button = !cellular->payment_url().empty(); |
| 643 | 555 |
| 644 // If an online payment URL was provided by shill, then this means that the | |
| 645 // "View Account" button should be shown for the current carrier. | |
| 646 if (olp) { | |
| 647 std::string url; | |
| 648 olp->GetStringWithoutPathExpansion(shill::kPaymentPortalURL, &url); | |
| 649 may_show_portal_button = !url.empty(); | |
| 650 } | |
| 651 // If no online payment URL was provided by shill, fall back to | 556 // If no online payment URL was provided by shill, fall back to |
| 652 // MobileConfig to determine if the "View Account" should be shown. | 557 // MobileConfig to determine if the "View Account" should be shown. |
| 653 if (!may_show_portal_button && MobileConfig::GetInstance()->IsReady()) { | 558 if (!may_show_portal_button && MobileConfig::GetInstance()->IsReady()) { |
| 654 const MobileConfig::Carrier* carrier = | 559 const MobileConfig::Carrier* carrier = |
| 655 MobileConfig::GetInstance()->GetCarrier(carrier_id); | 560 MobileConfig::GetInstance()->GetCarrier(carrier_id); |
| 656 may_show_portal_button = carrier && carrier->show_portal_button(); | 561 may_show_portal_button = carrier && carrier->show_portal_button(); |
| 657 } | 562 } |
| 658 if (may_show_portal_button) { | 563 if (may_show_portal_button) { |
| 659 // The button should be shown for a LTE network even when the LTE network | 564 // The button should be shown for a LTE network even when the LTE network |
| 660 // is not connected, but CrOS is online. This is done to enable users to | 565 // is not connected, but CrOS is online. This is done to enable users to |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 714 dictionary->SetBoolean(kTagShared, shared); | 619 dictionary->SetBoolean(kTagShared, shared); |
| 715 | 620 |
| 716 const std::string& type = network->type(); | 621 const std::string& type = network->type(); |
| 717 | 622 |
| 718 const NetworkState* connected_network = | 623 const NetworkState* connected_network = |
| 719 NetworkHandler::Get()->network_state_handler()->ConnectedNetworkByType( | 624 NetworkHandler::Get()->network_state_handler()->ConnectedNetworkByType( |
| 720 NetworkTypePattern::Primitive(type)); | 625 NetworkTypePattern::Primitive(type)); |
| 721 dictionary->SetBoolean(kTagDeviceConnected, connected_network != NULL); | 626 dictionary->SetBoolean(kTagDeviceConnected, connected_network != NULL); |
| 722 | 627 |
| 723 if (type == shill::kTypeCellular) | 628 if (type == shill::kTypeCellular) |
| 724 PopulateCellularDetails(network, shill_properties, dictionary.get()); | 629 PopulateCellularDetails(network, dictionary.get()); |
| 725 else if (type == shill::kTypeVPN) | 630 else if (type == shill::kTypeVPN) |
| 726 PopulateVPNDetails(network, shill_properties, dictionary.get()); | 631 PopulateVPNDetails(network, shill_properties, dictionary.get()); |
| 727 | 632 |
| 728 return dictionary.Pass(); | 633 return dictionary.Pass(); |
| 729 } | 634 } |
| 730 | 635 |
| 731 // Helper methods for SetIPConfigProperties | 636 // Helper methods for SetIPConfigProperties |
| 732 bool AppendPropertyKeyIfPresent(const std::string& key, | 637 bool AppendPropertyKeyIfPresent(const std::string& key, |
| 733 const base::DictionaryValue& old_properties, | 638 const base::DictionaryValue& old_properties, |
| 734 std::vector<std::string>* property_keys) { | 639 std::vector<std::string>* property_keys) { |
| (...skipping 917 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1652 dictionary->SetBoolean( | 1557 dictionary->SetBoolean( |
| 1653 kTagWimaxAvailable, | 1558 kTagWimaxAvailable, |
| 1654 handler->IsTechnologyAvailable(NetworkTypePattern::Wimax())); | 1559 handler->IsTechnologyAvailable(NetworkTypePattern::Wimax())); |
| 1655 dictionary->SetBoolean( | 1560 dictionary->SetBoolean( |
| 1656 kTagWimaxEnabled, | 1561 kTagWimaxEnabled, |
| 1657 handler->IsTechnologyEnabled(NetworkTypePattern::Wimax())); | 1562 handler->IsTechnologyEnabled(NetworkTypePattern::Wimax())); |
| 1658 } | 1563 } |
| 1659 | 1564 |
| 1660 } // namespace options | 1565 } // namespace options |
| 1661 } // namespace chromeos | 1566 } // namespace chromeos |
| OLD | NEW |