summaryrefslogtreecommitdiffstats
path: root/ash/wm
diff options
context:
space:
mode:
authoroshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-13 23:50:55 +0000
committeroshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-13 23:50:55 +0000
commit09faf946bd8464b1b09298b5ec7fc598a42ab360 (patch)
treea5208c05368976323009010b029cc1c83fe2ac71 /ash/wm
parentb9f658bcccdd6b94e4820a61b81c2fd12a51ad59 (diff)
downloadchromium_src-09faf946bd8464b1b09298b5ec7fc598a42ab360.zip
chromium_src-09faf946bd8464b1b09298b5ec7fc598a42ab360.tar.gz
chromium_src-09faf946bd8464b1b09298b5ec7fc598a42ab360.tar.bz2
Move the logic to update bounds for show type from WorkspaceLayoutManager to DefaultState
* Introduced WindowStateObserver::{Pre|Post}WindowShowTypeChange We had implicit dependency between OnWindowShowTypeChanged implementations. This clearly separate the things that should happen before and after the window's bounds is updated. This is another step to introduce state machine. BUG=318325 TEST=no functional change. all tests should pass. TBR=benwells@chromium.org Review URL: https://codereview.chromium.org/149303003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@251191 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/wm')
-rw-r--r--ash/wm/custom_frame_view_ash.cc2
-rw-r--r--ash/wm/default_state.cc271
-rw-r--r--ash/wm/default_state.h12
-rw-r--r--ash/wm/dock/docked_window_layout_manager.cc2
-rw-r--r--ash/wm/dock/docked_window_layout_manager.h4
-rw-r--r--ash/wm/panels/panel_layout_manager.cc2
-rw-r--r--ash/wm/panels/panel_layout_manager.h4
-rw-r--r--ash/wm/resize_handle_window_targeter.cc4
-rw-r--r--ash/wm/resize_handle_window_targeter.h4
-rw-r--r--ash/wm/toplevel_window_event_handler.cc7
-rw-r--r--ash/wm/window_state.cc134
-rw-r--r--ash/wm/window_state.h28
-rw-r--r--ash/wm/window_state_observer.h20
-rw-r--r--ash/wm/wm_types.h19
-rw-r--r--ash/wm/workspace/workspace_layout_manager.cc199
-rw-r--r--ash/wm/workspace/workspace_layout_manager.h12
-rw-r--r--ash/wm/workspace/workspace_layout_manager_unittest.cc2
17 files changed, 457 insertions, 269 deletions
diff --git a/ash/wm/custom_frame_view_ash.cc b/ash/wm/custom_frame_view_ash.cc
index 1db2602..be5886b 100644
--- a/ash/wm/custom_frame_view_ash.cc
+++ b/ash/wm/custom_frame_view_ash.cc
@@ -105,7 +105,7 @@ class CustomFrameViewAshWindowStateDelegate
window_state_ = NULL;
}
// Overridden from ash::wm::WindowStateObserver:
- virtual void OnWindowShowTypeChanged(
+ virtual void OnPostWindowShowTypeChange(
ash::wm::WindowState* window_state,
ash::wm::WindowShowType old_type) OVERRIDE {
if (!window_state->IsFullscreen() &&
diff --git a/ash/wm/default_state.cc b/ash/wm/default_state.cc
index 3787f7f..b6276fb 100644
--- a/ash/wm/default_state.cc
+++ b/ash/wm/default_state.cc
@@ -4,10 +4,17 @@
#include "ash/wm/default_state.h"
+#include "ash/display/display_controller.h"
#include "ash/screen_util.h"
#include "ash/shell.h"
+#include "ash/shell_window_ids.h"
#include "ash/wm/coordinate_conversion.h"
+#include "ash/wm/window_animations.h"
#include "ash/wm/window_state.h"
+#include "ash/wm/window_state_delegate.h"
+#include "ash/wm/window_util.h"
+#include "ash/wm/workspace/workspace_window_resizer.h"
+#include "ui/aura/client/aura_constants.h"
#include "ui/aura/window.h"
#include "ui/aura/window_delegate.h"
#include "ui/gfx/display.h"
@@ -15,12 +22,109 @@
namespace ash {
namespace wm {
+namespace {
+
+bool IsPanel(aura::Window* window) {
+ return window->parent() &&
+ window->parent()->id() == internal::kShellWindowId_DockedContainer;
+}
+
+gfx::Rect BoundsWithScreenEdgeVisible(
+ aura::Window* window,
+ const gfx::Rect& restore_bounds) {
+ gfx::Rect max_bounds =
+ ash::ScreenUtil::GetMaximizedWindowBoundsInParent(window);
+ // If the restore_bounds are more than 1 grid step away from the size the
+ // window would be when maximized, inset it.
+ max_bounds.Inset(ash::internal::WorkspaceWindowResizer::kScreenEdgeInset,
+ ash::internal::WorkspaceWindowResizer::kScreenEdgeInset);
+ if (restore_bounds.Contains(max_bounds))
+ return max_bounds;
+ return restore_bounds;
+}
+
+void MoveToDisplayForRestore(WindowState* window_state) {
+ if (!window_state->HasRestoreBounds())
+ return;
+ const gfx::Rect& restore_bounds = window_state->GetRestoreBoundsInScreen();
+
+ // Move only if the restore bounds is outside of
+ // the display. There is no information about in which
+ // display it should be restored, so this is best guess.
+ // TODO(oshima): Restore information should contain the
+ // work area information like WindowResizer does for the
+ // last window location.
+ gfx::Rect display_area = Shell::GetScreen()->GetDisplayNearestWindow(
+ window_state->window()).bounds();
+
+ if (!display_area.Intersects(restore_bounds)) {
+ const gfx::Display& display =
+ Shell::GetScreen()->GetDisplayMatching(restore_bounds);
+ DisplayController* display_controller =
+ Shell::GetInstance()->display_controller();
+ aura::Window* new_root =
+ display_controller->GetRootWindowForDisplayId(display.id());
+ if (new_root != window_state->window()->GetRootWindow()) {
+ aura::Window* new_container =
+ Shell::GetContainer(new_root, window_state->window()->parent()->id());
+ new_container->AddChild(window_state->window());
+ }
+ }
+}
+
+} // namespace;
DefaultState::DefaultState() {}
DefaultState::~DefaultState() {}
void DefaultState::OnWMEvent(WindowState* window_state,
WMEvent event) {
+ if (ProcessCompoundEvents(window_state, event))
+ return;
+
+ WindowShowType next_show_type = SHOW_TYPE_NORMAL;
+ switch (event) {
+ case NORMAL:
+ next_show_type = SHOW_TYPE_NORMAL;
+ break;
+ case MAXIMIZE:
+ next_show_type = SHOW_TYPE_MAXIMIZED;
+ break;
+ case MINIMIZE:
+ next_show_type = SHOW_TYPE_MINIMIZED;
+ break;
+ case FULLSCREEN:
+ next_show_type = SHOW_TYPE_FULLSCREEN;
+ break;
+ case SNAP_LEFT:
+ next_show_type = SHOW_TYPE_LEFT_SNAPPED;
+ break;
+ case SNAP_RIGHT:
+ next_show_type = SHOW_TYPE_RIGHT_SNAPPED;
+ break;
+ case TOGGLE_MAXIMIZE_CAPTION:
+ case TOGGLE_MAXIMIZE:
+ case TOGGLE_VERTICAL_MAXIMIZE:
+ case TOGGLE_HORIZONTAL_MAXIMIZE:
+ case TOGGLE_FULLSCREEN:
+ NOTREACHED() << "Compound event should not reach here:" << event;
+ return;
+ }
+
+ WindowShowType current = window_state->window_show_type();
+ if (current != next_show_type) {
+ window_state->UpdateWindowShowType(next_show_type);
+ window_state->NotifyPreShowTypeChange(current);
+ // TODO(oshima): Make docked window a state.
+ if (!window_state->IsDocked() && !IsPanel(window_state->window()))
+ UpdateBoundsFromShowType(window_state, current);
+ window_state->NotifyPostShowTypeChange(current);
+ }
+};
+
+// static
+bool DefaultState::ProcessCompoundEvents(WindowState* window_state,
+ WMEvent event) {
aura::Window* window = window_state->window();
switch (event) {
@@ -34,8 +138,7 @@ void DefaultState::OnWMEvent(WindowState* window_state,
if (window_state->CanMaximize())
window_state->Maximize();
}
- break;
-
+ return true;
case TOGGLE_MAXIMIZE:
if (window_state->IsFullscreen())
window_state->ToggleFullscreen();
@@ -43,8 +146,7 @@ void DefaultState::OnWMEvent(WindowState* window_state,
window_state->Restore();
else if (window_state->CanMaximize())
window_state->Maximize();
- break;
-
+ return true;
case TOGGLE_VERTICAL_MAXIMIZE: {
gfx::Rect work_area =
ScreenUtil::GetDisplayWorkAreaBoundsInParent(window);
@@ -56,7 +158,7 @@ void DefaultState::OnWMEvent(WindowState* window_state,
// restored bounds looks weird.
if (window->delegate()->GetMaximumSize().height() != 0 ||
!window_state->IsNormalShowType()) {
- return;
+ return true;
}
if (window_state->HasRestoreBounds() &&
(window->bounds().height() == work_area.height() &&
@@ -69,20 +171,18 @@ void DefaultState::OnWMEvent(WindowState* window_state,
window->bounds().width(),
work_area.height()));
}
- break;
+ return true;
}
case TOGGLE_HORIZONTAL_MAXIMIZE: {
// Maximize horizontally if:
// - The window does not have a max width defined.
// - The window is snapped or has the normal show type.
if (window->delegate()->GetMaximumSize().width() != 0)
- return;
+ return true;
if (!window_state->IsNormalShowType() && !window_state->IsSnapped())
- return;
-
+ return true;
gfx::Rect work_area =
ScreenUtil::GetDisplayWorkAreaBoundsInParent(window);
-
if (window_state->IsNormalShowType() &&
window_state->HasRestoreBounds() &&
(window->bounds().width() == work_area.width() &&
@@ -107,9 +207,158 @@ void DefaultState::OnWMEvent(WindowState* window_state,
window_state->SetRestoreBoundsInParent(restore_bounds);
window->SetBounds(new_bounds);
}
+ return true;
+ }
+ case TOGGLE_FULLSCREEN: {
+ // Window which cannot be maximized should not be fullscreened.
+ // It can, however, be restored if it was fullscreened.
+ bool is_fullscreen = window_state->IsFullscreen();
+ if (!is_fullscreen && !window_state->CanMaximize())
+ return true;
+ if (window_state->delegate() &&
+ window_state->delegate()->ToggleFullscreen(window_state)) {
+ return true;
+ }
+ if (is_fullscreen) {
+ window_state->Restore();
+ } else {
+ //
+ window_state->window()->SetProperty(aura::client::kShowStateKey,
+ ui::SHOW_STATE_FULLSCREEN);
+ }
+ return true;
}
+ case NORMAL:
+ case MAXIMIZE:
+ case MINIMIZE:
+ case FULLSCREEN:
+ case SNAP_LEFT:
+ case SNAP_RIGHT:
+ break;
}
-};
+ return false;
+}
+
+// static
+void DefaultState::UpdateBoundsFromShowType(WindowState* window_state,
+ WindowShowType old_show_type) {
+ aura::Window* window = window_state->window();
+ // Do nothing If this is not yet added to the container.
+ if (!window->parent())
+ return;
+
+ if (old_show_type != SHOW_TYPE_MINIMIZED &&
+ !window_state->HasRestoreBounds() &&
+ window_state->IsMaximizedOrFullscreen() &&
+ !IsMaximizedOrFullscreenWindowShowType(old_show_type)) {
+ window_state->SaveCurrentBoundsForRestore();
+ }
+
+ // When restoring from a minimized state, we want to restore to the previous
+ // bounds. However, we want to maintain the restore bounds. (The restore
+ // bounds are set if a user maximized the window in one axis by double
+ // clicking the window border for example).
+ gfx::Rect restore;
+ if (old_show_type == SHOW_TYPE_MINIMIZED &&
+ window_state->IsNormalShowState() &&
+ window_state->HasRestoreBounds() &&
+ !window_state->unminimize_to_restore_bounds()) {
+ restore = window_state->GetRestoreBoundsInScreen();
+ window_state->SaveCurrentBoundsForRestore();
+ }
+
+ if (window_state->IsMaximizedOrFullscreen())
+ MoveToDisplayForRestore(window_state);
+
+ WindowShowType show_type = window_state->window_show_type();
+ gfx::Rect bounds_in_parent;
+ switch (show_type) {
+ case SHOW_TYPE_DEFAULT:
+ case SHOW_TYPE_NORMAL:
+ case SHOW_TYPE_LEFT_SNAPPED:
+ case SHOW_TYPE_RIGHT_SNAPPED: {
+ gfx::Rect work_area_in_parent =
+ ScreenUtil::GetDisplayWorkAreaBoundsInParent(window_state->window());
+
+ if (window_state->HasRestoreBounds())
+ bounds_in_parent = window_state->GetRestoreBoundsInParent();
+ else
+ bounds_in_parent = window->bounds();
+ // Make sure that part of the window is always visible.
+ AdjustBoundsToEnsureMinimumWindowVisibility(
+ work_area_in_parent, &bounds_in_parent);
+
+ if (show_type == SHOW_TYPE_LEFT_SNAPPED ||
+ show_type == SHOW_TYPE_RIGHT_SNAPPED) {
+ window_state->AdjustSnappedBounds(&bounds_in_parent);
+ } else {
+ bounds_in_parent = BoundsWithScreenEdgeVisible(
+ window,
+ bounds_in_parent);
+ }
+ break;
+ }
+ case SHOW_TYPE_MAXIMIZED:
+ bounds_in_parent = ScreenUtil::GetMaximizedWindowBoundsInParent(window);
+ break;
+
+ case SHOW_TYPE_FULLSCREEN:
+ bounds_in_parent = ScreenUtil::GetDisplayBoundsInParent(window);
+ break;
+
+ case SHOW_TYPE_MINIMIZED:
+ break;
+ case SHOW_TYPE_INACTIVE:
+ case SHOW_TYPE_DETACHED:
+ case SHOW_TYPE_END:
+ case SHOW_TYPE_AUTO_POSITIONED:
+ return;
+ }
+
+ if (show_type != SHOW_TYPE_MINIMIZED) {
+ if (old_show_type == SHOW_TYPE_MINIMIZED ||
+ (window_state->IsFullscreen() &&
+ !window_state->animate_to_fullscreen())) {
+ window_state->SetBoundsDirect(bounds_in_parent);
+ } else if (window_state->IsMaximizedOrFullscreen() ||
+ IsMaximizedOrFullscreenWindowShowType(old_show_type)) {
+ CrossFadeToBounds(window, bounds_in_parent);
+ } else {
+ window_state->SetBoundsDirectAnimated(bounds_in_parent);
+ }
+ }
+
+ if (window_state->IsMinimized()) {
+ // Save the previous show state so that we can correctly restore it.
+ window_state->window()->SetProperty(aura::client::kRestoreShowStateKey,
+ ToWindowShowState(old_show_type));
+ views::corewm::SetWindowVisibilityAnimationType(
+ window_state->window(), WINDOW_VISIBILITY_ANIMATION_TYPE_MINIMIZE);
+
+ // Hide the window.
+ window_state->window()->Hide();
+ // Activate another window.
+ if (window_state->IsActive())
+ window_state->Deactivate();
+ } else if ((window_state->window()->TargetVisibility() ||
+ old_show_type == SHOW_TYPE_MINIMIZED) &&
+ !window_state->window()->layer()->visible()) {
+ // The layer may be hidden if the window was previously minimized. Make
+ // sure it's visible.
+ window_state->window()->Show();
+ if (old_show_type == SHOW_TYPE_MINIMIZED &&
+ !window_state->IsMaximizedOrFullscreen()) {
+ window_state->set_unminimize_to_restore_bounds(false);
+ }
+ }
+
+ if (window_state->IsNormalShowState())
+ window_state->ClearRestoreBounds();
+
+ // Set the restore rectangle to the previously set restore rectangle.
+ if (!restore.IsEmpty())
+ window_state->SetRestoreBoundsInScreen(restore);
+}
} // namespace wm
} // namespace ash
diff --git a/ash/wm/default_state.h b/ash/wm/default_state.h
index 72e1f74..41064c6 100644
--- a/ash/wm/default_state.h
+++ b/ash/wm/default_state.h
@@ -17,9 +17,17 @@ class DefaultState : public WindowState::State {
virtual ~DefaultState();
// WindowState::State overrides:
- virtual void OnWMEvent(WindowState* window_state,
- WMEvent event) OVERRIDE;
+ virtual void OnWMEvent(WindowState* window_state, WMEvent event) OVERRIDE;
+
private:
+ // Process stete dependent events, such as TOGGLE_MAXIMIZED,
+ // TOGGLE_FULLSCREEN.
+ static bool ProcessCompoundEvents(WindowState* window_state, WMEvent event);
+
+ // Animates to new window bounds based on the current and previous show type.
+ static void UpdateBoundsFromShowType(wm::WindowState* window_state,
+ wm::WindowShowType old_show_type);
+
DISALLOW_COPY_AND_ASSIGN(DefaultState);
};
diff --git a/ash/wm/dock/docked_window_layout_manager.cc b/ash/wm/dock/docked_window_layout_manager.cc
index 323275f..d72e317 100644
--- a/ash/wm/dock/docked_window_layout_manager.cc
+++ b/ash/wm/dock/docked_window_layout_manager.cc
@@ -791,7 +791,7 @@ void DockedWindowLayoutManager::OnBackgroundUpdated(
/////////////////////////////////////////////////////////////////////////////
// DockedWindowLayoutManager, WindowStateObserver implementation:
-void DockedWindowLayoutManager::OnWindowShowTypeChanged(
+void DockedWindowLayoutManager::OnPreWindowShowTypeChange(
wm::WindowState* window_state,
wm::WindowShowType old_type) {
aura::Window* window = window_state->window();
diff --git a/ash/wm/dock/docked_window_layout_manager.h b/ash/wm/dock/docked_window_layout_manager.h
index 088ebd2..8499d71 100644
--- a/ash/wm/dock/docked_window_layout_manager.h
+++ b/ash/wm/dock/docked_window_layout_manager.h
@@ -159,8 +159,8 @@ class ASH_EXPORT DockedWindowLayoutManager
BackgroundAnimatorChangeType change_type) OVERRIDE;
// wm::WindowStateObserver:
- virtual void OnWindowShowTypeChanged(wm::WindowState* window_state,
- wm::WindowShowType old_type) OVERRIDE;
+ virtual void OnPreWindowShowTypeChange(wm::WindowState* window_state,
+ wm::WindowShowType old_type) OVERRIDE;
// aura::WindowObserver:
virtual void OnWindowBoundsChanged(aura::Window* window,
diff --git a/ash/wm/panels/panel_layout_manager.cc b/ash/wm/panels/panel_layout_manager.cc
index 7bfe4ad..cc521f4 100644
--- a/ash/wm/panels/panel_layout_manager.cc
+++ b/ash/wm/panels/panel_layout_manager.cc
@@ -459,7 +459,7 @@ void PanelLayoutManager::OnShelfAlignmentChanged(aura::Window* root_window) {
/////////////////////////////////////////////////////////////////////////////
// PanelLayoutManager, WindowObserver implementation:
-void PanelLayoutManager::OnWindowShowTypeChanged(
+void PanelLayoutManager::OnPostWindowShowTypeChange(
wm::WindowState* window_state,
wm::WindowShowType old_type) {
// If the shelf is currently hidden then windows will not actually be shown
diff --git a/ash/wm/panels/panel_layout_manager.h b/ash/wm/panels/panel_layout_manager.h
index 407cbcb..058fa39 100644
--- a/ash/wm/panels/panel_layout_manager.h
+++ b/ash/wm/panels/panel_layout_manager.h
@@ -97,8 +97,8 @@ class ASH_EXPORT PanelLayoutManager
virtual void OnShelfAlignmentChanged(aura::Window* root_window) OVERRIDE;
// Overridden from ash::wm::WindowStateObserver
- virtual void OnWindowShowTypeChanged(wm::WindowState* window_state,
- wm::WindowShowType old_type) OVERRIDE;
+ virtual void OnPostWindowShowTypeChange(wm::WindowState* window_state,
+ wm::WindowShowType old_type) OVERRIDE;
// Overridden from aura::WindowObserver
virtual void OnWindowVisibilityChanged(aura::Window* window,
diff --git a/ash/wm/resize_handle_window_targeter.cc b/ash/wm/resize_handle_window_targeter.cc
index 144e0fd..fb7df0a 100644
--- a/ash/wm/resize_handle_window_targeter.cc
+++ b/ash/wm/resize_handle_window_targeter.cc
@@ -17,7 +17,7 @@ ResizeHandleWindowTargeter::ResizeHandleWindowTargeter(
: window_(window),
immersive_controller_(controller) {
wm::WindowState* window_state = wm::GetWindowState(window_);
- OnWindowShowTypeChanged(window_state, wm::SHOW_TYPE_DEFAULT);
+ OnPostWindowShowTypeChange(window_state, wm::SHOW_TYPE_DEFAULT);
window_state->AddObserver(this);
window_->AddObserver(this);
}
@@ -29,7 +29,7 @@ ResizeHandleWindowTargeter::~ResizeHandleWindowTargeter() {
}
}
-void ResizeHandleWindowTargeter::OnWindowShowTypeChanged(
+void ResizeHandleWindowTargeter::OnPostWindowShowTypeChange(
wm::WindowState* window_state,
wm::WindowShowType old_type) {
if (window_state->IsMaximizedOrFullscreen()) {
diff --git a/ash/wm/resize_handle_window_targeter.h b/ash/wm/resize_handle_window_targeter.h
index 828d2fc..4ddb66f 100644
--- a/ash/wm/resize_handle_window_targeter.h
+++ b/ash/wm/resize_handle_window_targeter.h
@@ -29,8 +29,8 @@ class ResizeHandleWindowTargeter : public wm::WindowStateObserver,
private:
// wm::WindowStateObserver:
- virtual void OnWindowShowTypeChanged(wm::WindowState* window_state,
- wm::WindowShowType old_type) OVERRIDE;
+ virtual void OnPostWindowShowTypeChange(wm::WindowState* window_state,
+ wm::WindowShowType old_type) OVERRIDE;
// aura::WindowObserver:
virtual void OnWindowDestroying(aura::Window* window) OVERRIDE;
diff --git a/ash/wm/toplevel_window_event_handler.cc b/ash/wm/toplevel_window_event_handler.cc
index 156ff04..1dbb6b4 100644
--- a/ash/wm/toplevel_window_event_handler.cc
+++ b/ash/wm/toplevel_window_event_handler.cc
@@ -104,8 +104,8 @@ class ToplevelWindowEventHandler::ScopedWindowResizer
virtual void OnWindowDestroying(aura::Window* window) OVERRIDE;
// WindowStateObserver overrides:
- virtual void OnWindowShowTypeChanged(wm::WindowState* window_state,
- wm::WindowShowType type) OVERRIDE;
+ virtual void OnPreWindowShowTypeChange(wm::WindowState* window_state,
+ wm::WindowShowType type) OVERRIDE;
private:
ToplevelWindowEventHandler* handler_;
@@ -144,7 +144,8 @@ void ToplevelWindowEventHandler::ScopedWindowResizer::OnWindowHierarchyChanging(
handler_->CompleteDrag(DRAG_COMPLETE);
}
-void ToplevelWindowEventHandler::ScopedWindowResizer::OnWindowShowTypeChanged(
+void
+ToplevelWindowEventHandler::ScopedWindowResizer::OnPreWindowShowTypeChange(
wm::WindowState* window_state,
wm::WindowShowType old) {
handler_->CompleteDrag(DRAG_COMPLETE);
diff --git a/ash/wm/window_state.cc b/ash/wm/window_state.cc
index 81f23fe..db9a321 100644
--- a/ash/wm/window_state.cc
+++ b/ash/wm/window_state.cc
@@ -17,14 +17,66 @@
#include "base/auto_reset.h"
#include "base/command_line.h"
#include "ui/aura/client/aura_constants.h"
+#include "ui/aura/layout_manager.h"
#include "ui/aura/window.h"
#include "ui/aura/window_delegate.h"
+#include "ui/compositor/scoped_layer_animation_settings.h"
#include "ui/gfx/display.h"
#include "ui/views/corewm/window_util.h"
namespace ash {
namespace wm {
+namespace {
+
+// A tentative class to set the bounds on the window.
+// TODO(oshima): Once all logic is cleaned up, move this to the real layout
+// manager with proper friendship.
+class BoundsSetter : public aura::LayoutManager {
+ public:
+ BoundsSetter() {}
+ virtual ~BoundsSetter() {}
+
+ // aura::LayoutManager overrides:
+ virtual void OnWindowResized() OVERRIDE {}
+ virtual void OnWindowAddedToLayout(aura::Window* child) OVERRIDE {}
+ virtual void OnWillRemoveWindowFromLayout(aura::Window* child) OVERRIDE {}
+ virtual void OnWindowRemovedFromLayout(aura::Window* child) OVERRIDE {}
+ virtual void OnChildWindowVisibilityChanged(
+ aura::Window* child, bool visible) OVERRIDE {}
+ virtual void SetChildBounds(
+ aura::Window* child, const gfx::Rect& requested_bounds) OVERRIDE {}
+
+ void SetBounds(aura::Window* window, const gfx::Rect& bounds) {
+ SetChildBoundsDirect(window, bounds);
+ }
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(BoundsSetter);
+};
+
+WMEvent WMEventFromShowState(ui::WindowShowState requested_show_state) {
+ switch (requested_show_state) {
+ case ui::SHOW_STATE_DEFAULT:
+ case ui::SHOW_STATE_NORMAL:
+ return NORMAL;
+ case ui::SHOW_STATE_MINIMIZED:
+ return MINIMIZE;
+ case ui::SHOW_STATE_MAXIMIZED:
+ return MAXIMIZE;
+ case ui::SHOW_STATE_FULLSCREEN:
+ return FULLSCREEN;
+ case ui::SHOW_STATE_INACTIVE:
+ case ui::SHOW_STATE_DETACHED:
+ case ui::SHOW_STATE_END:
+ NOTREACHED() << "No WMEvent defined for the show type:"
+ << requested_show_state;
+ }
+ return NORMAL;
+}
+
+} // namespace
+
WindowState::WindowState(aura::Window* window)
: window_(window),
window_position_managed_(false),
@@ -38,11 +90,10 @@ WindowState::WindowState(aura::Window* window)
hide_shelf_when_fullscreen_(true),
animate_to_fullscreen_(true),
minimum_visibility_(false),
- in_set_window_show_type_(false),
+ ignore_property_change_(false),
window_show_type_(ToWindowShowType(GetShowState())),
current_state_(new DefaultState) {
window_->AddObserver(this);
-
#if defined(OS_CHROMEOS)
// NOTE(pkotwicz): Animating to immersive fullscreen does not look good. When
// switches::UseImmersiveFullscreenForAllWindows() returns true, most windows
@@ -182,23 +233,11 @@ void WindowState::Deactivate() {
void WindowState::Restore() {
if (!IsNormalShowType())
- SetWindowShowType(SHOW_TYPE_NORMAL);
+ OnWMEvent(NORMAL);
}
void WindowState::ToggleFullscreen() {
- // Window which cannot be maximized should not be fullscreened.
- // It can, however, be restored if it was fullscreened.
- bool is_fullscreen = IsFullscreen();
- if (!is_fullscreen && !CanMaximize())
- return;
- if (delegate_ && delegate_->ToggleFullscreen(this))
- return;
- if (is_fullscreen) {
- Restore();
- } else {
- window_->SetProperty(aura::client::kShowStateKey,
- ui::SHOW_STATE_FULLSCREEN);
- }
+ OnWMEvent(TOGGLE_FULLSCREEN);
}
void WindowState::OnWMEvent(WMEvent event) {
@@ -273,12 +312,25 @@ void WindowState::SetAndClearRestoreBounds() {
ClearRestoreBounds();
}
+void WindowState::AdjustSnappedBounds(gfx::Rect* bounds) {
+ if (is_dragged() || !IsSnapped())
+ return;
+ gfx::Rect maximized_bounds = ScreenUtil::GetMaximizedWindowBoundsInParent(
+ window_);
+ if (window_show_type() == SHOW_TYPE_LEFT_SNAPPED)
+ bounds->set_x(maximized_bounds.x());
+ else if (window_show_type() == SHOW_TYPE_RIGHT_SNAPPED)
+ bounds->set_x(maximized_bounds.right() - bounds->width());
+ bounds->set_y(maximized_bounds.y());
+ bounds->set_height(maximized_bounds.height());
+}
+
void WindowState::OnWindowPropertyChanged(aura::Window* window,
const void* key,
intptr_t old) {
DCHECK_EQ(window, window_);
- if (key == aura::client::kShowStateKey)
- SetWindowShowType(ToWindowShowType(GetShowState()));
+ if (key == aura::client::kShowStateKey && !ignore_property_change_)
+ OnWMEvent(WMEventFromShowState(GetShowState()));
}
void WindowState::SnapWindow(WindowShowType left_or_right,
@@ -299,7 +351,9 @@ void WindowState::SnapWindow(WindowShowType left_or_right,
DCHECK(left_or_right == SHOW_TYPE_LEFT_SNAPPED ||
left_or_right == SHOW_TYPE_RIGHT_SNAPPED);
- SetWindowShowType(left_or_right);
+ OnWMEvent(left_or_right == SHOW_TYPE_LEFT_SNAPPED ?
+ SNAP_LEFT : SNAP_RIGHT);
+
// TODO(varkha): Ideally the bounds should be changed in a LayoutManager upon
// observing the WindowShowType change.
// If the window is a child of kShellWindowId_DockedContainer such as during
@@ -312,21 +366,41 @@ void WindowState::SnapWindow(WindowShowType left_or_right,
SetRestoreBoundsInScreen(restore_bounds_in_screen);
}
-void WindowState::SetWindowShowType(WindowShowType new_window_show_type) {
- if (in_set_window_show_type_)
- return;
- base::AutoReset<bool> resetter(&in_set_window_show_type_, true);
-
+void WindowState::UpdateWindowShowType(WindowShowType new_window_show_type) {
ui::WindowShowState new_window_state =
ToWindowShowState(new_window_show_type);
- if (new_window_state != GetShowState())
+ if (new_window_state != GetShowState()) {
+ base::AutoReset<bool> resetter(&ignore_property_change_, true);
window_->SetProperty(aura::client::kShowStateKey, new_window_state);
- WindowShowType old_window_show_type = window_show_type_;
- window_show_type_ = new_window_show_type;
- if (old_window_show_type != window_show_type_) {
- FOR_EACH_OBSERVER(WindowStateObserver, observer_list_,
- OnWindowShowTypeChanged(this, old_window_show_type));
}
+ window_show_type_ = new_window_show_type;
+}
+
+void WindowState::NotifyPreShowTypeChange(WindowShowType old_window_show_type) {
+ FOR_EACH_OBSERVER(WindowStateObserver, observer_list_,
+ OnPreWindowShowTypeChange(this, old_window_show_type));
+}
+
+void WindowState::NotifyPostShowTypeChange(
+ WindowShowType old_window_show_type) {
+ FOR_EACH_OBSERVER(WindowStateObserver, observer_list_,
+ OnPostWindowShowTypeChange(this, old_window_show_type));
+}
+
+void WindowState::SetBoundsDirect(const gfx::Rect& bounds) {
+ BoundsSetter().SetBounds(window_, bounds);
+}
+
+void WindowState::SetBoundsDirectAnimated(const gfx::Rect& bounds) {
+ const int kBoundsChangeSlideDurationMs = 120;
+
+ ui::Layer* layer = window_->layer();
+ ui::ScopedLayerAnimationSettings slide_settings(layer->GetAnimator());
+ slide_settings.SetPreemptionStrategy(
+ ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET);
+ slide_settings.SetTransitionDuration(
+ base::TimeDelta::FromMilliseconds(kBoundsChangeSlideDurationMs));
+ SetBoundsDirect(bounds);
}
WindowState* GetActiveWindowState() {
diff --git a/ash/wm/window_state.h b/ash/wm/window_state.h
index 4ed2fe6..1023cdd 100644
--- a/ash/wm/window_state.h
+++ b/ash/wm/window_state.h
@@ -23,6 +23,9 @@ class Rect;
}
namespace ash {
+namespace internal {
+class WorkspaceLayoutManager;
+}
namespace wm {
class WindowStateDelegate;
@@ -271,6 +274,10 @@ class ASH_EXPORT WindowState : public aura::WindowObserver {
// Sets the currently stored restore bounds and clears the restore bounds.
void SetAndClearRestoreBounds();
+ // Adjusts the |bounds| so that they are flush with the edge of the
+ // workspace if the window represented by |window_state| is side snapped.
+ void AdjustSnappedBounds(gfx::Rect* bounds);
+
// Returns a pointer to DragDetails during drag operations.
const DragDetails* drag_details() const { return drag_details_.get(); }
DragDetails* drag_details() { return drag_details_.get(); }
@@ -281,12 +288,26 @@ class ASH_EXPORT WindowState : public aura::WindowObserver {
intptr_t old) OVERRIDE;
private:
+ friend class DefaultState;
+ // TODO(oshima): Move more logic from WLM to this class and remove
+ // this friend.
+ friend class internal::WorkspaceLayoutManager;
+
+ WindowStateDelegate* delegate() { return delegate_.get(); }
+
// Snaps the window to left or right of the desktop with given bounds.
void SnapWindow(WindowShowType left_or_right,
const gfx::Rect& bounds);
// Sets the window show type and updates the show state if necessary.
- void SetWindowShowType(WindowShowType new_window_show_type);
+ // Note that this does not update the window bounds.
+ void UpdateWindowShowType(WindowShowType new_window_show_type);
+
+ void NotifyPreShowTypeChange(WindowShowType old_window_show_type);
+ void NotifyPostShowTypeChange(WindowShowType old_window_show_type);
+
+ void SetBoundsDirect(const gfx::Rect& bounds);
+ void SetBoundsDirectAnimated(const gfx::Rect& bounds);
// The owner of this window settings.
aura::Window* window_;
@@ -313,8 +334,9 @@ class ASH_EXPORT WindowState : public aura::WindowObserver {
ObserverList<WindowStateObserver> observer_list_;
- // True when in SetWindowShowType(). This is used to avoid reentrance.
- bool in_set_window_show_type_;
+ // True to ignore a property change event to avoid reentrance in
+ // UpdateWindowShowType()
+ bool ignore_property_change_;
WindowShowType window_show_type_;
diff --git a/ash/wm/window_state_observer.h b/ash/wm/window_state_observer.h
index f177d5f..2b30823 100644
--- a/ash/wm/window_state_observer.h
+++ b/ash/wm/window_state_observer.h
@@ -14,12 +14,24 @@ class WindowState;
class ASH_EXPORT WindowStateObserver {
public:
- // Called when the window's show type has changed. This is different from
- // kWindowShowStatekey property change as this will be invoked when the window
+ // Following observer methods are different from kWindowShowStatekey
+ // property change as they will be invoked when the window
// gets left/right maximized, and auto positioned. |old_type| is the value
// before the change.
- virtual void OnWindowShowTypeChanged(WindowState* window_state,
- WindowShowType old_type) {}
+
+ // Called after the window's show type is set to new type, but before
+ // the window's bounds has been updated for the new type.
+ // This is used to update the shell state such as work area so
+ // that the window can use the correct environment to update its bounds.
+ // TODO(oshima): Remove this once docked windows has its own state.
+ virtual void OnPreWindowShowTypeChange(WindowState* window_state,
+ WindowShowType old_type) {}
+
+ // Called after the window's state has been changed for the new show type.
+ // This is used to update the shell state that depends on the update
+ // window bounds, such as shelf visibility.
+ virtual void OnPostWindowShowTypeChange(WindowState* window_state,
+ WindowShowType old_type) {}
};
} // namespace wm
diff --git a/ash/wm/wm_types.h b/ash/wm/wm_types.h
index 8a4d22d..0215d4b 100644
--- a/ash/wm/wm_types.h
+++ b/ash/wm/wm_types.h
@@ -43,6 +43,22 @@ enum WindowShowType {
// Set of operations that can change the window's state.
enum WMEvent {
+ // Following events are the request to become corresponding state.
+ // Note that this does not mean the window will be in corresponding
+ // state and the request may not be fullfilled.
+
+ // NORMAL is used as a restore operation with a few exceptions.
+ NORMAL,
+ MAXIMIZE,
+ MINIMIZE,
+ FULLSCREEN,
+ // TODO(oshima): Consolidate these two events.
+ SNAP_LEFT,
+ SNAP_RIGHT,
+
+ // Following events are compond events which may lead to different
+ // states depending on the current state.
+
// A user requested to toggle maximized state by double clicking window
// header.
TOGGLE_MAXIMIZE_CAPTION,
@@ -57,6 +73,9 @@ enum WMEvent {
// A user requested to toggle horizontal maximize by double clicking
// left/right edge.
TOGGLE_HORIZONTAL_MAXIMIZE,
+
+ // A user requested to toggle fullscreen state.
+ TOGGLE_FULLSCREEN,
};
// Utility functions to convert WindowShowType <-> ui::WindowShowState.
diff --git a/ash/wm/workspace/workspace_layout_manager.cc b/ash/wm/workspace/workspace_layout_manager.cc
index efe6c68..bb25f35 100644
--- a/ash/wm/workspace/workspace_layout_manager.cc
+++ b/ash/wm/workspace/workspace_layout_manager.cc
@@ -16,14 +16,12 @@
#include "ash/wm/window_properties.h"
#include "ash/wm/window_state.h"
#include "ash/wm/window_util.h"
-#include "ash/wm/workspace/workspace_window_resizer.h"
#include "ui/aura/client/activation_client.h"
#include "ui/aura/client/aura_constants.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/compositor/scoped_layer_animation_settings.h"
#include "ui/events/event.h"
#include "ui/gfx/screen.h"
#include "ui/views/corewm/window_util.h"
@@ -40,49 +38,6 @@ namespace {
// must be visible when the window is added to the workspace.
const float kMinimumPercentOnScreenArea = 0.3f;
-void MoveToDisplayForRestore(wm::WindowState* window_state) {
- if (!window_state->HasRestoreBounds())
- return;
- const gfx::Rect& restore_bounds = window_state->GetRestoreBoundsInScreen();
-
- // Move only if the restore bounds is outside of
- // the display. There is no information about in which
- // display it should be restored, so this is best guess.
- // TODO(oshima): Restore information should contain the
- // work area information like WindowResizer does for the
- // last window location.
- gfx::Rect display_area = Shell::GetScreen()->GetDisplayNearestWindow(
- window_state->window()).bounds();
-
- if (!display_area.Intersects(restore_bounds)) {
- const gfx::Display& display =
- Shell::GetScreen()->GetDisplayMatching(restore_bounds);
- DisplayController* display_controller =
- Shell::GetInstance()->display_controller();
- aura::Window* new_root =
- display_controller->GetRootWindowForDisplayId(display.id());
- if (new_root != window_state->window()->GetRootWindow()) {
- aura::Window* new_container =
- Shell::GetContainer(new_root, window_state->window()->parent()->id());
- new_container->AddChild(window_state->window());
- }
- }
-}
-
-gfx::Rect BoundsWithScreenEdgeVisible(
- aura::Window* window,
- const gfx::Rect& restore_bounds) {
- gfx::Rect max_bounds =
- ash::ScreenUtil::GetMaximizedWindowBoundsInParent(window);
- // If the restore_bounds are more than 1 grid step away from the size the
- // window would be when maximized, inset it.
- max_bounds.Inset(ash::internal::WorkspaceWindowResizer::kScreenEdgeInset,
- ash::internal::WorkspaceWindowResizer::kScreenEdgeInset);
- if (restore_bounds.Contains(max_bounds))
- return max_bounds;
- return restore_bounds;
-}
-
} // namespace
WorkspaceLayoutManager::WorkspaceLayoutManager(aura::Window* window)
@@ -167,7 +122,7 @@ void WorkspaceLayoutManager::SetChildBounds(
} else if (window_state->IsSnapped()) {
gfx::Rect child_bounds(requested_bounds);
wm::AdjustBoundsSmallerThan(work_area_in_parent_.size(), &child_bounds);
- AdjustSnappedBounds(window_state, &child_bounds);
+ window_state->AdjustSnappedBounds(&child_bounds);
SetChildBoundsDirect(child, child_bounds);
} else if (!SetMaximizedOrFullscreenBounds(window_state)) {
// Some windows rely on this to set their initial bounds.
@@ -242,37 +197,9 @@ void WorkspaceLayoutManager::OnWindowActivated(aura::Window* gained_active,
//////////////////////////////////////////////////////////////////////////////
// WorkspaceLayoutManager, wm::WindowStateObserver implementation:
-void WorkspaceLayoutManager::OnWindowShowTypeChanged(
+void WorkspaceLayoutManager::OnPostWindowShowTypeChange(
wm::WindowState* window_state,
wm::WindowShowType old_type) {
- if (old_type != wm::SHOW_TYPE_MINIMIZED &&
- !window_state->HasRestoreBounds() &&
- window_state->IsMaximizedOrFullscreen() &&
- !wm::IsMaximizedOrFullscreenWindowShowType(old_type)) {
- window_state->SaveCurrentBoundsForRestore();
- }
- // When restoring from a minimized state, we want to restore to the previous
- // bounds. However, we want to maintain the restore bounds. (The restore
- // bounds are set if a user maximized the window in one axis by double
- // clicking the window border for example).
- gfx::Rect restore;
- if (old_type == wm::SHOW_TYPE_MINIMIZED &&
- window_state->IsNormalShowState() &&
- window_state->HasRestoreBounds() &&
- !window_state->unminimize_to_restore_bounds()) {
- restore = window_state->GetRestoreBoundsInScreen();
- window_state->SaveCurrentBoundsForRestore();
- }
-
- UpdateBoundsFromShowType(window_state, old_type);
- ShowTypeChanged(window_state, old_type);
-
- if (window_state->IsNormalShowState())
- window_state->ClearRestoreBounds();
-
- // Set the restore rectangle to the previously set restore rectangle.
- if (!restore.IsEmpty())
- window_state->SetRestoreBoundsInScreen(restore);
// Notify observers that fullscreen state may be changing.
if (window_state->IsFullscreen() || old_type == wm::SHOW_TYPE_FULLSCREEN)
@@ -281,34 +208,6 @@ void WorkspaceLayoutManager::OnWindowShowTypeChanged(
UpdateShelfVisibility();
}
-void WorkspaceLayoutManager::ShowTypeChanged(
- wm::WindowState* window_state,
- wm::WindowShowType last_show_type) {
- if (window_state->IsMinimized()) {
- // Save the previous show state so that we can correctly restore it.
- window_state->window()->SetProperty(aura::client::kRestoreShowStateKey,
- wm::ToWindowShowState(last_show_type));
- views::corewm::SetWindowVisibilityAnimationType(
- window_state->window(), WINDOW_VISIBILITY_ANIMATION_TYPE_MINIMIZE);
-
- // Hide the window.
- window_state->window()->Hide();
- // Activate another window.
- if (window_state->IsActive())
- window_state->Deactivate();
- } else if ((window_state->window()->TargetVisibility() ||
- last_show_type == wm::SHOW_TYPE_MINIMIZED) &&
- !window_state->window()->layer()->visible()) {
- // The layer may be hidden if the window was previously minimized. Make
- // sure it's visible.
- window_state->window()->Show();
- if (last_show_type == wm::SHOW_TYPE_MINIMIZED &&
- !window_state->IsMaximizedOrFullscreen()) {
- window_state->set_unminimize_to_restore_bounds(false);
- }
- }
-}
-
//////////////////////////////////////////////////////////////////////////////
// WorkspaceLayoutManager, private:
@@ -370,9 +269,9 @@ void WorkspaceLayoutManager::AdjustWindowBoundsForWorkAreaChange(
work_area_in_parent_, &bounds);
break;
}
- //AdjustSnappedBounds(window_state, &bounds);
+ window_state->AdjustSnappedBounds(&bounds);
if (window_state->window()->bounds() != bounds)
- SetChildBoundsAnimated(window_state->window(), bounds);
+ window_state->SetBoundsDirectAnimated(bounds);
}
void WorkspaceLayoutManager::AdjustWindowBoundsWhenAdded(
@@ -401,7 +300,7 @@ void WorkspaceLayoutManager::AdjustWindowBoundsWhenAdded(
int min_height = bounds.height() * kMinimumPercentOnScreenArea;
ash::wm::AdjustBoundsToEnsureWindowVisibility(
display_area, min_width, min_height, &bounds);
- AdjustSnappedBounds(window_state, &bounds);
+ window_state->AdjustSnappedBounds(&bounds);
if (window->bounds() != bounds)
window->SetBounds(bounds);
}
@@ -421,66 +320,6 @@ void WorkspaceLayoutManager::UpdateFullscreenState() {
}
}
-void WorkspaceLayoutManager::UpdateBoundsFromShowType(
- wm::WindowState* window_state,
- wm::WindowShowType old_show_type) {
- aura::Window* window = window_state->window();
- if (window_state->IsMaximizedOrFullscreen())
- MoveToDisplayForRestore(window_state);
-
- wm::WindowShowType show_type = window_state->window_show_type();
- gfx::Rect bounds_in_parent;
- switch (show_type) {
- case wm::SHOW_TYPE_DEFAULT:
- case wm::SHOW_TYPE_NORMAL:
- case wm::SHOW_TYPE_LEFT_SNAPPED:
- case wm::SHOW_TYPE_RIGHT_SNAPPED:
- if (window_state->HasRestoreBounds())
- bounds_in_parent = window_state->GetRestoreBoundsInParent();
- else
- bounds_in_parent = window->bounds();
- // Make sure that part of the window is always visible.
- wm::AdjustBoundsToEnsureMinimumWindowVisibility(
- work_area_in_parent_, &bounds_in_parent);
-
- if (show_type == wm::SHOW_TYPE_LEFT_SNAPPED ||
- show_type == wm::SHOW_TYPE_RIGHT_SNAPPED) {
- AdjustSnappedBounds(window_state, &bounds_in_parent);
- } else {
- bounds_in_parent = BoundsWithScreenEdgeVisible(
- window,
- bounds_in_parent);
- }
- break;
-
- case wm::SHOW_TYPE_MAXIMIZED:
- bounds_in_parent = ScreenUtil::GetMaximizedWindowBoundsInParent(window);
- break;
-
- case wm::SHOW_TYPE_FULLSCREEN:
- bounds_in_parent = ScreenUtil::GetDisplayBoundsInParent(window);
- break;
-
- case wm::SHOW_TYPE_MINIMIZED:
- case wm::SHOW_TYPE_INACTIVE:
- case wm::SHOW_TYPE_DETACHED:
- case wm::SHOW_TYPE_END:
- case wm::SHOW_TYPE_AUTO_POSITIONED:
- return;
- }
-
- if (old_show_type == wm::SHOW_TYPE_MINIMIZED ||
- (window_state->IsFullscreen() &&
- !window_state->animate_to_fullscreen())) {
- SetChildBoundsDirect(window, bounds_in_parent);
- } else if (window_state->IsMaximizedOrFullscreen() ||
- IsMaximizedOrFullscreenWindowShowType(old_show_type)) {
- CrossFadeToBounds(window, bounds_in_parent);
- } else {
- SetChildBoundsAnimated(window, bounds_in_parent);
- }
-}
-
bool WorkspaceLayoutManager::SetMaximizedOrFullscreenBounds(
wm::WindowState* window_state) {
DCHECK(!window_state->is_dragged());
@@ -500,33 +339,5 @@ bool WorkspaceLayoutManager::SetMaximizedOrFullscreenBounds(
return false;
}
-void WorkspaceLayoutManager::AdjustSnappedBounds(wm::WindowState* window_state,
- gfx::Rect* bounds) {
- if (window_state->is_dragged() || !window_state->IsSnapped())
- return;
- gfx::Rect maximized_bounds = ScreenUtil::GetMaximizedWindowBoundsInParent(
- window_state->window());
- if (window_state->window_show_type() == wm::SHOW_TYPE_LEFT_SNAPPED)
- bounds->set_x(maximized_bounds.x());
- else if (window_state->window_show_type() == wm::SHOW_TYPE_RIGHT_SNAPPED)
- bounds->set_x(maximized_bounds.right() - bounds->width());
- bounds->set_y(maximized_bounds.y());
- // TODO(varkha): Set width to 50% here for snapped windows.
- bounds->set_height(maximized_bounds.height());
-}
-
-void WorkspaceLayoutManager::SetChildBoundsAnimated(Window* child,
- const gfx::Rect& bounds) {
- const int kBoundsChangeSlideDurationMs = 120;
-
- ui::Layer* layer = child->layer();
- ui::ScopedLayerAnimationSettings slide_settings(layer->GetAnimator());
- slide_settings.SetPreemptionStrategy(
- ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET);
- slide_settings.SetTransitionDuration(
- base::TimeDelta::FromMilliseconds(kBoundsChangeSlideDurationMs));
- SetChildBoundsDirect(child, bounds);
-}
-
} // namespace internal
} // namespace ash
diff --git a/ash/wm/workspace/workspace_layout_manager.h b/ash/wm/workspace/workspace_layout_manager.h
index 8cd44cc..4a17ec5 100644
--- a/ash/wm/workspace/workspace_layout_manager.h
+++ b/ash/wm/workspace/workspace_layout_manager.h
@@ -77,8 +77,8 @@ class ASH_EXPORT WorkspaceLayoutManager
aura::Window* lost_active) OVERRIDE;
// WindowStateObserver overrides:
- virtual void OnWindowShowTypeChanged(wm::WindowState* window_state,
- wm::WindowShowType old_type) OVERRIDE;
+ virtual void OnPostWindowShowTypeChange(wm::WindowState* window_state,
+ wm::WindowShowType old_type) OVERRIDE;
private:
typedef std::set<aura::Window*> WindowSet;
@@ -88,10 +88,6 @@ class ASH_EXPORT WorkspaceLayoutManager
ADJUST_WINDOW_WORK_AREA_INSETS_CHANGED,
};
- // Invoked from OnWindowShowTypeChanged().
- void ShowTypeChanged(wm::WindowState* window_state,
- wm::WindowShowType last_show_type);
-
// Adjusts the window's bounds when the display area changes for given
// window. This happens when the display size, work area insets or
// the display on which the window exists has changed.
@@ -125,10 +121,6 @@ class ASH_EXPORT WorkspaceLayoutManager
// window are set and true is returned. Does nothing otherwise.
bool SetMaximizedOrFullscreenBounds(wm::WindowState* window_state);
- // Adjusts the |bounds| so that they are flush with the edge of the
- // workspace if the window represented by |window_state| is side snapped.
- void AdjustSnappedBounds(wm::WindowState* window_state, gfx::Rect* bounds);
-
// Animates the window bounds to |bounds|.
void SetChildBoundsAnimated(aura::Window* child, const gfx::Rect& bounds);
diff --git a/ash/wm/workspace/workspace_layout_manager_unittest.cc b/ash/wm/workspace/workspace_layout_manager_unittest.cc
index 8baf51c..4e6d1bd 100644
--- a/ash/wm/workspace/workspace_layout_manager_unittest.cc
+++ b/ash/wm/workspace/workspace_layout_manager_unittest.cc
@@ -587,7 +587,7 @@ TEST_F(WorkspaceLayoutManagerSoloTest, FocusDuringUnminimize) {
EXPECT_EQ(ui::SHOW_STATE_MINIMIZED, delegate.GetShowStateAndReset());
window->Show();
EXPECT_TRUE(window->IsVisible());
- EXPECT_EQ(ui::SHOW_STATE_DEFAULT, delegate.GetShowStateAndReset());
+ EXPECT_EQ(ui::SHOW_STATE_NORMAL, delegate.GetShowStateAndReset());
}
// Tests maximized window size during root window resize.