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

Unified Diff: chrome/browser/push_messaging/push_messaging_notification_manager.cc

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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/push_messaging/push_messaging_notification_manager.cc
diff --git a/chrome/browser/push_messaging/push_messaging_notification_manager.cc b/chrome/browser/push_messaging/push_messaging_notification_manager.cc
index c772c163121357bb8a89d4252a38a6392ee64e9e..11509a98c3ea6c11b859e8606d95ab01bff05598 100644
--- a/chrome/browser/push_messaging/push_messaging_notification_manager.cc
+++ b/chrome/browser/push_messaging/push_messaging_notification_manager.cc
@@ -14,6 +14,7 @@
#include "chrome/browser/notifications/platform_notification_service_impl.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/push_messaging/background_budget_service.h"
+#include "chrome/browser/push_messaging/background_budget_service_factory.h"
#include "chrome/browser/push_messaging/push_messaging_constants.h"
#include "chrome/common/features.h"
#include "chrome/grit/generated_resources.h"
@@ -189,7 +190,9 @@ void PushMessagingNotificationManager::DidGetNotificationsFromDatabase(
// Only track budget for messages that needed to show a notification but
// did not.
double budget = 0;
- BackgroundBudgetService::GetBudget(profile_, origin, budget);
+ BackgroundBudgetService* service =
+ BackgroundBudgetServiceFactory::GetForProfile(profile_);
+ service->GetBudget(origin, budget);
DidGetBudget(origin, service_worker_registration_id,
message_handled_closure, budget);
return;
@@ -255,7 +258,9 @@ void PushMessagingNotificationManager::DidGetBudget(
double cost = 1.0;
if (budget >= cost) {
// Update the stored budget.
- BackgroundBudgetService::StoreBudget(profile_, origin, budget - cost);
+ BackgroundBudgetService* service =
+ BackgroundBudgetServiceFactory::GetForProfile(profile_);
+ service->StoreBudget(origin, budget - cost);
RecordUserVisibleStatus(
content::PUSH_USER_VISIBLE_STATUS_REQUIRED_BUT_NOT_SHOWN_USED_GRACE);

Powered by Google App Engine
This is Rietveld 408576698