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

Unified Diff: ash/system/tiles/tiles_default_view.cc

Issue 2857103007: [Night Light] CL2: Ash and system tray work (Closed)
Patch Set: James' comments 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/tiles/tiles_default_view.cc
diff --git a/ash/system/tiles/tiles_default_view.cc b/ash/system/tiles/tiles_default_view.cc
index d5c51a7eef4766fc5a4b277e7cd11d70a17242b1..9c8c725984b40680ff133b7248c16a3dfeb2a2d6 100644
--- a/ash/system/tiles/tiles_default_view.cc
+++ b/ash/system/tiles/tiles_default_view.cc
@@ -11,6 +11,7 @@
#include "ash/shell_port.h"
#include "ash/shutdown_controller.h"
#include "ash/strings/grit/ash_strings.h"
+#include "ash/system/night_light/night_light_controller.h"
#include "ash/system/tray/system_menu_button.h"
#include "ash/system/tray/system_tray.h"
#include "ash/system/tray/system_tray_controller.h"
@@ -41,6 +42,7 @@ TilesDefaultView::TilesDefaultView(SystemTrayItem* owner)
: owner_(owner),
settings_button_(nullptr),
help_button_(nullptr),
+ night_light_button_(nullptr),
lock_button_(nullptr),
power_button_(nullptr) {
DCHECK(owner_);
@@ -85,6 +87,16 @@ void TilesDefaultView::Init() {
AddChildView(help_button_);
AddChildView(TrayPopupUtils::CreateVerticalSeparator());
+ night_light_button_ =
+ new SystemMenuButton(this, TrayPopupInkDropStyle::HOST_CENTERED,
+ Shell::Get()->night_light_controller()->enabled()
+ ? kSystemMenuNightLightOnIcon
+ : kSystemMenuNightLightOffIcon,
+ IDS_ASH_STATUS_TRAY_NIGHT_LIGHT);
+ night_light_button_->SetEnabled(!disable_buttons);
+ AddChildView(night_light_button_);
+ AddChildView(TrayPopupUtils::CreateVerticalSeparator());
+
lock_button_ =
new SystemMenuButton(this, TrayPopupInkDropStyle::HOST_CENTERED,
kSystemMenuLockIcon, IDS_ASH_STATUS_TRAY_LOCK);
@@ -114,6 +126,9 @@ void TilesDefaultView::ButtonPressed(views::Button* sender,
} else if (sender == help_button_) {
ShellPort::Get()->RecordUserMetricsAction(UMA_TRAY_HELP);
Shell::Get()->system_tray_controller()->ShowHelp();
+ } else if (sender == night_light_button_) {
+ ShellPort::Get()->RecordUserMetricsAction(UMA_TRAY_NIGHT_LIGHT);
+ Shell::Get()->night_light_controller()->Toggle();
} else if (sender == lock_button_) {
ShellPort::Get()->RecordUserMetricsAction(UMA_TRAY_LOCK_SCREEN);
chromeos::DBusThreadManager::Get()

Powered by Google App Engine
This is Rietveld 408576698