Chromium Code Reviews| Index: chrome/browser/push_messaging/background_budget_service.h |
| diff --git a/chrome/browser/push_messaging/background_budget_service.h b/chrome/browser/push_messaging/background_budget_service.h |
| index d9c8411a61c3601664ab44396b45b32654ec744a..78cad2451b8cc285664813db833b03b24302cbbb 100644 |
| --- a/chrome/browser/push_messaging/background_budget_service.h |
| +++ b/chrome/browser/push_messaging/background_budget_service.h |
| @@ -7,7 +7,6 @@ |
| #include <string> |
| -#include "base/callback_forward.h" |
| #include "url/gurl.h" |
| class Profile; |
| @@ -17,24 +16,21 @@ class PrefRegistrySyncable; |
| } |
| // A budget service to help Chrome decide how much background work a service |
| -// worker should be able to do on behalf of the user. The budget currently |
| -// implements a grace period of 1 non-visual notification in 10. |
| +// worker should be able to do on behalf of the user. The budget is calculated |
| +// based on the Site Engagment Score and is consumed when a service worker |
| +// doesn't show a notification when it needed to. |
| class BackgroundBudgetService { |
| public: |
| static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); |
| - // Get the budget associated with the origin. This currently tracks a string |
| - // which holds 0 and 1 for the last 10 push messages and whether they |
| - // triggered a visual notification. |
| - static std::string GetBudget(Profile* profile, const GURL& origin); |
| + // Get the budget associated with the origin. This is returned as the double |
| + // budget. |
| + static void GetBudget(Profile* profile, const GURL& origin, double& budget); |
|
Peter Beverloo
2016/04/14 18:02:09
Can we return the double instead? If you do decide
harkness
2016/04/27 11:21:08
Done.
|
| - // Store the budget associated with the origin. notifications_shown is |
| - // expected to be a string encoding whether the last 10 push messages |
| - // triggered |
| - // a visual notification. |
| + // Store the budget associated with the origin. |
|
Peter Beverloo
2016/04/14 18:02:09
This method, as well as GetBudget(), should docume
harkness
2016/04/27 11:21:08
Done. I capped it at 0.0 to the max value of SES.
|
| static void StoreBudget(Profile* profile, |
| const GURL& origin, |
| - const std::string& notifications_shown); |
| + const double budget); |
| private: |
| DISALLOW_IMPLICIT_CONSTRUCTORS(BackgroundBudgetService); |