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

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

Issue 2857103007: [Night Light] CL2: Ash and system tray work (Closed)
Patch Set: Exclude one test from mash 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
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

Powered by Google App Engine
This is Rietveld 408576698