Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(31)

Side by Side Diff: ash/system/night_light/night_light_controller.cc

Issue 2905923002: Enable software compositing while Night Light is on (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "ash/system/night_light/night_light_controller.h" 5 #include "ash/system/night_light/night_light_controller.h"
6 6
7 #include "ash/public/cpp/ash_pref_names.h" 7 #include "ash/public/cpp/ash_pref_names.h"
8 #include "ash/session/session_controller.h" 8 #include "ash/session/session_controller.h"
9 #include "ash/shell.h" 9 #include "ash/shell.h"
10 #include "base/time/time.h" 10 #include "base/time/time.h"
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 active_user_pref_service_ = Shell::Get()->GetActiveUserPrefService(); 108 active_user_pref_service_ = Shell::Get()->GetActiveUserPrefService();
109 InitFromUserPrefs(); 109 InitFromUserPrefs();
110 } 110 }
111 111
112 void NightLightController::Refresh() { 112 void NightLightController::Refresh() {
113 // TODO(afakhry): Add here refreshing of start and end times, when you 113 // TODO(afakhry): Add here refreshing of start and end times, when you
114 // implement the automatic schedule settings. 114 // implement the automatic schedule settings.
115 ApplyColorTemperatureToLayers( 115 ApplyColorTemperatureToLayers(
116 GetEnabled() ? GetColorTemperature() : 0.0f, 116 GetEnabled() ? GetColorTemperature() : 0.0f,
117 base::TimeDelta::FromSeconds(kManualToggleAnimationDurationSec)); 117 base::TimeDelta::FromSeconds(kManualToggleAnimationDurationSec));
118 Shell::Get()->SetCursorCompositingEnabled(GetEnabled());
118 } 119 }
119 120
120 void NightLightController::StartWatchingPrefsChanges() { 121 void NightLightController::StartWatchingPrefsChanges() {
121 DCHECK(active_user_pref_service_); 122 DCHECK(active_user_pref_service_);
122 123
123 pref_change_registrar_ = base::MakeUnique<PrefChangeRegistrar>(); 124 pref_change_registrar_ = base::MakeUnique<PrefChangeRegistrar>();
124 pref_change_registrar_->Init(active_user_pref_service_); 125 pref_change_registrar_->Init(active_user_pref_service_);
125 pref_change_registrar_->Add( 126 pref_change_registrar_->Add(
126 prefs::kNightLightEnabled, 127 prefs::kNightLightEnabled,
127 base::Bind(&NightLightController::OnEnabledPrefChanged, 128 base::Bind(&NightLightController::OnEnabledPrefChanged,
(...skipping 25 matching lines...) Expand all
153 Refresh(); 154 Refresh();
154 NotifyStatusChanged(); 155 NotifyStatusChanged();
155 } 156 }
156 157
157 void NightLightController::OnColorTemperaturePrefChanged() { 158 void NightLightController::OnColorTemperaturePrefChanged() {
158 DCHECK(active_user_pref_service_); 159 DCHECK(active_user_pref_service_);
159 Refresh(); 160 Refresh();
160 } 161 }
161 162
162 } // namespace ash 163 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698