Commit 830b4e93 authored by Avery Musbach's avatar Avery Musbach Committed by Commit Bot

overview: Factor out repeated code into helper function

Bug: None
Change-Id: I53fd720e73d6c68a9264cc153a65fea5ff3dba4d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2033631
Commit-Queue: Avery Musbach <amusbach@chromium.org>
Reviewed-by: default avatarSammie Quon <sammiequon@chromium.org>
Cr-Commit-Position: refs/heads/master@{#737516}
parent a05c36b3
......@@ -604,10 +604,8 @@ void OverviewGrid::RemoveItem(OverviewItem* overview_item,
// update the grid bounds if the window being dragged from the top or shelf,
// the former being handled in TabletModeWindowDragDelegate's destructor.
base::flat_set<OverviewItem*> ignored_items;
if (overview_session_->window_drag_controller() &&
overview_session_->window_drag_controller()->item()) {
if (overview_session_->IsAnyOverviewItemDragged())
ignored_items.insert(overview_session_->window_drag_controller()->item());
}
const gfx::Rect grid_bounds = GetGridBoundsInScreen(
root_window_,
split_view_drag_indicators_
......
......@@ -1306,10 +1306,8 @@ void OverviewItem::HandlePressEvent(const gfx::PointF& location_in_screen,
bool from_touch_gesture) {
// We allow switching finger while dragging, but do not allow dragging two
// or more items.
if (overview_session_->window_drag_controller() &&
overview_session_->window_drag_controller()->item()) {
if (overview_session_->IsAnyOverviewItemDragged())
return;
}
StartDrag();
overview_session_->InitiateDrag(this, location_in_screen,
......
......@@ -271,6 +271,10 @@ void OverviewSession::Shutdown() {
}
}
bool OverviewSession::IsAnyOverviewItemDragged() const {
return window_drag_controller_ && window_drag_controller_->item();
}
void OverviewSession::OnGridEmpty() {
if (!IsEmpty())
return;
......@@ -1021,7 +1025,7 @@ void OverviewSession::OnSplitViewDividerPositionChanged() {
void OverviewSession::Move(bool reverse) {
// Do not allow moving the highlight while in the middle of a drag.
if (window_drag_controller_ && window_drag_controller_->item())
if (IsAnyOverviewItemDragged())
return;
highlight_controller_->MoveHighlight(reverse);
......
......@@ -120,6 +120,8 @@ class ASH_EXPORT OverviewSession : public display::DisplayObserver,
// Perform cleanup that cannot be done in the destructor.
void Shutdown();
bool IsAnyOverviewItemDragged() const;
// Called when the last overview item from a grid is deleted.
void OnGridEmpty();
......
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