OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef NET_BASE_CERT_VERIFIER_H_ | 5 #ifndef NET_BASE_CERT_VERIFIER_H_ |
6 #define NET_BASE_CERT_VERIFIER_H_ | 6 #define NET_BASE_CERT_VERIFIER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <string> | 10 #include <string> |
11 | 11 |
12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "base/threading/non_thread_safe.h" | 14 #include "base/threading/non_thread_safe.h" |
15 #include "base/time.h" | 15 #include "base/time.h" |
16 #include "net/base/cert_database.h" | 16 #include "net/base/cert_database.h" |
17 #include "net/base/cert_verify_result.h" | 17 #include "net/base/cert_verify_result.h" |
18 #include "net/base/completion_callback.h" | 18 #include "net/base/completion_callback.h" |
| 19 #include "net/base/net_api.h" |
19 #include "net/base/x509_cert_types.h" | 20 #include "net/base/x509_cert_types.h" |
20 | 21 |
21 namespace net { | 22 namespace net { |
22 | 23 |
23 class CertVerifierJob; | 24 class CertVerifierJob; |
24 class CertVerifierWorker; | 25 class CertVerifierWorker; |
25 class X509Certificate; | 26 class X509Certificate; |
26 | 27 |
27 // CachedCertVerifyResult contains the result of a certificate verification. | 28 // CachedCertVerifyResult contains the result of a certificate verification. |
28 struct CachedCertVerifyResult { | 29 struct CachedCertVerifyResult { |
(...skipping 11 matching lines...) Expand all Loading... |
40 }; | 41 }; |
41 | 42 |
42 // CertVerifier represents a service for verifying certificates. | 43 // CertVerifier represents a service for verifying certificates. |
43 // | 44 // |
44 // CertVerifier can handle multiple requests at a time, so when canceling a | 45 // CertVerifier can handle multiple requests at a time, so when canceling a |
45 // request the RequestHandle that was returned by Verify() needs to be | 46 // request the RequestHandle that was returned by Verify() needs to be |
46 // given. A simpler alternative for consumers that only have 1 outstanding | 47 // given. A simpler alternative for consumers that only have 1 outstanding |
47 // request at a time is to create a SingleRequestCertVerifier wrapper around | 48 // request at a time is to create a SingleRequestCertVerifier wrapper around |
48 // CertVerifier (which will automatically cancel the single request when it | 49 // CertVerifier (which will automatically cancel the single request when it |
49 // goes out of scope). | 50 // goes out of scope). |
50 class CertVerifier : public base::NonThreadSafe, | 51 class NET_API CertVerifier : NON_EXPORTED_BASE(public base::NonThreadSafe), |
51 public CertDatabase::Observer { | 52 public CertDatabase::Observer { |
52 public: | 53 public: |
53 // Opaque type used to cancel a request. | 54 // Opaque type used to cancel a request. |
54 typedef void* RequestHandle; | 55 typedef void* RequestHandle; |
55 | 56 |
56 // CertVerifier must not call base::Time::Now() directly. It must call | 57 // CertVerifier must not call base::Time::Now() directly. It must call |
57 // time_service_->Now(). This allows unit tests to mock the current time. | 58 // time_service_->Now(). This allows unit tests to mock the current time. |
58 class TimeService { | 59 class TimeService { |
59 public: | 60 public: |
60 virtual ~TimeService() {} | 61 virtual ~TimeService() {} |
61 | 62 |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 | 212 |
212 // Completion callback for when request to |cert_verifier_| completes. | 213 // Completion callback for when request to |cert_verifier_| completes. |
213 CompletionCallbackImpl<SingleRequestCertVerifier> callback_; | 214 CompletionCallbackImpl<SingleRequestCertVerifier> callback_; |
214 | 215 |
215 DISALLOW_COPY_AND_ASSIGN(SingleRequestCertVerifier); | 216 DISALLOW_COPY_AND_ASSIGN(SingleRequestCertVerifier); |
216 }; | 217 }; |
217 | 218 |
218 } // namespace net | 219 } // namespace net |
219 | 220 |
220 #endif // NET_BASE_CERT_VERIFIER_H_ | 221 #endif // NET_BASE_CERT_VERIFIER_H_ |
OLD | NEW |