| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_PUSH_MESSAGING_BACKGROUND_BUDGET_SERVICE_H_ |
| 6 #define CHROME_BROWSER_PUSH_MESSAGING_BACKGROUND_BUDGET_SERVICE_H_ |
| 7 |
| 8 #include <string> |
| 9 |
| 10 #include "base/callback_forward.h" |
| 11 #include "components/keyed_service/core/keyed_service.h" |
| 12 #include "url/gurl.h" |
| 13 |
| 14 class Profile; |
| 15 |
| 16 namespace user_prefs { |
| 17 class PrefRegistrySyncable; |
| 18 } |
| 19 |
| 20 namespace chrome { |
| 21 |
| 22 // A budget service to help chrome decide how much background work a service |
| 23 // worker should be able to do on behalf of the user. The budget will be derived |
| 24 // from the Site engagement score for each domain, but in the initial |
| 25 // implementation it is just using the old grace period logic. |
| 26 // TODO(harkness) do I need a CHROME_EXPORT? |
| 27 class BackgroundBudgetService : public KeyedService { |
| 28 public: |
| 29 BackgroundBudgetService() {} |
| 30 ~BackgroundBudgetService() override {} |
| 31 |
| 32 void Shutdown() override {} |
| 33 |
| 34 using BudgetCallback = base::Callback<void(bool success)>; |
| 35 |
| 36 using StringCallback = base::Callback<void(const std::string& data)>; |
| 37 |
| 38 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); |
| 39 static void GetBudget(Profile* profile, |
| 40 int64_t service_worker_registration_id, |
| 41 const StringCallback& callback); |
| 42 |
| 43 static void StoreBudget(Profile* profile, |
| 44 int64_t service_worker_registration_id, |
| 45 const GURL& origin, |
| 46 const std::string& notifications_shown, |
| 47 const BudgetCallback& callback); |
| 48 }; |
| 49 |
| 50 } // namespace chrome |
| 51 |
| 52 #endif // CHROME_BROWSER_PUSH_MESSAGING_BACKGROUND_BUDGET_SERVICE_H_ |
| OLD | NEW |