| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/extensions/api/platform_keys/verify_trust_api.h" | 5 #include "chrome/browser/extensions/api/platform_keys/verify_trust_api.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 der_cert_chain.push_back(base::StringPiece( | 169 der_cert_chain.push_back(base::StringPiece( |
| 170 reinterpret_cast<const char*>(cert_der.data()), cert_der.size())); | 170 reinterpret_cast<const char*>(cert_der.data()), cert_der.size())); |
| 171 } | 171 } |
| 172 scoped_refptr<net::X509Certificate> cert_chain( | 172 scoped_refptr<net::X509Certificate> cert_chain( |
| 173 net::X509Certificate::CreateFromDERCertChain(der_cert_chain)); | 173 net::X509Certificate::CreateFromDERCertChain(der_cert_chain)); |
| 174 if (!cert_chain) { | 174 if (!cert_chain) { |
| 175 callback.Run(platform_keys::kErrorInvalidX509Cert, 0, 0); | 175 callback.Run(platform_keys::kErrorInvalidX509Cert, 0, 0); |
| 176 return; | 176 return; |
| 177 } | 177 } |
| 178 | 178 |
| 179 if (!ContainsKey(extension_to_verifier_, extension_id)) { | 179 if (!base::ContainsKey(extension_to_verifier_, extension_id)) { |
| 180 extension_to_verifier_[extension_id] = | 180 extension_to_verifier_[extension_id] = |
| 181 make_linked_ptr(net::CertVerifier::CreateDefault().release()); | 181 make_linked_ptr(net::CertVerifier::CreateDefault().release()); |
| 182 } | 182 } |
| 183 net::CertVerifier* verifier = extension_to_verifier_[extension_id].get(); | 183 net::CertVerifier* verifier = extension_to_verifier_[extension_id].get(); |
| 184 | 184 |
| 185 std::unique_ptr<net::CertVerifyResult> verify_result( | 185 std::unique_ptr<net::CertVerifyResult> verify_result( |
| 186 new net::CertVerifyResult); | 186 new net::CertVerifyResult); |
| 187 std::unique_ptr<net::BoundNetLog> net_log(new net::BoundNetLog); | 187 std::unique_ptr<net::BoundNetLog> net_log(new net::BoundNetLog); |
| 188 const int flags = 0; | 188 const int flags = 0; |
| 189 | 189 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 218 std::unique_ptr<net::CertVerifyResult> verify_result, | 218 std::unique_ptr<net::CertVerifyResult> verify_result, |
| 219 RequestState* request_state, | 219 RequestState* request_state, |
| 220 int return_value) { | 220 int return_value) { |
| 221 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); | 221 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); |
| 222 | 222 |
| 223 callback.Run(std::string() /* no error message */, return_value, | 223 callback.Run(std::string() /* no error message */, return_value, |
| 224 verify_result->cert_status); | 224 verify_result->cert_status); |
| 225 } | 225 } |
| 226 | 226 |
| 227 } // namespace extensions | 227 } // namespace extensions |
| OLD | NEW |