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/net_export.h" |
20 #include "net/base/x509_cert_types.h" | 20 #include "net/base/x509_cert_types.h" |
21 | 21 |
22 namespace net { | 22 namespace net { |
23 | 23 |
24 class CertVerifierJob; | 24 class CertVerifierJob; |
25 class CertVerifierWorker; | 25 class CertVerifierWorker; |
26 class X509Certificate; | 26 class X509Certificate; |
27 | 27 |
28 // CachedCertVerifyResult contains the result of a certificate verification. | 28 // CachedCertVerifyResult contains the result of a certificate verification. |
29 struct CachedCertVerifyResult { | 29 struct CachedCertVerifyResult { |
(...skipping 11 matching lines...) Expand all Loading... |
41 }; | 41 }; |
42 | 42 |
43 // CertVerifier represents a service for verifying certificates. | 43 // CertVerifier represents a service for verifying certificates. |
44 // | 44 // |
45 // 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 |
46 // request the RequestHandle that was returned by Verify() needs to be | 46 // request the RequestHandle that was returned by Verify() needs to be |
47 // given. A simpler alternative for consumers that only have 1 outstanding | 47 // given. A simpler alternative for consumers that only have 1 outstanding |
48 // request at a time is to create a SingleRequestCertVerifier wrapper around | 48 // request at a time is to create a SingleRequestCertVerifier wrapper around |
49 // CertVerifier (which will automatically cancel the single request when it | 49 // CertVerifier (which will automatically cancel the single request when it |
50 // goes out of scope). | 50 // goes out of scope). |
51 class NET_API CertVerifier : NON_EXPORTED_BASE(public base::NonThreadSafe), | 51 class NET_EXPORT CertVerifier : NON_EXPORTED_BASE(public base::NonThreadSafe), |
52 public CertDatabase::Observer { | 52 public CertDatabase::Observer { |
53 public: | 53 public: |
54 // Opaque type used to cancel a request. | 54 // Opaque type used to cancel a request. |
55 typedef void* RequestHandle; | 55 typedef void* RequestHandle; |
56 | 56 |
57 // CertVerifier must not call base::Time::Now() directly. It must call | 57 // CertVerifier must not call base::Time::Now() directly. It must call |
58 // 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. |
59 class TimeService { | 59 class TimeService { |
60 public: | 60 public: |
61 virtual ~TimeService() {} | 61 virtual ~TimeService() {} |
62 | 62 |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 | 212 |
213 // Completion callback for when request to |cert_verifier_| completes. | 213 // Completion callback for when request to |cert_verifier_| completes. |
214 CompletionCallbackImpl<SingleRequestCertVerifier> callback_; | 214 CompletionCallbackImpl<SingleRequestCertVerifier> callback_; |
215 | 215 |
216 DISALLOW_COPY_AND_ASSIGN(SingleRequestCertVerifier); | 216 DISALLOW_COPY_AND_ASSIGN(SingleRequestCertVerifier); |
217 }; | 217 }; |
218 | 218 |
219 } // namespace net | 219 } // namespace net |
220 | 220 |
221 #endif // NET_BASE_CERT_VERIFIER_H_ | 221 #endif // NET_BASE_CERT_VERIFIER_H_ |
OLD | NEW |