Chromium Code Reviews| Index: components/certificate_transparency/log_proof_fetcher.h |
| diff --git a/components/certificate_transparency/log_proof_fetcher.h b/components/certificate_transparency/log_proof_fetcher.h |
| index ba952e365d6f77177184a9c70648e2b9f6ef6b09..3bf59f8798009d3074688f2bffbf1ea15df9e115 100644 |
| --- a/components/certificate_transparency/log_proof_fetcher.h |
| +++ b/components/certificate_transparency/log_proof_fetcher.h |
| @@ -7,12 +7,14 @@ |
| #include <map> |
| #include <string> |
| +#include <vector> |
| #include "base/callback.h" |
| #include "base/macros.h" |
| #include "base/memory/scoped_ptr.h" |
| #include "base/memory/weak_ptr.h" |
| #include "net/url_request/url_request.h" |
| +#include "url/gurl.h" |
| namespace base { |
| class Value; |
| @@ -53,6 +55,14 @@ class LogProofFetcher : public net::URLRequest::Delegate { |
| using FetchFailedCallback = base::Callback< |
| void(const std::string& log_id, int net_error, int http_response_code)>; |
| + // Callback for successful retrieval of consistency proofs between two |
| + // STHs. Called with the log_id of the log the consistency belongs to (as |
| + // supplied by the caller to FetchConsistencyProof) and the vector of |
| + // proof nodes. |
| + using ConsistencyProofFetchedCallback = |
| + base::Callback<void(const std::string& log_id, |
| + const std::vector<std::string>& consistency_proof)>; |
| + |
| explicit LogProofFetcher(net::URLRequestContext* request_context); |
| ~LogProofFetcher() override; |
| @@ -73,6 +83,20 @@ class LogProofFetcher : public net::URLRequest::Delegate { |
| const SignedTreeHeadFetchedCallback& fetched_callback, |
| const FetchFailedCallback& failed_callback); |
| + // Fetch a consistency proof between the Merkle trees identified by |
| + // |old_tree_size| and |new_tree_size| of the log identified by |log_id| |
| + // from |base_log_url|. |
| + // |
| + // See the documentation of FetchSignedTreeHead regarding request destruction |
| + // and multiple requests to the same log. |
| + void FetchConsistencyProof( |
| + const GURL& base_log_url, |
| + const std::string& log_id, |
| + size_t old_tree_size, |
| + size_t new_tree_size, |
| + const ConsistencyProofFetchedCallback& fetched_callback, |
| + const FetchFailedCallback& failed_callback); |
| + |
| // net::URLRequest::Delegate |
| void OnResponseStarted(net::URLRequest* request) override; |
| void OnReadCompleted(net::URLRequest* request, int bytes_read) override; |
| @@ -107,6 +131,20 @@ class LogProofFetcher : public net::URLRequest::Delegate { |
| scoped_ptr<base::Value> parsed_json); |
| void OnSTHJsonParseError(net::URLRequest* request, const std::string& error); |
| + // Callbacks for parsing the consistency proof's JSON by the SafeJsonParser |
| + void OnConsistencyProofJsonParseSuccess(net::URLRequest* request, |
| + scoped_ptr<base::Value> parsed_json); |
| + void OnConsistencyProofJsonParseError(net::URLRequest* request, |
| + const std::string& error); |
| + |
| + // Creates a new request with the right flags for log requests. |
|
Ryan Sleevi
2015/11/26 00:50:09
"with the right flags" is not very clear/helpful.
Eran Messeri
2015/11/26 22:07:13
Done - completely changed the documentation as thi
|
| + void FetchFromLog( |
| + const GURL& request_url, |
| + const std::string& log_id, |
| + const SignedTreeHeadFetchedCallback& sth_fetched_callback, |
| + const ConsistencyProofFetchedCallback& proof_fetched_callback, |
| + const FetchFailedCallback& failed_callback); |
| + |
| net::URLRequestContext* const request_context_; |
| // Owns the contained requests, as well as FetchState. |