chromium/chrome/browser/badging/badge_manager.h

// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CHROME_BROWSER_BADGING_BADGE_MANAGER_H_
#define CHROME_BROWSER_BADGING_BADGE_MANAGER_H_

#include <map>
#include <memory>
#include <optional>
#include <string>
#include <vector>

#include "base/memory/raw_ptr.h"
#include "base/time/time.h"
#include "components/keyed_service/core/keyed_service.h"
#include "components/webapps/common/web_app_id.h"
#include "content/public/browser/service_worker_version_base_info.h"
#include "mojo/public/cpp/bindings/receiver_set.h"
#include "third_party/blink/public/mojom/badging/badging.mojom.h"
#include "third_party/blink/public/mojom/service_worker/service_worker_ancestor_frame_type.mojom.h"
#include "url/gurl.h"

class Profile;

namespace base {
class Clock;
}  // namespace base

namespace content {
class RenderFrameHost;
class RenderProcessHost;
}  // namespace content

namespace ukm {
class UkmRecorder;
}  // namespace ukm

namespace badging {
class BadgeManagerDelegate;

// Records different types of update badge event.
// These values are persisted to logs. Entries should not be renumbered and
// numeric values should never be reused.
enum UpdateBadgeType {};

// The maximum value of badge contents before saturation occurs.
constexpr uint64_t kMaxBadgeContent =;

// We don't show a badge in response to notifications if the
// Badging API has been used recently.
constexpr base::TimeDelta kBadgingOverrideLifetime =;

// We record when the Badging API was last used, but rate limit
// our updates to minimize load on the Web App database,
constexpr base::TimeDelta kBadgingMinimumUpdateInterval =;

// Maintains a record of badge contents and dispatches badge changes to a
// delegate.
class BadgeManager : public KeyedService, public blink::mojom::BadgeService {};

// Determines the text to put on the badge based on some badge_content.
std::string GetBadgeString(BadgeManager::BadgeValue badge_content);

}  // namespace badging

#endif  // CHROME_BROWSER_BADGING_BADGE_MANAGER_H_