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

Side by Side Diff: components/offline_pages/content/prefetch_service_factory.cc

Issue 2879013002: Create skeleton for the Prefetching store and initial pipeline step. (Closed)
Patch Set: A couple of minor changes. Created 3 years, 7 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/content/prefetch_service_factory.h" 5 #include "components/offline_pages/content/prefetch_service_factory.h"
6 6
7 #include <memory>
8
7 #include "base/memory/singleton.h" 9 #include "base/memory/singleton.h"
8 #include "components/keyed_service/content/browser_context_dependency_manager.h" 10 #include "components/keyed_service/content/browser_context_dependency_manager.h"
9 #include "components/offline_pages/core/prefetch/prefetch_service_impl.h" 11 #include "components/offline_pages/core/prefetch/prefetch_service_impl.h"
12 #include "components/offline_pages/core/prefetch/prefetch_store.h"
10 #include "content/public/browser/browser_context.h" 13 #include "content/public/browser/browser_context.h"
11 14
12 namespace offline_pages { 15 namespace offline_pages {
13 16
14 PrefetchServiceFactory::PrefetchServiceFactory() 17 PrefetchServiceFactory::PrefetchServiceFactory()
15 : BrowserContextKeyedServiceFactory( 18 : BrowserContextKeyedServiceFactory(
16 "OfflinePagePrefetchService", 19 "OfflinePagePrefetchService",
17 BrowserContextDependencyManager::GetInstance()) {} 20 BrowserContextDependencyManager::GetInstance()) {}
18 21
19 // static 22 // static
20 PrefetchServiceFactory* PrefetchServiceFactory::GetInstance() { 23 PrefetchServiceFactory* PrefetchServiceFactory::GetInstance() {
21 return base::Singleton<PrefetchServiceFactory>::get(); 24 return base::Singleton<PrefetchServiceFactory>::get();
22 } 25 }
23 26
24 // static 27 // static
25 PrefetchService* PrefetchServiceFactory::GetForBrowserContext( 28 PrefetchService* PrefetchServiceFactory::GetForBrowserContext(
26 content::BrowserContext* context) { 29 content::BrowserContext* context) {
27 return static_cast<PrefetchService*>( 30 return static_cast<PrefetchService*>(
28 GetInstance()->GetServiceForBrowserContext(context, true)); 31 GetInstance()->GetServiceForBrowserContext(context, true));
29 } 32 }
30 33
31 KeyedService* PrefetchServiceFactory::BuildServiceInstanceFor( 34 KeyedService* PrefetchServiceFactory::BuildServiceInstanceFor(
32 content::BrowserContext* context) const { 35 content::BrowserContext* context) const {
33 return new PrefetchServiceImpl(); 36 // TODO(carlosk): instantiate actual implementation of the store once it
37 // exists.
38 std::unique_ptr<PrefetchStore> prefetch_store;
Dmitry Titov 2017/05/18 21:24:02 Does this create an instance of abstract class? Do
carlosk 2017/05/24 20:57:26 This stores a null pointer. And I like the idea of
39 return new PrefetchServiceImpl(std::move(prefetch_store));
34 } 40 }
35 41
36 } // namespace offline_pages 42 } // namespace offline_pages
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698