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

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

Issue 2692403002: Put the new harmonized dialog implementation behind flag. (Closed)
Patch Set: Created 3 years, 10 months 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
« no previous file with comments | « chrome/browser/chromeos/options/network_config_view.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"
(...skipping 14 matching lines...) Expand all
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"
35 #include "ui/base/resource/resource_bundle.h" 36 #include "ui/base/resource/resource_bundle.h"
36 #include "ui/events/event.h" 37 #include "ui/events/event.h"
37 #include "ui/views/controls/button/checkbox.h" 38 #include "ui/views/controls/button/checkbox.h"
38 #include "ui/views/controls/button/image_button.h" 39 #include "ui/views/controls/button/image_button.h"
39 #include "ui/views/controls/combobox/combobox.h" 40 #include "ui/views/controls/combobox/combobox.h"
40 #include "ui/views/controls/label.h" 41 #include "ui/views/controls/label.h"
41 #include "ui/views/controls/textfield/textfield.h" 42 #include "ui/views/controls/textfield/textfield.h"
42 #include "ui/views/layout/grid_layout.h" 43 #include "ui/views/layout/grid_layout.h"
43 #include "ui/views/widget/widget.h" 44 #include "ui/views/widget/widget.h"
44 #include "ui/views/window/dialog_client_view.h" 45 #include "ui/views/window/dialog_client_view.h"
(...skipping 888 matching lines...) Expand 10 before | Expand all | Expand 10 after
933 ParseEAPUIProperty(&passphrase_ui_data_, network, ::onc::eap::kPassword); 934 ParseEAPUIProperty(&passphrase_ui_data_, network, ::onc::eap::kPassword);
934 else 935 else
935 ParseUIProperty(&passphrase_ui_data_, network, ::onc::wifi::kPassphrase); 936 ParseUIProperty(&passphrase_ui_data_, network, ::onc::wifi::kPassphrase);
936 } 937 }
937 938
938 views::GridLayout* layout = layout_utils::CreatePanelLayout(this); 939 views::GridLayout* layout = layout_utils::CreatePanelLayout(this);
939 LayoutDelegate* delegate = LayoutDelegate::Get(); 940 LayoutDelegate* delegate = LayoutDelegate::Get();
940 941
941 const int column_view_set_id = 0; 942 const int column_view_set_id = 0;
942 views::ColumnSet* column_set = layout->AddColumnSet(column_view_set_id); 943 views::ColumnSet* column_set = layout->AddColumnSet(column_view_set_id);
943 const int kLabelMinWidth = 150;
944 const int kPasswordVisibleWidth = 20; 944 const int kPasswordVisibleWidth = 20;
945 // Label 945 // Label
946 column_set->AddColumn(views::GridLayout::LEADING, views::GridLayout::FILL, 1, 946 if (ui::MaterialDesignController::IsSecondaryUiMaterial()) {
947 views::GridLayout::USE_PREF, 0, kLabelMinWidth); 947 // This constant ensures the minimum width of the label column and ensures
948 // the width of the Wifi dialog equals 512.
949 const int kLabelMinWidth = 158;
xdai1 2017/02/15 01:46:09 This value increased a little bit because we remov
950 column_set->AddColumn(views::GridLayout::LEADING, views::GridLayout::FILL,
951 1, views::GridLayout::USE_PREF, 0, kLabelMinWidth);
952 } else {
953 column_set->AddColumn(views::GridLayout::LEADING, views::GridLayout::FILL,
954 1, views::GridLayout::USE_PREF, 0, 0);
955 }
948 column_set->AddPaddingColumn( 956 column_set->AddPaddingColumn(
949 0, delegate->GetMetric( 957 0, delegate->GetMetric(
950 LayoutDelegate::Metric::RELATED_CONTROL_HORIZONTAL_SPACING)); 958 LayoutDelegate::Metric::RELATED_CONTROL_HORIZONTAL_SPACING));
951 // Textfield, combobox. 959 // Textfield, combobox.
952 column_set->AddColumn(views::GridLayout::FILL, views::GridLayout::FILL, 1, 960 column_set->AddColumn(views::GridLayout::FILL, views::GridLayout::FILL, 1,
953 views::GridLayout::USE_PREF, 0, 961 views::GridLayout::USE_PREF, 0,
954 ChildNetworkConfigView::kInputFieldMinWidth); 962 ChildNetworkConfigView::kInputFieldMinWidth);
955 column_set->AddPaddingColumn( 963 column_set->AddPaddingColumn(
956 0, delegate->GetMetric( 964 0, delegate->GetMetric(
957 LayoutDelegate::Metric::RELATED_CONTROL_HORIZONTAL_SPACING)); 965 LayoutDelegate::Metric::RELATED_CONTROL_HORIZONTAL_SPACING));
958 // Password visible button / policy indicator. 966 // Password visible button / policy indicator.
959 column_set->AddColumn(views::GridLayout::CENTER, views::GridLayout::FILL, 0, 967 column_set->AddColumn(views::GridLayout::CENTER, views::GridLayout::FILL, 0,
960 views::GridLayout::FIXED, kPasswordVisibleWidth, 0); 968 views::GridLayout::FIXED, kPasswordVisibleWidth, 0);
961 column_set->AddPaddingColumn(
962 0, delegate->GetMetric(
963 LayoutDelegate::Metric::RELATED_CONTROL_HORIZONTAL_SPACING));
964 969
965 // SSID input 970 // SSID input
966 if (!network || network->type() != shill::kTypeEthernet) { 971 if (!network || network->type() != shill::kTypeEthernet) {
967 layout->StartRow(0, column_view_set_id); 972 layout->StartRow(0, column_view_set_id);
968 layout->AddView(new views::Label(l10n_util::GetStringUTF16( 973 layout->AddView(new views::Label(l10n_util::GetStringUTF16(
969 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_NETWORK_ID))); 974 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_NETWORK_ID)));
970 if (!network) { 975 if (!network) {
971 ssid_textfield_ = new views::Textfield(); 976 ssid_textfield_ = new views::Textfield();
972 ssid_textfield_->set_controller(this); 977 ssid_textfield_->set_controller(this);
973 ssid_textfield_->SetAccessibleName(l10n_util::GetStringUTF16( 978 ssid_textfield_->SetAccessibleName(l10n_util::GetStringUTF16(
974 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_NETWORK_ID)); 979 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_NETWORK_ID));
975 layout->AddView(ssid_textfield_, 1, 1, views::GridLayout::FILL, 980 if (ui::MaterialDesignController::IsSecondaryUiMaterial()) {
976 views::GridLayout::FILL, 0, 981 layout->AddView(ssid_textfield_, 1, 1, views::GridLayout::FILL,
977 ChildNetworkConfigView::kInputFieldHeight); 982 views::GridLayout::FILL, 0,
983 ChildNetworkConfigView::kInputFieldHeight);
984 } else {
985 layout->AddView(ssid_textfield_);
986 }
978 } else { 987 } else {
979 views::Label* label = 988 views::Label* label =
980 new views::Label(base::UTF8ToUTF16(network->name())); 989 new views::Label(base::UTF8ToUTF16(network->name()));
981 label->SetHorizontalAlignment(gfx::ALIGN_LEFT); 990 label->SetHorizontalAlignment(gfx::ALIGN_LEFT);
982 layout->AddView(label); 991 layout->AddView(label);
983 } 992 }
984 layout->AddPaddingRow( 993 layout->AddPaddingRow(
985 0, delegate->GetMetric( 994 0, delegate->GetMetric(
986 LayoutDelegate::Metric::RELATED_CONTROL_VERTICAL_SPACING)); 995 LayoutDelegate::Metric::RELATED_CONTROL_VERTICAL_SPACING));
987 } 996 }
988 997
989 // Security select 998 // Security select
990 if (!network && !show_8021x) { 999 if (!network && !show_8021x) {
991 layout->StartRow(0, column_view_set_id); 1000 layout->StartRow(0, column_view_set_id);
992 base::string16 label_text = l10n_util::GetStringUTF16( 1001 base::string16 label_text = l10n_util::GetStringUTF16(
993 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_SECURITY); 1002 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_SECURITY);
994 layout->AddView(new views::Label(label_text)); 1003 layout->AddView(new views::Label(label_text));
995 security_combobox_model_.reset(new internal::SecurityComboboxModel); 1004 security_combobox_model_.reset(new internal::SecurityComboboxModel);
996 security_combobox_ = new views::Combobox(security_combobox_model_.get()); 1005 security_combobox_ = new views::Combobox(security_combobox_model_.get());
997 security_combobox_->SetAccessibleName(label_text); 1006 security_combobox_->SetAccessibleName(label_text);
998 security_combobox_->set_listener(this); 1007 security_combobox_->set_listener(this);
999 layout->AddView(security_combobox_, 1, 1, views::GridLayout::FILL, 1008 if (ui::MaterialDesignController::IsSecondaryUiMaterial()) {
1000 views::GridLayout::FILL, 0, 1009 layout->AddView(security_combobox_, 1, 1, views::GridLayout::FILL,
1001 ChildNetworkConfigView::kInputFieldHeight); 1010 views::GridLayout::FILL, 0,
1011 ChildNetworkConfigView::kInputFieldHeight);
1012 } else {
1013 layout->AddView(security_combobox_);
1014 }
1002 layout->AddView(security_combobox_); 1015 layout->AddView(security_combobox_);
1003 layout->AddPaddingRow( 1016 layout->AddPaddingRow(
1004 0, delegate->GetMetric( 1017 0, delegate->GetMetric(
1005 LayoutDelegate::Metric::RELATED_CONTROL_VERTICAL_SPACING)); 1018 LayoutDelegate::Metric::RELATED_CONTROL_VERTICAL_SPACING));
1006 } 1019 }
1007 1020
1008 // Only enumerate certificates in the data model for 802.1X networks. 1021 // Only enumerate certificates in the data model for 802.1X networks.
1009 if (show_8021x) { 1022 if (show_8021x) {
1010 // Observer any changes to the certificate list. 1023 // Observer any changes to the certificate list.
1011 CertLibrary::Get()->AddObserver(this); 1024 CertLibrary::Get()->AddObserver(this);
1012 1025
1013 // EAP method 1026 // EAP method
1014 layout->StartRow(0, column_view_set_id); 1027 layout->StartRow(0, column_view_set_id);
1015 base::string16 eap_label_text = l10n_util::GetStringUTF16( 1028 base::string16 eap_label_text = l10n_util::GetStringUTF16(
1016 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_EAP_METHOD); 1029 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_EAP_METHOD);
1017 layout->AddView(new views::Label(eap_label_text)); 1030 layout->AddView(new views::Label(eap_label_text));
1018 eap_method_combobox_model_.reset(new internal::EAPMethodComboboxModel); 1031 eap_method_combobox_model_.reset(new internal::EAPMethodComboboxModel);
1019 eap_method_combobox_ = new views::Combobox( 1032 eap_method_combobox_ = new views::Combobox(
1020 eap_method_combobox_model_.get()); 1033 eap_method_combobox_model_.get());
1021 eap_method_combobox_->SetAccessibleName(eap_label_text); 1034 eap_method_combobox_->SetAccessibleName(eap_label_text);
1022 eap_method_combobox_->set_listener(this); 1035 eap_method_combobox_->set_listener(this);
1023 eap_method_combobox_->SetEnabled(eap_method_ui_data_.IsEditable()); 1036 eap_method_combobox_->SetEnabled(eap_method_ui_data_.IsEditable());
1024 layout->AddView(eap_method_combobox_, 1, 1, views::GridLayout::FILL, 1037 if (ui::MaterialDesignController::IsSecondaryUiMaterial()) {
1025 views::GridLayout::FILL, 0, 1038 layout->AddView(eap_method_combobox_, 1, 1, views::GridLayout::FILL,
1026 ChildNetworkConfigView::kInputFieldHeight); 1039 views::GridLayout::FILL, 0,
1040 ChildNetworkConfigView::kInputFieldHeight);
1041 } else {
1042 layout->AddView(eap_method_combobox_);
1043 }
1027 layout->AddView(new ControlledSettingIndicatorView(eap_method_ui_data_)); 1044 layout->AddView(new ControlledSettingIndicatorView(eap_method_ui_data_));
1028 layout->AddPaddingRow( 1045 layout->AddPaddingRow(
1029 0, delegate->GetMetric( 1046 0, delegate->GetMetric(
1030 LayoutDelegate::Metric::RELATED_CONTROL_VERTICAL_SPACING)); 1047 LayoutDelegate::Metric::RELATED_CONTROL_VERTICAL_SPACING));
1031 1048
1032 // Phase 2 authentication 1049 // Phase 2 authentication
1033 layout->StartRow(0, column_view_set_id); 1050 layout->StartRow(0, column_view_set_id);
1034 base::string16 phase_2_label_text = l10n_util::GetStringUTF16( 1051 base::string16 phase_2_label_text = l10n_util::GetStringUTF16(
1035 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_PHASE_2_AUTH); 1052 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_PHASE_2_AUTH);
1036 phase_2_auth_label_ = new views::Label(phase_2_label_text); 1053 phase_2_auth_label_ = new views::Label(phase_2_label_text);
1037 layout->AddView(phase_2_auth_label_); 1054 layout->AddView(phase_2_auth_label_);
1038 phase_2_auth_combobox_model_.reset( 1055 phase_2_auth_combobox_model_.reset(
1039 new internal::Phase2AuthComboboxModel(eap_method_combobox_)); 1056 new internal::Phase2AuthComboboxModel(eap_method_combobox_));
1040 phase_2_auth_combobox_ = new views::Combobox( 1057 phase_2_auth_combobox_ = new views::Combobox(
1041 phase_2_auth_combobox_model_.get()); 1058 phase_2_auth_combobox_model_.get());
1042 phase_2_auth_combobox_->SetAccessibleName(phase_2_label_text); 1059 phase_2_auth_combobox_->SetAccessibleName(phase_2_label_text);
1043 phase_2_auth_label_->SetEnabled(false); 1060 phase_2_auth_label_->SetEnabled(false);
1044 phase_2_auth_combobox_->SetEnabled(false); 1061 phase_2_auth_combobox_->SetEnabled(false);
1045 phase_2_auth_combobox_->set_listener(this); 1062 phase_2_auth_combobox_->set_listener(this);
1046 layout->AddView(phase_2_auth_combobox_, 1, 1, views::GridLayout::FILL, 1063 if (ui::MaterialDesignController::IsSecondaryUiMaterial()) {
1047 views::GridLayout::FILL, 0, 1064 layout->AddView(phase_2_auth_combobox_, 1, 1, views::GridLayout::FILL,
1048 ChildNetworkConfigView::kInputFieldHeight); 1065 views::GridLayout::FILL, 0,
1066 ChildNetworkConfigView::kInputFieldHeight);
1067 } else {
1068 layout->AddView(phase_2_auth_combobox_);
1069 }
1049 layout->AddView(new ControlledSettingIndicatorView(phase_2_auth_ui_data_)); 1070 layout->AddView(new ControlledSettingIndicatorView(phase_2_auth_ui_data_));
1050 layout->AddPaddingRow( 1071 layout->AddPaddingRow(
1051 0, delegate->GetMetric( 1072 0, delegate->GetMetric(
1052 LayoutDelegate::Metric::RELATED_CONTROL_VERTICAL_SPACING)); 1073 LayoutDelegate::Metric::RELATED_CONTROL_VERTICAL_SPACING));
1053 1074
1054 // Server CA certificate 1075 // Server CA certificate
1055 layout->StartRow(0, column_view_set_id); 1076 layout->StartRow(0, column_view_set_id);
1056 base::string16 server_ca_cert_label_text = l10n_util::GetStringUTF16( 1077 base::string16 server_ca_cert_label_text = l10n_util::GetStringUTF16(
1057 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CERT_SERVER_CA); 1078 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CERT_SERVER_CA);
1058 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);
1059 layout->AddView(server_ca_cert_label_); 1080 layout->AddView(server_ca_cert_label_);
1060 server_ca_cert_combobox_model_.reset( 1081 server_ca_cert_combobox_model_.reset(
1061 new internal::ServerCACertComboboxModel()); 1082 new internal::ServerCACertComboboxModel());
1062 server_ca_cert_combobox_ = new ComboboxWithWidth( 1083 server_ca_cert_combobox_ = new ComboboxWithWidth(
1063 server_ca_cert_combobox_model_.get(), 1084 server_ca_cert_combobox_model_.get(),
1064 ChildNetworkConfigView::kInputFieldMinWidth); 1085 ChildNetworkConfigView::kInputFieldMinWidth);
1065 server_ca_cert_combobox_->SetAccessibleName(server_ca_cert_label_text); 1086 server_ca_cert_combobox_->SetAccessibleName(server_ca_cert_label_text);
1066 server_ca_cert_label_->SetEnabled(false); 1087 server_ca_cert_label_->SetEnabled(false);
1067 server_ca_cert_combobox_->SetEnabled(false); 1088 server_ca_cert_combobox_->SetEnabled(false);
1068 server_ca_cert_combobox_->set_listener(this); 1089 server_ca_cert_combobox_->set_listener(this);
1069 layout->AddView(server_ca_cert_combobox_, 1, 1, views::GridLayout::FILL, 1090 if (ui::MaterialDesignController::IsSecondaryUiMaterial()) {
1070 views::GridLayout::FILL, 0, 1091 layout->AddView(server_ca_cert_combobox_, 1, 1, views::GridLayout::FILL,
1071 ChildNetworkConfigView::kInputFieldHeight); 1092 views::GridLayout::FILL, 0,
1093 ChildNetworkConfigView::kInputFieldHeight);
1094 } else {
1095 layout->AddView(server_ca_cert_combobox_);
1096 }
1072 layout->AddView( 1097 layout->AddView(
1073 new ControlledSettingIndicatorView(server_ca_cert_ui_data_)); 1098 new ControlledSettingIndicatorView(server_ca_cert_ui_data_));
1074 layout->AddPaddingRow( 1099 layout->AddPaddingRow(
1075 0, delegate->GetMetric( 1100 0, delegate->GetMetric(
1076 LayoutDelegate::Metric::RELATED_CONTROL_VERTICAL_SPACING)); 1101 LayoutDelegate::Metric::RELATED_CONTROL_VERTICAL_SPACING));
1077 1102
1078 // Subject Match 1103 // Subject Match
1079 layout->StartRow(0, column_view_set_id); 1104 layout->StartRow(0, column_view_set_id);
1080 base::string16 subject_match_label_text = l10n_util::GetStringUTF16( 1105 base::string16 subject_match_label_text = l10n_util::GetStringUTF16(
1081 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_EAP_SUBJECT_MATCH); 1106 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_EAP_SUBJECT_MATCH);
1082 subject_match_label_ = new views::Label(subject_match_label_text); 1107 subject_match_label_ = new views::Label(subject_match_label_text);
1083 layout->AddView(subject_match_label_); 1108 layout->AddView(subject_match_label_);
1084 subject_match_textfield_ = new views::Textfield(); 1109 subject_match_textfield_ = new views::Textfield();
1085 subject_match_textfield_->SetAccessibleName(subject_match_label_text); 1110 subject_match_textfield_->SetAccessibleName(subject_match_label_text);
1086 subject_match_textfield_->set_controller(this); 1111 subject_match_textfield_->set_controller(this);
1087 layout->AddView(subject_match_textfield_, 1, 1, views::GridLayout::FILL, 1112 if (ui::MaterialDesignController::IsSecondaryUiMaterial()) {
1088 views::GridLayout::FILL, 0, 1113 layout->AddView(subject_match_textfield_, 1, 1, views::GridLayout::FILL,
1089 ChildNetworkConfigView::kInputFieldHeight); 1114 views::GridLayout::FILL, 0,
1115 ChildNetworkConfigView::kInputFieldHeight);
1116 } else {
1117 layout->AddView(subject_match_textfield_);
1118 }
1090 layout->AddPaddingRow( 1119 layout->AddPaddingRow(
1091 0, delegate->GetMetric( 1120 0, delegate->GetMetric(
1092 LayoutDelegate::Metric::RELATED_CONTROL_VERTICAL_SPACING)); 1121 LayoutDelegate::Metric::RELATED_CONTROL_VERTICAL_SPACING));
1093 1122
1094 // User certificate 1123 // User certificate
1095 layout->StartRow(0, column_view_set_id); 1124 layout->StartRow(0, column_view_set_id);
1096 base::string16 user_cert_label_text = l10n_util::GetStringUTF16( 1125 base::string16 user_cert_label_text = l10n_util::GetStringUTF16(
1097 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CERT); 1126 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CERT);
1098 user_cert_label_ = new views::Label(user_cert_label_text); 1127 user_cert_label_ = new views::Label(user_cert_label_text);
1099 layout->AddView(user_cert_label_); 1128 layout->AddView(user_cert_label_);
1100 user_cert_combobox_model_.reset(new internal::UserCertComboboxModel(this)); 1129 user_cert_combobox_model_.reset(new internal::UserCertComboboxModel(this));
1101 user_cert_combobox_ = new views::Combobox(user_cert_combobox_model_.get()); 1130 user_cert_combobox_ = new views::Combobox(user_cert_combobox_model_.get());
1102 user_cert_combobox_->SetAccessibleName(user_cert_label_text); 1131 user_cert_combobox_->SetAccessibleName(user_cert_label_text);
1103 user_cert_label_->SetEnabled(false); 1132 user_cert_label_->SetEnabled(false);
1104 user_cert_combobox_->SetEnabled(false); 1133 user_cert_combobox_->SetEnabled(false);
1105 user_cert_combobox_->set_listener(this); 1134 user_cert_combobox_->set_listener(this);
1106 layout->AddView(user_cert_combobox_, 1, 1, views::GridLayout::FILL, 1135 if (ui::MaterialDesignController::IsSecondaryUiMaterial()) {
1107 views::GridLayout::FILL, 0, 1136 layout->AddView(user_cert_combobox_, 1, 1, views::GridLayout::FILL,
1108 ChildNetworkConfigView::kInputFieldHeight); 1137 views::GridLayout::FILL, 0,
1138 ChildNetworkConfigView::kInputFieldHeight);
1139 } else {
1140 layout->AddView(user_cert_combobox_);
1141 }
1109 layout->AddView(new ControlledSettingIndicatorView(user_cert_ui_data_)); 1142 layout->AddView(new ControlledSettingIndicatorView(user_cert_ui_data_));
1110 layout->AddPaddingRow( 1143 layout->AddPaddingRow(
1111 0, delegate->GetMetric( 1144 0, delegate->GetMetric(
1112 LayoutDelegate::Metric::RELATED_CONTROL_VERTICAL_SPACING)); 1145 LayoutDelegate::Metric::RELATED_CONTROL_VERTICAL_SPACING));
1113 1146
1114 // Identity 1147 // Identity
1115 layout->StartRow(0, column_view_set_id); 1148 layout->StartRow(0, column_view_set_id);
1116 base::string16 identity_label_text = l10n_util::GetStringUTF16( 1149 base::string16 identity_label_text = l10n_util::GetStringUTF16(
1117 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CERT_IDENTITY); 1150 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CERT_IDENTITY);
1118 identity_label_ = new views::Label(identity_label_text); 1151 identity_label_ = new views::Label(identity_label_text);
1119 layout->AddView(identity_label_); 1152 layout->AddView(identity_label_);
1120 identity_textfield_ = new views::Textfield(); 1153 identity_textfield_ = new views::Textfield();
1121 identity_textfield_->SetAccessibleName(identity_label_text); 1154 identity_textfield_->SetAccessibleName(identity_label_text);
1122 identity_textfield_->set_controller(this); 1155 identity_textfield_->set_controller(this);
1123 identity_textfield_->SetEnabled(identity_ui_data_.IsEditable()); 1156 identity_textfield_->SetEnabled(identity_ui_data_.IsEditable());
1124 layout->AddView(identity_textfield_, 1, 1, views::GridLayout::FILL, 1157 if (ui::MaterialDesignController::IsSecondaryUiMaterial()) {
1125 views::GridLayout::FILL, 0, 1158 layout->AddView(identity_textfield_, 1, 1, views::GridLayout::FILL,
1126 ChildNetworkConfigView::kInputFieldHeight); 1159 views::GridLayout::FILL, 0,
1160 ChildNetworkConfigView::kInputFieldHeight);
1161 } else {
1162 layout->AddView(identity_textfield_);
1163 }
1127 layout->AddView(new ControlledSettingIndicatorView(identity_ui_data_)); 1164 layout->AddView(new ControlledSettingIndicatorView(identity_ui_data_));
1128 layout->AddPaddingRow( 1165 layout->AddPaddingRow(
1129 0, delegate->GetMetric( 1166 0, delegate->GetMetric(
1130 LayoutDelegate::Metric::RELATED_CONTROL_VERTICAL_SPACING)); 1167 LayoutDelegate::Metric::RELATED_CONTROL_VERTICAL_SPACING));
1131 } 1168 }
1132 1169
1133 // Passphrase input 1170 // Passphrase input
1134 layout->StartRow(0, column_view_set_id); 1171 layout->StartRow(0, column_view_set_id);
1135 int label_text_id = IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_PASSPHRASE; 1172 int label_text_id = IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_PASSPHRASE;
1136 base::string16 passphrase_label_text = 1173 base::string16 passphrase_label_text =
1137 l10n_util::GetStringUTF16(label_text_id); 1174 l10n_util::GetStringUTF16(label_text_id);
1138 passphrase_label_ = new views::Label(passphrase_label_text); 1175 passphrase_label_ = new views::Label(passphrase_label_text);
1139 layout->AddView(passphrase_label_); 1176 layout->AddView(passphrase_label_);
1140 passphrase_textfield_ = new PassphraseTextfield(); 1177 passphrase_textfield_ = new PassphraseTextfield();
1141 passphrase_textfield_->set_controller(this); 1178 passphrase_textfield_->set_controller(this);
1142 // Disable passphrase input initially for other network. 1179 // Disable passphrase input initially for other network.
1143 passphrase_label_->SetEnabled(network); 1180 passphrase_label_->SetEnabled(network);
1144 passphrase_textfield_->SetEnabled(network && 1181 passphrase_textfield_->SetEnabled(network &&
1145 passphrase_ui_data_.IsEditable()); 1182 passphrase_ui_data_.IsEditable());
1146 passphrase_textfield_->SetAccessibleName(passphrase_label_text); 1183 passphrase_textfield_->SetAccessibleName(passphrase_label_text);
1147 layout->AddView(passphrase_textfield_, 1, 1, views::GridLayout::FILL, 1184 if (ui::MaterialDesignController::IsSecondaryUiMaterial()) {
1148 views::GridLayout::FILL, 0, 1185 layout->AddView(passphrase_textfield_, 1, 1, views::GridLayout::FILL,
1149 ChildNetworkConfigView::kInputFieldHeight); 1186 views::GridLayout::FILL, 0,
1187 ChildNetworkConfigView::kInputFieldHeight);
1188 } else {
1189 layout->AddView(passphrase_textfield_);
1190 }
1150 1191
1151 if (passphrase_ui_data_.IsManaged()) { 1192 if (passphrase_ui_data_.IsManaged()) {
1152 layout->AddView(new ControlledSettingIndicatorView(passphrase_ui_data_)); 1193 layout->AddView(new ControlledSettingIndicatorView(passphrase_ui_data_));
1153 } else { 1194 } else {
1154 // Password visible button. 1195 // Password visible button.
1155 passphrase_visible_button_ = new views::ToggleImageButton(this); 1196 passphrase_visible_button_ = new views::ToggleImageButton(this);
1156 passphrase_visible_button_->SetFocusForPlatform(); 1197 passphrase_visible_button_->SetFocusForPlatform();
1157 passphrase_visible_button_->set_request_focus_on_press(true); 1198 passphrase_visible_button_->set_request_focus_on_press(true);
1158 passphrase_visible_button_->SetTooltipText( 1199 passphrase_visible_button_->SetTooltipText(
1159 l10n_util::GetStringUTF16( 1200 l10n_util::GetStringUTF16(
(...skipping 30 matching lines...) Expand all
1190 // Anonymous identity 1231 // Anonymous identity
1191 layout->StartRow(0, column_view_set_id); 1232 layout->StartRow(0, column_view_set_id);
1192 identity_anonymous_label_ = 1233 identity_anonymous_label_ =
1193 new views::Label(l10n_util::GetStringUTF16( 1234 new views::Label(l10n_util::GetStringUTF16(
1194 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CERT_IDENTITY_ANONYMOUS)); 1235 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CERT_IDENTITY_ANONYMOUS));
1195 layout->AddView(identity_anonymous_label_); 1236 layout->AddView(identity_anonymous_label_);
1196 identity_anonymous_textfield_ = new views::Textfield(); 1237 identity_anonymous_textfield_ = new views::Textfield();
1197 identity_anonymous_label_->SetEnabled(false); 1238 identity_anonymous_label_->SetEnabled(false);
1198 identity_anonymous_textfield_->SetEnabled(false); 1239 identity_anonymous_textfield_->SetEnabled(false);
1199 identity_anonymous_textfield_->set_controller(this); 1240 identity_anonymous_textfield_->set_controller(this);
1200 layout->AddView(identity_anonymous_textfield_, 1, 1, 1241 if (ui::MaterialDesignController::IsSecondaryUiMaterial()) {
1201 views::GridLayout::FILL, views::GridLayout::FILL, 0, 1242 layout->AddView(identity_anonymous_textfield_, 1, 1,
1202 ChildNetworkConfigView::kInputFieldHeight); 1243 views::GridLayout::FILL, views::GridLayout::FILL, 0,
1244 ChildNetworkConfigView::kInputFieldHeight);
1245 } else {
1246 layout->AddView(identity_anonymous_textfield_);
1247 }
1203 layout->AddView( 1248 layout->AddView(
1204 new ControlledSettingIndicatorView(identity_anonymous_ui_data_)); 1249 new ControlledSettingIndicatorView(identity_anonymous_ui_data_));
1205 layout->AddPaddingRow( 1250 layout->AddPaddingRow(
1206 0, delegate->GetMetric( 1251 0, delegate->GetMetric(
1207 LayoutDelegate::Metric::RELATED_CONTROL_VERTICAL_SPACING)); 1252 LayoutDelegate::Metric::RELATED_CONTROL_VERTICAL_SPACING));
1208 } 1253 }
1209 1254
1210 // We need a little bit more padding before Checkboxes. 1255 if (ui::MaterialDesignController::IsSecondaryUiMaterial()) {
1211 layout->AddPaddingRow( 1256 // We need a little bit more padding above Checkboxes.
1212 0, delegate->GetMetric( 1257 layout->AddPaddingRow(
1213 LayoutDelegate::Metric::RELATED_CONTROL_VERTICAL_SPACING)); 1258 0, delegate->GetMetric(
1259 LayoutDelegate::Metric::RELATED_CONTROL_VERTICAL_SPACING));
1260 }
1214 1261
1215 // Checkboxes. 1262 // Checkboxes.
1216 1263
1217 // Save credentials 1264 // Save credentials
1218 if (show_8021x) { 1265 if (show_8021x) {
1219 layout->StartRow(0, column_view_set_id); 1266 layout->StartRow(0, column_view_set_id);
1220 save_credentials_checkbox_ = new views::Checkbox( 1267 save_credentials_checkbox_ = new views::Checkbox(
1221 l10n_util::GetStringUTF16( 1268 l10n_util::GetStringUTF16(
1222 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_SAVE_CREDENTIALS)); 1269 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_SAVE_CREDENTIALS));
1223 save_credentials_checkbox_->SetEnabled( 1270 save_credentials_checkbox_->SetEnabled(
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
1441 void WifiConfigView::ParseEAPUIProperty(NetworkPropertyUIData* property_ui_data, 1488 void WifiConfigView::ParseEAPUIProperty(NetworkPropertyUIData* property_ui_data,
1442 const NetworkState* network, 1489 const NetworkState* network,
1443 const std::string& key) { 1490 const std::string& key) {
1444 std::string onc_tag = network->type() == shill::kTypeEthernet 1491 std::string onc_tag = network->type() == shill::kTypeEthernet
1445 ? ::onc::ethernet::kEAP 1492 ? ::onc::ethernet::kEAP
1446 : ::onc::wifi::kEAP; 1493 : ::onc::wifi::kEAP;
1447 ParseUIProperty(property_ui_data, network, onc_tag + '.' + key); 1494 ParseUIProperty(property_ui_data, network, onc_tag + '.' + key);
1448 } 1495 }
1449 1496
1450 } // namespace chromeos 1497 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/options/network_config_view.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698