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

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

Issue 2659973003: [Harmony] Harmony Chrome OS Wifi dialog. (Closed)
Patch Set: Address oshima@'s comments. 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
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"
17 #include "chrome/grit/generated_resources.h" 18 #include "chrome/grit/generated_resources.h"
18 #include "chrome/grit/theme_resources.h" 19 #include "chrome/grit/theme_resources.h"
19 #include "chromeos/login/login_state.h" 20 #include "chromeos/login/login_state.h"
20 #include "chromeos/network/client_cert_util.h" 21 #include "chromeos/network/client_cert_util.h"
21 #include "chromeos/network/network_configuration_handler.h" 22 #include "chromeos/network/network_configuration_handler.h"
22 #include "chromeos/network/network_connect.h" 23 #include "chromeos/network/network_connect.h"
23 #include "chromeos/network/network_event_log.h" 24 #include "chromeos/network/network_event_log.h"
24 #include "chromeos/network/network_handler.h" 25 #include "chromeos/network/network_handler.h"
25 #include "chromeos/network/network_state.h" 26 #include "chromeos/network/network_state.h"
26 #include "chromeos/network/network_state_handler.h" 27 #include "chromeos/network/network_state_handler.h"
27 #include "chromeos/network/network_ui_data.h" 28 #include "chromeos/network/network_ui_data.h"
28 #include "chromeos/network/onc/onc_utils.h" 29 #include "chromeos/network/onc/onc_utils.h"
29 #include "chromeos/network/shill_property_util.h" 30 #include "chromeos/network/shill_property_util.h"
30 #include "components/onc/onc_constants.h" 31 #include "components/onc/onc_constants.h"
31 #include "third_party/cros_system_api/dbus/service_constants.h" 32 #include "third_party/cros_system_api/dbus/service_constants.h"
32 #include "ui/base/l10n/l10n_util.h" 33 #include "ui/base/l10n/l10n_util.h"
33 #include "ui/base/resource/resource_bundle.h" 34 #include "ui/base/resource/resource_bundle.h"
34 #include "ui/events/event.h" 35 #include "ui/events/event.h"
35 #include "ui/views/controls/button/checkbox.h" 36 #include "ui/views/controls/button/checkbox.h"
36 #include "ui/views/controls/button/image_button.h" 37 #include "ui/views/controls/button/image_button.h"
37 #include "ui/views/controls/combobox/combobox.h" 38 #include "ui/views/controls/combobox/combobox.h"
38 #include "ui/views/controls/label.h" 39 #include "ui/views/controls/label.h"
39 #include "ui/views/controls/textfield/textfield.h" 40 #include "ui/views/controls/textfield/textfield.h"
40 #include "ui/views/layout/grid_layout.h" 41 #include "ui/views/layout/grid_layout.h"
41 #include "ui/views/layout/layout_constants.h"
42 #include "ui/views/widget/widget.h" 42 #include "ui/views/widget/widget.h"
43 #include "ui/views/window/dialog_client_view.h" 43 #include "ui/views/window/dialog_client_view.h"
44 44
45 namespace chromeos { 45 namespace chromeos {
46 46
47 namespace { 47 namespace {
48 48
49 // Combobox that supports a preferred width. Used by Server CA combobox 49 // Combobox that supports a preferred width. Used by Server CA combobox
50 // because the strings inside it are too wide. 50 // because the strings inside it are too wide.
51 class ComboboxWithWidth : public views::Combobox { 51 class ComboboxWithWidth : public views::Combobox {
(...skipping 875 matching lines...) Expand 10 before | Expand all | Expand 10 after
927 ParseEAPUIProperty( 927 ParseEAPUIProperty(
928 &identity_anonymous_ui_data_, network, ::onc::eap::kAnonymousIdentity); 928 &identity_anonymous_ui_data_, network, ::onc::eap::kAnonymousIdentity);
929 ParseEAPUIProperty( 929 ParseEAPUIProperty(
930 &save_credentials_ui_data_, network, ::onc::eap::kSaveCredentials); 930 &save_credentials_ui_data_, network, ::onc::eap::kSaveCredentials);
931 if (show_8021x) 931 if (show_8021x)
932 ParseEAPUIProperty(&passphrase_ui_data_, network, ::onc::eap::kPassword); 932 ParseEAPUIProperty(&passphrase_ui_data_, network, ::onc::eap::kPassword);
933 else 933 else
934 ParseUIProperty(&passphrase_ui_data_, network, ::onc::wifi::kPassphrase); 934 ParseUIProperty(&passphrase_ui_data_, network, ::onc::wifi::kPassphrase);
935 } 935 }
936 936
937 views::GridLayout* layout = views::GridLayout::CreatePanel(this); 937 views::GridLayout* layout = new views::GridLayout(this);
938 SetLayoutManager(layout); 938 LayoutDelegate* delegate = LayoutDelegate::Get();
939 layout->SetInsets(gfx::Insets(
940 delegate->GetLayoutDistance(
941 LayoutDelegate::LayoutDistanceType::PANEL_HORIZ_MARGIN),
942 delegate->GetLayoutDistance(
943 LayoutDelegate::LayoutDistanceType::PANEL_VERT_MARGIN),
944 delegate->GetLayoutDistance(
945 LayoutDelegate::LayoutDistanceType::BUTTON_VEDGE_MARGIN_NEW),
946 delegate->GetLayoutDistance(
947 LayoutDelegate::LayoutDistanceType::BUTTON_HEDGE_MARGIN_NEW)));
948 this->SetLayoutManager(layout);
939 949
940 const int column_view_set_id = 0; 950 const int column_view_set_id = 0;
941 views::ColumnSet* column_set = layout->AddColumnSet(column_view_set_id); 951 views::ColumnSet* column_set = layout->AddColumnSet(column_view_set_id);
952 const int kLableMinWidth = 150;
Elly Fong-Jones 2017/01/30 18:06:40 Lable -> Label
xdai1 2017/01/30 18:46:36 Done.
942 const int kPasswordVisibleWidth = 20; 953 const int kPasswordVisibleWidth = 20;
943 // Label 954 // Label
944 column_set->AddColumn(views::GridLayout::LEADING, views::GridLayout::FILL, 1, 955 column_set->AddColumn(views::GridLayout::LEADING, views::GridLayout::FILL, 1,
945 views::GridLayout::USE_PREF, 0, 0); 956 views::GridLayout::USE_PREF, 0, kLableMinWidth);
946 column_set->AddPaddingColumn(0, views::kRelatedControlSmallHorizontalSpacing); 957 column_set->AddPaddingColumn(
958 0, delegate->GetLayoutDistance(LayoutDelegate::LayoutDistanceType::
959 RELATED_CONTROL_HORIZONTAL_SPACING));
947 // Textfield, combobox. 960 // Textfield, combobox.
948 column_set->AddColumn(views::GridLayout::FILL, views::GridLayout::FILL, 1, 961 column_set->AddColumn(views::GridLayout::FILL, views::GridLayout::FILL, 1,
949 views::GridLayout::USE_PREF, 0, 962 views::GridLayout::USE_PREF, 0,
950 ChildNetworkConfigView::kInputFieldMinWidth); 963 ChildNetworkConfigView::kInputFieldMinWidth);
951 column_set->AddPaddingColumn(0, views::kRelatedControlSmallHorizontalSpacing); 964 column_set->AddPaddingColumn(
965 0, delegate->GetLayoutDistance(LayoutDelegate::LayoutDistanceType::
966 RELATED_CONTROL_HORIZONTAL_SPACING));
952 // Password visible button / policy indicator. 967 // Password visible button / policy indicator.
953 column_set->AddColumn(views::GridLayout::CENTER, views::GridLayout::FILL, 1, 968 column_set->AddColumn(views::GridLayout::CENTER, views::GridLayout::FILL, 0,
954 views::GridLayout::USE_PREF, 0, kPasswordVisibleWidth); 969 views::GridLayout::FIXED, kPasswordVisibleWidth, 0);
970 column_set->AddPaddingColumn(
Elly Fong-Jones 2017/01/30 18:06:41 this column wasn't here before - is it meant to be
xdai1 2017/01/30 18:46:36 Yes. See this mock https://improv.googleplex.com/p
971 0, delegate->GetLayoutDistance(LayoutDelegate::LayoutDistanceType::
972 RELATED_CONTROL_HORIZONTAL_SPACING));
955 973
956 // SSID input 974 // SSID input
957 if (!network || network->type() != shill::kTypeEthernet) { 975 if (!network || network->type() != shill::kTypeEthernet) {
958 layout->StartRow(0, column_view_set_id); 976 layout->StartRow(0, column_view_set_id);
959 layout->AddView(new views::Label(l10n_util::GetStringUTF16( 977 layout->AddView(new views::Label(l10n_util::GetStringUTF16(
960 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_NETWORK_ID))); 978 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_NETWORK_ID)));
961 if (!network) { 979 if (!network) {
962 ssid_textfield_ = new views::Textfield(); 980 ssid_textfield_ = new views::Textfield();
963 ssid_textfield_->set_controller(this); 981 ssid_textfield_->set_controller(this);
964 ssid_textfield_->SetAccessibleName(l10n_util::GetStringUTF16( 982 ssid_textfield_->SetAccessibleName(l10n_util::GetStringUTF16(
965 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_NETWORK_ID)); 983 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_NETWORK_ID));
966 layout->AddView(ssid_textfield_); 984 layout->AddView(ssid_textfield_, 1, 1, views::GridLayout::FILL,
985 views::GridLayout::FILL, 0,
986 ChildNetworkConfigView::kInputFieldHeight);
967 } else { 987 } else {
968 views::Label* label = 988 views::Label* label =
969 new views::Label(base::UTF8ToUTF16(network->name())); 989 new views::Label(base::UTF8ToUTF16(network->name()));
970 label->SetHorizontalAlignment(gfx::ALIGN_LEFT); 990 label->SetHorizontalAlignment(gfx::ALIGN_LEFT);
971 layout->AddView(label); 991 layout->AddView(label);
972 } 992 }
973 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); 993 layout->AddPaddingRow(
994 0, delegate->GetLayoutDistance(LayoutDelegate::LayoutDistanceType::
995 RELATED_CONTROL_VERTICAL_SPACING));
974 } 996 }
975 997
976 // Security select 998 // Security select
977 if (!network && !show_8021x) { 999 if (!network && !show_8021x) {
978 layout->StartRow(0, column_view_set_id); 1000 layout->StartRow(0, column_view_set_id);
979 base::string16 label_text = l10n_util::GetStringUTF16( 1001 base::string16 label_text = l10n_util::GetStringUTF16(
980 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_SECURITY); 1002 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_SECURITY);
981 layout->AddView(new views::Label(label_text)); 1003 layout->AddView(new views::Label(label_text));
982 security_combobox_model_.reset(new internal::SecurityComboboxModel); 1004 security_combobox_model_.reset(new internal::SecurityComboboxModel);
983 security_combobox_ = new views::Combobox(security_combobox_model_.get()); 1005 security_combobox_ = new views::Combobox(security_combobox_model_.get());
984 security_combobox_->SetAccessibleName(label_text); 1006 security_combobox_->SetAccessibleName(label_text);
985 security_combobox_->set_listener(this); 1007 security_combobox_->set_listener(this);
1008 layout->AddView(security_combobox_, 1, 1, views::GridLayout::FILL,
1009 views::GridLayout::FILL, 0,
1010 ChildNetworkConfigView::kInputFieldHeight);
986 layout->AddView(security_combobox_); 1011 layout->AddView(security_combobox_);
987 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); 1012 layout->AddPaddingRow(
1013 0, delegate->GetLayoutDistance(LayoutDelegate::LayoutDistanceType::
1014 RELATED_CONTROL_VERTICAL_SPACING));
988 } 1015 }
989 1016
990 // Only enumerate certificates in the data model for 802.1X networks. 1017 // Only enumerate certificates in the data model for 802.1X networks.
991 if (show_8021x) { 1018 if (show_8021x) {
992 // Observer any changes to the certificate list. 1019 // Observer any changes to the certificate list.
993 CertLibrary::Get()->AddObserver(this); 1020 CertLibrary::Get()->AddObserver(this);
994 1021
995 // EAP method 1022 // EAP method
996 layout->StartRow(0, column_view_set_id); 1023 layout->StartRow(0, column_view_set_id);
997 base::string16 eap_label_text = l10n_util::GetStringUTF16( 1024 base::string16 eap_label_text = l10n_util::GetStringUTF16(
998 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_EAP_METHOD); 1025 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_EAP_METHOD);
999 layout->AddView(new views::Label(eap_label_text)); 1026 layout->AddView(new views::Label(eap_label_text));
1000 eap_method_combobox_model_.reset(new internal::EAPMethodComboboxModel); 1027 eap_method_combobox_model_.reset(new internal::EAPMethodComboboxModel);
1001 eap_method_combobox_ = new views::Combobox( 1028 eap_method_combobox_ = new views::Combobox(
1002 eap_method_combobox_model_.get()); 1029 eap_method_combobox_model_.get());
1003 eap_method_combobox_->SetAccessibleName(eap_label_text); 1030 eap_method_combobox_->SetAccessibleName(eap_label_text);
1004 eap_method_combobox_->set_listener(this); 1031 eap_method_combobox_->set_listener(this);
1005 eap_method_combobox_->SetEnabled(eap_method_ui_data_.IsEditable()); 1032 eap_method_combobox_->SetEnabled(eap_method_ui_data_.IsEditable());
1006 layout->AddView(eap_method_combobox_); 1033 layout->AddView(eap_method_combobox_, 1, 1, views::GridLayout::FILL,
1034 views::GridLayout::FILL, 0,
1035 ChildNetworkConfigView::kInputFieldHeight);
1007 layout->AddView(new ControlledSettingIndicatorView(eap_method_ui_data_)); 1036 layout->AddView(new ControlledSettingIndicatorView(eap_method_ui_data_));
1008 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); 1037 layout->AddPaddingRow(
1038 0, delegate->GetLayoutDistance(LayoutDelegate::LayoutDistanceType::
1039 RELATED_CONTROL_VERTICAL_SPACING));
1009 1040
1010 // Phase 2 authentication 1041 // Phase 2 authentication
1011 layout->StartRow(0, column_view_set_id); 1042 layout->StartRow(0, column_view_set_id);
1012 base::string16 phase_2_label_text = l10n_util::GetStringUTF16( 1043 base::string16 phase_2_label_text = l10n_util::GetStringUTF16(
1013 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_PHASE_2_AUTH); 1044 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_PHASE_2_AUTH);
1014 phase_2_auth_label_ = new views::Label(phase_2_label_text); 1045 phase_2_auth_label_ = new views::Label(phase_2_label_text);
1015 layout->AddView(phase_2_auth_label_); 1046 layout->AddView(phase_2_auth_label_);
1016 phase_2_auth_combobox_model_.reset( 1047 phase_2_auth_combobox_model_.reset(
1017 new internal::Phase2AuthComboboxModel(eap_method_combobox_)); 1048 new internal::Phase2AuthComboboxModel(eap_method_combobox_));
1018 phase_2_auth_combobox_ = new views::Combobox( 1049 phase_2_auth_combobox_ = new views::Combobox(
1019 phase_2_auth_combobox_model_.get()); 1050 phase_2_auth_combobox_model_.get());
1020 phase_2_auth_combobox_->SetAccessibleName(phase_2_label_text); 1051 phase_2_auth_combobox_->SetAccessibleName(phase_2_label_text);
1021 phase_2_auth_label_->SetEnabled(false); 1052 phase_2_auth_label_->SetEnabled(false);
1022 phase_2_auth_combobox_->SetEnabled(false); 1053 phase_2_auth_combobox_->SetEnabled(false);
1023 phase_2_auth_combobox_->set_listener(this); 1054 phase_2_auth_combobox_->set_listener(this);
1024 layout->AddView(phase_2_auth_combobox_); 1055 layout->AddView(phase_2_auth_combobox_, 1, 1, views::GridLayout::FILL,
1056 views::GridLayout::FILL, 0,
1057 ChildNetworkConfigView::kInputFieldHeight);
1025 layout->AddView(new ControlledSettingIndicatorView(phase_2_auth_ui_data_)); 1058 layout->AddView(new ControlledSettingIndicatorView(phase_2_auth_ui_data_));
1026 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); 1059 layout->AddPaddingRow(
1060 0, delegate->GetLayoutDistance(LayoutDelegate::LayoutDistanceType::
1061 RELATED_CONTROL_VERTICAL_SPACING));
1027 1062
1028 // Server CA certificate 1063 // Server CA certificate
1029 layout->StartRow(0, column_view_set_id); 1064 layout->StartRow(0, column_view_set_id);
1030 base::string16 server_ca_cert_label_text = l10n_util::GetStringUTF16( 1065 base::string16 server_ca_cert_label_text = l10n_util::GetStringUTF16(
1031 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CERT_SERVER_CA); 1066 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CERT_SERVER_CA);
1032 server_ca_cert_label_ = new views::Label(server_ca_cert_label_text); 1067 server_ca_cert_label_ = new views::Label(server_ca_cert_label_text);
1033 layout->AddView(server_ca_cert_label_); 1068 layout->AddView(server_ca_cert_label_);
1034 server_ca_cert_combobox_model_.reset( 1069 server_ca_cert_combobox_model_.reset(
1035 new internal::ServerCACertComboboxModel()); 1070 new internal::ServerCACertComboboxModel());
1036 server_ca_cert_combobox_ = new ComboboxWithWidth( 1071 server_ca_cert_combobox_ = new ComboboxWithWidth(
1037 server_ca_cert_combobox_model_.get(), 1072 server_ca_cert_combobox_model_.get(),
1038 ChildNetworkConfigView::kInputFieldMinWidth); 1073 ChildNetworkConfigView::kInputFieldMinWidth);
1039 server_ca_cert_combobox_->SetAccessibleName(server_ca_cert_label_text); 1074 server_ca_cert_combobox_->SetAccessibleName(server_ca_cert_label_text);
1040 server_ca_cert_label_->SetEnabled(false); 1075 server_ca_cert_label_->SetEnabled(false);
1041 server_ca_cert_combobox_->SetEnabled(false); 1076 server_ca_cert_combobox_->SetEnabled(false);
1042 server_ca_cert_combobox_->set_listener(this); 1077 server_ca_cert_combobox_->set_listener(this);
1043 layout->AddView(server_ca_cert_combobox_); 1078 layout->AddView(server_ca_cert_combobox_, 1, 1, views::GridLayout::FILL,
1079 views::GridLayout::FILL, 0,
1080 ChildNetworkConfigView::kInputFieldHeight);
1044 layout->AddView( 1081 layout->AddView(
1045 new ControlledSettingIndicatorView(server_ca_cert_ui_data_)); 1082 new ControlledSettingIndicatorView(server_ca_cert_ui_data_));
1046 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); 1083 layout->AddPaddingRow(
1084 0, delegate->GetLayoutDistance(LayoutDelegate::LayoutDistanceType::
1085 RELATED_CONTROL_VERTICAL_SPACING));
1047 1086
1048 // Subject Match 1087 // Subject Match
1049 layout->StartRow(0, column_view_set_id); 1088 layout->StartRow(0, column_view_set_id);
1050 base::string16 subject_match_label_text = l10n_util::GetStringUTF16( 1089 base::string16 subject_match_label_text = l10n_util::GetStringUTF16(
1051 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_EAP_SUBJECT_MATCH); 1090 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_EAP_SUBJECT_MATCH);
1052 subject_match_label_ = new views::Label(subject_match_label_text); 1091 subject_match_label_ = new views::Label(subject_match_label_text);
1053 layout->AddView(subject_match_label_); 1092 layout->AddView(subject_match_label_);
1054 subject_match_textfield_ = new views::Textfield(); 1093 subject_match_textfield_ = new views::Textfield();
1055 subject_match_textfield_->SetAccessibleName(subject_match_label_text); 1094 subject_match_textfield_->SetAccessibleName(subject_match_label_text);
1056 subject_match_textfield_->set_controller(this); 1095 subject_match_textfield_->set_controller(this);
1057 layout->AddView(subject_match_textfield_); 1096 layout->AddView(subject_match_textfield_, 1, 1, views::GridLayout::FILL,
1058 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); 1097 views::GridLayout::FILL, 0,
1098 ChildNetworkConfigView::kInputFieldHeight);
1099 layout->AddPaddingRow(
1100 0, delegate->GetLayoutDistance(LayoutDelegate::LayoutDistanceType::
1101 RELATED_CONTROL_VERTICAL_SPACING));
1059 1102
1060 // User certificate 1103 // User certificate
1061 layout->StartRow(0, column_view_set_id); 1104 layout->StartRow(0, column_view_set_id);
1062 base::string16 user_cert_label_text = l10n_util::GetStringUTF16( 1105 base::string16 user_cert_label_text = l10n_util::GetStringUTF16(
1063 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CERT); 1106 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CERT);
1064 user_cert_label_ = new views::Label(user_cert_label_text); 1107 user_cert_label_ = new views::Label(user_cert_label_text);
1065 layout->AddView(user_cert_label_); 1108 layout->AddView(user_cert_label_);
1066 user_cert_combobox_model_.reset(new internal::UserCertComboboxModel(this)); 1109 user_cert_combobox_model_.reset(new internal::UserCertComboboxModel(this));
1067 user_cert_combobox_ = new views::Combobox(user_cert_combobox_model_.get()); 1110 user_cert_combobox_ = new views::Combobox(user_cert_combobox_model_.get());
1068 user_cert_combobox_->SetAccessibleName(user_cert_label_text); 1111 user_cert_combobox_->SetAccessibleName(user_cert_label_text);
1069 user_cert_label_->SetEnabled(false); 1112 user_cert_label_->SetEnabled(false);
1070 user_cert_combobox_->SetEnabled(false); 1113 user_cert_combobox_->SetEnabled(false);
1071 user_cert_combobox_->set_listener(this); 1114 user_cert_combobox_->set_listener(this);
1072 layout->AddView(user_cert_combobox_); 1115 layout->AddView(user_cert_combobox_, 1, 1, views::GridLayout::FILL,
1116 views::GridLayout::FILL, 0,
1117 ChildNetworkConfigView::kInputFieldHeight);
1073 layout->AddView(new ControlledSettingIndicatorView(user_cert_ui_data_)); 1118 layout->AddView(new ControlledSettingIndicatorView(user_cert_ui_data_));
1074 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); 1119 layout->AddPaddingRow(
1120 0, delegate->GetLayoutDistance(LayoutDelegate::LayoutDistanceType::
1121 RELATED_CONTROL_VERTICAL_SPACING));
1075 1122
1076 // Identity 1123 // Identity
1077 layout->StartRow(0, column_view_set_id); 1124 layout->StartRow(0, column_view_set_id);
1078 base::string16 identity_label_text = l10n_util::GetStringUTF16( 1125 base::string16 identity_label_text = l10n_util::GetStringUTF16(
1079 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CERT_IDENTITY); 1126 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CERT_IDENTITY);
1080 identity_label_ = new views::Label(identity_label_text); 1127 identity_label_ = new views::Label(identity_label_text);
1081 layout->AddView(identity_label_); 1128 layout->AddView(identity_label_);
1082 identity_textfield_ = new views::Textfield(); 1129 identity_textfield_ = new views::Textfield();
1083 identity_textfield_->SetAccessibleName(identity_label_text); 1130 identity_textfield_->SetAccessibleName(identity_label_text);
1084 identity_textfield_->set_controller(this); 1131 identity_textfield_->set_controller(this);
1085 identity_textfield_->SetEnabled(identity_ui_data_.IsEditable()); 1132 identity_textfield_->SetEnabled(identity_ui_data_.IsEditable());
1086 layout->AddView(identity_textfield_); 1133 layout->AddView(identity_textfield_, 1, 1, views::GridLayout::FILL,
1134 views::GridLayout::FILL, 0,
1135 ChildNetworkConfigView::kInputFieldHeight);
1087 layout->AddView(new ControlledSettingIndicatorView(identity_ui_data_)); 1136 layout->AddView(new ControlledSettingIndicatorView(identity_ui_data_));
1088 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); 1137 layout->AddPaddingRow(
1138 0, delegate->GetLayoutDistance(LayoutDelegate::LayoutDistanceType::
1139 RELATED_CONTROL_VERTICAL_SPACING));
1089 } 1140 }
1090 1141
1091 // Passphrase input 1142 // Passphrase input
1092 layout->StartRow(0, column_view_set_id); 1143 layout->StartRow(0, column_view_set_id);
1093 int label_text_id = IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_PASSPHRASE; 1144 int label_text_id = IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_PASSPHRASE;
1094 base::string16 passphrase_label_text = 1145 base::string16 passphrase_label_text =
1095 l10n_util::GetStringUTF16(label_text_id); 1146 l10n_util::GetStringUTF16(label_text_id);
1096 passphrase_label_ = new views::Label(passphrase_label_text); 1147 passphrase_label_ = new views::Label(passphrase_label_text);
1097 layout->AddView(passphrase_label_); 1148 layout->AddView(passphrase_label_);
1098 passphrase_textfield_ = new PassphraseTextfield(); 1149 passphrase_textfield_ = new PassphraseTextfield();
1099 passphrase_textfield_->set_controller(this); 1150 passphrase_textfield_->set_controller(this);
1100 // Disable passphrase input initially for other network. 1151 // Disable passphrase input initially for other network.
1101 passphrase_label_->SetEnabled(network); 1152 passphrase_label_->SetEnabled(network);
1102 passphrase_textfield_->SetEnabled(network && 1153 passphrase_textfield_->SetEnabled(network &&
1103 passphrase_ui_data_.IsEditable()); 1154 passphrase_ui_data_.IsEditable());
1104 passphrase_textfield_->SetAccessibleName(passphrase_label_text); 1155 passphrase_textfield_->SetAccessibleName(passphrase_label_text);
1105 layout->AddView(passphrase_textfield_); 1156 layout->AddView(passphrase_textfield_, 1, 1, views::GridLayout::FILL,
1157 views::GridLayout::FILL, 0,
1158 ChildNetworkConfigView::kInputFieldHeight);
1106 1159
1107 if (passphrase_ui_data_.IsManaged()) { 1160 if (passphrase_ui_data_.IsManaged()) {
1108 layout->AddView(new ControlledSettingIndicatorView(passphrase_ui_data_)); 1161 layout->AddView(new ControlledSettingIndicatorView(passphrase_ui_data_));
1109 } else { 1162 } else {
1110 // Password visible button. 1163 // Password visible button.
1111 passphrase_visible_button_ = new views::ToggleImageButton(this); 1164 passphrase_visible_button_ = new views::ToggleImageButton(this);
1112 passphrase_visible_button_->SetFocusForPlatform(); 1165 passphrase_visible_button_->SetFocusForPlatform();
1113 passphrase_visible_button_->set_request_focus_on_press(true); 1166 passphrase_visible_button_->set_request_focus_on_press(true);
1114 passphrase_visible_button_->SetTooltipText( 1167 passphrase_visible_button_->SetTooltipText(
1115 l10n_util::GetStringUTF16( 1168 l10n_util::GetStringUTF16(
(...skipping 15 matching lines...) Expand all
1131 GetImageSkiaNamed(IDR_NETWORK_HIDE_PASSWORD)); 1184 GetImageSkiaNamed(IDR_NETWORK_HIDE_PASSWORD));
1132 passphrase_visible_button_->SetToggledImage( 1185 passphrase_visible_button_->SetToggledImage(
1133 views::ImageButton::STATE_HOVERED, 1186 views::ImageButton::STATE_HOVERED,
1134 ResourceBundle::GetSharedInstance(). 1187 ResourceBundle::GetSharedInstance().
1135 GetImageSkiaNamed(IDR_NETWORK_HIDE_PASSWORD_HOVER)); 1188 GetImageSkiaNamed(IDR_NETWORK_HIDE_PASSWORD_HOVER));
1136 passphrase_visible_button_->SetImageAlignment( 1189 passphrase_visible_button_->SetImageAlignment(
1137 views::ImageButton::ALIGN_CENTER, views::ImageButton::ALIGN_MIDDLE); 1190 views::ImageButton::ALIGN_CENTER, views::ImageButton::ALIGN_MIDDLE);
1138 layout->AddView(passphrase_visible_button_); 1191 layout->AddView(passphrase_visible_button_);
1139 } 1192 }
1140 1193
1141 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); 1194 layout->AddPaddingRow(
1195 0, delegate->GetLayoutDistance(LayoutDelegate::LayoutDistanceType::
1196 RELATED_CONTROL_VERTICAL_SPACING));
1142 1197
1143 if (show_8021x) { 1198 if (show_8021x) {
1144 // Anonymous identity 1199 // Anonymous identity
1145 layout->StartRow(0, column_view_set_id); 1200 layout->StartRow(0, column_view_set_id);
1146 identity_anonymous_label_ = 1201 identity_anonymous_label_ =
1147 new views::Label(l10n_util::GetStringUTF16( 1202 new views::Label(l10n_util::GetStringUTF16(
1148 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CERT_IDENTITY_ANONYMOUS)); 1203 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CERT_IDENTITY_ANONYMOUS));
1149 layout->AddView(identity_anonymous_label_); 1204 layout->AddView(identity_anonymous_label_);
1150 identity_anonymous_textfield_ = new views::Textfield(); 1205 identity_anonymous_textfield_ = new views::Textfield();
1151 identity_anonymous_label_->SetEnabled(false); 1206 identity_anonymous_label_->SetEnabled(false);
1152 identity_anonymous_textfield_->SetEnabled(false); 1207 identity_anonymous_textfield_->SetEnabled(false);
1153 identity_anonymous_textfield_->set_controller(this); 1208 identity_anonymous_textfield_->set_controller(this);
1154 layout->AddView(identity_anonymous_textfield_); 1209 layout->AddView(identity_anonymous_textfield_, 1, 1,
1210 views::GridLayout::FILL, views::GridLayout::FILL, 0,
1211 ChildNetworkConfigView::kInputFieldHeight);
1155 layout->AddView( 1212 layout->AddView(
1156 new ControlledSettingIndicatorView(identity_anonymous_ui_data_)); 1213 new ControlledSettingIndicatorView(identity_anonymous_ui_data_));
1157 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); 1214 layout->AddPaddingRow(
1215 0, delegate->GetLayoutDistance(LayoutDelegate::LayoutDistanceType::
1216 RELATED_CONTROL_VERTICAL_SPACING));
1158 } 1217 }
1159 1218
1219 // We need a little bit more padding before Checkboxes.
1220 layout->AddPaddingRow(
1221 0, delegate->GetLayoutDistance(LayoutDelegate::LayoutDistanceType::
1222 RELATED_CONTROL_VERTICAL_SPACING));
1223
1160 // Checkboxes. 1224 // Checkboxes.
1161 1225
1162 // Save credentials 1226 // Save credentials
1163 if (show_8021x) { 1227 if (show_8021x) {
1164 layout->StartRow(0, column_view_set_id); 1228 layout->StartRow(0, column_view_set_id);
1165 save_credentials_checkbox_ = new views::Checkbox( 1229 save_credentials_checkbox_ = new views::Checkbox(
1166 l10n_util::GetStringUTF16( 1230 l10n_util::GetStringUTF16(
1167 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_SAVE_CREDENTIALS)); 1231 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_SAVE_CREDENTIALS));
1168 save_credentials_checkbox_->SetEnabled( 1232 save_credentials_checkbox_->SetEnabled(
1169 save_credentials_ui_data_.IsEditable()); 1233 save_credentials_ui_data_.IsEditable());
1170 layout->SkipColumns(1); 1234 layout->SkipColumns(1);
1171 layout->AddView(save_credentials_checkbox_); 1235 layout->AddView(save_credentials_checkbox_);
1172 layout->AddView( 1236 layout->AddView(
1173 new ControlledSettingIndicatorView(save_credentials_ui_data_)); 1237 new ControlledSettingIndicatorView(save_credentials_ui_data_));
1174 } 1238 }
1175 1239
1176 // Share network 1240 // Share network
1177 if (!network || network->profile_path().empty()) { 1241 if (!network || network->profile_path().empty()) {
1178 layout->StartRow(0, column_view_set_id); 1242 layout->StartRow(0, column_view_set_id);
1179 share_network_checkbox_ = new views::Checkbox( 1243 share_network_checkbox_ = new views::Checkbox(
1180 l10n_util::GetStringUTF16( 1244 l10n_util::GetStringUTF16(
1181 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_SHARE_NETWORK)); 1245 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_SHARE_NETWORK));
1182 layout->SkipColumns(1); 1246 layout->SkipColumns(1);
1183 layout->AddView(share_network_checkbox_); 1247 layout->AddView(share_network_checkbox_);
1184 } 1248 }
1185 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); 1249 layout->AddPaddingRow(
1250 0, delegate->GetLayoutDistance(LayoutDelegate::LayoutDistanceType::
1251 RELATED_CONTROL_VERTICAL_SPACING));
1186 1252
1187 // Create an error label. 1253 // Create an error label.
1188 layout->StartRow(0, column_view_set_id); 1254 layout->StartRow(0, column_view_set_id);
1189 layout->SkipColumns(1); 1255 layout->SkipColumns(1);
1190 error_label_ = new views::Label(); 1256 error_label_ = new views::Label();
1191 error_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT); 1257 error_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
1192 error_label_->SetEnabledColor(SK_ColorRED); 1258 error_label_->SetEnabledColor(SK_ColorRED);
1193 layout->AddView(error_label_); 1259 layout->AddView(error_label_);
1194 1260
1195 // Initialize the field and checkbox values. 1261 // Initialize the field and checkbox values.
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
1384 void WifiConfigView::ParseEAPUIProperty(NetworkPropertyUIData* property_ui_data, 1450 void WifiConfigView::ParseEAPUIProperty(NetworkPropertyUIData* property_ui_data,
1385 const NetworkState* network, 1451 const NetworkState* network,
1386 const std::string& key) { 1452 const std::string& key) {
1387 std::string onc_tag = network->type() == shill::kTypeEthernet 1453 std::string onc_tag = network->type() == shill::kTypeEthernet
1388 ? ::onc::ethernet::kEAP 1454 ? ::onc::ethernet::kEAP
1389 : ::onc::wifi::kEAP; 1455 : ::onc::wifi::kEAP;
1390 ParseUIProperty(property_ui_data, network, onc_tag + '.' + key); 1456 ParseUIProperty(property_ui_data, network, onc_tag + '.' + key);
1391 } 1457 }
1392 1458
1393 } // namespace chromeos 1459 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698