blob: 1693cd72d5e4ad8f020ee37fd7d99cf4555b1b22 [file] [log] [blame]
Avi Drissman3a215d1e2022-09-07 19:43:091// Copyright 2022 The Chromium Authors
Drew Davenportefec3222022-07-18 22:31:422// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef ASH_DISPLAY_REFRESH_RATE_THROTTLE_CONTROLLER_H_
6#define ASH_DISPLAY_REFRESH_RATE_THROTTLE_CONTROLLER_H_
7
8#include "ash/ash_export.h"
9#include "ash/system/power/power_status.h"
Arthur Sonzogni834e018f2023-04-22 10:20:0210#include "base/memory/raw_ptr.h"
Drew Davenportefec3222022-07-18 22:31:4211#include "base/scoped_observation.h"
12#include "ui/display/manager/display_configurator.h"
13
14namespace ash {
15
16// Watches device power state and requests the refresh rate to be throttled
17// when in a low power state.
18class ASH_EXPORT RefreshRateThrottleController : public PowerStatus::Observer {
19 public:
20 RefreshRateThrottleController(
21 display::DisplayConfigurator* display_configurator,
22 PowerStatus* power_status);
23
24 RefreshRateThrottleController(const RefreshRateThrottleController&) = delete;
25 RefreshRateThrottleController& operator=(
26 const RefreshRateThrottleController&) = delete;
27 ~RefreshRateThrottleController() override;
28
29 // PowerStatus::Observer:
30 void OnPowerStatusChanged() override;
31
32 private:
33 base::ScopedObservation<ash::PowerStatus, ash::PowerStatus::Observer>
34 power_status_observer_;
35
36 // Not owned.
Arthur Sonzogni834e018f2023-04-22 10:20:0237 const raw_ptr<display::DisplayConfigurator, ExperimentalAsh>
38 display_configurator_;
39 const raw_ptr<PowerStatus, ExperimentalAsh> power_status_;
Drew Davenportefec3222022-07-18 22:31:4240};
41
42} // namespace ash
43
44#endif // ASH_DISPLAY_REFRESH_RATE_THROTTLE_CONTROLLER_H_