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

Side by Side Diff: chrome/browser/push_messaging/background_budget_service.h

Issue 1889513004: Make BackgroundBudgetService a KeyedService (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ses_integration
Patch Set: 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
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 #ifndef CHROME_BROWSER_PUSH_MESSAGING_BACKGROUND_BUDGET_SERVICE_H_ 5 #ifndef CHROME_BROWSER_PUSH_MESSAGING_BACKGROUND_BUDGET_SERVICE_H_
6 #define CHROME_BROWSER_PUSH_MESSAGING_BACKGROUND_BUDGET_SERVICE_H_ 6 #define CHROME_BROWSER_PUSH_MESSAGING_BACKGROUND_BUDGET_SERVICE_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "components/keyed_service/core/keyed_service.h"
10 #include "url/gurl.h" 11 #include "url/gurl.h"
11 12
12 class Profile; 13 class Profile;
13 14
14 namespace user_prefs { 15 namespace user_prefs {
15 class PrefRegistrySyncable; 16 class PrefRegistrySyncable;
16 } 17 }
17 18
18 // A budget service to help Chrome decide how much background work a service 19 // A budget service to help Chrome decide how much background work a service
19 // worker should be able to do on behalf of the user. The budget is calculated 20 // worker should be able to do on behalf of the user. The budget is calculated
20 // based on the Site Engagment Score and is consumed when a service worker 21 // based on the Site Engagment Score and is consumed when a service worker
21 // doesn't show a notification when it needed to. 22 // doesn't show a notification when it needed to.
22 class BackgroundBudgetService { 23 class BackgroundBudgetService : public KeyedService {
23 public: 24 public:
25 explicit BackgroundBudgetService(Profile* profile);
Peter Beverloo 2016/04/14 16:01:18 nit: virtual destructor
harkness 2016/04/14 17:44:19 Done.
26
24 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); 27 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry);
25 28
26 // Get the budget associated with the origin. This is returned as the double 29 // Get the budget associated with the origin. This is returned as the double
27 // budget. 30 // budget.
28 static void GetBudget(Profile* profile, const GURL& origin, double& budget); 31 void GetBudget(const GURL& origin, double& budget);
29 32
30 // Store the budget associated with the origin. 33 // Store the budget associated with the origin.
31 static void StoreBudget(Profile* profile, 34 void StoreBudget(const GURL& origin, const double budget);
32 const GURL& origin,
33 const double budget);
34 35
35 private: 36 private:
36 DISALLOW_IMPLICIT_CONSTRUCTORS(BackgroundBudgetService); 37 Profile* profile_;
38
39 DISALLOW_COPY_AND_ASSIGN(BackgroundBudgetService);
37 }; 40 };
38 41
39 #endif // CHROME_BROWSER_PUSH_MESSAGING_BACKGROUND_BUDGET_SERVICE_H_ 42 #endif // CHROME_BROWSER_PUSH_MESSAGING_BACKGROUND_BUDGET_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698