Chromium Code Reviews| Index: components/certificate_transparency/log_proofs_fetcher.h |
| diff --git a/components/certificate_transparency/log_proofs_fetcher.h b/components/certificate_transparency/log_proofs_fetcher.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..b4b041d9aad30f4d5180261e4bd506ffa007a8f3 |
| --- /dev/null |
| +++ b/components/certificate_transparency/log_proofs_fetcher.h |
| @@ -0,0 +1,78 @@ |
| +// Copyright 2015 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef COMPONENTS_CERTIFICATE_TRANSPARENCY_LOG_PROOFS_FETCHER_H_ |
| +#define COMPONENTS_CERTIFICATE_TRANSPARENCY_LOG_PROOFS_FETCHER_H_ |
| + |
| +#include <map> |
| +#include <string> |
| + |
| +#include "base/memory/scoped_ptr.h" |
| +#include "net/base/io_buffer.h" |
|
Ryan Sleevi
2015/04/24 10:42:07
You don't need to include this; you can forward de
Eran Messeri
2015/06/18 15:18:41
Done.
|
| +#include "net/url_request/url_request.h" |
| + |
|
Ryan Sleevi
2015/04/24 10:42:07
IWYU: Missing ref_counted
Eran Messeri
2015/06/18 15:18:41
Done.
|
| +namespace base { |
| +class Value; |
| +} |
|
Ryan Sleevi
2015/04/24 10:42:07
// namespace base
Eran Messeri
2015/06/18 15:18:41
Done.
|
| + |
| +namespace net { |
| +class URLRequestContext; |
| +class CTLogVerifier; |
| + |
| +namespace ct { |
| +struct SignedTreeHead; |
| +} // namespace ct |
| + |
| +} // namespace net |
| + |
| +namespace certificate_transparency { |
| + |
| +class LogProofsFetcher : public net::URLRequest::Delegate { |
|
Ryan Sleevi
2015/04/24 10:42:07
naming nit: It's weird to call this plural, and I
Ryan Sleevi
2015/04/24 10:42:07
style: documentation
Eran Messeri
2015/06/18 15:18:41
Done.
Eran Messeri
2015/06/18 15:18:42
Done.
|
| + public: |
| + explicit LogProofsFetcher(net::URLRequestContext* request_context); |
| + |
| + ~LogProofsFetcher() override; |
|
Ryan Sleevi
2015/04/24 10:42:07
delete newline on 34?
Eran Messeri
2015/06/18 15:18:41
Done.
|
| + |
| + void FetchSTH(net::CTLogVerifier* verifier); |
|
Ryan Sleevi
2015/04/24 10:42:07
documentation
Eran Messeri
2015/06/18 15:18:42
Done.
|
| + |
| + // net::URLRequest::Delegate |
| + void OnResponseStarted(net::URLRequest* request) override; |
| + void OnReadCompleted(net::URLRequest* request, int bytes_read) override; |
| + |
| + private: |
| + scoped_ptr<net::URLRequest> CreateURLRequest(GURL fetch_sth_url); |
|
Ryan Sleevi
2015/04/24 10:42:07
pass as const-ref
Eran Messeri
2015/06/18 15:18:42
Done.
|
| + |
| + // Performs post-report cleanup. |
| + void RequestComplete(net::URLRequest* request, int bytes_read); |
| + void RequestCleanup(net::URLRequest* request); |
|
Ryan Sleevi
2015/04/24 10:42:07
naming nit: RequestCleanup -> CleanupRequest (Requ
Eran Messeri
2015/06/18 15:18:42
Done.
|
| + |
| + struct NET_EXPORT_PRIVATE FetchParams { |
|
Ryan Sleevi
2015/04/24 10:42:07
1) NET_EXPORT_PRIVATE isn't needed
2) You can forw
Eran Messeri
2015/06/18 15:18:41
Done.
|
| + explicit FetchParams(net::CTLogVerifier* verifier); |
| + ~FetchParams(); |
| + |
| + net::CTLogVerifier* verifier; |
| + scoped_refptr<net::IOBufferWithSize> sth_buffer; |
| + int read_bytes; |
| + }; |
| + |
| + typedef std::map<net::URLRequest*, FetchParams*> RequestsMap; |
|
Ryan Sleevi
2015/04/24 10:42:07
You don't actually need this typedef, do you, sinc
Eran Messeri
2015/06/18 15:18:41
Done.
|
| + |
| + net::URLRequestContext* const request_context_; |
| + |
| + // Owns the contained requests. |
| + RequestsMap inflight_requests_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(LogProofsFetcher); |
| +}; |
| + |
| +class CTLogResponseParser { |
|
Ryan Sleevi
2015/04/24 10:42:07
style: move to a separate file.
Eran Messeri
2015/06/18 15:18:41
Done.
|
| + public: |
| + // Extracts STH from the json struct |
|
Ryan Sleevi
2015/04/24 10:42:07
s/json/JSON/
Eran Messeri
2015/06/18 15:18:41
Done.
|
| + static bool FillSignedTreeHead(const base::StringPiece& json_sth, |
| + net::ct::SignedTreeHead* sth); |
| +}; |
| + |
| +} // namespace certificate_transparency |
| + |
| +#endif // COMPONENTS_CERTIFICATE_TRANSPARENCY_LOG_PROOFS_FETCHER_H_ |