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..bbd64b3a0a19ba81651372f1752a6b6c8e109295 |
--- /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) { |
+ Shell::Get()->night_light_controller()->AddObserver(this); |
+} |
+ |
+TrayNightLight::~TrayNightLight() { |
+ Shell::Get()->night_light_controller()->RemoveObserver(this); |
+} |
+ |
+void TrayNightLight::OnNightLightEnabledChanged(bool enabled) { |
+ if (tray_view()) |
+ tray_view()->SetVisible(enabled); |
+} |
+ |
+bool TrayNightLight::GetInitialVisibility() { |
+ return Shell::Get()->night_light_controller()->enabled(); |
+} |
+ |
+} // namespace ash |