Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ash/wm/workspace/workspace_layout_manager.h" | 5 #include "ash/wm/workspace/workspace_layout_manager.h" |
| 6 | 6 |
| 7 #include "ash/display/display_controller.h" | |
| 7 #include "ash/root_window_controller.h" | 8 #include "ash/root_window_controller.h" |
| 8 #include "ash/screen_ash.h" | 9 #include "ash/screen_ash.h" |
| 9 #include "ash/shelf/shelf_layout_manager.h" | 10 #include "ash/shelf/shelf_layout_manager.h" |
| 10 #include "ash/shell.h" | 11 #include "ash/shell.h" |
| 11 #include "ash/wm/always_on_top_controller.h" | 12 #include "ash/wm/always_on_top_controller.h" |
| 12 #include "ash/wm/base_layout_manager.h" | 13 #include "ash/wm/base_layout_manager.h" |
| 13 #include "ash/wm/frame_painter.h" | 14 #include "ash/wm/frame_painter.h" |
| 14 #include "ash/wm/property_util.h" | 15 #include "ash/wm/property_util.h" |
| 15 #include "ash/wm/window_animations.h" | 16 #include "ash/wm/window_animations.h" |
| 16 #include "ash/wm/window_properties.h" | 17 #include "ash/wm/window_properties.h" |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 34 | 35 |
| 35 // This specifies how much percent 30% of a window rect (width / height) | 36 // This specifies how much percent 30% of a window rect (width / height) |
| 36 // must be visible when the window is added to the workspace. | 37 // must be visible when the window is added to the workspace. |
| 37 const float kMinimumPercentOnScreenArea = 0.3f; | 38 const float kMinimumPercentOnScreenArea = 0.3f; |
| 38 | 39 |
| 39 bool IsMaximizedState(ui::WindowShowState state) { | 40 bool IsMaximizedState(ui::WindowShowState state) { |
| 40 return state == ui::SHOW_STATE_MAXIMIZED || | 41 return state == ui::SHOW_STATE_MAXIMIZED || |
| 41 state == ui::SHOW_STATE_FULLSCREEN; | 42 state == ui::SHOW_STATE_FULLSCREEN; |
| 42 } | 43 } |
| 43 | 44 |
| 45 void MoveToDisplayToBeRestored(aura::Window* window, | |
|
James Cook
2013/08/09 16:48:54
MoveToDisplayForRestore? ReparentToDisplayForRest
oshima
2013/08/09 17:30:07
Done.
| |
| 46 const gfx::Rect& restore_bounds) { | |
| 47 // Move only if the restore bounds is outside of | |
| 48 // 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.
| |
| 49 // display it should be restored, so this is best guess. | |
| 50 // TODO(oshima): Restore information should contain the | |
| 51 // work area information like WindowResizer does for the | |
| 52 // last window location. | |
| 53 if (!window->GetRootWindow()->GetBoundsInScreen().Intersects( | |
| 54 restore_bounds)) { | |
| 55 DisplayController* display_controller = | |
| 56 Shell::GetInstance()->display_controller(); | |
| 57 const gfx::Display& display = | |
| 58 display_controller->GetDisplayMatching(restore_bounds); | |
| 59 aura::RootWindow* new_root = | |
| 60 display_controller->GetRootWindowForDisplayId(display.id()); | |
| 61 aura::Window* new_container = | |
| 62 Shell::GetContainer(new_root, window->parent()->id()); | |
| 63 new_container->AddChild(window); | |
| 64 } | |
| 65 } | |
| 66 | |
| 44 } // namespace | 67 } // namespace |
| 45 | 68 |
| 46 WorkspaceLayoutManager::WorkspaceLayoutManager(aura::Window* window) | 69 WorkspaceLayoutManager::WorkspaceLayoutManager(aura::Window* window) |
| 47 : BaseLayoutManager(window->GetRootWindow()), | 70 : BaseLayoutManager(window->GetRootWindow()), |
| 48 shelf_(NULL), | 71 shelf_(NULL), |
| 49 window_(window), | 72 window_(window), |
| 50 work_area_(ScreenAsh::GetDisplayWorkAreaBoundsInParent( | 73 work_area_(ScreenAsh::GetDisplayWorkAreaBoundsInParent( |
| 51 window->parent())) { | 74 window->parent())) { |
| 52 } | 75 } |
| 53 | 76 |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 278 window, | 301 window, |
| 279 BaseLayoutManager::BoundsWithScreenEdgeVisible( | 302 BaseLayoutManager::BoundsWithScreenEdgeVisible( |
| 280 window->parent()->parent(), | 303 window->parent()->parent(), |
| 281 bounds_in_parent)); | 304 bounds_in_parent)); |
| 282 } | 305 } |
| 283 ClearRestoreBounds(window); | 306 ClearRestoreBounds(window); |
| 284 break; | 307 break; |
| 285 } | 308 } |
| 286 | 309 |
| 287 case ui::SHOW_STATE_MAXIMIZED: | 310 case ui::SHOW_STATE_MAXIMIZED: |
| 311 MoveToDisplayToBeRestored(window, *GetRestoreBoundsInScreen(window)); | |
| 288 CrossFadeToBounds(window, ScreenAsh::GetMaximizedWindowBoundsInParent( | 312 CrossFadeToBounds(window, ScreenAsh::GetMaximizedWindowBoundsInParent( |
| 289 window->parent()->parent())); | 313 window->parent()->parent())); |
| 290 break; | 314 break; |
| 291 case ui::SHOW_STATE_FULLSCREEN: | 315 case ui::SHOW_STATE_FULLSCREEN: |
| 316 MoveToDisplayToBeRestored(window, *GetRestoreBoundsInScreen(window)); | |
| 292 CrossFadeToBounds(window, ScreenAsh::GetDisplayBoundsInParent( | 317 CrossFadeToBounds(window, ScreenAsh::GetDisplayBoundsInParent( |
| 293 window->parent()->parent())); | 318 window->parent()->parent())); |
| 294 break; | 319 break; |
| 295 | 320 |
| 296 default: | 321 default: |
| 297 break; | 322 break; |
| 298 } | 323 } |
| 299 } | 324 } |
| 300 | 325 |
| 301 bool WorkspaceLayoutManager::SetMaximizedOrFullscreenBounds( | 326 bool WorkspaceLayoutManager::SetMaximizedOrFullscreenBounds( |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 316 SetChildBoundsDirect( | 341 SetChildBoundsDirect( |
| 317 window, | 342 window, |
| 318 ScreenAsh::GetDisplayBoundsInParent(window->parent()->parent())); | 343 ScreenAsh::GetDisplayBoundsInParent(window->parent()->parent())); |
| 319 return true; | 344 return true; |
| 320 } | 345 } |
| 321 return false; | 346 return false; |
| 322 } | 347 } |
| 323 | 348 |
| 324 } // namespace internal | 349 } // namespace internal |
| 325 } // namespace ash | 350 } // namespace ash |
| OLD | NEW |