| 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/pick_request_task_factory.h" | 5 #include "components/offline_pages/background/cleanup_task_factory.h" |
| 6 | 6 |
| 7 #include "components/offline_pages/background/offliner_policy.h" | 7 #include "components/offline_pages/background/offliner_policy.h" |
| 8 #include "components/offline_pages/background/request_coordinator_event_logger.h
" | 8 #include "components/offline_pages/background/request_coordinator_event_logger.h
" |
| 9 #include "components/offline_pages/background/request_notifier.h" | 9 #include "components/offline_pages/background/request_notifier.h" |
| 10 | 10 |
| 11 namespace offline_pages { | 11 namespace offline_pages { |
| 12 | 12 |
| 13 // Capture the common parameters that we will need to make a pick task, | 13 // Capture the common parameters that we will need to make a pick task, |
| 14 // and use them when making tasks. Create this once each session, and | 14 // and use them when making tasks. Create this once each session, and |
| 15 // use it to build a picker task when needed. | 15 // use it to build a picker task when needed. |
| 16 PickRequestTaskFactory::PickRequestTaskFactory( | 16 CleanupTaskFactory::CleanupTaskFactory( |
| 17 OfflinerPolicy* policy, | 17 OfflinerPolicy* policy, |
| 18 RequestNotifier* notifier, | 18 RequestNotifier* notifier, |
| 19 RequestCoordinatorEventLogger* event_logger) | 19 RequestCoordinatorEventLogger* event_logger) |
| 20 : policy_(policy), notifier_(notifier), event_logger_(event_logger) {} | 20 : policy_(policy), notifier_(notifier), event_logger_(event_logger) { |
| 21 DCHECK(policy); |
| 22 DCHECK(notifier); |
| 23 DCHECK(event_logger); |
| 24 } |
| 21 | 25 |
| 22 PickRequestTaskFactory::~PickRequestTaskFactory() {} | 26 CleanupTaskFactory::~CleanupTaskFactory() {} |
| 23 | 27 |
| 24 std::unique_ptr<PickRequestTask> PickRequestTaskFactory::CreatePickerTask( | 28 std::unique_ptr<CleanupTask> CleanupTaskFactory::CreateCleanupTask( |
| 25 RequestQueueStore* store, | 29 RequestQueueStore* store) { |
| 26 const PickRequestTask::RequestPickedCallback& picked_callback, | 30 std::unique_ptr<CleanupTask> task( |
| 27 const PickRequestTask::RequestNotPickedCallback& not_picked_callback, | 31 new CleanupTask(store, policy_, notifier_, event_logger_)); |
| 28 const PickRequestTask::RequestCountCallback& request_count_callback, | |
| 29 DeviceConditions& conditions, | |
| 30 std::set<int64_t>& disabled_requests) { | |
| 31 std::unique_ptr<PickRequestTask> task(new PickRequestTask( | |
| 32 store, policy_, notifier_, event_logger_, picked_callback, | |
| 33 not_picked_callback, request_count_callback, conditions, | |
| 34 disabled_requests)); | |
| 35 return task; | 32 return task; |
| 36 } | 33 } |
| 37 | 34 |
| 38 } // namespace offline_pages | 35 } // namespace offline_pages |
| OLD | NEW |