Chromium Code Reviews| 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) {} |
|
fgorski
2016/12/02 21:44:04
would it make sense to DCHECK these inputs?
Pete Williamson
2016/12/05 20:39:45
Done.
| |
| 21 | 21 |
| 22 PickRequestTaskFactory::~PickRequestTaskFactory() {} | 22 CleanupTaskFactory::~CleanupTaskFactory() {} |
| 23 | 23 |
| 24 std::unique_ptr<PickRequestTask> PickRequestTaskFactory::CreatePickerTask( | 24 std::unique_ptr<CleanupTask> CleanupTaskFactory::CreateCleanupTask( |
| 25 RequestQueueStore* store, | 25 RequestQueueStore* store) { |
| 26 const PickRequestTask::RequestPickedCallback& picked_callback, | 26 std::unique_ptr<CleanupTask> task( |
| 27 const PickRequestTask::RequestNotPickedCallback& not_picked_callback, | 27 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; | 28 return task; |
| 36 } | 29 } |
| 37 | 30 |
| 38 } // namespace offline_pages | 31 } // namespace offline_pages |
| OLD | NEW |