Chromium Code Reviews| OLD | NEW |
|---|---|
| (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 #ifndef CHROME_BROWSER_PUSH_MESSAGING_BACKGROUND_BUDGET_SERVICE_H_ | |
| 6 #define CHROME_BROWSER_PUSH_MESSAGING_BACKGROUND_BUDGET_SERVICE_H_ | |
| 7 | |
| 8 #include <string> | |
| 9 | |
| 10 #include "base/callback_forward.h" | |
| 11 #include "url/gurl.h" | |
| 12 | |
| 13 class Profile; | |
| 14 | |
| 15 namespace user_prefs { | |
| 16 class PrefRegistrySyncable; | |
| 17 } | |
| 18 | |
| 19 // A budget service to help chrome decide how much background work a service | |
|
Bernhard Bauer
2016/04/11 13:58:42
Nit: "Chrome" capitalized.
harkness
2016/04/12 08:43:35
Done.
| |
| 20 // worker should be able to do on behalf of the user. The budget currently | |
| 21 // implements a grace period of 1 non-visual notification in 10. | |
| 22 class BackgroundBudgetService { | |
| 23 public: | |
| 24 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); | |
| 25 | |
| 26 // Get the budget associated with the origin. This currently tracks a string | |
| 27 // which holds 0 and 1 for the last 10 push messages and whether they | |
| 28 // triggered a visual notification. | |
| 29 static std::string GetBudget(Profile* profile, const GURL& origin); | |
| 30 | |
| 31 // Store the budget associated with the origin. notifications_shown is | |
| 32 // expected to be a sting encoding whether the last 10 push messages triggered | |
|
Bernhard Bauer
2016/04/11 13:58:41
Nit: "string" :)
harkness
2016/04/12 08:43:35
Done.
| |
| 33 // a visual notification. | |
| 34 static void StoreBudget(Profile* profile, | |
| 35 const GURL& origin, | |
| 36 const std::string& notifications_shown); | |
| 37 | |
| 38 private: | |
| 39 DISALLOW_IMPLICIT_CONSTRUCTORS(BackgroundBudgetService); | |
| 40 }; | |
| 41 | |
| 42 #endif // CHROME_BROWSER_PUSH_MESSAGING_BACKGROUND_BUDGET_SERVICE_H_ | |
| OLD | NEW |