Commit 72c4610f authored by minch's avatar minch Committed by Commit Bot

dark_mode: Live updae the time view and logout button in status area.

Bug: 1131543
Change-Id: Ib6f4f7ddf5efec27ad42bba135ee0e9478bf2147
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2542043Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Commit-Queue: Min Chen <minch@chromium.org>
Cr-Commit-Position: refs/heads/master@{#827906}
parent 91d8aed4
...@@ -35,15 +35,12 @@ LogoutButtonTray::LogoutButtonTray(Shelf* shelf) : TrayBackgroundView(shelf) { ...@@ -35,15 +35,12 @@ LogoutButtonTray::LogoutButtonTray(Shelf* shelf) : TrayBackgroundView(shelf) {
DCHECK(shelf); DCHECK(shelf);
Shell::Get()->session_controller()->AddObserver(this); Shell::Get()->session_controller()->AddObserver(this);
auto button = std::make_unique<views::MdTextButton>( button_ =
base::BindRepeating(&LogoutButtonTray::ButtonPressed, tray_container()->AddChildView(std::make_unique<views::MdTextButton>(
base::Unretained(this)), base::BindRepeating(&LogoutButtonTray::ButtonPressed,
base::string16(), CONTEXT_LAUNCHER_BUTTON); base::Unretained(this)),
button->SetProminent(true); base::string16(), CONTEXT_LAUNCHER_BUTTON));
button->SetBgColorOverride(AshColorProvider::Get()->GetControlsLayerColor( button_->SetProminent(true);
AshColorProvider::ControlsLayerType::kControlBackgroundColorAlert));
button_ = tray_container()->AddChildView(std::move(button));
} }
LogoutButtonTray::~LogoutButtonTray() { LogoutButtonTray::~LogoutButtonTray() {
...@@ -89,6 +86,12 @@ const char* LogoutButtonTray::GetClassName() const { ...@@ -89,6 +86,12 @@ const char* LogoutButtonTray::GetClassName() const {
return "LogoutButtonTray"; return "LogoutButtonTray";
} }
void LogoutButtonTray::OnThemeChanged() {
TrayBackgroundView::OnThemeChanged();
button_->SetBgColorOverride(AshColorProvider::Get()->GetControlsLayerColor(
AshColorProvider::ControlsLayerType::kControlBackgroundColorAlert));
}
void LogoutButtonTray::UpdateShowLogoutButtonInTray() { void LogoutButtonTray::UpdateShowLogoutButtonInTray() {
show_logout_button_in_tray_ = pref_change_registrar_->prefs()->GetBoolean( show_logout_button_in_tray_ = pref_change_registrar_->prefs()->GetBoolean(
prefs::kShowLogoutButtonInTray); prefs::kShowLogoutButtonInTray);
......
...@@ -44,6 +44,7 @@ class ASH_EXPORT LogoutButtonTray : public TrayBackgroundView, ...@@ -44,6 +44,7 @@ class ASH_EXPORT LogoutButtonTray : public TrayBackgroundView,
base::string16 GetAccessibleNameForTray() override; base::string16 GetAccessibleNameForTray() override;
void HandleLocaleChange() override; void HandleLocaleChange() override;
const char* GetClassName() const override; const char* GetClassName() const override;
void OnThemeChanged() override;
// SessionObserver: // SessionObserver:
void OnActiveUserPrefServiceChanged(PrefService* prefs) override; void OnActiveUserPrefServiceChanged(PrefService* prefs) override;
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
#include "ash/system/time/time_tray_item_view.h" #include "ash/system/time/time_tray_item_view.h"
#include "ash/session/session_controller_impl.h"
#include "ash/shelf/shelf.h" #include "ash/shelf/shelf.h"
#include "ash/shell.h" #include "ash/shell.h"
#include "ash/system/model/clock_model.h" #include "ash/system/model/clock_model.h"
...@@ -47,5 +48,11 @@ const char* TimeTrayItemView::GetClassName() const { ...@@ -47,5 +48,11 @@ const char* TimeTrayItemView::GetClassName() const {
return "TimeTrayItemView"; return "TimeTrayItemView";
} }
void TimeTrayItemView::OnThemeChanged() {
TrayItemView::OnThemeChanged();
time_view_->SetTextColor(
TrayIconColor(Shell::Get()->session_controller()->GetSessionState()));
}
} // namespace tray } // namespace tray
} // namespace ash } // namespace ash
...@@ -33,6 +33,7 @@ class TimeTrayItemView : public TrayItemView, public SessionObserver { ...@@ -33,6 +33,7 @@ class TimeTrayItemView : public TrayItemView, public SessionObserver {
// views::View: // views::View:
const char* GetClassName() const override; const char* GetClassName() const override;
void OnThemeChanged() override;
private: private:
TimeView* time_view_ = nullptr; TimeView* time_view_ = nullptr;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment