| 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/chromeos/options/wifi_config_view.h" | 5 #include "chrome/browser/chromeos/options/wifi_config_view.h" |
| 6 | 6 |
| 7 #include "ash/system/chromeos/network/network_connect.h" | |
| 8 #include "base/bind.h" | 7 #include "base/bind.h" |
| 9 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
| 10 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
| 11 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| 12 #include "chrome/browser/chromeos/enrollment_dialog_view.h" | 11 #include "chrome/browser/chromeos/enrollment_dialog_view.h" |
| 13 #include "chrome/browser/chromeos/net/onc_utils.h" | 12 #include "chrome/browser/chromeos/net/onc_utils.h" |
| 14 #include "chrome/browser/chromeos/options/passphrase_textfield.h" | 13 #include "chrome/browser/chromeos/options/passphrase_textfield.h" |
| 15 #include "chrome/browser/profiles/profile_manager.h" | 14 #include "chrome/browser/profiles/profile_manager.h" |
| 16 #include "chrome/grit/generated_resources.h" | 15 #include "chrome/grit/generated_resources.h" |
| 17 #include "chrome/grit/theme_resources.h" | 16 #include "chrome/grit/theme_resources.h" |
| 18 #include "chromeos/login/login_state.h" | 17 #include "chromeos/login/login_state.h" |
| 19 #include "chromeos/network/client_cert_util.h" | 18 #include "chromeos/network/client_cert_util.h" |
| 20 #include "chromeos/network/network_configuration_handler.h" | 19 #include "chromeos/network/network_configuration_handler.h" |
| 21 #include "chromeos/network/network_event_log.h" | 20 #include "chromeos/network/network_event_log.h" |
| 22 #include "chromeos/network/network_handler.h" | 21 #include "chromeos/network/network_handler.h" |
| 23 #include "chromeos/network/network_state.h" | 22 #include "chromeos/network/network_state.h" |
| 24 #include "chromeos/network/network_state_handler.h" | 23 #include "chromeos/network/network_state_handler.h" |
| 25 #include "chromeos/network/network_ui_data.h" | 24 #include "chromeos/network/network_ui_data.h" |
| 26 #include "chromeos/network/shill_property_util.h" | 25 #include "chromeos/network/shill_property_util.h" |
| 27 #include "components/onc/onc_constants.h" | 26 #include "components/onc/onc_constants.h" |
| 28 #include "third_party/cros_system_api/dbus/service_constants.h" | 27 #include "third_party/cros_system_api/dbus/service_constants.h" |
| 29 #include "ui/base/l10n/l10n_util.h" | 28 #include "ui/base/l10n/l10n_util.h" |
| 30 #include "ui/base/resource/resource_bundle.h" | 29 #include "ui/base/resource/resource_bundle.h" |
| 30 #include "ui/chromeos/network/network_connect.h" |
| 31 #include "ui/events/event.h" | 31 #include "ui/events/event.h" |
| 32 #include "ui/views/controls/button/checkbox.h" | 32 #include "ui/views/controls/button/checkbox.h" |
| 33 #include "ui/views/controls/button/image_button.h" | 33 #include "ui/views/controls/button/image_button.h" |
| 34 #include "ui/views/controls/combobox/combobox.h" | 34 #include "ui/views/controls/combobox/combobox.h" |
| 35 #include "ui/views/controls/label.h" | 35 #include "ui/views/controls/label.h" |
| 36 #include "ui/views/controls/textfield/textfield.h" | 36 #include "ui/views/controls/textfield/textfield.h" |
| 37 #include "ui/views/layout/grid_layout.h" | 37 #include "ui/views/layout/grid_layout.h" |
| 38 #include "ui/views/layout/layout_constants.h" | 38 #include "ui/views/layout/layout_constants.h" |
| 39 #include "ui/views/widget/widget.h" | 39 #include "ui/views/widget/widget.h" |
| 40 #include "ui/views/window/dialog_client_view.h" | 40 #include "ui/views/window/dialog_client_view.h" |
| (...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 581 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_PLEASE_INSTALL_USER_CERT); | 581 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_PLEASE_INSTALL_USER_CERT); |
| 582 } | 582 } |
| 583 } else if (!IsUserCertValid()) { | 583 } else if (!IsUserCertValid()) { |
| 584 error_msg = l10n_util::GetStringUTF16( | 584 error_msg = l10n_util::GetStringUTF16( |
| 585 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_REQUIRE_HARDWARE_BACKED); | 585 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_REQUIRE_HARDWARE_BACKED); |
| 586 } | 586 } |
| 587 } | 587 } |
| 588 if (error_msg.empty() && !service_path_.empty()) { | 588 if (error_msg.empty() && !service_path_.empty()) { |
| 589 const NetworkState* network = GetNetworkState(); | 589 const NetworkState* network = GetNetworkState(); |
| 590 if (network && network->connection_state() == shill::kStateFailure) { | 590 if (network && network->connection_state() == shill::kStateFailure) { |
| 591 error_msg = ash::NetworkConnect::Get()->GetErrorString( | 591 error_msg = ui::NetworkConnect::Get()->GetErrorString( |
| 592 network->last_error(), network->path()); | 592 network->last_error(), network->path()); |
| 593 } | 593 } |
| 594 } | 594 } |
| 595 if (!error_msg.empty()) { | 595 if (!error_msg.empty()) { |
| 596 error_label_->SetText(error_msg); | 596 error_label_->SetText(error_msg); |
| 597 error_label_->SetVisible(true); | 597 error_label_->SetVisible(true); |
| 598 } else { | 598 } else { |
| 599 error_label_->SetVisible(false); | 599 error_label_->SetVisible(false); |
| 600 } | 600 } |
| 601 } | 601 } |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 698 shill::kPassphraseProperty, GetPassphrase()); | 698 shill::kPassphraseProperty, GetPassphrase()); |
| 699 } | 699 } |
| 700 } else { | 700 } else { |
| 701 security = shill::kSecurity8021x; | 701 security = shill::kSecurity8021x; |
| 702 SetEapProperties(&properties, false /* not configured */); | 702 SetEapProperties(&properties, false /* not configured */); |
| 703 } | 703 } |
| 704 properties.SetStringWithoutPathExpansion( | 704 properties.SetStringWithoutPathExpansion( |
| 705 shill::kSecurityProperty, security); | 705 shill::kSecurityProperty, security); |
| 706 | 706 |
| 707 // Configure and connect to network. | 707 // Configure and connect to network. |
| 708 ash::NetworkConnect::Get()->CreateConfigurationAndConnect(&properties, | 708 ui::NetworkConnect::Get()->CreateConfigurationAndConnect(&properties, |
| 709 share_network); | 709 share_network); |
| 710 } else { | 710 } else { |
| 711 if (!network) { | 711 if (!network) { |
| 712 // Shill no longer knows about this network (edge case). | 712 // Shill no longer knows about this network (edge case). |
| 713 // TODO(stevenjb): Add notification for this. | 713 // TODO(stevenjb): Add notification for this. |
| 714 NET_LOG_ERROR("Network not found", service_path_); | 714 NET_LOG_ERROR("Network not found", service_path_); |
| 715 return true; // Close dialog | 715 return true; // Close dialog |
| 716 } | 716 } |
| 717 if (eap_method_combobox_) { | 717 if (eap_method_combobox_) { |
| 718 SetEapProperties(&properties, true /* configured */); | 718 SetEapProperties(&properties, true /* configured */); |
| 719 properties.SetBooleanWithoutPathExpansion( | 719 properties.SetBooleanWithoutPathExpansion( |
| 720 shill::kSaveCredentialsProperty, GetSaveCredentials()); | 720 shill::kSaveCredentialsProperty, GetSaveCredentials()); |
| 721 } else { | 721 } else { |
| 722 const std::string passphrase = GetPassphrase(); | 722 const std::string passphrase = GetPassphrase(); |
| 723 if (!passphrase.empty()) { | 723 if (!passphrase.empty()) { |
| 724 properties.SetStringWithoutPathExpansion( | 724 properties.SetStringWithoutPathExpansion( |
| 725 shill::kPassphraseProperty, passphrase); | 725 shill::kPassphraseProperty, passphrase); |
| 726 } | 726 } |
| 727 } | 727 } |
| 728 if (network->type() == shill::kTypeEthernet) { | 728 if (network->type() == shill::kTypeEthernet) { |
| 729 // When configuring an ethernet service, we actually configure the | 729 // When configuring an ethernet service, we actually configure the |
| 730 // EthernetEap service, which exists in the Profile only. | 730 // EthernetEap service, which exists in the Profile only. |
| 731 // See crbug.com/126870 for more info. | 731 // See crbug.com/126870 for more info. |
| 732 properties.SetStringWithoutPathExpansion(shill::kTypeProperty, | 732 properties.SetStringWithoutPathExpansion(shill::kTypeProperty, |
| 733 shill::kTypeEthernetEap); | 733 shill::kTypeEthernetEap); |
| 734 share_network = false; | 734 share_network = false; |
| 735 ash::NetworkConnect::Get()->CreateConfiguration(&properties, | 735 ui::NetworkConnect::Get()->CreateConfiguration(&properties, |
| 736 share_network); | 736 share_network); |
| 737 } else { | 737 } else { |
| 738 ash::NetworkConnect::Get()->ConfigureNetworkAndConnect( | 738 ui::NetworkConnect::Get()->ConfigureNetworkAndConnect( |
| 739 service_path_, properties, share_network); | 739 service_path_, properties, share_network); |
| 740 } | 740 } |
| 741 } | 741 } |
| 742 return true; // dialog will be closed | 742 return true; // dialog will be closed |
| 743 } | 743 } |
| 744 | 744 |
| 745 std::string WifiConfigView::GetSsid() const { | 745 std::string WifiConfigView::GetSsid() const { |
| 746 std::string result; | 746 std::string result; |
| 747 if (ssid_textfield_ != NULL) { | 747 if (ssid_textfield_ != NULL) { |
| 748 std::string untrimmed = base::UTF16ToUTF8(ssid_textfield_->text()); | 748 std::string untrimmed = base::UTF16ToUTF8(ssid_textfield_->text()); |
| (...skipping 630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1379 void WifiConfigView::ParseEAPUIProperty(NetworkPropertyUIData* property_ui_data, | 1379 void WifiConfigView::ParseEAPUIProperty(NetworkPropertyUIData* property_ui_data, |
| 1380 const NetworkState* network, | 1380 const NetworkState* network, |
| 1381 const std::string& key) { | 1381 const std::string& key) { |
| 1382 std::string onc_tag = network->type() == shill::kTypeEthernet | 1382 std::string onc_tag = network->type() == shill::kTypeEthernet |
| 1383 ? ::onc::ethernet::kEAP | 1383 ? ::onc::ethernet::kEAP |
| 1384 : ::onc::wifi::kEAP; | 1384 : ::onc::wifi::kEAP; |
| 1385 ParseUIProperty(property_ui_data, network, onc_tag + '.' + key); | 1385 ParseUIProperty(property_ui_data, network, onc_tag + '.' + key); |
| 1386 } | 1386 } |
| 1387 | 1387 |
| 1388 } // namespace chromeos | 1388 } // namespace chromeos |
| OLD | NEW |