#include "base/power_monitor/power_monitor.h"
#include <utility>
#include "base/logging.h"
#include "base/no_destructor.h"
#include "base/power_monitor/power_monitor_source.h"
#include "base/trace_event/base_tracing.h"
#include "build/build_config.h"
namespace base {
void PowerMonitor::Initialize(std::unique_ptr<PowerMonitorSource> source) { … }
bool PowerMonitor::IsInitialized() { … }
void PowerMonitor::AddPowerSuspendObserver(PowerSuspendObserver* obs) { … }
void PowerMonitor::RemovePowerSuspendObserver(PowerSuspendObserver* obs) { … }
void PowerMonitor::AddPowerStateObserver(PowerStateObserver* obs) { … }
void PowerMonitor::RemovePowerStateObserver(PowerStateObserver* obs) { … }
void PowerMonitor::AddPowerThermalObserver(PowerThermalObserver* obs) { … }
void PowerMonitor::RemovePowerThermalObserver(PowerThermalObserver* obs) { … }
bool PowerMonitor::AddPowerSuspendObserverAndReturnSuspendedState(
PowerSuspendObserver* obs) { … }
bool PowerMonitor::AddPowerStateObserverAndReturnOnBatteryState(
PowerStateObserver* obs) { … }
PowerStateObserver::BatteryPowerStatus
PowerMonitor::AddPowerStateObserverAndReturnBatteryPowerStatus(
PowerStateObserver* obs) { … }
PowerThermalObserver::DeviceThermalState
PowerMonitor::AddPowerStateObserverAndReturnPowerThermalState(
PowerThermalObserver* obs) { … }
PowerMonitorSource* PowerMonitor::Source() { … }
bool PowerMonitor::IsOnBatteryPower() { … }
PowerStateObserver::BatteryPowerStatus PowerMonitor::GetBatteryPowerStatus() { … }
TimeTicks PowerMonitor::GetLastSystemResumeTime() { … }
void PowerMonitor::ShutdownForTesting() { … }
PowerThermalObserver::DeviceThermalState
PowerMonitor::GetCurrentThermalState() { … }
void PowerMonitor::SetCurrentThermalState(
PowerThermalObserver::DeviceThermalState state) { … }
#if BUILDFLAG(IS_ANDROID)
int PowerMonitor::GetRemainingBatteryCapacity() {
DCHECK(IsInitialized());
return PowerMonitor::Source()->GetRemainingBatteryCapacity();
}
#endif
void PowerMonitor::NotifyPowerStateChange(bool on_battery_power) { … }
void PowerMonitor::NotifyPowerStateChange(
PowerStateObserver::BatteryPowerStatus battery_power_status) { … }
void PowerMonitor::NotifySuspend() { … }
void PowerMonitor::NotifyResume() { … }
void PowerMonitor::NotifyThermalStateChange(
PowerThermalObserver::DeviceThermalState new_state) { … }
void PowerMonitor::NotifySpeedLimitChange(int speed_limit) { … }
PowerMonitor* PowerMonitor::GetInstance() { … }
PowerMonitor::PowerMonitor()
: … { … }
PowerMonitor::~PowerMonitor() = default;
}