OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/string_util.h" | 7 #include "base/string_util.h" |
8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
9 #include "chrome/browser/chromeos/cros/cros_library.h" | 9 #include "chrome/browser/chromeos/cros/cros_library.h" |
10 #include "chrome/browser/chromeos/cros/network_library.h" | 10 #include "chrome/browser/chromeos/cros/network_library.h" |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 }; | 181 }; |
182 | 182 |
183 class ServerCACertComboboxModel : public ui::ComboboxModel { | 183 class ServerCACertComboboxModel : public ui::ComboboxModel { |
184 public: | 184 public: |
185 explicit ServerCACertComboboxModel(CertLibrary* cert_library) | 185 explicit ServerCACertComboboxModel(CertLibrary* cert_library) |
186 : cert_library_(cert_library) { | 186 : cert_library_(cert_library) { |
187 DCHECK(cert_library); | 187 DCHECK(cert_library); |
188 } | 188 } |
189 virtual ~ServerCACertComboboxModel() {} | 189 virtual ~ServerCACertComboboxModel() {} |
190 virtual int GetItemCount() { | 190 virtual int GetItemCount() { |
191 if (!cert_library_->CertificatesLoaded()) | 191 // First "Use Default", then the certs (if any), then "Do not check". |
192 return 1; // "Loading" | |
193 // First "Default", then the certs, then "Do not check". | |
194 return cert_library_->GetCACertificates().Size() + 2; | 192 return cert_library_->GetCACertificates().Size() + 2; |
195 } | 193 } |
196 virtual string16 GetItemAt(int combo_index) { | 194 virtual string16 GetItemAt(int combo_index) { |
197 if (!cert_library_->CertificatesLoaded()) | |
198 return l10n_util::GetStringUTF16( | |
199 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CERT_LOADING); | |
200 if (combo_index == 0) | 195 if (combo_index == 0) |
201 return l10n_util::GetStringUTF16( | 196 return l10n_util::GetStringUTF16( |
202 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CERT_SERVER_CA_DEFAULT); | 197 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CERT_SERVER_CA_DEFAULT); |
203 if (combo_index == GetItemCount() - 1) | 198 if (combo_index == GetItemCount() - 1) |
204 return l10n_util::GetStringUTF16( | 199 return l10n_util::GetStringUTF16( |
205 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CERT_SERVER_CA_DO_NOT_CHECK); | 200 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CERT_SERVER_CA_DO_NOT_CHECK); |
206 int cert_index = combo_index - 1; | 201 int cert_index = combo_index - 1; |
207 return cert_library_->GetCACertificates().GetDisplayStringAt(cert_index); | 202 return cert_library_->GetCACertificates().GetDisplayStringAt(cert_index); |
208 } | 203 } |
209 | 204 |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
393 have_user_certs && | 388 have_user_certs && |
394 user_cert_ui_data_.editable()); | 389 user_cert_ui_data_.editable()); |
395 user_cert_combobox_->ModelChanged(); | 390 user_cert_combobox_->ModelChanged(); |
396 user_cert_combobox_->SetSelectedItem(0); | 391 user_cert_combobox_->SetSelectedItem(0); |
397 | 392 |
398 // No server CA certs for LEAP | 393 // No server CA certs for LEAP |
399 bool ca_cert_enabled = | 394 bool ca_cert_enabled = |
400 (selected != EAP_METHOD_INDEX_NONE && selected != EAP_METHOD_INDEX_LEAP); | 395 (selected != EAP_METHOD_INDEX_NONE && selected != EAP_METHOD_INDEX_LEAP); |
401 server_ca_cert_label_->SetEnabled(ca_cert_enabled); | 396 server_ca_cert_label_->SetEnabled(ca_cert_enabled); |
402 server_ca_cert_combobox_->SetEnabled(ca_cert_enabled && | 397 server_ca_cert_combobox_->SetEnabled(ca_cert_enabled && |
403 !certs_loading && | |
404 server_ca_cert_ui_data_.editable()); | 398 server_ca_cert_ui_data_.editable()); |
405 server_ca_cert_combobox_->ModelChanged(); | 399 server_ca_cert_combobox_->ModelChanged(); |
406 server_ca_cert_combobox_->SetSelectedItem(0); | 400 server_ca_cert_combobox_->SetSelectedItem(0); |
407 | 401 |
408 // No anonymous identity if no phase 2 auth. | 402 // No anonymous identity if no phase 2 auth. |
409 identity_anonymous_textfield_->SetEnabled( | 403 identity_anonymous_textfield_->SetEnabled( |
410 phase_2_auth_combobox_->IsEnabled() && | 404 phase_2_auth_combobox_->IsEnabled() && |
411 identity_anonymous_ui_data_.editable()); | 405 identity_anonymous_ui_data_.editable()); |
412 identity_anonymous_label_->SetEnabled( | 406 identity_anonymous_label_->SetEnabled( |
413 identity_anonymous_textfield_->IsEnabled()); | 407 identity_anonymous_textfield_->IsEnabled()); |
(...skipping 715 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1129 // Set focus to a reasonable widget, depending on what we're showing. | 1123 // Set focus to a reasonable widget, depending on what we're showing. |
1130 if (ssid_textfield_) | 1124 if (ssid_textfield_) |
1131 ssid_textfield_->RequestFocus(); | 1125 ssid_textfield_->RequestFocus(); |
1132 else if (eap_method_combobox_) | 1126 else if (eap_method_combobox_) |
1133 eap_method_combobox_->RequestFocus(); | 1127 eap_method_combobox_->RequestFocus(); |
1134 else if (passphrase_textfield_ && passphrase_textfield_->IsEnabled()) | 1128 else if (passphrase_textfield_ && passphrase_textfield_->IsEnabled()) |
1135 passphrase_textfield_->RequestFocus(); | 1129 passphrase_textfield_->RequestFocus(); |
1136 } | 1130 } |
1137 | 1131 |
1138 } // namespace chromeos | 1132 } // namespace chromeos |
OLD | NEW |