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/window_animations.h" | 5 #include "ash/wm/window_animations.h" |
6 | 6 |
7 #include <math.h> | 7 #include <math.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <vector> | 10 #include <vector> |
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 // Show/Hide windows using a fade. | 312 // Show/Hide windows using a fade. |
313 void AnimateShowWindow_Fade(aura::Window* window) { | 313 void AnimateShowWindow_Fade(aura::Window* window) { |
314 AnimateShowWindowCommon(window, gfx::Transform(), gfx::Transform()); | 314 AnimateShowWindowCommon(window, gfx::Transform(), gfx::Transform()); |
315 } | 315 } |
316 | 316 |
317 void AnimateHideWindow_Fade(aura::Window* window) { | 317 void AnimateHideWindow_Fade(aura::Window* window) { |
318 AnimateHideWindowCommon(window, gfx::Transform()); | 318 AnimateHideWindowCommon(window, gfx::Transform()); |
319 } | 319 } |
320 | 320 |
321 gfx::Rect GetMinimizeRectForWindow(aura::Window* window) { | 321 gfx::Rect GetMinimizeRectForWindow(aura::Window* window) { |
322 gfx::Rect target_bounds = Shell::GetInstance()->launcher()-> | 322 Launcher* launcher = Launcher::ForWindow(window); |
| 323 // Launcher is created lazily and can be NULL. |
| 324 if (!launcher) |
| 325 return gfx::Rect(); |
| 326 gfx::Rect target_bounds = Launcher::ForWindow(window)-> |
323 GetScreenBoundsOfItemIconForWindow(window); | 327 GetScreenBoundsOfItemIconForWindow(window); |
324 if (target_bounds.IsEmpty()) { | 328 if (target_bounds.IsEmpty()) { |
325 // Assume the launcher is overflowed, zoom off to the bottom right of the | 329 // Assume the launcher is overflowed, zoom off to the bottom right of the |
326 // work area. | 330 // work area. |
327 gfx::Rect work_area = | 331 gfx::Rect work_area = |
328 Shell::GetScreen()->GetDisplayNearestWindow(window).work_area(); | 332 Shell::GetScreen()->GetDisplayNearestWindow(window).work_area(); |
329 target_bounds.SetRect(work_area.right(), work_area.bottom(), 0, 0); | 333 target_bounds.SetRect(work_area.right(), work_area.bottom(), 0, 0); |
330 } | 334 } |
331 target_bounds = | 335 target_bounds = |
332 ScreenAsh::ConvertRectFromScreen(window->parent(), target_bounds); | 336 ScreenAsh::ConvertRectFromScreen(window->parent(), target_bounds); |
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
790 return AnimateShowWindow(window); | 794 return AnimateShowWindow(window); |
791 } else { | 795 } else { |
792 // Don't start hiding the window again if it's already being hidden. | 796 // Don't start hiding the window again if it's already being hidden. |
793 return window->layer()->GetTargetOpacity() != 0.0f && | 797 return window->layer()->GetTargetOpacity() != 0.0f && |
794 AnimateHideWindow(window); | 798 AnimateHideWindow(window); |
795 } | 799 } |
796 } | 800 } |
797 | 801 |
798 } // namespace internal | 802 } // namespace internal |
799 } // namespace ash | 803 } // namespace ash |
OLD | NEW |