Chromium Code Reviews| Index: chrome/browser/chromeos/options/wifi_config_view.cc |
| diff --git a/chrome/browser/chromeos/options/wifi_config_view.cc b/chrome/browser/chromeos/options/wifi_config_view.cc |
| index 9d15680ac81c62fe5ea585c92527c0c09e13e33d..9eecf31f5d47df52d85dcf461d10c00575325d2d 100644 |
| --- a/chrome/browser/chromeos/options/wifi_config_view.cc |
| +++ b/chrome/browser/chromeos/options/wifi_config_view.cc |
| @@ -372,12 +372,14 @@ void WifiConfigView::RefreshEapFields() { |
| phase_2_auth_combobox_->ModelChanged(); |
| phase_2_auth_combobox_->SetSelectedItem(0); |
| phase_2_auth_combobox_->SetEnabled( |
| - phase_2_auth_combobox_->model()->GetItemCount() > 1); |
| + phase_2_auth_combobox_->model()->GetItemCount() > 1 && |
| + phase_2_auth_ui_data_.editable()); |
| phase_2_auth_label_->SetEnabled(phase_2_auth_combobox_->IsEnabled()); |
| // No password for EAP-TLS |
| passphrase_textfield_->SetEnabled(selected != EAP_METHOD_INDEX_NONE && |
| - selected != EAP_METHOD_INDEX_TLS); |
| + selected != EAP_METHOD_INDEX_TLS && |
| + passphrase_ui_data_.editable()); |
| passphrase_label_->SetEnabled(passphrase_textfield_->IsEnabled()); |
| if (!passphrase_textfield_->IsEnabled()) |
| passphrase_textfield_->SetText(string16()); |
| @@ -387,7 +389,9 @@ void WifiConfigView::RefreshEapFields() { |
| bool user_cert_enabled = (selected == EAP_METHOD_INDEX_TLS); |
| user_cert_label_->SetEnabled(user_cert_enabled); |
| bool have_user_certs = !certs_loading && HaveUserCerts(); |
| - user_cert_combobox_->SetEnabled(user_cert_enabled && have_user_certs); |
| + user_cert_combobox_->SetEnabled(user_cert_enabled && |
| + have_user_certs && |
| + user_cert_ui_data_.editable()); |
| user_cert_combobox_->ModelChanged(); |
| user_cert_combobox_->SetSelectedItem(0); |
| @@ -395,13 +399,16 @@ void WifiConfigView::RefreshEapFields() { |
| bool ca_cert_enabled = |
| (selected != EAP_METHOD_INDEX_NONE && selected != EAP_METHOD_INDEX_LEAP); |
| server_ca_cert_label_->SetEnabled(ca_cert_enabled); |
| - server_ca_cert_combobox_->SetEnabled(ca_cert_enabled && !certs_loading); |
| + server_ca_cert_combobox_->SetEnabled(ca_cert_enabled && |
| + !certs_loading && |
| + server_ca_cert_ui_data_.editable()); |
| server_ca_cert_combobox_->ModelChanged(); |
| server_ca_cert_combobox_->SetSelectedItem(0); |
| // No anonymous identity if no phase 2 auth. |
| identity_anonymous_textfield_->SetEnabled( |
| - phase_2_auth_combobox_->IsEnabled()); |
| + phase_2_auth_combobox_->IsEnabled() && |
| + identity_anonymous_ui_data_.editable()); |
| identity_anonymous_label_->SetEnabled( |
| identity_anonymous_textfield_->IsEnabled()); |
| if (!identity_anonymous_textfield_->IsEnabled()) |
| @@ -741,6 +748,35 @@ void WifiConfigView::Cancel() { |
| // to enter the data. And if they select the 802.1x encryption, we will show |
| // the 802.1x fields. |
| void WifiConfigView::Init(WifiNetwork* wifi, bool show_8021x) { |
| + if (wifi) { |
| + eap_method_ui_data_.UpdateFromNetwork( |
| + wifi, NetworkUIData::kPropertyEAPMethod); |
| + phase_2_auth_ui_data_.UpdateFromNetwork( |
| + wifi, NetworkUIData::kPropertyEAPPhase2Auth); |
| + user_cert_ui_data_.UpdateFromNetwork( |
| + wifi, NetworkUIData::kPropertyEAPClientCertPkcs11Id); |
| + server_ca_cert_ui_data_.UpdateFromNetwork( |
| + wifi, NetworkUIData::kPropertyEAPServerCaCertNssNickname); |
| + if (server_ca_cert_ui_data_.controller() != |
| + NetworkPropertyUIData::CONTROLLER_POLICY) { |
| + server_ca_cert_ui_data_.UpdateFromNetwork( |
| + wifi, NetworkUIData::kPropertyEAPUseSystemCAs); |
| + } |
| + identity_ui_data_.UpdateFromNetwork( |
| + wifi, NetworkUIData::kPropertyEAPIdentity); |
| + identity_anonymous_ui_data_.UpdateFromNetwork( |
| + wifi, NetworkUIData::kPropertyEAPAnonymousIdentity); |
| + save_credentials_ui_data_.UpdateFromNetwork( |
| + wifi, NetworkUIData::kPropertySaveCredentials); |
| + if (show_8021x) { |
| + passphrase_ui_data_.UpdateFromNetwork( |
| + wifi, NetworkUIData::kPropertyEAPPassphrase); |
| + } else { |
| + passphrase_ui_data_.UpdateFromNetwork( |
| + wifi, NetworkUIData::kPropertyPassphrase); |
| + } |
| + } |
| + |
| views::GridLayout* layout = views::GridLayout::CreatePanel(this); |
| SetLayoutManager(layout); |
| @@ -756,7 +792,7 @@ void WifiConfigView::Init(WifiNetwork* wifi, bool show_8021x) { |
| views::GridLayout::USE_PREF, 0, |
| ChildNetworkConfigView::kInputFieldMinWidth); |
| column_set->AddPaddingColumn(0, views::kRelatedControlSmallHorizontalSpacing); |
| - // Password visible button |
| + // Password visible button / policy indicator. |
| column_set->AddColumn(views::GridLayout::CENTER, views::GridLayout::FILL, 1, |
| views::GridLayout::USE_PREF, 0, kPasswordVisibleWidth); |
| @@ -802,7 +838,9 @@ void WifiConfigView::Init(WifiNetwork* wifi, bool show_8021x) { |
| IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_EAP_METHOD))); |
| eap_method_combobox_ = new views::Combobox(new EAPMethodComboboxModel()); |
| eap_method_combobox_->set_listener(this); |
| + eap_method_combobox_->SetEnabled(eap_method_ui_data_.editable()); |
| layout->AddView(eap_method_combobox_); |
| + layout->AddView(new ControlledSettingIndicatorView(eap_method_ui_data_)); |
| layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); |
| // Phase 2 authentication |
| @@ -816,6 +854,7 @@ void WifiConfigView::Init(WifiNetwork* wifi, bool show_8021x) { |
| phase_2_auth_combobox_->SetEnabled(false); |
| phase_2_auth_combobox_->set_listener(this); |
| layout->AddView(phase_2_auth_combobox_); |
| + layout->AddView(new ControlledSettingIndicatorView(phase_2_auth_ui_data_)); |
| layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); |
| // Server CA certificate |
| @@ -830,6 +869,8 @@ void WifiConfigView::Init(WifiNetwork* wifi, bool show_8021x) { |
| server_ca_cert_combobox_->SetEnabled(false); |
| server_ca_cert_combobox_->set_listener(this); |
| layout->AddView(server_ca_cert_combobox_); |
| + layout->AddView( |
| + new ControlledSettingIndicatorView(server_ca_cert_ui_data_)); |
| layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); |
| // User certificate |
| @@ -843,6 +884,7 @@ void WifiConfigView::Init(WifiNetwork* wifi, bool show_8021x) { |
| user_cert_combobox_->SetEnabled(false); |
| user_cert_combobox_->set_listener(this); |
| layout->AddView(user_cert_combobox_); |
| + layout->AddView(new ControlledSettingIndicatorView(user_cert_ui_data_)); |
| layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); |
| // Identity |
| @@ -855,7 +897,9 @@ void WifiConfigView::Init(WifiNetwork* wifi, bool show_8021x) { |
| identity_textfield_->SetController(this); |
| if (wifi && !wifi->identity().empty()) |
| identity_textfield_->SetText(UTF8ToUTF16(wifi->identity())); |
| + identity_textfield_->SetEnabled(identity_ui_data_.editable()); |
| layout->AddView(identity_textfield_); |
| + layout->AddView(new ControlledSettingIndicatorView(identity_ui_data_)); |
| layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); |
| } |
| @@ -878,29 +922,36 @@ void WifiConfigView::Init(WifiNetwork* wifi, bool show_8021x) { |
| passphrase_textfield_->SetAccessibleName(l10n_util::GetStringUTF16( |
| label_text_id)); |
| layout->AddView(passphrase_textfield_); |
| - // Password visible button. |
| - passphrase_visible_button_ = new views::ToggleImageButton(this); |
| - passphrase_visible_button_->SetTooltipText( |
| - l10n_util::GetStringUTF16( |
| - IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_PASSPHRASE_SHOW)); |
| - passphrase_visible_button_->SetToggledTooltipText( |
| - l10n_util::GetStringUTF16( |
| - IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_PASSPHRASE_HIDE)); |
| - passphrase_visible_button_->SetImage( |
| - views::ImageButton::BS_NORMAL, |
| - ResourceBundle::GetSharedInstance(). |
| - GetBitmapNamed(IDR_NETWORK_SHOW_PASSWORD_OFF)); |
| - passphrase_visible_button_->SetImage( |
| - views::ImageButton::BS_HOT, |
| - ResourceBundle::GetSharedInstance(). |
| - GetBitmapNamed(IDR_NETWORK_SHOW_PASSWORD_HOVER)); |
| - passphrase_visible_button_->SetToggledImage( |
| - views::ImageButton::BS_NORMAL, |
| - ResourceBundle::GetSharedInstance(). |
| - GetBitmapNamed(IDR_NETWORK_SHOW_PASSWORD_ON)); |
| - passphrase_visible_button_->SetImageAlignment( |
| - views::ImageButton::ALIGN_CENTER, views::ImageButton::ALIGN_MIDDLE); |
| - layout->AddView(passphrase_visible_button_); |
| + |
| + if (passphrase_ui_data_.controller() == |
| + NetworkPropertyUIData::CONTROLLER_POLICY) { |
|
stevenjb
2011/11/29 17:58:28
I think this should definitely be either !editable
Mattias Nissler (ping if slow)
2011/11/29 21:29:39
Done.
|
| + layout->AddView(new ControlledSettingIndicatorView(passphrase_ui_data_)); |
| + } else { |
| + // Password visible button. |
| + passphrase_visible_button_ = new views::ToggleImageButton(this); |
| + passphrase_visible_button_->SetTooltipText( |
| + l10n_util::GetStringUTF16( |
| + IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_PASSPHRASE_SHOW)); |
| + passphrase_visible_button_->SetToggledTooltipText( |
| + l10n_util::GetStringUTF16( |
| + IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_PASSPHRASE_HIDE)); |
| + passphrase_visible_button_->SetImage( |
| + views::ImageButton::BS_NORMAL, |
| + ResourceBundle::GetSharedInstance(). |
| + GetBitmapNamed(IDR_NETWORK_SHOW_PASSWORD_OFF)); |
| + passphrase_visible_button_->SetImage( |
| + views::ImageButton::BS_HOT, |
| + ResourceBundle::GetSharedInstance(). |
| + GetBitmapNamed(IDR_NETWORK_SHOW_PASSWORD_HOVER)); |
| + passphrase_visible_button_->SetToggledImage( |
| + views::ImageButton::BS_NORMAL, |
| + ResourceBundle::GetSharedInstance(). |
| + GetBitmapNamed(IDR_NETWORK_SHOW_PASSWORD_ON)); |
| + passphrase_visible_button_->SetImageAlignment( |
| + views::ImageButton::ALIGN_CENTER, views::ImageButton::ALIGN_MIDDLE); |
| + layout->AddView(passphrase_visible_button_); |
| + } |
| + |
| layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); |
| if (show_8021x) { |
| @@ -916,6 +967,8 @@ void WifiConfigView::Init(WifiNetwork* wifi, bool show_8021x) { |
| identity_anonymous_textfield_->SetEnabled(false); |
| identity_anonymous_textfield_->SetController(this); |
| layout->AddView(identity_anonymous_textfield_); |
| + layout->AddView( |
| + new ControlledSettingIndicatorView(identity_anonymous_ui_data_)); |
| layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); |
| } |
| @@ -927,8 +980,12 @@ void WifiConfigView::Init(WifiNetwork* wifi, bool show_8021x) { |
| save_credentials_checkbox_ = new views::Checkbox( |
| l10n_util::GetStringUTF16( |
| IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_SAVE_CREDENTIALS)); |
| + save_credentials_checkbox_->SetEnabled( |
| + save_credentials_ui_data_.editable()); |
| layout->SkipColumns(1); |
| layout->AddView(save_credentials_checkbox_); |
| + layout->AddView( |
| + new ControlledSettingIndicatorView(save_credentials_ui_data_)); |
| } |
| // Share network |