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 (wm::IsWindowFullscreen(child)) | 61 else if (wm::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() { | |
sky
2012/03/01 01:43:19
Order should match that of header.
jennyz
2012/03/01 18:27:45
Done.
| |
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 the work area insets changes. | |
74 for (WindowSet::const_iterator it = windows_.begin(); | 83 for (WindowSet::const_iterator it = windows_.begin(); |
75 it != windows_.end(); | 84 it != windows_.end(); |
76 ++it) { | 85 ++it) { |
77 aura::Window* window = *it; | 86 aura::Window* window = *it; |
78 // The work area may be smaller than the full screen. | 87 // The work area may be smaller than the full screen. |
79 gfx::Rect monitor_rect = wm::IsWindowFullscreen(window) ? | 88 gfx::Rect monitor_rect = wm::IsWindowFullscreen(window) ? |
80 gfx::Screen::GetMonitorAreaNearestWindow(window) : | 89 gfx::Screen::GetMonitorAreaNearestWindow(window) : |
81 gfx::Screen::GetMonitorWorkAreaNearestWindow(window); | 90 gfx::Screen::GetMonitorWorkAreaNearestWindow(window); |
82 // Put as much of the window as possible within the monitor area. | 91 // Put as much of the window as possible within the monitor area. |
83 window->SetBounds(window->bounds().AdjustToFit(monitor_rect)); | 92 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)); | 128 window->SetBounds(gfx::Screen::GetMonitorAreaNearestWindow(window)); |
120 break; | 129 break; |
121 | 130 |
122 default: | 131 default: |
123 break; | 132 break; |
124 } | 133 } |
125 } | 134 } |
126 | 135 |
127 } // namespace internal | 136 } // namespace internal |
128 } // namespace ash | 137 } // namespace ash |
OLD | NEW |