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 #include "components/offline_pages/background/request_coordinator.h" | 5 #include "components/offline_pages/background/request_coordinator.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 if (canceled) | 174 if (canceled) |
175 TryNextRequest(); | 175 TryNextRequest(); |
176 } | 176 } |
177 | 177 |
178 void RequestCoordinator::ResumeRequests( | 178 void RequestCoordinator::ResumeRequests( |
179 const std::vector<int64_t>& request_ids) { | 179 const std::vector<int64_t>& request_ids) { |
180 queue_->ChangeRequestsState( | 180 queue_->ChangeRequestsState( |
181 request_ids, SavePageRequest::RequestState::AVAILABLE, | 181 request_ids, SavePageRequest::RequestState::AVAILABLE, |
182 base::Bind(&RequestCoordinator::UpdateMultipleRequestsCallback, | 182 base::Bind(&RequestCoordinator::UpdateMultipleRequestsCallback, |
183 weak_ptr_factory_.GetWeakPtr())); | 183 weak_ptr_factory_.GetWeakPtr())); |
184 // TODO: Should we also schedule a task, in case there is not one scheduled? | 184 scheduler_->Schedule(GetTriggerConditionsForUserRequest()); |
185 } | 185 } |
186 | 186 |
187 void RequestCoordinator::AddRequestResultCallback( | 187 void RequestCoordinator::AddRequestResultCallback( |
188 RequestQueue::AddRequestResult result, | 188 RequestQueue::AddRequestResult result, |
189 const SavePageRequest& request) { | 189 const SavePageRequest& request) { |
190 // Inform the scheduler that we have an outstanding task.. | 190 // Inform the scheduler that we have an outstanding task.. |
191 scheduler_->Schedule(GetTriggerConditionsForUserRequest()); | 191 scheduler_->Schedule(GetTriggerConditionsForUserRequest()); |
192 } | 192 } |
193 | 193 |
194 // Called in response to updating a request in the request queue. | 194 // Called in response to updating a request in the request queue. |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
448 FOR_EACH_OBSERVER(Observer, observers_, OnChanged(request)); | 448 FOR_EACH_OBSERVER(Observer, observers_, OnChanged(request)); |
449 } | 449 } |
450 | 450 |
451 void RequestCoordinator::GetOffliner() { | 451 void RequestCoordinator::GetOffliner() { |
452 if (!offliner_) { | 452 if (!offliner_) { |
453 offliner_ = factory_->GetOffliner(policy_.get()); | 453 offliner_ = factory_->GetOffliner(policy_.get()); |
454 } | 454 } |
455 } | 455 } |
456 | 456 |
457 } // namespace offline_pages | 457 } // namespace offline_pages |
OLD | NEW |