Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "ash/system/night_light/tray_night_light.h" | |
| 6 | |
| 7 #include "ash/resources/vector_icons/vector_icons.h" | |
| 8 #include "ash/shell.h" | |
| 9 #include "ui/views/view.h" | |
| 10 | |
| 11 namespace ash { | |
| 12 | |
| 13 TrayNightLight::TrayNightLight(SystemTray* system_tray) | |
| 14 : TrayImageItem(system_tray, kSystemTrayNightLightIcon, UMA_NIGHT_LIGHT) { | |
| 15 ash::Shell::Get()->night_light_controller()->AddObserver(this); | |
|
James Cook
2017/05/05 17:12:32
nit: no ash::
afakhry
2017/05/05 20:04:11
Done.
| |
| 16 } | |
| 17 | |
| 18 TrayNightLight::~TrayNightLight() { | |
| 19 ash::Shell::Get()->night_light_controller()->RemoveObserver(this); | |
| 20 } | |
| 21 | |
| 22 void TrayNightLight::OnStatusChanged(bool new_status) { | |
| 23 if (tray_view()) | |
| 24 tray_view()->SetVisible(new_status); | |
| 25 } | |
| 26 | |
| 27 bool TrayNightLight::GetInitialVisibility() { | |
| 28 return ash::Shell::Get()->night_light_controller()->enabled(); | |
| 29 } | |
|
James Cook
2017/05/05 17:12:32
optional: This class is very light weight, so I'm
afakhry
2017/05/05 20:04:11
Thanks for the pointers.
I added a test. Please t
| |
| 30 | |
| 31 } // namespace ash | |
| OLD | NEW |