| 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 policy_(std::move(policy)), | 56 policy_(std::move(policy)), |
| 57 factory_(std::move(factory)), | 57 factory_(std::move(factory)), |
| 58 queue_(std::move(queue)), | 58 queue_(std::move(queue)), |
| 59 scheduler_(std::move(scheduler)), | 59 scheduler_(std::move(scheduler)), |
| 60 active_request_(nullptr), | 60 active_request_(nullptr), |
| 61 last_offlining_status_(Offliner::RequestStatus::UNKNOWN), | 61 last_offlining_status_(Offliner::RequestStatus::UNKNOWN), |
| 62 offliner_timeout_(base::TimeDelta::FromSeconds( | 62 offliner_timeout_(base::TimeDelta::FromSeconds( |
| 63 policy_->GetSinglePageTimeLimitInSeconds())), | 63 policy_->GetSinglePageTimeLimitInSeconds())), |
| 64 weak_ptr_factory_(this) { | 64 weak_ptr_factory_(this) { |
| 65 DCHECK(policy_ != nullptr); | 65 DCHECK(policy_ != nullptr); |
| 66 picker_.reset(new RequestPicker(queue_.get(), policy_.get())); | 66 picker_.reset(new RequestPicker(queue_.get(), policy_.get(), this)); |
| 67 } | 67 } |
| 68 | 68 |
| 69 RequestCoordinator::~RequestCoordinator() {} | 69 RequestCoordinator::~RequestCoordinator() {} |
| 70 | 70 |
| 71 bool RequestCoordinator::SavePageLater( | 71 bool RequestCoordinator::SavePageLater( |
| 72 const GURL& url, const ClientId& client_id, bool user_requested) { | 72 const GURL& url, const ClientId& client_id, bool user_requested) { |
| 73 DVLOG(2) << "URL is " << url << " " << __func__; | 73 DVLOG(2) << "URL is " << url << " " << __func__; |
| 74 | 74 |
| 75 if (!OfflinePageModel::CanSaveURL(url)) { | 75 if (!OfflinePageModel::CanSaveURL(url)) { |
| 76 DVLOG(1) << "Not able to save page for requested url: " << url; | 76 DVLOG(1) << "Not able to save page for requested url: " << url; |
| (...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 357 policy_->UnmeteredNetworkRequiredForUserRequestedPage()); | 357 policy_->UnmeteredNetworkRequiredForUserRequestedPage()); |
| 358 return trigger_conditions; | 358 return trigger_conditions; |
| 359 } | 359 } |
| 360 | 360 |
| 361 void RequestCoordinator::GetOffliner() { | 361 void RequestCoordinator::GetOffliner() { |
| 362 if (!offliner_) { | 362 if (!offliner_) { |
| 363 offliner_ = factory_->GetOffliner(policy_.get()); | 363 offliner_ = factory_->GetOffliner(policy_.get()); |
| 364 } | 364 } |
| 365 } | 365 } |
| 366 | 366 |
| 367 void RequestCoordinator::NotifyRequestsExpired( |
| 368 const std::vector<SavePageRequest>& expired_requests, |
| 369 RequestQueue::UpdateRequestResult result) { |
| 370 // Notify observers that requests are expired. |
| 371 } |
| 372 |
| 367 } // namespace offline_pages | 373 } // namespace offline_pages |
| OLD | NEW |