Commit 9195b452 authored by Manu Cornet's avatar Manu Cornet Committed by Commit Bot

CrOS Status Area: No need to observe shelf config from delegate

Instead, call |UpdateLayout| from the widget itself.

Bug: 1050788
Change-Id: I42be9e98f56df6c04b3662a832050069b1b689c6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2053125Reviewed-by: default avatarMitsuru Oshima <oshima@chromium.org>
Commit-Queue: Manu Cornet <manucornet@chromium.org>
Cr-Commit-Position: refs/heads/master@{#741095}
parent 369d8230
......@@ -424,6 +424,7 @@ void StatusAreaWidget::OnShelfConfigUpdated() {
for (TrayBackgroundView* tray_button : tray_buttons_)
tray_button->UpdateAfterShelfChange();
UpdateCollapseState();
status_area_widget_delegate_->UpdateLayout();
}
void StatusAreaWidget::UpdateAfterColorModeChange() {
......
......@@ -84,8 +84,6 @@ StatusAreaWidgetDelegate::StatusAreaWidgetDelegate(Shelf* shelf)
DCHECK(shelf_);
set_owned_by_client(); // Deleted by DeleteDelegate().
ShelfConfig::Get()->AddObserver(this);
// Allow the launcher to surrender the focus to another window upon
// navigation completion by the user.
set_allow_deactivate_on_esc(true);
......@@ -93,9 +91,7 @@ StatusAreaWidgetDelegate::StatusAreaWidgetDelegate(Shelf* shelf)
layer()->SetFillsBoundsOpaquely(false);
}
StatusAreaWidgetDelegate::~StatusAreaWidgetDelegate() {
ShelfConfig::Get()->RemoveObserver(this);
}
StatusAreaWidgetDelegate::~StatusAreaWidgetDelegate() = default;
void StatusAreaWidgetDelegate::SetFocusCyclerForTesting(
const FocusCycler* focus_cycler) {
......@@ -173,10 +169,6 @@ void StatusAreaWidgetDelegate::DeleteDelegate() {
delete this;
}
void StatusAreaWidgetDelegate::OnShelfConfigUpdated() {
UpdateLayout();
}
void StatusAreaWidgetDelegate::UpdateLayout() {
// Use a grid layout so that the trays can be centered in each cell, and
// so that the widget gets laid out correctly when tray sizes change.
......
......@@ -20,8 +20,7 @@ class Shelf;
// The View for the status area widget.
class ASH_EXPORT StatusAreaWidgetDelegate : public views::AccessiblePaneView,
public views::WidgetDelegate,
public ShelfConfig::Observer {
public views::WidgetDelegate {
public:
explicit StatusAreaWidgetDelegate(Shelf* shelf);
~StatusAreaWidgetDelegate() override;
......@@ -54,9 +53,6 @@ class ASH_EXPORT StatusAreaWidgetDelegate : public views::AccessiblePaneView,
bool CanActivate() const override;
void DeleteDelegate() override;
// ShelfConfig::Observer:
void OnShelfConfigUpdated() override;
void set_default_last_focusable_child(bool default_last_focusable_child) {
default_last_focusable_child_ = default_last_focusable_child;
}
......
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