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

Side by Side Diff: ios/web/net/cert_verifier_block_adapter.cc

Issue 1231783003: WKWebView: Do not DCHECK on invalid CertVerifierBlockAdapter::Params. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 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
OLDNEW
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 "base/mac/bind_objc_block.h" 7 #include "base/mac/bind_objc_block.h"
8 #include "net/base/net_errors.h" 8 #include "net/base/net_errors.h"
9 #include "net/cert/cert_verify_result.h" 9 #include "net/cert/cert_verify_result.h"
10 #include "net/cert/crl_set.h" 10 #include "net/cert/crl_set.h"
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 hostname(hostname), 63 hostname(hostname),
64 flags(static_cast<CertVerifier::VerifyFlags>(0)) { 64 flags(static_cast<CertVerifier::VerifyFlags>(0)) {
65 } 65 }
66 66
67 CertVerifierBlockAdapter::Params::~Params() { 67 CertVerifierBlockAdapter::Params::~Params() {
68 } 68 }
69 69
70 void CertVerifierBlockAdapter::Verify( 70 void CertVerifierBlockAdapter::Verify(
71 const Params& params, 71 const Params& params,
72 void (^completion_handler)(scoped_ptr<CertVerifyResult>, int)) { 72 void (^completion_handler)(scoped_ptr<CertVerifyResult>, int)) {
73 DCHECK(params.cert); 73 DCHECK(completion_handler);
74 DCHECK(params.hostname.size());
75 74
76 scoped_refptr<VerificationContext> context( 75 scoped_refptr<VerificationContext> context(
77 new VerificationContext(params.cert)); 76 new VerificationContext(params.cert));
78 CompletionCallback callback = base::BindBlock(^(int) { 77 CompletionCallback callback = base::BindBlock(^(int) {
79 completion_handler(context->scoped_result(), 0); 78 completion_handler(context->scoped_result(), 0);
80 }); 79 });
81 int status = cert_verifier_->Verify(params.cert.get(), params.hostname, 80 int status = cert_verifier_->Verify(params.cert.get(), params.hostname,
82 params.ocsp_response, params.flags, 81 params.ocsp_response, params.flags,
83 params.crl_set.get(), &(context->result), 82 params.crl_set.get(), &(context->result),
84 callback, &(context->request), net_log_); 83 callback, &(context->request), net_log_);
85 DCHECK(status != ERR_INVALID_ARGUMENT);
86 84
87 if (status == ERR_IO_PENDING) { 85 if (status == ERR_IO_PENDING) {
88 // Completion handler will be called from |callback| when verification 86 // Completion handler will be called from |callback| when verification
89 // request is completed. 87 // request is completed.
90 return; 88 return;
91 } 89 }
92 90
93 // Verification has either failed or result was retrieved from the cache. 91 // Verification has either failed or result was retrieved from the cache.
94 completion_handler(status ? nullptr : context->scoped_result(), status); 92 completion_handler(status ? nullptr : context->scoped_result(), status);
95 } 93 }
96 94
97 } // net 95 } // net
OLDNEW
« no previous file with comments | « ios/web/net/cert_verifier_block_adapter.h ('k') | ios/web/net/cert_verifier_block_adapter_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698