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/ui/webui/options/certificate_manager_handler.h" | 5 #include "chrome/browser/ui/webui/options/certificate_manager_handler.h" |
6 | 6 |
7 #include <errno.h> | 7 #include <errno.h> |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
599 void CertificateManagerHandler::GetCATrust(const base::ListValue* args) { | 599 void CertificateManagerHandler::GetCATrust(const base::ListValue* args) { |
600 net::X509Certificate* cert = cert_id_map_->CallbackArgsToCert(args); | 600 net::X509Certificate* cert = cert_id_map_->CallbackArgsToCert(args); |
601 if (!cert) { | 601 if (!cert) { |
602 web_ui()->CallJavascriptFunctionUnsafe( | 602 web_ui()->CallJavascriptFunctionUnsafe( |
603 "CertificateEditCaTrustOverlay.dismiss"); | 603 "CertificateEditCaTrustOverlay.dismiss"); |
604 return; | 604 return; |
605 } | 605 } |
606 | 606 |
607 net::NSSCertDatabase::TrustBits trust_bits = | 607 net::NSSCertDatabase::TrustBits trust_bits = |
608 certificate_manager_model_->cert_db()->GetCertTrust(cert, net::CA_CERT); | 608 certificate_manager_model_->cert_db()->GetCertTrust(cert, net::CA_CERT); |
609 base::FundamentalValue ssl_value( | 609 base::Value ssl_value( |
610 static_cast<bool>(trust_bits & net::NSSCertDatabase::TRUSTED_SSL)); | 610 static_cast<bool>(trust_bits & net::NSSCertDatabase::TRUSTED_SSL)); |
611 base::FundamentalValue email_value( | 611 base::Value email_value( |
612 static_cast<bool>(trust_bits & net::NSSCertDatabase::TRUSTED_EMAIL)); | 612 static_cast<bool>(trust_bits & net::NSSCertDatabase::TRUSTED_EMAIL)); |
613 base::FundamentalValue obj_sign_value( | 613 base::Value obj_sign_value( |
614 static_cast<bool>(trust_bits & net::NSSCertDatabase::TRUSTED_OBJ_SIGN)); | 614 static_cast<bool>(trust_bits & net::NSSCertDatabase::TRUSTED_OBJ_SIGN)); |
615 web_ui()->CallJavascriptFunctionUnsafe( | 615 web_ui()->CallJavascriptFunctionUnsafe( |
616 "CertificateEditCaTrustOverlay.populateTrust", ssl_value, email_value, | 616 "CertificateEditCaTrustOverlay.populateTrust", ssl_value, email_value, |
617 obj_sign_value); | 617 obj_sign_value); |
618 } | 618 } |
619 | 619 |
620 void CertificateManagerHandler::EditCATrust(const base::ListValue* args) { | 620 void CertificateManagerHandler::EditCATrust(const base::ListValue* args) { |
621 net::X509Certificate* cert = cert_id_map_->CallbackArgsToCert(args); | 621 net::X509Certificate* cert = cert_id_map_->CallbackArgsToCert(args); |
622 bool fail = !cert; | 622 bool fail = !cert; |
623 bool trust_ssl = false; | 623 bool trust_ssl = false; |
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1077 } | 1077 } |
1078 } | 1078 } |
1079 | 1079 |
1080 void CertificateManagerHandler::OnCertificateManagerModelCreated( | 1080 void CertificateManagerHandler::OnCertificateManagerModelCreated( |
1081 std::unique_ptr<CertificateManagerModel> model) { | 1081 std::unique_ptr<CertificateManagerModel> model) { |
1082 certificate_manager_model_ = std::move(model); | 1082 certificate_manager_model_ = std::move(model); |
1083 CertificateManagerModelReady(); | 1083 CertificateManagerModelReady(); |
1084 } | 1084 } |
1085 | 1085 |
1086 void CertificateManagerHandler::CertificateManagerModelReady() { | 1086 void CertificateManagerHandler::CertificateManagerModelReady() { |
1087 base::FundamentalValue user_db_available_value( | 1087 base::Value user_db_available_value( |
1088 certificate_manager_model_->is_user_db_available()); | 1088 certificate_manager_model_->is_user_db_available()); |
1089 base::FundamentalValue tpm_available_value( | 1089 base::Value tpm_available_value( |
1090 certificate_manager_model_->is_tpm_available()); | 1090 certificate_manager_model_->is_tpm_available()); |
1091 web_ui()->CallJavascriptFunctionUnsafe("CertificateManager.onModelReady", | 1091 web_ui()->CallJavascriptFunctionUnsafe("CertificateManager.onModelReady", |
1092 user_db_available_value, | 1092 user_db_available_value, |
1093 tpm_available_value); | 1093 tpm_available_value); |
1094 certificate_manager_model_->Refresh(); | 1094 certificate_manager_model_->Refresh(); |
1095 } | 1095 } |
1096 | 1096 |
1097 void CertificateManagerHandler::Populate(const base::ListValue* args) { | 1097 void CertificateManagerHandler::Populate(const base::ListValue* args) { |
1098 if (certificate_manager_model_) { | 1098 if (certificate_manager_model_) { |
1099 // Already have a model, the webui must be re-loading. Just re-run the | 1099 // Already have a model, the webui must be re-loading. Just re-run the |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1232 web_ui()->CallJavascriptFunctionUnsafe("CertificateImportErrorOverlay.show", | 1232 web_ui()->CallJavascriptFunctionUnsafe("CertificateImportErrorOverlay.show", |
1233 title_value, error_value, | 1233 title_value, error_value, |
1234 cert_error_list); | 1234 cert_error_list); |
1235 } | 1235 } |
1236 | 1236 |
1237 gfx::NativeWindow CertificateManagerHandler::GetParentWindow() const { | 1237 gfx::NativeWindow CertificateManagerHandler::GetParentWindow() const { |
1238 return web_ui()->GetWebContents()->GetTopLevelNativeWindow(); | 1238 return web_ui()->GetWebContents()->GetTopLevelNativeWindow(); |
1239 } | 1239 } |
1240 | 1240 |
1241 } // namespace options | 1241 } // namespace options |
OLD | NEW |