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, ...@@ -103,8 +103,8 @@ class ASH_EXPORT OverviewGrid : public SplitViewObserver,
// of |reposition| and |animate| is false, the stacking order will be adjusted // of |reposition| and |animate| is false, the stacking order will be adjusted
// immediately. // immediately.
// Note: OverviewSession has versions of the Add/Remove items. Those are // Note: OverviewSession has versions of the Add/Remove items. Those are
// preferred as they update other things like the overview accessibility // preferred as they will call into these functions and update other things
// annotator. // like the overview accessibility annotator and the no recent items widget.
void AddItem(aura::Window* window, void AddItem(aura::Window* window,
bool reposition, bool reposition,
bool animate, bool animate,
......
...@@ -163,17 +163,17 @@ class OverviewItemMoveHelper : public aura::WindowObserver { ...@@ -163,17 +163,17 @@ class OverviewItemMoveHelper : public aura::WindowObserver {
OverviewController* overview_controller = OverviewController* overview_controller =
Shell::Get()->overview_controller(); Shell::Get()->overview_controller();
if (overview_controller->InOverviewSession()) { if (overview_controller->InOverviewSession()) {
OverviewGrid* target_grid = // OverviewSession::AddItemInMruOrder() will add |window| to the grid
overview_controller->overview_session()->GetGridWithRootWindow( // associated with |window|'s root. Do not reposition or restack as we
window->GetRootWindow()); // will soon handle them both anyway.
// Add |window| to |target_grid| with reposition=false and restack=false, OverviewSession* session = overview_controller->overview_session();
// because soon we will handle both repositioning and restacking anyway. session->AddItemInMruOrder(window, /*reposition=*/false,
target_grid->AddItemInMruOrder(window, /*reposition=*/false,
/*animate=*/false, /*restack=*/false); /*animate=*/false, /*restack=*/false);
OverviewItem* item = target_grid->GetOverviewItemContaining(window); OverviewItem* item = session->GetOverviewItemForWindow(window);
DCHECK(item);
item->SetBounds(target_item_bounds_, OVERVIEW_ANIMATION_NONE); item->SetBounds(target_item_bounds_, OVERVIEW_ANIMATION_NONE);
item->set_should_restack_on_animation_end(true); item->set_should_restack_on_animation_end(true);
// The destructor will call |OverviewSession::PositionWindows|. // The destructor will call OverviewSession::PositionWindows().
} }
delete this; 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