Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 "base/string_util.h" | 7 #include "base/string_util.h" |
| 8 #include "base/stringprintf.h" | 8 #include "base/stringprintf.h" |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "chrome/browser/chromeos/cros/cros_library.h" | 10 #include "chrome/browser/chromeos/cros/cros_library.h" |
| (...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 309 | 309 |
| 310 bool WifiConfigView::CanLogin() { | 310 bool WifiConfigView::CanLogin() { |
| 311 static const size_t kMinWirelessPasswordLen = 5; | 311 static const size_t kMinWirelessPasswordLen = 5; |
| 312 | 312 |
| 313 // We either have an existing wifi network or the user entered an SSID. | 313 // We either have an existing wifi network or the user entered an SSID. |
| 314 if (service_path_.empty() && GetSsid().empty()) | 314 if (service_path_.empty() && GetSsid().empty()) |
| 315 return false; | 315 return false; |
| 316 | 316 |
| 317 // If the network requires a passphrase, make sure it is the right length. | 317 // If the network requires a passphrase, make sure it is the right length. |
| 318 if (passphrase_textfield_ != NULL | 318 if (passphrase_textfield_ != NULL |
| 319 && passphrase_textfield_->enabled() | 319 && PassphraseActive() |
| 320 && passphrase_textfield_->text().length() < kMinWirelessPasswordLen) | 320 && passphrase_textfield_->text().length() < kMinWirelessPasswordLen) |
| 321 return false; | 321 return false; |
| 322 | 322 |
| 323 // If we're using EAP, we must have a method. | 323 // If we're using EAP, we must have a method. |
| 324 if (eap_method_combobox_ | 324 if (eap_method_combobox_ |
| 325 && eap_method_combobox_->enabled() | |
| 326 && eap_method_combobox_->selected_item() == EAP_METHOD_INDEX_NONE) | 325 && eap_method_combobox_->selected_item() == EAP_METHOD_INDEX_NONE) |
| 327 return false; | 326 return false; |
| 328 | 327 |
| 329 // Block login if certs are required but user has none. | 328 // Block login if certs are required but user has none. |
| 330 if (UserCertRequired() && (!HaveUserCerts() || !IsUserCertValid())) | 329 if (UserCertRequired() && (!HaveUserCerts() || !IsUserCertValid())) |
| 331 return false; | 330 return false; |
| 332 | 331 |
| 333 return true; | 332 return true; |
| 334 } | 333 } |
| 335 | 334 |
| 336 bool WifiConfigView::UserCertRequired() const { | 335 bool WifiConfigView::UserCertRequired() const { |
| 337 if (!cert_library_) | 336 if (!cert_library_) |
| 338 return false; // return false until cert_library_ is initialized. | 337 return false; // return false until cert_library_ is initialized. |
| 339 // Only EAP-TLS requires a user certificate. | 338 return UserCertActive(); |
| 340 if (eap_method_combobox_ && | |
| 341 eap_method_combobox_->enabled() && | |
| 342 eap_method_combobox_->selected_item() == EAP_METHOD_INDEX_TLS) { | |
| 343 return true; | |
| 344 } | |
| 345 return false; | |
| 346 } | 339 } |
| 347 | 340 |
| 348 bool WifiConfigView::HaveUserCerts() const { | 341 bool WifiConfigView::HaveUserCerts() const { |
| 349 return cert_library_->GetUserCertificates().Size() > 0; | 342 return cert_library_->GetUserCertificates().Size() > 0; |
| 350 } | 343 } |
| 351 | 344 |
| 352 bool WifiConfigView::IsUserCertValid() const { | 345 bool WifiConfigView::IsUserCertValid() const { |
| 353 if (!user_cert_combobox_ || !user_cert_combobox_->enabled()) | 346 if (!UserCertActive()) |
| 354 return false; | 347 return false; |
| 355 int selected = user_cert_combobox_->selected_item(); | 348 int selected = user_cert_combobox_->selected_item(); |
| 356 if (selected < 0) | 349 if (selected < 0) |
| 357 return false; | 350 return false; |
| 358 // Currently only hardware-backed user certificates are valid. | 351 // Currently only hardware-backed user certificates are valid. |
| 359 if (cert_library_->IsHardwareBacked() && | 352 if (cert_library_->IsHardwareBacked() && |
| 360 !cert_library_->GetUserCertificates().IsHardwareBackedAt(selected)) | 353 !cert_library_->GetUserCertificates().IsHardwareBackedAt(selected)) |
| 361 return false; | 354 return false; |
| 362 return true; | 355 return true; |
| 363 } | 356 } |
| 364 | 357 |
| 358 bool WifiConfigView::Phase2AuthActive() const { | |
| 359 if (phase_2_auth_combobox_) | |
| 360 return phase_2_auth_combobox_->model()->GetItemCount() > 1; | |
| 361 | |
| 362 return false; | |
| 363 } | |
| 364 | |
| 365 bool WifiConfigView::PassphraseActive() const { | |
| 366 if (eap_method_combobox_) { | |
| 367 // No password for EAP-TLS. | |
| 368 int selected = eap_method_combobox_->selected_item(); | |
| 369 return (selected != EAP_METHOD_INDEX_NONE && | |
| 370 selected != EAP_METHOD_INDEX_TLS); | |
| 371 } else if (security_combobox_) { | |
| 372 return security_combobox_->selected_item() != SECURITY_INDEX_NONE; | |
| 373 } | |
| 374 | |
| 375 return false; | |
| 376 } | |
| 377 | |
| 378 bool WifiConfigView::UserCertActive() const { | |
| 379 // User certs only for EAP-TLS. | |
| 380 if (eap_method_combobox_) | |
| 381 return eap_method_combobox_->selected_item() == EAP_METHOD_INDEX_TLS; | |
| 382 | |
| 383 return false; | |
| 384 } | |
| 385 | |
| 386 bool WifiConfigView::CaCertActive() const { | |
| 387 // No server CA certs for LEAP. | |
| 388 if (eap_method_combobox_) { | |
| 389 int selected = eap_method_combobox_->selected_item(); | |
| 390 return (selected != EAP_METHOD_INDEX_NONE && | |
| 391 selected != EAP_METHOD_INDEX_LEAP); | |
| 392 } | |
| 393 | |
| 394 return false; | |
| 395 } | |
| 396 | |
| 365 void WifiConfigView::UpdateDialogButtons() { | 397 void WifiConfigView::UpdateDialogButtons() { |
| 366 parent_->GetDialogClientView()->UpdateDialogButtons(); | 398 parent_->GetDialogClientView()->UpdateDialogButtons(); |
| 367 } | 399 } |
| 368 | 400 |
| 369 void WifiConfigView::RefreshEapFields() { | 401 void WifiConfigView::RefreshEapFields() { |
| 370 DCHECK(cert_library_); | 402 DCHECK(cert_library_); |
| 371 int selected = eap_method_combobox_->selected_item(); | |
| 372 | 403 |
| 373 // If EAP method changes, the phase 2 auth choices may have changed also. | 404 // If EAP method changes, the phase 2 auth choices may have changed also. |
| 374 phase_2_auth_combobox_->ModelChanged(); | 405 phase_2_auth_combobox_->ModelChanged(); |
| 375 phase_2_auth_combobox_->SetSelectedItem(0); | 406 phase_2_auth_combobox_->SetSelectedItem(0); |
| 376 phase_2_auth_combobox_->SetEnabled( | 407 bool phase_2_auth_enabled = Phase2AuthActive(); |
| 377 phase_2_auth_combobox_->model()->GetItemCount() > 1 && | 408 phase_2_auth_combobox_->SetEnabled(phase_2_auth_enabled && |
| 378 phase_2_auth_ui_data_.editable()); | 409 phase_2_auth_ui_data_.editable()); |
| 379 phase_2_auth_label_->SetEnabled(phase_2_auth_combobox_->enabled()); | 410 phase_2_auth_label_->SetEnabled(phase_2_auth_enabled); |
| 380 | 411 |
| 381 // No password for EAP-TLS | 412 // Passphrase. |
| 382 passphrase_textfield_->SetEnabled(selected != EAP_METHOD_INDEX_NONE && | 413 bool passphrase_enabled = PassphraseActive(); |
| 383 selected != EAP_METHOD_INDEX_TLS && | 414 passphrase_textfield_->SetEnabled(passphrase_enabled && |
| 384 passphrase_ui_data_.editable()); | 415 passphrase_ui_data_.editable()); |
| 385 passphrase_label_->SetEnabled(passphrase_textfield_->enabled()); | 416 passphrase_label_->SetEnabled(passphrase_enabled); |
| 386 if (!passphrase_textfield_->enabled()) | 417 if (!passphrase_enabled) |
| 387 passphrase_textfield_->SetText(string16()); | 418 passphrase_textfield_->SetText(string16()); |
| 388 | 419 |
| 389 // User certs only for EAP-TLS | 420 // User cert. |
| 390 bool certs_loading = cert_library_->CertificatesLoading(); | 421 bool certs_loading = cert_library_->CertificatesLoading(); |
| 391 bool user_cert_enabled = (selected == EAP_METHOD_INDEX_TLS); | 422 bool user_cert_enabled = UserCertActive(); |
| 392 user_cert_label_->SetEnabled(user_cert_enabled); | 423 user_cert_label_->SetEnabled(user_cert_enabled); |
| 393 bool have_user_certs = !certs_loading && HaveUserCerts(); | 424 bool have_user_certs = !certs_loading && HaveUserCerts(); |
| 394 user_cert_combobox_->SetEnabled(user_cert_enabled && | 425 user_cert_combobox_->SetEnabled(user_cert_enabled && |
| 395 have_user_certs && | 426 have_user_certs && |
| 396 user_cert_ui_data_.editable()); | 427 user_cert_ui_data_.editable()); |
| 397 user_cert_combobox_->ModelChanged(); | 428 user_cert_combobox_->ModelChanged(); |
| 398 user_cert_combobox_->SetSelectedItem(0); | 429 user_cert_combobox_->SetSelectedItem(0); |
| 399 | 430 |
| 400 // No server CA certs for LEAP | 431 // Server CA. |
| 401 bool ca_cert_enabled = | 432 bool ca_cert_enabled = CaCertActive(); |
| 402 (selected != EAP_METHOD_INDEX_NONE && selected != EAP_METHOD_INDEX_LEAP); | |
| 403 server_ca_cert_label_->SetEnabled(ca_cert_enabled); | 433 server_ca_cert_label_->SetEnabled(ca_cert_enabled); |
| 404 server_ca_cert_combobox_->SetEnabled(ca_cert_enabled && | 434 server_ca_cert_combobox_->SetEnabled(ca_cert_enabled && |
| 405 !certs_loading && | 435 !certs_loading && |
| 406 server_ca_cert_ui_data_.editable()); | 436 server_ca_cert_ui_data_.editable()); |
| 407 server_ca_cert_combobox_->ModelChanged(); | 437 server_ca_cert_combobox_->ModelChanged(); |
| 408 server_ca_cert_combobox_->SetSelectedItem(0); | 438 server_ca_cert_combobox_->SetSelectedItem(0); |
| 409 | 439 |
| 410 // No anonymous identity if no phase 2 auth. | 440 // No anonymous identity if no phase 2 auth. |
| 441 bool identity_anonymous_enabled = phase_2_auth_enabled; | |
| 411 identity_anonymous_textfield_->SetEnabled( | 442 identity_anonymous_textfield_->SetEnabled( |
| 412 phase_2_auth_combobox_->enabled() && | 443 identity_anonymous_enabled && identity_anonymous_ui_data_.editable()); |
| 413 identity_anonymous_ui_data_.editable()); | 444 identity_anonymous_label_->SetEnabled(identity_anonymous_enabled); |
| 414 identity_anonymous_label_->SetEnabled( | 445 if (!identity_anonymous_enabled) |
| 415 identity_anonymous_textfield_->enabled()); | |
| 416 if (!identity_anonymous_textfield_->enabled()) | |
| 417 identity_anonymous_textfield_->SetText(string16()); | 446 identity_anonymous_textfield_->SetText(string16()); |
| 418 | 447 |
| 419 RefreshShareCheckbox(); | 448 RefreshShareCheckbox(); |
| 420 } | 449 } |
| 421 | 450 |
| 422 void WifiConfigView::RefreshShareCheckbox() { | 451 void WifiConfigView::RefreshShareCheckbox() { |
| 423 if (!share_network_checkbox_) | 452 if (!share_network_checkbox_) |
| 424 return; | 453 return; |
| 425 | 454 |
| 426 if (security_combobox_ && | 455 if (security_combobox_ && |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 517 } else { | 546 } else { |
| 518 NOTREACHED(); | 547 NOTREACHED(); |
| 519 } | 548 } |
| 520 } | 549 } |
| 521 | 550 |
| 522 void WifiConfigView::ItemChanged(views::Combobox* combo_box, | 551 void WifiConfigView::ItemChanged(views::Combobox* combo_box, |
| 523 int prev_index, int new_index) { | 552 int prev_index, int new_index) { |
| 524 if (new_index == prev_index) | 553 if (new_index == prev_index) |
| 525 return; | 554 return; |
| 526 if (combo_box == security_combobox_) { | 555 if (combo_box == security_combobox_) { |
| 527 // If changed to no security, then disable combobox and clear it. | 556 bool passphrase_enabled = PassphraseActive(); |
| 528 // Otherwise, enable it. Also, update can login. | 557 passphrase_label_->SetEnabled(passphrase_enabled); |
| 529 if (new_index == SECURITY_INDEX_NONE) { | 558 passphrase_textfield_->SetEnabled(passphrase_enabled && |
| 530 passphrase_label_->SetEnabled(false); | 559 passphrase_ui_data_.editable()); |
| 531 passphrase_textfield_->SetEnabled(false); | 560 if (!passphrase_enabled) |
| 532 passphrase_textfield_->SetText(string16()); | 561 passphrase_textfield_->SetText(string16()); |
| 533 } else { | |
| 534 passphrase_label_->SetEnabled(true); | |
| 535 passphrase_textfield_->SetEnabled(true); | |
| 536 } | |
| 537 RefreshShareCheckbox(); | 562 RefreshShareCheckbox(); |
| 538 } else if (combo_box == user_cert_combobox_) { | 563 } else if (combo_box == user_cert_combobox_) { |
| 539 RefreshShareCheckbox(); | 564 RefreshShareCheckbox(); |
| 540 } else if (combo_box == eap_method_combobox_) { | 565 } else if (combo_box == eap_method_combobox_) { |
| 541 RefreshEapFields(); | 566 RefreshEapFields(); |
| 542 } | 567 } |
| 543 UpdateDialogButtons(); | 568 UpdateDialogButtons(); |
| 544 UpdateErrorLabel(); | 569 UpdateErrorLabel(); |
| 545 } | 570 } |
| 546 | 571 |
| (...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 902 int label_text_id = IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_PASSPHRASE; | 927 int label_text_id = IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_PASSPHRASE; |
| 903 passphrase_label_ = new views::Label( | 928 passphrase_label_ = new views::Label( |
| 904 l10n_util::GetStringUTF16(label_text_id)); | 929 l10n_util::GetStringUTF16(label_text_id)); |
| 905 layout->AddView(passphrase_label_); | 930 layout->AddView(passphrase_label_); |
| 906 passphrase_textfield_ = new views::Textfield( | 931 passphrase_textfield_ = new views::Textfield( |
| 907 views::Textfield::STYLE_OBSCURED); | 932 views::Textfield::STYLE_OBSCURED); |
| 908 passphrase_textfield_->SetController(this); | 933 passphrase_textfield_->SetController(this); |
| 909 if (wifi && !wifi->GetPassphrase().empty()) | 934 if (wifi && !wifi->GetPassphrase().empty()) |
| 910 passphrase_textfield_->SetText(UTF8ToUTF16(wifi->GetPassphrase())); | 935 passphrase_textfield_->SetText(UTF8ToUTF16(wifi->GetPassphrase())); |
| 911 // Disable passphrase input initially for other network. | 936 // Disable passphrase input initially for other network. |
| 912 if (!wifi) { | 937 passphrase_label_->SetEnabled(wifi); |
|
stevenjb
2012/01/27 19:14:07
nit: I'd use (wifi ? true : false) to make it clea
Mattias Nissler (ping if slow)
2012/01/30 12:56:49
Switched it to wifi != NULL.
| |
| 913 passphrase_label_->SetEnabled(false); | 938 passphrase_textfield_->SetEnabled(wifi && passphrase_ui_data_.editable()); |
| 914 passphrase_textfield_->SetEnabled(false); | |
| 915 } | |
| 916 passphrase_textfield_->SetAccessibleName(l10n_util::GetStringUTF16( | 939 passphrase_textfield_->SetAccessibleName(l10n_util::GetStringUTF16( |
| 917 label_text_id)); | 940 label_text_id)); |
| 918 layout->AddView(passphrase_textfield_); | 941 layout->AddView(passphrase_textfield_); |
| 919 | 942 |
| 920 if (passphrase_ui_data_.managed()) { | 943 if (passphrase_ui_data_.managed()) { |
| 921 layout->AddView(new ControlledSettingIndicatorView(passphrase_ui_data_)); | 944 layout->AddView(new ControlledSettingIndicatorView(passphrase_ui_data_)); |
| 922 } else { | 945 } else { |
| 923 // Password visible button. | 946 // Password visible button. |
| 924 passphrase_visible_button_ = new views::ToggleImageButton(this); | 947 passphrase_visible_button_ = new views::ToggleImageButton(this); |
| 925 passphrase_visible_button_->SetTooltipText( | 948 passphrase_visible_button_->SetTooltipText( |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1020 eap_method_combobox_->SetSelectedItem(EAP_METHOD_INDEX_TLS); | 1043 eap_method_combobox_->SetSelectedItem(EAP_METHOD_INDEX_TLS); |
| 1021 break; | 1044 break; |
| 1022 case EAP_METHOD_LEAP: | 1045 case EAP_METHOD_LEAP: |
| 1023 eap_method_combobox_->SetSelectedItem(EAP_METHOD_INDEX_LEAP); | 1046 eap_method_combobox_->SetSelectedItem(EAP_METHOD_INDEX_LEAP); |
| 1024 break; | 1047 break; |
| 1025 default: | 1048 default: |
| 1026 break; | 1049 break; |
| 1027 } | 1050 } |
| 1028 RefreshEapFields(); | 1051 RefreshEapFields(); |
| 1029 | 1052 |
| 1030 // Phase 2 authentication | 1053 // Phase 2 authentication and anonymous identity. |
| 1031 if (phase_2_auth_combobox_->enabled()) { | 1054 if (Phase2AuthActive()) { |
| 1032 EAPPhase2Auth eap_phase_2_auth = | 1055 EAPPhase2Auth eap_phase_2_auth = |
| 1033 (wifi ? wifi->eap_phase_2_auth() : EAP_PHASE_2_AUTH_AUTO); | 1056 (wifi ? wifi->eap_phase_2_auth() : EAP_PHASE_2_AUTH_AUTO); |
| 1034 switch (eap_phase_2_auth) { | 1057 switch (eap_phase_2_auth) { |
| 1035 case EAP_PHASE_2_AUTH_MD5: | 1058 case EAP_PHASE_2_AUTH_MD5: |
| 1036 phase_2_auth_combobox_->SetSelectedItem(PHASE_2_AUTH_INDEX_MD5); | 1059 phase_2_auth_combobox_->SetSelectedItem(PHASE_2_AUTH_INDEX_MD5); |
| 1037 break; | 1060 break; |
| 1038 case EAP_PHASE_2_AUTH_MSCHAPV2: | 1061 case EAP_PHASE_2_AUTH_MSCHAPV2: |
| 1039 phase_2_auth_combobox_->SetSelectedItem(PHASE_2_AUTH_INDEX_MSCHAPV2); | 1062 phase_2_auth_combobox_->SetSelectedItem(PHASE_2_AUTH_INDEX_MSCHAPV2); |
| 1040 break; | 1063 break; |
| 1041 case EAP_PHASE_2_AUTH_MSCHAP: | 1064 case EAP_PHASE_2_AUTH_MSCHAP: |
| 1042 phase_2_auth_combobox_->SetSelectedItem(PHASE_2_AUTH_INDEX_MSCHAP); | 1065 phase_2_auth_combobox_->SetSelectedItem(PHASE_2_AUTH_INDEX_MSCHAP); |
| 1043 break; | 1066 break; |
| 1044 case EAP_PHASE_2_AUTH_PAP: | 1067 case EAP_PHASE_2_AUTH_PAP: |
| 1045 phase_2_auth_combobox_->SetSelectedItem(PHASE_2_AUTH_INDEX_PAP); | 1068 phase_2_auth_combobox_->SetSelectedItem(PHASE_2_AUTH_INDEX_PAP); |
| 1046 break; | 1069 break; |
| 1047 case EAP_PHASE_2_AUTH_CHAP: | 1070 case EAP_PHASE_2_AUTH_CHAP: |
| 1048 phase_2_auth_combobox_->SetSelectedItem(PHASE_2_AUTH_INDEX_CHAP); | 1071 phase_2_auth_combobox_->SetSelectedItem(PHASE_2_AUTH_INDEX_CHAP); |
| 1049 break; | 1072 break; |
| 1050 default: | 1073 default: |
| 1051 break; | 1074 break; |
| 1052 } | 1075 } |
| 1076 | |
| 1077 const std::string& eap_anonymous_identity = | |
| 1078 (wifi ? wifi->GetEapAnonymousIdentity() : std::string()); | |
| 1079 identity_anonymous_textfield_->SetText( | |
| 1080 UTF8ToUTF16(eap_anonymous_identity)); | |
| 1053 } | 1081 } |
| 1054 | 1082 |
| 1055 // Server CA certificate | 1083 // Server CA certificate |
| 1056 if (server_ca_cert_combobox_->enabled()) { | 1084 if (CaCertActive()) { |
| 1057 const std::string& nss_nickname = | 1085 const std::string& nss_nickname = |
| 1058 (wifi ? wifi->eap_server_ca_cert_nss_nickname() : std::string()); | 1086 (wifi ? wifi->eap_server_ca_cert_nss_nickname() : std::string()); |
| 1059 if (nss_nickname.empty()) { | 1087 if (nss_nickname.empty()) { |
| 1060 if (wifi->eap_use_system_cas()) { | 1088 if (wifi->eap_use_system_cas()) { |
| 1061 // "Default" | 1089 // "Default" |
| 1062 server_ca_cert_combobox_->SetSelectedItem(0); | 1090 server_ca_cert_combobox_->SetSelectedItem(0); |
| 1063 } else { | 1091 } else { |
| 1064 // "Do not check" | 1092 // "Do not check" |
| 1065 server_ca_cert_combobox_->SetSelectedItem( | 1093 server_ca_cert_combobox_->SetSelectedItem( |
| 1066 server_ca_cert_combobox_->model()->GetItemCount() - 1); | 1094 server_ca_cert_combobox_->model()->GetItemCount() - 1); |
| 1067 } | 1095 } |
| 1068 } else { | 1096 } else { |
| 1069 // select the certificate if available | 1097 // select the certificate if available |
| 1070 int cert_index = | 1098 int cert_index = |
| 1071 cert_library_->GetCACertificates().FindCertByNickname(nss_nickname); | 1099 cert_library_->GetCACertificates().FindCertByNickname(nss_nickname); |
| 1072 if (cert_index >= 0) { | 1100 if (cert_index >= 0) { |
| 1073 // Skip item for "Default" | 1101 // Skip item for "Default" |
| 1074 server_ca_cert_combobox_->SetSelectedItem(1 + cert_index); | 1102 server_ca_cert_combobox_->SetSelectedItem(1 + cert_index); |
| 1075 } | 1103 } |
| 1076 } | 1104 } |
| 1077 } | 1105 } |
| 1078 | 1106 |
| 1079 // User certificate | 1107 // User certificate |
| 1080 if (user_cert_combobox_->enabled()) { | 1108 if (UserCertActive()) { |
| 1081 const std::string& pkcs11_id = | 1109 const std::string& pkcs11_id = |
| 1082 (wifi ? wifi->eap_client_cert_pkcs11_id() : std::string()); | 1110 (wifi ? wifi->eap_client_cert_pkcs11_id() : std::string()); |
| 1083 if (!pkcs11_id.empty()) { | 1111 if (!pkcs11_id.empty()) { |
| 1084 int cert_index = | 1112 int cert_index = |
| 1085 cert_library_->GetUserCertificates().FindCertByPkcs11Id(pkcs11_id); | 1113 cert_library_->GetUserCertificates().FindCertByPkcs11Id(pkcs11_id); |
| 1086 if (cert_index >= 0) { | 1114 if (cert_index >= 0) { |
| 1087 user_cert_combobox_->SetSelectedItem(cert_index); | 1115 user_cert_combobox_->SetSelectedItem(cert_index); |
| 1088 } | 1116 } |
| 1089 } | 1117 } |
| 1090 } | 1118 } |
| 1091 | 1119 |
| 1092 // Identity | 1120 // Identity is always active. |
| 1093 if (identity_textfield_->enabled()) { | 1121 const std::string& eap_identity = |
| 1094 const std::string& eap_identity = | 1122 (wifi ? wifi->GetEapIdentity() : std::string()); |
| 1095 (wifi ? wifi->GetEapIdentity() : std::string()); | 1123 identity_textfield_->SetText(UTF8ToUTF16(eap_identity)); |
| 1096 identity_textfield_->SetText(UTF8ToUTF16(eap_identity)); | |
| 1097 } | |
| 1098 | |
| 1099 // Anonymous identity | |
| 1100 if (identity_anonymous_textfield_->enabled()) { | |
| 1101 const std::string& eap_anonymous_identity = | |
| 1102 (wifi ? wifi->GetEapAnonymousIdentity() : std::string()); | |
| 1103 identity_anonymous_textfield_->SetText( | |
| 1104 UTF8ToUTF16(eap_anonymous_identity)); | |
| 1105 } | |
| 1106 | 1124 |
| 1107 // Passphrase | 1125 // Passphrase |
| 1108 if (passphrase_textfield_->enabled()) { | 1126 if (PassphraseActive()) { |
| 1109 const std::string& eap_passphrase = | 1127 const std::string& eap_passphrase = |
| 1110 (wifi ? wifi->eap_passphrase() : std::string()); | 1128 (wifi ? wifi->eap_passphrase() : std::string()); |
| 1111 passphrase_textfield_->SetText(UTF8ToUTF16(eap_passphrase)); | 1129 passphrase_textfield_->SetText(UTF8ToUTF16(eap_passphrase)); |
| 1112 } | 1130 } |
| 1113 | 1131 |
| 1114 // Save credentials | 1132 // Save credentials |
| 1115 bool save_credentials = (wifi ? wifi->save_credentials() : false); | 1133 bool save_credentials = (wifi ? wifi->save_credentials() : false); |
| 1116 save_credentials_checkbox_->SetChecked(save_credentials); | 1134 save_credentials_checkbox_->SetChecked(save_credentials); |
| 1117 } | 1135 } |
| 1118 | 1136 |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 1144 void WifiConfigView::ParseWiFiEAPUIProperty( | 1162 void WifiConfigView::ParseWiFiEAPUIProperty( |
| 1145 NetworkPropertyUIData* property_ui_data, | 1163 NetworkPropertyUIData* property_ui_data, |
| 1146 Network* network, | 1164 Network* network, |
| 1147 const std::string& key) { | 1165 const std::string& key) { |
| 1148 ParseWiFiUIProperty( | 1166 ParseWiFiUIProperty( |
| 1149 property_ui_data, network, | 1167 property_ui_data, network, |
| 1150 base::StringPrintf("%s.%s", onc::wifi::kEAP, key.c_str())); | 1168 base::StringPrintf("%s.%s", onc::wifi::kEAP, key.c_str())); |
| 1151 } | 1169 } |
| 1152 | 1170 |
| 1153 } // namespace chromeos | 1171 } // namespace chromeos |
| OLD | NEW |