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 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 static const double kSelectedTabThrobScale = .5; | 190 static const double kSelectedTabThrobScale = .5; |
191 | 191 |
192 // Durations for the various parts of the mini tab title animation. | 192 // Durations for the various parts of the mini tab title animation. |
193 static const int kMiniTitleChangeAnimationDuration1MS = 1600; | 193 static const int kMiniTitleChangeAnimationDuration1MS = 1600; |
194 static const int kMiniTitleChangeAnimationStart1MS = 0; | 194 static const int kMiniTitleChangeAnimationStart1MS = 0; |
195 static const int kMiniTitleChangeAnimationEnd1MS = 1900; | 195 static const int kMiniTitleChangeAnimationEnd1MS = 1900; |
196 static const int kMiniTitleChangeAnimationDuration2MS = 0; | 196 static const int kMiniTitleChangeAnimationDuration2MS = 0; |
197 static const int kMiniTitleChangeAnimationDuration3MS = 550; | 197 static const int kMiniTitleChangeAnimationDuration3MS = 550; |
198 static const int kMiniTitleChangeAnimationStart3MS = 150; | 198 static const int kMiniTitleChangeAnimationStart3MS = 150; |
199 static const int kMiniTitleChangeAnimationEnd3MS = 800; | 199 static const int kMiniTitleChangeAnimationEnd3MS = 800; |
| 200 static const int kMiniTitleChangeAnimationIntervalMS = 40; |
200 | 201 |
201 // Offset from the right edge for the start of the mini title change animation. | 202 // Offset from the right edge for the start of the mini title change animation. |
202 static const int kMiniTitleChangeInitialXOffset = 6; | 203 static const int kMiniTitleChangeInitialXOffset = 6; |
203 | 204 |
204 // Radius of the radial gradient used for mini title change animation. | 205 // Radius of the radial gradient used for mini title change animation. |
205 static const int kMiniTitleChangeGradientRadius = 20; | 206 static const int kMiniTitleChangeGradientRadius = 20; |
206 | 207 |
207 // Colors of the gradient used during the mini title change animation. | 208 // Colors of the gradient used during the mini title change animation. |
208 static const SkColor kMiniTitleChangeGradientColor1 = SK_ColorWHITE; | 209 static const SkColor kMiniTitleChangeGradientColor1 = SK_ColorWHITE; |
209 static const SkColor kMiniTitleChangeGradientColor2 = | 210 static const SkColor kMiniTitleChangeGradientColor2 = |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 parts.push_back( | 255 parts.push_back( |
255 ui::MultiAnimation::Part(kMiniTitleChangeAnimationDuration2MS, | 256 ui::MultiAnimation::Part(kMiniTitleChangeAnimationDuration2MS, |
256 ui::Tween::ZERO)); | 257 ui::Tween::ZERO)); |
257 parts.push_back( | 258 parts.push_back( |
258 ui::MultiAnimation::Part(kMiniTitleChangeAnimationDuration3MS, | 259 ui::MultiAnimation::Part(kMiniTitleChangeAnimationDuration3MS, |
259 ui::Tween::EASE_IN)); | 260 ui::Tween::EASE_IN)); |
260 parts[0].start_time_ms = kMiniTitleChangeAnimationStart1MS; | 261 parts[0].start_time_ms = kMiniTitleChangeAnimationStart1MS; |
261 parts[0].end_time_ms = kMiniTitleChangeAnimationEnd1MS; | 262 parts[0].end_time_ms = kMiniTitleChangeAnimationEnd1MS; |
262 parts[2].start_time_ms = kMiniTitleChangeAnimationStart3MS; | 263 parts[2].start_time_ms = kMiniTitleChangeAnimationStart3MS; |
263 parts[2].end_time_ms = kMiniTitleChangeAnimationEnd3MS; | 264 parts[2].end_time_ms = kMiniTitleChangeAnimationEnd3MS; |
264 mini_title_animation_.reset(new ui::MultiAnimation(parts)); | 265 mini_title_animation_.reset(new ui::MultiAnimation( |
| 266 parts, |
| 267 base::TimeDelta::FromMilliseconds( |
| 268 kMiniTitleChangeAnimationIntervalMS))); |
265 mini_title_animation_->SetContainer(animation_container()); | 269 mini_title_animation_->SetContainer(animation_container()); |
266 mini_title_animation_->set_delegate(this); | 270 mini_title_animation_->set_delegate(this); |
267 } | 271 } |
268 mini_title_animation_->Start(); | 272 mini_title_animation_->Start(); |
269 } | 273 } |
270 | 274 |
271 void Tab::StopMiniTabTitleAnimation() { | 275 void Tab::StopMiniTabTitleAnimation() { |
272 if (mini_title_animation_.get()) | 276 if (mini_title_animation_.get()) |
273 mini_title_animation_->Stop(); | 277 mini_title_animation_->Stop(); |
274 } | 278 } |
(...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
886 ui::ScaleFactor scale_factor, | 890 ui::ScaleFactor scale_factor, |
887 const gfx::ImageSkia& image) { | 891 const gfx::ImageSkia& image) { |
888 ImageCacheEntry entry; | 892 ImageCacheEntry entry; |
889 entry.resource_id = resource_id; | 893 entry.resource_id = resource_id; |
890 entry.scale_factor = scale_factor; | 894 entry.scale_factor = scale_factor; |
891 entry.image = image; | 895 entry.image = image; |
892 image_cache_->push_front(entry); | 896 image_cache_->push_front(entry); |
893 if (image_cache_->size() > kMaxImageCacheSize) | 897 if (image_cache_->size() > kMaxImageCacheSize) |
894 image_cache_->pop_back(); | 898 image_cache_->pop_back(); |
895 } | 899 } |
OLD | NEW |