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

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

Powered by Google App Engine
This is Rietveld 408576698