summaryrefslogtreecommitdiffstats
path: root/ash
diff options
context:
space:
mode:
authormukai@chromium.org <mukai@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-20 22:19:16 +0000
committermukai@chromium.org <mukai@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-20 22:19:16 +0000
commitf619247664f8e0e496ce1fe0086fa9f4bcbe39a7 (patch)
tree74b230afadcf851c3629a40492e23e47d8e41577 /ash
parent30a07b3c388a4c3c38ca6bd4e429f6d207115fa0 (diff)
downloadchromium_src-f619247664f8e0e496ce1fe0086fa9f4bcbe39a7.zip
chromium_src-f619247664f8e0e496ce1fe0086fa9f4bcbe39a7.tar.gz
chromium_src-f619247664f8e0e496ce1fe0086fa9f4bcbe39a7.tar.bz2
Manual revert: "Do not create a workspace for a maximized window."
This CL reverts the following 3 CLs. crrev.com/205493: Do not create a workspace for a maximized window. crrev.com/205989: Fixes the test expectation from fullscreen_area. crrev.com/206487: Recovers the background when the maximized window is closed. I landed the first patch, but it has caused a few regressions and the latter 2 CLs has fixed them. However, we expect that several more regressions will be observed afterall and it would not be possible to fix all of those regressions in this milestone. Thus this CL reverts everything to recover the original behavior for M29. I will reland them and fix the regressions at some earlier point of M30 cycle. BUG=245345,248757 TBR=sky@chromium.org, jamescook@chromium.org TEST=ash_unittests still succeeds Review URL: https://codereview.chromium.org/17408008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@207606 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash')
-rw-r--r--ash/shelf/shelf_layout_manager_unittest.cc25
-rw-r--r--ash/wm/frame_painter_unittest.cc11
-rw-r--r--ash/wm/workspace/workspace.cc16
-rw-r--r--ash/wm/workspace/workspace.h18
-rw-r--r--ash/wm/workspace/workspace_layout_manager.cc29
-rw-r--r--ash/wm/workspace/workspace_manager.cc179
-rw-r--r--ash/wm/workspace/workspace_manager.h20
-rw-r--r--ash/wm/workspace/workspace_manager_unittest.cc340
8 files changed, 257 insertions, 381 deletions
diff --git a/ash/shelf/shelf_layout_manager_unittest.cc b/ash/shelf/shelf_layout_manager_unittest.cc
index a0db945..cbe4097 100644
--- a/ash/shelf/shelf_layout_manager_unittest.cc
+++ b/ash/shelf/shelf_layout_manager_unittest.cc
@@ -1400,27 +1400,34 @@ TEST_F(ShelfLayoutManagerTest, WorkAreaChangeWorkspace) {
// Both windows are maximized. They should be of the same size.
EXPECT_EQ(widget_one->GetNativeWindow()->bounds().ToString(),
widget_two->GetNativeWindow()->bounds().ToString());
- int area_when_shelf_shown =
- widget_one->GetNativeWindow()->bounds().size().GetArea();
// Now hide the shelf.
shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS);
- // Both windows should be resized according to the shelf status.
+ // The active maximized window will get resized to the new work area. However,
+ // the inactive window should not get resized.
+ EXPECT_NE(widget_one->GetNativeWindow()->bounds().ToString(),
+ widget_two->GetNativeWindow()->bounds().ToString());
+
+ // Activate the first window. Now, both windows should be of the same size
+ // again.
+ widget_one->Activate();
EXPECT_EQ(widget_one->GetNativeWindow()->bounds().ToString(),
widget_two->GetNativeWindow()->bounds().ToString());
- // Resized to small.
- EXPECT_LT(area_when_shelf_shown,
- widget_one->GetNativeWindow()->bounds().size().GetArea());
// Now show the shelf.
shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER);
- // Again both windows should be of the same size.
+ // The active maximized window will get resized to the new work area. However,
+ // the inactive window should not get resized.
+ EXPECT_NE(widget_one->GetNativeWindow()->bounds().ToString(),
+ widget_two->GetNativeWindow()->bounds().ToString());
+
+ // Activate the first window. Now, both windows should be of the same size
+ // again.
+ widget_two->Activate();
EXPECT_EQ(widget_one->GetNativeWindow()->bounds().ToString(),
widget_two->GetNativeWindow()->bounds().ToString());
- EXPECT_EQ(area_when_shelf_shown,
- widget_one->GetNativeWindow()->bounds().size().GetArea());
}
// Confirm that the shelf is dimmed only when content is maximized and
diff --git a/ash/wm/frame_painter_unittest.cc b/ash/wm/frame_painter_unittest.cc
index 27d4684..703aafc 100644
--- a/ash/wm/frame_painter_unittest.cc
+++ b/ash/wm/frame_painter_unittest.cc
@@ -305,6 +305,17 @@ TEST_F(FramePainterTest, UseSoloWindowHeader) {
w2->Show();
EXPECT_FALSE(p1.UseSoloWindowHeader());
+ // Maximize the window, then activate the first window. The second window
+ // is in its own workspace, so solo should be active for the first one.
+ w2->Maximize();
+ w1->Activate();
+ EXPECT_TRUE(p1.UseSoloWindowHeader());
+
+ // Switch to the second window and restore it. Solo should be disabled.
+ w2->Activate();
+ w2->Restore();
+ EXPECT_FALSE(p2.UseSoloWindowHeader());
+
// Minimize the second window. Solo should be enabled.
w2->Minimize();
EXPECT_TRUE(p1.UseSoloWindowHeader());
diff --git a/ash/wm/workspace/workspace.cc b/ash/wm/workspace/workspace.cc
index cd790a1..03e5004 100644
--- a/ash/wm/workspace/workspace.cc
+++ b/ash/wm/workspace/workspace.cc
@@ -20,8 +20,8 @@ namespace internal {
Workspace::Workspace(WorkspaceManager* manager,
aura::Window* parent,
- bool is_fullscreen)
- : is_fullscreen_(is_fullscreen),
+ bool is_maximized)
+ : is_maximized_(is_maximized),
workspace_manager_(manager),
window_(new aura::Window(NULL)),
event_handler_(new WorkspaceEventHandler(window_)),
@@ -72,7 +72,7 @@ aura::Window* Workspace::ReleaseWindow() {
}
bool Workspace::ShouldMoveToPending() const {
- if (!is_fullscreen_)
+ if (!is_maximized_)
return false;
for (size_t i = 0; i < window_->children().size(); ++i) {
@@ -80,8 +80,8 @@ bool Workspace::ShouldMoveToPending() const {
if (!child->TargetVisibility() || wm::IsWindowMinimized(child))
continue;
- // If we have a fullscreen window don't move to pending.
- if (wm::IsWindowFullscreen(child))
+ // If we have a maximized window don't move to pending.
+ if (WorkspaceManager::IsMaximized(child))
return false;
if (GetTrackedByWorkspace(child) && !GetPersistsAcrossAllWorkspaces(child))
@@ -90,13 +90,13 @@ bool Workspace::ShouldMoveToPending() const {
return true;
}
-int Workspace::GetNumFullscreenWindows() const {
+int Workspace::GetNumMaximizedWindows() const {
int count = 0;
for (size_t i = 0; i < window_->children().size(); ++i) {
aura::Window* child = window_->children()[i];
if (GetTrackedByWorkspace(child) &&
- (wm::IsWindowFullscreen(child) ||
- WorkspaceManager::WillRestoreToWorkspace(child))) {
+ (WorkspaceManager::IsMaximized(child) ||
+ WorkspaceManager::WillRestoreMaximized(child))) {
if (++count == 2)
return count;
}
diff --git a/ash/wm/workspace/workspace.h b/ash/wm/workspace/workspace.h
index 4b8423b..0ad230b 100644
--- a/ash/wm/workspace/workspace.h
+++ b/ash/wm/workspace/workspace.h
@@ -26,14 +26,14 @@ class WorkspaceEventHandler;
class WorkspaceLayoutManager;
class WorkspaceManager;
-// Workspace is used to maintain either a single fullscreen windows (including
+// Workspace is used to maintain either a single maximized windows (including
// transients and other windows) or any number of windows (for the
// desktop). Workspace is used by WorkspaceManager to manage a set of windows.
class ASH_EXPORT Workspace {
public:
Workspace(WorkspaceManager* manager,
aura::Window* parent,
- bool is_fullscreen);
+ bool is_maximized);
~Workspace();
// Returns the topmost activatable window. This corresponds to the most
@@ -43,7 +43,7 @@ class ASH_EXPORT Workspace {
// Resets state. This should be used before destroying the Workspace.
aura::Window* ReleaseWindow();
- bool is_fullscreen() const { return is_fullscreen_; }
+ bool is_maximized() const { return is_maximized_; }
aura::Window* window() { return window_; }
@@ -60,16 +60,16 @@ class ASH_EXPORT Workspace {
WorkspaceManager* workspace_manager() { return workspace_manager_; }
// Returns true if the Workspace should be moved to pending. This is true
- // if there are no visible fullscreen windows.
+ // if there are no visible maximized windows.
bool ShouldMoveToPending() const;
- // Returns the number of fullscreen windows (including minimized windows that
- // would be fullscreen on restore). This does not consider visibility.
- int GetNumFullscreenWindows() const;
+ // Returns the number of maximized windows (including minimized windows that
+ // would be maximized on restore). This does not consider visibility.
+ int GetNumMaximizedWindows() const;
private:
- // Is this a workspace for fullscreen windows?
- const bool is_fullscreen_;
+ // Is this a workspace for maximized windows?
+ const bool is_maximized_;
WorkspaceManager* workspace_manager_;
diff --git a/ash/wm/workspace/workspace_layout_manager.cc b/ash/wm/workspace/workspace_layout_manager.cc
index 6e9feca..db45d81 100644
--- a/ash/wm/workspace/workspace_layout_manager.cc
+++ b/ash/wm/workspace/workspace_layout_manager.cc
@@ -74,11 +74,6 @@ void ResetConstrainedWindowBoundsIfNecessary(const BoundsMap& bounds_map,
ResetConstrainedWindowBoundsIfNecessary(bounds_map, window->children()[i]);
}
-bool IsMaximizedState(ui::WindowShowState state) {
- return state == ui::SHOW_STATE_MAXIMIZED ||
- state == ui::SHOW_STATE_FULLSCREEN;
-}
-
} // namespace
WorkspaceLayoutManager::WorkspaceLayoutManager(Workspace* workspace)
@@ -173,8 +168,8 @@ void WorkspaceLayoutManager::OnWindowPropertyChanged(Window* window,
window->GetProperty(aura::client::kShowStateKey);
if (old_state != ui::SHOW_STATE_MINIMIZED &&
GetRestoreBoundsInScreen(window) == NULL &&
- IsMaximizedState(new_state) &&
- !IsMaximizedState(old_state)) {
+ WorkspaceManager::IsMaximizedState(new_state) &&
+ !WorkspaceManager::IsMaximizedState(old_state)) {
SetRestoreBoundsInParent(window, window->bounds());
}
// When restoring from a minimized state, we want to restore to the
@@ -191,18 +186,17 @@ void WorkspaceLayoutManager::OnWindowPropertyChanged(Window* window,
SetRestoreBoundsInScreen(window, window->GetBoundsInScreen());
}
- // If the new state requires |window| to be in a workspace, clone the layer.
- // WorkspaceManager will use it (and take ownership of it) when animating.
- // Ideally we could use that of BaseLayoutManager, but that proves
- // problematic. In particular when restoring we need to animate on top of
- // the workspace animating in.
+ // If maximizing or restoring, clone the layer. WorkspaceManager will use it
+ // (and take ownership of it) when animating. Ideally we could use that of
+ // BaseLayoutManager, but that proves problematic. In particular when
+ // restoring we need to animate on top of the workspace animating in.
ui::Layer* cloned_layer = NULL;
BoundsMap bounds_map;
if (wm::IsActiveWindow(window) &&
- ((new_state == ui::SHOW_STATE_FULLSCREEN &&
+ ((WorkspaceManager::IsMaximizedState(new_state) &&
wm::IsWindowStateNormal(old_state)) ||
- (new_state != ui::SHOW_STATE_FULLSCREEN &&
- old_state == ui::SHOW_STATE_FULLSCREEN &&
+ (!WorkspaceManager::IsMaximizedState(new_state) &&
+ WorkspaceManager::IsMaximizedState(old_state) &&
new_state != ui::SHOW_STATE_MINIMIZED))) {
BuildWindowBoundsMap(window, &bounds_map);
cloned_layer = views::corewm::RecreateWindowLayers(window, false);
@@ -230,11 +224,6 @@ void WorkspaceLayoutManager::OnWindowPropertyChanged(Window* window,
if (key == internal::kWindowTrackedByWorkspaceKey &&
GetTrackedByWorkspace(window)) {
workspace_manager()->OnTrackedByWorkspaceChanged(workspace_, window);
- if (wm::IsWindowMaximized(window)) {
- SetChildBoundsDirect(
- window, ScreenAsh::GetMaximizedWindowBoundsInParent(
- window->parent()->parent()));
- }
}
if (key == aura::client::kAlwaysOnTopKey &&
diff --git a/ash/wm/workspace/workspace_manager.cc b/ash/wm/workspace/workspace_manager.cc
index b23f5c4..e0d53e4 100644
--- a/ash/wm/workspace/workspace_manager.cc
+++ b/ash/wm/workspace/workspace_manager.cc
@@ -51,7 +51,7 @@ DEFINE_WINDOW_PROPERTY_KEY(Workspace*, kWorkspaceKey, NULL);
namespace {
-// Duration for fading out the desktop background when fullscreen.
+// Duration for fading out the desktop background when maximizing.
const int kCrossFadeSwitchTimeMS = 700;
// Amount of time to pause before animating anything. Only used during initial
@@ -146,17 +146,27 @@ WorkspaceManager::~WorkspaceManager() {
}
// static
-bool WorkspaceManager::WillRestoreToWorkspace(Window* window) {
+bool WorkspaceManager::IsMaximized(Window* window) {
+ return IsMaximizedState(window->GetProperty(aura::client::kShowStateKey));
+}
+
+// static
+bool WorkspaceManager::IsMaximizedState(ui::WindowShowState state) {
+ return state == ui::SHOW_STATE_MAXIMIZED ||
+ state == ui::SHOW_STATE_FULLSCREEN;
+}
+
+// static
+bool WorkspaceManager::WillRestoreMaximized(Window* window) {
return wm::IsWindowMinimized(window) &&
- window->GetProperty(aura::client::kRestoreShowStateKey) ==
- ui::SHOW_STATE_FULLSCREEN;
+ IsMaximizedState(window->GetProperty(aura::client::kRestoreShowStateKey));
}
WorkspaceWindowState WorkspaceManager::GetWindowState() const {
if (!shelf_)
return WORKSPACE_WINDOW_STATE_DEFAULT;
- const bool is_active_fullscreen = active_workspace_->is_fullscreen();
+ const bool is_active_maximized = active_workspace_->is_maximized();
const gfx::Rect shelf_bounds(shelf_->GetIdealBounds());
const Window::Windows& windows(active_workspace_->window()->children());
bool window_overlaps_launcher = false;
@@ -168,16 +178,18 @@ WorkspaceWindowState WorkspaceManager::GetWindowState() const {
ui::Layer* layer = (*i)->layer();
if (!layer->GetTargetVisibility() || layer->GetTargetOpacity() == 0.0f)
continue;
- if (wm::IsWindowMaximized(*i)) {
- // An untracked window may still be fullscreen so we keep iterating when
- // we hit a maximized window.
- has_maximized_window = true;
- } else if (is_active_fullscreen && wm::IsWindowFullscreen(*i)) {
- // Ignore fullscreen windows if we're in the desktop. Such a state
- // is transitory and means we haven't yet switched. If we did consider
- // such windows we'll return the wrong thing, which can lead to
- // prematurely anging the launcher state and clobbering restore bounds.
- return WORKSPACE_WINDOW_STATE_FULL_SCREEN;
+ // Ignore maximized/fullscreen windows if we're in the desktop. Such a state
+ // is transitory and means we haven't yet switched. If we did consider such
+ // windows we'll return the wrong thing, which can lead to prematurely
+ // changing the launcher state and clobbering restore bounds.
+ if (is_active_maximized) {
+ if (wm::IsWindowMaximized(*i)) {
+ // An untracked window may still be fullscreen so we keep iterating when
+ // we hit a maximized window.
+ has_maximized_window = true;
+ } else if (wm::IsWindowFullscreen(*i)) {
+ return WORKSPACE_WINDOW_STATE_FULL_SCREEN;
+ }
}
if (!window_overlaps_launcher && (*i)->bounds().Intersects(shelf_bounds))
window_overlaps_launcher = true;
@@ -208,25 +220,24 @@ void WorkspaceManager::SetActiveWorkspaceByWindow(Window* window) {
// out of would disappear since the workspace changed). Since this case is
// only transiently used (property reset on input release) we don't worry
// about window state. In fact we can't consider window state here as we
- // have to allow dragging of a fullscreen window to work in this case.
+ // have to allow dragging of a maximized window to work in this case.
// . The window persists across all workspaces. For example, the task
// manager is in the desktop worskpace and the current workspace is
- // fullscreen. If we swapped to the desktop you would lose context.
- // Instead we reparent. The exception to this is if the window is
- // fullscreen (it needs its own workspace then) or we're in the process of
- // fullscreen. If we're in the process of fullscreen the window needs its
- // own workspace.
+ // maximized. If we swapped to the desktop you would lose context. Instead
+ // we reparent. The exception to this is if the window is maximized (it
+ // needs its own workspace then) or we're in the process of maximizing. If
+ // we're in the process of maximizing the window needs its own workspace.
if (!GetTrackedByWorkspace(window) ||
- (GetPersistsAcrossAllWorkspaces(window) &&
- !wm::IsWindowFullscreen(window) && !WillRestoreToWorkspace(window))) {
+ (GetPersistsAcrossAllWorkspaces(window) && !IsMaximized(window) &&
+ !(wm::IsWindowMinimized(window) && WillRestoreMaximized(window)))) {
ReparentWindow(window, active_workspace_->window(), NULL);
} else {
SetActiveWorkspace(workspace, SWITCH_WINDOW_MADE_ACTIVE,
base::TimeDelta());
}
}
- if (workspace->is_fullscreen() && wm::IsWindowFullscreen(window)) {
- // Clicking on the fullscreen window in a fullscreen workspace. Force all
+ if (workspace->is_maximized() && IsMaximized(window)) {
+ // Clicking on the maximized window in a maximized workspace. Force all
// other windows to drop to the desktop.
MoveChildrenToDesktop(workspace->window(), NULL);
}
@@ -239,7 +250,7 @@ Window* WorkspaceManager::GetActiveWorkspaceWindow() {
Window* WorkspaceManager::GetParentForNewWindow(Window* window) {
// Try to put windows with transient parents in the same workspace as their
// transient parent.
- if (window->transient_parent() && !wm::IsWindowFullscreen(window)) {
+ if (window->transient_parent() && !IsMaximized(window)) {
Workspace* workspace = FindBy(window->transient_parent());
if (workspace)
return workspace->window();
@@ -249,7 +260,7 @@ Window* WorkspaceManager::GetParentForNewWindow(Window* window) {
if (!GetTrackedByWorkspace(window))
return active_workspace_->window();
- if (wm::IsWindowFullscreen(window)) {
+ if (IsMaximized(window)) {
// Wait for the window to be made active before showing the workspace.
Workspace* workspace = CreateWorkspace(true);
pending_workspaces_.insert(workspace);
@@ -287,7 +298,7 @@ void WorkspaceManager::SetActiveWorkspaceFromCycler(Workspace* workspace) {
}
void WorkspaceManager::DoInitialAnimation() {
- if (active_workspace_->is_fullscreen()) {
+ if (active_workspace_->is_maximized()) {
RootWindowController* root_controller = GetRootWindowController(
contents_window_->GetRootWindow());
if (root_controller) {
@@ -351,17 +362,17 @@ void WorkspaceManager::SetActiveWorkspace(Workspace* workspace,
active_workspace_->workspace_layout_manager()->
OnDisplayWorkAreaInsetsChanged();
- const bool is_unminimizing_fullscreen_window =
+ const bool is_unminimizing_maximized_window =
unminimizing_workspace_ && unminimizing_workspace_ == active_workspace_ &&
- active_workspace_->is_fullscreen();
- if (is_unminimizing_fullscreen_window) {
+ active_workspace_->is_maximized();
+ if (is_unminimizing_maximized_window) {
// If we're unminimizing a window it needs to be on the top, otherwise you
// won't see the animation.
contents_window_->StackChildAtTop(active_workspace_->window());
- } else if (active_workspace_->is_fullscreen() &&
- last_active->is_fullscreen() &&
- reason != SWITCH_FULLSCREEN_FROM_FULLSCREEN_WORKSPACE) {
- // When switching between fullscreen windows we need the last active
+ } else if (active_workspace_->is_maximized() &&
+ last_active->is_maximized() &&
+ reason != SWITCH_MAXIMIZED_FROM_MAXIMIZED_WORKSPACE) {
+ // When switching between maximized windows we need the last active
// workspace on top of the new, otherwise the animations won't look
// right. Since only one workspace is visible at a time stacking order of
// the workspace windows ultimately doesn't matter.
@@ -371,7 +382,7 @@ void WorkspaceManager::SetActiveWorkspace(Workspace* workspace,
UpdateShelfVisibility();
// NOTE: duration supplied to this method is only used for desktop background.
- HideWorkspace(last_active, reason, is_unminimizing_fullscreen_window);
+ HideWorkspace(last_active, reason, is_unminimizing_maximized_window);
ShowWorkspace(workspace, last_active, reason);
RootWindowController* root_controller = GetRootWindowController(
@@ -396,8 +407,8 @@ WorkspaceManager::FindWorkspace(Workspace* workspace) {
return std::find(workspaces_.begin(), workspaces_.end(), workspace);
}
-Workspace* WorkspaceManager::CreateWorkspace(bool fullscreen) {
- return new Workspace(this, contents_window_, fullscreen);
+Workspace* WorkspaceManager::CreateWorkspace(bool maximized) {
+ return new Workspace(this, contents_window_, maximized);
}
void WorkspaceManager::MoveWorkspaceToPendingOrDelete(
@@ -440,13 +451,13 @@ void WorkspaceManager::MoveWorkspaceToPendingOrDelete(
void WorkspaceManager::MoveChildrenToDesktop(aura::Window* window,
aura::Window* stack_beneath) {
- // Build the list of windows to move. Exclude fullscreen and windows with
- // transient parents.
+ // Build the list of windows to move. Exclude maximized/fullscreen and windows
+ // with transient parents.
Window::Windows to_move;
for (size_t i = 0; i < window->children().size(); ++i) {
Window* child = window->children()[i];
- if (!child->transient_parent() && !wm::IsWindowFullscreen(child) &&
- !WillRestoreToWorkspace(child)) {
+ if (!child->transient_parent() && !IsMaximized(child) &&
+ !WillRestoreMaximized(child)) {
to_move.push_back(child);
}
}
@@ -538,11 +549,8 @@ void WorkspaceManager::ShowOrHideDesktopBackground(
case SWITCH_WORKSPACE_CYCLER:
// The workspace cycler has already animated the desktop background's
// opacity. Do not do any further animation.
- case SWITCH_BACKGROUND_ONLY_WITHIN_DESKTOP:
- // The show/hide of background may happen within the desktop workspace
- // for maximized windows. In that case no animation is needed.
break;
- case SWITCH_FULLSCREEN_FROM_FULLSCREEN_WORKSPACE:
+ case SWITCH_MAXIMIZED_FROM_MAXIMIZED_WORKSPACE:
case SWITCH_MAXIMIZED_OR_RESTORED:
// FadeDesktop() fades the desktop background by animating the opacity of
// a black window immediately above the desktop background. Set the
@@ -600,7 +608,7 @@ void WorkspaceManager::ShowWorkspace(
void WorkspaceManager::HideWorkspace(
Workspace* workspace,
SwitchReason reason,
- bool is_unminimizing_fullscreen_window) const {
+ bool is_unminimizing_maximized_window) const {
WorkspaceAnimationDetails details;
details.direction = active_workspace_ == desktop_workspace() ?
WORKSPACE_ANIMATE_UP : WORKSPACE_ANIMATE_DOWN;
@@ -610,7 +618,7 @@ void WorkspaceManager::HideWorkspace(
details.animate_opacity =
((active_workspace_ == desktop_workspace() ||
workspace != desktop_workspace()) &&
- !is_unminimizing_fullscreen_window);
+ !is_unminimizing_maximized_window);
details.animate_scale = true;
details.animate = true;
break;
@@ -622,9 +630,9 @@ void WorkspaceManager::HideWorkspace(
details.animate_scale = true;
break;
- case SWITCH_FULLSCREEN_FROM_FULLSCREEN_WORKSPACE:
+ case SWITCH_MAXIMIZED_FROM_MAXIMIZED_WORKSPACE:
case SWITCH_MAXIMIZED_OR_RESTORED:
- if (active_workspace_->is_fullscreen()) {
+ if (active_workspace_->is_maximized()) {
// Delay the hide until the animation is done.
details.duration =
base::TimeDelta::FromMilliseconds(kCrossFadeSwitchTimeMS);
@@ -681,20 +689,6 @@ void WorkspaceManager::OnWillRemoveWindowFromWorkspace(Workspace* workspace,
void WorkspaceManager::OnWindowRemovedFromWorkspace(Workspace* workspace,
Window* child) {
- // Reappear the background which was hidden when a window is maximized.
- if (wm::IsWindowMaximized(child) && workspace == active_workspace_ &&
- GetWindowState() != WORKSPACE_WINDOW_STATE_MAXIMIZED) {
- RootWindowController* root_controller = GetRootWindowController(
- workspace->window()->GetRootWindow());
- aura::Window* background = root_controller->GetContainer(
- kShellWindowId_DesktopBackgroundContainer);;
- ShowOrHideDesktopBackground(
- background,
- SWITCH_BACKGROUND_ONLY_WITHIN_DESKTOP,
- base::TimeDelta(),
- true);
- }
-
if (workspace->ShouldMoveToPending())
MoveWorkspaceToPendingOrDelete(workspace, NULL, SWITCH_WINDOW_REMOVED);
UpdateShelfVisibility();
@@ -731,51 +725,25 @@ void WorkspaceManager::OnWorkspaceWindowShowStateChanged(
ui::Layer* old_layer) {
// |child| better still be in |workspace| else things have gone wrong.
DCHECK_EQ(workspace, child->GetProperty(kWorkspaceKey));
-
- if (active_workspace_ == workspace) {
- // Show/hide state of the background has to be set here since maximized
- // window doesn't create its own workspace anymore.
- RootWindowController* root_controller = GetRootWindowController(
- contents_window_->GetRootWindow());
- aura::Window* background = root_controller->GetContainer(
- kShellWindowId_DesktopBackgroundContainer);
- if (wm::IsWindowMaximized(child)) {
- ShowOrHideDesktopBackground(
- background,
- last_show_state == ui::SHOW_STATE_MINIMIZED ?
- SWITCH_MAXIMIZED_OR_RESTORED :
- SWITCH_BACKGROUND_ONLY_WITHIN_DESKTOP,
- base::TimeDelta(),
- false);
- } else if (last_show_state == ui::SHOW_STATE_MAXIMIZED &&
- GetWindowState() != WORKSPACE_WINDOW_STATE_MAXIMIZED) {
- ShowOrHideDesktopBackground(
- background,
- SWITCH_BACKGROUND_ONLY_WITHIN_DESKTOP,
- base::TimeDelta(),
- true);
- }
- }
-
if (wm::IsWindowMinimized(child)) {
if (workspace->ShouldMoveToPending())
MoveWorkspaceToPendingOrDelete(workspace, NULL, SWITCH_MINIMIZED);
DCHECK(!old_layer);
} else {
// Set of cases to deal with:
- // . More than one fullscreen window: move newly fullscreen window into
+ // . More than one maximized window: move newly maximized window into
// own workspace.
- // . One fullscreen window and not in a fullscreen workspace: move window
+ // . One maximized window and not in a maximized workspace: move window
// into own workspace.
- // . No fullscreen window and not in desktop: move to desktop and further
+ // . No maximized window and not in desktop: move to desktop and further
// any existing windows are stacked beneath |child|.
const bool is_active = wm::IsActiveWindow(child);
Workspace* new_workspace = NULL;
- const int full_count = workspace->GetNumFullscreenWindows();
- base::TimeDelta duration = (old_layer && !wm::IsWindowFullscreen(child)) ?
+ const int max_count = workspace->GetNumMaximizedWindows();
+ base::TimeDelta duration = old_layer && !IsMaximized(child) ?
GetCrossFadeDuration(old_layer->bounds(), child->bounds()) :
base::TimeDelta::FromMilliseconds(kCrossFadeSwitchTimeMS);
- if (full_count == 0) {
+ if (max_count == 0) {
if (workspace != desktop_workspace()) {
{
base::AutoReset<bool> setter(&in_move_, true);
@@ -790,8 +758,8 @@ void WorkspaceManager::OnWorkspaceWindowShowStateChanged(
if (FindWorkspace(workspace) == workspaces_.end())
workspace = NULL;
}
- } else if ((full_count == 1 && workspace == desktop_workspace()) ||
- full_count > 1) {
+ } else if ((max_count == 1 && workspace == desktop_workspace()) ||
+ max_count > 1) {
new_workspace = CreateWorkspace(true);
pending_workspaces_.insert(new_workspace);
ReparentWindow(child, new_workspace->window(), NULL);
@@ -802,8 +770,8 @@ void WorkspaceManager::OnWorkspaceWindowShowStateChanged(
// active.
if (old_layer) {
SetActiveWorkspace(new_workspace,
- full_count >= 2 ?
- SWITCH_FULLSCREEN_FROM_FULLSCREEN_WORKSPACE :
+ max_count >= 2 ?
+ SWITCH_MAXIMIZED_FROM_MAXIMIZED_WORKSPACE :
SWITCH_MAXIMIZED_OR_RESTORED,
duration);
CrossFadeWindowBetweenWorkspaces(new_workspace->window(), child,
@@ -827,14 +795,13 @@ void WorkspaceManager::OnWorkspaceWindowShowStateChanged(
void WorkspaceManager::OnTrackedByWorkspaceChanged(Workspace* workspace,
aura::Window* window) {
Workspace* new_workspace = NULL;
- if (wm::IsWindowFullscreen(window)) {
- if (workspace->is_fullscreen() &&
- workspace->GetNumFullscreenWindows() == 1) {
- // If |window| is the only window in a fullscreen workspace then leave
+ if (IsMaximized(window)) {
+ if (workspace->is_maximized() && workspace->GetNumMaximizedWindows() == 1) {
+ // If |window| is the only window in a maximized workspace then leave
// it there. Additionally animate it back to the origin.
ui::ScopedLayerAnimationSettings settings(window->layer()->GetAnimator());
// All bounds changes get routed through WorkspaceLayoutManager and since
- // the window is fullscreen WorkspaceLayoutManager is going to force a
+ // the window is maximized WorkspaceLayoutManager is going to force a
// value. In other words, it doesn't matter what we supply to SetBounds()
// here.
window->SetBounds(gfx::Rect());
@@ -842,7 +809,7 @@ void WorkspaceManager::OnTrackedByWorkspaceChanged(Workspace* workspace,
}
new_workspace = CreateWorkspace(true);
pending_workspaces_.insert(new_workspace);
- } else if (workspace->is_fullscreen()) {
+ } else if (workspace->is_maximized()) {
new_workspace = desktop_workspace();
} else {
return;
diff --git a/ash/wm/workspace/workspace_manager.h b/ash/wm/workspace/workspace_manager.h
index f070e62..3fca5ec 100644
--- a/ash/wm/workspace/workspace_manager.h
+++ b/ash/wm/workspace/workspace_manager.h
@@ -58,9 +58,14 @@ class ASH_EXPORT WorkspaceManager : public ash::ShellObserver {
explicit WorkspaceManager(aura::Window* viewport);
virtual ~WorkspaceManager();
- // Returns true if |window| is minimized and will restore to a window which
- // exists in its own workspace.
- static bool WillRestoreToWorkspace(aura::Window* window);
+ // Returns true if |window| is considered maximized and should exist in its
+ // own workspace.
+ static bool IsMaximized(aura::Window* window);
+ static bool IsMaximizedState(ui::WindowShowState state);
+
+ // Returns true if |window| is minimized and will restore to a maximized
+ // window.
+ static bool WillRestoreMaximized(aura::Window* window);
// Returns the current window state.
WorkspaceWindowState GetWindowState() const;
@@ -111,13 +116,10 @@ class ASH_EXPORT WorkspaceManager : public ash::ShellObserver {
SWITCH_WINDOW_MADE_ACTIVE,
SWITCH_WINDOW_REMOVED,
SWITCH_VISIBILITY_CHANGED,
- SWITCH_BACKGROUND_ONLY_WITHIN_DESKTOP,
SWITCH_MINIMIZED,
SWITCH_MAXIMIZED_OR_RESTORED,
- // Switch a normal window in a fullscreen workspace to get fullscreen.
- // TODO(mukai): this should be removed in the future. Normal windows should
- // not be in a fullscreen workspace. See crbug.com/249154
- SWITCH_FULLSCREEN_FROM_FULLSCREEN_WORKSPACE,
+ // Switch a normal window in a maximized workspace to maximized.
+ SWITCH_MAXIMIZED_FROM_MAXIMIZED_WORKSPACE,
SWITCH_TRACKED_BY_WORKSPACE_CHANGED,
// Switch as the result of DoInitialAnimation(). This isn't a real switch,
@@ -155,7 +157,7 @@ class ASH_EXPORT WorkspaceManager : public ash::ShellObserver {
// Creates a new workspace. The Workspace is not added to anything and is
// owned by the caller.
- Workspace* CreateWorkspace(bool fullscren);
+ Workspace* CreateWorkspace(bool maximized);
// Moves all the non-maximized child windows of |workspace| to the desktop
// stacked beneath |stack_beneath| (if non-NULL). After moving child windows
diff --git a/ash/wm/workspace/workspace_manager_unittest.cc b/ash/wm/workspace/workspace_manager_unittest.cc
index 60e3fdf..01ad2cb 100644
--- a/ash/wm/workspace/workspace_manager_unittest.cc
+++ b/ash/wm/workspace/workspace_manager_unittest.cc
@@ -144,19 +144,12 @@ class WorkspaceManagerTest : public test::AshTestBase {
return shelf_layout_manager()->window_overlaps_shelf();
}
- bool IsBackgroundVisible(aura::Window* window) {
- RootWindowController* controller = RootWindowController::ForWindow(window);
- aura::Window* background =
- controller->GetContainer(kShellWindowId_DesktopBackgroundContainer);
- return background->IsVisible();
- }
-
Workspace* FindBy(aura::Window* window) const {
return manager_->FindBy(window);
}
std::string WorkspaceStateString(Workspace* workspace) {
- return (workspace->is_fullscreen() ? "F" : "") +
+ return (workspace->is_maximized() ? "M" : "") +
base::IntToString(static_cast<int>(
workspace->window()->children().size()));
}
@@ -170,14 +163,14 @@ class WorkspaceManagerTest : public test::AshTestBase {
// Returns a string description of the current state. The string has the
// following format:
// W* P=W* active=N
- // Each W corresponds to a workspace. Each workspace is prefixed with an 'F'
- // if the workspace is fullscreen and is followed by the number of windows in
+ // Each W corresponds to a workspace. Each workspace is prefixed with an 'M'
+ // if the workspace is maximized and is followed by the number of windows in
// the workspace.
// 'P=' is used for the pending workspaces (see
// WorkspaceManager::pending_workspaces_ for details on pending workspaces).
// N is the index of the active workspace (index into
// WorkspaceManager::workspaces_).
- // For example, '2 F1 P=F1 active=1' means the first workspace (the desktop)
+ // For example, '2 M1 P=M1 active=1' means the first workspace (the desktop)
// has 2 windows, the second workspace is a maximized workspace with 1 window,
// there is a pending maximized workspace with 1 window and the second
// workspace is active.
@@ -267,9 +260,9 @@ TEST_F(WorkspaceManagerTest, SingleMaximizeWindow) {
EXPECT_TRUE(wm::IsActiveWindow(w1.get()));
- // Should be 1 workspace, maximized window doesn't create its own workspace.
- ASSERT_EQ("1 active=0", StateString());
- EXPECT_EQ(w1.get(), workspaces()[0]->window()->children()[0]);
+ // Should be 2 workspaces, the second maximized with w1.
+ ASSERT_EQ("0 M1 active=1", StateString());
+ EXPECT_EQ(w1.get(), workspaces()[1]->window()->children()[0]);
EXPECT_EQ(ScreenAsh::GetMaximizedWindowBoundsInParent(w1.get()).width(),
w1->bounds().width());
EXPECT_EQ(ScreenAsh::GetMaximizedWindowBoundsInParent(w1.get()).height(),
@@ -278,6 +271,8 @@ TEST_F(WorkspaceManagerTest, SingleMaximizeWindow) {
// Restore the window.
w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL);
+ // Should be 1 workspace for the desktop.
+ ASSERT_EQ("1 active=0", StateString());
EXPECT_EQ(w1.get(), workspaces()[0]->window()->children()[0]);
EXPECT_EQ("0,0 250x251", w1->bounds().ToString());
}
@@ -288,13 +283,13 @@ TEST_F(WorkspaceManagerTest, CloseLastWindowInWorkspace) {
scoped_ptr<Window> w2(CreateTestWindow());
w1->SetBounds(gfx::Rect(0, 0, 250, 251));
w1->Show();
- w2->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN);
+ w2->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED);
w2->Show();
wm::ActivateWindow(w1.get());
- // Should be 1 workspace and 1 pending, !fullscreen and fullsceen. The second
+ // Should be 1 workspace and 1 pending, !maximized and maximized. The second
// workspace is pending since the window wasn't active.
- ASSERT_EQ("1 P=F1 active=0", StateString());
+ ASSERT_EQ("1 P=M1 active=0", StateString());
EXPECT_EQ(w1.get(), workspaces()[0]->window()->children()[0]);
// Close w2.
@@ -306,51 +301,11 @@ TEST_F(WorkspaceManagerTest, CloseLastWindowInWorkspace) {
EXPECT_TRUE(w1->IsVisible());
}
-TEST_F(WorkspaceManagerTest, BackgroundWithMaximizedWindow) {
- scoped_ptr<Window> w1(CreateTestWindow());
- scoped_ptr<Window> w2(CreateTestWindow());
- scoped_ptr<Window> w3(CreateTestWindow());
- w1->SetBounds(gfx::Rect(0, 0, 250, 251));
- w1->Show();
- w2->SetBounds(gfx::Rect(0, 0, 250, 251));
- w2->Show();
- w3->SetBounds(gfx::Rect(0, 0, 250, 251));
- w3->Show();
- wm::ActivateWindow(w1.get());
- wm::ActivateWindow(w2.get());
- wm::ActivateWindow(w3.get());
- EXPECT_TRUE(IsBackgroundVisible(w1.get()));
-
- w2->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED);
- EXPECT_FALSE(IsBackgroundVisible(w1.get()));
-
- w3->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED);
- EXPECT_FALSE(IsBackgroundVisible(w1.get()));
-
- w2->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MINIMIZED);
- EXPECT_FALSE(IsBackgroundVisible(w1.get()));
-
- w3->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MINIMIZED);
- EXPECT_TRUE(IsBackgroundVisible(w1.get()));
-
- w2->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED);
- EXPECT_FALSE(IsBackgroundVisible(w1.get()));
-
- w3->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED);
- EXPECT_FALSE(IsBackgroundVisible(w1.get()));
-
- w2.reset();
- EXPECT_FALSE(IsBackgroundVisible(w1.get()));
-
- w3.reset();
- EXPECT_TRUE(IsBackgroundVisible(w1.get()));
-}
-
-// Assertions around adding a fullscreen window when empty.
-TEST_F(WorkspaceManagerTest, AddFullscreenWindowWhenEmpty) {
+// Assertions around adding a maximized window when empty.
+TEST_F(WorkspaceManagerTest, AddMaximizedWindowWhenEmpty) {
scoped_ptr<Window> w1(CreateTestWindow());
w1->SetBounds(gfx::Rect(0, 0, 250, 251));
- w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN);
+ w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED);
w1->Show();
wm::ActivateWindow(w1.get());
@@ -362,12 +317,12 @@ TEST_F(WorkspaceManagerTest, AddFullscreenWindowWhenEmpty) {
EXPECT_EQ(work_area.height(), w1->bounds().height());
// Should be 2 workspaces (since we always keep the desktop).
- ASSERT_EQ("0 F1 active=1", StateString());
+ ASSERT_EQ("0 M1 active=1", StateString());
EXPECT_EQ(w1.get(), workspaces()[1]->window()->children()[0]);
}
-// Assertions around two windows and toggling one to be fullscreen.
-TEST_F(WorkspaceManagerTest, FullscreenWithNormalWindow) {
+// Assertions around two windows and toggling one to be maximized.
+TEST_F(WorkspaceManagerTest, MaximizeWithNormalWindow) {
scoped_ptr<Window> w1(CreateTestWindow());
scoped_ptr<Window> w2(CreateTestWindow());
w1->SetBounds(gfx::Rect(0, 0, 250, 251));
@@ -377,17 +332,16 @@ TEST_F(WorkspaceManagerTest, FullscreenWithNormalWindow) {
EXPECT_TRUE(w1->layer()->visible());
w2->SetBounds(gfx::Rect(0, 0, 50, 51));
- w2->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN);
+ w2->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED);
w2->Show();
wm::ActivateWindow(w2.get());
// Should now be two workspaces.
- ASSERT_EQ("1 F1 active=1", StateString());
+ ASSERT_EQ("1 M1 active=1", StateString());
EXPECT_EQ(w1.get(), workspaces()[0]->window()->children()[0]);
EXPECT_EQ(w2.get(), workspaces()[1]->window()->children()[0]);
- gfx::Rect work_area(
- ScreenAsh::GetMaximizedWindowBoundsInParent(w1.get()));
+ gfx::Rect work_area(ScreenAsh::GetMaximizedWindowBoundsInParent(w1.get()));
EXPECT_EQ(work_area.width(), w2->bounds().width());
EXPECT_EQ(work_area.height(), w2->bounds().height());
@@ -401,26 +355,26 @@ TEST_F(WorkspaceManagerTest, FullscreenWithNormalWindow) {
EXPECT_TRUE(wm::IsActiveWindow(w2.get()));
}
-// Assertions around two fullscreen windows.
-TEST_F(WorkspaceManagerTest, TwoFullscreen) {
+// Assertions around two maximized windows.
+TEST_F(WorkspaceManagerTest, TwoMaximized) {
scoped_ptr<Window> w1(CreateTestWindow());
scoped_ptr<Window> w2(CreateTestWindow());
w1->SetBounds(gfx::Rect(0, 0, 250, 251));
w1->Show();
wm::ActivateWindow(w1.get());
- w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN);
- ASSERT_EQ("1 F1 active=1", StateString());
+ w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED);
+ ASSERT_EQ("1 M1 active=1", StateString());
w2->SetBounds(gfx::Rect(0, 0, 50, 51));
w2->Show();
wm::ActivateWindow(w2.get());
- ASSERT_EQ("1 F1 active=0", StateString());
+ ASSERT_EQ("1 M1 active=0", StateString());
- w2->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN);
+ w2->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED);
EXPECT_TRUE(wm::IsActiveWindow(w2.get()));
- ASSERT_EQ("0 F1 F1 active=2", StateString());
+ ASSERT_EQ("0 M1 M1 active=2", StateString());
- // The last stacked window (|w2|) should be last since it was fullscreen last.
+ // The last stacked window (|w2|) should be last since it was maximized last.
EXPECT_EQ(w1.get(), workspaces()[1]->window()->children()[0]);
EXPECT_EQ(w2.get(), workspaces()[2]->window()->children()[0]);
}
@@ -439,28 +393,28 @@ size_t IndexOfLayerInParent(ui::Layer* layer) {
}
// Make sure that the layer z-order is correct for the time of the animation
-// when in a workspace with a normal and a fullscreen window the normal window
-// gets fullscreen. See crbug.com/232399.
-TEST_F(WorkspaceManagerTest, FullscreenSecondInWorkspace) {
- // Create a fullscreen window.
+// when in a workspace with a normal and a maximized window the normal window
+// gets maximized. See crbug.com/232399.
+TEST_F(WorkspaceManagerTest, MaximizeSecondInWorkspace) {
+ // Create a maximized window.
scoped_ptr<Window> w1(CreateTestWindow());
ASSERT_EQ(1U, w1->layer()->parent()->children().size());
w1->SetBounds(gfx::Rect(0, 0, 250, 251));
w1->Show();
wm::ActivateWindow(w1.get());
- w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN);
+ w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED);
wm::ActivateWindow(w1.get());
- // There are two workspaces: A normal and a fullscreen one.
- ASSERT_EQ("0 F1 active=1", StateString());
+ // There are two workspaces: A normal and a maximized one.
+ ASSERT_EQ("0 M1 active=1", StateString());
- // Create a second window and make it part of the fullscreen workspace.
+ // Create a second window and make it part of the maximized workspace.
scoped_ptr<Window> w2(CreateAppTestWindow(w1->parent()));
w2->SetBounds(gfx::Rect(0, 0, 50, 51));
w2->Show();
wm::ActivateWindow(w2.get());
- // There are still two workspaces and two windows in the (fullscreen)
+ // There are still two workspaces and two windows in the (maximized)
// workspace.
- ASSERT_EQ("0 F2 active=1", StateString());
+ ASSERT_EQ("0 M2 active=1", StateString());
ASSERT_EQ(w1->layer()->parent()->children()[0], w1->layer());
ASSERT_EQ(w1->layer()->parent()->children()[1], w2->layer());
@@ -473,11 +427,11 @@ TEST_F(WorkspaceManagerTest, FullscreenSecondInWorkspace) {
ui::Layer* old_w2_layer = w2->layer();
// Maximize the second window and make sure that the workspace changes.
- w2->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN);
+ w2->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED);
- // Check the correct window hierarchy - (|w2|) should be last since it got
- // fullscreen last.
- ASSERT_EQ("0 F1 F1 active=2", StateString());
+ // Check the correct window hierarchy - (|w2|) should be last since it was
+ // maximized last.
+ ASSERT_EQ("0 M1 M1 active=2", StateString());
EXPECT_EQ(3U, workspaces().size());
EXPECT_EQ(w1.get(), workspaces()[1]->window()->children()[0]);
EXPECT_EQ(w2.get(), workspaces()[2]->window()->children()[0]);
@@ -540,8 +494,8 @@ TEST_F(WorkspaceManagerTest, SingleFullscreenWindow) {
w1->Show();
wm::ActivateWindow(w1.get());
- // Should be 2 workspaces, normal and fullscreen.
- ASSERT_EQ("0 F1 active=1", StateString());
+ // Should be 2 workspaces, normal and maximized.
+ ASSERT_EQ("0 M1 active=1", StateString());
EXPECT_EQ(w1.get(), workspaces()[1]->window()->children()[0]);
EXPECT_EQ(GetFullscreenBounds(w1.get()).width(), w1->bounds().width());
EXPECT_EQ(GetFullscreenBounds(w1.get()).height(), w1->bounds().height());
@@ -559,7 +513,7 @@ TEST_F(WorkspaceManagerTest, SingleFullscreenWindow) {
// Back to fullscreen.
w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN);
- ASSERT_EQ("0 F1 active=1", StateString());
+ ASSERT_EQ("0 M1 active=1", StateString());
EXPECT_EQ(w1.get(), workspaces()[1]->window()->children()[0]);
EXPECT_EQ(GetFullscreenBounds(w1.get()).width(), w1->bounds().width());
EXPECT_EQ(GetFullscreenBounds(w1.get()).height(), w1->bounds().height());
@@ -579,7 +533,7 @@ TEST_F(WorkspaceManagerTest, DontShowTransientsOnSwitch) {
w1->Show();
scoped_ptr<Window> w3(CreateTestWindow());
- w3->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN);
+ w3->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED);
w3->Show();
wm::ActivateWindow(w3.get());
@@ -600,10 +554,10 @@ TEST_F(WorkspaceManagerTest, PersistsTransientChildStayInSameWorkspace) {
SetPersistsAcrossAllWorkspaces(
w1.get(),
WINDOW_PERSISTS_ACROSS_ALL_WORKSPACES_VALUE_YES);
- w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN);
+ w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED);
w1->Show();
wm::ActivateWindow(w1.get());
- ASSERT_EQ("0 F1 active=1", StateString());
+ ASSERT_EQ("0 M1 active=1", StateString());
scoped_ptr<Window> w2(CreateTestWindowUnparented());
w1->AddTransientChild(w2.get());
@@ -614,7 +568,7 @@ TEST_F(WorkspaceManagerTest, PersistsTransientChildStayInSameWorkspace) {
w2->Show();
wm::ActivateWindow(w2.get());
- ASSERT_EQ("0 F2 active=1", StateString());
+ ASSERT_EQ("0 M2 active=1", StateString());
}
// Assertions around minimizing a single window.
@@ -635,31 +589,31 @@ TEST_F(WorkspaceManagerTest, MinimizeSingleWindow) {
EXPECT_TRUE(w1->layer()->IsDrawn());
}
-// Assertions around minimizing a fullscreen window.
-TEST_F(WorkspaceManagerTest, MinimizeFullscreenWindow) {
- // Two windows, w1 normal, w2 fullscreen.
+// Assertions around minimizing a maximized window.
+TEST_F(WorkspaceManagerTest, MinimizeMaximizedWindow) {
+ // Two windows, w1 normal, w2 maximized.
scoped_ptr<Window> w1(CreateTestWindow());
scoped_ptr<Window> w2(CreateTestWindow());
w1->Show();
- w2->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN);
+ w2->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED);
w2->Show();
wm::ActivateWindow(w2.get());
- ASSERT_EQ("1 F1 active=1", StateString());
+ ASSERT_EQ("1 M1 active=1", StateString());
// Minimize w2.
w2->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MINIMIZED);
- ASSERT_EQ("1 P=F1 active=0", StateString());
+ ASSERT_EQ("1 P=M1 active=0", StateString());
EXPECT_TRUE(w1->layer()->IsDrawn());
EXPECT_FALSE(w2->layer()->IsDrawn());
// Show the window, which should trigger unminimizing.
w2->Show();
- ASSERT_EQ("1 P=F1 active=0", StateString());
+ ASSERT_EQ("1 P=M1 active=0", StateString());
wm::ActivateWindow(w2.get());
- ASSERT_EQ("1 F1 active=1", StateString());
+ ASSERT_EQ("1 M1 active=1", StateString());
- EXPECT_TRUE(wm::IsWindowFullscreen(w2.get()));
+ EXPECT_TRUE(wm::IsWindowMaximized(w2.get()));
EXPECT_FALSE(w1->layer()->IsDrawn());
EXPECT_TRUE(w2->layer()->IsDrawn());
@@ -772,7 +726,7 @@ TEST_F(WorkspaceManagerTest, ShelfStateUpdated) {
w2->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED);
w2->Show();
wm::ActivateWindow(w2.get());
- EXPECT_EQ(0, active_index());
+ EXPECT_EQ(1, active_index());
EXPECT_EQ(SHELF_AUTO_HIDE, shelf->visibility_state());
EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->auto_hide_state());
EXPECT_EQ("0,1 101x102", w1->bounds().ToString());
@@ -788,7 +742,7 @@ TEST_F(WorkspaceManagerTest, ShelfStateUpdated) {
// Switch to w2.
wm::ActivateWindow(w2.get());
- EXPECT_EQ(0, active_index());
+ EXPECT_EQ(1, active_index());
EXPECT_EQ(SHELF_AUTO_HIDE, shelf->visibility_state());
EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->auto_hide_state());
EXPECT_EQ("0,1 101x102", w1->bounds().ToString());
@@ -805,37 +759,32 @@ TEST_F(WorkspaceManagerTest, ShelfStateUpdated) {
w1->SetBounds(touches_shelf_bounds);
EXPECT_FALSE(GetWindowOverlapsShelf());
- // Activate w1. Although w1 is visible, the overlap state is still false since
- // w2 is maximized.
+ // Activate w1. Since w1 is visible the overlap state should be true.
wm::ActivateWindow(w1.get());
- EXPECT_FALSE(GetWindowOverlapsShelf());
-
- // Restore w2.
- w2->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL);
EXPECT_TRUE(GetWindowOverlapsShelf());
}
// Verifies persist across all workspaces.
TEST_F(WorkspaceManagerTest, PersistAcrossAllWorkspaces) {
- // Create a fullscreen window.
+ // Create a maximized window.
scoped_ptr<Window> w1(CreateTestWindow());
w1->Show();
- w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN);
+ w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED);
wm::ActivateWindow(w1.get());
- ASSERT_EQ("0 F1 active=1", StateString());
+ ASSERT_EQ("0 M1 active=1", StateString());
// Create a window that persists across all workspaces. It should be placed in
- // the current fullscreen workspace.
+ // the current maximized workspace.
scoped_ptr<Window> w2(CreateTestWindow());
SetPersistsAcrossAllWorkspaces(
w2.get(),
WINDOW_PERSISTS_ACROSS_ALL_WORKSPACES_VALUE_YES);
w2->Show();
- ASSERT_EQ("1 F1 active=1", StateString());
+ ASSERT_EQ("1 M1 active=1", StateString());
// Activate w2, which should move it to the 2nd workspace.
wm::ActivateWindow(w2.get());
- ASSERT_EQ("0 F2 active=1", StateString());
+ ASSERT_EQ("0 M2 active=1", StateString());
// Restoring w2 should drop the persists window back to the desktop, and drop
// it to the bottom of the stack.
@@ -846,18 +795,18 @@ TEST_F(WorkspaceManagerTest, PersistAcrossAllWorkspaces) {
// Repeat, but this time minimize. The minimized window should end up in
// pending.
- w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN);
- ASSERT_EQ("1 P=F1 active=0", StateString());
+ w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED);
+ ASSERT_EQ("1 P=M1 active=0", StateString());
w2.reset(CreateTestWindow());
SetPersistsAcrossAllWorkspaces(
w2.get(),
WINDOW_PERSISTS_ACROSS_ALL_WORKSPACES_VALUE_YES);
w2->Show();
- ASSERT_EQ("1 P=F1 active=0", StateString());
+ ASSERT_EQ("1 P=M1 active=0", StateString());
wm::ActivateWindow(w2.get());
- ASSERT_EQ("1 P=F1 active=0", StateString());
+ ASSERT_EQ("1 P=M1 active=0", StateString());
w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MINIMIZED);
- ASSERT_EQ("1 P=F1 active=0", StateString());
+ ASSERT_EQ("1 P=M1 active=0", StateString());
EXPECT_EQ(w2.get(), workspaces()[0]->window()->children()[0]);
}
@@ -875,14 +824,14 @@ TEST_F(WorkspaceManagerTest, ActivatePersistAcrossAllWorkspacesWhenNotActive) {
// Create a maximized window.
scoped_ptr<Window> w1(CreateTestWindow());
w1->Show();
- w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN);
+ w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED);
wm::ActivateWindow(w1.get());
- ASSERT_EQ("1 F1 active=1", StateString());
+ ASSERT_EQ("1 M1 active=1", StateString());
// Activate the persists across all workspace window. It should move to the
// current workspace.
wm::ActivateWindow(w2.get());
- ASSERT_EQ("0 F2 active=1", StateString());
+ ASSERT_EQ("0 M2 active=1", StateString());
// The window that persists across all workspaces should be moved to the top
// of the stacking order.
EXPECT_EQ(w1.get(), workspaces()[1]->window()->children()[0]);
@@ -906,9 +855,9 @@ TEST_F(WorkspaceManagerTest, ShowMinimizedPersistWindow) {
EXPECT_TRUE(w1->IsVisible());
}
-// Test that a persistent window across all workspaces which got fullscreen
-// first, then got minimized and finally got restored does not crash the
-// system (see http://crbug.com/151698) and restores its fullscreen workspace
+// Test that a persistent window across all workspaces which was first
+// maximized, then got minimized and finally got restored does not crash the
+// system (see http://crbug.com/151698) and restores its maximized workspace
// instead.
TEST_F(WorkspaceManagerTest, MaximizeMinimizeRestoreDoesNotCrash) {
// We need to create a regular window first so there's an active workspace.
@@ -922,14 +871,14 @@ TEST_F(WorkspaceManagerTest, MaximizeMinimizeRestoreDoesNotCrash) {
WINDOW_PERSISTS_ACROSS_ALL_WORKSPACES_VALUE_YES);
w2->Show();
wm::ActivateWindow(w2.get());
- w2->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN);
+ w2->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED);
w2->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MINIMIZED);
EXPECT_FALSE(w2->IsVisible());
- // This is the critical call which should switch to the fullscreen workspace
+ // This is the critical call which should switch to the maximized workspace
// of that window instead of reparenting it to the other workspace (and
// crashing while trying to do so).
wm::ActivateWindow(w2.get());
- EXPECT_EQ(ui::SHOW_STATE_FULLSCREEN,
+ EXPECT_EQ(ui::SHOW_STATE_MAXIMIZED,
w2->GetProperty(aura::client::kShowStateKey));
EXPECT_TRUE(w2->IsVisible());
}
@@ -951,22 +900,22 @@ TEST_F(WorkspaceManagerTest, GetWindowStateWithUnmanagedFullscreenWindow) {
w2->Show();
wm::ActivateWindow(w2.get());
- ASSERT_EQ("1 F1 active=1", StateString());
+ ASSERT_EQ("1 M1 active=1", StateString());
EXPECT_EQ(SHELF_HIDDEN, shelf->visibility_state());
EXPECT_EQ(WORKSPACE_WINDOW_STATE_FULL_SCREEN, manager_->GetWindowState());
w2->Hide();
- ASSERT_EQ("1 P=F1 active=0", StateString());
+ ASSERT_EQ("1 P=M1 active=0", StateString());
EXPECT_EQ(SHELF_VISIBLE, shelf->visibility_state());
w2->Show();
- ASSERT_EQ("1 P=F1 active=0", StateString());
+ ASSERT_EQ("1 P=M1 active=0", StateString());
EXPECT_EQ(SHELF_VISIBLE, shelf->visibility_state());
EXPECT_EQ(WORKSPACE_WINDOW_STATE_DEFAULT, manager_->GetWindowState());
wm::ActivateWindow(w2.get());
- ASSERT_EQ("1 F1 active=1", StateString());
+ ASSERT_EQ("1 M1 active=1", StateString());
EXPECT_EQ(SHELF_HIDDEN, shelf->visibility_state());
EXPECT_EQ(WORKSPACE_WINDOW_STATE_FULL_SCREEN, manager_->GetWindowState());
@@ -977,7 +926,7 @@ TEST_F(WorkspaceManagerTest, GetWindowStateWithUnmanagedFullscreenWindow) {
}
// Variant of GetWindowStateWithUnmanagedFullscreenWindow that uses a maximized
-// window rather than a normal window. It should be same as the normal window.
+// window rather than a normal window.
TEST_F(WorkspaceManagerTest,
GetWindowStateWithUnmanagedFullscreenWindowWithMaximized) {
ShelfLayoutManager* shelf = shelf_layout_manager();
@@ -1016,8 +965,8 @@ TEST_F(WorkspaceManagerTest,
}
// Verifies a window marked as persisting across all workspaces ends up in its
-// own workspace when got fullscreen.
-TEST_F(WorkspaceManagerTest, FullscreenDontPersistEndsUpInOwnWorkspace) {
+// own workspace when maximized.
+TEST_F(WorkspaceManagerTest, MaximizeDontPersistEndsUpInOwnWorkspace) {
scoped_ptr<Window> w1(CreateTestWindow());
SetPersistsAcrossAllWorkspaces(
@@ -1028,8 +977,8 @@ TEST_F(WorkspaceManagerTest, FullscreenDontPersistEndsUpInOwnWorkspace) {
ASSERT_EQ("1 active=0", StateString());
// Maximize should trigger containing the window.
- w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN);
- ASSERT_EQ("0 P=F1 active=0", StateString());
+ w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED);
+ ASSERT_EQ("0 P=M1 active=0", StateString());
// And resetting to normal should remove it.
w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL);
@@ -1049,8 +998,8 @@ TEST_F(WorkspaceManagerTest, MinimizeResetsVisibility) {
EXPECT_FALSE(shelf_widget()->paints_background());
}
-// Verifies transients are moved when fullscreen.
-TEST_F(WorkspaceManagerTest, MoveTransientOnFullscreen) {
+// Verifies transients are moved when maximizing.
+TEST_F(WorkspaceManagerTest, MoveTransientOnMaximize) {
scoped_ptr<Window> w1(CreateTestWindow());
w1->Show();
scoped_ptr<Window> w2(CreateTestWindow());
@@ -1059,8 +1008,8 @@ TEST_F(WorkspaceManagerTest, MoveTransientOnFullscreen) {
wm::ActivateWindow(w1.get());
ASSERT_EQ("2 active=0", StateString());
- w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN);
- ASSERT_EQ("0 F2 active=1", StateString());
+ w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED);
+ ASSERT_EQ("0 M2 active=1", StateString());
EXPECT_TRUE(wm::IsActiveWindow(w1.get()));
// Create another transient child of |w1|. We do this unparented, set up the
@@ -1070,12 +1019,12 @@ TEST_F(WorkspaceManagerTest, MoveTransientOnFullscreen) {
w1->AddTransientChild(w3.get());
SetDefaultParentByPrimaryRootWindow(w3.get());
w3->Show();
- ASSERT_EQ("0 F3 active=1", StateString());
+ ASSERT_EQ("0 M3 active=1", StateString());
// Minimize the window. All the transients are hidden as a result, so it ends
// up in pending.
w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MINIMIZED);
- ASSERT_EQ("0 P=F3 active=0", StateString());
+ ASSERT_EQ("0 P=M3 active=0", StateString());
// Restore and everything should go back to the first workspace.
w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL);
@@ -1089,11 +1038,11 @@ TEST_F(WorkspaceManagerTest, VisibilityTests) {
EXPECT_TRUE(w1->IsVisible());
EXPECT_EQ(1.0f, w1->layer()->GetCombinedOpacity());
- // Create another window, activate it and make it fullscreen.
+ // Create another window, activate it and maximized it.
scoped_ptr<Window> w2(CreateTestWindow());
w2->Show();
wm::ActivateWindow(w2.get());
- w2->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN);
+ w2->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED);
EXPECT_TRUE(w2->IsVisible());
EXPECT_EQ(1.0f, w2->layer()->GetCombinedOpacity());
EXPECT_FALSE(w1->IsVisible());
@@ -1117,21 +1066,21 @@ TEST_F(WorkspaceManagerTest, VisibilityTests) {
EXPECT_TRUE(w2->IsVisible());
EXPECT_EQ(1.0f, w2->layer()->GetCombinedOpacity());
- // Make |w2| fullscreen again, then close it.
- w2->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN);
+ // Maximize |w2| again, then close it.
+ w2->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED);
w2->Hide();
EXPECT_FALSE(w2->IsVisible());
EXPECT_EQ(1.0f, w1->layer()->GetCombinedOpacity());
EXPECT_TRUE(w1->IsVisible());
- // Create |w2| and maximize it.
+ // Create |w2| and make it fullscreen.
w2.reset(CreateTestWindow());
w2->Show();
wm::ActivateWindow(w2.get());
- w2->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED);
+ w2->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN);
EXPECT_TRUE(w2->IsVisible());
EXPECT_EQ(1.0f, w2->layer()->GetCombinedOpacity());
- EXPECT_TRUE(w1->IsVisible());
+ EXPECT_FALSE(w1->IsVisible());
// Close |w2|.
w2.reset();
@@ -1302,19 +1251,19 @@ TEST_F(WorkspaceManagerTest, TransientParent) {
// Verifies changing TrackedByWorkspace works.
TEST_F(WorkspaceManagerTest, TrackedByWorkspace) {
- // Create a fullscreen window.
+ // Create a window maximized.
scoped_ptr<Window> w1(CreateTestWindow());
w1->Show();
wm::ActivateWindow(w1.get());
- w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN);
+ w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED);
EXPECT_TRUE(wm::IsActiveWindow(w1.get()));
EXPECT_TRUE(w1->IsVisible());
- // Create a second fullscreen window and mark it not tracked by workspace
+ // Create a second window maximized and mark it not tracked by workspace
// manager.
scoped_ptr<Window> w2(CreateTestWindowUnparented());
w2->SetBounds(gfx::Rect(1, 6, 25, 30));
- w2->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN);
+ w2->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED);
SetDefaultParentByPrimaryRootWindow(w2.get());
w2->Show();
SetTrackedByWorkspace(w2.get(), false);
@@ -1342,13 +1291,13 @@ TEST_F(WorkspaceManagerTest, TrackedByWorkspace) {
}
// Verifies a window marked as persisting across all workspaces ends up in its
-// own workspace when get fullscreen.
+// own workspace when maximized.
TEST_F(WorkspaceManagerTest, DeactivateDropsToDesktop) {
- // Create a fullscreen window.
+ // Create a window maximized.
scoped_ptr<Window> w1(CreateTestWindow());
w1->Show();
wm::ActivateWindow(w1.get());
- w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN);
+ w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED);
EXPECT_TRUE(wm::IsActiveWindow(w1.get()));
EXPECT_TRUE(w1->IsVisible());
@@ -1361,11 +1310,11 @@ TEST_F(WorkspaceManagerTest, DeactivateDropsToDesktop) {
w2->Show();
wm::ActivateWindow(w2.get());
EXPECT_EQ(w1->parent(), w2->parent());
- ASSERT_EQ("0 F2 active=1", StateString());
+ ASSERT_EQ("0 M2 active=1", StateString());
// Activate |w1|, should result in dropping |w2| to the desktop.
wm::ActivateWindow(w1.get());
- ASSERT_EQ("1 F1 active=1", StateString());
+ ASSERT_EQ("1 M1 active=1", StateString());
}
// Test the basic auto placement of one and or two windows in a "simulated
@@ -1781,10 +1730,10 @@ class DragMaximizedNonTrackedWindowObserver
} // namespace
-// Verifies setting tracked by workspace to false and then dragging a fullscreen
+// Verifies setting tracked by workspace to false and then dragging a maximized
// window doesn't result in changing the window hierarchy (which typically
// indicates new workspaces have been created).
-TEST_F(WorkspaceManagerTest, DragFullscreenNonTrackedWindow) {
+TEST_F(WorkspaceManagerTest, DragMaximizedNonTrackedWindow) {
aura::test::EventGenerator generator(
Shell::GetPrimaryRootWindow(), gfx::Point());
generator.MoveMouseTo(5, 5);
@@ -1797,7 +1746,7 @@ TEST_F(WorkspaceManagerTest, DragFullscreenNonTrackedWindow) {
gfx::Rect(5, 6, 7, 8),
NULL));
SetDefaultParentByPrimaryRootWindow(w1.get());
- w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN);
+ w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED);
w1->Show();
wm::ActivateWindow(w1.get());
DragMaximizedNonTrackedWindowObserver observer;
@@ -1806,65 +1755,14 @@ TEST_F(WorkspaceManagerTest, DragFullscreenNonTrackedWindow) {
// There should be two workspace, one for the desktop and one for the
// maximized window with the maximized active.
- EXPECT_EQ("0 F1 active=1", StateString());
-
- generator.PressLeftButton();
- generator.MoveMouseTo(100, 100);
- // The bounds shouldn't change (drag should result in nothing happening
- // now.
- EXPECT_EQ(max_bounds.ToString(), w1->bounds().ToString());
- EXPECT_EQ("0 F1 active=1", StateString());
-
- generator.ReleaseLeftButton();
- EXPECT_EQ(0, observer.change_count());
-
- // Set tracked to false and repeat, now the window should move.
- SetTrackedByWorkspace(w1.get(), false);
- generator.MoveMouseTo(5, 5);
- generator.PressLeftButton();
- generator.MoveMouseBy(100, 100);
- EXPECT_EQ(gfx::Rect(max_bounds.x() + 100, max_bounds.y() + 100,
- max_bounds.width(), max_bounds.height()).ToString(),
- w1->bounds().ToString());
- EXPECT_EQ("0 F1 active=1", StateString());
-
- generator.ReleaseLeftButton();
- SetTrackedByWorkspace(w1.get(), true);
- // Marking the window tracked again should snap back to origin.
- EXPECT_EQ("0 F1 active=1", StateString());
- EXPECT_EQ(max_bounds.ToString(), w1->bounds().ToString());
- EXPECT_EQ(0, observer.change_count());
-
- w1->parent()->parent()->RemoveObserver(&observer);
-}
-
-// Verifies setting tracked by workspace to false and then dragging a maximized
-// window can change the bound.
-TEST_F(WorkspaceManagerTest, DragMaximizedNonTrackedWindow) {
- aura::test::EventGenerator generator(
- Shell::GetPrimaryRootWindow(), gfx::Point());
- generator.MoveMouseTo(5, 5);
-
- aura::test::TestWindowDelegate delegate;
- delegate.set_window_component(HTCAPTION);
- scoped_ptr<Window> w1(
- aura::test::CreateTestWindowWithDelegate(&delegate,
- aura::client::WINDOW_TYPE_NORMAL,
- gfx::Rect(5, 6, 7, 8),
- NULL));
- SetDefaultParentByPrimaryRootWindow(w1.get());
- w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED);
- w1->Show();
- wm::ActivateWindow(w1.get());
- DragMaximizedNonTrackedWindowObserver observer;
- w1->parent()->parent()->AddObserver(&observer);
- const gfx::Rect max_bounds(w1->bounds());
+ EXPECT_EQ("0 M1 active=1", StateString());
generator.PressLeftButton();
generator.MoveMouseTo(100, 100);
// The bounds shouldn't change (drag should result in nothing happening
// now.
EXPECT_EQ(max_bounds.ToString(), w1->bounds().ToString());
+ EXPECT_EQ("0 M1 active=1", StateString());
generator.ReleaseLeftButton();
EXPECT_EQ(0, observer.change_count());
@@ -1877,10 +1775,12 @@ TEST_F(WorkspaceManagerTest, DragMaximizedNonTrackedWindow) {
EXPECT_EQ(gfx::Rect(max_bounds.x() + 100, max_bounds.y() + 100,
max_bounds.width(), max_bounds.height()).ToString(),
w1->bounds().ToString());
+ EXPECT_EQ("0 M1 active=1", StateString());
generator.ReleaseLeftButton();
SetTrackedByWorkspace(w1.get(), true);
// Marking the window tracked again should snap back to origin.
+ EXPECT_EQ("0 M1 active=1", StateString());
EXPECT_EQ(max_bounds.ToString(), w1->bounds().ToString());
EXPECT_EQ(0, observer.change_count());