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 Shell::Get()->night_light_controller()->AddObserver(this); |
| 16 } |
| 17 |
| 18 TrayNightLight::~TrayNightLight() { |
| 19 Shell::Get()->night_light_controller()->RemoveObserver(this); |
| 20 } |
| 21 |
| 22 void TrayNightLight::OnNightLightEnabledChanged(bool enabled) { |
| 23 if (tray_view()) |
| 24 tray_view()->SetVisible(enabled); |
| 25 } |
| 26 |
| 27 bool TrayNightLight::GetInitialVisibility() { |
| 28 return Shell::Get()->night_light_controller()->enabled(); |
| 29 } |
| 30 |
| 31 } // namespace ash |
OLD | NEW |