| 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 "ui/gfx/animation/animation_container.h" | 7 #include "ui/gfx/animation/animation_container.h" |
| 8 #include "ui/gfx/animation/animation_delegate.h" | 8 #include "ui/gfx/animation/animation_delegate.h" |
| 9 #include "ui/gfx/animation/tween.h" | 9 #include "ui/gfx/animation/tween.h" |
| 10 #include "ui/gfx/rect.h" | 10 #include "ui/gfx/rect.h" |
| 11 | 11 |
| 12 #if defined(OS_WIN) | |
| 13 #include "base/win/windows_version.h" | |
| 14 #endif | |
| 15 | |
| 16 namespace gfx { | 12 namespace gfx { |
| 17 | 13 |
| 18 Animation::Animation(base::TimeDelta timer_interval) | 14 Animation::Animation(base::TimeDelta timer_interval) |
| 19 : timer_interval_(timer_interval), | 15 : timer_interval_(timer_interval), |
| 20 is_animating_(false), | 16 is_animating_(false), |
| 21 delegate_(NULL) { | 17 delegate_(NULL) { |
| 22 } | 18 } |
| 23 | 19 |
| 24 Animation::~Animation() { | 20 Animation::~Animation() { |
| 25 // Don't send out notification from the destructor. Chances are the delegate | 21 // Don't send out notification from the destructor. Chances are the delegate |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 container_ = container; | 82 container_ = container; |
| 87 else | 83 else |
| 88 container_ = new AnimationContainer(); | 84 container_ = new AnimationContainer(); |
| 89 | 85 |
| 90 if (is_animating_) | 86 if (is_animating_) |
| 91 container_->Start(this); | 87 container_->Start(this); |
| 92 } | 88 } |
| 93 | 89 |
| 94 // static | 90 // static |
| 95 bool Animation::ShouldRenderRichAnimation() { | 91 bool Animation::ShouldRenderRichAnimation() { |
| 96 #if defined(OS_WIN) | |
| 97 if (base::win::GetVersion() >= base::win::VERSION_VISTA) { | |
| 98 BOOL result; | |
| 99 // Get "Turn off all unnecessary animations" value. | |
| 100 if (::SystemParametersInfo(SPI_GETCLIENTAREAANIMATION, 0, &result, 0)) { | |
| 101 // There seems to be a typo in the MSDN document (as of May 2009): | |
| 102 // http://msdn.microsoft.com/en-us/library/ms724947(VS.85).aspx | |
| 103 // The document states that the result is TRUE when animations are | |
| 104 // _disabled_, but in fact, it is TRUE when they are _enabled_. | |
| 105 return !!result; | |
| 106 } | |
| 107 } | |
| 108 return !::GetSystemMetrics(SM_REMOTESESSION); | |
| 109 #else | |
| 110 return true; | 92 return true; |
| 111 #endif | |
| 112 } | 93 } |
| 113 | 94 |
| 114 bool Animation::ShouldSendCanceledFromStop() { | 95 bool Animation::ShouldSendCanceledFromStop() { |
| 115 return false; | 96 return false; |
| 116 } | 97 } |
| 117 | 98 |
| 118 void Animation::SetStartTime(base::TimeTicks start_time) { | 99 void Animation::SetStartTime(base::TimeTicks start_time) { |
| 119 start_time_ = start_time; | 100 start_time_ = start_time; |
| 120 } | 101 } |
| 121 | 102 |
| 122 base::TimeDelta Animation::GetTimerInterval() const { | 103 base::TimeDelta Animation::GetTimerInterval() const { |
| 123 return timer_interval_; | 104 return timer_interval_; |
| 124 } | 105 } |
| 125 | 106 |
| 126 } // namespace gfx | 107 } // namespace gfx |
| OLD | NEW |