Chromium Code Reviews| 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..a1716e79fad7e07a729d3c7634a70592925a518c 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,28 @@ bool IsMaximizedState(ui::WindowShowState state) { |
| state == ui::SHOW_STATE_FULLSCREEN; |
| } |
| +void MoveToDisplayToBeRestored(aura::Window* window, |
|
James Cook
2013/08/09 16:48:54
MoveToDisplayForRestore? ReparentToDisplayForRest
oshima
2013/08/09 17:30:07
Done.
|
| + const gfx::Rect& restore_bounds) { |
| + // Move only if the restore bounds is outside of |
| + // the root window. Thre is no information about in which |
|
James Cook
2013/08/09 16:48:54
Thre -> There
oshima
2013/08/09 17:30:07
Done.
|
| + // 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()); |
| + aura::Window* new_container = |
| + Shell::GetContainer(new_root, window->parent()->id()); |
| + new_container->AddChild(window); |
| + } |
| +} |
| + |
| } // namespace |
| WorkspaceLayoutManager::WorkspaceLayoutManager(aura::Window* window) |
| @@ -285,10 +308,12 @@ void WorkspaceLayoutManager::UpdateBoundsFromShowState(Window* window) { |
| } |
| case ui::SHOW_STATE_MAXIMIZED: |
| + MoveToDisplayToBeRestored(window, *GetRestoreBoundsInScreen(window)); |
| CrossFadeToBounds(window, ScreenAsh::GetMaximizedWindowBoundsInParent( |
| window->parent()->parent())); |
| break; |
| case ui::SHOW_STATE_FULLSCREEN: |
| + MoveToDisplayToBeRestored(window, *GetRestoreBoundsInScreen(window)); |
| CrossFadeToBounds(window, ScreenAsh::GetDisplayBoundsInParent( |
| window->parent()->parent())); |
| break; |