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/views/tabs/tab.h" | 5 #include "chrome/browser/ui/views/tabs/tab.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 | 8 |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "chrome/browser/defaults.h" | 10 #include "chrome/browser/defaults.h" |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 static const double kSelectedTabThrobScale = .5; | 189 static const double kSelectedTabThrobScale = .5; |
190 | 190 |
191 // Durations for the various parts of the mini tab title animation. | 191 // Durations for the various parts of the mini tab title animation. |
192 static const int kMiniTitleChangeAnimationDuration1MS = 1600; | 192 static const int kMiniTitleChangeAnimationDuration1MS = 1600; |
193 static const int kMiniTitleChangeAnimationStart1MS = 0; | 193 static const int kMiniTitleChangeAnimationStart1MS = 0; |
194 static const int kMiniTitleChangeAnimationEnd1MS = 1900; | 194 static const int kMiniTitleChangeAnimationEnd1MS = 1900; |
195 static const int kMiniTitleChangeAnimationDuration2MS = 0; | 195 static const int kMiniTitleChangeAnimationDuration2MS = 0; |
196 static const int kMiniTitleChangeAnimationDuration3MS = 550; | 196 static const int kMiniTitleChangeAnimationDuration3MS = 550; |
197 static const int kMiniTitleChangeAnimationStart3MS = 150; | 197 static const int kMiniTitleChangeAnimationStart3MS = 150; |
198 static const int kMiniTitleChangeAnimationEnd3MS = 800; | 198 static const int kMiniTitleChangeAnimationEnd3MS = 800; |
| 199 static const int kMiniTitleChangeAnimationIntervalMS = 40; |
199 | 200 |
200 // Offset from the right edge for the start of the mini title change animation. | 201 // Offset from the right edge for the start of the mini title change animation. |
201 static const int kMiniTitleChangeInitialXOffset = 6; | 202 static const int kMiniTitleChangeInitialXOffset = 6; |
202 | 203 |
203 // Radius of the radial gradient used for mini title change animation. | 204 // Radius of the radial gradient used for mini title change animation. |
204 static const int kMiniTitleChangeGradientRadius = 20; | 205 static const int kMiniTitleChangeGradientRadius = 20; |
205 | 206 |
206 // Colors of the gradient used during the mini title change animation. | 207 // Colors of the gradient used during the mini title change animation. |
207 static const SkColor kMiniTitleChangeGradientColor1 = SK_ColorWHITE; | 208 static const SkColor kMiniTitleChangeGradientColor1 = SK_ColorWHITE; |
208 static const SkColor kMiniTitleChangeGradientColor2 = | 209 static const SkColor kMiniTitleChangeGradientColor2 = |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 parts.push_back( | 242 parts.push_back( |
242 ui::MultiAnimation::Part(kMiniTitleChangeAnimationDuration2MS, | 243 ui::MultiAnimation::Part(kMiniTitleChangeAnimationDuration2MS, |
243 ui::Tween::ZERO)); | 244 ui::Tween::ZERO)); |
244 parts.push_back( | 245 parts.push_back( |
245 ui::MultiAnimation::Part(kMiniTitleChangeAnimationDuration3MS, | 246 ui::MultiAnimation::Part(kMiniTitleChangeAnimationDuration3MS, |
246 ui::Tween::EASE_IN)); | 247 ui::Tween::EASE_IN)); |
247 parts[0].start_time_ms = kMiniTitleChangeAnimationStart1MS; | 248 parts[0].start_time_ms = kMiniTitleChangeAnimationStart1MS; |
248 parts[0].end_time_ms = kMiniTitleChangeAnimationEnd1MS; | 249 parts[0].end_time_ms = kMiniTitleChangeAnimationEnd1MS; |
249 parts[2].start_time_ms = kMiniTitleChangeAnimationStart3MS; | 250 parts[2].start_time_ms = kMiniTitleChangeAnimationStart3MS; |
250 parts[2].end_time_ms = kMiniTitleChangeAnimationEnd3MS; | 251 parts[2].end_time_ms = kMiniTitleChangeAnimationEnd3MS; |
251 mini_title_animation_.reset(new ui::MultiAnimation(parts)); | 252 mini_title_animation_.reset(new ui::MultiAnimation( |
| 253 parts, |
| 254 base::TimeDelta::FromMilliseconds( |
| 255 kMiniTitleChangeAnimationIntervalMS))); |
252 mini_title_animation_->SetContainer(animation_container()); | 256 mini_title_animation_->SetContainer(animation_container()); |
253 mini_title_animation_->set_delegate(this); | 257 mini_title_animation_->set_delegate(this); |
254 } | 258 } |
255 mini_title_animation_->Start(); | 259 mini_title_animation_->Start(); |
256 } | 260 } |
257 | 261 |
258 void Tab::StopMiniTabTitleAnimation() { | 262 void Tab::StopMiniTabTitleAnimation() { |
259 if (mini_title_animation_.get()) | 263 if (mini_title_animation_.get()) |
260 mini_title_animation_->Stop(); | 264 mini_title_animation_->Stop(); |
261 } | 265 } |
(...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
843 rb.GetImageSkiaNamed(IDR_TAB_ACTIVE_RIGHT_SEARCH); | 847 rb.GetImageSkiaNamed(IDR_TAB_ACTIVE_RIGHT_SEARCH); |
844 tab_active_search_.l_width = tab_active_search_.image_l->width(); | 848 tab_active_search_.l_width = tab_active_search_.image_l->width(); |
845 tab_active_search_.r_width = tab_active_search_.image_r->width(); | 849 tab_active_search_.r_width = tab_active_search_.image_r->width(); |
846 | 850 |
847 tab_inactive_.image_l = rb.GetImageSkiaNamed(IDR_TAB_INACTIVE_LEFT); | 851 tab_inactive_.image_l = rb.GetImageSkiaNamed(IDR_TAB_INACTIVE_LEFT); |
848 tab_inactive_.image_c = rb.GetImageSkiaNamed(IDR_TAB_INACTIVE_CENTER); | 852 tab_inactive_.image_c = rb.GetImageSkiaNamed(IDR_TAB_INACTIVE_CENTER); |
849 tab_inactive_.image_r = rb.GetImageSkiaNamed(IDR_TAB_INACTIVE_RIGHT); | 853 tab_inactive_.image_r = rb.GetImageSkiaNamed(IDR_TAB_INACTIVE_RIGHT); |
850 tab_inactive_.l_width = tab_inactive_.image_l->width(); | 854 tab_inactive_.l_width = tab_inactive_.image_l->width(); |
851 tab_inactive_.r_width = tab_inactive_.image_r->width(); | 855 tab_inactive_.r_width = tab_inactive_.image_r->width(); |
852 } | 856 } |
OLD | NEW |