diff options
author | oshima <oshima@chromium.org> | 2015-01-06 16:32:19 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-01-07 00:32:56 +0000 |
commit | 1531d38e8a150190c83c87ca6676cb809b39e376 (patch) | |
tree | eb7d6b2351629c2dfb53f0b5d25ec923877158e4 /ui/wm | |
parent | 45e673e6ff837eeb500c2ad5bcbe5a799e8ba180 (diff) | |
download | chromium_src-1531d38e8a150190c83c87ca6676cb809b39e376.zip chromium_src-1531d38e8a150190c83c87ca6676cb809b39e376.tar.gz chromium_src-1531d38e8a150190c83c87ca6676cb809b39e376.tar.bz2 |
Don't show the shadow for maximized/fullscreen window
BUG=407966
TEST=covered by unit test.
Committed: https://crrev.com/deecdafa38a9effc737acde28e82a32cc527a1b5
Cr-Commit-Position: refs/heads/master@{#309272}
Review URL: https://codereview.chromium.org/778283002
Cr-Commit-Position: refs/heads/master@{#310190}
Diffstat (limited to 'ui/wm')
-rw-r--r-- | ui/wm/core/shadow_controller.cc | 11 | ||||
-rw-r--r-- | ui/wm/core/shadow_controller_unittest.cc | 25 |
2 files changed, 35 insertions, 1 deletions
diff --git a/ui/wm/core/shadow_controller.cc b/ui/wm/core/shadow_controller.cc index 99bfadf..d25b4a5 100644 --- a/ui/wm/core/shadow_controller.cc +++ b/ui/wm/core/shadow_controller.cc @@ -10,10 +10,12 @@ #include "base/logging.h" #include "base/memory/linked_ptr.h" #include "base/scoped_observer.h" +#include "ui/aura/client/aura_constants.h" #include "ui/aura/env.h" #include "ui/aura/env_observer.h" #include "ui/aura/window.h" #include "ui/aura/window_observer.h" +#include "ui/base/ui_base_types.h" #include "ui/compositor/layer.h" #include "ui/wm/core/shadow.h" #include "ui/wm/core/shadow_types.h" @@ -169,7 +171,7 @@ void ShadowController::Impl::OnWindowInitialized(aura::Window* window) { void ShadowController::Impl::OnWindowPropertyChanged(aura::Window* window, const void* key, intptr_t old) { - if (key == kShadowTypeKey) { + if (key == kShadowTypeKey || key == aura::client::kShowStateKey) { HandlePossibleShadowVisibilityChange(window); return; } @@ -207,6 +209,13 @@ void ShadowController::Impl::OnWindowActivated(aura::Window* gained_active, bool ShadowController::Impl::ShouldShowShadowForWindow( aura::Window* window) const { + ui::WindowShowState show_state = + window->GetProperty(aura::client::kShowStateKey); + if (show_state == ui::SHOW_STATE_FULLSCREEN || + show_state == ui::SHOW_STATE_MAXIMIZED) { + return SHADOW_TYPE_NONE; + } + const ShadowType type = GetShadowType(window); switch (type) { case SHADOW_TYPE_NONE: diff --git a/ui/wm/core/shadow_controller_unittest.cc b/ui/wm/core/shadow_controller_unittest.cc index 18116d4..6e3818b 100644 --- a/ui/wm/core/shadow_controller_unittest.cc +++ b/ui/wm/core/shadow_controller_unittest.cc @@ -8,6 +8,7 @@ #include <vector> #include "base/memory/scoped_ptr.h" +#include "ui/aura/client/aura_constants.h" #include "ui/aura/client/window_tree_client.h" #include "ui/aura/test/aura_test_base.h" #include "ui/aura/window.h" @@ -154,6 +155,30 @@ TEST_F(ShadowControllerTest, ShadowStyle) { EXPECT_EQ(Shadow::STYLE_ACTIVE, shadow2->style()); } +// Tests that shadow gets updated when the window show state chagnes. +TEST_F(ShadowControllerTest, ShowState) { + ShadowController::TestApi api(shadow_controller()); + + scoped_ptr<aura::Window> window(new aura::Window(NULL)); + window->SetType(ui::wm::WINDOW_TYPE_NORMAL); + window->Init(aura::WINDOW_LAYER_TEXTURED); + ParentWindow(window.get()); + window->Show(); + + Shadow* shadow = api.GetShadowForWindow(window.get()); + ASSERT_TRUE(shadow != NULL); + EXPECT_EQ(Shadow::STYLE_INACTIVE, shadow->style()); + + window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); + EXPECT_FALSE(shadow->layer()->visible()); + + window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL); + EXPECT_TRUE(shadow->layer()->visible()); + + window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN); + EXPECT_FALSE(shadow->layer()->visible()); +} + // Tests that we use smaller shadows for tooltips and menus. TEST_F(ShadowControllerTest, SmallShadowsForTooltipsAndMenus) { ShadowController::TestApi api(shadow_controller()); |