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/toolbar/toolbar_model.h" | 10 #include "chrome/browser/ui/toolbar/toolbar_model.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(parts)); | 139 background_animation_.reset(new ui::MultiAnimation( |
| 140 parts, |
| 141 ui::MultiAnimation::GetDefaultTimerInterval())); |
140 background_animation_->set_continuous(false); | 142 background_animation_->set_continuous(false); |
141 background_animation_->set_delegate(this); | 143 background_animation_->set_delegate(this); |
142 } | 144 } |
143 | 145 |
144 void ToolbarSearchAnimator::StartBackgroundChange() { | 146 void ToolbarSearchAnimator::StartBackgroundChange() { |
145 InitBackgroundAnimation(); | 147 InitBackgroundAnimation(); |
146 background_animation_->Start(); | 148 background_animation_->Start(); |
147 } | 149 } |
148 | 150 |
149 void ToolbarSearchAnimator::Reset(content::WebContents* web_contents) { | 151 void ToolbarSearchAnimator::Reset(content::WebContents* web_contents) { |
150 bool notify_background_observers = | 152 bool notify_background_observers = |
151 background_animation_.get() && background_animation_->is_animating(); | 153 background_animation_.get() && background_animation_->is_animating(); |
152 | 154 |
153 background_animation_.reset(); | 155 background_animation_.reset(); |
154 | 156 |
155 // Notify observers of animation cancelation. | 157 // Notify observers of animation cancelation. |
156 if (notify_background_observers) { | 158 if (notify_background_observers) { |
157 FOR_EACH_OBSERVER(ToolbarSearchAnimatorObserver, observers_, | 159 FOR_EACH_OBSERVER(ToolbarSearchAnimatorObserver, observers_, |
158 OnToolbarBackgroundAnimatorCanceled(web_contents)); | 160 OnToolbarBackgroundAnimatorCanceled(web_contents)); |
159 } | 161 } |
160 } | 162 } |
161 | 163 |
162 } // namespace search | 164 } // namespace search |
163 } // namespace chrome | 165 } // namespace chrome |
OLD | NEW |