Chromium Code Reviews| Index: components/offline_pages/background/request_coordinator.cc |
| diff --git a/components/offline_pages/background/request_coordinator.cc b/components/offline_pages/background/request_coordinator.cc |
| index e6ac73f55fc065eb4b25c8fee76eb8ad2f1f444c..a2d56788d550bce46ed65b5d442ee95b38bc1351 100644 |
| --- a/components/offline_pages/background/request_coordinator.cc |
| +++ b/components/offline_pages/background/request_coordinator.cc |
| @@ -60,13 +60,13 @@ RequestCoordinator::RequestCoordinator(std::unique_ptr<OfflinerPolicy> policy, |
| last_offlining_status_(Offliner::RequestStatus::UNKNOWN), |
| weak_ptr_factory_(this) { |
| DCHECK(policy_ != nullptr); |
| - picker_.reset(new RequestPicker(queue_.get())); |
| + picker_.reset(new RequestPicker(queue_.get(), policy.get())); |
|
fgorski
2016/07/20 16:23:31
policy_.get()
This is happening after the std::mov
Pete Williamson
2016/07/20 19:50:43
Nice catch! This was supposed to be policy_
|
| } |
| RequestCoordinator::~RequestCoordinator() {} |
| bool RequestCoordinator::SavePageLater( |
| - const GURL& url, const ClientId& client_id) { |
| + const GURL& url, const ClientId& client_id, bool was_user_requested) { |
| DVLOG(2) << "URL is " << url << " " << __FUNCTION__; |
| // TODO(petewil): We need a robust scheme for allocating new IDs. |
|
fgorski
2016/07/20 16:23:31
Note: We may have to switch for GUIDs for this giv
Pete Williamson
2016/07/20 19:50:43
Todo elaborated a bit more to mention GUIDS and do
|
| @@ -75,7 +75,7 @@ bool RequestCoordinator::SavePageLater( |
| // Build a SavePageRequest. |
| // TODO(petewil): Use something like base::Clock to help in testing. |
| offline_pages::SavePageRequest request( |
| - id++, url, client_id, base::Time::Now()); |
| + id++, url, client_id, base::Time::Now(), was_user_requested); |
| // Put the request on the request queue. |
| queue_->AddRequest(request, |
| @@ -116,6 +116,7 @@ void RequestCoordinator::StopProcessing() { |
| bool RequestCoordinator::StartProcessing( |
| const DeviceConditions& device_conditions, |
| const base::Callback<void(bool)>& callback) { |
| + current_conditions_.reset(new DeviceConditions(device_conditions)); |
| if (is_busy_) return false; |
| is_canceled_ = false; |
| @@ -135,7 +136,8 @@ void RequestCoordinator::TryNextRequest() { |
| base::Bind(&RequestCoordinator::RequestPicked, |
| weak_ptr_factory_.GetWeakPtr()), |
| base::Bind(&RequestCoordinator::RequestQueueEmpty, |
| - weak_ptr_factory_.GetWeakPtr())); |
| + weak_ptr_factory_.GetWeakPtr()), |
| + current_conditions_.get()); |
| } |
| // Called by the request picker when a request has been picked. |