Chromium Code Reviews| 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 da6fbda89e28452d7a7f5d3cc605a7ae59aef98e..ea1ab0946b5bb1b9bffded6398855122b5a0c0db 100644 |
| --- a/chrome/browser/push_messaging/push_messaging_notification_manager.cc |
| +++ b/chrome/browser/push_messaging/push_messaging_notification_manager.cc |
| @@ -11,8 +11,8 @@ |
| #include "base/metrics/histogram_macros.h" |
| #include "base/strings/utf_string_conversions.h" |
| #include "chrome/browser/browser_process.h" |
| -#include "chrome/browser/budget_service/background_budget_service.h" |
| -#include "chrome/browser/budget_service/background_budget_service_factory.h" |
| +#include "chrome/browser/budget_service/budget_manager.h" |
| +#include "chrome/browser/budget_service/budget_manager_factory.h" |
| #include "chrome/browser/engagement/site_engagement_service.h" |
| #include "chrome/browser/notifications/platform_notification_service_impl.h" |
| #include "chrome/browser/profiles/profile.h" |
| @@ -187,8 +187,7 @@ void PushMessagingNotificationManager::DidGetNotificationsFromDatabase( |
| } |
| // Get the budget for the service worker. |
|
Peter Beverloo
2016/08/12 12:39:46
nit: origin
harkness
2016/08/15 08:05:41
Done.
|
| - BackgroundBudgetService* service = |
| - BackgroundBudgetServiceFactory::GetForProfile(profile_); |
| + BudgetManager* service = BudgetManagerFactory::GetForProfile(profile_); |
|
Peter Beverloo
2016/08/12 12:39:47
nit: s/service/manager/?
harkness
2016/08/15 08:05:41
Done.
|
| service->GetBudget( |
| origin, |
| base::Bind(&PushMessagingNotificationManager::DidGetBudget, |
| @@ -205,7 +204,7 @@ void PushMessagingNotificationManager::DidGetBudget( |
| bool notification_shown, |
| const double budget) { |
| // Record the budget available any time the budget is queried. |
| - UMA_HISTOGRAM_COUNTS_100("PushMessaging.BackgroundBudget", budget); |
| + UMA_HISTOGRAM_COUNTS_100("PushMessaging.BudgetManager", budget); |
| // Get the site engagement score. Only used for UMA recording. |
| SiteEngagementService* ses_service = SiteEngagementService::Get(profile_); |
| @@ -213,8 +212,7 @@ void PushMessagingNotificationManager::DidGetBudget( |
| // Generate histograms for the GetBudget calls which would return "no budget" |
| // or "low budget" if an API was available to app developers. |
| - double cost = BackgroundBudgetService::GetCost( |
| - BackgroundBudgetService::CostType::SILENT_PUSH); |
| + double cost = BudgetManager::GetCost(BudgetManager::CostType::SILENT_PUSH); |
| if (budget < cost) |
| UMA_HISTOGRAM_COUNTS_100("PushMessaging.SESForNoBudgetOrigin", ses_score); |
| else if (budget < 2.0 * cost) |
| @@ -284,14 +282,12 @@ void PushMessagingNotificationManager::CheckForMissedNotification( |
| // If the service needed to show a notification but did not, update the |
| // budget. |
| - double cost = BackgroundBudgetService::GetCost( |
| - BackgroundBudgetService::CostType::SILENT_PUSH); |
| + double cost = BudgetManager::GetCost(BudgetManager::CostType::SILENT_PUSH); |
| if (budget >= cost) { |
| RecordUserVisibleStatus( |
| content::PUSH_USER_VISIBLE_STATUS_REQUIRED_BUT_NOT_SHOWN_USED_GRACE); |
| - BackgroundBudgetService* service = |
| - BackgroundBudgetServiceFactory::GetForProfile(profile_); |
| + BudgetManager* service = BudgetManagerFactory::GetForProfile(profile_); |
|
Peter Beverloo
2016/08/12 12:39:47
nit: s/service/manager/
harkness
2016/08/15 08:05:41
Done.
|
| // Update the stored budget. |
| service->StoreBudget(origin, budget - cost, message_handled_closure); |