| 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 <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/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
| 13 #include "chrome/browser/chromeos/enrollment_dialog_view.h" | 13 #include "chrome/browser/chromeos/enrollment_dialog_view.h" |
| 14 #include "chrome/browser/chromeos/net/shill_error.h" | 14 #include "chrome/browser/chromeos/net/shill_error.h" |
| 15 #include "chrome/browser/chromeos/options/passphrase_textfield.h" | 15 #include "chrome/browser/chromeos/options/passphrase_textfield.h" |
| 16 #include "chrome/browser/profiles/profile_manager.h" | 16 #include "chrome/browser/profiles/profile_manager.h" |
| 17 #include "chrome/browser/ui/views/harmony/layout_delegate.h" | |
| 18 #include "chrome/browser/ui/views/layout_utils.h" | 17 #include "chrome/browser/ui/views/layout_utils.h" |
| 19 #include "chrome/grit/generated_resources.h" | 18 #include "chrome/grit/generated_resources.h" |
| 20 #include "chrome/grit/theme_resources.h" | 19 #include "chrome/grit/theme_resources.h" |
| 21 #include "chromeos/login/login_state.h" | 20 #include "chromeos/login/login_state.h" |
| 22 #include "chromeos/network/client_cert_util.h" | 21 #include "chromeos/network/client_cert_util.h" |
| 23 #include "chromeos/network/network_configuration_handler.h" | 22 #include "chromeos/network/network_configuration_handler.h" |
| 24 #include "chromeos/network/network_connect.h" | 23 #include "chromeos/network/network_connect.h" |
| 25 #include "chromeos/network/network_event_log.h" | 24 #include "chromeos/network/network_event_log.h" |
| 26 #include "chromeos/network/network_handler.h" | 25 #include "chromeos/network/network_handler.h" |
| 27 #include "chromeos/network/network_state.h" | 26 #include "chromeos/network/network_state.h" |
| 28 #include "chromeos/network/network_state_handler.h" | 27 #include "chromeos/network/network_state_handler.h" |
| 29 #include "chromeos/network/network_ui_data.h" | 28 #include "chromeos/network/network_ui_data.h" |
| 30 #include "chromeos/network/onc/onc_utils.h" | 29 #include "chromeos/network/onc/onc_utils.h" |
| 31 #include "chromeos/network/shill_property_util.h" | 30 #include "chromeos/network/shill_property_util.h" |
| 32 #include "components/onc/onc_constants.h" | 31 #include "components/onc/onc_constants.h" |
| 33 #include "third_party/cros_system_api/dbus/service_constants.h" | 32 #include "third_party/cros_system_api/dbus/service_constants.h" |
| 34 #include "ui/base/l10n/l10n_util.h" | 33 #include "ui/base/l10n/l10n_util.h" |
| 35 #include "ui/base/material_design/material_design_controller.h" | 34 #include "ui/base/material_design/material_design_controller.h" |
| 36 #include "ui/base/resource/resource_bundle.h" | 35 #include "ui/base/resource/resource_bundle.h" |
| 37 #include "ui/events/event.h" | 36 #include "ui/events/event.h" |
| 38 #include "ui/views/controls/button/checkbox.h" | 37 #include "ui/views/controls/button/checkbox.h" |
| 39 #include "ui/views/controls/button/image_button.h" | 38 #include "ui/views/controls/button/image_button.h" |
| 40 #include "ui/views/controls/combobox/combobox.h" | 39 #include "ui/views/controls/combobox/combobox.h" |
| 41 #include "ui/views/controls/label.h" | 40 #include "ui/views/controls/label.h" |
| 42 #include "ui/views/controls/textfield/textfield.h" | 41 #include "ui/views/controls/textfield/textfield.h" |
| 43 #include "ui/views/layout/grid_layout.h" | 42 #include "ui/views/layout/grid_layout.h" |
| 43 #include "ui/views/layout/views_layout_delegate.h" |
| 44 #include "ui/views/widget/widget.h" | 44 #include "ui/views/widget/widget.h" |
| 45 #include "ui/views/window/dialog_client_view.h" | 45 #include "ui/views/window/dialog_client_view.h" |
| 46 | 46 |
| 47 namespace chromeos { | 47 namespace chromeos { |
| 48 | 48 |
| 49 namespace { | 49 namespace { |
| 50 | 50 |
| 51 // Combobox that supports a preferred width. Used by Server CA combobox | 51 // Combobox that supports a preferred width. Used by Server CA combobox |
| 52 // because the strings inside it are too wide. | 52 // because the strings inside it are too wide. |
| 53 class ComboboxWithWidth : public views::Combobox { | 53 class ComboboxWithWidth : public views::Combobox { |
| (...skipping 876 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 930 &identity_anonymous_ui_data_, network, ::onc::eap::kAnonymousIdentity); | 930 &identity_anonymous_ui_data_, network, ::onc::eap::kAnonymousIdentity); |
| 931 ParseEAPUIProperty( | 931 ParseEAPUIProperty( |
| 932 &save_credentials_ui_data_, network, ::onc::eap::kSaveCredentials); | 932 &save_credentials_ui_data_, network, ::onc::eap::kSaveCredentials); |
| 933 if (show_8021x) | 933 if (show_8021x) |
| 934 ParseEAPUIProperty(&passphrase_ui_data_, network, ::onc::eap::kPassword); | 934 ParseEAPUIProperty(&passphrase_ui_data_, network, ::onc::eap::kPassword); |
| 935 else | 935 else |
| 936 ParseUIProperty(&passphrase_ui_data_, network, ::onc::wifi::kPassphrase); | 936 ParseUIProperty(&passphrase_ui_data_, network, ::onc::wifi::kPassphrase); |
| 937 } | 937 } |
| 938 | 938 |
| 939 views::GridLayout* layout = layout_utils::CreatePanelLayout(this); | 939 views::GridLayout* layout = layout_utils::CreatePanelLayout(this); |
| 940 LayoutDelegate* delegate = LayoutDelegate::Get(); | 940 views::ViewsLayoutDelegate* delegate = views::ViewsLayoutDelegate::Get(); |
| 941 | 941 |
| 942 const int column_view_set_id = 0; | 942 const int column_view_set_id = 0; |
| 943 views::ColumnSet* column_set = layout->AddColumnSet(column_view_set_id); | 943 views::ColumnSet* column_set = layout->AddColumnSet(column_view_set_id); |
| 944 const int kPasswordVisibleWidth = 20; | 944 const int kPasswordVisibleWidth = 20; |
| 945 // Label | 945 // Label |
| 946 if (ui::MaterialDesignController::IsSecondaryUiMaterial()) { | 946 if (ui::MaterialDesignController::IsSecondaryUiMaterial()) { |
| 947 // This constant ensures the minimum width of the label column and ensures | 947 // This constant ensures the minimum width of the label column and ensures |
| 948 // the width of the Wifi dialog equals 512. | 948 // the width of the Wifi dialog equals 512. |
| 949 const int kLabelMinWidth = 158; | 949 const int kLabelMinWidth = 158; |
| 950 column_set->AddColumn(views::GridLayout::LEADING, views::GridLayout::FILL, | 950 column_set->AddColumn(views::GridLayout::LEADING, views::GridLayout::FILL, |
| 951 1, views::GridLayout::USE_PREF, 0, kLabelMinWidth); | 951 1, views::GridLayout::USE_PREF, 0, kLabelMinWidth); |
| 952 } else { | 952 } else { |
| 953 column_set->AddColumn(views::GridLayout::LEADING, views::GridLayout::FILL, | 953 column_set->AddColumn(views::GridLayout::LEADING, views::GridLayout::FILL, |
| 954 1, views::GridLayout::USE_PREF, 0, 0); | 954 1, views::GridLayout::USE_PREF, 0, 0); |
| 955 } | 955 } |
| 956 column_set->AddPaddingColumn( | 956 column_set->AddPaddingColumn( |
| 957 0, delegate->GetMetric( | 957 0, delegate->GetDistanceMetric( |
| 958 LayoutDelegate::Metric::RELATED_CONTROL_HORIZONTAL_SPACING)); | 958 views::DistanceMetric::RELATED_CONTROL_HORIZONTAL)); |
| 959 // Textfield, combobox. | 959 // Textfield, combobox. |
| 960 column_set->AddColumn(views::GridLayout::FILL, views::GridLayout::FILL, 1, | 960 column_set->AddColumn(views::GridLayout::FILL, views::GridLayout::FILL, 1, |
| 961 views::GridLayout::USE_PREF, 0, | 961 views::GridLayout::USE_PREF, 0, |
| 962 ChildNetworkConfigView::kInputFieldMinWidth); | 962 ChildNetworkConfigView::kInputFieldMinWidth); |
| 963 column_set->AddPaddingColumn( | 963 column_set->AddPaddingColumn( |
| 964 0, delegate->GetMetric( | 964 0, delegate->GetDistanceMetric( |
| 965 LayoutDelegate::Metric::RELATED_CONTROL_HORIZONTAL_SPACING)); | 965 views::DistanceMetric::RELATED_CONTROL_HORIZONTAL)); |
| 966 // Password visible button / policy indicator. | 966 // Password visible button / policy indicator. |
| 967 column_set->AddColumn(views::GridLayout::CENTER, views::GridLayout::FILL, 0, | 967 column_set->AddColumn(views::GridLayout::CENTER, views::GridLayout::FILL, 0, |
| 968 views::GridLayout::FIXED, kPasswordVisibleWidth, 0); | 968 views::GridLayout::FIXED, kPasswordVisibleWidth, 0); |
| 969 | 969 |
| 970 // SSID input | 970 // SSID input |
| 971 if (!network || network->type() != shill::kTypeEthernet) { | 971 if (!network || network->type() != shill::kTypeEthernet) { |
| 972 layout->StartRow(0, column_view_set_id); | 972 layout->StartRow(0, column_view_set_id); |
| 973 layout->AddView(new views::Label(l10n_util::GetStringUTF16( | 973 layout->AddView(new views::Label(l10n_util::GetStringUTF16( |
| 974 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_NETWORK_ID))); | 974 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_NETWORK_ID))); |
| 975 if (!network) { | 975 if (!network) { |
| 976 ssid_textfield_ = new views::Textfield(); | 976 ssid_textfield_ = new views::Textfield(); |
| 977 ssid_textfield_->set_controller(this); | 977 ssid_textfield_->set_controller(this); |
| 978 ssid_textfield_->SetAccessibleName(l10n_util::GetStringUTF16( | 978 ssid_textfield_->SetAccessibleName(l10n_util::GetStringUTF16( |
| 979 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_NETWORK_ID)); | 979 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_NETWORK_ID)); |
| 980 if (ui::MaterialDesignController::IsSecondaryUiMaterial()) { | 980 if (ui::MaterialDesignController::IsSecondaryUiMaterial()) { |
| 981 layout->AddView(ssid_textfield_, 1, 1, views::GridLayout::FILL, | 981 layout->AddView(ssid_textfield_, 1, 1, views::GridLayout::FILL, |
| 982 views::GridLayout::FILL, 0, | 982 views::GridLayout::FILL, 0, |
| 983 ChildNetworkConfigView::kInputFieldHeight); | 983 ChildNetworkConfigView::kInputFieldHeight); |
| 984 } else { | 984 } else { |
| 985 layout->AddView(ssid_textfield_); | 985 layout->AddView(ssid_textfield_); |
| 986 } | 986 } |
| 987 } else { | 987 } else { |
| 988 views::Label* label = | 988 views::Label* label = |
| 989 new views::Label(base::UTF8ToUTF16(network->name())); | 989 new views::Label(base::UTF8ToUTF16(network->name())); |
| 990 label->SetHorizontalAlignment(gfx::ALIGN_LEFT); | 990 label->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
| 991 layout->AddView(label); | 991 layout->AddView(label); |
| 992 } | 992 } |
| 993 layout->AddPaddingRow( | 993 layout->AddPaddingRow(0, |
| 994 0, delegate->GetMetric( | 994 delegate->GetDistanceMetric( |
| 995 LayoutDelegate::Metric::RELATED_CONTROL_VERTICAL_SPACING)); | 995 views::DistanceMetric::RELATED_CONTROL_VERTICAL)); |
| 996 } | 996 } |
| 997 | 997 |
| 998 // Security select | 998 // Security select |
| 999 if (!network && !show_8021x) { | 999 if (!network && !show_8021x) { |
| 1000 layout->StartRow(0, column_view_set_id); | 1000 layout->StartRow(0, column_view_set_id); |
| 1001 base::string16 label_text = l10n_util::GetStringUTF16( | 1001 base::string16 label_text = l10n_util::GetStringUTF16( |
| 1002 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_SECURITY); | 1002 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_SECURITY); |
| 1003 layout->AddView(new views::Label(label_text)); | 1003 layout->AddView(new views::Label(label_text)); |
| 1004 security_combobox_model_.reset(new internal::SecurityComboboxModel); | 1004 security_combobox_model_.reset(new internal::SecurityComboboxModel); |
| 1005 security_combobox_ = new views::Combobox(security_combobox_model_.get()); | 1005 security_combobox_ = new views::Combobox(security_combobox_model_.get()); |
| 1006 security_combobox_->SetAccessibleName(label_text); | 1006 security_combobox_->SetAccessibleName(label_text); |
| 1007 security_combobox_->set_listener(this); | 1007 security_combobox_->set_listener(this); |
| 1008 if (ui::MaterialDesignController::IsSecondaryUiMaterial()) { | 1008 if (ui::MaterialDesignController::IsSecondaryUiMaterial()) { |
| 1009 layout->AddView(security_combobox_, 1, 1, views::GridLayout::FILL, | 1009 layout->AddView(security_combobox_, 1, 1, views::GridLayout::FILL, |
| 1010 views::GridLayout::FILL, 0, | 1010 views::GridLayout::FILL, 0, |
| 1011 ChildNetworkConfigView::kInputFieldHeight); | 1011 ChildNetworkConfigView::kInputFieldHeight); |
| 1012 } else { | 1012 } else { |
| 1013 layout->AddView(security_combobox_); | 1013 layout->AddView(security_combobox_); |
| 1014 } | 1014 } |
| 1015 layout->AddView(security_combobox_); | 1015 layout->AddView(security_combobox_); |
| 1016 layout->AddPaddingRow( | 1016 layout->AddPaddingRow(0, |
| 1017 0, delegate->GetMetric( | 1017 delegate->GetDistanceMetric( |
| 1018 LayoutDelegate::Metric::RELATED_CONTROL_VERTICAL_SPACING)); | 1018 views::DistanceMetric::RELATED_CONTROL_VERTICAL)); |
| 1019 } | 1019 } |
| 1020 | 1020 |
| 1021 // Only enumerate certificates in the data model for 802.1X networks. | 1021 // Only enumerate certificates in the data model for 802.1X networks. |
| 1022 if (show_8021x) { | 1022 if (show_8021x) { |
| 1023 // Observer any changes to the certificate list. | 1023 // Observer any changes to the certificate list. |
| 1024 CertLibrary::Get()->AddObserver(this); | 1024 CertLibrary::Get()->AddObserver(this); |
| 1025 | 1025 |
| 1026 // EAP method | 1026 // EAP method |
| 1027 layout->StartRow(0, column_view_set_id); | 1027 layout->StartRow(0, column_view_set_id); |
| 1028 base::string16 eap_label_text = l10n_util::GetStringUTF16( | 1028 base::string16 eap_label_text = l10n_util::GetStringUTF16( |
| 1029 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_EAP_METHOD); | 1029 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_EAP_METHOD); |
| 1030 layout->AddView(new views::Label(eap_label_text)); | 1030 layout->AddView(new views::Label(eap_label_text)); |
| 1031 eap_method_combobox_model_.reset(new internal::EAPMethodComboboxModel); | 1031 eap_method_combobox_model_.reset(new internal::EAPMethodComboboxModel); |
| 1032 eap_method_combobox_ = new views::Combobox( | 1032 eap_method_combobox_ = new views::Combobox( |
| 1033 eap_method_combobox_model_.get()); | 1033 eap_method_combobox_model_.get()); |
| 1034 eap_method_combobox_->SetAccessibleName(eap_label_text); | 1034 eap_method_combobox_->SetAccessibleName(eap_label_text); |
| 1035 eap_method_combobox_->set_listener(this); | 1035 eap_method_combobox_->set_listener(this); |
| 1036 eap_method_combobox_->SetEnabled(eap_method_ui_data_.IsEditable()); | 1036 eap_method_combobox_->SetEnabled(eap_method_ui_data_.IsEditable()); |
| 1037 if (ui::MaterialDesignController::IsSecondaryUiMaterial()) { | 1037 if (ui::MaterialDesignController::IsSecondaryUiMaterial()) { |
| 1038 layout->AddView(eap_method_combobox_, 1, 1, views::GridLayout::FILL, | 1038 layout->AddView(eap_method_combobox_, 1, 1, views::GridLayout::FILL, |
| 1039 views::GridLayout::FILL, 0, | 1039 views::GridLayout::FILL, 0, |
| 1040 ChildNetworkConfigView::kInputFieldHeight); | 1040 ChildNetworkConfigView::kInputFieldHeight); |
| 1041 } else { | 1041 } else { |
| 1042 layout->AddView(eap_method_combobox_); | 1042 layout->AddView(eap_method_combobox_); |
| 1043 } | 1043 } |
| 1044 layout->AddView(new ControlledSettingIndicatorView(eap_method_ui_data_)); | 1044 layout->AddView(new ControlledSettingIndicatorView(eap_method_ui_data_)); |
| 1045 layout->AddPaddingRow( | 1045 layout->AddPaddingRow(0, |
| 1046 0, delegate->GetMetric( | 1046 delegate->GetDistanceMetric( |
| 1047 LayoutDelegate::Metric::RELATED_CONTROL_VERTICAL_SPACING)); | 1047 views::DistanceMetric::RELATED_CONTROL_VERTICAL)); |
| 1048 | 1048 |
| 1049 // Phase 2 authentication | 1049 // Phase 2 authentication |
| 1050 layout->StartRow(0, column_view_set_id); | 1050 layout->StartRow(0, column_view_set_id); |
| 1051 base::string16 phase_2_label_text = l10n_util::GetStringUTF16( | 1051 base::string16 phase_2_label_text = l10n_util::GetStringUTF16( |
| 1052 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_PHASE_2_AUTH); | 1052 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_PHASE_2_AUTH); |
| 1053 phase_2_auth_label_ = new views::Label(phase_2_label_text); | 1053 phase_2_auth_label_ = new views::Label(phase_2_label_text); |
| 1054 layout->AddView(phase_2_auth_label_); | 1054 layout->AddView(phase_2_auth_label_); |
| 1055 phase_2_auth_combobox_model_.reset( | 1055 phase_2_auth_combobox_model_.reset( |
| 1056 new internal::Phase2AuthComboboxModel(eap_method_combobox_)); | 1056 new internal::Phase2AuthComboboxModel(eap_method_combobox_)); |
| 1057 phase_2_auth_combobox_ = new views::Combobox( | 1057 phase_2_auth_combobox_ = new views::Combobox( |
| 1058 phase_2_auth_combobox_model_.get()); | 1058 phase_2_auth_combobox_model_.get()); |
| 1059 phase_2_auth_combobox_->SetAccessibleName(phase_2_label_text); | 1059 phase_2_auth_combobox_->SetAccessibleName(phase_2_label_text); |
| 1060 phase_2_auth_label_->SetEnabled(false); | 1060 phase_2_auth_label_->SetEnabled(false); |
| 1061 phase_2_auth_combobox_->SetEnabled(false); | 1061 phase_2_auth_combobox_->SetEnabled(false); |
| 1062 phase_2_auth_combobox_->set_listener(this); | 1062 phase_2_auth_combobox_->set_listener(this); |
| 1063 if (ui::MaterialDesignController::IsSecondaryUiMaterial()) { | 1063 if (ui::MaterialDesignController::IsSecondaryUiMaterial()) { |
| 1064 layout->AddView(phase_2_auth_combobox_, 1, 1, views::GridLayout::FILL, | 1064 layout->AddView(phase_2_auth_combobox_, 1, 1, views::GridLayout::FILL, |
| 1065 views::GridLayout::FILL, 0, | 1065 views::GridLayout::FILL, 0, |
| 1066 ChildNetworkConfigView::kInputFieldHeight); | 1066 ChildNetworkConfigView::kInputFieldHeight); |
| 1067 } else { | 1067 } else { |
| 1068 layout->AddView(phase_2_auth_combobox_); | 1068 layout->AddView(phase_2_auth_combobox_); |
| 1069 } | 1069 } |
| 1070 layout->AddView(new ControlledSettingIndicatorView(phase_2_auth_ui_data_)); | 1070 layout->AddView(new ControlledSettingIndicatorView(phase_2_auth_ui_data_)); |
| 1071 layout->AddPaddingRow( | 1071 layout->AddPaddingRow(0, |
| 1072 0, delegate->GetMetric( | 1072 delegate->GetDistanceMetric( |
| 1073 LayoutDelegate::Metric::RELATED_CONTROL_VERTICAL_SPACING)); | 1073 views::DistanceMetric::RELATED_CONTROL_VERTICAL)); |
| 1074 | 1074 |
| 1075 // Server CA certificate | 1075 // Server CA certificate |
| 1076 layout->StartRow(0, column_view_set_id); | 1076 layout->StartRow(0, column_view_set_id); |
| 1077 base::string16 server_ca_cert_label_text = l10n_util::GetStringUTF16( | 1077 base::string16 server_ca_cert_label_text = l10n_util::GetStringUTF16( |
| 1078 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CERT_SERVER_CA); | 1078 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CERT_SERVER_CA); |
| 1079 server_ca_cert_label_ = new views::Label(server_ca_cert_label_text); | 1079 server_ca_cert_label_ = new views::Label(server_ca_cert_label_text); |
| 1080 layout->AddView(server_ca_cert_label_); | 1080 layout->AddView(server_ca_cert_label_); |
| 1081 server_ca_cert_combobox_model_.reset( | 1081 server_ca_cert_combobox_model_.reset( |
| 1082 new internal::ServerCACertComboboxModel()); | 1082 new internal::ServerCACertComboboxModel()); |
| 1083 server_ca_cert_combobox_ = new ComboboxWithWidth( | 1083 server_ca_cert_combobox_ = new ComboboxWithWidth( |
| 1084 server_ca_cert_combobox_model_.get(), | 1084 server_ca_cert_combobox_model_.get(), |
| 1085 ChildNetworkConfigView::kInputFieldMinWidth); | 1085 ChildNetworkConfigView::kInputFieldMinWidth); |
| 1086 server_ca_cert_combobox_->SetAccessibleName(server_ca_cert_label_text); | 1086 server_ca_cert_combobox_->SetAccessibleName(server_ca_cert_label_text); |
| 1087 server_ca_cert_label_->SetEnabled(false); | 1087 server_ca_cert_label_->SetEnabled(false); |
| 1088 server_ca_cert_combobox_->SetEnabled(false); | 1088 server_ca_cert_combobox_->SetEnabled(false); |
| 1089 server_ca_cert_combobox_->set_listener(this); | 1089 server_ca_cert_combobox_->set_listener(this); |
| 1090 if (ui::MaterialDesignController::IsSecondaryUiMaterial()) { | 1090 if (ui::MaterialDesignController::IsSecondaryUiMaterial()) { |
| 1091 layout->AddView(server_ca_cert_combobox_, 1, 1, views::GridLayout::FILL, | 1091 layout->AddView(server_ca_cert_combobox_, 1, 1, views::GridLayout::FILL, |
| 1092 views::GridLayout::FILL, 0, | 1092 views::GridLayout::FILL, 0, |
| 1093 ChildNetworkConfigView::kInputFieldHeight); | 1093 ChildNetworkConfigView::kInputFieldHeight); |
| 1094 } else { | 1094 } else { |
| 1095 layout->AddView(server_ca_cert_combobox_); | 1095 layout->AddView(server_ca_cert_combobox_); |
| 1096 } | 1096 } |
| 1097 layout->AddView( | 1097 layout->AddView( |
| 1098 new ControlledSettingIndicatorView(server_ca_cert_ui_data_)); | 1098 new ControlledSettingIndicatorView(server_ca_cert_ui_data_)); |
| 1099 layout->AddPaddingRow( | 1099 layout->AddPaddingRow(0, |
| 1100 0, delegate->GetMetric( | 1100 delegate->GetDistanceMetric( |
| 1101 LayoutDelegate::Metric::RELATED_CONTROL_VERTICAL_SPACING)); | 1101 views::DistanceMetric::RELATED_CONTROL_VERTICAL)); |
| 1102 | 1102 |
| 1103 // Subject Match | 1103 // Subject Match |
| 1104 layout->StartRow(0, column_view_set_id); | 1104 layout->StartRow(0, column_view_set_id); |
| 1105 base::string16 subject_match_label_text = l10n_util::GetStringUTF16( | 1105 base::string16 subject_match_label_text = l10n_util::GetStringUTF16( |
| 1106 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_EAP_SUBJECT_MATCH); | 1106 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_EAP_SUBJECT_MATCH); |
| 1107 subject_match_label_ = new views::Label(subject_match_label_text); | 1107 subject_match_label_ = new views::Label(subject_match_label_text); |
| 1108 layout->AddView(subject_match_label_); | 1108 layout->AddView(subject_match_label_); |
| 1109 subject_match_textfield_ = new views::Textfield(); | 1109 subject_match_textfield_ = new views::Textfield(); |
| 1110 subject_match_textfield_->SetAccessibleName(subject_match_label_text); | 1110 subject_match_textfield_->SetAccessibleName(subject_match_label_text); |
| 1111 subject_match_textfield_->set_controller(this); | 1111 subject_match_textfield_->set_controller(this); |
| 1112 if (ui::MaterialDesignController::IsSecondaryUiMaterial()) { | 1112 if (ui::MaterialDesignController::IsSecondaryUiMaterial()) { |
| 1113 layout->AddView(subject_match_textfield_, 1, 1, views::GridLayout::FILL, | 1113 layout->AddView(subject_match_textfield_, 1, 1, views::GridLayout::FILL, |
| 1114 views::GridLayout::FILL, 0, | 1114 views::GridLayout::FILL, 0, |
| 1115 ChildNetworkConfigView::kInputFieldHeight); | 1115 ChildNetworkConfigView::kInputFieldHeight); |
| 1116 } else { | 1116 } else { |
| 1117 layout->AddView(subject_match_textfield_); | 1117 layout->AddView(subject_match_textfield_); |
| 1118 } | 1118 } |
| 1119 layout->AddPaddingRow( | 1119 layout->AddPaddingRow(0, |
| 1120 0, delegate->GetMetric( | 1120 delegate->GetDistanceMetric( |
| 1121 LayoutDelegate::Metric::RELATED_CONTROL_VERTICAL_SPACING)); | 1121 views::DistanceMetric::RELATED_CONTROL_VERTICAL)); |
| 1122 | 1122 |
| 1123 // User certificate | 1123 // User certificate |
| 1124 layout->StartRow(0, column_view_set_id); | 1124 layout->StartRow(0, column_view_set_id); |
| 1125 base::string16 user_cert_label_text = l10n_util::GetStringUTF16( | 1125 base::string16 user_cert_label_text = l10n_util::GetStringUTF16( |
| 1126 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CERT); | 1126 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CERT); |
| 1127 user_cert_label_ = new views::Label(user_cert_label_text); | 1127 user_cert_label_ = new views::Label(user_cert_label_text); |
| 1128 layout->AddView(user_cert_label_); | 1128 layout->AddView(user_cert_label_); |
| 1129 user_cert_combobox_model_.reset(new internal::UserCertComboboxModel(this)); | 1129 user_cert_combobox_model_.reset(new internal::UserCertComboboxModel(this)); |
| 1130 user_cert_combobox_ = new views::Combobox(user_cert_combobox_model_.get()); | 1130 user_cert_combobox_ = new views::Combobox(user_cert_combobox_model_.get()); |
| 1131 user_cert_combobox_->SetAccessibleName(user_cert_label_text); | 1131 user_cert_combobox_->SetAccessibleName(user_cert_label_text); |
| 1132 user_cert_label_->SetEnabled(false); | 1132 user_cert_label_->SetEnabled(false); |
| 1133 user_cert_combobox_->SetEnabled(false); | 1133 user_cert_combobox_->SetEnabled(false); |
| 1134 user_cert_combobox_->set_listener(this); | 1134 user_cert_combobox_->set_listener(this); |
| 1135 if (ui::MaterialDesignController::IsSecondaryUiMaterial()) { | 1135 if (ui::MaterialDesignController::IsSecondaryUiMaterial()) { |
| 1136 layout->AddView(user_cert_combobox_, 1, 1, views::GridLayout::FILL, | 1136 layout->AddView(user_cert_combobox_, 1, 1, views::GridLayout::FILL, |
| 1137 views::GridLayout::FILL, 0, | 1137 views::GridLayout::FILL, 0, |
| 1138 ChildNetworkConfigView::kInputFieldHeight); | 1138 ChildNetworkConfigView::kInputFieldHeight); |
| 1139 } else { | 1139 } else { |
| 1140 layout->AddView(user_cert_combobox_); | 1140 layout->AddView(user_cert_combobox_); |
| 1141 } | 1141 } |
| 1142 layout->AddView(new ControlledSettingIndicatorView(user_cert_ui_data_)); | 1142 layout->AddView(new ControlledSettingIndicatorView(user_cert_ui_data_)); |
| 1143 layout->AddPaddingRow( | 1143 layout->AddPaddingRow(0, |
| 1144 0, delegate->GetMetric( | 1144 delegate->GetDistanceMetric( |
| 1145 LayoutDelegate::Metric::RELATED_CONTROL_VERTICAL_SPACING)); | 1145 views::DistanceMetric::RELATED_CONTROL_VERTICAL)); |
| 1146 | 1146 |
| 1147 // Identity | 1147 // Identity |
| 1148 layout->StartRow(0, column_view_set_id); | 1148 layout->StartRow(0, column_view_set_id); |
| 1149 base::string16 identity_label_text = l10n_util::GetStringUTF16( | 1149 base::string16 identity_label_text = l10n_util::GetStringUTF16( |
| 1150 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CERT_IDENTITY); | 1150 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CERT_IDENTITY); |
| 1151 identity_label_ = new views::Label(identity_label_text); | 1151 identity_label_ = new views::Label(identity_label_text); |
| 1152 layout->AddView(identity_label_); | 1152 layout->AddView(identity_label_); |
| 1153 identity_textfield_ = new views::Textfield(); | 1153 identity_textfield_ = new views::Textfield(); |
| 1154 identity_textfield_->SetAccessibleName(identity_label_text); | 1154 identity_textfield_->SetAccessibleName(identity_label_text); |
| 1155 identity_textfield_->set_controller(this); | 1155 identity_textfield_->set_controller(this); |
| 1156 identity_textfield_->SetEnabled(identity_ui_data_.IsEditable()); | 1156 identity_textfield_->SetEnabled(identity_ui_data_.IsEditable()); |
| 1157 if (ui::MaterialDesignController::IsSecondaryUiMaterial()) { | 1157 if (ui::MaterialDesignController::IsSecondaryUiMaterial()) { |
| 1158 layout->AddView(identity_textfield_, 1, 1, views::GridLayout::FILL, | 1158 layout->AddView(identity_textfield_, 1, 1, views::GridLayout::FILL, |
| 1159 views::GridLayout::FILL, 0, | 1159 views::GridLayout::FILL, 0, |
| 1160 ChildNetworkConfigView::kInputFieldHeight); | 1160 ChildNetworkConfigView::kInputFieldHeight); |
| 1161 } else { | 1161 } else { |
| 1162 layout->AddView(identity_textfield_); | 1162 layout->AddView(identity_textfield_); |
| 1163 } | 1163 } |
| 1164 layout->AddView(new ControlledSettingIndicatorView(identity_ui_data_)); | 1164 layout->AddView(new ControlledSettingIndicatorView(identity_ui_data_)); |
| 1165 layout->AddPaddingRow( | 1165 layout->AddPaddingRow(0, |
| 1166 0, delegate->GetMetric( | 1166 delegate->GetDistanceMetric( |
| 1167 LayoutDelegate::Metric::RELATED_CONTROL_VERTICAL_SPACING)); | 1167 views::DistanceMetric::RELATED_CONTROL_VERTICAL)); |
| 1168 } | 1168 } |
| 1169 | 1169 |
| 1170 // Passphrase input | 1170 // Passphrase input |
| 1171 layout->StartRow(0, column_view_set_id); | 1171 layout->StartRow(0, column_view_set_id); |
| 1172 int label_text_id = IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_PASSPHRASE; | 1172 int label_text_id = IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_PASSPHRASE; |
| 1173 base::string16 passphrase_label_text = | 1173 base::string16 passphrase_label_text = |
| 1174 l10n_util::GetStringUTF16(label_text_id); | 1174 l10n_util::GetStringUTF16(label_text_id); |
| 1175 passphrase_label_ = new views::Label(passphrase_label_text); | 1175 passphrase_label_ = new views::Label(passphrase_label_text); |
| 1176 layout->AddView(passphrase_label_); | 1176 layout->AddView(passphrase_label_); |
| 1177 passphrase_textfield_ = new PassphraseTextfield(); | 1177 passphrase_textfield_ = new PassphraseTextfield(); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1216 GetImageSkiaNamed(IDR_NETWORK_HIDE_PASSWORD)); | 1216 GetImageSkiaNamed(IDR_NETWORK_HIDE_PASSWORD)); |
| 1217 passphrase_visible_button_->SetToggledImage( | 1217 passphrase_visible_button_->SetToggledImage( |
| 1218 views::ImageButton::STATE_HOVERED, | 1218 views::ImageButton::STATE_HOVERED, |
| 1219 ResourceBundle::GetSharedInstance(). | 1219 ResourceBundle::GetSharedInstance(). |
| 1220 GetImageSkiaNamed(IDR_NETWORK_HIDE_PASSWORD_HOVER)); | 1220 GetImageSkiaNamed(IDR_NETWORK_HIDE_PASSWORD_HOVER)); |
| 1221 passphrase_visible_button_->SetImageAlignment( | 1221 passphrase_visible_button_->SetImageAlignment( |
| 1222 views::ImageButton::ALIGN_CENTER, views::ImageButton::ALIGN_MIDDLE); | 1222 views::ImageButton::ALIGN_CENTER, views::ImageButton::ALIGN_MIDDLE); |
| 1223 layout->AddView(passphrase_visible_button_); | 1223 layout->AddView(passphrase_visible_button_); |
| 1224 } | 1224 } |
| 1225 | 1225 |
| 1226 layout->AddPaddingRow( | 1226 layout->AddPaddingRow(0, |
| 1227 0, delegate->GetMetric( | 1227 delegate->GetDistanceMetric( |
| 1228 LayoutDelegate::Metric::RELATED_CONTROL_VERTICAL_SPACING)); | 1228 views::DistanceMetric::RELATED_CONTROL_VERTICAL)); |
| 1229 | 1229 |
| 1230 if (show_8021x) { | 1230 if (show_8021x) { |
| 1231 // Anonymous identity | 1231 // Anonymous identity |
| 1232 layout->StartRow(0, column_view_set_id); | 1232 layout->StartRow(0, column_view_set_id); |
| 1233 identity_anonymous_label_ = | 1233 identity_anonymous_label_ = |
| 1234 new views::Label(l10n_util::GetStringUTF16( | 1234 new views::Label(l10n_util::GetStringUTF16( |
| 1235 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CERT_IDENTITY_ANONYMOUS)); | 1235 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CERT_IDENTITY_ANONYMOUS)); |
| 1236 layout->AddView(identity_anonymous_label_); | 1236 layout->AddView(identity_anonymous_label_); |
| 1237 identity_anonymous_textfield_ = new views::Textfield(); | 1237 identity_anonymous_textfield_ = new views::Textfield(); |
| 1238 identity_anonymous_label_->SetEnabled(false); | 1238 identity_anonymous_label_->SetEnabled(false); |
| 1239 identity_anonymous_textfield_->SetEnabled(false); | 1239 identity_anonymous_textfield_->SetEnabled(false); |
| 1240 identity_anonymous_textfield_->set_controller(this); | 1240 identity_anonymous_textfield_->set_controller(this); |
| 1241 if (ui::MaterialDesignController::IsSecondaryUiMaterial()) { | 1241 if (ui::MaterialDesignController::IsSecondaryUiMaterial()) { |
| 1242 layout->AddView(identity_anonymous_textfield_, 1, 1, | 1242 layout->AddView(identity_anonymous_textfield_, 1, 1, |
| 1243 views::GridLayout::FILL, views::GridLayout::FILL, 0, | 1243 views::GridLayout::FILL, views::GridLayout::FILL, 0, |
| 1244 ChildNetworkConfigView::kInputFieldHeight); | 1244 ChildNetworkConfigView::kInputFieldHeight); |
| 1245 } else { | 1245 } else { |
| 1246 layout->AddView(identity_anonymous_textfield_); | 1246 layout->AddView(identity_anonymous_textfield_); |
| 1247 } | 1247 } |
| 1248 layout->AddView( | 1248 layout->AddView( |
| 1249 new ControlledSettingIndicatorView(identity_anonymous_ui_data_)); | 1249 new ControlledSettingIndicatorView(identity_anonymous_ui_data_)); |
| 1250 layout->AddPaddingRow( | 1250 layout->AddPaddingRow(0, |
| 1251 0, delegate->GetMetric( | 1251 delegate->GetDistanceMetric( |
| 1252 LayoutDelegate::Metric::RELATED_CONTROL_VERTICAL_SPACING)); | 1252 views::DistanceMetric::RELATED_CONTROL_VERTICAL)); |
| 1253 } | 1253 } |
| 1254 | 1254 |
| 1255 if (ui::MaterialDesignController::IsSecondaryUiMaterial()) { | 1255 if (ui::MaterialDesignController::IsSecondaryUiMaterial()) { |
| 1256 // We need a little bit more padding above Checkboxes. | 1256 // We need a little bit more padding above Checkboxes. |
| 1257 layout->AddPaddingRow( | 1257 layout->AddPaddingRow(0, |
| 1258 0, delegate->GetMetric( | 1258 delegate->GetDistanceMetric( |
| 1259 LayoutDelegate::Metric::RELATED_CONTROL_VERTICAL_SPACING)); | 1259 views::DistanceMetric::RELATED_CONTROL_VERTICAL)); |
| 1260 } | 1260 } |
| 1261 | 1261 |
| 1262 // Checkboxes. | 1262 // Checkboxes. |
| 1263 | 1263 |
| 1264 // Save credentials | 1264 // Save credentials |
| 1265 if (show_8021x) { | 1265 if (show_8021x) { |
| 1266 layout->StartRow(0, column_view_set_id); | 1266 layout->StartRow(0, column_view_set_id); |
| 1267 save_credentials_checkbox_ = new views::Checkbox( | 1267 save_credentials_checkbox_ = new views::Checkbox( |
| 1268 l10n_util::GetStringUTF16( | 1268 l10n_util::GetStringUTF16( |
| 1269 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_SAVE_CREDENTIALS)); | 1269 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_SAVE_CREDENTIALS)); |
| 1270 save_credentials_checkbox_->SetEnabled( | 1270 save_credentials_checkbox_->SetEnabled( |
| 1271 save_credentials_ui_data_.IsEditable()); | 1271 save_credentials_ui_data_.IsEditable()); |
| 1272 layout->SkipColumns(1); | 1272 layout->SkipColumns(1); |
| 1273 layout->AddView(save_credentials_checkbox_); | 1273 layout->AddView(save_credentials_checkbox_); |
| 1274 layout->AddView( | 1274 layout->AddView( |
| 1275 new ControlledSettingIndicatorView(save_credentials_ui_data_)); | 1275 new ControlledSettingIndicatorView(save_credentials_ui_data_)); |
| 1276 } | 1276 } |
| 1277 | 1277 |
| 1278 // Share network | 1278 // Share network |
| 1279 if (!network || network->profile_path().empty()) { | 1279 if (!network || network->profile_path().empty()) { |
| 1280 layout->StartRow(0, column_view_set_id); | 1280 layout->StartRow(0, column_view_set_id); |
| 1281 share_network_checkbox_ = new views::Checkbox( | 1281 share_network_checkbox_ = new views::Checkbox( |
| 1282 l10n_util::GetStringUTF16( | 1282 l10n_util::GetStringUTF16( |
| 1283 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_SHARE_NETWORK)); | 1283 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_SHARE_NETWORK)); |
| 1284 layout->SkipColumns(1); | 1284 layout->SkipColumns(1); |
| 1285 layout->AddView(share_network_checkbox_); | 1285 layout->AddView(share_network_checkbox_); |
| 1286 } | 1286 } |
| 1287 layout->AddPaddingRow( | 1287 layout->AddPaddingRow(0, |
| 1288 0, delegate->GetMetric( | 1288 delegate->GetDistanceMetric( |
| 1289 LayoutDelegate::Metric::RELATED_CONTROL_VERTICAL_SPACING)); | 1289 views::DistanceMetric::RELATED_CONTROL_VERTICAL)); |
| 1290 | 1290 |
| 1291 // Create an error label. | 1291 // Create an error label. |
| 1292 layout->StartRow(0, column_view_set_id); | 1292 layout->StartRow(0, column_view_set_id); |
| 1293 layout->SkipColumns(1); | 1293 layout->SkipColumns(1); |
| 1294 error_label_ = new views::Label(); | 1294 error_label_ = new views::Label(); |
| 1295 error_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT); | 1295 error_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
| 1296 error_label_->SetEnabledColor(SK_ColorRED); | 1296 error_label_->SetEnabledColor(SK_ColorRED); |
| 1297 layout->AddView(error_label_); | 1297 layout->AddView(error_label_); |
| 1298 | 1298 |
| 1299 // Initialize the field and checkbox values. | 1299 // Initialize the field and checkbox values. |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1488 void WifiConfigView::ParseEAPUIProperty(NetworkPropertyUIData* property_ui_data, | 1488 void WifiConfigView::ParseEAPUIProperty(NetworkPropertyUIData* property_ui_data, |
| 1489 const NetworkState* network, | 1489 const NetworkState* network, |
| 1490 const std::string& key) { | 1490 const std::string& key) { |
| 1491 std::string onc_tag = network->type() == shill::kTypeEthernet | 1491 std::string onc_tag = network->type() == shill::kTypeEthernet |
| 1492 ? ::onc::ethernet::kEAP | 1492 ? ::onc::ethernet::kEAP |
| 1493 : ::onc::wifi::kEAP; | 1493 : ::onc::wifi::kEAP; |
| 1494 ParseUIProperty(property_ui_data, network, onc_tag + '.' + key); | 1494 ParseUIProperty(property_ui_data, network, onc_tag + '.' + key); |
| 1495 } | 1495 } |
| 1496 | 1496 |
| 1497 } // namespace chromeos | 1497 } // namespace chromeos |
| OLD | NEW |