| 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/desktop_background/user_wallpaper_delegate.h" | 8 #include "ash/desktop_background/user_wallpaper_delegate.h" |
| 9 #include "ash/root_window_controller.h" | 9 #include "ash/root_window_controller.h" |
| 10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 ShowWallpaperAnimationObserver(RootWindowController* root_window_controller, | 23 ShowWallpaperAnimationObserver(RootWindowController* root_window_controller, |
| 24 views::Widget* desktop_widget, | 24 views::Widget* desktop_widget, |
| 25 bool is_initial_animation) | 25 bool is_initial_animation) |
| 26 : root_window_controller_(root_window_controller), | 26 : root_window_controller_(root_window_controller), |
| 27 desktop_widget_(desktop_widget), | 27 desktop_widget_(desktop_widget), |
| 28 is_initial_animation_(is_initial_animation) { | 28 is_initial_animation_(is_initial_animation) { |
| 29 DCHECK(desktop_widget_); | 29 DCHECK(desktop_widget_); |
| 30 desktop_widget_->AddObserver(this); | 30 desktop_widget_->AddObserver(this); |
| 31 } | 31 } |
| 32 | 32 |
| 33 virtual ~ShowWallpaperAnimationObserver() { | 33 ~ShowWallpaperAnimationObserver() override { |
| 34 StopObservingImplicitAnimations(); | 34 StopObservingImplicitAnimations(); |
| 35 if (desktop_widget_) | 35 if (desktop_widget_) |
| 36 desktop_widget_->RemoveObserver(this); | 36 desktop_widget_->RemoveObserver(this); |
| 37 } | 37 } |
| 38 | 38 |
| 39 private: | 39 private: |
| 40 // Overridden from ui::ImplicitAnimationObserver: | 40 // Overridden from ui::ImplicitAnimationObserver: |
| 41 virtual void OnImplicitAnimationsScheduled() override { | 41 void OnImplicitAnimationsScheduled() override { |
| 42 if (is_initial_animation_) { | 42 if (is_initial_animation_) { |
| 43 root_window_controller_-> | 43 root_window_controller_-> |
| 44 HandleInitialDesktopBackgroundAnimationStarted(); | 44 HandleInitialDesktopBackgroundAnimationStarted(); |
| 45 } | 45 } |
| 46 } | 46 } |
| 47 | 47 |
| 48 virtual void OnImplicitAnimationsCompleted() override { | 48 void OnImplicitAnimationsCompleted() override { |
| 49 root_window_controller_->OnWallpaperAnimationFinished(desktop_widget_); | 49 root_window_controller_->OnWallpaperAnimationFinished(desktop_widget_); |
| 50 delete this; | 50 delete this; |
| 51 } | 51 } |
| 52 | 52 |
| 53 // Overridden from views::WidgetObserver. | 53 // Overridden from views::WidgetObserver. |
| 54 virtual void OnWidgetDestroying(views::Widget* widget) override { | 54 void OnWidgetDestroying(views::Widget* widget) override { delete this; } |
| 55 delete this; | |
| 56 } | |
| 57 | 55 |
| 58 RootWindowController* root_window_controller_; | 56 RootWindowController* root_window_controller_; |
| 59 views::Widget* desktop_widget_; | 57 views::Widget* desktop_widget_; |
| 60 | 58 |
| 61 // Is this object observing the initial brightness/grayscale animation? | 59 // Is this object observing the initial brightness/grayscale animation? |
| 62 const bool is_initial_animation_; | 60 const bool is_initial_animation_; |
| 63 | 61 |
| 64 DISALLOW_COPY_AND_ASSIGN(ShowWallpaperAnimationObserver); | 62 DISALLOW_COPY_AND_ASSIGN(ShowWallpaperAnimationObserver); |
| 65 }; | 63 }; |
| 66 | 64 |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 } | 135 } |
| 138 | 136 |
| 139 DesktopBackgroundWidgetController* AnimatingDesktopController::GetController( | 137 DesktopBackgroundWidgetController* AnimatingDesktopController::GetController( |
| 140 bool pass_ownership) { | 138 bool pass_ownership) { |
| 141 if (pass_ownership) | 139 if (pass_ownership) |
| 142 return controller_.release(); | 140 return controller_.release(); |
| 143 return controller_.get(); | 141 return controller_.get(); |
| 144 } | 142 } |
| 145 | 143 |
| 146 } // namespace ash | 144 } // namespace ash |
| OLD | NEW |