Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(134)

Side by Side Diff: components/offline_pages/core/prefetch/prefetch_service_impl.cc

Issue 2879013002: Create skeleton for the Prefetching store and initial pipeline step. (Closed)
Patch Set: Made construction params a cost&. Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/offline_metrics_collector.h" 10 #include "components/offline_pages/core/prefetch/offline_metrics_collector.h"
11 #include "components/offline_pages/core/prefetch/prefetch_dispatcher_impl.h" 11 #include "components/offline_pages/core/prefetch/prefetch_dispatcher_impl.h"
12 #include "components/offline_pages/core/prefetch/prefetch_store.h"
12 13
13 namespace offline_pages { 14 namespace offline_pages {
14 15
15 PrefetchServiceImpl::PrefetchServiceImpl( 16 PrefetchServiceImpl::PrefetchServiceImpl(
17 std::unique_ptr<OfflineMetricsCollector> offline_metrics_collector,
18 std::unique_ptr<PrefetchDispatcher> dispatcher,
16 std::unique_ptr<PrefetchGCMHandler> gcm_handler, 19 std::unique_ptr<PrefetchGCMHandler> gcm_handler,
17 std::unique_ptr<OfflineMetricsCollector> offline_metrics_collector) 20 std::unique_ptr<PrefetchStore> store)
18 : gcm_handler_(std::move(gcm_handler)), 21 : offline_metrics_collector_(std::move(offline_metrics_collector)),
19 dispatcher_(base::MakeUnique<PrefetchDispatcherImpl>()), 22 prefetch_dispatcher_(std::move(dispatcher)),
20 offline_metrics_collector_(std::move(offline_metrics_collector)) {} 23 prefetch_gcm_handler_(std::move(gcm_handler)),
24 prefetch_store_(std::move(store)) {
25 prefetch_dispatcher_->SetService(this);
26 }
21 27
22 PrefetchServiceImpl::~PrefetchServiceImpl() = default; 28 PrefetchServiceImpl::~PrefetchServiceImpl() = default;
23 29
30 OfflineMetricsCollector* PrefetchServiceImpl::GetOfflineMetricsCollector() {
31 return offline_metrics_collector_.get();
32 }
33
34 PrefetchDispatcher* PrefetchServiceImpl::GetPrefetchDispatcher() {
35 return prefetch_dispatcher_.get();
36 }
37
38 PrefetchGCMHandler* PrefetchServiceImpl::GetPrefetchGCMHandler() {
39 return prefetch_gcm_handler_.get();
40 }
41
42 PrefetchStore* PrefetchServiceImpl::GetPrefetchStore() {
43 return prefetch_store_.get();
44 }
45
24 void PrefetchServiceImpl::ObserveContentSuggestionsService( 46 void PrefetchServiceImpl::ObserveContentSuggestionsService(
25 ntp_snippets::ContentSuggestionsService* service) { 47 ntp_snippets::ContentSuggestionsService* service) {
26 suggested_articles_observer_ = 48 suggested_articles_observer_ =
27 base::MakeUnique<SuggestedArticlesObserver>(service, this); 49 base::MakeUnique<SuggestedArticlesObserver>(service, this);
28 } 50 }
29 51
30 PrefetchDispatcher* PrefetchServiceImpl::GetDispatcher() {
31 return dispatcher_.get();
32 }
33
34 OfflineMetricsCollector* PrefetchServiceImpl::GetOfflineMetricsCollector() {
35 return offline_metrics_collector_.get();
36 }
37
38 PrefetchGCMHandler* PrefetchServiceImpl::GetPrefetchGCMHandler() {
39 return gcm_handler_.get();
40 }
41
42 void PrefetchServiceImpl::Shutdown() {} 52 void PrefetchServiceImpl::Shutdown() {}
43 53
44 } // namespace offline_pages 54 } // namespace offline_pages
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698