summaryrefslogtreecommitdiffstats
path: root/ash
diff options
context:
space:
mode:
authorsky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-07-31 17:57:32 +0000
committersky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-07-31 17:57:32 +0000
commit67573fda53a8232cbaf2db2b31de63626f8f4eae (patch)
tree75c4ad25cf751a80bda67b7e61e20f5223c9ac8d /ash
parentd7151f462650ace89eb5e37ac09808064a4a6c24 (diff)
downloadchromium_src-67573fda53a8232cbaf2db2b31de63626f8f4eae.zip
chromium_src-67573fda53a8232cbaf2db2b31de63626f8f4eae.tar.gz
chromium_src-67573fda53a8232cbaf2db2b31de63626f8f4eae.tar.bz2
Makes maximized windows go in their own workspace regardless of
whether they are set to float across all workspaces. BUG=133577 TEST=covered by tests R=oshima@chromium.org Review URL: https://chromiumcodereview.appspot.com/10830029 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@149218 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash')
-rw-r--r--ash/wm/workspace/workspace_manager.cc19
-rw-r--r--ash/wm/workspace/workspace_manager_unittest.cc22
2 files changed, 34 insertions, 7 deletions
diff --git a/ash/wm/workspace/workspace_manager.cc b/ash/wm/workspace/workspace_manager.cc
index d4ab3cb..fd5f66e 100644
--- a/ash/wm/workspace/workspace_manager.cc
+++ b/ash/wm/workspace/workspace_manager.cc
@@ -71,7 +71,8 @@ bool WorkspaceManager::ShouldManageWindow(aura::Window* window) {
return window->type() == aura::client::WINDOW_TYPE_NORMAL &&
!window->transient_parent() &&
ash::GetTrackedByWorkspace(window) &&
- !ash::GetPersistsAcrossAllWorkspaces(window);
+ (!ash::GetPersistsAcrossAllWorkspaces(window) ||
+ wm::IsWindowMaximized(window));
}
bool WorkspaceManager::Contains(aura::Window* window) const {
@@ -170,13 +171,17 @@ WorkspaceManager::WindowState WorkspaceManager::GetWindowState() {
}
void WorkspaceManager::ShowStateChanged(aura::Window* window) {
- if (!ShouldManageWindow(window) || !FindBy(window))
+ Workspace* workspace = FindBy(window);
+ if (!workspace)
return;
-
- Workspace::Type old_type = FindBy(window)->type();
- Workspace::Type new_type = Workspace::TypeForWindow(window);
- if (new_type != old_type)
- OnTypeOfWorkspacedNeededChanged(window);
+ if (!ShouldManageWindow(window)) {
+ RemoveWindow(window);
+ } else {
+ Workspace::Type old_type = workspace->type();
+ Workspace::Type new_type = Workspace::TypeForWindow(window);
+ if (new_type != old_type)
+ OnTypeOfWorkspacedNeededChanged(window);
+ }
UpdateShelfVisibility();
}
diff --git a/ash/wm/workspace/workspace_manager_unittest.cc b/ash/wm/workspace/workspace_manager_unittest.cc
index 64b22c3..4f6a5f8 100644
--- a/ash/wm/workspace/workspace_manager_unittest.cc
+++ b/ash/wm/workspace/workspace_manager_unittest.cc
@@ -672,5 +672,27 @@ TEST_F(WorkspaceManagerTest, DontResetAnimation) {
EXPECT_TRUE(w1->GetProperty(aura::client::kAnimationsDisabledKey));
}
+// Verifies a window marked as persisting across all workspaces ends up in its
+// own workspace when maximized.
+TEST_F(WorkspaceManagerTest, MaximizeDontPersistEndsUpInOwnWorkspace) {
+ scoped_ptr<Window> w1(CreateTestWindow());
+
+ SetPersistsAcrossAllWorkspaces(
+ w1.get(),
+ WINDOW_PERSISTS_ACROSS_ALL_WORKSPACES_VALUE_YES);
+ w1->Show();
+
+ // Shouldn't contain the window initially.
+ EXPECT_FALSE(manager_->Contains(w1.get()));
+
+ // Maximize should trigger containing the window.
+ w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED);
+ EXPECT_TRUE(manager_->Contains(w1.get()));
+
+ // And resetting to normal should remove it.
+ w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL);
+ EXPECT_FALSE(manager_->Contains(w1.get()));
+}
+
} // namespace internal
} // namespace ash