| 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/workspace/desktop_background_fade_controller.h" | 5 #include "ash/wm/workspace/desktop_background_fade_controller.h" |
| 6 | 6 |
| 7 #include "ash/wm/window_animations.h" | 7 #include "ash/wm/window_animations.h" |
| 8 #include "ash/wm/workspace/colored_window_controller.h" | 8 #include "ash/wm/workspace/colored_window_controller.h" |
| 9 #include "base/time/time.h" | 9 #include "base/time/time.h" |
| 10 #include "ui/aura/window.h" | 10 #include "ui/aura/window.h" |
| 11 #include "ui/compositor/scoped_layer_animation_settings.h" | 11 #include "ui/compositor/scoped_layer_animation_settings.h" |
| 12 #include "ui/views/widget/widget.h" | 12 #include "ui/views/widget/widget.h" |
| 13 | 13 |
| 14 namespace ash { | 14 namespace ash { |
| 15 namespace internal { | 15 namespace internal { |
| 16 | 16 |
| 17 DesktopBackgroundFadeController::DesktopBackgroundFadeController( | 17 DesktopBackgroundFadeController::DesktopBackgroundFadeController( |
| 18 aura::Window* parent, | 18 aura::Window* parent, |
| 19 aura::Window* position_above, | 19 aura::Window* position_above, |
| 20 base::TimeDelta duration, | 20 base::TimeDelta duration, |
| 21 Direction direction) { | 21 Direction direction) { |
| 22 SkColor start_color, target_color; | 22 SkColor start_color, target_color; |
| 23 ui::Tween::Type tween_type; | 23 gfx::Tween::Type tween_type; |
| 24 if (direction == FADE_OUT) { | 24 if (direction == FADE_OUT) { |
| 25 start_color = SkColorSetARGB(0, 0, 0, 0); | 25 start_color = SkColorSetARGB(0, 0, 0, 0); |
| 26 target_color = SK_ColorBLACK; | 26 target_color = SK_ColorBLACK; |
| 27 tween_type = ui::Tween::EASE_IN_OUT; | 27 tween_type = gfx::Tween::EASE_IN_OUT; |
| 28 } else { | 28 } else { |
| 29 start_color = SK_ColorBLACK; | 29 start_color = SK_ColorBLACK; |
| 30 target_color = SkColorSetARGB(0, 0, 0, 0); | 30 target_color = SkColorSetARGB(0, 0, 0, 0); |
| 31 tween_type = ui::Tween::EASE_IN_OUT; | 31 tween_type = gfx::Tween::EASE_IN_OUT; |
| 32 } | 32 } |
| 33 | 33 |
| 34 window_controller_.reset( | 34 window_controller_.reset( |
| 35 new ColoredWindowController(parent, "DesktopFade")); | 35 new ColoredWindowController(parent, "DesktopFade")); |
| 36 | 36 |
| 37 // Force the window to be directly on top of the desktop. | 37 // Force the window to be directly on top of the desktop. |
| 38 aura::Window* fade_window = window_controller_->GetWidget()->GetNativeView(); | 38 aura::Window* fade_window = window_controller_->GetWidget()->GetNativeView(); |
| 39 parent->StackChildBelow(fade_window, position_above); | 39 parent->StackChildBelow(fade_window, position_above); |
| 40 parent->StackChildAbove(fade_window, position_above); | 40 parent->StackChildAbove(fade_window, position_above); |
| 41 window_controller_->SetColor(start_color); | 41 window_controller_->SetColor(start_color); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 56 DesktopBackgroundFadeController::~DesktopBackgroundFadeController() { | 56 DesktopBackgroundFadeController::~DesktopBackgroundFadeController() { |
| 57 StopObservingImplicitAnimations(); | 57 StopObservingImplicitAnimations(); |
| 58 } | 58 } |
| 59 | 59 |
| 60 void DesktopBackgroundFadeController::OnImplicitAnimationsCompleted() { | 60 void DesktopBackgroundFadeController::OnImplicitAnimationsCompleted() { |
| 61 window_controller_.reset(); | 61 window_controller_.reset(); |
| 62 } | 62 } |
| 63 | 63 |
| 64 } // namespace internal | 64 } // namespace internal |
| 65 } // namespace ash | 65 } // namespace ash |
| OLD | NEW |