diff options
author | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-21 16:01:53 +0000 |
---|---|---|
committer | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-21 16:01:53 +0000 |
commit | 379418079f6f422db211d61f1b1142e4025b730c (patch) | |
tree | 5d8b29f7c92276fcfc1b7729df7ba6f864762eaf | |
parent | 080e86faa082c7d2fb8a935c8e189fbb7d1a23c9 (diff) | |
download | chromium_src-379418079f6f422db211d61f1b1142e4025b730c.zip chromium_src-379418079f6f422db211d61f1b1142e4025b730c.tar.gz chromium_src-379418079f6f422db211d61f1b1142e4025b730c.tar.bz2 |
Nukes the new tab animation. I'll remove the images separately.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/2858015
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@50356 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/views/tabs/base_tab_strip.cc | 1 | ||||
-rw-r--r-- | chrome/browser/views/tabs/base_tab_strip.h | 4 | ||||
-rw-r--r-- | chrome/browser/views/tabs/tab.cc | 69 | ||||
-rw-r--r-- | chrome/browser/views/tabs/tab.h | 27 | ||||
-rw-r--r-- | chrome/browser/views/tabs/tab_strip.cc | 253 | ||||
-rw-r--r-- | chrome/browser/views/tabs/tab_strip.h | 52 |
6 files changed, 26 insertions, 380 deletions
diff --git a/chrome/browser/views/tabs/base_tab_strip.cc b/chrome/browser/views/tabs/base_tab_strip.cc index 5008ddb..6457d5c 100644 --- a/chrome/browser/views/tabs/base_tab_strip.cc +++ b/chrome/browser/views/tabs/base_tab_strip.cc @@ -120,7 +120,6 @@ BaseTabStrip::BaseTabStrip(TabStripController* controller, Type type) type_(type), attaching_dragged_tab_(false), ALLOW_THIS_IN_INITIALIZER_LIST(bounds_animator_(this)) { - bounds_animator_.set_observer(this); } BaseTabStrip::~BaseTabStrip() { diff --git a/chrome/browser/views/tabs/base_tab_strip.h b/chrome/browser/views/tabs/base_tab_strip.h index 244edb2..ece3321 100644 --- a/chrome/browser/views/tabs/base_tab_strip.h +++ b/chrome/browser/views/tabs/base_tab_strip.h @@ -21,7 +21,6 @@ class ThemeProvider; // Base class for the view tab strip implementations. class BaseTabStrip : public views::View, - public views::BoundsAnimatorObserver, public TabController { public: enum Type { @@ -161,9 +160,6 @@ class BaseTabStrip : public views::View, gfx::Rect ideal_bounds; }; - // BoundsAnimator::Observer overrides: - virtual void OnBoundsAnimatorDone(views::BoundsAnimator* animator) {} - // View overrides. virtual bool OnMouseDragged(const views::MouseEvent& event); virtual void OnMouseReleased(const views::MouseEvent& event, diff --git a/chrome/browser/views/tabs/tab.cc b/chrome/browser/views/tabs/tab.cc index 75de074..e4785be 100644 --- a/chrome/browser/views/tabs/tab.cc +++ b/chrome/browser/views/tabs/tab.cc @@ -54,10 +54,6 @@ static const int kMiniTabRendererAsNormalTabWidth = // How opaque to make the hover state (out of 1). static const double kHoverOpacity = 0.33; -// Used when |render_as_new_tab| is true. -static SkBitmap* new_tab_mask = NULL; -static SkBitmap* new_tab_shadow = NULL; - Tab::TabImage Tab::tab_alpha = {0}; Tab::TabImage Tab::tab_active = {0}; Tab::TabImage Tab::tab_active_nano = {0}; @@ -109,20 +105,13 @@ Tab::Tab(TabController* controller) : BaseTab(controller, true), showing_icon_(false), showing_close_button_(false), - close_button_color_(NULL), - render_as_new_tab_(false), - render_unselected_(false), - alpha_(1) { + close_button_color_(NULL) { InitTabResources(); } Tab::~Tab() { } -void Tab::SizeToNewTabButtonImages() { - SetBounds(x(), y(), new_tab_shadow->width(), new_tab_shadow->height()); -} - void Tab::StartMiniTabTitleAnimation() { if (!mini_title_animation_.get()) { MultiAnimation::Parts parts; @@ -199,15 +188,6 @@ void Tab::DataChanged(const TabRendererData& old) { // Tab, views::View overrides: void Tab::Paint(gfx::Canvas* canvas) { - if (render_as_new_tab_) { - if (base::i18n::IsRTL()) { - canvas->TranslateInt(width(), 0); - canvas->ScaleInt(-1, 1); - } - PaintAsNewTab(canvas); - return; - } - // Don't paint if we're narrower than we can render correctly. (This should // only happen during animations). if (width() < GetMinimumUnselectedSize().width() && !data().mini) @@ -585,47 +565,6 @@ void Tab::PaintActiveTabBackground(gfx::Canvas* canvas) { canvas->DrawBitmapInt(*tab_image->image_r, width() - tab_image->r_width, 0); } -void Tab::PaintAsNewTab(gfx::Canvas* canvas) { - bool is_otr = data().off_the_record; - - // The tab image needs to be lined up with the background image - // so that it feels partially transparent. These offsets represent the tab - // position within the frame background image. - int offset = GetX(views::View::APPLY_MIRRORING_TRANSFORMATION) + - background_offset_.x(); - - int tab_id; - if (GetWidget() && - GetWidget()->GetWindow()->GetNonClientView()->UseNativeFrame()) { - tab_id = IDR_THEME_TAB_BACKGROUND_V; - } else { - tab_id = is_otr ? IDR_THEME_TAB_BACKGROUND_INCOGNITO : - IDR_THEME_TAB_BACKGROUND; - } - - SkBitmap* tab_bg = GetThemeProvider()->GetBitmapNamed(tab_id); - - // If the theme is providing a custom background image, then its top edge - // should be at the top of the tab. Otherwise, we assume that the background - // image is a composited foreground + frame image. - int bg_offset_y = GetThemeProvider()->HasCustomImage(tab_id) ? - 0 : background_offset_.y(); - - SkBitmap image = SkBitmapOperations::CreateTiledBitmap( - *tab_bg, offset, bg_offset_y, new_tab_mask->width(), - new_tab_mask->height()); - image = SkBitmapOperations::CreateMaskedBitmap(image, *new_tab_mask); - canvas->DrawBitmapInt(image, - 0, 0, image.width(), image.height(), - 0, 0, image.width(), image.height(), - false); - - canvas->DrawBitmapInt(*new_tab_shadow, - 0, 0, new_tab_shadow->width(), new_tab_shadow->height(), - 0, 0, new_tab_shadow->width(), new_tab_shadow->height(), - false); -} - int Tab::IconCapacity() const { if (height() < GetMinimumUnselectedSize().height()) return 0; @@ -651,9 +590,6 @@ bool Tab::ShouldShowCloseBox() const { } double Tab::GetThrobValue() { - if (alpha_ != 1) - return alpha_; - if (pulse_animation() && pulse_animation()->is_animating()) return pulse_animation()->GetCurrentValue() * kHoverOpacity; @@ -705,7 +641,4 @@ void Tab::LoadTabImages() { tab_inactive_nano.l_width = tab_inactive_nano.image_l->width(); tab_inactive_nano.r_width = tab_inactive_nano.image_r->width(); tab_inactive_nano.y_offset = kNanoTabDiffHeight; - - new_tab_mask = rb.GetBitmapNamed(IDR_TAB_ALPHA_NEW_TAB); - new_tab_shadow = rb.GetBitmapNamed(IDR_TAB_NEW_TAB_SHADOW); } diff --git a/chrome/browser/views/tabs/tab.h b/chrome/browser/views/tabs/tab.h index fdd550c..11653ed 100644 --- a/chrome/browser/views/tabs/tab.h +++ b/chrome/browser/views/tabs/tab.h @@ -29,23 +29,6 @@ class Tab : public BaseTab { explicit Tab(TabController* controller); virtual ~Tab(); - // Sizes the renderer to the size of the new tab images. This is used - // during the new tab animation. See TabStrip's description of AnimationType - // for details. - void SizeToNewTabButtonImages(); - - // Used during new tab animation to force the tab to render a new tab like - // animation. - void set_render_as_new_tab(bool value) { render_as_new_tab_ = value; } - - // Sets the alpha value to render the tab at. This is used during the new - // tab animation. - void set_alpha(double value) { alpha_ = value; } - - // Forces the tab to render unselected even though it is selected. - void set_render_unselected(bool value) { render_unselected_ = value; } - bool render_unselected() const { return render_unselected_; } - // Start/stop the mini-tab title animation. void StartMiniTabTitleAnimation(); void StopMiniTabTitleAnimation(); @@ -97,7 +80,6 @@ class Tab : public BaseTab { void PaintInactiveTabBackgroundWithTitleChange(gfx::Canvas* canvas); void PaintInactiveTabBackground(gfx::Canvas* canvas); void PaintActiveTabBackground(gfx::Canvas* canvas); - void PaintAsNewTab(gfx::Canvas* canvas); // Returns the number of favicon-size elements that can fit in the tab's // current size. @@ -153,15 +135,6 @@ class Tab : public BaseTab { // The current color of the close button. SkColor close_button_color_; - // See description above setter. - bool render_as_new_tab_; - - // See description above setter. - bool render_unselected_; - - // See description above setter. - double alpha_; - static bool initialized_; DISALLOW_COPY_AND_ASSIGN(Tab); diff --git a/chrome/browser/views/tabs/tab_strip.cc b/chrome/browser/views/tabs/tab_strip.cc index a1631fd..b8aecf5 100644 --- a/chrome/browser/views/tabs/tab_strip.cc +++ b/chrome/browser/views/tabs/tab_strip.cc @@ -46,22 +46,6 @@ using views::DropTargetEvent; -// Duration of the first step in a new tab animation. -static const int kNewTabDurationMs = 50; - -// Duration of the last step in the new tab animation. -static const int kNewTab3DurationMs = 100; - -// Amount in pixels newly inserted tabs go past target bounds before animating -// to final position. This is used for ANIMATION_NEW_TAB_2. -static const int kNewTabOvershoot = 9; - -// Amount in pixels the newly inserted tab is clipped against the previous -// tab while animating. This is used to make sure the user doesn't see the -// newly inserted tab behind other tabs and so that its shadow isn't visible -// until the user can actually see the tab. -static const int kNetTabSelectedOffset = -13; - static const int kNewTabButtonHOffset = -5; static const int kNewTabButtonVOffset = 5; static const int kResizeTabsTimeMs = 300; @@ -86,25 +70,6 @@ static inline int Round(double x) { namespace { -// Animation delegate used during new tab animation step 2 to vary the alpha of -// the tab. -class NewTabAlphaDelegate - : public views::BoundsAnimator::OwnedAnimationDelegate { - public: - explicit NewTabAlphaDelegate(Tab* tab) : tab_(tab) { - } - - virtual void AnimationProgressed(const Animation* animation) { - if (tab_->render_unselected()) - tab_->set_alpha(animation->GetCurrentValue()); - } - - private: - Tab* tab_; - - DISALLOW_COPY_AND_ASSIGN(NewTabAlphaDelegate); -}; - /////////////////////////////////////////////////////////////////////////////// // NewTabButton // @@ -168,9 +133,7 @@ TabStrip::TabStrip(TabStripController* controller) available_width_for_tabs_(-1), in_tab_close_(false), animation_container_(new AnimationContainer()), - animation_type_(ANIMATION_DEFAULT), - new_tab_button_enabled_(true), - cancelling_animation_(false) { + new_tab_button_enabled_(true) { Init(); } @@ -245,10 +208,6 @@ bool TabStrip::IsPositionInWindowCaption(const gfx::Point& point) { void TabStrip::SetDraggedTabBounds(int tab_index, const gfx::Rect& tab_bounds) { } -bool TabStrip::IsAnimating() const { - return BaseTabStrip::IsAnimating() || new_tab_timer_.IsRunning(); -} - TabStrip* TabStrip::AsTabStrip() { return this; } @@ -366,8 +325,6 @@ void TabStrip::PaintChildren(gfx::Canvas* canvas) { Tab* dragging_tab = NULL; - int model_count = GetModelCount(); - for (int i = tab_count() - 1; i >= 0; --i) { Tab* tab = GetTabAtTabDataIndex(i); // We must ask the _Tab's_ model, not ourselves, because in some situations @@ -377,20 +334,7 @@ void TabStrip::PaintChildren(gfx::Canvas* canvas) { if (tab->dragging()) { dragging_tab = tab; } else if (!tab->IsSelected()) { - if (tab->render_unselected() && model_count > 1) { - // See comment above kNetTabAnimationSelectedOffset as to why we do - // this. - Tab* last_tab = GetTabAtModelIndex(model_count - 2); - canvas->save(); - int clip_x = last_tab->bounds().right() + kNetTabSelectedOffset; - int clip_width = width() - clip_x; - clip_x = MirroredXWithWidthInsideView(clip_x, clip_width); - canvas->ClipRectInt(clip_x, 0, clip_width, height()); - tab->ProcessPaint(canvas); - canvas->restore(); - } else { - tab->ProcessPaint(canvas); - } + tab->ProcessPaint(canvas); } else { selected_tab = tab; } @@ -409,19 +353,12 @@ void TabStrip::PaintChildren(gfx::Canvas* canvas) { paint); } - if (animation_type_ == ANIMATION_NEW_TAB_3) - newtab_button_->ProcessPaint(canvas); - // Paint the selected tab last, so it overlaps all the others. if (selected_tab) selected_tab->ProcessPaint(canvas); // Paint the New Tab button. - if (animation_type_ != ANIMATION_NEW_TAB_1 && - animation_type_ != ANIMATION_NEW_TAB_2 && - animation_type_ != ANIMATION_NEW_TAB_3) { - newtab_button_->ProcessPaint(canvas); - } + newtab_button_->ProcessPaint(canvas); // And the dragged tab. if (dragging_tab) @@ -532,15 +469,6 @@ void TabStrip::ThemeChanged() { LoadNewTabButtonImage(); } -void TabStrip::OnBoundsAnimatorDone(views::BoundsAnimator* animator) { - AnimationType last_type = animation_type_; - - ResetAnimationState(false); - - if (!cancelling_animation_ && last_type == ANIMATION_NEW_TAB_2) - NewTabAnimation2Done(); -} - BaseTab* TabStrip::CreateTab() { Tab* tab = new Tab(this); tab->set_animation_container(animation_container_.get()); @@ -548,12 +476,27 @@ BaseTab* TabStrip::CreateTab() { } void TabStrip::StartInsertTabAnimation(int model_index, bool foreground) { - if (!IsDragSessionActive() && !attaching_dragged_tab() && - ShouldStartIntertTabAnimationAtEnd(model_index, foreground)) { - StartInsertTabAnimationAtEnd(); + PrepareForAnimation(); + + // The TabStrip can now use its entire width to lay out Tabs. + in_tab_close_ = false; + available_width_for_tabs_ = -1; + + GenerateIdealBounds(); + + int tab_data_index = ModelIndexToTabIndex(model_index); + BaseTab* tab = base_tab_at_tab_index(tab_data_index); + if (model_index == 0) { + tab->SetBounds(0, ideal_bounds(tab_data_index).y(), 0, + ideal_bounds(tab_data_index).height()); } else { - StartInsertTabAnimationImpl(model_index); + BaseTab* last_tab = base_tab_at_tab_index(tab_data_index - 1); + tab->SetBounds(last_tab->bounds().right() + kTabHOffset, + ideal_bounds(tab_data_index).y(), 0, + ideal_bounds(tab_data_index).height()); } + + AnimateToIdealBounds(); } void TabStrip::StartMoveTabAnimation() { @@ -570,20 +513,13 @@ void TabStrip::AnimateToIdealBounds() { bounds_animator().AnimateViewTo(tab, ideal_bounds(i)); } - if (animation_type_ != ANIMATION_NEW_TAB_3) { - bounds_animator().AnimateViewTo(newtab_button_, newtab_button_bounds_); - } + bounds_animator().AnimateViewTo(newtab_button_, newtab_button_bounds_); } bool TabStrip::ShouldHighlightCloseButtonAfterRemove() { return in_tab_close_; } -void TabStrip::PrepareForAnimation() { - BaseTabStrip::PrepareForAnimation(); - ResetAnimationState(true); -} - void TabStrip::ViewHierarchyChanged(bool is_add, views::View* parent, views::View* child) { @@ -596,10 +532,7 @@ void TabStrip::ViewHierarchyChanged(bool is_add, bool TabStrip::IsTabSelected(const BaseTab* btr) const { const Tab* tab = static_cast<const Tab*>(btr); - if (tab->closing() || tab->render_unselected()) - return false; - - return BaseTabStrip::IsTabSelected(btr); + return !tab->closing() && BaseTabStrip::IsTabSelected(btr); } /////////////////////////////////////////////////////////////////////////////// @@ -1105,114 +1038,12 @@ void TabStrip::GenerateIdealBounds() { newtab_button_bounds_.set_origin(gfx::Point(new_tab_x, new_tab_y)); } -void TabStrip::NewTabAnimation1Done() { - int tab_data_index = tab_count() - 1; - Tab* tab = GetTabAtTabDataIndex(tab_data_index); - - gfx::Rect old_tab_bounds = tab->bounds(); - - GenerateIdealBounds(); - - gfx::Rect end_bounds = ideal_bounds(tab_data_index); - end_bounds.Offset(kNewTabOvershoot, 0); - set_ideal_bounds(tab_data_index, end_bounds); - - int x = old_tab_bounds.right() - end_bounds.width(); - int w = end_bounds.width(); - if (x < 0) { - w += x; - x = 0; - } - tab->SetBounds(x, old_tab_bounds.y(), w, end_bounds.height()); - - AnimateToIdealBounds(); - - animation_type_ = ANIMATION_NEW_TAB_2; - tab->set_render_as_new_tab(false); - tab->set_render_unselected(true); - tab->set_alpha(0); - - // BoundsAnimator takes ownership of NewTabAlphaDelegate. - bounds_animator().SetAnimationDelegate(tab, new NewTabAlphaDelegate(tab), - true); -} - -void TabStrip::NewTabAnimation2Done() { - animation_type_ = ANIMATION_NEW_TAB_3; - - GenerateIdealBounds(); - - AnimateToIdealBounds(); - - SlideAnimation* animation = new SlideAnimation(NULL); - animation->SetSlideDuration(kNewTab3DurationMs); - animation->SetTweenType(Tween::EASE_IN_OUT); - - // BoundsAnimator takes ownership of animation. - bounds_animator().SetAnimationForView( - GetTabAtTabDataIndex(tab_count() - 1), animation); -} - -bool TabStrip::ShouldStartIntertTabAnimationAtEnd(int model_index, - bool foreground) { - return foreground && (model_index + 1 == GetModelCount()) && - controller()->IsNewTabPage(model_index); -} - void TabStrip::StartResizeLayoutAnimation() { PrepareForAnimation(); GenerateIdealBounds(); AnimateToIdealBounds(); } -void TabStrip::StartInsertTabAnimationAtEnd() { - PrepareForAnimation(); - - // The TabStrip can now use its entire width to lay out Tabs. - in_tab_close_ = false; - available_width_for_tabs_ = -1; - - animation_type_ = ANIMATION_NEW_TAB_1; - - GenerateIdealBounds(); - - int tab_data_index = ModelIndexToTabIndex(GetModelCount() - 1); - Tab* tab = GetTabAtTabDataIndex(tab_data_index); - tab->SizeToNewTabButtonImages(); - tab->SetBounds(newtab_button_->x() + - (newtab_button_->width() - tab->width()) / 2, - ideal_bounds(tab_data_index).y(), - tab->width(), tab->height()); - tab->set_render_as_new_tab(true); - - new_tab_timer_.Start(base::TimeDelta::FromMilliseconds(kNewTabDurationMs), - this, &TabStrip::NewTabAnimation1Done); -} - -void TabStrip::StartInsertTabAnimationImpl(int model_index) { - PrepareForAnimation(); - - // The TabStrip can now use its entire width to lay out Tabs. - in_tab_close_ = false; - available_width_for_tabs_ = -1; - - GenerateIdealBounds(); - - int tab_data_index = ModelIndexToTabIndex(model_index); - BaseTab* tab = base_tab_at_tab_index(tab_data_index); - if (model_index == 0) { - tab->SetBounds(0, ideal_bounds(tab_data_index).y(), 0, - ideal_bounds(tab_data_index).height()); - } else { - BaseTab* last_tab = base_tab_at_tab_index(tab_data_index - 1); - tab->SetBounds(last_tab->bounds().right() + kTabHOffset, - ideal_bounds(tab_data_index).y(), 0, - ideal_bounds(tab_data_index).height()); - } - - AnimateToIdealBounds(); -} - void TabStrip::StartMiniTabAnimation() { in_tab_close_ = false; available_width_for_tabs_ = -1; @@ -1271,17 +1102,7 @@ void TabStrip::StopAnimating(bool layout) { if (!IsAnimating()) return; - new_tab_timer_.Stop(); - - if (bounds_animator().IsAnimating()) { - // Cancelling the animation triggers OnBoundsAnimatorDone, which invokes - // ResetAnimationState. - cancelling_animation_ = true; - bounds_animator().Cancel(); - cancelling_animation_ = false; - } else { - ResetAnimationState(false); - } + bounds_animator().Cancel(); DCHECK(!IsAnimating()); @@ -1289,30 +1110,6 @@ void TabStrip::StopAnimating(bool layout) { Layout(); } -void TabStrip::ResetAnimationState(bool stop_new_tab_timer) { - if (animation_type_ == ANIMATION_NEW_TAB_2) { - newtab_button_->SchedulePaint(); - if (tab_count() > 0) { - // Paint the last tab as it's visual appearance changes when transitioning - // between ANIMATION_NEW_TAB_2 and ANIMATION_NEW_TAB_3. - GetTabAtTabDataIndex(tab_count() - 1)->SchedulePaint(); - } - } - - if (stop_new_tab_timer) - new_tab_timer_.Stop(); - - animation_type_ = ANIMATION_DEFAULT; - - // Reset the animation state of each tab. - for (int i = 0; i < tab_count(); ++i) { - Tab* tab = GetTabAtTabDataIndex(i); - tab->set_render_as_new_tab(false); - tab->set_render_unselected(false); - tab->set_alpha(1); - } -} - int TabStrip::GetMiniTabCount() const { int mini_count = 0; for (int i = 0; i < tab_count(); ++i) { diff --git a/chrome/browser/views/tabs/tab_strip.h b/chrome/browser/views/tabs/tab_strip.h index d1e9b29..a88a247 100644 --- a/chrome/browser/views/tabs/tab_strip.h +++ b/chrome/browser/views/tabs/tab_strip.h @@ -67,7 +67,6 @@ class TabStrip : public BaseTabStrip, virtual bool IsPositionInWindowCaption(const gfx::Point& point); virtual void SetDraggedTabBounds(int tab_index, const gfx::Rect& tab_bounds); - virtual bool IsAnimating() const; virtual TabStrip* AsTabStrip(); virtual void PrepareForCloseAt(int model_index); virtual void RemoveTabAt(int model_index); @@ -92,9 +91,6 @@ class TabStrip : public BaseTabStrip, virtual views::View* GetViewForPoint(const gfx::Point& point); virtual void ThemeChanged(); - // BoundsAnimator::Observer overrides: - virtual void OnBoundsAnimatorDone(views::BoundsAnimator* animator); - protected: // BaseTabStrip overrides: virtual BaseTab* CreateTab(); @@ -102,7 +98,6 @@ class TabStrip : public BaseTabStrip, virtual void StartMoveTabAnimation(); virtual void AnimateToIdealBounds(); virtual bool ShouldHighlightCloseButtonAfterRemove(); - virtual void PrepareForAnimation(); // views::View implementation: virtual void ViewHierarchyChanged(bool is_add, @@ -134,30 +129,6 @@ class TabStrip : public BaseTabStrip, private: friend class DraggedTabController; - // AnimationType used for tracking animations that require additional - // state beyond just animating the bounds of a view. - // - // Currently the only animation special cased is that of inserting the new tab - // page at the end of the tab strip. Here's the steps that take place when - // this happens. - // . The newly inserted tab is set to render for the new tab animation - // |set_render_as_new_tab|. The timer new_tab_timer_ is used to determine - // when to turn this off. This is represented by state ANIMATION_NEW_TAB_1. - // . The new tab is rendered in the background with an ever increasing alpha - // value and the tab goes slightly past the new tab button. The new tab - // button is not visible during this animation. This is represented by the - // state ANIMATION_NEW_TAB_2. - // . The new tab is animated to its final position and the new tab button is - // rendered beneath the selected tab. This is represented by the state - // ANIMATION_NEW_TAB_3. - enum AnimationType { - ANIMATION_DEFAULT, - - ANIMATION_NEW_TAB_1, - ANIMATION_NEW_TAB_2, - ANIMATION_NEW_TAB_3 - }; - // Used during a drop session of a url. Tracks the position of the drop as // well as a window used to highlight where the drop occurs. struct DropInfo { @@ -272,20 +243,8 @@ class TabStrip : public BaseTabStrip, // stable representations of Tab positions. void GenerateIdealBounds(); - // Both of these are invoked when a part of the new tab animation completes. - // They configure state for the next step in the animation and start it. - void NewTabAnimation1Done(); - void NewTabAnimation2Done(); - - // Returns true if a new tab inserted at specified index should start the - // new tab animation. See description above AnimationType for details on - // this animation. - bool ShouldStartIntertTabAnimationAtEnd(int model_index, bool foreground); - // Starts various types of TabStrip animations. void StartResizeLayoutAnimation(); - void StartInsertTabAnimationAtEnd(); - void StartInsertTabAnimationImpl(int model_index); void StartMoveTabAnimation(int from_model_index, int to_model_index); void StartMiniTabAnimation(); @@ -295,11 +254,6 @@ class TabStrip : public BaseTabStrip, // ongoing this does a layout. virtual void StopAnimating(bool layout); - // Resets all state related to animations. This is invoked when an animation - // completes, prior to starting an animation or when we cancel an animation. - // If |stop_new_tab_timer| is true, |new_tab_timer_| is stopped. - void ResetAnimationState(bool stop_new_tab_timer); - // Calculates the available width for tabs, assuming a Tab is to be closed. int GetAvailableWidthForTabs(Tab* last_tab) const; @@ -366,15 +320,9 @@ class TabStrip : public BaseTabStrip, // Used for stage 1 of new tab animation. base::OneShotTimer<TabStrip> new_tab_timer_; - // Set for special animations. - AnimationType animation_type_; - // Whether the new tab button is being displayed. bool new_tab_button_enabled_; - // If true, we're cancelling the animation. - bool cancelling_animation_; - DISALLOW_COPY_AND_ASSIGN(TabStrip); }; |