chromium/chrome/browser/upgrade_detector/upgrade_detector_impl.cc

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

#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/40285824): Remove this and convert code to safer constructs.
#pragma allow_unsafe_buffers
#endif

#include "chrome/browser/upgrade_detector/upgrade_detector_impl.h"

#include <stdint.h>

#include <optional>
#include <string>

#include "base/build_time.h"
#include "base/check_op.h"
#include "base/command_line.h"
#include "base/feature_list.h"
#include "base/functional/bind.h"
#include "base/no_destructor.h"
#include "base/notreached.h"
#include "base/ranges/algorithm.h"
#include "base/task/sequenced_task_runner.h"
#include "base/time/clock.h"
#include "base/time/default_clock.h"
#include "base/time/default_tick_clock.h"
#include "base/time/tick_clock.h"
#include "base/time/time.h"
#include "build/build_config.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/buildflags.h"
#include "chrome/browser/enterprise/browser_management/management_service_factory.h"
#include "chrome/browser/google/google_brand.h"
#include "chrome/browser/obsolete_system/obsolete_system.h"
#include "chrome/browser/upgrade_detector/build_state.h"
#include "chrome/browser/upgrade_detector/get_installed_version.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/pref_names.h"
#include "components/network_time/network_time_tracker.h"
#include "components/prefs/pref_service.h"
#include "components/version_info/version_info.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"

#if BUILDFLAG(IS_WIN)
#include "chrome/installer/util/google_update_settings.h"
#endif

namespace {

// The default thresholds for reaching annoyance levels.
constexpr auto kDefaultVeryLowThreshold =;
constexpr auto kDefaultLowThreshold =;
constexpr auto kDefaultElevatedThreshold =;
constexpr auto kDefaultHighThreshold =;
constexpr auto kDefaultGraceThreshold =;

// How long to wait (each cycle) before checking which severity level we should
// be at. Once we reach the highest severity, the timer will stop.
constexpr auto kNotifyCycleTime =;

// Same as kNotifyCycleTimeMs but only used during testing.
constexpr auto kNotifyCycleTimeForTesting =;

// How often to check to see if the build has become outdated.
constexpr auto kOutdatedBuildDetectorPeriod =;

// The number of days after which we identify a build/install as outdated.
constexpr auto kOutdatedBuildAge =;

bool ShouldDetectOutdatedBuilds() {}

// Check if one of the outdated simulation switches was present on the command
// line.
bool SimulatingOutdated() {}

// Check if any of the testing switches was present on the command line.
bool IsTesting() {}

}  // namespace

UpgradeDetectorImpl::UpgradeDetectorImpl(const base::Clock* clock,
                                         const base::TickClock* tick_clock)
    :{}

UpgradeDetectorImpl::~UpgradeDetectorImpl() {}

void UpgradeDetectorImpl::StartUpgradeNotificationTimer() {}

void UpgradeDetectorImpl::CalculateThresholds() {}

void UpgradeDetectorImpl::DoCalculateThresholds() {}

void UpgradeDetectorImpl::StartOutdatedBuildDetector() {}

void UpgradeDetectorImpl::DetectOutdatedInstall() {}

void UpgradeDetectorImpl::UpgradeDetected(UpgradeAvailable upgrade_available) {}

void UpgradeDetectorImpl::OnExperimentChangesDetected(Severity severity) {}

void UpgradeDetectorImpl::NotifyOnUpgradeWithTimePassed(
    base::TimeDelta time_passed) {}

base::TimeDelta UpgradeDetectorImpl::GetThresholdForLevel(
    UpgradeNotificationAnnoyanceLevel level) {}

// static
UpgradeDetectorImpl::LevelIndex
UpgradeDetectorImpl::AnnoyanceLevelToStagesIndex(
    UpgradeNotificationAnnoyanceLevel level) {}

// static
UpgradeDetector::UpgradeNotificationAnnoyanceLevel
UpgradeDetectorImpl::StageIndexToAnnoyanceLevel(size_t index) {}

void UpgradeDetectorImpl::OnMonitoredPrefsChanged() {}

void UpgradeDetectorImpl::NotifyOnUpgrade() {}

// static
UpgradeDetectorImpl* UpgradeDetectorImpl::GetInstance() {}

void UpgradeDetectorImpl::Init() {}

void UpgradeDetectorImpl::Shutdown() {}

base::Time UpgradeDetectorImpl::GetAnnoyanceLevelDeadline(
    UpgradeNotificationAnnoyanceLevel level) {}

void UpgradeDetectorImpl::OnUpdate(const BuildState* build_state) {}

// static
UpgradeDetector* UpgradeDetector::GetInstance() {}

// static
base::TimeDelta UpgradeDetector::GetDefaultHighAnnoyanceThreshold() {}

// static
base::TimeDelta UpgradeDetector::GetDefaultElevatedAnnoyanceThreshold() {}

// static
UpgradeDetector::RelaunchWindow UpgradeDetector::GetDefaultRelaunchWindow() {}