Commit 906960ba authored by sky@chromium.org's avatar sky@chromium.org

Makes sure shelf visibility is updated when the visibility of a window

changes.

BUG=137342
TEST=none
R=ben@chromium.org


Review URL: https://chromiumcodereview.appspot.com/10874086

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@153530 0039d316-1c4b-4281-b951-d872f2087c98
parent b561aab8
...@@ -170,8 +170,7 @@ WorkspaceWindowState WorkspaceManager2::GetWindowState() const { ...@@ -170,8 +170,7 @@ WorkspaceWindowState WorkspaceManager2::GetWindowState() const {
for (Window::Windows::const_iterator i = windows.begin(); for (Window::Windows::const_iterator i = windows.begin();
i != windows.end(); ++i) { i != windows.end(); ++i) {
ui::Layer* layer = (*i)->layer(); ui::Layer* layer = (*i)->layer();
if (!layer->GetTargetVisibility() || layer->GetTargetOpacity() == 0.0f || if (!layer->GetTargetVisibility() || layer->GetTargetOpacity() == 0.0f)
(*i)->id() == kShellWindowId_DesktopBackgroundContainer)
continue; continue;
if (wm::IsWindowMaximized(*i)) { if (wm::IsWindowMaximized(*i)) {
// An untracked window may still be fullscreen so we keep iterating when // An untracked window may still be fullscreen so we keep iterating when
...@@ -428,6 +427,8 @@ void WorkspaceManager2::OnWorkspaceChildWindowVisibilityChanged( ...@@ -428,6 +427,8 @@ void WorkspaceManager2::OnWorkspaceChildWindowVisibilityChanged(
Window* child) { Window* child) {
if (workspace->ShouldMoveToPending()) if (workspace->ShouldMoveToPending())
MoveWorkspaceToPendingOrDelete(workspace, NULL, ANIMATE_NEW); MoveWorkspaceToPendingOrDelete(workspace, NULL, ANIMATE_NEW);
else if (workspace == active_workspace_)
UpdateShelfVisibility();
} }
void WorkspaceManager2::OnWorkspaceWindowChildBoundsChanged( void WorkspaceManager2::OnWorkspaceWindowChildBoundsChanged(
......
...@@ -461,12 +461,22 @@ TEST_F(WorkspaceManager2Test, ShelfStateUpdated) { ...@@ -461,12 +461,22 @@ TEST_F(WorkspaceManager2Test, ShelfStateUpdated) {
scoped_ptr<Window> w1(CreateTestWindow()); scoped_ptr<Window> w1(CreateTestWindow());
const gfx::Rect w1_bounds(0, 1, 101, 102); const gfx::Rect w1_bounds(0, 1, 101, 102);
ShelfLayoutManager* shelf = Shell::GetInstance()->shelf();
const gfx::Rect touches_shelf_bounds(
0, shelf->GetIdealBounds().y() - 10, 101, 102);
// Move |w1| to overlap the shelf.
w1->SetBounds(touches_shelf_bounds);
EXPECT_FALSE(GetWindowOverlapsShelf());
// Make it visible, since visible shelf overlaps should be true.
w1->Show();
EXPECT_TRUE(GetWindowOverlapsShelf());
wm::ActivateWindow(w1.get());
w1->SetBounds(w1_bounds); w1->SetBounds(w1_bounds);
w1->Show(); w1->Show();
wm::ActivateWindow(w1.get()); wm::ActivateWindow(w1.get());
ShelfLayoutManager* shelf = Shell::GetInstance()->shelf();
EXPECT_EQ(ShelfLayoutManager::VISIBLE, shelf->visibility_state()); EXPECT_EQ(ShelfLayoutManager::VISIBLE, shelf->visibility_state());
// Maximize the window. // Maximize the window.
...@@ -490,8 +500,6 @@ TEST_F(WorkspaceManager2Test, ShelfStateUpdated) { ...@@ -490,8 +500,6 @@ TEST_F(WorkspaceManager2Test, ShelfStateUpdated) {
EXPECT_FALSE(GetWindowOverlapsShelf()); EXPECT_FALSE(GetWindowOverlapsShelf());
// Move window so it obscures shelf. // Move window so it obscures shelf.
const gfx::Rect touches_shelf_bounds(
0, shelf->GetIdealBounds().y() - 10, 101, 102);
w1->SetBounds(touches_shelf_bounds); w1->SetBounds(touches_shelf_bounds);
EXPECT_TRUE(GetWindowOverlapsShelf()); EXPECT_TRUE(GetWindowOverlapsShelf());
......
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