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_service_impl.h" | 5 #include "components/offline_pages/core/prefetch/prefetch_service_impl.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
10 #include "components/offline_pages/core/prefetch/prefetch_dispatcher_impl.h" | 10 #include "components/offline_pages/core/prefetch/prefetch_dispatcher_impl.h" |
11 | 11 |
12 namespace offline_pages { | 12 namespace offline_pages { |
13 | 13 |
14 PrefetchServiceImpl::PrefetchServiceImpl() | 14 PrefetchServiceImpl::PrefetchServiceImpl( |
15 : dispatcher_(base::MakeUnique<PrefetchDispatcherImpl>()) {} | 15 std::unique_ptr<PrefetchGCMHandler> gcm_handler) |
| 16 : gcm_handler_(std::move(gcm_handler)), |
| 17 dispatcher_(base::MakeUnique<PrefetchDispatcherImpl>()) {} |
16 | 18 |
17 PrefetchServiceImpl::~PrefetchServiceImpl() = default; | 19 PrefetchServiceImpl::~PrefetchServiceImpl() = default; |
18 | 20 |
| 21 PrefetchGCMHandler* PrefetchServiceImpl::GetPrefetchGCMHandler() { |
| 22 return gcm_handler_.get(); |
| 23 } |
| 24 |
19 PrefetchDispatcher* PrefetchServiceImpl::GetDispatcher() { | 25 PrefetchDispatcher* PrefetchServiceImpl::GetDispatcher() { |
20 return dispatcher_.get(); | 26 return dispatcher_.get(); |
21 }; | 27 } |
| 28 |
| 29 void PrefetchServiceImpl::ObserveContentSuggestionsService( |
| 30 ntp_snippets::ContentSuggestionsService* service) { |
| 31 suggested_articles_observer_ = |
| 32 base::MakeUnique<SuggestedArticlesObserver>(service, this); |
| 33 } |
22 | 34 |
23 void PrefetchServiceImpl::Shutdown() {} | 35 void PrefetchServiceImpl::Shutdown() {} |
24 | 36 |
25 } // namespace offline_pages | 37 } // namespace offline_pages |
OLD | NEW |