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 "chrome/browser/ui/search/toolbar_search_animator.h" | 5 #include "chrome/browser/ui/search/toolbar_search_animator.h" |
6 | 6 |
7 #include "chrome/browser/ui/search/search_model.h" | 7 #include "chrome/browser/ui/search/search_model.h" |
8 #include "chrome/browser/ui/search/search_types.h" | 8 #include "chrome/browser/ui/search/search_types.h" |
9 #include "chrome/browser/ui/search/toolbar_search_animator_observer.h" | 9 #include "chrome/browser/ui/search/toolbar_search_animator_observer.h" |
10 #include "chrome/browser/ui/tab_contents/tab_contents.h" | 10 #include "chrome/browser/ui/tab_contents/tab_contents.h" |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 } | 129 } |
130 | 130 |
131 void ToolbarSearchAnimator::InitBackgroundAnimation() { | 131 void ToolbarSearchAnimator::InitBackgroundAnimation() { |
132 ui::MultiAnimation::Parts parts; | 132 ui::MultiAnimation::Parts parts; |
133 parts.push_back(ui::MultiAnimation::Part( | 133 parts.push_back(ui::MultiAnimation::Part( |
134 background_change_delay_ms_ * InstantUI::GetSlowAnimationScaleFactor(), | 134 background_change_delay_ms_ * InstantUI::GetSlowAnimationScaleFactor(), |
135 ui::Tween::ZERO)); | 135 ui::Tween::ZERO)); |
136 parts.push_back(ui::MultiAnimation::Part( | 136 parts.push_back(ui::MultiAnimation::Part( |
137 background_change_duration_ms_ * InstantUI::GetSlowAnimationScaleFactor(), | 137 background_change_duration_ms_ * InstantUI::GetSlowAnimationScaleFactor(), |
138 ui::Tween::LINEAR)); | 138 ui::Tween::LINEAR)); |
139 background_animation_.reset(new ui::MultiAnimation( | 139 background_animation_.reset(new ui::MultiAnimation(parts)); |
140 parts, | |
141 ui::MultiAnimation::GetDefaultTimerInterval())); | |
142 background_animation_->set_continuous(false); | 140 background_animation_->set_continuous(false); |
143 background_animation_->set_delegate(this); | 141 background_animation_->set_delegate(this); |
144 } | 142 } |
145 | 143 |
146 void ToolbarSearchAnimator::StartBackgroundChange() { | 144 void ToolbarSearchAnimator::StartBackgroundChange() { |
147 InitBackgroundAnimation(); | 145 InitBackgroundAnimation(); |
148 background_animation_->Start(); | 146 background_animation_->Start(); |
149 } | 147 } |
150 | 148 |
151 void ToolbarSearchAnimator::Reset(TabContents* tab_contents) { | 149 void ToolbarSearchAnimator::Reset(TabContents* tab_contents) { |
152 bool notify_background_observers = | 150 bool notify_background_observers = |
153 background_animation_.get() && background_animation_->is_animating(); | 151 background_animation_.get() && background_animation_->is_animating(); |
154 | 152 |
155 background_animation_.reset(); | 153 background_animation_.reset(); |
156 | 154 |
157 // Notify observers of animation cancelation. | 155 // Notify observers of animation cancelation. |
158 if (notify_background_observers) { | 156 if (notify_background_observers) { |
159 FOR_EACH_OBSERVER(ToolbarSearchAnimatorObserver, observers_, | 157 FOR_EACH_OBSERVER(ToolbarSearchAnimatorObserver, observers_, |
160 OnToolbarBackgroundAnimatorCanceled(tab_contents)); | 158 OnToolbarBackgroundAnimatorCanceled(tab_contents)); |
161 } | 159 } |
162 } | 160 } |
163 | 161 |
164 } // namespace search | 162 } // namespace search |
165 } // namespace chrome | 163 } // namespace chrome |
OLD | NEW |