#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 = …;
constexpr uint32_t kMaxAttemptCount = …;
static_assert …;
std::optional<base::Time> g_now_override_for_testing_;
base::Time Now() { … }
}
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) { … }
}
bool operator==(const GeneratedIconFix& a, const GeneratedIconFix& b) { … }
std::ostream& operator<<(std::ostream& out,
const GeneratedIconFixSource& source) { … }
}