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