Commit 3f0ed2a6 authored by Toni Barzic's avatar Toni Barzic Committed by Commit Bot

Use window util to minimize windows when going home

HomeScreenController should minimize non-foreground windows without
animation when handling requests to go to home screen.
Instead of just using WindowState::Minimize() on each window, use
window_util::HideAndMaybeMinimizeWithoutAnimation(). The later should
ensure that windows are properly minimized without using animation.

BUG=1024659

TEST=Open an android app, then another app above it. Tap Home button.
     The app in the foreground animates to the home screen; the android
     app gets minimized without animating.

Change-Id: Idb9caa86891b2f21e2127333acfca8dbaea9ed52
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1918092Reviewed-by: default avatarAlex Newcomer <newcomer@chromium.org>
Commit-Queue: Toni Baržić <tbarzic@chromium.org>
Cr-Commit-Position: refs/heads/master@{#715526}
parent fc6bf82c
......@@ -24,6 +24,7 @@
#include "ash/wm/tablet_mode/tablet_mode_controller.h"
#include "ash/wm/window_state.h"
#include "ash/wm/window_transient_descendant_iterator.h"
#include "ash/wm/window_util.h"
#include "base/barrier_closure.h"
#include "base/logging.h"
#include "base/stl_util.h"
......@@ -39,17 +40,19 @@ namespace {
// Returns true if any windows are minimized.
bool MinimizeAllWindows(const aura::Window::Windows& windows,
const aura::Window::Windows& windows_to_ignore) {
bool handled = false;
aura::Window* container = Shell::Get()->GetPrimaryRootWindow()->GetChildById(
kShellWindowId_HomeScreenContainer);
aura::Window::Windows windows_to_minimize;
for (auto it = windows.rbegin(); it != windows.rend(); it++) {
if (!container->Contains(*it) && !base::Contains(windows_to_ignore, *it) &&
!WindowState::Get(*it)->IsMinimized()) {
WindowState::Get(*it)->Minimize();
handled = true;
windows_to_minimize.push_back(*it);
}
}
return handled;
window_util::HideAndMaybeMinimizeWithoutAnimation(windows_to_minimize,
/*minimize=*/true);
return !windows_to_minimize.empty();
}
} // namespace
......
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