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

Side by Side Diff: chrome/browser/offline_pages/prefetch/prefetch_service_factory.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 "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>
8
7 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
8 #include "base/memory/singleton.h" 10 #include "base/memory/singleton.h"
9 #include "chrome/browser/offline_pages/prefetch/offline_metrics_collector_impl.h " 11 #include "chrome/browser/offline_pages/prefetch/offline_metrics_collector_impl.h "
10 #include "components/keyed_service/content/browser_context_dependency_manager.h" 12 #include "components/keyed_service/content/browser_context_dependency_manager.h"
13 #include "components/offline_pages/core/prefetch/prefetch_dispatcher_impl.h"
11 #include "components/offline_pages/core/prefetch/prefetch_gcm_app_handler.h" 14 #include "components/offline_pages/core/prefetch/prefetch_gcm_app_handler.h"
15 #include "components/offline_pages/core/prefetch/prefetch_in_memory_store.h"
12 #include "components/offline_pages/core/prefetch/prefetch_service_impl.h" 16 #include "components/offline_pages/core/prefetch/prefetch_service_impl.h"
13 #include "content/public/browser/browser_context.h" 17 #include "content/public/browser/browser_context.h"
14 18
15 namespace offline_pages { 19 namespace offline_pages {
16 20
17 PrefetchServiceFactory::PrefetchServiceFactory() 21 PrefetchServiceFactory::PrefetchServiceFactory()
18 : BrowserContextKeyedServiceFactory( 22 : BrowserContextKeyedServiceFactory(
19 "OfflinePagePrefetchService", 23 "OfflinePagePrefetchService",
20 BrowserContextDependencyManager::GetInstance()) {} 24 BrowserContextDependencyManager::GetInstance()) {}
21 // static 25 // static
22 PrefetchServiceFactory* PrefetchServiceFactory::GetInstance() { 26 PrefetchServiceFactory* PrefetchServiceFactory::GetInstance() {
23 return base::Singleton<PrefetchServiceFactory>::get(); 27 return base::Singleton<PrefetchServiceFactory>::get();
24 } 28 }
25 29
26 // static 30 // static
27 PrefetchService* PrefetchServiceFactory::GetForBrowserContext( 31 PrefetchService* PrefetchServiceFactory::GetForBrowserContext(
28 content::BrowserContext* context) { 32 content::BrowserContext* context) {
29 return static_cast<PrefetchService*>( 33 return static_cast<PrefetchService*>(
30 GetInstance()->GetServiceForBrowserContext(context, true)); 34 GetInstance()->GetServiceForBrowserContext(context, true));
31 } 35 }
32 36
33 KeyedService* PrefetchServiceFactory::BuildServiceInstanceFor( 37 KeyedService* PrefetchServiceFactory::BuildServiceInstanceFor(
34 content::BrowserContext* context) const { 38 content::BrowserContext* context) const {
35 auto prefetch_gcm_app_handler = base::MakeUnique<PrefetchGCMAppHandler>(); 39 auto dispatcher_impl = base::MakeUnique<PrefetchDispatcherImpl>();
36 auto offline_metrics_collector = 40 auto offline_metrics_collector =
37 base::MakeUnique<OfflineMetricsCollectorImpl>(); 41 base::MakeUnique<OfflineMetricsCollectorImpl>();
42 auto gcm_handler = base::MakeUnique<PrefetchGCMAppHandler>();
43 auto in_memory_store = base::MakeUnique<PrefetchInMemoryStore>();
38 44
39 return new PrefetchServiceImpl(std::move(prefetch_gcm_app_handler), 45 return new PrefetchServiceImpl(
40 std::move(offline_metrics_collector)); 46 std::move(offline_metrics_collector), std::move(dispatcher_impl),
47 std::move(gcm_handler), std::move(in_memory_store));
41 } 48 }
42 49
43 } // namespace offline_pages 50 } // namespace offline_pages
OLDNEW
« no previous file with comments | « chrome/browser/android/offline_pages/prefetch/prefetch_background_task.cc ('k') | components/offline_pages/core/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698