OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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/core/prefetch/prefetch_dispatcher_impl.h" | 5 #include "components/offline_pages/core/prefetch/prefetch_dispatcher_impl.h" |
6 | 6 |
| 7 #include "base/memory/ptr_util.h" |
| 8 #include "components/offline_pages/core/prefetch/add_unique_urls_task.h" |
| 9 #include "components/offline_pages/core/prefetch/prefetch_service.h" |
7 #include "url/gurl.h" | 10 #include "url/gurl.h" |
8 | 11 |
9 namespace offline_pages { | 12 namespace offline_pages { |
10 | 13 |
11 PrefetchDispatcherImpl::PrefetchDispatcherImpl() {} | 14 PrefetchDispatcherImpl::PrefetchDispatcherImpl() = default; |
12 | 15 |
13 PrefetchDispatcherImpl::~PrefetchDispatcherImpl() = default; | 16 PrefetchDispatcherImpl::~PrefetchDispatcherImpl() = default; |
14 | 17 |
| 18 void PrefetchDispatcherImpl::SetService(PrefetchService* service) { |
| 19 CHECK(service); |
| 20 service_ = service; |
| 21 } |
| 22 |
15 void PrefetchDispatcherImpl::AddCandidatePrefetchURLs( | 23 void PrefetchDispatcherImpl::AddCandidatePrefetchURLs( |
16 const std::vector<PrefetchURL>& url_suggestions) { | 24 const std::vector<PrefetchURL>& prefetch_urls) { |
17 NOTIMPLEMENTED(); | 25 std::unique_ptr<Task> add_task = base::MakeUnique<AddUniqueUrlsTask>( |
| 26 service_->GetPrefetchStore(), prefetch_urls); |
| 27 task_queue_.AddTask(std::move(add_task)); |
18 } | 28 } |
| 29 |
19 void PrefetchDispatcherImpl::RemoveAllUnprocessedPrefetchURLs( | 30 void PrefetchDispatcherImpl::RemoveAllUnprocessedPrefetchURLs( |
20 const std::string& name_space) { | 31 const std::string& name_space) { |
21 NOTIMPLEMENTED(); | 32 NOTIMPLEMENTED(); |
22 } | 33 } |
23 | 34 |
24 void PrefetchDispatcherImpl::RemovePrefetchURLsByClientId( | 35 void PrefetchDispatcherImpl::RemovePrefetchURLsByClientId( |
25 const ClientId& client_id) { | 36 const ClientId& client_id) { |
26 NOTIMPLEMENTED(); | 37 NOTIMPLEMENTED(); |
27 } | 38 } |
28 | 39 |
29 void PrefetchDispatcherImpl::BeginBackgroundTask( | 40 void PrefetchDispatcherImpl::BeginBackgroundTask( |
30 std::unique_ptr<ScopedBackgroundTask> task) { | 41 std::unique_ptr<ScopedBackgroundTask> task) { |
31 NOTIMPLEMENTED(); | 42 NOTIMPLEMENTED(); |
32 } | 43 } |
33 | 44 |
34 void PrefetchDispatcherImpl::StopBackgroundTask(ScopedBackgroundTask* task) { | 45 void PrefetchDispatcherImpl::StopBackgroundTask(ScopedBackgroundTask* task) { |
35 NOTIMPLEMENTED(); | 46 NOTIMPLEMENTED(); |
36 } | 47 } |
37 | 48 |
38 } // namespace offline_pages | 49 } // namespace offline_pages |
OLD | NEW |