Chromium Code Reviews| Index: chrome/browser/push_messaging/background_budget_service.cc |
| diff --git a/chrome/browser/push_messaging/background_budget_service.cc b/chrome/browser/push_messaging/background_budget_service.cc |
| index 12fa3c8a5b78fa2d4da30ce95bdb4228bee72dbd..4b7654ee9087f72b22e0f84e5b05e04b0474dda6 100644 |
| --- a/chrome/browser/push_messaging/background_budget_service.cc |
| +++ b/chrome/browser/push_messaging/background_budget_service.cc |
| @@ -72,23 +72,25 @@ bool GetBudgetDataFromPrefValue(const std::string& pref_value, |
| } // namespace |
| +BackgroundBudgetService::BackgroundBudgetService(Profile* profile) |
| + : profile_(profile) { |
| + DCHECK(profile); |
| +} |
| + |
| // static |
| void BackgroundBudgetService::RegisterProfilePrefs( |
| user_prefs::PrefRegistrySyncable* registry) { |
| registry->RegisterDictionaryPref(prefs::kBackgroundBudgetMap); |
| } |
| -// static |
| -void BackgroundBudgetService::GetBudget(Profile* profile, |
| - const GURL& origin, |
| - double& budget) { |
| +void BackgroundBudgetService::GetBudget(const GURL& origin, double& budget) { |
| // Get the current SES score, which we'll use to set a new budget. |
| - SiteEngagementService* service = SiteEngagementService::Get(profile); |
| + SiteEngagementService* service = SiteEngagementService::Get(profile_); |
| double ses_score = service->GetScore(origin); |
| // Get the last used budget data. This is a triple of last calculated time, |
| // budget at that time, and Site Engagement Score (ses) at that time. |
| - const std::string map_value = GetBudgetDataFromPrefs(profile, origin); |
| + const std::string map_value = GetBudgetDataFromPrefs(profile_, origin); |
| // If there is no stored data, just return data based on the SES. |
| if (map_value.empty()) { |
| @@ -120,13 +122,12 @@ void BackgroundBudgetService::GetBudget(Profile* profile, |
| } |
| // static |
|
Michael van Ouwerkerk
2016/04/14 14:36:31
nit: no longer
harkness
2016/04/14 17:44:19
Done.
|
| -void BackgroundBudgetService::StoreBudget(Profile* profile, |
| - const GURL& origin, |
| +void BackgroundBudgetService::StoreBudget(const GURL& origin, |
| const double budget) { |
| // Get the current SES score to write into the prefs with the new budget. |
| - SiteEngagementService* service = SiteEngagementService::Get(profile); |
| + SiteEngagementService* service = SiteEngagementService::Get(profile_); |
| double ses_score = service->GetScore(origin); |
| std::string budget_string = MakePrefValueFromBudgetData(budget, ses_score); |
| - SetBudgetDataInPrefs(profile, origin, budget_string); |
| + SetBudgetDataInPrefs(profile_, origin, budget_string); |
| } |