| 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 <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 PrefetchDispatcherImpl::PrefetchDispatcherImpl() = default; | 27 PrefetchDispatcherImpl::PrefetchDispatcherImpl() = default; |
| 28 | 28 |
| 29 PrefetchDispatcherImpl::~PrefetchDispatcherImpl() = default; | 29 PrefetchDispatcherImpl::~PrefetchDispatcherImpl() = default; |
| 30 | 30 |
| 31 void PrefetchDispatcherImpl::SetService(PrefetchService* service) { | 31 void PrefetchDispatcherImpl::SetService(PrefetchService* service) { |
| 32 CHECK(service); | 32 CHECK(service); |
| 33 service_ = service; | 33 service_ = service; |
| 34 } | 34 } |
| 35 | 35 |
| 36 void PrefetchDispatcherImpl::AddCandidatePrefetchURLs( | 36 void PrefetchDispatcherImpl::AddCandidatePrefetchURLs( |
| 37 const std::string& name_space, |
| 37 const std::vector<PrefetchURL>& prefetch_urls) { | 38 const std::vector<PrefetchURL>& prefetch_urls) { |
| 38 if (!IsPrefetchingOfflinePagesEnabled()) | 39 if (!IsPrefetchingOfflinePagesEnabled()) |
| 39 return; | 40 return; |
| 40 | 41 |
| 41 std::unique_ptr<Task> add_task = base::MakeUnique<AddUniqueUrlsTask>( | 42 std::unique_ptr<Task> add_task = |
| 42 service_->GetPrefetchStore(), prefetch_urls); | 43 base::MakeUnique<AddUniqueUrlsTask>(name_space, prefetch_urls); |
| 43 task_queue_.AddTask(std::move(add_task)); | 44 task_queue_.AddTask(std::move(add_task)); |
| 44 } | 45 } |
| 45 | 46 |
| 46 void PrefetchDispatcherImpl::RemoveAllUnprocessedPrefetchURLs( | 47 void PrefetchDispatcherImpl::RemoveAllUnprocessedPrefetchURLs( |
| 47 const std::string& name_space) { | 48 const std::string& name_space) { |
| 48 if (!IsPrefetchingOfflinePagesEnabled()) | 49 if (!IsPrefetchingOfflinePagesEnabled()) |
| 49 return; | 50 return; |
| 50 | 51 |
| 51 NOTIMPLEMENTED(); | 52 NOTIMPLEMENTED(); |
| 52 } | 53 } |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 | 92 |
| 92 void PrefetchDispatcherImpl::GCMOperationCompletedMessageReceived( | 93 void PrefetchDispatcherImpl::GCMOperationCompletedMessageReceived( |
| 93 const std::string& operation_name) { | 94 const std::string& operation_name) { |
| 94 if (!IsPrefetchingOfflinePagesEnabled()) | 95 if (!IsPrefetchingOfflinePagesEnabled()) |
| 95 return; | 96 return; |
| 96 | 97 |
| 97 NOTIMPLEMENTED(); | 98 NOTIMPLEMENTED(); |
| 98 } | 99 } |
| 99 | 100 |
| 100 } // namespace offline_pages | 101 } // namespace offline_pages |
| OLD | NEW |