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

Unified 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: 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 side-by-side diff with in-line comments
Download patch
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..b8f9b199bdc9c95b2392aac258db6e50451a91d3 100644
--- a/chrome/browser/push_messaging/background_budget_service.h
+++ b/chrome/browser/push_messaging/background_budget_service.h
@@ -7,7 +7,7 @@
#include <string>
-#include "base/callback_forward.h"
+#include "components/keyed_service/core/keyed_service.h"
#include "url/gurl.h"
class Profile;
@@ -19,25 +19,27 @@ 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.
-class BackgroundBudgetService {
+class BackgroundBudgetService : public KeyedService {
public:
+ explicit BackgroundBudgetService(Profile* profile);
+ ~BackgroundBudgetService() override {}
+
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);
+ std::string GetBudget(const GURL& origin);
// 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.
- static void StoreBudget(Profile* profile,
- const GURL& origin,
- const std::string& notifications_shown);
+ void StoreBudget(const GURL& origin, const std::string& notifications_shown);
private:
- DISALLOW_IMPLICIT_CONSTRUCTORS(BackgroundBudgetService);
+ Profile* profile_;
+ DISALLOW_COPY_AND_ASSIGN(BackgroundBudgetService);
};
#endif // CHROME_BROWSER_PUSH_MESSAGING_BACKGROUND_BUDGET_SERVICE_H_

Powered by Google App Engine
This is Rietveld 408576698