Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(384)

Side by Side Diff: chrome/browser/chromeos/options/wifi_config_view.cc

Issue 2434683003: Move NetworkStateNotifier and NetworkConnect from src/ui (Closed)
Patch Set: Fix virtuals Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/strings/string_util.h" 11 #include "base/strings/string_util.h"
12 #include "base/strings/stringprintf.h" 12 #include "base/strings/stringprintf.h"
13 #include "base/strings/utf_string_conversions.h" 13 #include "base/strings/utf_string_conversions.h"
14 #include "chrome/browser/chromeos/enrollment_dialog_view.h" 14 #include "chrome/browser/chromeos/enrollment_dialog_view.h"
15 #include "chrome/browser/chromeos/net/onc_utils.h" 15 #include "chrome/browser/chromeos/net/onc_utils.h"
16 #include "chrome/browser/chromeos/net/shill_error.h"
16 #include "chrome/browser/chromeos/options/passphrase_textfield.h" 17 #include "chrome/browser/chromeos/options/passphrase_textfield.h"
17 #include "chrome/browser/profiles/profile_manager.h" 18 #include "chrome/browser/profiles/profile_manager.h"
18 #include "chrome/grit/generated_resources.h" 19 #include "chrome/grit/generated_resources.h"
19 #include "chrome/grit/theme_resources.h" 20 #include "chrome/grit/theme_resources.h"
20 #include "chromeos/login/login_state.h" 21 #include "chromeos/login/login_state.h"
21 #include "chromeos/network/client_cert_util.h" 22 #include "chromeos/network/client_cert_util.h"
22 #include "chromeos/network/network_configuration_handler.h" 23 #include "chromeos/network/network_configuration_handler.h"
24 #include "chromeos/network/network_connect.h"
23 #include "chromeos/network/network_event_log.h" 25 #include "chromeos/network/network_event_log.h"
24 #include "chromeos/network/network_handler.h" 26 #include "chromeos/network/network_handler.h"
25 #include "chromeos/network/network_state.h" 27 #include "chromeos/network/network_state.h"
26 #include "chromeos/network/network_state_handler.h" 28 #include "chromeos/network/network_state_handler.h"
27 #include "chromeos/network/network_ui_data.h" 29 #include "chromeos/network/network_ui_data.h"
28 #include "chromeos/network/shill_property_util.h" 30 #include "chromeos/network/shill_property_util.h"
29 #include "components/onc/onc_constants.h" 31 #include "components/onc/onc_constants.h"
30 #include "third_party/cros_system_api/dbus/service_constants.h" 32 #include "third_party/cros_system_api/dbus/service_constants.h"
31 #include "ui/base/l10n/l10n_util.h" 33 #include "ui/base/l10n/l10n_util.h"
32 #include "ui/base/resource/resource_bundle.h" 34 #include "ui/base/resource/resource_bundle.h"
33 #include "ui/chromeos/network/network_connect.h"
34 #include "ui/events/event.h" 35 #include "ui/events/event.h"
35 #include "ui/views/controls/button/checkbox.h" 36 #include "ui/views/controls/button/checkbox.h"
36 #include "ui/views/controls/button/image_button.h" 37 #include "ui/views/controls/button/image_button.h"
37 #include "ui/views/controls/combobox/combobox.h" 38 #include "ui/views/controls/combobox/combobox.h"
38 #include "ui/views/controls/label.h" 39 #include "ui/views/controls/label.h"
39 #include "ui/views/controls/textfield/textfield.h" 40 #include "ui/views/controls/textfield/textfield.h"
40 #include "ui/views/layout/grid_layout.h" 41 #include "ui/views/layout/grid_layout.h"
41 #include "ui/views/layout/layout_constants.h" 42 #include "ui/views/layout/layout_constants.h"
42 #include "ui/views/widget/widget.h" 43 #include "ui/views/widget/widget.h"
43 #include "ui/views/window/dialog_client_view.h" 44 #include "ui/views/window/dialog_client_view.h"
(...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after
585 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_PLEASE_INSTALL_USER_CERT); 586 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_PLEASE_INSTALL_USER_CERT);
586 } 587 }
587 } else if (!IsUserCertValid()) { 588 } else if (!IsUserCertValid()) {
588 error_msg = l10n_util::GetStringUTF16( 589 error_msg = l10n_util::GetStringUTF16(
589 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_REQUIRE_HARDWARE_BACKED); 590 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_REQUIRE_HARDWARE_BACKED);
590 } 591 }
591 } 592 }
592 if (error_msg.empty() && !service_path_.empty()) { 593 if (error_msg.empty() && !service_path_.empty()) {
593 const NetworkState* network = GetNetworkState(); 594 const NetworkState* network = GetNetworkState();
594 if (network && network->connection_state() == shill::kStateFailure) { 595 if (network && network->connection_state() == shill::kStateFailure) {
595 error_msg = ui::NetworkConnect::Get()->GetShillErrorString( 596 error_msg = shill_error::GetShillErrorString(network->last_error(),
596 network->last_error(), network->path()); 597 network->guid());
597 } 598 }
598 } 599 }
599 if (!error_msg.empty()) { 600 if (!error_msg.empty()) {
600 error_label_->SetText(error_msg); 601 error_label_->SetText(error_msg);
601 error_label_->SetVisible(true); 602 error_label_->SetVisible(true);
602 } else { 603 } else {
603 error_label_->SetVisible(false); 604 error_label_->SetVisible(false);
604 } 605 }
605 } 606 }
606 607
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
703 shill::kPassphraseProperty, GetPassphrase()); 704 shill::kPassphraseProperty, GetPassphrase());
704 } 705 }
705 } else { 706 } else {
706 security_class = shill::kSecurity8021x; 707 security_class = shill::kSecurity8021x;
707 SetEapProperties(&properties, false /* not configured */); 708 SetEapProperties(&properties, false /* not configured */);
708 } 709 }
709 properties.SetStringWithoutPathExpansion( 710 properties.SetStringWithoutPathExpansion(
710 shill::kSecurityClassProperty, security_class); 711 shill::kSecurityClassProperty, security_class);
711 712
712 // Configure and connect to network. 713 // Configure and connect to network.
713 ui::NetworkConnect::Get()->CreateConfigurationAndConnect(&properties, 714 NetworkConnect::Get()->CreateConfigurationAndConnect(&properties,
714 share_network); 715 share_network);
715 } else { 716 } else {
716 if (!network) { 717 if (!network) {
717 // Shill no longer knows about this network (edge case). 718 // Shill no longer knows about this network (edge case).
718 // TODO(stevenjb): Add notification for this. 719 // TODO(stevenjb): Add notification for this.
719 NET_LOG_ERROR("Network not found", service_path_); 720 NET_LOG_ERROR("Network not found", service_path_);
720 return true; // Close dialog 721 return true; // Close dialog
721 } 722 }
722 if (eap_method_combobox_) { 723 if (eap_method_combobox_) {
723 SetEapProperties(&properties, true /* configured */); 724 SetEapProperties(&properties, true /* configured */);
724 properties.SetBooleanWithoutPathExpansion( 725 properties.SetBooleanWithoutPathExpansion(
725 shill::kSaveCredentialsProperty, GetSaveCredentials()); 726 shill::kSaveCredentialsProperty, GetSaveCredentials());
726 } else { 727 } else {
727 const std::string passphrase = GetPassphrase(); 728 const std::string passphrase = GetPassphrase();
728 if (!passphrase.empty()) { 729 if (!passphrase.empty()) {
729 properties.SetStringWithoutPathExpansion( 730 properties.SetStringWithoutPathExpansion(
730 shill::kPassphraseProperty, passphrase); 731 shill::kPassphraseProperty, passphrase);
731 } 732 }
732 } 733 }
733 if (network->type() == shill::kTypeEthernet) { 734 if (network->type() == shill::kTypeEthernet) {
734 // When configuring an ethernet service, we actually configure the 735 // When configuring an ethernet service, we actually configure the
735 // EthernetEap service, which exists in the Profile only. 736 // EthernetEap service, which exists in the Profile only.
736 // See crbug.com/126870 for more info. 737 // See crbug.com/126870 for more info.
737 properties.SetStringWithoutPathExpansion(shill::kTypeProperty, 738 properties.SetStringWithoutPathExpansion(shill::kTypeProperty,
738 shill::kTypeEthernetEap); 739 shill::kTypeEthernetEap);
739 share_network = false; 740 share_network = false;
740 ui::NetworkConnect::Get()->CreateConfiguration(&properties, 741 NetworkConnect::Get()->CreateConfiguration(&properties, share_network);
741 share_network);
742 } else { 742 } else {
743 ui::NetworkConnect::Get()->ConfigureNetworkAndConnect( 743 NetworkConnect::Get()->ConfigureNetworkAndConnect(
744 service_path_, properties, share_network); 744 service_path_, properties, share_network);
745 } 745 }
746 } 746 }
747 return true; // dialog will be closed 747 return true; // dialog will be closed
748 } 748 }
749 749
750 std::string WifiConfigView::GetSsid() const { 750 std::string WifiConfigView::GetSsid() const {
751 std::string result; 751 std::string result;
752 if (ssid_textfield_ != NULL) { 752 if (ssid_textfield_ != NULL) {
753 std::string untrimmed = base::UTF16ToUTF8(ssid_textfield_->text()); 753 std::string untrimmed = base::UTF16ToUTF8(ssid_textfield_->text());
(...skipping 631 matching lines...) Expand 10 before | Expand all | Expand 10 after
1385 void WifiConfigView::ParseEAPUIProperty(NetworkPropertyUIData* property_ui_data, 1385 void WifiConfigView::ParseEAPUIProperty(NetworkPropertyUIData* property_ui_data,
1386 const NetworkState* network, 1386 const NetworkState* network,
1387 const std::string& key) { 1387 const std::string& key) {
1388 std::string onc_tag = network->type() == shill::kTypeEthernet 1388 std::string onc_tag = network->type() == shill::kTypeEthernet
1389 ? ::onc::ethernet::kEAP 1389 ? ::onc::ethernet::kEAP
1390 : ::onc::wifi::kEAP; 1390 : ::onc::wifi::kEAP;
1391 ParseUIProperty(property_ui_data, network, onc_tag + '.' + key); 1391 ParseUIProperty(property_ui_data, network, onc_tag + '.' + key);
1392 } 1392 }
1393 1393
1394 } // namespace chromeos 1394 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/options/vpn_config_view.cc ('k') | chrome/browser/chromeos/options/wimax_config_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698