| 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..0a062e1eb29a4b83937c871eea971b694e5c8812 100644
|
| --- a/components/certificate_transparency/log_proof_fetcher.h
|
| +++ b/components/certificate_transparency/log_proof_fetcher.h
|
| @@ -53,6 +53,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 +81,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,11 +129,24 @@ 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 URLRequest with the right flags for log requests.
|
| + net::URLRequest* CreateRequest(const GURL& url);
|
| +
|
| net::URLRequestContext* const request_context_;
|
|
|
| // Owns the contained requests, as well as FetchState.
|
| std::map<net::URLRequest*, FetchState*> inflight_requests_;
|
|
|
| + std::map<size_t, SignedTreeHeadFetchedCallback> sth_fetch_callbacks_;
|
| + std::map<size_t, ConsistencyProofFetchedCallback>
|
| + consistency_fetch_callbacks_;
|
| +
|
| base::WeakPtrFactory<LogProofFetcher> weak_factory_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(LogProofFetcher);
|
|
|