Commit de0d2b8f authored by Sammie Quon's avatar Sammie Quon Committed by Commit Bot

overview: Fix bug with no recent items showing up in multi display drag.

Use the sessions AddItem instead of grids AddItem. The former updates
the recent items widget and also |num_items_|. This prevents a DCHECK
from crashing when exiting overview, since |num_items_| will have the
wrong value.

Fixed: 1147990
Test: manual
Change-Id: I27f76a6da28572da6fa9f8bd045b239e63d7d19f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2533994Reviewed-by: default avatarXiaoqian Dai <xdai@chromium.org>
Commit-Queue: Sammie Quon <sammiequon@chromium.org>
Cr-Commit-Position: refs/heads/master@{#826836}
parent 12d23eb3
......@@ -103,8 +103,8 @@ class ASH_EXPORT OverviewGrid : public SplitViewObserver,
// of |reposition| and |animate| is false, the stacking order will be adjusted
// immediately.
// Note: OverviewSession has versions of the Add/Remove items. Those are
// preferred as they update other things like the overview accessibility
// annotator.
// preferred as they will call into these functions and update other things
// like the overview accessibility annotator and the no recent items widget.
void AddItem(aura::Window* window,
bool reposition,
bool animate,
......
......@@ -163,17 +163,17 @@ class OverviewItemMoveHelper : public aura::WindowObserver {
OverviewController* overview_controller =
Shell::Get()->overview_controller();
if (overview_controller->InOverviewSession()) {
OverviewGrid* target_grid =
overview_controller->overview_session()->GetGridWithRootWindow(
window->GetRootWindow());
// Add |window| to |target_grid| with reposition=false and restack=false,
// because soon we will handle both repositioning and restacking anyway.
target_grid->AddItemInMruOrder(window, /*reposition=*/false,
/*animate=*/false, /*restack=*/false);
OverviewItem* item = target_grid->GetOverviewItemContaining(window);
// OverviewSession::AddItemInMruOrder() will add |window| to the grid
// associated with |window|'s root. Do not reposition or restack as we
// will soon handle them both anyway.
OverviewSession* session = overview_controller->overview_session();
session->AddItemInMruOrder(window, /*reposition=*/false,
/*animate=*/false, /*restack=*/false);
OverviewItem* item = session->GetOverviewItemForWindow(window);
DCHECK(item);
item->SetBounds(target_item_bounds_, OVERVIEW_ANIMATION_NONE);
item->set_should_restack_on_animation_end(true);
// The destructor will call |OverviewSession::PositionWindows|.
// The destructor will call OverviewSession::PositionWindows().
}
delete this;
}
......
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