Chromium Code Reviews| 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. | |
|
Peter Beverloo
2016/04/08 10:41:11
Comment nits:
- s/chrome/Chrome/.
- "... will
harkness
2016/04/08 14:11:43
Done.
| |
| 26 // TODO(harkness) do I need a CHROME_EXPORT? | |
|
Peter Beverloo
2016/04/08 10:41:11
No.
The *_EXPORT macros are used when building Ch
harkness
2016/04/08 14:11:43
Acknowledged.
Peter Beverloo
2016/04/08 14:29:38
So remove the TODO? :)
| |
| 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)>; | |
|
Peter Beverloo
2016/04/08 10:41:11
Where would we use the success/failure callback of
harkness
2016/04/08 14:11:43
Currently, this isn't used at all. I had it in thi
| |
| 35 | |
| 36 using StringCallback = base::Callback<void(const std::string& data)>; | |
|
Peter Beverloo
2016/04/08 10:41:11
nit: I'd call this BudgetCallback.
harkness
2016/04/08 14:11:43
I'd actually already changed that in my next patch
| |
| 37 | |
| 38 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); | |
| 39 static void GetBudget(Profile* profile, | |
|
Peter Beverloo
2016/04/08 10:41:11
Get/StoreBudget need to be documented. Today they
harkness
2016/04/08 14:11:43
Done.
| |
| 40 const GURL& origin, | |
| 41 const StringCallback& callback); | |
| 42 | |
| 43 static void StoreBudget(Profile* profile, | |
| 44 const GURL& origin, | |
| 45 const std::string& notifications_shown, | |
| 46 const BudgetCallback& callback); | |
| 47 }; | |
| 48 | |
| 49 } // namespace chrome | |
| 50 | |
| 51 #endif // CHROME_BROWSER_PUSH_MESSAGING_BACKGROUND_BUDGET_SERVICE_H_ | |
| OLD | NEW |