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

Side by Side Diff: chrome/browser/precache/precache_manager_factory.cc

Issue 1961153003: Add pause/resume functionality to precache (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Cleaned up PrecacheFetcher constructor Created 4 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/precache/precache_manager_factory.h" 5 #include "chrome/browser/precache/precache_manager_factory.h"
6 6
7 #include <memory>
8
7 #include "chrome/browser/history/history_service_factory.h" 9 #include "chrome/browser/history/history_service_factory.h"
8 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
9 #include "chrome/browser/sync/profile_sync_service_factory.h" 11 #include "chrome/browser/sync/profile_sync_service_factory.h"
10 #include "components/keyed_service/content/browser_context_dependency_manager.h" 12 #include "components/keyed_service/content/browser_context_dependency_manager.h"
11 #include "components/keyed_service/core/service_access_type.h" 13 #include "components/keyed_service/core/service_access_type.h"
12 #include "components/precache/content/precache_manager.h" 14 #include "components/precache/content/precache_manager.h"
15 #include "components/precache/core/precache_database.h"
13 #include "content/public/browser/browser_context.h" 16 #include "content/public/browser/browser_context.h"
14 17
15 namespace precache { 18 namespace precache {
16 19
17 // static 20 // static
18 PrecacheManager* PrecacheManagerFactory::GetForBrowserContext( 21 PrecacheManager* PrecacheManagerFactory::GetForBrowserContext(
19 content::BrowserContext* browser_context) { 22 content::BrowserContext* browser_context) {
20 return static_cast<PrecacheManager*>( 23 return static_cast<PrecacheManager*>(
21 GetInstance()->GetServiceForBrowserContext(browser_context, true)); 24 GetInstance()->GetServiceForBrowserContext(browser_context, true));
22 } 25 }
23 26
24 // static 27 // static
25 PrecacheManagerFactory* PrecacheManagerFactory::GetInstance() { 28 PrecacheManagerFactory* PrecacheManagerFactory::GetInstance() {
26 return base::Singleton<PrecacheManagerFactory>::get(); 29 return base::Singleton<PrecacheManagerFactory>::get();
27 } 30 }
28 31
29 PrecacheManagerFactory::PrecacheManagerFactory() 32 PrecacheManagerFactory::PrecacheManagerFactory()
30 : BrowserContextKeyedServiceFactory( 33 : BrowserContextKeyedServiceFactory(
31 "PrecacheManager", 34 "PrecacheManager",
32 BrowserContextDependencyManager::GetInstance()) { 35 BrowserContextDependencyManager::GetInstance()) {
33 } 36 }
34 37
35 PrecacheManagerFactory::~PrecacheManagerFactory() { 38 PrecacheManagerFactory::~PrecacheManagerFactory() {
36 } 39 }
37 40
38 KeyedService* PrecacheManagerFactory::BuildServiceInstanceFor( 41 KeyedService* PrecacheManagerFactory::BuildServiceInstanceFor(
39 content::BrowserContext* browser_context) const { 42 content::BrowserContext* browser_context) const {
43 std::unique_ptr<PrecacheDatabase> precache_database(
44 new PrecacheDatabase());
45 base::FilePath db_path(browser_context->GetPath().Append(
46 base::FilePath(FILE_PATH_LITERAL("PrecacheDatabase"))));
40 return new PrecacheManager( 47 return new PrecacheManager(
41 browser_context, 48 browser_context,
42 ProfileSyncServiceFactory::GetSyncServiceForBrowserContext( 49 ProfileSyncServiceFactory::GetSyncServiceForBrowserContext(
43 browser_context), 50 browser_context),
44 HistoryServiceFactory::GetForProfile( 51 HistoryServiceFactory::GetForProfile(
45 Profile::FromBrowserContext(browser_context), 52 Profile::FromBrowserContext(browser_context),
46 ServiceAccessType::IMPLICIT_ACCESS)); 53 ServiceAccessType::IMPLICIT_ACCESS),
54 std::move(precache_database),
55 db_path);
47 } 56 }
48 57
49 } // namespace precache 58 } // namespace precache
OLDNEW
« no previous file with comments | « no previous file | components/components_tests.gyp » ('j') | components/precache/content/precache_manager.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698