OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/budget_service/background_budget_service_factory.h" | 5 #include "chrome/browser/budget_service/budget_manager_factory.h" |
6 | 6 |
7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
8 #include "base/time/default_clock.h" | 8 #include "base/time/default_clock.h" |
9 #include "chrome/browser/budget_service/background_budget_service.h" | 9 #include "chrome/browser/budget_service/budget_manager.h" |
10 #include "chrome/browser/engagement/site_engagement_service_factory.h" | 10 #include "chrome/browser/engagement/site_engagement_service_factory.h" |
11 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
12 #include "components/keyed_service/content/browser_context_dependency_manager.h" | 12 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
13 #include "content/public/browser/browser_context.h" | 13 #include "content/public/browser/browser_context.h" |
14 | 14 |
15 // static | 15 // static |
16 BackgroundBudgetService* BackgroundBudgetServiceFactory::GetForProfile( | 16 BudgetManager* BudgetManagerFactory::GetForProfile( |
17 content::BrowserContext* profile) { | 17 content::BrowserContext* profile) { |
18 // Budget tracking is not supported in incognito mode. | 18 // Budget tracking is not supported in incognito mode. |
19 if (profile->IsOffTheRecord()) | 19 if (profile->IsOffTheRecord()) |
20 return nullptr; | 20 return nullptr; |
21 | 21 |
22 return static_cast<BackgroundBudgetService*>( | 22 return static_cast<BudgetManager*>( |
23 GetInstance()->GetServiceForBrowserContext(profile, true)); | 23 GetInstance()->GetServiceForBrowserContext(profile, true)); |
24 } | 24 } |
25 | 25 |
26 // static | 26 // static |
27 BackgroundBudgetServiceFactory* BackgroundBudgetServiceFactory::GetInstance() { | 27 BudgetManagerFactory* BudgetManagerFactory::GetInstance() { |
28 return base::Singleton<BackgroundBudgetServiceFactory>::get(); | 28 return base::Singleton<BudgetManagerFactory>::get(); |
29 } | 29 } |
30 | 30 |
31 BackgroundBudgetServiceFactory::BackgroundBudgetServiceFactory() | 31 BudgetManagerFactory::BudgetManagerFactory() |
32 : BrowserContextKeyedServiceFactory( | 32 : BrowserContextKeyedServiceFactory( |
33 "BackgroundBudgetService", | 33 "BudgetManager", |
34 BrowserContextDependencyManager::GetInstance()) { | 34 BrowserContextDependencyManager::GetInstance()) { |
35 DependsOn(SiteEngagementServiceFactory::GetInstance()); | 35 DependsOn(SiteEngagementServiceFactory::GetInstance()); |
36 } | 36 } |
37 | 37 |
38 KeyedService* BackgroundBudgetServiceFactory::BuildServiceInstanceFor( | 38 KeyedService* BudgetManagerFactory::BuildServiceInstanceFor( |
39 content::BrowserContext* profile) const { | 39 content::BrowserContext* profile) const { |
40 return new BackgroundBudgetService(static_cast<Profile*>(profile)); | 40 return new BudgetManager(static_cast<Profile*>(profile)); |
41 } | 41 } |
OLD | NEW |