1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29
   30
   31
   32
   33
   34
   35
   36
   37
   38
   39
   40
   41
   42
   43
   44
   45
   46
   47
   48
   49
   50
   51
   52
   53
   54
   55
   56
   57
   58
   59
   60
   61
   62
   63
   64
   65
   66

ash / system / model / fake_power_status.cc [blame]

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

#include "ash/system/model/fake_power_status.h"

namespace ash {

FakePowerStatus::FakePowerStatus() = default;

FakePowerStatus::~FakePowerStatus() = default;

void FakePowerStatus::SetBatteryPercent(double percent) {
  battery_percent_ = percent;
  RequestStatusUpdate();
}

void FakePowerStatus::SetIsBatteryPresent(bool present) {
  is_battery_present_ = present;
  RequestStatusUpdate();
}

void FakePowerStatus::SetIsBatterySaverActive(bool active) {
  is_battery_saver_active_ = active;
  RequestStatusUpdate();
}

void FakePowerStatus::SetIsLinePowerConnected(bool connected) {
  is_line_power_connected_ = connected;
  RequestStatusUpdate();
}

void FakePowerStatus::SetIsUsbChargerConnected(bool connected) {
  is_usb_charger_connected_ = connected;
  RequestStatusUpdate();
}

void FakePowerStatus::SetDefaultState() {
  is_battery_present_ = true;
  is_battery_saver_active_ = false;
  is_line_power_connected_ = false;
  is_usb_charger_connected_ = false;
  RequestStatusUpdate();
}

double FakePowerStatus::GetBatteryPercent() const {
  return battery_percent_;
}

bool FakePowerStatus::IsBatteryPresent() const {
  return is_battery_present_;
}

bool FakePowerStatus::IsBatterySaverActive() const {
  return is_battery_saver_active_;
}

bool FakePowerStatus::IsLinePowerConnected() const {
  return is_line_power_connected_;
}

bool FakePowerStatus::IsUsbChargerConnected() const {
  return is_usb_charger_connected_;
}

}  // namespace ash