Chromium Code Reviews| Index: ash/system/night_light/tray_night_light.cc |
| diff --git a/ash/system/night_light/tray_night_light.cc b/ash/system/night_light/tray_night_light.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..d1ad6af955703e308bec0518e193dd7352269b27 |
| --- /dev/null |
| +++ b/ash/system/night_light/tray_night_light.cc |
| @@ -0,0 +1,31 @@ |
| +// Copyright 2017 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "ash/system/night_light/tray_night_light.h" |
| + |
| +#include "ash/resources/vector_icons/vector_icons.h" |
| +#include "ash/shell.h" |
| +#include "ui/views/view.h" |
| + |
| +namespace ash { |
| + |
| +TrayNightLight::TrayNightLight(SystemTray* system_tray) |
| + : TrayImageItem(system_tray, kSystemTrayNightLightIcon, UMA_NIGHT_LIGHT) { |
| + 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.
|
| +} |
| + |
| +TrayNightLight::~TrayNightLight() { |
| + ash::Shell::Get()->night_light_controller()->RemoveObserver(this); |
| +} |
| + |
| +void TrayNightLight::OnStatusChanged(bool new_status) { |
| + if (tray_view()) |
| + tray_view()->SetVisible(new_status); |
| +} |
| + |
| +bool TrayNightLight::GetInitialVisibility() { |
| + return ash::Shell::Get()->night_light_controller()->enabled(); |
| +} |
|
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
|
| + |
| +} // namespace ash |