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

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

Issue 182313004: Remove GetPkcs11Id from x509_certificate_model (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: .. Created 6 years, 9 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 | Annotate | Revision Log
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/vpn_config_view.h" 5 #include "chrome/browser/chromeos/options/vpn_config_view.h"
6 6
7 #include "ash/system/chromeos/network/network_connect.h" 7 #include "ash/system/chromeos/network/network_connect.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after
440 } 440 }
441 441
442 const std::string VPNConfigView::GetServerCACertPEM() const { 442 const std::string VPNConfigView::GetServerCACertPEM() const {
443 int index = server_ca_cert_combobox_ ? 443 int index = server_ca_cert_combobox_ ?
444 server_ca_cert_combobox_->selected_index() : 0; 444 server_ca_cert_combobox_->selected_index() : 0;
445 if (index == 0) { 445 if (index == 0) {
446 // First item is "Default". 446 // First item is "Default".
447 return std::string(); 447 return std::string();
448 } else { 448 } else {
449 int cert_index = index - 1; 449 int cert_index = index - 1;
450 return CertLibrary::Get()->GetCertPEMAt( 450 return CertLibrary::Get()->GetServerCACertPEMAt(cert_index);
451 CertLibrary::CERT_TYPE_SERVER_CA, cert_index);
452 } 451 }
453 } 452 }
454 453
455 const std::string VPNConfigView::GetUserCertID() const { 454 const std::string VPNConfigView::GetUserCertID() const {
456 if (!HaveUserCerts()) { 455 if (!HaveUserCerts()) {
457 return std::string(); // "None installed" 456 return std::string(); // "None installed"
458 } else { 457 } else {
459 // Certificates are listed in the order they appear in the model. 458 // Certificates are listed in the order they appear in the model.
460 int index = user_cert_combobox_ ? user_cert_combobox_->selected_index() : 0; 459 int index = user_cert_combobox_ ? user_cert_combobox_->selected_index() : 0;
461 return CertLibrary::Get()->GetCertPkcs11IdAt( 460 return CertLibrary::Get()->GetUserCertPkcs11IdAt(index);
462 CertLibrary::CERT_TYPE_USER, index);
463 } 461 }
464 } 462 }
465 463
466 bool VPNConfigView::GetSaveCredentials() const { 464 bool VPNConfigView::GetSaveCredentials() const {
467 return save_credentials_checkbox_->checked(); 465 return save_credentials_checkbox_->checked();
468 } 466 }
469 467
470 int VPNConfigView::GetProviderTypeIndex() const { 468 int VPNConfigView::GetProviderTypeIndex() const {
471 if (provider_type_combobox_) 469 if (provider_type_combobox_)
472 return provider_type_combobox_->selected_index(); 470 return provider_type_combobox_->selected_index();
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
879 } 877 }
880 878
881 void VPNConfigView::Refresh() { 879 void VPNConfigView::Refresh() {
882 UpdateControls(); 880 UpdateControls();
883 881
884 // Set certificate combo boxes. 882 // Set certificate combo boxes.
885 if (server_ca_cert_combobox_) { 883 if (server_ca_cert_combobox_) {
886 server_ca_cert_combobox_->ModelChanged(); 884 server_ca_cert_combobox_->ModelChanged();
887 if (enable_server_ca_cert_ && !ca_cert_pem_.empty()) { 885 if (enable_server_ca_cert_ && !ca_cert_pem_.empty()) {
888 // Select the current server CA certificate in the combobox. 886 // Select the current server CA certificate in the combobox.
889 int cert_index = CertLibrary::Get()->GetCertIndexByPEM( 887 int cert_index =
890 CertLibrary::CERT_TYPE_SERVER_CA, ca_cert_pem_); 888 CertLibrary::Get()->GetServerCACertIndexByPEM(ca_cert_pem_);
891 if (cert_index >= 0) { 889 if (cert_index >= 0) {
892 // Skip item for "Default" 890 // Skip item for "Default"
893 server_ca_cert_combobox_->SetSelectedIndex(1 + cert_index); 891 server_ca_cert_combobox_->SetSelectedIndex(1 + cert_index);
894 } else { 892 } else {
895 server_ca_cert_combobox_->SetSelectedIndex(0); 893 server_ca_cert_combobox_->SetSelectedIndex(0);
896 } 894 }
897 } else { 895 } else {
898 server_ca_cert_combobox_->SetSelectedIndex(0); 896 server_ca_cert_combobox_->SetSelectedIndex(0);
899 } 897 }
900 } 898 }
901 899
902 if (user_cert_combobox_) { 900 if (user_cert_combobox_) {
903 user_cert_combobox_->ModelChanged(); 901 user_cert_combobox_->ModelChanged();
904 if (enable_user_cert_ && !client_cert_id_.empty()) { 902 if (enable_user_cert_ && !client_cert_id_.empty()) {
905 int cert_index = CertLibrary::Get()->GetCertIndexByPkcs11Id( 903 int cert_index =
906 CertLibrary::CERT_TYPE_USER, client_cert_id_); 904 CertLibrary::Get()->GetUserCertIndexByPkcs11Id(client_cert_id_);
907 if (cert_index >= 0) 905 if (cert_index >= 0)
908 user_cert_combobox_->SetSelectedIndex(cert_index); 906 user_cert_combobox_->SetSelectedIndex(cert_index);
909 else 907 else
910 user_cert_combobox_->SetSelectedIndex(0); 908 user_cert_combobox_->SetSelectedIndex(0);
911 } else { 909 } else {
912 user_cert_combobox_->SetSelectedIndex(0); 910 user_cert_combobox_->SetSelectedIndex(0);
913 } 911 }
914 } 912 }
915 913
916 UpdateErrorLabel(); 914 UpdateErrorLabel();
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
1054 property_ui_data->ParseOncProperty( 1052 property_ui_data->ParseOncProperty(
1055 onc_source, 1053 onc_source,
1056 onc, 1054 onc,
1057 base::StringPrintf("%s.%s.%s", 1055 base::StringPrintf("%s.%s.%s",
1058 ::onc::network_config::kVPN, 1056 ::onc::network_config::kVPN,
1059 dict_key.c_str(), 1057 dict_key.c_str(),
1060 key.c_str())); 1058 key.c_str()));
1061 } 1059 }
1062 1060
1063 } // namespace chromeos 1061 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/options/cert_library.cc ('k') | chrome/browser/chromeos/options/wifi_config_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698