| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "ui/gfx/animation/animation.h" | 5 #include "ui/gfx/animation/animation.h" |
| 6 | 6 |
| 7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
| 8 #include "ui/gfx/animation/animation_container.h" | 8 #include "ui/gfx/animation/animation_container.h" |
| 9 #include "ui/gfx/animation/animation_delegate.h" | 9 #include "ui/gfx/animation/animation_delegate.h" |
| 10 #include "ui/gfx/animation/tween.h" | 10 #include "ui/gfx/animation/tween.h" |
| 11 #include "ui/gfx/geometry/rect.h" | 11 #include "ui/gfx/geometry/rect.h" |
| 12 | 12 |
| 13 #if defined(OS_WIN) | |
| 14 #include "base/win/windows_version.h" | |
| 15 #endif | |
| 16 | |
| 17 namespace gfx { | 13 namespace gfx { |
| 18 | 14 |
| 19 Animation::Animation(base::TimeDelta timer_interval) | 15 Animation::Animation(base::TimeDelta timer_interval) |
| 20 : timer_interval_(timer_interval), | 16 : timer_interval_(timer_interval), |
| 21 is_animating_(false), | 17 is_animating_(false), |
| 22 delegate_(NULL) { | 18 delegate_(NULL) { |
| 23 } | 19 } |
| 24 | 20 |
| 25 Animation::~Animation() { | 21 Animation::~Animation() { |
| 26 // Don't send out notification from the destructor. Chances are the delegate | 22 // Don't send out notification from the destructor. Chances are the delegate |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 | 81 |
| 86 if (container) | 82 if (container) |
| 87 container_ = container; | 83 container_ = container; |
| 88 else | 84 else |
| 89 container_ = new AnimationContainer(); | 85 container_ = new AnimationContainer(); |
| 90 | 86 |
| 91 if (is_animating_) | 87 if (is_animating_) |
| 92 container_->Start(this); | 88 container_->Start(this); |
| 93 } | 89 } |
| 94 | 90 |
| 91 #if !defined(OS_WIN) |
| 95 // static | 92 // static |
| 96 bool Animation::ShouldRenderRichAnimation() { | 93 bool Animation::ShouldRenderRichAnimation() { |
| 97 #if defined(OS_WIN) | 94 // Defined in platform specific file for Windows. |
| 98 if (base::win::GetVersion() >= base::win::VERSION_VISTA) { | |
| 99 BOOL result; | |
| 100 // Get "Turn off all unnecessary animations" value. | |
| 101 if (::SystemParametersInfo(SPI_GETCLIENTAREAANIMATION, 0, &result, 0)) { | |
| 102 return !!result; | |
| 103 } | |
| 104 } | |
| 105 return !::GetSystemMetrics(SM_REMOTESESSION); | |
| 106 #else | |
| 107 return true; | 95 return true; |
| 96 } |
| 108 #endif | 97 #endif |
| 98 |
| 99 #if !defined(OS_WIN) && !defined(OS_MACOSX) |
| 100 // static |
| 101 bool Animation::ScrollAnimationsEnabledBySystem() { |
| 102 // Defined in platform specific files for Windows and OSX. |
| 103 return true; |
| 109 } | 104 } |
| 105 #endif |
| 110 | 106 |
| 111 bool Animation::ShouldSendCanceledFromStop() { | 107 bool Animation::ShouldSendCanceledFromStop() { |
| 112 return false; | 108 return false; |
| 113 } | 109 } |
| 114 | 110 |
| 115 void Animation::SetStartTime(base::TimeTicks start_time) { | 111 void Animation::SetStartTime(base::TimeTicks start_time) { |
| 116 start_time_ = start_time; | 112 start_time_ = start_time; |
| 117 } | 113 } |
| 118 | 114 |
| 119 base::TimeDelta Animation::GetTimerInterval() const { | 115 base::TimeDelta Animation::GetTimerInterval() const { |
| 120 return timer_interval_; | 116 return timer_interval_; |
| 121 } | 117 } |
| 122 | 118 |
| 123 } // namespace gfx | 119 } // namespace gfx |
| OLD | NEW |