| 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_manager2.h" | 5 #include "ash/wm/workspace/workspace_layout_manager2.h" |
| 6 | 6 |
| 7 #include "ash/ash_switches.h" | 7 #include "ash/ash_switches.h" |
| 8 #include "ash/screen_ash.h" | 8 #include "ash/screen_ash.h" |
| 9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
| 10 #include "ash/wm/always_on_top_controller.h" | 10 #include "ash/wm/always_on_top_controller.h" |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 } | 282 } |
| 283 | 283 |
| 284 void WorkspaceLayoutManager2::AdjustWindowSizeForScreenChange( | 284 void WorkspaceLayoutManager2::AdjustWindowSizeForScreenChange( |
| 285 Window* window, | 285 Window* window, |
| 286 AdjustWindowReason reason) { | 286 AdjustWindowReason reason) { |
| 287 if (GetTrackedByWorkspace(window) && | 287 if (GetTrackedByWorkspace(window) && |
| 288 !SetMaximizedOrFullscreenBounds(window)) { | 288 !SetMaximizedOrFullscreenBounds(window)) { |
| 289 if (reason == ADJUST_WINDOW_SCREEN_SIZE_CHANGED) { | 289 if (reason == ADJUST_WINDOW_SCREEN_SIZE_CHANGED) { |
| 290 // The work area may be smaller than the full screen. Put as much of the | 290 // The work area may be smaller than the full screen. Put as much of the |
| 291 // window as possible within the display area. | 291 // window as possible within the display area. |
| 292 window->SetBounds(window->bounds().AdjustToFit(work_area_)); | 292 gfx::Rect bounds = window->bounds(); |
| 293 bounds.AdjustToFit(work_area_); |
| 294 window->SetBounds(bounds); |
| 293 } else if (reason == ADJUST_WINDOW_DISPLAY_INSETS_CHANGED) { | 295 } else if (reason == ADJUST_WINDOW_DISPLAY_INSETS_CHANGED) { |
| 294 // If the window is completely outside the display work area, then move it | 296 // If the window is completely outside the display work area, then move it |
| 295 // enough to be visible again. | 297 // enough to be visible again. |
| 296 gfx::Rect bounds = window->bounds(); | 298 gfx::Rect bounds = window->bounds(); |
| 297 if (!work_area_.Intersects(bounds)) { | 299 if (!work_area_.Intersects(bounds)) { |
| 298 int y_offset = 0; | 300 int y_offset = 0; |
| 299 if (work_area_.bottom() < bounds.y()) { | 301 if (work_area_.bottom() < bounds.y()) { |
| 300 y_offset = work_area_.bottom() - bounds.y() - kMinimumOnScreenArea; | 302 y_offset = work_area_.bottom() - bounds.y() - kMinimumOnScreenArea; |
| 301 } else if (bounds.bottom() < work_area_.y()) { | 303 } else if (bounds.bottom() < work_area_.y()) { |
| 302 y_offset = work_area_.y() - bounds.bottom() + kMinimumOnScreenArea; | 304 y_offset = work_area_.y() - bounds.bottom() + kMinimumOnScreenArea; |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 369 } | 371 } |
| 370 return false; | 372 return false; |
| 371 } | 373 } |
| 372 | 374 |
| 373 WorkspaceManager2* WorkspaceLayoutManager2::workspace_manager() { | 375 WorkspaceManager2* WorkspaceLayoutManager2::workspace_manager() { |
| 374 return workspace_->workspace_manager(); | 376 return workspace_->workspace_manager(); |
| 375 } | 377 } |
| 376 | 378 |
| 377 } // namespace internal | 379 } // namespace internal |
| 378 } // namespace ash | 380 } // namespace ash |
| OLD | NEW |