Commit 73858d13 authored by Manu Cornet's avatar Manu Cornet Committed by Commit Bot

CrOS Shelf: No need to keep shelf insets as a field any longer

Change-Id: Idf49601dd121fa93486672425ad563d0302fac45
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2056203Reviewed-by: default avatarMatthew Mourgos <mmourgos@chromium.org>
Commit-Queue: Manu Cornet <manucornet@chromium.org>
Cr-Commit-Position: refs/heads/master@{#741319}
parent bea5d21b
......@@ -1537,7 +1537,7 @@ bool ShelfLayoutManager::IsDraggingWindowFromTopOrCaptionArea() const {
return false;
}
void ShelfLayoutManager::CalculateTargetBounds(
gfx::Insets ShelfLayoutManager::CalculateTargetBounds(
const State& state,
HotseatState hotseat_target_state) {
shelf_->shelf_widget()->CalculateTargetBounds();
......@@ -1556,7 +1556,7 @@ void ShelfLayoutManager::CalculateTargetBounds(
snapped_shelf_bounds, shelf_->shelf_widget()->GetNativeWindow());
shelf_->shelf_widget()->set_target_bounds(snapped_shelf_bounds);
target_bounds_.shelf_insets = shelf_->SelectValueForShelfAlignment(
return shelf_->SelectValueForShelfAlignment(
gfx::Insets(0, 0,
GetShelfInset(state.visibility_state,
IsHotseatEnabled()
......@@ -1572,7 +1572,8 @@ void ShelfLayoutManager::CalculateTargetBounds(
void ShelfLayoutManager::CalculateTargetBoundsAndUpdateWorkArea() {
HotseatState hotseat_target_state =
CalculateHotseatState(visibility_state(), auto_hide_state());
CalculateTargetBounds(state_, hotseat_target_state);
gfx::Insets shelf_insets =
CalculateTargetBounds(state_, hotseat_target_state);
gfx::Rect shelf_bounds_for_workarea_calculation =
shelf_->shelf_widget()->GetTargetBounds();
// When the hotseat is enabled, only use the in-app shelf bounds when
......@@ -1584,7 +1585,7 @@ void ShelfLayoutManager::CalculateTargetBoundsAndUpdateWorkArea() {
if (!suspend_work_area_update_) {
WorkAreaInsets::ForWindow(shelf_widget_->GetNativeWindow())
->SetShelfBoundsAndInsets(shelf_bounds_for_workarea_calculation,
target_bounds_.shelf_insets);
shelf_insets);
for (auto& observer : observers_)
observer.OnWorkAreaInsetsChanged();
}
......
......@@ -302,8 +302,6 @@ class ASH_EXPORT ShelfLayoutManager
~TargetBounds();
float opacity;
gfx::Insets shelf_insets; // Shelf insets within the screen
};
struct State {
......@@ -366,9 +364,10 @@ class ASH_EXPORT ShelfLayoutManager
bool IsDraggingWindowFromTopOrCaptionArea() const;
// Calculates shelf target bounds assuming visibility of
// |state.visibilty_state| and |hotseat_target_state|.
void CalculateTargetBounds(const State& state,
HotseatState hotseat_target_state);
// |state.visibilty_state| and |hotseat_target_state|. Returns the desired
// shelf insets.
gfx::Insets CalculateTargetBounds(const State& state,
HotseatState hotseat_target_state);
// Calculates the target bounds using |state_| and updates the
// |user_work_area_bounds_|.
......
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