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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 } | 98 } |
99 } | 99 } |
100 | 100 |
101 void BaseLayoutManager::SetChildBounds(aura::Window* child, | 101 void BaseLayoutManager::SetChildBounds(aura::Window* child, |
102 const gfx::Rect& requested_bounds) { | 102 const gfx::Rect& requested_bounds) { |
103 gfx::Rect child_bounds(requested_bounds); | 103 gfx::Rect child_bounds(requested_bounds); |
104 // Some windows rely on this to set their initial bounds. | 104 // Some windows rely on this to set their initial bounds. |
105 if (wm::IsWindowMaximized(child)) | 105 if (wm::IsWindowMaximized(child)) |
106 child_bounds = ScreenAsh::GetMaximizedWindowBounds(child); | 106 child_bounds = ScreenAsh::GetMaximizedWindowBounds(child); |
107 else if (wm::IsWindowFullscreen(child)) | 107 else if (wm::IsWindowFullscreen(child)) |
108 child_bounds = gfx::Screen::GetMonitorNearestWindow(child).bounds(); | 108 child_bounds = gfx::Screen::GetDisplayNearestWindow(child).bounds(); |
109 SetChildBoundsDirect(child, child_bounds); | 109 SetChildBoundsDirect(child, child_bounds); |
110 } | 110 } |
111 | 111 |
112 ///////////////////////////////////////////////////////////////////////////// | 112 ///////////////////////////////////////////////////////////////////////////// |
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 } |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 MaybeAnimateToBounds(window, | 191 MaybeAnimateToBounds(window, |
192 animate, | 192 animate, |
193 ScreenAsh::GetMaximizedWindowBounds(window)); | 193 ScreenAsh::GetMaximizedWindowBounds(window)); |
194 break; | 194 break; |
195 | 195 |
196 case ui::SHOW_STATE_FULLSCREEN: | 196 case ui::SHOW_STATE_FULLSCREEN: |
197 SetRestoreBoundsIfNotSet(window); | 197 SetRestoreBoundsIfNotSet(window); |
198 // Don't animate the full-screen window transition. | 198 // Don't animate the full-screen window transition. |
199 // TODO(jamescook): Use animation here. Be sure the lock screen works. | 199 // TODO(jamescook): Use animation here. Be sure the lock screen works. |
200 SetChildBoundsDirect( | 200 SetChildBoundsDirect( |
201 window, gfx::Screen::GetMonitorNearestWindow(window).bounds()); | 201 window, gfx::Screen::GetDisplayNearestWindow(window).bounds()); |
202 break; | 202 break; |
203 | 203 |
204 default: | 204 default: |
205 break; | 205 break; |
206 } | 206 } |
207 } | 207 } |
208 | 208 |
209 void BaseLayoutManager::MaybeAnimateToBounds(aura::Window* window, | 209 void BaseLayoutManager::MaybeAnimateToBounds(aura::Window* window, |
210 bool animate, | 210 bool animate, |
211 const gfx::Rect& new_bounds) { | 211 const gfx::Rect& new_bounds) { |
(...skipping 16 matching lines...) Expand all Loading... |
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::GetMonitorNearestWindow(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 monitor_rect = |
242 gfx::Screen::GetMonitorNearestWindow(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 monitor area. |
244 window->SetBounds(window->bounds().AdjustToFit(monitor_rect)); | 244 window->SetBounds(window->bounds().AdjustToFit(monitor_rect)); |
245 } | 245 } |
246 } | 246 } |
247 } | 247 } |
248 | 248 |
249 } // namespace internal | 249 } // namespace internal |
250 } // namespace ash | 250 } // namespace ash |
OLD | NEW |