| 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 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 | 176 |
| 177 void SendRequestToOffliner(const SavePageRequest& request); | 177 void SendRequestToOffliner(const SavePageRequest& request); |
| 178 | 178 |
| 179 // Called by the offliner when an offlining request is completed. (and by | 179 // Called by the offliner when an offlining request is completed. (and by |
| 180 // tests). | 180 // tests). |
| 181 void OfflinerDoneCallback(const SavePageRequest& request, | 181 void OfflinerDoneCallback(const SavePageRequest& request, |
| 182 Offliner::RequestStatus status); | 182 Offliner::RequestStatus status); |
| 183 | 183 |
| 184 void TryNextRequest(); | 184 void TryNextRequest(); |
| 185 | 185 |
| 186 // If there is an active request in the list, cancel that request. |
| 187 void CancelActiveRequestIfItMatches(const std::vector<int64_t>& request_ids); |
| 188 |
| 186 // Returns the appropriate offliner to use, getting a new one from the factory | 189 // Returns the appropriate offliner to use, getting a new one from the factory |
| 187 // if needed. | 190 // if needed. |
| 188 void GetOffliner(); | 191 void GetOffliner(); |
| 189 | 192 |
| 190 void SetOfflinerTimeoutForTest(const base::TimeDelta& timeout) { | 193 void SetOfflinerTimeoutForTest(const base::TimeDelta& timeout) { |
| 191 offliner_timeout_ = timeout; | 194 offliner_timeout_ = timeout; |
| 192 } | 195 } |
| 193 | 196 |
| 194 void SetDeviceConditionsForTest(DeviceConditions& current_conditions) { | 197 void SetDeviceConditionsForTest(DeviceConditions& current_conditions) { |
| 195 current_conditions_.reset(new DeviceConditions(current_conditions)); | 198 current_conditions_.reset(new DeviceConditions(current_conditions)); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 base::TimeDelta offliner_timeout_; | 237 base::TimeDelta offliner_timeout_; |
| 235 // Allows us to pass a weak pointer to callbacks. | 238 // Allows us to pass a weak pointer to callbacks. |
| 236 base::WeakPtrFactory<RequestCoordinator> weak_ptr_factory_; | 239 base::WeakPtrFactory<RequestCoordinator> weak_ptr_factory_; |
| 237 | 240 |
| 238 DISALLOW_COPY_AND_ASSIGN(RequestCoordinator); | 241 DISALLOW_COPY_AND_ASSIGN(RequestCoordinator); |
| 239 }; | 242 }; |
| 240 | 243 |
| 241 } // namespace offline_pages | 244 } // namespace offline_pages |
| 242 | 245 |
| 243 #endif // COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_COORDINATOR_H_ | 246 #endif // COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_COORDINATOR_H_ |
| OLD | NEW |