| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef ASH_SYSTEM_NIGHT_LIGHT_NIGHT_LIGHT_CONTROLLER_H_ | 5 #ifndef ASH_SYSTEM_NIGHT_LIGHT_NIGHT_LIGHT_CONTROLLER_H_ |
| 6 #define ASH_SYSTEM_NIGHT_LIGHT_NIGHT_LIGHT_CONTROLLER_H_ | 6 #define ASH_SYSTEM_NIGHT_LIGHT_NIGHT_LIGHT_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "ash/ash_export.h" | 10 #include "ash/ash_export.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 // Emitted when the NightLight status is changed. | 28 // Emitted when the NightLight status is changed. |
| 29 virtual void OnNightLightEnabledChanged(bool enabled) = 0; | 29 virtual void OnNightLightEnabledChanged(bool enabled) = 0; |
| 30 | 30 |
| 31 protected: | 31 protected: |
| 32 virtual ~Observer() {} | 32 virtual ~Observer() {} |
| 33 }; | 33 }; |
| 34 | 34 |
| 35 explicit NightLightController(SessionController* session_controller); | 35 explicit NightLightController(SessionController* session_controller); |
| 36 ~NightLightController() override; | 36 ~NightLightController() override; |
| 37 | 37 |
| 38 // Returns true if the NightLight feature is enabled in the flags. |
| 39 static bool IsFeatureEnabled(); |
| 40 |
| 41 // Enables the NightLight feature by adding its corresponding flag for unit |
| 42 // tests. |
| 43 static void EnableFeatureForTesting(); |
| 44 |
| 38 static void RegisterPrefs(PrefRegistrySimple* registry); | 45 static void RegisterPrefs(PrefRegistrySimple* registry); |
| 39 | 46 |
| 40 void AddObserver(Observer* observer); | 47 void AddObserver(Observer* observer); |
| 41 void RemoveObserver(Observer* observer); | 48 void RemoveObserver(Observer* observer); |
| 42 | 49 |
| 43 // Get the NightLight settings stored in the current active user prefs. | 50 // Get the NightLight settings stored in the current active user prefs. |
| 44 bool GetEnabled() const; | 51 bool GetEnabled() const; |
| 45 float GetColorTemperature() const; | 52 float GetColorTemperature() const; |
| 46 | 53 |
| 47 // Set the desired NightLight settings in the current active user prefs. | 54 // Set the desired NightLight settings in the current active user prefs. |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 std::unique_ptr<PrefChangeRegistrar> pref_change_registrar_; | 90 std::unique_ptr<PrefChangeRegistrar> pref_change_registrar_; |
| 84 | 91 |
| 85 base::ObserverList<Observer> observers_; | 92 base::ObserverList<Observer> observers_; |
| 86 | 93 |
| 87 DISALLOW_COPY_AND_ASSIGN(NightLightController); | 94 DISALLOW_COPY_AND_ASSIGN(NightLightController); |
| 88 }; | 95 }; |
| 89 | 96 |
| 90 } // namespace ash | 97 } // namespace ash |
| 91 | 98 |
| 92 #endif // ASH_SYSTEM_NIGHT_LIGHT_NIGHT_LIGHT_CONTROLLER_H_ | 99 #endif // ASH_SYSTEM_NIGHT_LIGHT_NIGHT_LIGHT_CONTROLLER_H_ |
| OLD | NEW |