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

Unified Diff: ash/system/night_light/tray_night_light.cc

Issue 2857103007: [Night Light] CL2: Ash and system tray work (Closed)
Patch Set: Update comment Created 3 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/system/night_light/tray_night_light.h ('k') | ash/system/night_light/tray_night_light_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « ash/system/night_light/tray_night_light.h ('k') | ash/system/night_light/tray_night_light_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698