Commit 2fc2e963 authored by Manu Cornet's avatar Manu Cornet Committed by Commit Bot

CrOS Shelf: Allow setting 'animate' bool when laying out shelf

Consolidate |LayoutShelf| and |LayoutShelfAndUpdateBounds|.

Bug: 1035722, 1034725, 1033233, 1035717
Change-Id: I3ea844a6d10f5d8d6f328680350ce76c056c3717
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1980528
Commit-Queue: Manu Cornet <manucornet@chromium.org>
Reviewed-by: default avatarMatthew Mourgos <mmourgos@chromium.org>
Reviewed-by: default avatarTetsui Ohkubo <tetsui@chromium.org>
Cr-Commit-Position: refs/heads/master@{#727426}
parent 40f8673e
......@@ -472,6 +472,20 @@ gfx::Rect ShelfLayoutManager::GetIdealBoundsForWorkAreaCalculation() const {
return rect;
}
void ShelfLayoutManager::LayoutShelf(bool animate) {
// The ShelfWidget may be partially closed (no native widget) during shutdown
// so skip layout.
if (in_shutdown_)
return;
CalculateTargetBoundsAndUpdateWorkArea(hotseat_state());
UpdateBoundsAndOpacity(animate);
// Update insets in ShelfWindowTargeter when shelf bounds change.
for (auto& observer : observers_)
observer.WillChangeVisibilityState(visibility_state());
}
void ShelfLayoutManager::UpdateVisibilityState() {
// Bail out early after shelf is destroyed or visibility update is suspended.
aura::Window* shelf_window = shelf_widget_->GetNativeWindow();
......@@ -1019,7 +1033,7 @@ void ShelfLayoutManager::OnDisplayMetricsChanged(
void ShelfLayoutManager::OnLocaleChanged() {
// Layout update is needed when language changes between LTR and RTL.
LayoutShelfAndUpdateBounds();
LayoutShelf();
}
void ShelfLayoutManager::OnDeskSwitchAnimationLaunching() {
......@@ -1372,24 +1386,6 @@ ShelfVisibilityState ShelfLayoutManager::CalculateShelfVisibility() {
return SHELF_VISIBLE;
}
void ShelfLayoutManager::LayoutShelfAndUpdateBounds() {
CalculateTargetBoundsAndUpdateWorkArea(hotseat_state());
UpdateBoundsAndOpacity(false);
// Update insets in ShelfWindowTargeter when shelf bounds change.
for (auto& observer : observers_)
observer.WillChangeVisibilityState(visibility_state());
}
void ShelfLayoutManager::LayoutShelf() {
// The ShelfWidget may be partially closed (no native widget) during shutdown
// so skip layout.
if (in_shutdown_)
return;
LayoutShelfAndUpdateBounds();
}
void ShelfLayoutManager::SetDimmed(bool dimmed) {
if (dimmed_for_inactivity_ == dimmed)
return;
......
......@@ -109,9 +109,8 @@ class ASH_EXPORT ShelfLayoutManager : public AppListControllerObserver,
// bounds in tablet mode.
gfx::Rect GetIdealBoundsForWorkAreaCalculation() const;
// Stops any animations, sets the bounds of the shelf and status widgets, and
// changes the work area
void LayoutShelf();
// Sets the bounds of the shelf and status widgets.
void LayoutShelf(bool animate = false);
// Updates the visibility state.
void UpdateVisibilityState();
......@@ -404,9 +403,6 @@ class ASH_EXPORT ShelfLayoutManager : public AppListControllerObserver,
// behavior setting.
ShelfVisibilityState CalculateShelfVisibility();
// Stops any animations and sets the bounds of the shelf and status widgets.
void LayoutShelfAndUpdateBounds();
// Updates the shelf dim state.
void UpdateShelfIconOpacity();
......
......@@ -62,6 +62,8 @@ void StatusAreaLayoutManager::LayoutStatusArea() {
return;
base::AutoReset<bool> auto_reset_in_layout(&in_layout_, true);
// TODO(manucornet): This should be animated, but that breaks
// |LoginCursorTest|.
shelf_widget_->shelf_layout_manager()->LayoutShelf();
}
......
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