Index: ios/web/net/cert_verifier_block_adapter.cc |
diff --git a/ios/web/net/cert_verifier_block_adapter.cc b/ios/web/net/cert_verifier_block_adapter.cc |
index 31901000e9552f2f347735e6937008c50289b3e9..28f6f075629b50d93cc27e33759456360e57d7d7 100644 |
--- a/ios/web/net/cert_verifier_block_adapter.cc |
+++ b/ios/web/net/cert_verifier_block_adapter.cc |
@@ -28,13 +28,6 @@ struct VerificationContext : public base::RefCounted<VerificationContext> { |
// Certificate being verificated. |
scoped_refptr<net::X509Certificate> cert; |
- // Copies CertVerifyResult and wraps it into a scoped_ptr. |
- scoped_ptr<CertVerifyResult> scoped_result() { |
- scoped_ptr<CertVerifyResult> scoped_result(new CertVerifyResult()); |
- scoped_result->CopyFrom(result); |
- return scoped_result.Pass(); |
- } |
- |
private: |
VerificationContext() = delete; |
// Required by base::RefCounted. |
@@ -43,14 +36,8 @@ struct VerificationContext : public base::RefCounted<VerificationContext> { |
}; |
} |
-CertVerifierBlockAdapter::CertVerifierBlockAdapter() |
- : CertVerifierBlockAdapter( |
- scoped_ptr<CertVerifier>(CertVerifier::CreateDefault())) { |
Ryan Sleevi
2015/08/06 03:07:08
Thanks for removing this; I would have nacked this
|
-} |
- |
-CertVerifierBlockAdapter::CertVerifierBlockAdapter( |
- scoped_ptr<CertVerifier> cert_verifier) |
- : cert_verifier_(cert_verifier.Pass()) { |
+CertVerifierBlockAdapter::CertVerifierBlockAdapter(CertVerifier* cert_verifier) |
+ : cert_verifier_(cert_verifier) { |
DCHECK(cert_verifier_); |
} |
@@ -69,13 +56,17 @@ CertVerifierBlockAdapter::Params::~Params() { |
void CertVerifierBlockAdapter::Verify( |
const Params& params, |
- void (^completion_handler)(scoped_ptr<CertVerifyResult>, int)) { |
+ void (^completion_handler)(CertVerifyResult, int)) { |
DCHECK(completion_handler); |
+ if (!params.cert || !params.hostname.size()) { |
Ryan Sleevi
2015/08/06 03:07:08
!params.hostname.empty() for empty checks with STL
Eugene But (OOO till 7-30)
2015/08/07 02:27:20
Done.
|
+ completion_handler(CertVerifyResult(), ERR_INVALID_ARGUMENT); |
Ryan Sleevi
2015/08/06 03:07:08
While David explained how CertVerifier doesn't che
Eugene But (OOO till 7-30)
2015/08/07 02:27:20
Actually CertVerifier DOES check for this:
https:/
|
+ return; |
+ } |
scoped_refptr<VerificationContext> context( |
new VerificationContext(params.cert)); |
CompletionCallback callback = base::BindBlock(^(int) { |
- completion_handler(context->scoped_result(), 0); |
+ completion_handler(context->result, OK); |
Ryan Sleevi
2015/08/06 03:07:08
BUG? It seems that you're assuming that any return
Eugene But (OOO till 7-30)
2015/08/07 02:27:20
Done.
|
}); |
int status = cert_verifier_->Verify(params.cert.get(), params.hostname, |
Ryan Sleevi
2015/08/06 03:07:08
This is typically called |result| in //net, rather
Eugene But (OOO till 7-30)
2015/08/07 02:27:20
I named this |status| to differentiate from |certV
Ryan Sleevi
2015/08/07 21:52:11
Well, you're not naming things statusResult/certVe
Eugene But (OOO till 7-30)
2015/08/12 22:00:38
Sorry for confusion, this file is .cc and a subjec
|
params.ocsp_response, params.flags, |
@@ -89,7 +80,7 @@ void CertVerifierBlockAdapter::Verify( |
} |
// Verification has either failed or result was retrieved from the cache. |
- completion_handler(status ? nullptr : context->scoped_result(), status); |
+ completion_handler(context->result, status); |
Ryan Sleevi
2015/08/06 03:07:08
BUG? Nothing in here seems like it actually keeps
Eugene But (OOO till 7-30)
2015/08/07 02:27:20
|context| is kept alive by the block (blocks retai
|
} |
} // net |