Chromium Code Reviews| Index: components/offline_pages/background/pick_request_task_factory.cc |
| diff --git a/components/offline_pages/background/pick_request_task_factory.cc b/components/offline_pages/background/pick_request_task_factory.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..99363ae305fca904ba6cc31d8de6cb6c0c49e93c |
| --- /dev/null |
| +++ b/components/offline_pages/background/pick_request_task_factory.cc |
| @@ -0,0 +1,35 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "components/offline_pages/background/pick_request_task_factory.h" |
| + |
| +#include "components/offline_pages/background/request_coordinator_event_logger.h" |
| + |
| +namespace offline_pages { |
| + |
| +// Capture the common parameters that we will need to make a pick task, |
| +// and use them when making tasks. Create this once each session, and |
| +// use it to build a picker task when needed. |
| +PickRequestTaskFactory::PickRequestTaskFactory( |
| + OfflinerPolicy* policy, |
|
fgorski
2016/11/09 17:58:07
missing include
Pete Williamson
2016/11/09 23:53:55
Done.
|
| + RequestNotifier* notifier, |
|
fgorski
2016/11/09 17:58:07
missing include
Pete Williamson
2016/11/09 23:53:55
Done.
|
| + RequestCoordinatorEventLogger* event_logger) |
| + : policy_(policy), notifier_(notifier), event_logger_(event_logger) {} |
| + |
| +PickRequestTaskFactory::~PickRequestTaskFactory() {} |
| + |
| +std::unique_ptr<PickRequestTask> PickRequestTaskFactory::CreatePickerTask( |
| + RequestQueueStore* store, |
| + const PickRequestTask::RequestPickedCallback& picked_callback, |
| + const PickRequestTask::RequestNotPickedCallback& not_picked_callback, |
| + DeviceConditions& conditions, |
| + std::set<int64_t>& disabled_requests) { |
| + std::unique_ptr<PickRequestTask> task; |
|
fgorski
2016/11/09 17:58:07
nit: why not construct it in one line?
Pete Williamson
2016/11/09 23:53:55
Done. I didn't do it in the first place because I
fgorski
2016/11/10 19:15:50
Acknowledged.
|
| + task.reset(new PickRequestTask(store, policy_, notifier_, event_logger_, |
| + picked_callback, not_picked_callback, |
| + conditions, disabled_requests)); |
| + return task; |
| +} |
| + |
| +} // namespace offline_pages |