OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/views/tabs/tab.h" | 5 #include "chrome/browser/views/tabs/tab.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 | 8 |
9 #include "app/multi_animation.h" | 9 #include "app/multi_animation.h" |
10 #include "app/resource_bundle.h" | 10 #include "app/resource_bundle.h" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 browser_defaults::kMiniTabWidth + 30; | 51 browser_defaults::kMiniTabWidth + 30; |
52 | 52 |
53 // How opaque to make the hover state (out of 1). | 53 // How opaque to make the hover state (out of 1). |
54 static const double kHoverOpacity = 0.33; | 54 static const double kHoverOpacity = 0.33; |
55 | 55 |
56 Tab::TabImage Tab::tab_alpha = {0}; | 56 Tab::TabImage Tab::tab_alpha = {0}; |
57 Tab::TabImage Tab::tab_active = {0}; | 57 Tab::TabImage Tab::tab_active = {0}; |
58 Tab::TabImage Tab::tab_inactive = {0}; | 58 Tab::TabImage Tab::tab_inactive = {0}; |
59 | 59 |
60 // Durations for the various parts of the mini tab title animation. | 60 // Durations for the various parts of the mini tab title animation. |
61 static const int kMiniTitleChangeAnimationDuration1MS = 1000; | 61 static const int kMiniTitleChangeAnimationDuration1MS = 1600; |
62 static const int kMiniTitleChangeAnimationDuration2MS = 500; | 62 static const int kMiniTitleChangeAnimationStart1MS = 0; |
63 static const int kMiniTitleChangeAnimationDuration3MS = 800; | 63 static const int kMiniTitleChangeAnimationEnd1MS = 1900; |
| 64 static const int kMiniTitleChangeAnimationDuration2MS = 0; |
| 65 static const int kMiniTitleChangeAnimationDuration3MS = 550; |
| 66 static const int kMiniTitleChangeAnimationStart3MS = 150; |
| 67 static const int kMiniTitleChangeAnimationEnd3MS = 800; |
64 | 68 |
65 // Offset from the right edge for the start of the mini title change animation. | 69 // Offset from the right edge for the start of the mini title change animation. |
66 static const int kMiniTitleChangeInitialXOffset = 6; | 70 static const int kMiniTitleChangeInitialXOffset = 6; |
67 | 71 |
68 // Radius of the radial gradient used for mini title change animation. | 72 // Radius of the radial gradient used for mini title change animation. |
69 static const int kMiniTitleChangeGradientRadius = 20; | 73 static const int kMiniTitleChangeGradientRadius = 20; |
70 | 74 |
71 // Colors of the gradient used during the mini title change animation. | 75 // Colors of the gradient used during the mini title change animation. |
72 static const SkColor kMiniTitleChangeGradientColor1 = SK_ColorWHITE; | 76 static const SkColor kMiniTitleChangeGradientColor1 = SK_ColorWHITE; |
73 static const SkColor kMiniTitleChangeGradientColor2 = | 77 static const SkColor kMiniTitleChangeGradientColor2 = |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 | 114 |
111 void Tab::StartMiniTabTitleAnimation() { | 115 void Tab::StartMiniTabTitleAnimation() { |
112 if (!mini_title_animation_.get()) { | 116 if (!mini_title_animation_.get()) { |
113 MultiAnimation::Parts parts; | 117 MultiAnimation::Parts parts; |
114 parts.push_back(MultiAnimation::Part(kMiniTitleChangeAnimationDuration1MS, | 118 parts.push_back(MultiAnimation::Part(kMiniTitleChangeAnimationDuration1MS, |
115 Tween::EASE_OUT)); | 119 Tween::EASE_OUT)); |
116 parts.push_back(MultiAnimation::Part(kMiniTitleChangeAnimationDuration2MS, | 120 parts.push_back(MultiAnimation::Part(kMiniTitleChangeAnimationDuration2MS, |
117 Tween::ZERO)); | 121 Tween::ZERO)); |
118 parts.push_back(MultiAnimation::Part(kMiniTitleChangeAnimationDuration3MS, | 122 parts.push_back(MultiAnimation::Part(kMiniTitleChangeAnimationDuration3MS, |
119 Tween::EASE_IN)); | 123 Tween::EASE_IN)); |
| 124 parts[0].start_time_ms = kMiniTitleChangeAnimationStart1MS; |
| 125 parts[0].end_time_ms = kMiniTitleChangeAnimationEnd1MS; |
| 126 parts[2].start_time_ms = kMiniTitleChangeAnimationStart3MS; |
| 127 parts[2].end_time_ms = kMiniTitleChangeAnimationEnd3MS; |
120 mini_title_animation_.reset(new MultiAnimation(parts)); | 128 mini_title_animation_.reset(new MultiAnimation(parts)); |
121 mini_title_animation_->SetContainer(animation_container()); | 129 mini_title_animation_->SetContainer(animation_container()); |
122 mini_title_animation_->set_delegate(this); | 130 mini_title_animation_->set_delegate(this); |
123 } | 131 } |
124 mini_title_animation_->Start(); | 132 mini_title_animation_->Start(); |
125 } | 133 } |
126 | 134 |
127 void Tab::StopMiniTabTitleAnimation() { | 135 void Tab::StopMiniTabTitleAnimation() { |
128 if (mini_title_animation_.get()) | 136 if (mini_title_animation_.get()) |
129 mini_title_animation_->Stop(); | 137 mini_title_animation_->Stop(); |
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
596 tab_active.image_r = rb.GetBitmapNamed(IDR_TAB_ACTIVE_RIGHT); | 604 tab_active.image_r = rb.GetBitmapNamed(IDR_TAB_ACTIVE_RIGHT); |
597 tab_active.l_width = tab_active.image_l->width(); | 605 tab_active.l_width = tab_active.image_l->width(); |
598 tab_active.r_width = tab_active.image_r->width(); | 606 tab_active.r_width = tab_active.image_r->width(); |
599 | 607 |
600 tab_inactive.image_l = rb.GetBitmapNamed(IDR_TAB_INACTIVE_LEFT); | 608 tab_inactive.image_l = rb.GetBitmapNamed(IDR_TAB_INACTIVE_LEFT); |
601 tab_inactive.image_c = rb.GetBitmapNamed(IDR_TAB_INACTIVE_CENTER); | 609 tab_inactive.image_c = rb.GetBitmapNamed(IDR_TAB_INACTIVE_CENTER); |
602 tab_inactive.image_r = rb.GetBitmapNamed(IDR_TAB_INACTIVE_RIGHT); | 610 tab_inactive.image_r = rb.GetBitmapNamed(IDR_TAB_INACTIVE_RIGHT); |
603 tab_inactive.l_width = tab_inactive.image_l->width(); | 611 tab_inactive.l_width = tab_inactive.image_l->width(); |
604 tab_inactive.r_width = tab_inactive.image_r->width(); | 612 tab_inactive.r_width = tab_inactive.image_r->width(); |
605 } | 613 } |
OLD | NEW |