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/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/shelf_layout_manager.h" | 10 #include "ash/wm/shelf_layout_manager.h" |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 // BaseLayoutManager, RootWindowObserver overrides: | 113 // BaseLayoutManager, RootWindowObserver overrides: |
114 | 114 |
115 void BaseLayoutManager::OnRootWindowResized(const aura::RootWindow* root, | 115 void BaseLayoutManager::OnRootWindowResized(const aura::RootWindow* root, |
116 const gfx::Size& old_size) { | 116 const gfx::Size& old_size) { |
117 AdjustWindowSizesForScreenChange(); | 117 AdjustWindowSizesForScreenChange(); |
118 } | 118 } |
119 | 119 |
120 ///////////////////////////////////////////////////////////////////////////// | 120 ///////////////////////////////////////////////////////////////////////////// |
121 // BaseLayoutManager, ash::ShellObserver overrides: | 121 // BaseLayoutManager, ash::ShellObserver overrides: |
122 | 122 |
123 void BaseLayoutManager::OnMonitorWorkAreaInsetsChanged() { | 123 void BaseLayoutManager::OnDisplayWorkAreaInsetsChanged() { |
124 AdjustWindowSizesForScreenChange(); | 124 AdjustWindowSizesForScreenChange(); |
125 } | 125 } |
126 | 126 |
127 ///////////////////////////////////////////////////////////////////////////// | 127 ///////////////////////////////////////////////////////////////////////////// |
128 // BaseLayoutManager, WindowObserver overrides: | 128 // BaseLayoutManager, WindowObserver overrides: |
129 | 129 |
130 void BaseLayoutManager::OnWindowPropertyChanged(aura::Window* window, | 130 void BaseLayoutManager::OnWindowPropertyChanged(aura::Window* window, |
131 const void* key, | 131 const void* key, |
132 intptr_t old) { | 132 intptr_t old) { |
133 if (key == aura::client::kShowStateKey) { | 133 if (key == aura::client::kShowStateKey) { |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 !window->GetProperty(aura::client::kAnimationsDisabledKey) && | 215 !window->GetProperty(aura::client::kAnimationsDisabledKey) && |
216 !CommandLine::ForCurrentProcess()->HasSwitch( | 216 !CommandLine::ForCurrentProcess()->HasSwitch( |
217 ash::switches::kAshWindowAnimationsDisabled)) { | 217 ash::switches::kAshWindowAnimationsDisabled)) { |
218 CrossFadeToBounds(window, new_bounds); | 218 CrossFadeToBounds(window, new_bounds); |
219 return; | 219 return; |
220 } | 220 } |
221 SetChildBoundsDirect(window, new_bounds); | 221 SetChildBoundsDirect(window, new_bounds); |
222 } | 222 } |
223 | 223 |
224 void BaseLayoutManager::AdjustWindowSizesForScreenChange() { | 224 void BaseLayoutManager::AdjustWindowSizesForScreenChange() { |
225 // If a user plugs an external monitor into a laptop running Aura the | 225 // If a user plugs an external display into a laptop running Aura the |
226 // monitor size will change. Maximized windows need to resize to match. | 226 // display size will change. Maximized windows need to resize to match. |
227 // We also do this when developers running Aura on a desktop manually resize | 227 // We also do this when developers running Aura on a desktop manually resize |
228 // the host window. | 228 // the host window. |
229 // We also need to do this when the work area insets changes. | 229 // We also need to do this when the work area insets changes. |
230 for (WindowSet::const_iterator it = windows_.begin(); | 230 for (WindowSet::const_iterator it = windows_.begin(); |
231 it != windows_.end(); | 231 it != windows_.end(); |
232 ++it) { | 232 ++it) { |
233 aura::Window* window = *it; | 233 aura::Window* window = *it; |
234 if (wm::IsWindowMaximized(window)) { | 234 if (wm::IsWindowMaximized(window)) { |
235 SetChildBoundsDirect(window, ScreenAsh::GetMaximizedWindowBounds(window)); | 235 SetChildBoundsDirect(window, ScreenAsh::GetMaximizedWindowBounds(window)); |
236 } else if (wm::IsWindowFullscreen(window)) { | 236 } else if (wm::IsWindowFullscreen(window)) { |
237 SetChildBoundsDirect( | 237 SetChildBoundsDirect( |
238 window, gfx::Screen::GetDisplayNearestWindow(window).bounds()); | 238 window, gfx::Screen::GetDisplayNearestWindow(window).bounds()); |
239 } else { | 239 } else { |
240 // The work area may be smaller than the full screen. | 240 // The work area may be smaller than the full screen. |
241 gfx::Rect monitor_rect = | 241 gfx::Rect display_rect = |
242 gfx::Screen::GetDisplayNearestWindow(window).work_area(); | 242 gfx::Screen::GetDisplayNearestWindow(window).work_area(); |
243 // Put as much of the window as possible within the monitor area. | 243 // Put as much of the window as possible within the display area. |
244 window->SetBounds(window->bounds().AdjustToFit(monitor_rect)); | 244 window->SetBounds(window->bounds().AdjustToFit(display_rect)); |
245 } | 245 } |
246 } | 246 } |
247 } | 247 } |
248 | 248 |
249 } // namespace internal | 249 } // namespace internal |
250 } // namespace ash | 250 } // namespace ash |
OLD | NEW |