| 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/wm/property_util.h" | 7 #include "ash/wm/property_util.h" |
| 8 #include "ash/wm/window_util.h" | 8 #include "ash/wm/window_util.h" |
| 9 #include "ash/wm/workspace/workspace.h" | 9 #include "ash/wm/workspace/workspace.h" |
| 10 #include "ash/wm/workspace/workspace_manager.h" | 10 #include "ash/wm/workspace/workspace_manager.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 void WorkspaceLayoutManager::OnWindowResized() { | 34 void WorkspaceLayoutManager::OnWindowResized() { |
| 35 // Workspace is updated via RootWindowObserver::OnRootWindowResized. | 35 // Workspace is updated via RootWindowObserver::OnRootWindowResized. |
| 36 } | 36 } |
| 37 | 37 |
| 38 void WorkspaceLayoutManager::OnWindowAddedToLayout(aura::Window* child) { | 38 void WorkspaceLayoutManager::OnWindowAddedToLayout(aura::Window* child) { |
| 39 if (!workspace_manager_->IsManagedWindow(child)) | 39 if (!workspace_manager_->IsManagedWindow(child)) |
| 40 return; | 40 return; |
| 41 | 41 |
| 42 if (child->IsVisible()) { | 42 if (child->IsVisible()) { |
| 43 workspace_manager_->AddWindow(child); | 43 workspace_manager_->AddWindow(child); |
| 44 } else if (wm::IsWindowMaximized(child) || | 44 } else if (wm::IsWindowMaximized(child)) { |
| 45 workspace_manager_->ShouldMaximize(child)) { | |
| 46 if (!wm::IsWindowMaximized(child)) { | |
| 47 SetRestoreBoundsIfNotSet(child); | |
| 48 wm::MaximizeWindow(child); | |
| 49 } | |
| 50 SetChildBoundsDirect(child, | 45 SetChildBoundsDirect(child, |
| 51 gfx::Screen::GetMonitorWorkAreaNearestWindow(child)); | 46 gfx::Screen::GetMonitorWorkAreaNearestWindow(child)); |
| 52 } else if (wm::IsWindowFullscreen(child)) { | 47 } else if (wm::IsWindowFullscreen(child)) { |
| 53 SetChildBoundsDirect(child, | 48 SetChildBoundsDirect(child, |
| 54 gfx::Screen::GetMonitorAreaNearestWindow(child)); | 49 gfx::Screen::GetMonitorAreaNearestWindow(child)); |
| 55 } else { | 50 } else { |
| 56 // Align non-maximized/fullscreen windows to a grid. | 51 // Align non-maximized/fullscreen windows to a grid. |
| 57 SetChildBoundsDirect( | 52 SetChildBoundsDirect( |
| 58 child, workspace_manager_->AlignBoundsToGrid(child->GetTargetBounds())); | 53 child, workspace_manager_->AlignBoundsToGrid(child->GetTargetBounds())); |
| 59 } | 54 } |
| (...skipping 26 matching lines...) Expand all Loading... |
| 86 child_bounds = gfx::Screen::GetMonitorAreaNearestWindow(child); | 81 child_bounds = gfx::Screen::GetMonitorAreaNearestWindow(child); |
| 87 } else { | 82 } else { |
| 88 child_bounds = gfx::Screen::GetMonitorWorkAreaNearestWindow(child). | 83 child_bounds = gfx::Screen::GetMonitorWorkAreaNearestWindow(child). |
| 89 AdjustToFit(requested_bounds); | 84 AdjustToFit(requested_bounds); |
| 90 } | 85 } |
| 91 SetChildBoundsDirect(child, child_bounds); | 86 SetChildBoundsDirect(child, child_bounds); |
| 92 } | 87 } |
| 93 | 88 |
| 94 } // namespace internal | 89 } // namespace internal |
| 95 } // namespace ash | 90 } // namespace ash |
| OLD | NEW |