Commit 1531d38e authored by oshima's avatar oshima Committed by Commit bot

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}
parent 45e673e6
......@@ -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:
......
......@@ -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());
......
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