Commit afa2effa authored by Manu Cornet's avatar Manu Cornet Committed by Commit Bot

CrOS Shelf: Let the shelf layout manager keep target bounds as a field

The shelf layout manager currently calculates and sets the bounds of
all the shelf-related widgets (navigation, hotseat, status area).

The bound calculation logic should remain in this class, but the
actual setting of the bounds and managing animations can be done by
each widget at their leisure without requiring a full relayout of all
other widgets. For that to happen, the shelf layout manager can be
the central place from which widgets can ask their target bounds, but
they can then be responsible for setting them themselves at their own
pace.

This CL makes the target bounds a field so that other classes can
query them at any time (through getters that will be added
subsequently as other classes need them).

This has no expected user-visible effect.

Bug: 1021698
Change-Id: I6214d21315aec42e01d44f9f8ace4b041e970704
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1919603Reviewed-by: default avatarAlex Newcomer <newcomer@chromium.org>
Commit-Queue: Alex Newcomer <newcomer@chromium.org>
Commit-Queue: Manu Cornet <manucornet@chromium.org>
Cr-Commit-Position: refs/heads/master@{#715900}
parent efaf3324
This diff is collapsed.
...@@ -394,8 +394,7 @@ class ASH_EXPORT ShelfLayoutManager : public AppListControllerObserver, ...@@ -394,8 +394,7 @@ class ASH_EXPORT ShelfLayoutManager : public AppListControllerObserver,
// Updates the bounds and opacity of the shelf and status widgets. // Updates the bounds and opacity of the shelf and status widgets.
// If |observer| is specified, it will be called back when the animations, if // If |observer| is specified, it will be called back when the animations, if
// any, are complete. // any, are complete.
void UpdateBoundsAndOpacity(const TargetBounds& target_bounds, void UpdateBoundsAndOpacity(bool animate,
bool animate,
ui::ImplicitAnimationObserver* observer); ui::ImplicitAnimationObserver* observer);
// Returns true if a maximized or fullscreen window is being dragged from the // Returns true if a maximized or fullscreen window is being dragged from the
...@@ -409,19 +408,16 @@ class ASH_EXPORT ShelfLayoutManager : public AppListControllerObserver, ...@@ -409,19 +408,16 @@ class ASH_EXPORT ShelfLayoutManager : public AppListControllerObserver,
// Calculates shelf target bounds assuming visibility of // Calculates shelf target bounds assuming visibility of
// |state.visibilty_state| and |hotseat_target_state|. // |state.visibilty_state| and |hotseat_target_state|.
void CalculateTargetBounds(const State& state, void CalculateTargetBounds(const State& state,
TargetBounds* target_bounds, HotseatState hotseat_target_state);
HotseatState hotseat_target_state) const;
// Calculates the target bounds using |state_|, |hotseat_target_state|, and // Calculates the target bounds using |state_|, |hotseat_target_state|, and
// updates the |user_work_area_bounds_|. // updates the |user_work_area_bounds_|.
void CalculateTargetBoundsAndUpdateWorkArea( void CalculateTargetBoundsAndUpdateWorkArea(
TargetBounds* target_bounds,
HotseatState hotseat_target_state); HotseatState hotseat_target_state);
// Updates the target bounds if a gesture-drag is in progress. This is only // Updates the target bounds if a gesture-drag is in progress. This is only
// used by |CalculateTargetBounds()|. // used by |CalculateTargetBounds()|.
void UpdateTargetBoundsForGesture(TargetBounds* target_bounds, void UpdateTargetBoundsForGesture(HotseatState target_hotseat_state);
HotseatState target_hotseat_state) const;
// Updates the auto hide state immediately. // Updates the auto hide state immediately.
void UpdateAutoHideStateNow(); void UpdateAutoHideStateNow();
...@@ -648,6 +644,9 @@ class ASH_EXPORT ShelfLayoutManager : public AppListControllerObserver, ...@@ -648,6 +644,9 @@ class ASH_EXPORT ShelfLayoutManager : public AppListControllerObserver,
// Location of the beginning of a drag in screen coordinates. // Location of the beginning of a drag in screen coordinates.
gfx::Point drag_start_point_in_screen_; gfx::Point drag_start_point_in_screen_;
// The current set of target bounds for shelf-related widgets.
TargetBounds target_bounds_;
// When it is true, |CalculateAutoHideState| returns the current auto hide // When it is true, |CalculateAutoHideState| returns the current auto hide
// state. // state.
bool is_auto_hide_state_locked_ = false; bool is_auto_hide_state_locked_ = false;
......
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