| 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/desktop_background/desktop_background_widget_controller.h" | 5 #include "ash/desktop_background/desktop_background_widget_controller.h" |
| 6 | 6 |
| 7 #include "ash/ash_export.h" | 7 #include "ash/ash_export.h" |
| 8 #include "ash/common/wallpaper/wallpaper_delegate.h" |
| 8 #include "ash/common/wm_lookup.h" | 9 #include "ash/common/wm_lookup.h" |
| 10 #include "ash/common/wm_shell.h" |
| 9 #include "ash/common/wm_window.h" | 11 #include "ash/common/wm_window.h" |
| 10 #include "ash/desktop_background/user_wallpaper_delegate.h" | |
| 11 #include "ash/root_window_controller.h" | 12 #include "ash/root_window_controller.h" |
| 12 #include "ash/shell.h" | |
| 13 #include "ui/aura/window.h" | 13 #include "ui/aura/window.h" |
| 14 #include "ui/compositor/layer_animation_observer.h" | 14 #include "ui/compositor/layer_animation_observer.h" |
| 15 #include "ui/compositor/scoped_layer_animation_settings.h" | 15 #include "ui/compositor/scoped_layer_animation_settings.h" |
| 16 #include "ui/views/widget/widget.h" | 16 #include "ui/views/widget/widget.h" |
| 17 | 17 |
| 18 namespace ash { | 18 namespace ash { |
| 19 namespace { | 19 namespace { |
| 20 | 20 |
| 21 class ShowWallpaperAnimationObserver : public ui::ImplicitAnimationObserver, | 21 class ShowWallpaperAnimationObserver : public ui::ImplicitAnimationObserver, |
| 22 public views::WidgetObserver { | 22 public views::WidgetObserver { |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 const gfx::Rect& new_bounds) { | 118 const gfx::Rect& new_bounds) { |
| 119 SetBounds(new_bounds); | 119 SetBounds(new_bounds); |
| 120 } | 120 } |
| 121 | 121 |
| 122 void DesktopBackgroundWidgetController::StartAnimating( | 122 void DesktopBackgroundWidgetController::StartAnimating( |
| 123 RootWindowController* root_window_controller) { | 123 RootWindowController* root_window_controller) { |
| 124 if (widget_) { | 124 if (widget_) { |
| 125 ui::ScopedLayerAnimationSettings settings( | 125 ui::ScopedLayerAnimationSettings settings( |
| 126 widget_->GetNativeView()->layer()->GetAnimator()); | 126 widget_->GetNativeView()->layer()->GetAnimator()); |
| 127 settings.AddObserver(new ShowWallpaperAnimationObserver( | 127 settings.AddObserver(new ShowWallpaperAnimationObserver( |
| 128 root_window_controller, widget_, Shell::GetInstance() | 128 root_window_controller, widget_, |
| 129 ->user_wallpaper_delegate() | 129 WmShell::Get()->wallpaper_delegate()->ShouldShowInitialAnimation())); |
| 130 ->ShouldShowInitialAnimation())); | |
| 131 // When |widget_| shows, AnimateShowWindowCommon() is called to do the | 130 // When |widget_| shows, AnimateShowWindowCommon() is called to do the |
| 132 // animation. Sets transition duration to 0 to avoid animating to the | 131 // animation. Sets transition duration to 0 to avoid animating to the |
| 133 // show animation's initial values. | 132 // show animation's initial values. |
| 134 settings.SetTransitionDuration(base::TimeDelta()); | 133 settings.SetTransitionDuration(base::TimeDelta()); |
| 135 widget_->Show(); | 134 widget_->Show(); |
| 136 } | 135 } |
| 137 } | 136 } |
| 138 | 137 |
| 139 AnimatingDesktopController::AnimatingDesktopController( | 138 AnimatingDesktopController::AnimatingDesktopController( |
| 140 DesktopBackgroundWidgetController* component) { | 139 DesktopBackgroundWidgetController* component) { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 151 } | 150 } |
| 152 | 151 |
| 153 DesktopBackgroundWidgetController* AnimatingDesktopController::GetController( | 152 DesktopBackgroundWidgetController* AnimatingDesktopController::GetController( |
| 154 bool pass_ownership) { | 153 bool pass_ownership) { |
| 155 if (pass_ownership) | 154 if (pass_ownership) |
| 156 return controller_.release(); | 155 return controller_.release(); |
| 157 return controller_.get(); | 156 return controller_.get(); |
| 158 } | 157 } |
| 159 | 158 |
| 160 } // namespace ash | 159 } // namespace ash |
| OLD | NEW |