chromium/chrome/browser/web_applications/generated_icon_fix_util.cc

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

#include "chrome/browser/web_applications/generated_icon_fix_util.h"

#include <stdint.h>

#include <compare>
#include <optional>
#include <ostream>
#include <string>
#include <string_view>
#include <utility>

#include "base/feature_list.h"
#include "base/notreached.h"
#include "base/numerics/clamped_math.h"
#include "base/numerics/safe_conversions.h"
#include "base/strings/to_string.h"
#include "base/values.h"
#include "chrome/browser/web_applications/locks/with_app_resources.h"
#include "chrome/browser/web_applications/web_app.h"
#include "chrome/browser/web_applications/web_app_registrar.h"
#include "chrome/browser/web_applications/web_app_registry_update.h"
#include "chrome/common/chrome_features.h"
#include "components/sync/base/time.h"

namespace web_app {

namespace generated_icon_fix_util {

namespace {

constexpr base::TimeDelta kFixWindowDuration =;
constexpr base::TimeDelta kFixAttemptThrottleDuration =;

// Capping the number of attempts should be redundant with the throttle + window
// but, because retries on failure are self propagating, have an explicit
// attempt count to be extra safe. Ordinarily a constraint like this would be
// CHECK'd but because these attempts run at start up it wouldn't be good for
// stability.
constexpr uint32_t kMaxAttemptCount =;
static_assert;

std::optional<base::Time> g_now_override_for_testing_;

base::Time Now() {}

}  // namespace

bool IsValid(const GeneratedIconFix& generated_icon_fix) {}

base::Value ToDebugValue(const GeneratedIconFix* generated_icon_fix) {}

void SetNowForTesting(base::Time now) {}

bool HasRemainingAttempts(const WebApp& app) {}

bool IsWithinFixTimeWindow(const WebApp& app) {}

void EnsureFixTimeWindowStarted(WithAppResources& resources,
                                ScopedRegistryUpdate& update,
                                const webapps::AppId& app_id,
                                GeneratedIconFixSource source) {}

GeneratedIconFix CreateInitialTimeWindow(GeneratedIconFixSource source) {}

base::TimeDelta GetThrottleDuration(const WebApp& app) {}

void RecordFixAttempt(WithAppResources& resources,
                      ScopedRegistryUpdate& update,
                      const webapps::AppId& app_id,
                      GeneratedIconFixSource source) {}

}  // namespace generated_icon_fix_util

bool operator==(const GeneratedIconFix& a, const GeneratedIconFix& b) {}

std::ostream& operator<<(std::ostream& out,
                         const GeneratedIconFixSource& source) {}

}  // namespace web_app