OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef COMPONENTS_CERTIFICATE_TRANSPARENCY_LOG_PROOF_FETCHER_H_ | 5 #ifndef COMPONENTS_CERTIFICATE_TRANSPARENCY_LOG_PROOF_FETCHER_H_ |
6 #define COMPONENTS_CERTIFICATE_TRANSPARENCY_LOG_PROOF_FETCHER_H_ | 6 #define COMPONENTS_CERTIFICATE_TRANSPARENCY_LOG_PROOF_FETCHER_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 const std::string& log_id, | 101 const std::string& log_id, |
102 uint64_t old_tree_size, | 102 uint64_t old_tree_size, |
103 uint64_t new_tree_size, | 103 uint64_t new_tree_size, |
104 const ConsistencyProofFetchedCallback& fetched_callback, | 104 const ConsistencyProofFetchedCallback& fetched_callback, |
105 const FetchFailedCallback& failed_callback); | 105 const FetchFailedCallback& failed_callback); |
106 | 106 |
107 private: | 107 private: |
108 // Starts the fetch (by delegating to the LogResponseHandler) | 108 // Starts the fetch (by delegating to the LogResponseHandler) |
109 // and stores the |log_handler| in |inflight_fetches_| for later | 109 // and stores the |log_handler| in |inflight_fetches_| for later |
110 // cleanup. | 110 // cleanup. |
111 void StartFetch(const GURL& request_url, LogResponseHandler* log_handler); | 111 void StartFetch(const GURL& request_url, |
| 112 std::unique_ptr<LogResponseHandler> log_request); |
112 | 113 |
113 // Callback for when the fetch was done (successfully or not). | 114 // Callback for when the fetch was done (successfully or not). |
114 // Deletes, and removes, the |log_handler| from the |inflight_fetches_|. | 115 // Deletes, and removes, the |log_handler| from the |inflight_fetches_|. |
115 // Additionally, invokes |caller_callback| which is typically | 116 // Additionally, invokes |caller_callback| which is typically |
116 // one of the callbacks provided to the Fetch... method, bound to | 117 // one of the callbacks provided to the Fetch... method, bound to |
117 // success/failure parameters. | 118 // success/failure parameters. |
118 void OnFetchDone(LogResponseHandler* log_handler, | 119 void OnFetchDone(LogResponseHandler* log_handler, |
119 const base::Closure& caller_callback); | 120 const base::Closure& caller_callback); |
120 | 121 |
121 net::URLRequestContext* const request_context_; | 122 net::URLRequestContext* const request_context_; |
122 | 123 |
123 std::set<LogResponseHandler*> inflight_fetches_; | 124 std::set<std::unique_ptr<LogResponseHandler>> inflight_fetches_; |
124 | 125 |
125 base::WeakPtrFactory<LogProofFetcher> weak_factory_; | 126 base::WeakPtrFactory<LogProofFetcher> weak_factory_; |
126 | 127 |
127 DISALLOW_COPY_AND_ASSIGN(LogProofFetcher); | 128 DISALLOW_COPY_AND_ASSIGN(LogProofFetcher); |
128 }; | 129 }; |
129 | 130 |
130 } // namespace certificate_transparency | 131 } // namespace certificate_transparency |
131 | 132 |
132 #endif // COMPONENTS_CERTIFICATE_TRANSPARENCY_LOG_PROOF_FETCHER_H_ | 133 #endif // COMPONENTS_CERTIFICATE_TRANSPARENCY_LOG_PROOF_FETCHER_H_ |
OLD | NEW |