OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef COMPONENTS_CERTIFICATE_TRANSPARENCY_LOG_PROOFS_FETCHER_H_ | |
6 #define COMPONENTS_CERTIFICATE_TRANSPARENCY_LOG_PROOFS_FETCHER_H_ | |
7 | |
8 #include <map> | |
9 #include <string> | |
10 | |
11 #include "base/memory/scoped_ptr.h" | |
12 #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.
| |
13 #include "net/url_request/url_request.h" | |
14 | |
Ryan Sleevi
2015/04/24 10:42:07
IWYU: Missing ref_counted
Eran Messeri
2015/06/18 15:18:41
Done.
| |
15 namespace base { | |
16 class Value; | |
17 } | |
Ryan Sleevi
2015/04/24 10:42:07
// namespace base
Eran Messeri
2015/06/18 15:18:41
Done.
| |
18 | |
19 namespace net { | |
20 class URLRequestContext; | |
21 class CTLogVerifier; | |
22 | |
23 namespace ct { | |
24 struct SignedTreeHead; | |
25 } // namespace ct | |
26 | |
27 } // namespace net | |
28 | |
29 namespace certificate_transparency { | |
30 | |
31 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.
| |
32 public: | |
33 explicit LogProofsFetcher(net::URLRequestContext* request_context); | |
34 | |
35 ~LogProofsFetcher() override; | |
Ryan Sleevi
2015/04/24 10:42:07
delete newline on 34?
Eran Messeri
2015/06/18 15:18:41
Done.
| |
36 | |
37 void FetchSTH(net::CTLogVerifier* verifier); | |
Ryan Sleevi
2015/04/24 10:42:07
documentation
Eran Messeri
2015/06/18 15:18:42
Done.
| |
38 | |
39 // net::URLRequest::Delegate | |
40 void OnResponseStarted(net::URLRequest* request) override; | |
41 void OnReadCompleted(net::URLRequest* request, int bytes_read) override; | |
42 | |
43 private: | |
44 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.
| |
45 | |
46 // Performs post-report cleanup. | |
47 void RequestComplete(net::URLRequest* request, int bytes_read); | |
48 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.
| |
49 | |
50 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.
| |
51 explicit FetchParams(net::CTLogVerifier* verifier); | |
52 ~FetchParams(); | |
53 | |
54 net::CTLogVerifier* verifier; | |
55 scoped_refptr<net::IOBufferWithSize> sth_buffer; | |
56 int read_bytes; | |
57 }; | |
58 | |
59 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.
| |
60 | |
61 net::URLRequestContext* const request_context_; | |
62 | |
63 // Owns the contained requests. | |
64 RequestsMap inflight_requests_; | |
65 | |
66 DISALLOW_COPY_AND_ASSIGN(LogProofsFetcher); | |
67 }; | |
68 | |
69 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.
| |
70 public: | |
71 // 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.
| |
72 static bool FillSignedTreeHead(const base::StringPiece& json_sth, | |
73 net::ct::SignedTreeHead* sth); | |
74 }; | |
75 | |
76 } // namespace certificate_transparency | |
77 | |
78 #endif // COMPONENTS_CERTIFICATE_TRANSPARENCY_LOG_PROOFS_FETCHER_H_ | |
OLD | NEW |