| Index: chrome/browser/push_messaging/background_budget_service.h
|
| diff --git a/chrome/browser/push_messaging/background_budget_service.h b/chrome/browser/push_messaging/background_budget_service.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..f4acefdd6f2d29ff8c36920c1e45715cf7d47549
|
| --- /dev/null
|
| +++ b/chrome/browser/push_messaging/background_budget_service.h
|
| @@ -0,0 +1,52 @@
|
| +// Copyright 2016 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#ifndef CHROME_BROWSER_PUSH_MESSAGING_BACKGROUND_BUDGET_SERVICE_H_
|
| +#define CHROME_BROWSER_PUSH_MESSAGING_BACKGROUND_BUDGET_SERVICE_H_
|
| +
|
| +#include <string>
|
| +
|
| +#include "base/callback_forward.h"
|
| +#include "components/keyed_service/core/keyed_service.h"
|
| +#include "url/gurl.h"
|
| +
|
| +class Profile;
|
| +
|
| +namespace user_prefs {
|
| +class PrefRegistrySyncable;
|
| +}
|
| +
|
| +namespace chrome {
|
| +
|
| +// A budget service to help chrome decide how much background work a service
|
| +// worker should be able to do on behalf of the user. The budget will be derived
|
| +// from the Site engagement score for each domain, but in the initial
|
| +// implementation it is just using the old grace period logic.
|
| +// TODO(harkness) do I need a CHROME_EXPORT?
|
| +class BackgroundBudgetService : public KeyedService {
|
| + public:
|
| + BackgroundBudgetService() {}
|
| + ~BackgroundBudgetService() override {}
|
| +
|
| + void Shutdown() override {}
|
| +
|
| + using BudgetCallback = base::Callback<void(bool success)>;
|
| +
|
| + using StringCallback = base::Callback<void(const std::string& data)>;
|
| +
|
| + static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry);
|
| + static void GetBudget(Profile* profile,
|
| + int64_t service_worker_registration_id,
|
| + const StringCallback& callback);
|
| +
|
| + static void StoreBudget(Profile* profile,
|
| + int64_t service_worker_registration_id,
|
| + const GURL& origin,
|
| + const std::string& notifications_shown,
|
| + const BudgetCallback& callback);
|
| +};
|
| +
|
| +} // namespace chrome
|
| +
|
| +#endif // CHROME_BROWSER_PUSH_MESSAGING_BACKGROUND_BUDGET_SERVICE_H_
|
|
|