OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_OFFLINE_PAGES_BACKGROUND_REQUEST_COORDINATOR_H_ | 5 #ifndef COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_COORDINATOR_H_ |
6 #define COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_COORDINATOR_H_ | 6 #define COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_COORDINATOR_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 // Called by the offliner when an offlining request is completed. (and by | 204 // Called by the offliner when an offlining request is completed. (and by |
205 // tests). | 205 // tests). |
206 void OfflinerDoneCallback(const SavePageRequest& request, | 206 void OfflinerDoneCallback(const SavePageRequest& request, |
207 Offliner::RequestStatus status); | 207 Offliner::RequestStatus status); |
208 | 208 |
209 void TryNextRequest(); | 209 void TryNextRequest(); |
210 | 210 |
211 // If there is an active request in the list, cancel that request. | 211 // If there is an active request in the list, cancel that request. |
212 bool CancelActiveRequestIfItMatches(const std::vector<int64_t>& request_ids); | 212 bool CancelActiveRequestIfItMatches(const std::vector<int64_t>& request_ids); |
213 | 213 |
| 214 // Records an aborted attempt for the request and update it in the queue |
| 215 // (possibly removing it). Returns the updated copy. |
| 216 void AbortRequestAttempt(SavePageRequest* request); |
| 217 |
| 218 // Remove the attempted request from the queue with status to pass through to |
| 219 // any observers and UMA histogram. |
| 220 void RemoveAttemptedRequest(const SavePageRequest& request, |
| 221 SavePageStatus status); |
| 222 |
214 // Returns the appropriate offliner to use, getting a new one from the factory | 223 // Returns the appropriate offliner to use, getting a new one from the factory |
215 // if needed. | 224 // if needed. |
216 void GetOffliner(); | 225 void GetOffliner(); |
217 | 226 |
218 // Method to wrap calls to getting the connection type so it can be | 227 // Method to wrap calls to getting the connection type so it can be |
219 // changed for tests. | 228 // changed for tests. |
220 net::NetworkChangeNotifier::ConnectionType GetConnectionType(); | 229 net::NetworkChangeNotifier::ConnectionType GetConnectionType(); |
221 | 230 |
222 void SetNetworkConditionsForTest( | 231 void SetNetworkConditionsForTest( |
223 net::NetworkChangeNotifier::ConnectionType connection) { | 232 net::NetworkChangeNotifier::ConnectionType connection) { |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 base::TimeDelta offliner_timeout_; | 285 base::TimeDelta offliner_timeout_; |
277 // Allows us to pass a weak pointer to callbacks. | 286 // Allows us to pass a weak pointer to callbacks. |
278 base::WeakPtrFactory<RequestCoordinator> weak_ptr_factory_; | 287 base::WeakPtrFactory<RequestCoordinator> weak_ptr_factory_; |
279 | 288 |
280 DISALLOW_COPY_AND_ASSIGN(RequestCoordinator); | 289 DISALLOW_COPY_AND_ASSIGN(RequestCoordinator); |
281 }; | 290 }; |
282 | 291 |
283 } // namespace offline_pages | 292 } // namespace offline_pages |
284 | 293 |
285 #endif // COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_COORDINATOR_H_ | 294 #endif // COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_COORDINATOR_H_ |
OLD | NEW |