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

Side by Side Diff: chrome/browser/push_messaging/background_budget_service_factory.cc

Issue 1889513004: Make BackgroundBudgetService a KeyedService (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ses_integration
Patch Set: Apply diffs to master branch to remove SES dependency Created 4 years, 8 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/browser/push_messaging/background_budget_service_factory.h"
6
7 #include "chrome/browser/engagement/site_engagement_service_factory.h"
8 #include "chrome/browser/profiles/profile.h"
9 #include "chrome/browser/push_messaging/background_budget_service.h"
10 #include "components/keyed_service/content/browser_context_dependency_manager.h"
11 #include "content/public/browser/browser_context.h"
12
13 // static
14 BackgroundBudgetService* BackgroundBudgetServiceFactory::GetForProfile(
15 content::BrowserContext* profile) {
16 // Budget tracking is not supported in incognito mode.
17 if (profile->IsOffTheRecord())
Peter Beverloo 2016/04/15 12:22:24 Why not? The dependency (SiteEngagementServiceFact
18 return nullptr;
19
20 return static_cast<BackgroundBudgetService*>(
21 GetInstance()->GetServiceForBrowserContext(profile, true));
22 }
23
24 // static
25 BackgroundBudgetServiceFactory* BackgroundBudgetServiceFactory::GetInstance() {
26 return base::Singleton<BackgroundBudgetServiceFactory>::get();
27 }
28
29 BackgroundBudgetServiceFactory::BackgroundBudgetServiceFactory()
30 : BrowserContextKeyedServiceFactory(
31 "BackgroundBudgetService",
32 BrowserContextDependencyManager::GetInstance()) {
33 DependsOn(SiteEngagementServiceFactory::GetInstance());
34 }
35
36 KeyedService* BackgroundBudgetServiceFactory::BuildServiceInstanceFor(
37 content::BrowserContext* profile) const {
38 return new BackgroundBudgetService(static_cast<Profile*>(profile));
39 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698