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 587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
598 void CertificateManagerHandler::GetCATrust(const base::ListValue* args) { | 598 void CertificateManagerHandler::GetCATrust(const base::ListValue* args) { |
599 net::X509Certificate* cert = cert_id_map_->CallbackArgsToCert(args); | 599 net::X509Certificate* cert = cert_id_map_->CallbackArgsToCert(args); |
600 if (!cert) { | 600 if (!cert) { |
601 web_ui()->CallJavascriptFunctionUnsafe( | 601 web_ui()->CallJavascriptFunctionUnsafe( |
602 "CertificateEditCaTrustOverlay.dismiss"); | 602 "CertificateEditCaTrustOverlay.dismiss"); |
603 return; | 603 return; |
604 } | 604 } |
605 | 605 |
606 net::NSSCertDatabase::TrustBits trust_bits = | 606 net::NSSCertDatabase::TrustBits trust_bits = |
607 certificate_manager_model_->cert_db()->GetCertTrust(cert, net::CA_CERT); | 607 certificate_manager_model_->cert_db()->GetCertTrust(cert, net::CA_CERT); |
608 base::FundamentalValue ssl_value( | 608 base::Value ssl_value( |
609 static_cast<bool>(trust_bits & net::NSSCertDatabase::TRUSTED_SSL)); | 609 static_cast<bool>(trust_bits & net::NSSCertDatabase::TRUSTED_SSL)); |
610 base::FundamentalValue email_value( | 610 base::Value email_value( |
611 static_cast<bool>(trust_bits & net::NSSCertDatabase::TRUSTED_EMAIL)); | 611 static_cast<bool>(trust_bits & net::NSSCertDatabase::TRUSTED_EMAIL)); |
612 base::FundamentalValue obj_sign_value( | 612 base::Value obj_sign_value( |
613 static_cast<bool>(trust_bits & net::NSSCertDatabase::TRUSTED_OBJ_SIGN)); | 613 static_cast<bool>(trust_bits & net::NSSCertDatabase::TRUSTED_OBJ_SIGN)); |
614 web_ui()->CallJavascriptFunctionUnsafe( | 614 web_ui()->CallJavascriptFunctionUnsafe( |
615 "CertificateEditCaTrustOverlay.populateTrust", ssl_value, email_value, | 615 "CertificateEditCaTrustOverlay.populateTrust", ssl_value, email_value, |
616 obj_sign_value); | 616 obj_sign_value); |
617 } | 617 } |
618 | 618 |
619 void CertificateManagerHandler::EditCATrust(const base::ListValue* args) { | 619 void CertificateManagerHandler::EditCATrust(const base::ListValue* args) { |
620 net::X509Certificate* cert = cert_id_map_->CallbackArgsToCert(args); | 620 net::X509Certificate* cert = cert_id_map_->CallbackArgsToCert(args); |
621 bool fail = !cert; | 621 bool fail = !cert; |
622 bool trust_ssl = false; | 622 bool trust_ssl = false; |
(...skipping 454 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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1228 web_ui()->CallJavascriptFunctionUnsafe("CertificateImportErrorOverlay.show", | 1228 web_ui()->CallJavascriptFunctionUnsafe("CertificateImportErrorOverlay.show", |
1229 title_value, error_value, | 1229 title_value, error_value, |
1230 cert_error_list); | 1230 cert_error_list); |
1231 } | 1231 } |
1232 | 1232 |
1233 gfx::NativeWindow CertificateManagerHandler::GetParentWindow() const { | 1233 gfx::NativeWindow CertificateManagerHandler::GetParentWindow() const { |
1234 return web_ui()->GetWebContents()->GetTopLevelNativeWindow(); | 1234 return web_ui()->GetWebContents()->GetTopLevelNativeWindow(); |
1235 } | 1235 } |
1236 | 1236 |
1237 } // namespace options | 1237 } // namespace options |
OLD | NEW |