| 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/base_layout_manager.h" | 5 #include "ash/wm/base_layout_manager.h" |
| 6 | 6 |
| 7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
| 8 #include "ash/wm/property_util.h" | 8 #include "ash/wm/property_util.h" |
| 9 #include "ash/wm/window_util.h" | 9 #include "ash/wm/window_util.h" |
| 10 #include "ui/aura/client/aura_constants.h" | 10 #include "ui/aura/client/aura_constants.h" |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 child_bounds = gfx::Screen::GetMonitorWorkAreaNearestWindow(child); | 60 child_bounds = gfx::Screen::GetMonitorWorkAreaNearestWindow(child); |
| 61 else if (window_util::IsWindowFullscreen(child)) | 61 else if (window_util::IsWindowFullscreen(child)) |
| 62 child_bounds = gfx::Screen::GetMonitorAreaNearestWindow(child); | 62 child_bounds = gfx::Screen::GetMonitorAreaNearestWindow(child); |
| 63 SetChildBoundsDirect(child, child_bounds); | 63 SetChildBoundsDirect(child, child_bounds); |
| 64 } | 64 } |
| 65 | 65 |
| 66 ///////////////////////////////////////////////////////////////////////////// | 66 ///////////////////////////////////////////////////////////////////////////// |
| 67 // BaseLayoutManager, RootWindowObserver overrides: | 67 // BaseLayoutManager, RootWindowObserver overrides: |
| 68 | 68 |
| 69 void BaseLayoutManager::OnRootWindowResized(const gfx::Size& new_size) { | 69 void BaseLayoutManager::OnRootWindowResized(const gfx::Size& new_size) { |
| 70 AdjustWindowSizesForScreenChange(); |
| 71 } |
| 72 |
| 73 void BaseLayoutManager::OnScreenWorkAreaInsetsChanged() { |
| 74 AdjustWindowSizesForScreenChange(); |
| 75 } |
| 76 |
| 77 void BaseLayoutManager::AdjustWindowSizesForScreenChange() { |
| 70 // If a user plugs an external monitor into a laptop running Aura the | 78 // If a user plugs an external monitor into a laptop running Aura the |
| 71 // monitor size will change. Maximized windows need to resize to match. | 79 // monitor size will change. Maximized windows need to resize to match. |
| 72 // We also do this when developers running Aura on a desktop manually resize | 80 // We also do this when developers running Aura on a desktop manually resize |
| 73 // the host window. | 81 // the host window. |
| 82 // We also need to do this when user toggles between full screen mode and |
| 83 // normal mode with maximized windows. |
| 74 for (WindowSet::const_iterator it = windows_.begin(); | 84 for (WindowSet::const_iterator it = windows_.begin(); |
| 75 it != windows_.end(); | 85 it != windows_.end(); |
| 76 ++it) { | 86 ++it) { |
| 77 aura::Window* window = *it; | 87 aura::Window* window = *it; |
| 78 // The work area may be smaller than the full screen. | 88 // The work area may be smaller than the full screen. |
| 79 gfx::Rect monitor_rect = window_util::IsWindowFullscreen(window) ? | 89 gfx::Rect monitor_rect = window_util::IsWindowFullscreen(window) ? |
| 80 gfx::Screen::GetMonitorAreaNearestWindow(window) : | 90 gfx::Screen::GetMonitorAreaNearestWindow(window) : |
| 81 gfx::Screen::GetMonitorWorkAreaNearestWindow(window); | 91 gfx::Screen::GetMonitorWorkAreaNearestWindow(window); |
| 82 // Put as much of the window as possible within the monitor area. | 92 // Put as much of the window as possible within the monitor area. |
| 83 window->SetBounds(window->bounds().AdjustToFit(monitor_rect)); | 93 window->SetBounds(window->bounds().AdjustToFit(monitor_rect)); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 window->SetBounds(gfx::Screen::GetMonitorAreaNearestWindow(window)); | 129 window->SetBounds(gfx::Screen::GetMonitorAreaNearestWindow(window)); |
| 120 break; | 130 break; |
| 121 | 131 |
| 122 default: | 132 default: |
| 123 break; | 133 break; |
| 124 } | 134 } |
| 125 } | 135 } |
| 126 | 136 |
| 127 } // namespace internal | 137 } // namespace internal |
| 128 } // namespace ash | 138 } // namespace ash |
| OLD | NEW |