| 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 policy_(std::move(policy)), | 63 policy_(std::move(policy)), |
| 64 factory_(std::move(factory)), | 64 factory_(std::move(factory)), |
| 65 queue_(std::move(queue)), | 65 queue_(std::move(queue)), |
| 66 scheduler_(std::move(scheduler)), | 66 scheduler_(std::move(scheduler)), |
| 67 active_request_(nullptr), | 67 active_request_(nullptr), |
| 68 last_offlining_status_(Offliner::RequestStatus::UNKNOWN), | 68 last_offlining_status_(Offliner::RequestStatus::UNKNOWN), |
| 69 offliner_timeout_(base::TimeDelta::FromSeconds( | 69 offliner_timeout_(base::TimeDelta::FromSeconds( |
| 70 policy_->GetSinglePageTimeLimitInSeconds())), | 70 policy_->GetSinglePageTimeLimitInSeconds())), |
| 71 weak_ptr_factory_(this) { | 71 weak_ptr_factory_(this) { |
| 72 DCHECK(policy_ != nullptr); | 72 DCHECK(policy_ != nullptr); |
| 73 picker_.reset(new RequestPicker(queue_.get(), policy_.get())); | 73 picker_.reset(new RequestPicker(queue_.get(), policy_.get(), this)); |
| 74 } | 74 } |
| 75 | 75 |
| 76 RequestCoordinator::~RequestCoordinator() {} | 76 RequestCoordinator::~RequestCoordinator() {} |
| 77 | 77 |
| 78 bool RequestCoordinator::SavePageLater( | 78 bool RequestCoordinator::SavePageLater( |
| 79 const GURL& url, const ClientId& client_id, bool user_requested) { | 79 const GURL& url, const ClientId& client_id, bool user_requested) { |
| 80 DVLOG(2) << "URL is " << url << " " << __func__; | 80 DVLOG(2) << "URL is " << url << " " << __func__; |
| 81 | 81 |
| 82 if (!OfflinePageModel::CanSaveURL(url)) { | 82 if (!OfflinePageModel::CanSaveURL(url)) { |
| 83 DVLOG(1) << "Not able to save page for requested url: " << url; | 83 DVLOG(1) << "Not able to save page for requested url: " << url; |
| (...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 405 FOR_EACH_OBSERVER(Observer, observers_, OnChanged(request)); | 405 FOR_EACH_OBSERVER(Observer, observers_, OnChanged(request)); |
| 406 } | 406 } |
| 407 | 407 |
| 408 void RequestCoordinator::GetOffliner() { | 408 void RequestCoordinator::GetOffliner() { |
| 409 if (!offliner_) { | 409 if (!offliner_) { |
| 410 offliner_ = factory_->GetOffliner(policy_.get()); | 410 offliner_ = factory_->GetOffliner(policy_.get()); |
| 411 } | 411 } |
| 412 } | 412 } |
| 413 | 413 |
| 414 } // namespace offline_pages | 414 } // namespace offline_pages |
| OLD | NEW |