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

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

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

Powered by Google App Engine
This is Rietveld 408576698