| OLD | NEW |
| 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 "chrome/browser/history/history_service_factory.h" | 7 #include "chrome/browser/history/history_service_factory.h" |
| 8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
| 9 #include "chrome/browser/sync/profile_sync_service_factory.h" | 9 #include "chrome/browser/sync/profile_sync_service_factory.h" |
| 10 #include "components/keyed_service/content/browser_context_dependency_manager.h" | 10 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
| 11 #include "components/keyed_service/core/service_access_type.h" | 11 #include "components/keyed_service/core/service_access_type.h" |
| 12 #include "components/precache/content/precache_manager.h" | 12 #include "components/precache/content/precache_manager.h" |
| 13 #include "content/public/browser/browser_context.h" | 13 #include "content/public/browser/browser_context.h" |
| 14 | 14 |
| 15 namespace precache { | 15 namespace precache { |
| 16 | 16 |
| 17 // static | 17 // static |
| 18 PrecacheManager* PrecacheManagerFactory::GetForBrowserContext( | 18 PrecacheManager* PrecacheManagerFactory::GetForBrowserContext( |
| 19 content::BrowserContext* browser_context) { | 19 content::BrowserContext* browser_context) { |
| 20 return static_cast<PrecacheManager*>( | 20 return static_cast<PrecacheManager*>( |
| 21 GetInstance()->GetServiceForBrowserContext(browser_context, true)); | 21 GetInstance()->GetServiceForBrowserContext(browser_context, true)); |
| 22 } | 22 } |
| 23 | 23 |
| 24 // static | 24 // static |
| 25 PrecacheManagerFactory* PrecacheManagerFactory::GetInstance() { | 25 PrecacheManagerFactory* PrecacheManagerFactory::GetInstance() { |
| 26 return Singleton<PrecacheManagerFactory>::get(); | 26 return base::Singleton<PrecacheManagerFactory>::get(); |
| 27 } | 27 } |
| 28 | 28 |
| 29 PrecacheManagerFactory::PrecacheManagerFactory() | 29 PrecacheManagerFactory::PrecacheManagerFactory() |
| 30 : BrowserContextKeyedServiceFactory( | 30 : BrowserContextKeyedServiceFactory( |
| 31 "PrecacheManager", | 31 "PrecacheManager", |
| 32 BrowserContextDependencyManager::GetInstance()) { | 32 BrowserContextDependencyManager::GetInstance()) { |
| 33 } | 33 } |
| 34 | 34 |
| 35 PrecacheManagerFactory::~PrecacheManagerFactory() { | 35 PrecacheManagerFactory::~PrecacheManagerFactory() { |
| 36 } | 36 } |
| 37 | 37 |
| 38 KeyedService* PrecacheManagerFactory::BuildServiceInstanceFor( | 38 KeyedService* PrecacheManagerFactory::BuildServiceInstanceFor( |
| 39 content::BrowserContext* browser_context) const { | 39 content::BrowserContext* browser_context) const { |
| 40 return new PrecacheManager( | 40 return new PrecacheManager( |
| 41 browser_context, | 41 browser_context, |
| 42 ProfileSyncServiceFactory::GetSyncServiceForBrowserContext( | 42 ProfileSyncServiceFactory::GetSyncServiceForBrowserContext( |
| 43 browser_context), | 43 browser_context), |
| 44 HistoryServiceFactory::GetForProfile( | 44 HistoryServiceFactory::GetForProfile( |
| 45 Profile::FromBrowserContext(browser_context), | 45 Profile::FromBrowserContext(browser_context), |
| 46 ServiceAccessType::IMPLICIT_ACCESS)); | 46 ServiceAccessType::IMPLICIT_ACCESS)); |
| 47 } | 47 } |
| 48 | 48 |
| 49 } // namespace precache | 49 } // namespace precache |
| OLD | NEW |