| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chrome/browser/profiles/profile_statistics_factory.h" |
| 6 |
| 7 #include "base/memory/singleton.h" |
| 8 #include "chrome/browser/profiles/profile.h" |
| 9 #include "chrome/browser/profiles/profile_statistics.h" |
| 10 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
| 11 #include "content/public/browser/browser_thread.h" |
| 12 |
| 13 // static |
| 14 ProfileStatistics* ProfileStatisticsFactory::GetForProfile(Profile* profile) { |
| 15 return static_cast<ProfileStatistics*>( |
| 16 GetInstance()->GetServiceForBrowserContext(profile, true)); |
| 17 } |
| 18 |
| 19 // static |
| 20 ProfileStatisticsFactory* ProfileStatisticsFactory::GetInstance() { |
| 21 return base::Singleton<ProfileStatisticsFactory>::get(); |
| 22 } |
| 23 |
| 24 ProfileStatisticsFactory::ProfileStatisticsFactory() |
| 25 : BrowserContextKeyedServiceFactory("ProfileStatistics", |
| 26 BrowserContextDependencyManager::GetInstance()) { |
| 27 } |
| 28 |
| 29 KeyedService* ProfileStatisticsFactory::BuildServiceInstanceFor( |
| 30 content::BrowserContext* context) const { |
| 31 Profile* profile = Profile::FromBrowserContext(context); |
| 32 return new ProfileStatistics(profile); |
| 33 } |
| OLD | NEW |