#include "base/power_monitor/battery_state_sampler.h"
#include "base/power_monitor/power_monitor_buildflags.h"
#if !BUILDFLAG(IS_MAC)
#include "base/power_monitor/timer_sampling_event_source.h"
#endif
namespace base {
namespace {
BatteryStateSampler* g_battery_state_sampler = …;
bool g_test_instance_installed = …;
}
BatteryStateSampler::BatteryStateSampler(
std::unique_ptr<SamplingEventSource> sampling_event_source,
std::unique_ptr<BatteryLevelProvider> battery_level_provider)
: … { … }
BatteryStateSampler::~BatteryStateSampler() { … }
BatteryStateSampler* BatteryStateSampler::Get() { … }
void BatteryStateSampler::AddObserver(Observer* observer) { … }
void BatteryStateSampler::RemoveObserver(Observer* observer) { … }
void BatteryStateSampler::Shutdown() { … }
std::unique_ptr<base::BatteryStateSampler>
BatteryStateSampler::CreateInstanceForTesting(
std::unique_ptr<SamplingEventSource> sampling_event_source,
std::unique_ptr<BatteryLevelProvider> battery_level_provider) { … }
bool BatteryStateSampler::HasTestingInstance() { … }
#if !BUILDFLAG(IS_MAC)
std::unique_ptr<SamplingEventSource>
BatteryStateSampler::CreateSamplingEventSource() { … }
#endif
void BatteryStateSampler::OnInitialBatteryStateSampled(
const std::optional<BatteryLevelProvider::BatteryState>& battery_state) { … }
void BatteryStateSampler::OnSamplingEvent() { … }
void BatteryStateSampler::OnBatteryStateSampled(
const std::optional<BatteryLevelProvider::BatteryState>& battery_state) { … }
}