| 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/automation/testing_automation_provider.h" | 5 #include "chrome/browser/automation/testing_automation_provider.h" |
| 6 | 6 |
| 7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
| 8 #include "ash/shell_delegate.h" | 8 #include "ash/shell_delegate.h" |
| 9 #include "ash/system/tray/system_tray_delegate.h" | 9 #include "ash/system/tray/system_tray_delegate.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| 11 #include "base/i18n/time_formatting.h" | 11 #include "base/i18n/time_formatting.h" |
| 12 #include "base/prefs/pref_service.h" | 12 #include "base/prefs/pref_service.h" |
| 13 #include "base/strings/stringprintf.h" | 13 #include "base/strings/stringprintf.h" |
| 14 #include "base/strings/utf_string_conversions.h" | 14 #include "base/strings/utf_string_conversions.h" |
| 15 #include "base/time/time.h" | 15 #include "base/time/time.h" |
| 16 #include "chrome/browser/automation/automation_provider_json.h" | 16 #include "chrome/browser/automation/automation_provider_json.h" |
| 17 #include "chrome/browser/automation/automation_provider_observers.h" | 17 #include "chrome/browser/automation/automation_provider_observers.h" |
| 18 #include "chrome/browser/automation/automation_util.h" | 18 #include "chrome/browser/automation/automation_util.h" |
| 19 #include "chrome/browser/browser_process.h" | 19 #include "chrome/browser/browser_process.h" |
| 20 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" | 20 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" |
| 21 #include "chrome/browser/chromeos/accessibility/accessibility_util.h" | 21 #include "chrome/browser/chromeos/accessibility/accessibility_util.h" |
| 22 #include "chrome/browser/chromeos/cros/network_library.h" | |
| 23 #include "chrome/browser/chromeos/login/default_user_images.h" | 22 #include "chrome/browser/chromeos/login/default_user_images.h" |
| 24 #include "chrome/browser/chromeos/login/enrollment/enrollment_screen.h" | 23 #include "chrome/browser/chromeos/login/enrollment/enrollment_screen.h" |
| 25 #include "chrome/browser/chromeos/login/existing_user_controller.h" | 24 #include "chrome/browser/chromeos/login/existing_user_controller.h" |
| 26 #include "chrome/browser/chromeos/login/login_display.h" | 25 #include "chrome/browser/chromeos/login/login_display.h" |
| 27 #include "chrome/browser/chromeos/login/login_display_host_impl.h" | 26 #include "chrome/browser/chromeos/login/login_display_host_impl.h" |
| 28 #include "chrome/browser/chromeos/login/screen_locker.h" | 27 #include "chrome/browser/chromeos/login/screen_locker.h" |
| 29 #include "chrome/browser/chromeos/login/screens/eula_screen.h" | 28 #include "chrome/browser/chromeos/login/screens/eula_screen.h" |
| 30 #include "chrome/browser/chromeos/login/screens/network_screen.h" | 29 #include "chrome/browser/chromeos/login/screens/network_screen.h" |
| 31 #include "chrome/browser/chromeos/login/screens/update_screen.h" | 30 #include "chrome/browser/chromeos/login/screens/update_screen.h" |
| 32 #include "chrome/browser/chromeos/login/screens/user_image_screen.h" | 31 #include "chrome/browser/chromeos/login/screens/user_image_screen.h" |
| 33 #include "chrome/browser/chromeos/login/startup_utils.h" | 32 #include "chrome/browser/chromeos/login/startup_utils.h" |
| 34 #include "chrome/browser/chromeos/login/webui_login_display.h" | 33 #include "chrome/browser/chromeos/login/webui_login_display.h" |
| 35 #include "chrome/browser/chromeos/login/wizard_controller.h" | 34 #include "chrome/browser/chromeos/login/wizard_controller.h" |
| 36 #include "chrome/browser/chromeos/net/proxy_config_handler.h" | 35 #include "chrome/browser/chromeos/net/proxy_config_handler.h" |
| 37 #include "chrome/browser/chromeos/settings/cros_settings.h" | 36 #include "chrome/browser/chromeos/settings/cros_settings.h" |
| 38 #include "chrome/browser/chromeos/settings/cros_settings_names.h" | 37 #include "chrome/browser/chromeos/settings/cros_settings_names.h" |
| 39 #include "chrome/browser/chromeos/system/timezone_settings.h" | 38 #include "chrome/browser/chromeos/system/timezone_settings.h" |
| 40 #include "chrome/browser/prefs/proxy_config_dictionary.h" | 39 #include "chrome/browser/prefs/proxy_config_dictionary.h" |
| 41 #include "chrome/browser/ui/browser.h" | 40 #include "chrome/browser/ui/browser.h" |
| 42 #include "chrome/browser/ui/browser_window.h" | 41 #include "chrome/browser/ui/browser_window.h" |
| 43 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" | 42 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" |
| 44 #include "chrome/common/pref_names.h" | 43 #include "chrome/common/pref_names.h" |
| 45 #include "chromeos/audio/cras_audio_handler.h" | 44 #include "chromeos/audio/cras_audio_handler.h" |
| 46 #include "chromeos/dbus/dbus_thread_manager.h" | 45 #include "chromeos/dbus/dbus_thread_manager.h" |
| 47 #include "chromeos/dbus/session_manager_client.h" | 46 #include "chromeos/dbus/session_manager_client.h" |
| 48 #include "chromeos/dbus/update_engine_client.h" | 47 #include "chromeos/dbus/update_engine_client.h" |
| 49 #include "chromeos/network/network_state_handler.h" | |
| 50 #include "chromeos/network/onc/onc_utils.h" | |
| 51 #include "content/public/browser/web_contents.h" | 48 #include "content/public/browser/web_contents.h" |
| 52 #include "net/base/network_change_notifier.h" | |
| 53 #include "policy/policy_constants.h" | 49 #include "policy/policy_constants.h" |
| 54 #include "ui/views/widget/widget.h" | 50 #include "ui/views/widget/widget.h" |
| 55 | 51 |
| 56 using chromeos::DBusThreadManager; | 52 using chromeos::DBusThreadManager; |
| 57 using chromeos::ExistingUserController; | 53 using chromeos::ExistingUserController; |
| 58 using chromeos::NetworkLibrary; | |
| 59 using chromeos::UpdateEngineClient; | 54 using chromeos::UpdateEngineClient; |
| 60 using chromeos::User; | 55 using chromeos::User; |
| 61 using chromeos::UserManager; | 56 using chromeos::UserManager; |
| 62 using chromeos::WizardController; | 57 using chromeos::WizardController; |
| 63 | 58 |
| 64 namespace { | 59 namespace { |
| 65 | 60 |
| 66 DictionaryValue* GetNetworkInfoDict(const chromeos::Network* network) { | |
| 67 DictionaryValue* item = new DictionaryValue; | |
| 68 item->SetString("name", network->name()); | |
| 69 item->SetString("device_path", network->device_path()); | |
| 70 item->SetString("status", network->GetStateString()); | |
| 71 return item; | |
| 72 } | |
| 73 | |
| 74 DictionaryValue* GetWifiInfoDict(const chromeos::WifiNetwork* wifi) { | |
| 75 DictionaryValue* item = GetNetworkInfoDict(wifi); | |
| 76 item->SetInteger("strength", wifi->strength()); | |
| 77 item->SetBoolean("encrypted", wifi->encrypted()); | |
| 78 item->SetString("encryption", wifi->GetEncryptionString()); | |
| 79 return item; | |
| 80 } | |
| 81 | |
| 82 const char* UpdateStatusToString( | |
| 83 UpdateEngineClient::UpdateStatusOperation status) { | |
| 84 switch (status) { | |
| 85 case UpdateEngineClient::UPDATE_STATUS_IDLE: | |
| 86 return "idle"; | |
| 87 case UpdateEngineClient::UPDATE_STATUS_CHECKING_FOR_UPDATE: | |
| 88 return "checking for update"; | |
| 89 case UpdateEngineClient::UPDATE_STATUS_UPDATE_AVAILABLE: | |
| 90 return "update available"; | |
| 91 case UpdateEngineClient::UPDATE_STATUS_DOWNLOADING: | |
| 92 return "downloading"; | |
| 93 case UpdateEngineClient::UPDATE_STATUS_VERIFYING: | |
| 94 return "verifying"; | |
| 95 case UpdateEngineClient::UPDATE_STATUS_FINALIZING: | |
| 96 return "finalizing"; | |
| 97 case UpdateEngineClient::UPDATE_STATUS_UPDATED_NEED_REBOOT: | |
| 98 return "updated need reboot"; | |
| 99 case UpdateEngineClient::UPDATE_STATUS_REPORTING_ERROR_EVENT: | |
| 100 return "reporting error event"; | |
| 101 default: | |
| 102 return "unknown"; | |
| 103 } | |
| 104 } | |
| 105 | |
| 106 void UpdateCheckCallback(AutomationJSONReply* reply, | 61 void UpdateCheckCallback(AutomationJSONReply* reply, |
| 107 UpdateEngineClient::UpdateCheckResult result) { | 62 UpdateEngineClient::UpdateCheckResult result) { |
| 108 if (result == UpdateEngineClient::UPDATE_RESULT_SUCCESS) | 63 if (result == UpdateEngineClient::UPDATE_RESULT_SUCCESS) |
| 109 reply->SendSuccess(NULL); | 64 reply->SendSuccess(NULL); |
| 110 else | 65 else |
| 111 reply->SendError("update check failed"); | 66 reply->SendError("update check failed"); |
| 112 delete reply; | 67 delete reply; |
| 113 } | 68 } |
| 114 | 69 |
| 115 const std::string VPNProviderTypeToString( | |
| 116 chromeos::ProviderType provider_type) { | |
| 117 switch (provider_type) { | |
| 118 case chromeos::PROVIDER_TYPE_L2TP_IPSEC_PSK: | |
| 119 return std::string("L2TP_IPSEC_PSK"); | |
| 120 case chromeos::PROVIDER_TYPE_L2TP_IPSEC_USER_CERT: | |
| 121 return std::string("L2TP_IPSEC_USER_CERT"); | |
| 122 case chromeos::PROVIDER_TYPE_OPEN_VPN: | |
| 123 return std::string("OPEN_VPN"); | |
| 124 default: | |
| 125 return std::string("UNSUPPORTED_PROVIDER_TYPE"); | |
| 126 } | |
| 127 } | |
| 128 | |
| 129 } // namespace | 70 } // namespace |
| 130 | 71 |
| 131 #if defined(OS_CHROMEOS) | 72 #if defined(OS_CHROMEOS) |
| 132 void TestingAutomationProvider::PowerChanged( | 73 void TestingAutomationProvider::PowerChanged( |
| 133 const power_manager::PowerSupplyProperties& proto) { | 74 const power_manager::PowerSupplyProperties& proto) { |
| 134 power_supply_properties_ = proto; | 75 power_supply_properties_ = proto; |
| 135 } | 76 } |
| 136 #endif | 77 #endif |
| 137 | 78 |
| 138 void TestingAutomationProvider::AcceptOOBENetworkScreen( | 79 void TestingAutomationProvider::AcceptOOBENetworkScreen( |
| (...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 486 } else { | 427 } else { |
| 487 int64 time = power_supply_properties_.battery_time_to_empty_sec(); | 428 int64 time = power_supply_properties_.battery_time_to_empty_sec(); |
| 488 if (time > 0) | 429 if (time > 0) |
| 489 return_value->SetInteger("battery_seconds_to_empty", time); | 430 return_value->SetInteger("battery_seconds_to_empty", time); |
| 490 } | 431 } |
| 491 } | 432 } |
| 492 | 433 |
| 493 AutomationJSONReply(this, reply_message).SendSuccess(return_value.get()); | 434 AutomationJSONReply(this, reply_message).SendSuccess(return_value.get()); |
| 494 } | 435 } |
| 495 | 436 |
| 496 void TestingAutomationProvider::GetNetworkInfo(DictionaryValue* args, | |
| 497 IPC::Message* reply_message) { | |
| 498 scoped_ptr<DictionaryValue> return_value(new DictionaryValue); | |
| 499 NetworkLibrary* network_library = NetworkLibrary::Get(); | |
| 500 | |
| 501 return_value->SetBoolean("offline_mode", | |
| 502 net::NetworkChangeNotifier::IsOffline()); | |
| 503 | |
| 504 // Currently connected networks. | |
| 505 if (network_library->ethernet_network()) | |
| 506 return_value->SetString( | |
| 507 "connected_ethernet", | |
| 508 network_library->ethernet_network()->service_path()); | |
| 509 if (network_library->wifi_network()) | |
| 510 return_value->SetString("connected_wifi", | |
| 511 network_library->wifi_network()->service_path()); | |
| 512 if (network_library->cellular_network()) | |
| 513 return_value->SetString( | |
| 514 "connected_cellular", | |
| 515 network_library->cellular_network()->service_path()); | |
| 516 | |
| 517 // Ethernet network. | |
| 518 bool ethernet_available = network_library->ethernet_available(); | |
| 519 bool ethernet_enabled = network_library->ethernet_enabled(); | |
| 520 return_value->SetBoolean("ethernet_available", ethernet_available); | |
| 521 return_value->SetBoolean("ethernet_enabled", ethernet_enabled); | |
| 522 if (ethernet_available && ethernet_enabled) { | |
| 523 const chromeos::EthernetNetwork* ethernet_network = | |
| 524 network_library->ethernet_network(); | |
| 525 if (ethernet_network) { | |
| 526 DictionaryValue* items = new DictionaryValue; | |
| 527 DictionaryValue* item = GetNetworkInfoDict(ethernet_network); | |
| 528 items->Set(ethernet_network->service_path(), item); | |
| 529 items->SetInteger("network_type", chromeos::TYPE_ETHERNET); | |
| 530 return_value->Set("ethernet_networks", items); | |
| 531 } | |
| 532 } | |
| 533 | |
| 534 // Wi-fi networks. | |
| 535 bool wifi_available = network_library->wifi_available(); | |
| 536 bool wifi_enabled = network_library->wifi_enabled(); | |
| 537 return_value->SetBoolean("wifi_available", wifi_available); | |
| 538 return_value->SetBoolean("wifi_enabled", wifi_enabled); | |
| 539 if (wifi_available && wifi_enabled) { | |
| 540 const chromeos::WifiNetworkVector& wifi_networks = | |
| 541 network_library->wifi_networks(); | |
| 542 DictionaryValue* items = new DictionaryValue; | |
| 543 for (chromeos::WifiNetworkVector::const_iterator iter = | |
| 544 wifi_networks.begin(); iter != wifi_networks.end(); ++iter) { | |
| 545 const chromeos::WifiNetwork* wifi = *iter; | |
| 546 DictionaryValue* item = GetWifiInfoDict(wifi); | |
| 547 items->Set(wifi->service_path(), item); | |
| 548 } | |
| 549 items->SetInteger("network_type", chromeos::TYPE_WIFI); | |
| 550 return_value->Set("wifi_networks", items); | |
| 551 } | |
| 552 | |
| 553 // Cellular networks. | |
| 554 bool cellular_available = network_library->cellular_available(); | |
| 555 bool cellular_enabled = network_library->cellular_enabled(); | |
| 556 return_value->SetBoolean("cellular_available", cellular_available); | |
| 557 return_value->SetBoolean("cellular_enabled", cellular_enabled); | |
| 558 if (cellular_available && cellular_enabled) { | |
| 559 const chromeos::CellularNetworkVector& cellular_networks = | |
| 560 network_library->cellular_networks(); | |
| 561 DictionaryValue* items = new DictionaryValue; | |
| 562 for (size_t i = 0; i < cellular_networks.size(); ++i) { | |
| 563 DictionaryValue* item = GetNetworkInfoDict(cellular_networks[i]); | |
| 564 item->SetInteger("strength", cellular_networks[i]->strength()); | |
| 565 item->SetString("operator_name", cellular_networks[i]->operator_name()); | |
| 566 item->SetString("operator_code", cellular_networks[i]->operator_code()); | |
| 567 item->SetString("network_technology", | |
| 568 cellular_networks[i]->GetNetworkTechnologyString()); | |
| 569 item->SetString("activation_state", | |
| 570 cellular_networks[i]->GetActivationStateString()); | |
| 571 item->SetString("roaming_state", | |
| 572 cellular_networks[i]->GetRoamingStateString()); | |
| 573 items->Set(cellular_networks[i]->service_path(), item); | |
| 574 } | |
| 575 items->SetInteger("network_type", chromeos::TYPE_CELLULAR); | |
| 576 return_value->Set("cellular_networks", items); | |
| 577 } | |
| 578 | |
| 579 // Remembered Wifi Networks. | |
| 580 const chromeos::WifiNetworkVector& remembered_wifi = | |
| 581 network_library->remembered_wifi_networks(); | |
| 582 DictionaryValue* remembered_wifi_items = new DictionaryValue; | |
| 583 for (chromeos::WifiNetworkVector::const_iterator iter = | |
| 584 remembered_wifi.begin(); iter != remembered_wifi.end(); | |
| 585 ++iter) { | |
| 586 const chromeos::WifiNetwork* wifi = *iter; | |
| 587 DictionaryValue* item = GetWifiInfoDict(wifi); | |
| 588 remembered_wifi_items->Set(wifi->service_path(), item); | |
| 589 } | |
| 590 remembered_wifi_items->SetInteger("network_type", chromeos::TYPE_WIFI); | |
| 591 return_value->Set("remembered_wifi", remembered_wifi_items); | |
| 592 | |
| 593 AutomationJSONReply(this, reply_message).SendSuccess(return_value.get()); | |
| 594 } | |
| 595 | |
| 596 void TestingAutomationProvider::NetworkScan(DictionaryValue* args, | |
| 597 IPC::Message* reply_message) { | |
| 598 NetworkLibrary* network_library = NetworkLibrary::Get(); | |
| 599 network_library->RequestNetworkScan(); | |
| 600 | |
| 601 // Set up an observer (it will delete itself). | |
| 602 new NetworkScanObserver(this, reply_message); | |
| 603 } | |
| 604 | |
| 605 void TestingAutomationProvider::ToggleNetworkDevice( | |
| 606 DictionaryValue* args, IPC::Message* reply_message) { | |
| 607 AutomationJSONReply reply(this, reply_message); | |
| 608 std::string device; | |
| 609 bool enable; | |
| 610 if (!args->GetString("device", &device) || | |
| 611 !args->GetBoolean("enable", &enable)) { | |
| 612 reply.SendError("Invalid or missing args."); | |
| 613 return; | |
| 614 } | |
| 615 | |
| 616 // Set up an observer (it will delete itself). | |
| 617 new ToggleNetworkDeviceObserver(this, reply_message, device, enable); | |
| 618 | |
| 619 NetworkLibrary* network_library = NetworkLibrary::Get(); | |
| 620 if (device == "ethernet") { | |
| 621 network_library->EnableEthernetNetworkDevice(enable); | |
| 622 } else if (device == "wifi") { | |
| 623 network_library->EnableWifiNetworkDevice(enable); | |
| 624 } else if (device == "cellular") { | |
| 625 network_library->EnableCellularNetworkDevice(enable); | |
| 626 } else { | |
| 627 reply.SendError( | |
| 628 "Unknown device. Valid devices are ethernet, wifi, cellular."); | |
| 629 return; | |
| 630 } | |
| 631 } | |
| 632 | |
| 633 void TestingAutomationProvider::ForgetWifiNetwork( | |
| 634 DictionaryValue* args, IPC::Message* reply_message) { | |
| 635 std::string service_path; | |
| 636 if (!args->GetString("service_path", &service_path)) { | |
| 637 AutomationJSONReply(this, reply_message).SendError( | |
| 638 "Invalid or missing args."); | |
| 639 return; | |
| 640 } | |
| 641 | |
| 642 NetworkLibrary::Get()->ForgetNetwork(service_path); | |
| 643 AutomationJSONReply(this, reply_message).SendSuccess(NULL); | |
| 644 } | |
| 645 | |
| 646 void TestingAutomationProvider::ConnectToHiddenWifiNetwork( | |
| 647 DictionaryValue* args, IPC::Message* reply_message) { | |
| 648 std::string ssid, security, password; | |
| 649 bool shared; | |
| 650 if (!args->GetString("ssid", &ssid) || | |
| 651 !args->GetString("security", &security) || | |
| 652 !args->GetString("password", &password) || | |
| 653 !args->GetBoolean("shared", &shared)) { | |
| 654 AutomationJSONReply(this, reply_message).SendError( | |
| 655 "Invalid or missing args."); | |
| 656 return; | |
| 657 } | |
| 658 | |
| 659 std::map<std::string, chromeos::ConnectionSecurity> connection_security_map; | |
| 660 connection_security_map["SECURITY_NONE"] = chromeos::SECURITY_NONE; | |
| 661 connection_security_map["SECURITY_WEP"] = chromeos::SECURITY_WEP; | |
| 662 connection_security_map["SECURITY_WPA"] = chromeos::SECURITY_WPA; | |
| 663 connection_security_map["SECURITY_RSN"] = chromeos::SECURITY_RSN; | |
| 664 connection_security_map["SECURITY_8021X"] = chromeos::SECURITY_8021X; | |
| 665 | |
| 666 if (connection_security_map.find(security) == connection_security_map.end()) { | |
| 667 AutomationJSONReply(this, reply_message).SendError( | |
| 668 "Unknown security type."); | |
| 669 return; | |
| 670 } | |
| 671 chromeos::ConnectionSecurity connection_security = | |
| 672 connection_security_map[security]; | |
| 673 | |
| 674 NetworkLibrary* network_library = NetworkLibrary::Get(); | |
| 675 | |
| 676 // Set up an observer (it will delete itself). | |
| 677 new SSIDConnectObserver(this, reply_message, ssid); | |
| 678 | |
| 679 bool save_credentials = false; | |
| 680 | |
| 681 if (connection_security == chromeos::SECURITY_8021X) { | |
| 682 chromeos::NetworkLibrary::EAPConfigData config_data; | |
| 683 std::string eap_method, eap_auth, eap_identity; | |
| 684 if (!args->GetString("eap_method", &eap_method) || | |
| 685 !args->GetString("eap_auth", &eap_auth) || | |
| 686 !args->GetString("eap_identity", &eap_identity) || | |
| 687 !args->GetBoolean("save_credentials", &save_credentials)) { | |
| 688 AutomationJSONReply(this, reply_message).SendError( | |
| 689 "Invalid or missing EAP args."); | |
| 690 return; | |
| 691 } | |
| 692 | |
| 693 std::map<std::string, chromeos::EAPMethod> eap_method_map; | |
| 694 eap_method_map["EAP_METHOD_NONE"] = chromeos::EAP_METHOD_UNKNOWN; | |
| 695 eap_method_map["EAP_METHOD_PEAP"] = chromeos::EAP_METHOD_PEAP; | |
| 696 eap_method_map["EAP_METHOD_TLS"] = chromeos::EAP_METHOD_TLS; | |
| 697 eap_method_map["EAP_METHOD_TTLS"] = chromeos::EAP_METHOD_TTLS; | |
| 698 eap_method_map["EAP_METHOD_LEAP"] = chromeos::EAP_METHOD_LEAP; | |
| 699 if (eap_method_map.find(eap_method) == eap_method_map.end()) { | |
| 700 AutomationJSONReply(this, reply_message).SendError( | |
| 701 "Unknown EAP Method type."); | |
| 702 return; | |
| 703 } | |
| 704 config_data.method = eap_method_map[eap_method]; | |
| 705 | |
| 706 std::map<std::string, chromeos::EAPPhase2Auth> eap_auth_map; | |
| 707 eap_auth_map["EAP_PHASE_2_AUTH_AUTO"] = chromeos::EAP_PHASE_2_AUTH_AUTO; | |
| 708 eap_auth_map["EAP_PHASE_2_AUTH_MD5"] = chromeos::EAP_PHASE_2_AUTH_MD5; | |
| 709 eap_auth_map["EAP_PHASE_2_AUTH_MSCHAP"] = | |
| 710 chromeos::EAP_PHASE_2_AUTH_MSCHAP; | |
| 711 eap_auth_map["EAP_PHASE_2_AUTH_MSCHAPV2"] = | |
| 712 chromeos::EAP_PHASE_2_AUTH_MSCHAPV2; | |
| 713 eap_auth_map["EAP_PHASE_2_AUTH_PAP"] = chromeos::EAP_PHASE_2_AUTH_PAP; | |
| 714 eap_auth_map["EAP_PHASE_2_AUTH_CHAP"] = chromeos::EAP_PHASE_2_AUTH_CHAP; | |
| 715 if (eap_auth_map.find(eap_auth) == eap_auth_map.end()) { | |
| 716 AutomationJSONReply(this, reply_message).SendError( | |
| 717 "Unknown EAP Phase2 Auth type."); | |
| 718 return; | |
| 719 } | |
| 720 config_data.auth = eap_auth_map[eap_auth]; | |
| 721 | |
| 722 config_data.identity = eap_identity; | |
| 723 | |
| 724 // TODO(stevenjb): Parse cert values? | |
| 725 config_data.use_system_cas = false; | |
| 726 config_data.client_cert_pkcs11_id = ""; | |
| 727 | |
| 728 network_library->ConnectToUnconfiguredWifiNetwork( | |
| 729 ssid, chromeos::SECURITY_8021X, password, &config_data, | |
| 730 save_credentials, shared); | |
| 731 } else { | |
| 732 network_library->ConnectToUnconfiguredWifiNetwork( | |
| 733 ssid, connection_security, password, NULL, | |
| 734 save_credentials, shared); | |
| 735 } | |
| 736 } | |
| 737 | |
| 738 void TestingAutomationProvider::ExecuteJavascriptInOOBEWebUI( | 437 void TestingAutomationProvider::ExecuteJavascriptInOOBEWebUI( |
| 739 DictionaryValue* args, IPC::Message* reply_message) { | 438 DictionaryValue* args, IPC::Message* reply_message) { |
| 740 std::string javascript, frame_xpath; | 439 std::string javascript, frame_xpath; |
| 741 if (!args->GetString("javascript", &javascript)) { | 440 if (!args->GetString("javascript", &javascript)) { |
| 742 AutomationJSONReply(this, reply_message) | 441 AutomationJSONReply(this, reply_message) |
| 743 .SendError("'javascript' missing or invalid"); | 442 .SendError("'javascript' missing or invalid"); |
| 744 return; | 443 return; |
| 745 } | 444 } |
| 746 if (!args->GetString("frame_xpath", &frame_xpath)) { | 445 if (!args->GetString("frame_xpath", &frame_xpath)) { |
| 747 AutomationJSONReply(this, reply_message) | 446 AutomationJSONReply(this, reply_message) |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 906 | 605 |
| 907 void TestingAutomationProvider::AddChromeosObservers() { | 606 void TestingAutomationProvider::AddChromeosObservers() { |
| 908 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()-> | 607 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()-> |
| 909 AddObserver(this); | 608 AddObserver(this); |
| 910 } | 609 } |
| 911 | 610 |
| 912 void TestingAutomationProvider::RemoveChromeosObservers() { | 611 void TestingAutomationProvider::RemoveChromeosObservers() { |
| 913 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()-> | 612 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()-> |
| 914 RemoveObserver(this); | 613 RemoveObserver(this); |
| 915 } | 614 } |
| OLD | NEW |