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

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

Issue 2921973002: Hide Night Light behind a flag (Closed)
Patch Set: James' comments Created 3 years, 6 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
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/ash_switches.h"
7 #include "ash/public/cpp/ash_pref_names.h" 8 #include "ash/public/cpp/ash_pref_names.h"
8 #include "ash/session/session_controller.h" 9 #include "ash/session/session_controller.h"
9 #include "ash/shell.h" 10 #include "ash/shell.h"
11 #include "base/command_line.h"
10 #include "base/time/time.h" 12 #include "base/time/time.h"
11 #include "components/prefs/pref_registry_simple.h" 13 #include "components/prefs/pref_registry_simple.h"
12 #include "components/prefs/pref_service.h" 14 #include "components/prefs/pref_service.h"
13 #include "ui/compositor/layer.h" 15 #include "ui/compositor/layer.h"
14 #include "ui/compositor/scoped_layer_animation_settings.h" 16 #include "ui/compositor/scoped_layer_animation_settings.h"
15 17
16 namespace ash { 18 namespace ash {
17 19
18 namespace { 20 namespace {
19 21
(...skipping 30 matching lines...) Expand all
50 SessionController* session_controller) 52 SessionController* session_controller)
51 : session_controller_(session_controller) { 53 : session_controller_(session_controller) {
52 session_controller_->AddObserver(this); 54 session_controller_->AddObserver(this);
53 } 55 }
54 56
55 NightLightController::~NightLightController() { 57 NightLightController::~NightLightController() {
56 session_controller_->RemoveObserver(this); 58 session_controller_->RemoveObserver(this);
57 } 59 }
58 60
59 // static 61 // static
62 bool NightLightController::IsFeatureEnabled() {
63 return base::CommandLine::ForCurrentProcess()->HasSwitch(
64 ash::switches::kAshEnableNightLight);
65 }
66
67 // static
60 void NightLightController::RegisterPrefs(PrefRegistrySimple* registry) { 68 void NightLightController::RegisterPrefs(PrefRegistrySimple* registry) {
61 registry->RegisterBooleanPref(prefs::kNightLightEnabled, false); 69 registry->RegisterBooleanPref(prefs::kNightLightEnabled, false);
62 registry->RegisterDoublePref(prefs::kNightLightTemperature, 70 registry->RegisterDoublePref(prefs::kNightLightTemperature,
63 kDefaultColorTemperature); 71 kDefaultColorTemperature);
64 } 72 }
65 73
66 void NightLightController::AddObserver(Observer* observer) { 74 void NightLightController::AddObserver(Observer* observer) {
67 observers_.AddObserver(observer); 75 observers_.AddObserver(observer);
68 } 76 }
69 77
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 Refresh(); 162 Refresh();
155 NotifyStatusChanged(); 163 NotifyStatusChanged();
156 } 164 }
157 165
158 void NightLightController::OnColorTemperaturePrefChanged() { 166 void NightLightController::OnColorTemperaturePrefChanged() {
159 DCHECK(active_user_pref_service_); 167 DCHECK(active_user_pref_service_);
160 Refresh(); 168 Refresh();
161 } 169 }
162 170
163 } // namespace ash 171 } // namespace ash
OLDNEW
« no previous file with comments | « ash/system/night_light/night_light_controller.h ('k') | ash/system/night_light/night_light_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698