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 "chrome/browser/offline_pages/prefetch/prefetch_service_factory.h" | 5 #include "chrome/browser/offline_pages/prefetch/prefetch_service_factory.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
11 #include "base/memory/singleton.h" | 11 #include "base/memory/singleton.h" |
12 #include "chrome/browser/offline_pages/prefetch/offline_metrics_collector_impl.h
" | 12 #include "chrome/browser/offline_pages/prefetch/offline_metrics_collector_impl.h
" |
13 #include "chrome/browser/offline_pages/prefetch/prefetch_instance_id_proxy.h" | 13 #include "chrome/browser/offline_pages/prefetch/prefetch_instance_id_proxy.h" |
14 #include "components/keyed_service/content/browser_context_dependency_manager.h" | 14 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
15 #include "components/offline_pages/core/prefetch/prefetch_dispatcher_impl.h" | 15 #include "components/offline_pages/core/prefetch/prefetch_dispatcher_impl.h" |
16 #include "components/offline_pages/core/prefetch/prefetch_gcm_app_handler.h" | 16 #include "components/offline_pages/core/prefetch/prefetch_gcm_app_handler.h" |
17 #include "components/offline_pages/core/prefetch/prefetch_in_memory_store.h" | |
18 #include "components/offline_pages/core/prefetch/prefetch_service_impl.h" | 17 #include "components/offline_pages/core/prefetch/prefetch_service_impl.h" |
19 #include "components/offline_pages/core/prefetch/suggested_articles_observer.h" | 18 #include "components/offline_pages/core/prefetch/suggested_articles_observer.h" |
20 #include "content/public/browser/browser_context.h" | 19 #include "content/public/browser/browser_context.h" |
21 | 20 |
22 namespace offline_pages { | 21 namespace offline_pages { |
23 | 22 |
24 PrefetchServiceFactory::PrefetchServiceFactory() | 23 PrefetchServiceFactory::PrefetchServiceFactory() |
25 : BrowserContextKeyedServiceFactory( | 24 : BrowserContextKeyedServiceFactory( |
26 "OfflinePagePrefetchService", | 25 "OfflinePagePrefetchService", |
27 BrowserContextDependencyManager::GetInstance()) {} | 26 BrowserContextDependencyManager::GetInstance()) {} |
(...skipping 12 matching lines...) Expand all Loading... |
40 KeyedService* PrefetchServiceFactory::BuildServiceInstanceFor( | 39 KeyedService* PrefetchServiceFactory::BuildServiceInstanceFor( |
41 content::BrowserContext* context) const { | 40 content::BrowserContext* context) const { |
42 auto prefetch_dispatcher = base::MakeUnique<PrefetchDispatcherImpl>(); | 41 auto prefetch_dispatcher = base::MakeUnique<PrefetchDispatcherImpl>(); |
43 auto prefetch_gcm_app_handler = base::MakeUnique<PrefetchGCMAppHandler>( | 42 auto prefetch_gcm_app_handler = base::MakeUnique<PrefetchGCMAppHandler>( |
44 base::MakeUnique<PrefetchInstanceIDProxy>(kPrefetchingOfflinePagesAppId, | 43 base::MakeUnique<PrefetchInstanceIDProxy>(kPrefetchingOfflinePagesAppId, |
45 context)); | 44 context)); |
46 auto offline_metrics_collector = | 45 auto offline_metrics_collector = |
47 base::MakeUnique<OfflineMetricsCollectorImpl>(); | 46 base::MakeUnique<OfflineMetricsCollectorImpl>(); |
48 auto suggested_articles_observer = | 47 auto suggested_articles_observer = |
49 base::MakeUnique<SuggestedArticlesObserver>(prefetch_dispatcher.get()); | 48 base::MakeUnique<SuggestedArticlesObserver>(prefetch_dispatcher.get()); |
50 auto in_memory_store = base::MakeUnique<PrefetchInMemoryStore>(); | |
51 | 49 |
52 return new PrefetchServiceImpl( | 50 return new PrefetchServiceImpl(std::move(offline_metrics_collector), |
53 std::move(offline_metrics_collector), std::move(prefetch_dispatcher), | 51 std::move(prefetch_dispatcher), |
54 std::move(prefetch_gcm_app_handler), std::move(in_memory_store), | 52 std::move(prefetch_gcm_app_handler), |
55 std::move(suggested_articles_observer)); | 53 std::move(suggested_articles_observer)); |
56 } | 54 } |
57 | 55 |
58 } // namespace offline_pages | 56 } // namespace offline_pages |
OLD | NEW |