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..40a691f79298a58104db9829e06454504d23912c 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, |
+ ash::Shell::Get()->night_light_controller()->enabled() |
James Cook
2017/05/05 17:12:32
nit: no ash::
afakhry
2017/05/05 20:04:12
Done.
|
+ ? kSystemMenuNightLightOnIcon |
+ : kSystemMenuNightLightOffIcon, |
+ IDS_ASH_STATUS_TRAY_NIGHT_LIGHT); |
+ night_light_button_->SetEnabled(!disable_buttons); |
James Cook
2017/05/05 17:12:32
Is this button going to be a toggle, or will it op
afakhry
2017/05/05 20:04:12
It's a toggle button, but this |disable_buttons| i
James Cook
2017/05/05 20:47:43
|disable_buttons| currently means "I can show webu
afakhry
2017/05/06 00:49:34
According to this comment: https://cs.chromium.org
|
+ AddChildView(night_light_button_); |
+ AddChildView(TrayPopupUtils::CreateVerticalSeparator()); |
James Cook
2017/05/05 17:12:32
Please add a test that the night light icon is cre
afakhry
2017/05/05 20:04:12
Done. I updated TrayTilesTest.
|
+ |
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() |