Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(84)

Side by Side Diff: components/certificate_transparency/log_proofs_fetcher.h

Issue 1100003006: Certificate Transparency: Fetching of Signed Tree Heads (DRAFT) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merging with master Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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"
13 #include "net/url_request/url_request.h"
14
15 namespace base {
16 class Value;
17 }
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
davidben 2015/05/07 21:59:38 Comment describing what this class does.
31 class LogProofsFetcher : public net::URLRequest::Delegate {
32 public:
davidben 2015/05/07 21:59:38 Document that the LogProofsFetcher cannot outlive
33 explicit LogProofsFetcher(net::URLRequestContext* request_context);
34
35 ~LogProofsFetcher() override;
36
davidben 2015/05/07 21:59:37 Comment for what this function does.
37 void FetchSTH(net::CTLogVerifier* verifier);
davidben 2015/05/07 21:59:38 Nit: STH -> SignedTreeHead? Most APIs seem to use
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);
45
46 // Performs post-report cleanup.
47 void RequestComplete(net::URLRequest* request, int bytes_read);
48 void RequestCleanup(net::URLRequest* request);
49
50 struct NET_EXPORT_PRIVATE FetchParams {
davidben 2015/05/07 21:59:38 Why is this NET_EXPORT_PRIVATE? It's not in net an
Eran Messeri 2015/06/18 15:18:43 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;
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 {
davidben 2015/05/07 21:59:38 We don't usually create empty classes for naming.
70 public:
71 // Extracts STH from the json struct
davidben 2015/05/07 21:59:38 Period at the end. Mention that it returns false o
72 static bool FillSignedTreeHead(const base::StringPiece& json_sth,
73 net::ct::SignedTreeHead* sth);
74 };
davidben 2015/05/07 21:59:38 Probably wants to be in a separate header / source
75
76 } // namespace certificate_transparency
77
78 #endif // COMPONENTS_CERTIFICATE_TRANSPARENCY_LOG_PROOFS_FETCHER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698