Commit a8dbbe67 authored by Ahmed Mehfooz's avatar Ahmed Mehfooz Committed by Commit Bot

Open system tray in a collapsed state if screen height is limited

Bug: 909101
Change-Id: Ie37bed4e4bee9b5ac2a144cae54f3fc1f63dde28
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1808493
Commit-Queue: Ahmed Mehfooz <amehfooz@chromium.org>
Reviewed-by: default avatarTim Song <tengs@chromium.org>
Cr-Commit-Position: refs/heads/master@{#699149}
parent db774e83
......@@ -103,6 +103,14 @@ UnifiedSystemTrayView* UnifiedSystemTrayController::CreateView() {
std::make_unique<UnifiedBrightnessSliderController>(model_);
unified_view_->AddSliderView(brightness_slider_controller_->CreateView());
// Collapse system tray if there isn't enough space to show notifications when
// it is first opened.
if (bubble_ && bubble_->CalculateMaxHeight() -
unified_view_->GetExpandedSystemTrayHeight() <
kUnifiedNotificationMinimumHeight) {
ResetToCollapsed();
}
return unified_view_;
}
......@@ -402,6 +410,11 @@ void UnifiedSystemTrayController::UpdateExpandedAmount() {
model_->set_expanded_on_open(expanded_amount == 1.0);
}
void UnifiedSystemTrayController::ResetToCollapsed() {
unified_view_->SetExpandedAmount(0.0);
animation_->Reset(0);
}
double UnifiedSystemTrayController::GetDragExpandedAmount(
const gfx::Point& location) const {
double y_diff = (location - drag_init_point_).y();
......
......@@ -108,6 +108,10 @@ class ASH_EXPORT UnifiedSystemTrayController
// Ensure the main view is expanded. Called from the slider bubble controller.
void EnsureExpanded();
// Collapse the tray without animating. Used to open the tray in a collapsed
// state if there is insufficient vertical space.
void ResetToCollapsed();
// gfx::AnimationDelegate:
void AnimationEnded(const gfx::Animation* animation) override;
void AnimationProgressed(const gfx::Animation* animation) override;
......
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