Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_CERT_INTERNAL_CERT_ISSUER_SOURCE_H_ | 5 #ifndef NET_CERT_INTERNAL_CERT_ISSUER_SOURCE_H_ |
| 6 #define NET_CERT_INTERNAL_CERT_ISSUER_SOURCE_H_ | 6 #define NET_CERT_INTERNAL_CERT_ISSUER_SOURCE_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/callback.h" | 11 #include "base/callback.h" |
| 12 #include "net/base/net_export.h" | 12 #include "net/base/net_export.h" |
| 13 #include "net/cert/internal/completion_status.h" | 13 #include "net/cert/internal/completion_status.h" |
| 14 | 14 |
| 15 namespace net { | 15 namespace net { |
| 16 | 16 |
| 17 class ParsedCertificate; | 17 class ParsedCertificate; |
| 18 using ParsedCertificateList = std::vector<scoped_refptr<ParsedCertificate>>; | |
|
eroman
2016/07/01 23:49:29
Are you duplicating the definition here to avoid #
mattm
2016/07/02 02:21:51
Yeah.
| |
| 18 | 19 |
| 19 // Interface for looking up issuers of a certificate during path building. | 20 // Interface for looking up issuers of a certificate during path building. |
| 20 // Provides a synchronous and asynchronous method for retrieving issuers, so the | 21 // Provides a synchronous and asynchronous method for retrieving issuers, so the |
| 21 // path builder can try to complete synchronously first. The caller is expected | 22 // path builder can try to complete synchronously first. The caller is expected |
| 22 // to call SyncGetIssuersOf first, see if it can make progress with those | 23 // to call SyncGetIssuersOf first, see if it can make progress with those |
| 23 // results, and if not, then fall back to calling AsyncGetIssuersOf. | 24 // results, and if not, then fall back to calling AsyncGetIssuersOf. |
| 24 // An implementations may choose to return results from either one of the Get | 25 // An implementations may choose to return results from either one of the Get |
| 25 // methods, or from both. | 26 // methods, or from both. |
| 26 class NET_EXPORT CertIssuerSource { | 27 class NET_EXPORT CertIssuerSource { |
| 27 public: | 28 public: |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 51 }; | 52 }; |
| 52 | 53 |
| 53 using IssuerCallback = base::Callback<void(Request*)>; | 54 using IssuerCallback = base::Callback<void(Request*)>; |
| 54 | 55 |
| 55 virtual ~CertIssuerSource() = default; | 56 virtual ~CertIssuerSource() = default; |
| 56 | 57 |
| 57 // Finds certificates whose Subject matches |cert|'s Issuer. | 58 // Finds certificates whose Subject matches |cert|'s Issuer. |
| 58 // Matches are appended to |issuers|. Any existing contents of |issuers| will | 59 // Matches are appended to |issuers|. Any existing contents of |issuers| will |
| 59 // not be modified. If the implementation does not support synchronous | 60 // not be modified. If the implementation does not support synchronous |
| 60 // lookups, or if there are no matches, |issuers| is not modified. | 61 // lookups, or if there are no matches, |issuers| is not modified. |
| 61 virtual void SyncGetIssuersOf( | 62 virtual void SyncGetIssuersOf(const ParsedCertificate* cert, |
| 62 const ParsedCertificate* cert, | 63 ParsedCertificateList* issuers) = 0; |
| 63 std::vector<scoped_refptr<ParsedCertificate>>* issuers) = 0; | |
| 64 | 64 |
| 65 // Finds certificates whose Subject matches |cert|'s Issuer. | 65 // Finds certificates whose Subject matches |cert|'s Issuer. |
| 66 // If an async callback will be made |*out_req| is filled with a Request | 66 // If an async callback will be made |*out_req| is filled with a Request |
| 67 // object which may be destroyed to cancel the callback. If the implementation | 67 // object which may be destroyed to cancel the callback. If the implementation |
| 68 // does not support asynchronous lookups or can determine synchronously that | 68 // does not support asynchronous lookups or can determine synchronously that |
| 69 // it would return no results, |*out_req| will be set to nullptr. | 69 // it would return no results, |*out_req| will be set to nullptr. |
| 70 // | 70 // |
| 71 // When matches are available or the request is complete, |issuers_callback| | 71 // When matches are available or the request is complete, |issuers_callback| |
| 72 // will be called with a pointer to the same Request. The Request::GetNext | 72 // will be called with a pointer to the same Request. The Request::GetNext |
| 73 // method may then be used to iterate through the retrieved issuers. Note that | 73 // method may then be used to iterate through the retrieved issuers. Note that |
| 74 // |issuers_callback| may be called multiple times. See the documentation for | 74 // |issuers_callback| may be called multiple times. See the documentation for |
| 75 // Request::GetNext for more details. | 75 // Request::GetNext for more details. |
| 76 virtual void AsyncGetIssuersOf(const ParsedCertificate* cert, | 76 virtual void AsyncGetIssuersOf(const ParsedCertificate* cert, |
| 77 const IssuerCallback& issuers_callback, | 77 const IssuerCallback& issuers_callback, |
| 78 std::unique_ptr<Request>* out_req) = 0; | 78 std::unique_ptr<Request>* out_req) = 0; |
| 79 }; | 79 }; |
| 80 | 80 |
| 81 } // namespace net | 81 } // namespace net |
| 82 | 82 |
| 83 #endif // NET_CERT_INTERNAL_CERT_ISSUER_SOURCE_H_ | 83 #endif // NET_CERT_INTERNAL_CERT_ISSUER_SOURCE_H_ |
| OLD | NEW |