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) {
DCHECK(shelf);
Shell::Get()->session_controller()->AddObserver(this);
auto button = std::make_unique<views::MdTextButton>(
button_ =
tray_container()->AddChildView(std::make_unique<views::MdTextButton>(
base::BindRepeating(&LogoutButtonTray::ButtonPressed,
base::Unretained(this)),
base::string16(), CONTEXT_LAUNCHER_BUTTON);
button->SetProminent(true);
button->SetBgColorOverride(AshColorProvider::Get()->GetControlsLayerColor(
AshColorProvider::ControlsLayerType::kControlBackgroundColorAlert));
button_ = tray_container()->AddChildView(std::move(button));
base::string16(), CONTEXT_LAUNCHER_BUTTON));
button_->SetProminent(true);
}
LogoutButtonTray::~LogoutButtonTray() {
......@@ -89,6 +86,12 @@ const char* LogoutButtonTray::GetClassName() const {
return "LogoutButtonTray";
}
void LogoutButtonTray::OnThemeChanged() {
TrayBackgroundView::OnThemeChanged();
button_->SetBgColorOverride(AshColorProvider::Get()->GetControlsLayerColor(
AshColorProvider::ControlsLayerType::kControlBackgroundColorAlert));
}
void LogoutButtonTray::UpdateShowLogoutButtonInTray() {
show_logout_button_in_tray_ = pref_change_registrar_->prefs()->GetBoolean(
prefs::kShowLogoutButtonInTray);
......
......@@ -44,6 +44,7 @@ class ASH_EXPORT LogoutButtonTray : public TrayBackgroundView,
base::string16 GetAccessibleNameForTray() override;
void HandleLocaleChange() override;
const char* GetClassName() const override;
void OnThemeChanged() override;
// SessionObserver:
void OnActiveUserPrefServiceChanged(PrefService* prefs) override;
......
......@@ -4,6 +4,7 @@
#include "ash/system/time/time_tray_item_view.h"
#include "ash/session/session_controller_impl.h"
#include "ash/shelf/shelf.h"
#include "ash/shell.h"
#include "ash/system/model/clock_model.h"
......@@ -47,5 +48,11 @@ const char* TimeTrayItemView::GetClassName() const {
return "TimeTrayItemView";
}
void TimeTrayItemView::OnThemeChanged() {
TrayItemView::OnThemeChanged();
time_view_->SetTextColor(
TrayIconColor(Shell::Get()->session_controller()->GetSessionState()));
}
} // namespace tray
} // namespace ash
......@@ -33,6 +33,7 @@ class TimeTrayItemView : public TrayItemView, public SessionObserver {
// views::View:
const char* GetClassName() const override;
void OnThemeChanged() override;
private:
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