| Index: ash/wm/workspace/workspace_layout_manager.cc
|
| diff --git a/ash/wm/workspace/workspace_layout_manager.cc b/ash/wm/workspace/workspace_layout_manager.cc
|
| index 2fd56af26cbc9c4ba608936d3c21b34485ecf17f..c748d9a9e465c075bf94a8bbfcab8bc16b95b935 100644
|
| --- a/ash/wm/workspace/workspace_layout_manager.cc
|
| +++ b/ash/wm/workspace/workspace_layout_manager.cc
|
| @@ -4,6 +4,7 @@
|
|
|
| #include "ash/wm/workspace/workspace_layout_manager.h"
|
|
|
| +#include "ash/display/display_controller.h"
|
| #include "ash/root_window_controller.h"
|
| #include "ash/screen_ash.h"
|
| #include "ash/shelf/shelf_layout_manager.h"
|
| @@ -41,6 +42,33 @@ bool IsMaximizedState(ui::WindowShowState state) {
|
| state == ui::SHOW_STATE_FULLSCREEN;
|
| }
|
|
|
| +void MoveToDisplayForRestore(aura::Window* window) {
|
| + const gfx::Rect* restore_bounds = GetRestoreBoundsInScreen(window);
|
| + if (!restore_bounds)
|
| + return;
|
| +
|
| + // Move only if the restore bounds is outside of
|
| + // the root window. 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.
|
| + if (!window->GetRootWindow()->GetBoundsInScreen().Intersects(
|
| + *restore_bounds)) {
|
| + DisplayController* display_controller =
|
| + Shell::GetInstance()->display_controller();
|
| + const gfx::Display& display =
|
| + display_controller->GetDisplayMatching(*restore_bounds);
|
| + aura::RootWindow* new_root =
|
| + display_controller->GetRootWindowForDisplayId(display.id());
|
| + if (new_root != window->GetRootWindow()) {
|
| + aura::Window* new_container =
|
| + Shell::GetContainer(new_root, window->parent()->id());
|
| + new_container->AddChild(window);
|
| + }
|
| + }
|
| +}
|
| +
|
| } // namespace
|
|
|
| WorkspaceLayoutManager::WorkspaceLayoutManager(aura::Window* window)
|
| @@ -285,14 +313,15 @@ void WorkspaceLayoutManager::UpdateBoundsFromShowState(Window* window) {
|
| }
|
|
|
| case ui::SHOW_STATE_MAXIMIZED:
|
| + MoveToDisplayForRestore(window);
|
| CrossFadeToBounds(window, ScreenAsh::GetMaximizedWindowBoundsInParent(
|
| window->parent()->parent()));
|
| break;
|
| case ui::SHOW_STATE_FULLSCREEN:
|
| + MoveToDisplayForRestore(window);
|
| CrossFadeToBounds(window, ScreenAsh::GetDisplayBoundsInParent(
|
| window->parent()->parent()));
|
| break;
|
| -
|
| default:
|
| break;
|
| }
|
|
|