diff options
author | xiyuan@chromium.org <xiyuan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-28 23:16:18 +0000 |
---|---|---|
committer | xiyuan@chromium.org <xiyuan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-28 23:16:18 +0000 |
commit | aa29f31dd0fb2446ced9d58f5476a5cac8ebb9f2 (patch) | |
tree | 3ce2e7caa62a2892baf3656056d8e26d5214a43d /ash | |
parent | 824b02d9af091a619eeabb8562e7025cfac22545 (diff) | |
download | chromium_src-aa29f31dd0fb2446ced9d58f5476a5cac8ebb9f2.zip chromium_src-aa29f31dd0fb2446ced9d58f5476a5cac8ebb9f2.tar.gz chromium_src-aa29f31dd0fb2446ced9d58f5476a5cac8ebb9f2.tar.bz2 |
ash: Don't pick minimized window for replace active window.
A side effect of r129360 is that minimized window would be picked up as
the next active window. This CL fixes the problem by explicitly skipping
minimized window in GetTopmostWindowToActivateInContainer.
BUG=none.
TEST=aura_shell_unittests should pass.
Review URL: http://codereview.chromium.org/9877005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@129515 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash')
-rw-r--r-- | ash/wm/activation_controller.cc | 4 | ||||
-rw-r--r-- | ash/wm/activation_controller_unittest.cc | 22 |
2 files changed, 25 insertions, 1 deletions
diff --git a/ash/wm/activation_controller.cc b/ash/wm/activation_controller.cc index cfe74f5..5054256 100644 --- a/ash/wm/activation_controller.cc +++ b/ash/wm/activation_controller.cc @@ -295,7 +295,9 @@ aura::Window* ActivationController::GetTopmostWindowToActivateInContainer( container->children().rbegin(); i != container->children().rend(); ++i) { - if (*i != ignore && CanActivateWindowWithEvent(*i, NULL)) + if (*i != ignore && + CanActivateWindowWithEvent(*i, NULL) && + !wm::IsWindowMinimized(*i)) return *i; } return NULL; diff --git a/ash/wm/activation_controller_unittest.cc b/ash/wm/activation_controller_unittest.cc index 65bc0ef..167e07c 100644 --- a/ash/wm/activation_controller_unittest.cc +++ b/ash/wm/activation_controller_unittest.cc @@ -426,11 +426,33 @@ TEST_F(ActivationControllerTest, ActivateMinimizedWindow) { &wd, -1, gfx::Rect(50, 50), NULL)); wm::MinimizeWindow(w1.get()); + EXPECT_TRUE(wm::IsWindowMinimized(w1.get())); wm::ActivateWindow(w1.get()); EXPECT_TRUE(wm::IsActiveWindow(w1.get())); EXPECT_FALSE(wm::IsWindowMinimized(w1.get())); } +// Verifies that a minimized window would not be automatically activated as +// a replacement active window. +TEST_F(ActivationControllerTest, NoAutoActivateMinimizedWindow) { + aura::test::TestWindowDelegate wd; + scoped_ptr<aura::Window> w1(aura::test::CreateTestWindowWithDelegate( + &wd, -1, gfx::Rect(50, 50, 50, 50), NULL)); + scoped_ptr<aura::Window> w2(aura::test::CreateTestWindowWithDelegate( + &wd, -2, gfx::Rect(75, 75, 50, 50), NULL)); + + wm::MinimizeWindow(w1.get()); + EXPECT_TRUE(wm::IsWindowMinimized(w1.get())); + + wm::ActivateWindow(w2.get()); + EXPECT_TRUE(wm::IsActiveWindow(w2.get())); + + w2->Hide(); + + EXPECT_FALSE(wm::IsActiveWindow(w1.get())); + EXPECT_TRUE(wm::IsWindowMinimized(w1.get())); +} + } // namespace test } // namespace ash |