| 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/screen_ash.h" | 8 #include "ash/screen_ash.h" |
| 8 #include "ash/shelf/shelf_layout_manager.h" | 9 #include "ash/shelf/shelf_layout_manager.h" |
| 9 #include "ash/shell.h" | 10 #include "ash/shell.h" |
| 10 #include "ash/wm/window_animations.h" | 11 #include "ash/wm/window_animations.h" |
| 11 #include "ash/wm/window_properties.h" | 12 #include "ash/wm/window_properties.h" |
| 12 #include "ash/wm/window_util.h" | 13 #include "ash/wm/window_util.h" |
| 14 #include "ash/wm/workspace/stuck_edge_types.h" |
| 13 #include "ash/wm/workspace/workspace_window_resizer.h" | 15 #include "ash/wm/workspace/workspace_window_resizer.h" |
| 16 #include "base/command_line.h" |
| 14 #include "ui/aura/client/activation_client.h" | 17 #include "ui/aura/client/activation_client.h" |
| 15 #include "ui/aura/client/aura_constants.h" | 18 #include "ui/aura/client/aura_constants.h" |
| 16 #include "ui/aura/root_window.h" | 19 #include "ui/aura/root_window.h" |
| 17 #include "ui/aura/window.h" | 20 #include "ui/aura/window.h" |
| 18 #include "ui/base/ui_base_types.h" | 21 #include "ui/base/ui_base_types.h" |
| 19 #include "ui/compositor/layer.h" | 22 #include "ui/compositor/layer.h" |
| 20 #include "ui/gfx/screen.h" | 23 #include "ui/gfx/screen.h" |
| 21 #include "ui/views/corewm/corewm_switches.h" | 24 #include "ui/views/corewm/corewm_switches.h" |
| 22 #include "ui/views/corewm/window_util.h" | 25 #include "ui/views/corewm/window_util.h" |
| 23 | 26 |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 } else if ((window->TargetVisibility() || | 186 } else if ((window->TargetVisibility() || |
| 184 last_show_state == ui::SHOW_STATE_MINIMIZED) && | 187 last_show_state == ui::SHOW_STATE_MINIMIZED) && |
| 185 !window->layer()->visible()) { | 188 !window->layer()->visible()) { |
| 186 // The layer may be hidden if the window was previously minimized. Make | 189 // The layer may be hidden if the window was previously minimized. Make |
| 187 // sure it's visible. | 190 // sure it's visible. |
| 188 window->Show(); | 191 window->Show(); |
| 189 } | 192 } |
| 190 } | 193 } |
| 191 | 194 |
| 192 void BaseLayoutManager::UpdateBoundsFromShowState(aura::Window* window) { | 195 void BaseLayoutManager::UpdateBoundsFromShowState(aura::Window* window) { |
| 196 int stuck_edges_mask = GetStuckToEdge(window); |
| 193 switch (window->GetProperty(aura::client::kShowStateKey)) { | 197 switch (window->GetProperty(aura::client::kShowStateKey)) { |
| 194 case ui::SHOW_STATE_DEFAULT: | 198 case ui::SHOW_STATE_DEFAULT: |
| 195 case ui::SHOW_STATE_NORMAL: { | 199 case ui::SHOW_STATE_NORMAL: { |
| 196 const gfx::Rect* restore = GetRestoreBoundsInScreen(window); | 200 const gfx::Rect* restore = GetRestoreBoundsInScreen(window); |
| 197 if (restore) { | 201 if (restore) { |
| 198 gfx::Rect bounds_in_parent = | 202 gfx::Rect bounds_in_parent = |
| 199 ScreenAsh::ConvertRectFromScreen(window->parent(), *restore); | 203 ScreenAsh::ConvertRectFromScreen(window->parent(), *restore); |
| 200 SetChildBoundsDirect(window, | 204 SetChildBoundsDirect(window, |
| 201 BoundsWithScreenEdgeVisible(window, | 205 BoundsWithScreenEdgeVisible(window, |
| 202 bounds_in_parent)); | 206 bounds_in_parent)); |
| 207 |
| 208 // getting unstuck |
| 209 stuck_edges_mask = STUCK_EDGE_NONE; |
| 203 } | 210 } |
| 204 ClearRestoreBounds(window); | 211 ClearRestoreBounds(window); |
| 205 break; | 212 break; |
| 206 } | 213 } |
| 207 | 214 |
| 208 case ui::SHOW_STATE_MAXIMIZED: | 215 case ui::SHOW_STATE_MAXIMIZED: |
| 209 SetChildBoundsDirect(window, | 216 SetChildBoundsDirect(window, |
| 210 ScreenAsh::GetMaximizedWindowBoundsInParent(window)); | 217 ScreenAsh::GetMaximizedWindowBoundsInParent(window)); |
| 218 stuck_edges_mask = STUCK_EDGE_NONE; |
| 211 break; | 219 break; |
| 212 | 220 |
| 213 case ui::SHOW_STATE_FULLSCREEN: | 221 case ui::SHOW_STATE_FULLSCREEN: |
| 214 // Don't animate the full-screen window transition. | 222 // Don't animate the full-screen window transition. |
| 215 // TODO(jamescook): Use animation here. Be sure the lock screen works. | 223 // TODO(jamescook): Use animation here. Be sure the lock screen works. |
| 216 SetChildBoundsDirect( | 224 SetChildBoundsDirect( |
| 217 window, ScreenAsh::GetDisplayBoundsInParent(window)); | 225 window, ScreenAsh::GetDisplayBoundsInParent(window)); |
| 226 stuck_edges_mask = STUCK_EDGE_NONE; |
| 218 break; | 227 break; |
| 219 | 228 |
| 220 default: | 229 default: |
| 221 break; | 230 break; |
| 222 } | 231 } |
| 232 if (GetStuckToEdge(window) != stuck_edges_mask && |
| 233 CommandLine::ForCurrentProcess()->HasSwitch( |
| 234 switches::kAshEnableDockedWindows)) |
| 235 SetStuckToEdge(window, stuck_edges_mask); |
| 223 } | 236 } |
| 224 | 237 |
| 225 void BaseLayoutManager::AdjustWindowSizesForScreenChange() { | 238 void BaseLayoutManager::AdjustWindowSizesForScreenChange() { |
| 226 // If a user plugs an external display into a laptop running Aura the | 239 // If a user plugs an external display into a laptop running Aura the |
| 227 // display size will change. Maximized windows need to resize to match. | 240 // display size will change. Maximized windows need to resize to match. |
| 228 // We also do this when developers running Aura on a desktop manually resize | 241 // We also do this when developers running Aura on a desktop manually resize |
| 229 // the host window. | 242 // the host window. |
| 230 // We also need to do this when the work area insets changes. | 243 // We also need to do this when the work area insets changes. |
| 231 for (WindowSet::const_iterator it = windows_.begin(); | 244 for (WindowSet::const_iterator it = windows_.begin(); |
| 232 it != windows_.end(); | 245 it != windows_.end(); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 245 // Put as much of the window as possible within the display area. | 258 // Put as much of the window as possible within the display area. |
| 246 gfx::Rect bounds = window->bounds(); | 259 gfx::Rect bounds = window->bounds(); |
| 247 bounds.AdjustToFit(display_rect); | 260 bounds.AdjustToFit(display_rect); |
| 248 window->SetBounds(bounds); | 261 window->SetBounds(bounds); |
| 249 } | 262 } |
| 250 } | 263 } |
| 251 } | 264 } |
| 252 | 265 |
| 253 } // namespace internal | 266 } // namespace internal |
| 254 } // namespace ash | 267 } // namespace ash |
| OLD | NEW |