| 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 "ios/web/net/cert_verifier_block_adapter.h" | 5 #include "ios/web/net/cert_verifier_block_adapter.h" |
| 6 | 6 |
| 7 #include <utility> |
| 8 |
| 7 #include "base/mac/bind_objc_block.h" | 9 #include "base/mac/bind_objc_block.h" |
| 8 #include "net/base/net_errors.h" | 10 #include "net/base/net_errors.h" |
| 9 #include "net/cert/crl_set.h" | 11 #include "net/cert/crl_set.h" |
| 10 #include "net/cert/x509_certificate.h" | 12 #include "net/cert/x509_certificate.h" |
| 11 #include "net/log/net_log.h" | 13 #include "net/log/net_log.h" |
| 12 | 14 |
| 13 namespace web { | 15 namespace web { |
| 14 | 16 |
| 15 namespace { | 17 namespace { |
| 16 | 18 |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 params.ocsp_response, params.flags, | 89 params.ocsp_response, params.flags, |
| 88 params.crl_set.get(), &(context->result), | 90 params.crl_set.get(), &(context->result), |
| 89 callback, &request, context->net_log); | 91 callback, &request, context->net_log); |
| 90 if (error == net::ERR_IO_PENDING) { | 92 if (error == net::ERR_IO_PENDING) { |
| 91 // Keep the |net::CertVerifier::Request| alive until verification completes. | 93 // Keep the |net::CertVerifier::Request| alive until verification completes. |
| 92 // Because |context| is kept alive by |callback| (through base::BindBlock), | 94 // Because |context| is kept alive by |callback| (through base::BindBlock), |
| 93 // this means that the cert verification request cannot be cancelled. | 95 // this means that the cert verification request cannot be cancelled. |
| 94 // However, it guarantees that |callback| - and thus |completion_handler| - | 96 // However, it guarantees that |callback| - and thus |completion_handler| - |
| 95 // will always be called, which is a necessary part of the API contract of | 97 // will always be called, which is a necessary part of the API contract of |
| 96 // |CertVerifierBlockAdapter::Verify()|. | 98 // |CertVerifierBlockAdapter::Verify()|. |
| 97 context->request = request.Pass(); | 99 context->request = std::move(request); |
| 98 // Completion handler will be called from |callback| when verification | 100 // Completion handler will be called from |callback| when verification |
| 99 // request is completed. | 101 // request is completed. |
| 100 return; | 102 return; |
| 101 } | 103 } |
| 102 | 104 |
| 103 // Verification has either failed or result was retrieved from the cache. | 105 // Verification has either failed or result was retrieved from the cache. |
| 104 completion_handler(context->result, error); | 106 completion_handler(context->result, error); |
| 105 } | 107 } |
| 106 | 108 |
| 107 } // namespace web | 109 } // namespace web |
| OLD | NEW |