Commit 2cb7a9d3 authored by minch's avatar minch Committed by Commit Bot

dark_mode: Remove TrayBackgroundView::UpdateAfterColorModeChange.

StatusAreaWidget::UpdateAfterColorModeChange looks not color mode
related, but session state related. Make it call UpdateBackground()
directly.

Bug: 1131543
Change-Id: I858e5a3bd64cc735d547dc7fec1554f011885916
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2508169Reviewed-by: default avatarAhmed Fakhry <afakhry@chromium.org>
Commit-Queue: Min Chen <minch@chromium.org>
Cr-Commit-Position: refs/heads/master@{#822836}
parent 47d6b3c2
......@@ -187,7 +187,8 @@ void StatusAreaWidget::SetSystemTrayVisibility(bool visible) {
void StatusAreaWidget::OnSessionStateChanged(
session_manager::SessionState state) {
UpdateAfterColorModeChange();
for (TrayBackgroundView* tray_button : tray_buttons_)
tray_button->UpdateBackground();
}
void StatusAreaWidget::UpdateCollapseState() {
......@@ -553,11 +554,6 @@ void StatusAreaWidget::OnScrollEvent(ui::ScrollEvent* event) {
views::Widget::OnScrollEvent(event);
}
void StatusAreaWidget::UpdateAfterColorModeChange() {
for (TrayBackgroundView* tray_button : tray_buttons_)
tray_button->UpdateAfterColorModeChange();
}
void StatusAreaWidget::AddTrayButton(TrayBackgroundView* tray_button) {
status_area_widget_delegate_->AddChildView(tray_button);
tray_buttons_.push_back(tray_button);
......
......@@ -208,9 +208,6 @@ class ASH_EXPORT StatusAreaWidget : public SessionObserver,
// Adds a new tray button to the status area.
void AddTrayButton(TrayBackgroundView* tray_button);
// Update the colors used for the tray buttons.
void UpdateAfterColorModeChange();
// Called when in the collapsed state to calculate and update the visibility
// of each tray button.
void CalculateButtonVisibilityForCollapsedState();
......
......@@ -371,13 +371,19 @@ void TrayBackgroundView::UpdateAfterStatusAreaCollapseChange() {
views::View::SetVisible(GetEffectiveVisibility());
}
void TrayBackgroundView::UpdateAfterColorModeChange() {
UpdateBackground();
SchedulePaint();
}
void TrayBackgroundView::BubbleResized(const TrayBubbleView* bubble_view) {}
void TrayBackgroundView::UpdateBackground() {
const int radius = ShelfConfig::Get()->control_border_radius();
gfx::RoundedCornersF rounded_corners = {radius, radius, radius, radius};
layer()->SetRoundedCornerRadius(rounded_corners);
layer()->SetIsFastRoundedCorner(true);
layer()->SetBackgroundBlur(
ShelfConfig::Get()->GetShelfControlButtonBlurRadius());
layer()->SetColor(ShelfConfig::Get()->GetShelfControlButtonColor());
layer()->SetClipRect(GetBackgroundBounds());
}
void TrayBackgroundView::OnImplicitAnimationsCompleted() {
// If there is another animation in the queue, the reverse animation was
// triggered before the completion of animating to invisible. Do not turn off
......@@ -498,17 +504,6 @@ gfx::Insets TrayBackgroundView::GetBackgroundInsets() const {
return insets;
}
void TrayBackgroundView::UpdateBackground() {
const int radius = ShelfConfig::Get()->control_border_radius();
gfx::RoundedCornersF rounded_corners = {radius, radius, radius, radius};
layer()->SetRoundedCornerRadius(rounded_corners);
layer()->SetIsFastRoundedCorner(true);
layer()->SetBackgroundBlur(
ShelfConfig::Get()->GetShelfControlButtonBlurRadius());
layer()->SetColor(ShelfConfig::Get()->GetShelfControlButtonColor());
layer()->SetClipRect(GetBackgroundBounds());
}
bool TrayBackgroundView::GetEffectiveVisibility() {
// When the virtual keyboard is visible, the effective visibility of the view
// is solely determined by |show_with_virtual_keyboard_|.
......
......@@ -76,9 +76,6 @@ class ASH_EXPORT TrayBackgroundView : public ActionableView,
// Called whenever the status area's collapse state changes.
virtual void UpdateAfterStatusAreaCollapseChange();
// Called whenever the system color mode changes.
virtual void UpdateAfterColorModeChange();
// Called when the anchor (tray or bubble) may have moved or changed.
virtual void AnchorUpdated() {}
......@@ -101,6 +98,9 @@ class ASH_EXPORT TrayBackgroundView : public ActionableView,
// May close the bubble.
virtual void ClickedOutsideBubble() = 0;
// Updates the background layer.
virtual void UpdateBackground();
void SetIsActive(bool is_active);
bool is_active() const { return is_active_; }
......@@ -175,9 +175,6 @@ class ASH_EXPORT TrayBackgroundView : public ActionableView,
// Helper function that calculates background insets relative to local bounds.
gfx::Insets GetBackgroundInsets() const;
// Updates the background layer.
virtual void UpdateBackground();
// Returns the effective visibility of the tray item based on the current
// state.
bool GetEffectiveVisibility();
......
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