| 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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 const char kTagCarrierUrl[] = "carrierUrl"; | 139 const char kTagCarrierUrl[] = "carrierUrl"; |
| 140 const char kTagCellularAvailable[] = "cellularAvailable"; | 140 const char kTagCellularAvailable[] = "cellularAvailable"; |
| 141 const char kTagCellularEnabled[] = "cellularEnabled"; | 141 const char kTagCellularEnabled[] = "cellularEnabled"; |
| 142 const char kTagCellularSupportsScan[] = "cellularSupportsScan"; | 142 const char kTagCellularSupportsScan[] = "cellularSupportsScan"; |
| 143 const char kTagConfigure[] = "configure"; | 143 const char kTagConfigure[] = "configure"; |
| 144 const char kTagConnect[] = "connect"; | 144 const char kTagConnect[] = "connect"; |
| 145 const char kTagControlledBy[] = "controlledBy"; | 145 const char kTagControlledBy[] = "controlledBy"; |
| 146 const char kTagDeviceConnected[] = "deviceConnected"; | 146 const char kTagDeviceConnected[] = "deviceConnected"; |
| 147 const char kTagDisconnect[] = "disconnect"; | 147 const char kTagDisconnect[] = "disconnect"; |
| 148 const char kTagErrorState[] = "errorState"; | 148 const char kTagErrorState[] = "errorState"; |
| 149 const char kTagEsn[] = "esn"; | |
| 150 const char kTagFirmwareRevision[] = "firmwareRevision"; | |
| 151 const char kTagForget[] = "forget"; | 149 const char kTagForget[] = "forget"; |
| 152 const char kTagGsm[] = "gsm"; | |
| 153 const char kTagHardwareRevision[] = "hardwareRevision"; | |
| 154 const char kTagIdentity[] = "identity"; | 150 const char kTagIdentity[] = "identity"; |
| 155 const char kTagIccid[] = "iccid"; | |
| 156 const char kTagImei[] = "imei"; | |
| 157 const char kTagImsi[] = "imsi"; | |
| 158 const char kTagLanguage[] = "language"; | 151 const char kTagLanguage[] = "language"; |
| 159 const char kTagLastGoodApn[] = "lastGoodApn"; | 152 const char kTagLastGoodApn[] = "lastGoodApn"; |
| 160 const char kTagLocalizedName[] = "localizedName"; | 153 const char kTagLocalizedName[] = "localizedName"; |
| 161 const char kTagCellularManufacturer[] = "cellularManufacturer"; | |
| 162 const char kTagMdn[] = "mdn"; | |
| 163 const char kTagMeid[] = "meid"; | |
| 164 const char kTagMin[] = "min"; | |
| 165 const char kTagModelId[] = "modelId"; | |
| 166 const char kTagName[] = "name"; | 154 const char kTagName[] = "name"; |
| 167 const char kTagNameServersGoogle[] = "nameServersGoogle"; | 155 const char kTagNameServersGoogle[] = "nameServersGoogle"; |
| 168 const char kTagNameServerType[] = "nameServerType"; | 156 const char kTagNameServerType[] = "nameServerType"; |
| 169 const char kTagNetworkId[] = "networkId"; | 157 const char kTagNetworkId[] = "networkId"; |
| 170 const char kTagNetworkTechnology[] = "networkTechnology"; | |
| 171 const char kTagOperatorCode[] = "operatorCode"; | |
| 172 const char kTagOperatorName[] = "operatorName"; | |
| 173 const char kTagOptions[] = "options"; | 158 const char kTagOptions[] = "options"; |
| 174 const char kTagPassword[] = "password"; | 159 const char kTagPassword[] = "password"; |
| 175 const char kTagPolicy[] = "policy"; | 160 const char kTagPolicy[] = "policy"; |
| 176 const char kTagPreferred[] = "preferred"; | 161 const char kTagPreferred[] = "preferred"; |
| 177 const char kTagPrlVersion[] = "prlVersion"; | |
| 178 const char kTagProviderType[] = "providerType"; | 162 const char kTagProviderType[] = "providerType"; |
| 179 const char kTagProviderApnList[] = "providerApnList"; | 163 const char kTagProviderApnList[] = "providerApnList"; |
| 180 const char kTagRecommended[] = "recommended"; | 164 const char kTagRecommended[] = "recommended"; |
| 181 const char kTagRecommendedValue[] = "recommendedValue"; | 165 const char kTagRecommendedValue[] = "recommendedValue"; |
| 182 const char kTagRemembered[] = "remembered"; | 166 const char kTagRemembered[] = "remembered"; |
| 183 const char kTagRememberedList[] = "rememberedList"; | 167 const char kTagRememberedList[] = "rememberedList"; |
| 184 const char kTagRestrictedPool[] = "restrictedPool"; | 168 const char kTagRestrictedPool[] = "restrictedPool"; |
| 185 const char kTagRoamingState[] = "roamingState"; | 169 const char kTagRoamingState[] = "roamingState"; |
| 186 const char kTagServerHostname[] = "serverHostname"; | 170 const char kTagServerHostname[] = "serverHostname"; |
| 187 const char kTagCarriers[] = "carriers"; | 171 const char kTagCarriers[] = "carriers"; |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 344 std::string name_servers; | 328 std::string name_servers; |
| 345 if (shill_properties.GetStringWithoutPathExpansion( | 329 if (shill_properties.GetStringWithoutPathExpansion( |
| 346 name_servers_key, &name_servers)) { | 330 name_servers_key, &name_servers)) { |
| 347 ip_info_dict->SetString(kIpConfigNameServers, name_servers); | 331 ip_info_dict->SetString(kIpConfigNameServers, name_servers); |
| 348 VLOG(2) << "Found " << name_servers_key << ": " << name_servers; | 332 VLOG(2) << "Found " << name_servers_key << ": " << name_servers; |
| 349 } | 333 } |
| 350 | 334 |
| 351 return ip_info_dict.release(); | 335 return ip_info_dict.release(); |
| 352 } | 336 } |
| 353 | 337 |
| 354 bool CanForgetNetworkType(const std::string& type) { | |
| 355 return type == shill::kTypeWifi || | |
| 356 type == shill::kTypeWimax || | |
| 357 type == shill::kTypeVPN; | |
| 358 } | |
| 359 | |
| 360 bool CanAddNetworkType(const std::string& type) { | |
| 361 return type == shill::kTypeWifi || | |
| 362 type == shill::kTypeVPN || | |
| 363 type == shill::kTypeCellular; | |
| 364 } | |
| 365 | |
| 366 // Decorate dictionary |value_dict| with policy information from |ui_data|. | 338 // Decorate dictionary |value_dict| with policy information from |ui_data|. |
| 367 void DecorateValueDictionary(const NetworkPropertyUIData& ui_data, | 339 void DecorateValueDictionary(const NetworkPropertyUIData& ui_data, |
| 368 const base::Value& value, | 340 const base::Value& value, |
| 369 base::DictionaryValue* value_dict) { | 341 base::DictionaryValue* value_dict) { |
| 370 const base::Value* recommended_value = ui_data.default_value(); | 342 const base::Value* recommended_value = ui_data.default_value(); |
| 371 if (ui_data.IsManaged()) | 343 if (ui_data.IsManaged()) |
| 372 value_dict->SetString(kTagControlledBy, kTagPolicy); | 344 value_dict->SetString(kTagControlledBy, kTagPolicy); |
| 373 else if (recommended_value && recommended_value->Equals(&value)) | 345 else if (recommended_value && recommended_value->Equals(&value)) |
| 374 value_dict->SetString(kTagControlledBy, kTagRecommended); | 346 value_dict->SetString(kTagControlledBy, kTagRecommended); |
| 375 | 347 |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 536 *apn, shill::kApnLanguageProperty, kTagLanguage, dictionary); | 508 *apn, shill::kApnLanguageProperty, kTagLanguage, dictionary); |
| 537 } | 509 } |
| 538 | 510 |
| 539 void PopulateCellularDetails(const NetworkState* cellular, | 511 void PopulateCellularDetails(const NetworkState* cellular, |
| 540 const base::DictionaryValue& shill_properties, | 512 const base::DictionaryValue& shill_properties, |
| 541 base::DictionaryValue* dictionary) { | 513 base::DictionaryValue* dictionary) { |
| 542 dictionary->SetBoolean(kTagCarrierSelectFlag, | 514 dictionary->SetBoolean(kTagCarrierSelectFlag, |
| 543 CommandLine::ForCurrentProcess()->HasSwitch( | 515 CommandLine::ForCurrentProcess()->HasSwitch( |
| 544 chromeos::switches::kEnableCarrierSwitching)); | 516 chromeos::switches::kEnableCarrierSwitching)); |
| 545 // Cellular network / connection settings. | 517 // Cellular network / connection settings. |
| 546 dictionary->SetString(kTagNetworkTechnology, cellular->network_technology()); | |
| 547 dictionary->SetString(kTagActivationState, | 518 dictionary->SetString(kTagActivationState, |
| 548 internet_options_strings::ActivationStateString( | 519 internet_options_strings::ActivationStateString( |
| 549 cellular->activation_state())); | 520 cellular->activation_state())); |
| 550 dictionary->SetString(kTagRoamingState, | 521 dictionary->SetString(kTagRoamingState, |
| 551 internet_options_strings::RoamingStateString( | 522 internet_options_strings::RoamingStateString( |
| 552 cellular->roaming())); | 523 cellular->roaming())); |
| 553 dictionary->SetString( | 524 dictionary->SetString(kTagRestrictedPool, |
| 554 kTagRestrictedPool, | 525 internet_options_strings::RestrictedStateString( |
| 555 internet_options_strings::RestrictedStateString( | 526 cellular->connection_state())); |
| 556 cellular->connection_state())); | |
| 557 | |
| 558 const base::DictionaryValue* serving_operator = NULL; | |
| 559 if (shill_properties.GetDictionaryWithoutPathExpansion( | |
| 560 shill::kServingOperatorProperty, &serving_operator)) { | |
| 561 CopyStringFromDictionary(*serving_operator, | |
| 562 shill::kOperatorNameKey, | |
| 563 kTagOperatorName, | |
| 564 dictionary); | |
| 565 CopyStringFromDictionary(*serving_operator, | |
| 566 shill::kOperatorCodeKey, | |
| 567 kTagOperatorCode, | |
| 568 dictionary); | |
| 569 } | |
| 570 | 527 |
| 571 const base::DictionaryValue* olp = NULL; | 528 const base::DictionaryValue* olp = NULL; |
| 572 if (shill_properties.GetDictionaryWithoutPathExpansion( | 529 if (shill_properties.GetDictionaryWithoutPathExpansion( |
| 573 shill::kPaymentPortalProperty, &olp)) { | 530 shill::kPaymentPortalProperty, &olp)) { |
| 574 std::string url; | 531 std::string url; |
| 575 olp->GetStringWithoutPathExpansion(shill::kPaymentPortalURL, &url); | 532 olp->GetStringWithoutPathExpansion(shill::kPaymentPortalURL, &url); |
| 576 dictionary->SetString(kTagSupportUrl, url); | 533 dictionary->SetString(kTagSupportUrl, url); |
| 577 } | 534 } |
| 578 | 535 |
| 579 base::DictionaryValue* apn = new base::DictionaryValue; | 536 base::DictionaryValue* apn = new base::DictionaryValue; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 593 | 550 |
| 594 // These default to empty and are only set if device != NULL. | 551 // These default to empty and are only set if device != NULL. |
| 595 std::string carrier_id; | 552 std::string carrier_id; |
| 596 std::string mdn; | 553 std::string mdn; |
| 597 | 554 |
| 598 // Device settings. | 555 // Device settings. |
| 599 const DeviceState* device = | 556 const DeviceState* device = |
| 600 NetworkHandler::Get()->network_state_handler()->GetDeviceState( | 557 NetworkHandler::Get()->network_state_handler()->GetDeviceState( |
| 601 cellular->device_path()); | 558 cellular->device_path()); |
| 602 if (device) { | 559 if (device) { |
| 603 // TODO(stevenjb): Add NetworkDeviceHandler::GetProperties() and use that | |
| 604 // to retrieve the complete dictionary of device properties, instead of | |
| 605 // caching them (will be done for the new UI). | |
| 606 const base::DictionaryValue& device_properties = device->properties(); | 560 const base::DictionaryValue& device_properties = device->properties(); |
| 607 const NetworkPropertyUIData cellular_property_ui_data( | 561 const NetworkPropertyUIData cellular_property_ui_data( |
| 608 cellular->ui_data().onc_source()); | 562 cellular->ui_data().onc_source()); |
| 609 CopyStringFromDictionary(device_properties, | |
| 610 shill::kManufacturerProperty, | |
| 611 kTagCellularManufacturer, | |
| 612 dictionary); | |
| 613 CopyStringFromDictionary( | |
| 614 device_properties, shill::kModelIDProperty, kTagModelId, dictionary); | |
| 615 CopyStringFromDictionary(device_properties, | |
| 616 shill::kFirmwareRevisionProperty, | |
| 617 kTagFirmwareRevision, | |
| 618 dictionary); | |
| 619 CopyStringFromDictionary(device_properties, | |
| 620 shill::kHardwareRevisionProperty, | |
| 621 kTagHardwareRevision, | |
| 622 dictionary); | |
| 623 CopyIntegerFromDictionary(device_properties, | |
| 624 shill::kPRLVersionProperty, | |
| 625 kTagPrlVersion, | |
| 626 true, | |
| 627 dictionary); | |
| 628 CopyStringFromDictionary( | |
| 629 device_properties, shill::kMeidProperty, kTagMeid, dictionary); | |
| 630 CopyStringFromDictionary( | |
| 631 device_properties, shill::kIccidProperty, kTagIccid, dictionary); | |
| 632 CopyStringFromDictionary( | |
| 633 device_properties, shill::kImeiProperty, kTagImei, dictionary); | |
| 634 mdn = CopyStringFromDictionary( | |
| 635 device_properties, shill::kMdnProperty, kTagMdn, dictionary); | |
| 636 CopyStringFromDictionary( | |
| 637 device_properties, shill::kImsiProperty, kTagImsi, dictionary); | |
| 638 CopyStringFromDictionary( | |
| 639 device_properties, shill::kEsnProperty, kTagEsn, dictionary); | |
| 640 CopyStringFromDictionary( | |
| 641 device_properties, shill::kMinProperty, kTagMin, dictionary); | |
| 642 std::string family; | |
| 643 device_properties.GetStringWithoutPathExpansion( | |
| 644 shill::kTechnologyFamilyProperty, &family); | |
| 645 dictionary->SetBoolean(kTagGsm, family == shill::kNetworkTechnologyGsm); | |
| 646 | |
| 647 SetValueDictionary(dictionary, | 563 SetValueDictionary(dictionary, |
| 648 kTagSimCardLockEnabled, | 564 kTagSimCardLockEnabled, |
| 649 new base::FundamentalValue(device->sim_lock_enabled()), | 565 new base::FundamentalValue(device->sim_lock_enabled()), |
| 650 cellular_property_ui_data); | 566 cellular_property_ui_data); |
| 651 | 567 |
| 652 carrier_id = device->home_provider_id(); | 568 carrier_id = device->home_provider_id(); |
| 569 device_properties.GetStringWithoutPathExpansion(shill::kMdnProperty, &mdn); |
| 653 | 570 |
| 654 MobileConfig* config = MobileConfig::GetInstance(); | 571 MobileConfig* config = MobileConfig::GetInstance(); |
| 655 if (config->IsReady()) { | 572 if (config->IsReady()) { |
| 656 const MobileConfig::Carrier* carrier = config->GetCarrier(carrier_id); | 573 const MobileConfig::Carrier* carrier = config->GetCarrier(carrier_id); |
| 657 if (carrier && !carrier->top_up_url().empty()) | 574 if (carrier && !carrier->top_up_url().empty()) |
| 658 dictionary->SetString(kTagCarrierUrl, carrier->top_up_url()); | 575 dictionary->SetString(kTagCarrierUrl, carrier->top_up_url()); |
| 659 } | 576 } |
| 660 | 577 |
| 661 base::ListValue* apn_list_value = new base::ListValue(); | 578 base::ListValue* apn_list_value = new base::ListValue(); |
| 662 const base::ListValue* apn_list; | 579 const base::ListValue* apn_list; |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 742 // carrier specific portal. | 659 // carrier specific portal. |
| 743 if (cellular->IsConnectedState() || force_show_view_account_button) | 660 if (cellular->IsConnectedState() || force_show_view_account_button) |
| 744 dictionary->SetBoolean(kTagShowViewAccountButton, true); | 661 dictionary->SetBoolean(kTagShowViewAccountButton, true); |
| 745 } | 662 } |
| 746 } | 663 } |
| 747 } | 664 } |
| 748 | 665 |
| 749 scoped_ptr<base::DictionaryValue> PopulateConnectionDetails( | 666 scoped_ptr<base::DictionaryValue> PopulateConnectionDetails( |
| 750 const NetworkState* network, | 667 const NetworkState* network, |
| 751 const base::DictionaryValue& shill_properties) { | 668 const base::DictionaryValue& shill_properties) { |
| 669 // TODO(stevenjb): Once we eliminate all references to Shill properties, |
| 670 // we can switch to using managed_network_configuration_handler which |
| 671 // includes Device properties for Cellular (and skip the call to |
| 672 // onc::TranslateShillServiceToONCPart). For now we copy them over here. |
| 673 scoped_ptr<base::DictionaryValue> shill_properties_with_device( |
| 674 shill_properties.DeepCopy()); |
| 675 const DeviceState* device = |
| 676 NetworkHandler::Get()->network_state_handler()->GetDeviceState( |
| 677 network->device_path()); |
| 678 if (device) { |
| 679 shill_properties_with_device->Set(shill::kDeviceProperty, |
| 680 device->properties().DeepCopy()); |
| 681 } |
| 752 scoped_ptr<base::DictionaryValue> dictionary = | 682 scoped_ptr<base::DictionaryValue> dictionary = |
| 753 onc::TranslateShillServiceToONCPart( | 683 onc::TranslateShillServiceToONCPart( |
| 754 shill_properties, &onc::kNetworkWithStateSignature); | 684 *shill_properties_with_device, &onc::kNetworkWithStateSignature); |
| 755 | 685 |
| 756 dictionary->SetString(kNetworkInfoKeyServicePath, network->path()); | 686 dictionary->SetString(kNetworkInfoKeyServicePath, network->path()); |
| 757 dictionary->SetString( | 687 dictionary->SetString( |
| 758 kTagErrorState, | 688 kTagErrorState, |
| 759 ash::network_connect::ErrorString(network->error(), network->path())); | 689 ash::network_connect::ErrorString(network->error(), network->path())); |
| 760 | 690 |
| 761 dictionary->SetBoolean(kTagRemembered, !network->profile_path().empty()); | 691 dictionary->SetBoolean(kTagRemembered, !network->profile_path().empty()); |
| 762 bool shared = !network->IsPrivate(); | 692 bool shared = !network->IsPrivate(); |
| 763 dictionary->SetBoolean(kTagShared, shared); | 693 dictionary->SetBoolean(kTagShared, shared); |
| 764 | 694 |
| (...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1147 gfx::ImageSkia* icon = | 1077 gfx::ImageSkia* icon = |
| 1148 ResourceBundle::GetSharedInstance().GetImageSkiaNamed(resource_id); | 1078 ResourceBundle::GetSharedInstance().GetImageSkiaNamed(resource_id); |
| 1149 gfx::ImageSkiaRep image_rep = icon->GetRepresentation( | 1079 gfx::ImageSkiaRep image_rep = icon->GetRepresentation( |
| 1150 web_ui()->GetDeviceScaleFactor()); | 1080 web_ui()->GetDeviceScaleFactor()); |
| 1151 return webui::GetBitmapDataUrl(image_rep.sk_bitmap()); | 1081 return webui::GetBitmapDataUrl(image_rep.sk_bitmap()); |
| 1152 } | 1082 } |
| 1153 | 1083 |
| 1154 void InternetOptionsHandler::RefreshNetworkData() { | 1084 void InternetOptionsHandler::RefreshNetworkData() { |
| 1155 base::DictionaryValue dictionary; | 1085 base::DictionaryValue dictionary; |
| 1156 FillNetworkInfo(&dictionary); | 1086 FillNetworkInfo(&dictionary); |
| 1157 web_ui()->CallJavascriptFunction( | 1087 web_ui()->CallJavascriptFunction(kRefreshNetworkDataFunction, dictionary); |
| 1158 kRefreshNetworkDataFunction, dictionary); | |
| 1159 } | 1088 } |
| 1160 | 1089 |
| 1161 void InternetOptionsHandler::UpdateConnectionData( | 1090 void InternetOptionsHandler::UpdateConnectionData( |
| 1162 const std::string& service_path) { | 1091 const std::string& service_path) { |
| 1163 NetworkHandler::Get()->network_configuration_handler()->GetProperties( | 1092 NetworkHandler::Get()->network_configuration_handler()->GetProperties( |
| 1164 service_path, | 1093 service_path, |
| 1165 base::Bind(&InternetOptionsHandler::UpdateConnectionDataCallback, | 1094 base::Bind(&InternetOptionsHandler::UpdateConnectionDataCallback, |
| 1166 weak_factory_.GetWeakPtr()), | 1095 weak_factory_.GetWeakPtr()), |
| 1167 base::Bind(&ShillError, "UpdateConnectionData")); | 1096 base::Bind(&ShillError, "UpdateConnectionData")); |
| 1168 } | 1097 } |
| (...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1537 return; | 1466 return; |
| 1538 } | 1467 } |
| 1539 std::string type; // Shill type | 1468 std::string type; // Shill type |
| 1540 if (!onc_type.empty()) { | 1469 if (!onc_type.empty()) { |
| 1541 type = network_util::TranslateONCTypeToShill(onc_type); | 1470 type = network_util::TranslateONCTypeToShill(onc_type); |
| 1542 if (type.empty()) | 1471 if (type.empty()) |
| 1543 LOG(ERROR) << "Unable to translate ONC type: " << onc_type; | 1472 LOG(ERROR) << "Unable to translate ONC type: " << onc_type; |
| 1544 } | 1473 } |
| 1545 // Process commands that do not require an existing network. | 1474 // Process commands that do not require an existing network. |
| 1546 if (command == kTagAddConnection) { | 1475 if (command == kTagAddConnection) { |
| 1547 if (CanAddNetworkType(type)) | 1476 AddConnection(type); |
| 1548 AddConnection(type); | |
| 1549 } else if (command == kTagForget) { | 1477 } else if (command == kTagForget) { |
| 1550 if (CanForgetNetworkType(type)) { | 1478 NetworkHandler::Get()->network_configuration_handler()-> |
| 1551 NetworkHandler::Get()->network_configuration_handler()-> | 1479 RemoveConfiguration( |
| 1552 RemoveConfiguration( | 1480 service_path, |
| 1553 service_path, | 1481 base::Bind(&base::DoNothing), |
| 1554 base::Bind(&base::DoNothing), | 1482 base::Bind(&ShillError, "NetworkCommand: " + command)); |
| 1555 base::Bind(&ShillError, "NetworkCommand: " + command)); | |
| 1556 } | |
| 1557 } else if (command == kTagOptions) { | 1483 } else if (command == kTagOptions) { |
| 1558 NetworkHandler::Get()->network_configuration_handler()->GetProperties( | 1484 NetworkHandler::Get()->network_configuration_handler()->GetProperties( |
| 1559 service_path, | 1485 service_path, |
| 1560 base::Bind(&InternetOptionsHandler::PopulateDictionaryDetailsCallback, | 1486 base::Bind(&InternetOptionsHandler::PopulateDictionaryDetailsCallback, |
| 1561 weak_factory_.GetWeakPtr()), | 1487 weak_factory_.GetWeakPtr()), |
| 1562 base::Bind(&ShillError, "NetworkCommand: " + command)); | 1488 base::Bind(&ShillError, "NetworkCommand: " + command)); |
| 1563 } else if (command == kTagConnect) { | 1489 } else if (command == kTagConnect) { |
| 1564 const NetworkState* network = GetNetworkState(service_path); | 1490 const NetworkState* network = GetNetworkState(service_path); |
| 1565 if (network && network->type() == shill::kTypeWifi) | 1491 if (network && network->type() == shill::kTypeWifi) |
| 1566 content::RecordAction( | 1492 content::RecordAction( |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1599 content::RecordAction( | 1525 content::RecordAction( |
| 1600 base::UserMetricsAction("Options_NetworkJoinOtherWifi")); | 1526 base::UserMetricsAction("Options_NetworkJoinOtherWifi")); |
| 1601 NetworkConfigView::ShowForType(shill::kTypeWifi, GetNativeWindow()); | 1527 NetworkConfigView::ShowForType(shill::kTypeWifi, GetNativeWindow()); |
| 1602 } else if (type == shill::kTypeVPN) { | 1528 } else if (type == shill::kTypeVPN) { |
| 1603 content::RecordAction( | 1529 content::RecordAction( |
| 1604 base::UserMetricsAction("Options_NetworkJoinOtherVPN")); | 1530 base::UserMetricsAction("Options_NetworkJoinOtherVPN")); |
| 1605 NetworkConfigView::ShowForType(shill::kTypeVPN, GetNativeWindow()); | 1531 NetworkConfigView::ShowForType(shill::kTypeVPN, GetNativeWindow()); |
| 1606 } else if (type == shill::kTypeCellular) { | 1532 } else if (type == shill::kTypeCellular) { |
| 1607 ChooseMobileNetworkDialog::ShowDialog(GetNativeWindow()); | 1533 ChooseMobileNetworkDialog::ShowDialog(GetNativeWindow()); |
| 1608 } else { | 1534 } else { |
| 1609 NOTREACHED(); | 1535 LOG(ERROR) << "Unsupported type for AddConnection"; |
| 1610 } | 1536 } |
| 1611 } | 1537 } |
| 1612 | 1538 |
| 1613 base::ListValue* InternetOptionsHandler::GetWiredList() { | 1539 base::ListValue* InternetOptionsHandler::GetWiredList() { |
| 1614 base::ListValue* list = new base::ListValue(); | 1540 base::ListValue* list = new base::ListValue(); |
| 1615 const NetworkState* network = NetworkHandler::Get()->network_state_handler()-> | 1541 const NetworkState* network = NetworkHandler::Get()->network_state_handler()-> |
| 1616 FirstNetworkByType(NetworkTypePattern::Ethernet()); | 1542 FirstNetworkByType(NetworkTypePattern::Ethernet()); |
| 1617 if (!network) | 1543 if (!network) |
| 1618 return list; | 1544 return list; |
| 1619 list->Append(BuildNetworkDictionary(network, GetScaleFactor(), GetPrefs())); | 1545 list->Append(BuildNetworkDictionary(network, GetScaleFactor(), GetPrefs())); |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1703 dictionary->SetBoolean( | 1629 dictionary->SetBoolean( |
| 1704 kTagWimaxAvailable, | 1630 kTagWimaxAvailable, |
| 1705 handler->IsTechnologyAvailable(NetworkTypePattern::Wimax())); | 1631 handler->IsTechnologyAvailable(NetworkTypePattern::Wimax())); |
| 1706 dictionary->SetBoolean( | 1632 dictionary->SetBoolean( |
| 1707 kTagWimaxEnabled, | 1633 kTagWimaxEnabled, |
| 1708 handler->IsTechnologyEnabled(NetworkTypePattern::Wimax())); | 1634 handler->IsTechnologyEnabled(NetworkTypePattern::Wimax())); |
| 1709 } | 1635 } |
| 1710 | 1636 |
| 1711 } // namespace options | 1637 } // namespace options |
| 1712 } // namespace chromeos | 1638 } // namespace chromeos |
| OLD | NEW |