diff options
author | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-05 03:43:55 +0000 |
---|---|---|
committer | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-05 03:43:55 +0000 |
commit | 4ce7e15da651c6221720e33dc8c500830d4b6b8a (patch) | |
tree | 376ef1d7e7951dae3376e65f4edee9e7367adc89 /chrome/browser | |
parent | 5ee3ca64cdf2d00f82a1bc36f36e8ab5e520b4de (diff) | |
download | chromium_src-4ce7e15da651c6221720e33dc8c500830d4b6b8a.zip chromium_src-4ce7e15da651c6221720e33dc8c500830d4b6b8a.tar.gz chromium_src-4ce7e15da651c6221720e33dc8c500830d4b6b8a.tar.bz2 |
Refactors animation to allow for cleaner subclassing. I'm doing this
for creating a different animation subclass (which you'll see
shortly).
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/1961001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@46433 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
31 files changed, 81 insertions, 94 deletions
diff --git a/chrome/browser/chromeos/panels/panel_scroller.cc b/chrome/browser/chromeos/panels/panel_scroller.cc index ec681f3..daaa3fc 100644 --- a/chrome/browser/chromeos/panels/panel_scroller.cc +++ b/chrome/browser/chromeos/panels/panel_scroller.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this +// Copyright (c) 2010 The Chromium Authors. All rights reserved. Use of this // source code is governed by a BSD-style license that can be found in the // LICENSE file. @@ -26,7 +26,7 @@ PanelScroller::PanelScroller() ALLOW_THIS_IN_INITIALIZER_LIST(animation_(this)), animated_scroll_begin_(0), animated_scroll_end_(0) { - animation_.SetTweenType(SlideAnimation::EASE_IN_OUT); + animation_.SetTweenType(Tween::EASE_IN_OUT); animation_.SetSlideDuration(300); Panel* panel = new Panel; @@ -237,9 +237,6 @@ void PanelScroller::ScrollToPanel(int index) { animation_.Show(); } -void PanelScroller::AnimationEnded(const Animation* animation) { -} - void PanelScroller::AnimationProgressed(const Animation* animation) { scroll_pos_ = static_cast<int>( static_cast<double>(animated_scroll_end_ - animated_scroll_begin_) * @@ -248,6 +245,3 @@ void PanelScroller::AnimationProgressed(const Animation* animation) { Layout(); SchedulePaint(); } - -void PanelScroller::AnimationCanceled(const Animation* animation) { -} diff --git a/chrome/browser/chromeos/panels/panel_scroller.h b/chrome/browser/chromeos/panels/panel_scroller.h index a3db3db..51eedff 100644 --- a/chrome/browser/chromeos/panels/panel_scroller.h +++ b/chrome/browser/chromeos/panels/panel_scroller.h @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this +// Copyright (c) 2010 The Chromium Authors. All rights reserved. Use of this // source code is governed by a BSD-style license that can be found in the // LICENSE file. @@ -38,9 +38,7 @@ class PanelScroller : public views::View, public AnimationDelegate { struct Panel; // AnimationDelegate overrides. - virtual void AnimationEnded(const Animation* animation); virtual void AnimationProgressed(const Animation* animation); - virtual void AnimationCanceled(const Animation* animation); // Scrolls to the panel at the given index. It will be moved to the top. void ScrollToPanel(int index); diff --git a/chrome/browser/chromeos/status/network_menu_button.cc b/chrome/browser/chromeos/status/network_menu_button.cc index 8cb7eba..dea19d8 100644 --- a/chrome/browser/chromeos/status/network_menu_button.cc +++ b/chrome/browser/chromeos/status/network_menu_button.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -34,7 +34,7 @@ NetworkMenuButton::NetworkMenuButton(StatusAreaHost* host) ALLOW_THIS_IN_INITIALIZER_LIST(network_menu_(this)), ALLOW_THIS_IN_INITIALIZER_LIST(animation_connecting_(this)) { animation_connecting_.SetThrobDuration(kThrobDuration); - animation_connecting_.SetTweenType(SlideAnimation::NONE); + animation_connecting_.SetTweenType(Tween::LINEAR); NetworkChanged(CrosLibrary::Get()->GetNetworkLibrary()); CrosLibrary::Get()->GetNetworkLibrary()->AddObserver(this); } @@ -185,7 +185,7 @@ void NetworkMenuButton::DrawPressed(gfx::Canvas* canvas) { // If ethernet connected and not current connecting, then show ethernet // pressed icon. Otherwise, show the bars pressed icon. if (CrosLibrary::Get()->GetNetworkLibrary()->ethernet_connected() && - !animation_connecting_.IsAnimating()) + !animation_connecting_.is_animating()) canvas->DrawBitmapInt(IconForDisplay( *ResourceBundle::GetSharedInstance(). GetBitmapNamed(IDR_STATUSBAR_NETWORK_WIRED_PRESSED), SkBitmap()), @@ -230,19 +230,19 @@ void NetworkMenuButton::DrawIcon(gfx::Canvas* canvas) { // figure out if we are to also draw the extra image. int downloading_index = -1; int uploading_index = -1; - if (!animation_connecting_.IsAnimating()) { + if (!animation_connecting_.is_animating()) { // For network animation, we only show animation in one direction. // So when we are hiding, we just use 1 minus the value. // We have kNumWifiImages + 1 number of states. For the first state, where // we are not adding any images, we set the index to -1. - if (animation_downloading_.IsAnimating()) { + if (animation_downloading_.is_animating()) { double value_downloading = animation_downloading_.IsShowing() ? animation_downloading_.GetCurrentValue() : 1.0 - animation_downloading_.GetCurrentValue(); downloading_index = static_cast<int>(value_downloading * nextafter(static_cast<float>(kNumWifiImages + 1), 0)) - 1; } - if (animation_uploading_.IsAnimating()) { + if (animation_uploading_.is_animating()) { double value_uploading = animation_uploading_.IsShowing() ? animation_uploading_.GetCurrentValue() : 1.0 - animation_uploading_.GetCurrentValue(); @@ -299,7 +299,7 @@ void NetworkMenuButton::NetworkChanged(NetworkLibrary* cros) { if (CrosLibrary::Get()->EnsureLoaded()) { if (cros->wifi_connecting() || cros->cellular_connecting()) { // Start the connecting animation if not running. - if (!animation_connecting_.IsAnimating()) { + if (!animation_connecting_.is_animating()) { animation_connecting_.Reset(); animation_connecting_.StartThrobbing(std::numeric_limits<int>::max()); SetIcon(*rb.GetBitmapNamed(IDR_STATUSBAR_NETWORK_BARS1)); diff --git a/chrome/browser/gtk/bookmark_bar_gtk.cc b/chrome/browser/gtk/bookmark_bar_gtk.cc index 236123f..eed763f 100644 --- a/chrome/browser/gtk/bookmark_bar_gtk.cc +++ b/chrome/browser/gtk/bookmark_bar_gtk.cc @@ -392,7 +392,7 @@ int BookmarkBarGtk::GetHeight() { } bool BookmarkBarGtk::IsAnimating() { - return slide_animation_->IsAnimating(); + return slide_animation_->is_animating(); } bool BookmarkBarGtk::OnNewTabPage() { diff --git a/chrome/browser/gtk/browser_actions_toolbar_gtk.cc b/chrome/browser/gtk/browser_actions_toolbar_gtk.cc index 694e502..65fe134 100644 --- a/chrome/browser/gtk/browser_actions_toolbar_gtk.cc +++ b/chrome/browser/gtk/browser_actions_toolbar_gtk.cc @@ -855,6 +855,6 @@ gboolean BrowserActionsToolbarGtk::OnOverflowMenuButtonPress( } void BrowserActionsToolbarGtk::OnButtonShowOrHide(GtkWidget* sender) { - if (!resize_animation_.IsAnimating()) + if (!resize_animation_.is_animating()) UpdateChevronVisibility(); } diff --git a/chrome/browser/gtk/download_item_gtk.cc b/chrome/browser/gtk/download_item_gtk.cc index 5260d0f..2439943 100644 --- a/chrome/browser/gtk/download_item_gtk.cc +++ b/chrome/browser/gtk/download_item_gtk.cc @@ -361,7 +361,7 @@ void DownloadItemGtk::OnDownloadUpdated(DownloadItem* download) { complete_animation_.reset(new SlideAnimation(this)); complete_animation_->SetSlideDuration(kCompleteAnimationDurationMs); - complete_animation_->SetTweenType(SlideAnimation::NONE); + complete_animation_->SetTweenType(Tween::LINEAR); complete_animation_->Show(); break; case DownloadItem::IN_PROGRESS: @@ -792,7 +792,7 @@ gboolean DownloadItemGtk::OnProgressAreaExpose(GtkWidget* widget, // Create a transparent canvas. gfx::CanvasPaint canvas(event, false); if (complete_animation_.get()) { - if (complete_animation_->IsAnimating()) { + if (complete_animation_->is_animating()) { download_util::PaintDownloadComplete(&canvas, widget->allocation.x, widget->allocation.y, complete_animation_->GetCurrentValue(), @@ -822,7 +822,7 @@ gboolean DownloadItemGtk::OnProgressAreaExpose(GtkWidget* widget, gboolean DownloadItemGtk::OnMenuButtonPressEvent(GtkWidget* button, GdkEvent* event) { // Stop any completion animation. - if (complete_animation_.get() && complete_animation_->IsAnimating()) + if (complete_animation_.get() && complete_animation_->is_animating()) complete_animation_->End(); if (event->type == GDK_BUTTON_PRESS) { diff --git a/chrome/browser/gtk/download_started_animation_gtk.cc b/chrome/browser/gtk/download_started_animation_gtk.cc index 1e10348..5343ac2 100644 --- a/chrome/browser/gtk/download_started_animation_gtk.cc +++ b/chrome/browser/gtk/download_started_animation_gtk.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -6,7 +6,7 @@ #include <gtk/gtk.h> -#include "app/animation.h" +#include "app/linear_animation.h" #include "app/resource_bundle.h" #include "base/message_loop.h" #include "chrome/browser/tab_contents/tab_contents.h" @@ -28,7 +28,7 @@ const int kFrameRateHz = 60; // the frame. const double kMoveFraction = 1.0 / 3.0; -class DownloadStartedAnimationGtk : public Animation, +class DownloadStartedAnimationGtk : public LinearAnimation, public NotificationObserver { public: explicit DownloadStartedAnimationGtk(TabContents* tab_contents); @@ -78,7 +78,7 @@ class DownloadStartedAnimationGtk : public Animation, DownloadStartedAnimationGtk::DownloadStartedAnimationGtk( TabContents* tab_contents) - : Animation(kMoveTimeMs, kFrameRateHz, NULL), + : LinearAnimation(kMoveTimeMs, kFrameRateHz, NULL), tab_contents_(tab_contents) { static GdkPixbuf* kDownloadImage = NULL; if (!kDownloadImage) { diff --git a/chrome/browser/gtk/hover_controller_gtk.cc b/chrome/browser/gtk/hover_controller_gtk.cc index 0737a97..3adf686 100644 --- a/chrome/browser/gtk/hover_controller_gtk.cc +++ b/chrome/browser/gtk/hover_controller_gtk.cc @@ -67,7 +67,7 @@ void HoverControllerGtk::AnimationProgressed(const Animation* animation) { return; // Ignore the hover animation if we are throbbing. - if (animation == &hover_animation_ && throb_animation_.IsAnimating()) + if (animation == &hover_animation_ && throb_animation_.is_animating()) return; gtk_chrome_button_set_hover_state(GTK_CHROME_BUTTON(button_), diff --git a/chrome/browser/gtk/slide_animator_gtk.cc b/chrome/browser/gtk/slide_animator_gtk.cc index 2c1549d..ff20c40 100644 --- a/chrome/browser/gtk/slide_animator_gtk.cc +++ b/chrome/browser/gtk/slide_animator_gtk.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -60,7 +60,7 @@ SlideAnimatorGtk::SlideAnimatorGtk(GtkWidget* child, animation_.reset(new SlideAnimation(this)); // Default tween type is EASE_OUT. if (linear) - animation_->SetTweenType(SlideAnimation::NONE); + animation_->SetTweenType(Tween::LINEAR); if (duration != 0) animation_->SetSlideDuration(duration); } @@ -111,7 +111,7 @@ bool SlideAnimatorGtk::IsClosing() { } bool SlideAnimatorGtk::IsAnimating() { - return animation_->IsAnimating(); + return animation_->is_animating(); } void SlideAnimatorGtk::AnimationProgressed(const Animation* animation) { diff --git a/chrome/browser/gtk/tabs/dragged_tab_gtk.cc b/chrome/browser/gtk/tabs/dragged_tab_gtk.cc index bffadd5..f221c0e 100644 --- a/chrome/browser/gtk/tabs/dragged_tab_gtk.cc +++ b/chrome/browser/gtk/tabs/dragged_tab_gtk.cc @@ -125,7 +125,7 @@ void DraggedTabGtk::AnimateToBounds(const gfx::Rect& bounds, animation_end_bounds_ = bounds; close_animation_.SetSlideDuration(kAnimateToBoundsDurationMs); - close_animation_.SetTweenType(SlideAnimation::EASE_OUT); + close_animation_.SetTweenType(Tween::EASE_OUT); if (!close_animation_.IsShowing()) { close_animation_.Reset(); close_animation_.Show(); diff --git a/chrome/browser/gtk/tabs/tab_renderer_gtk.cc b/chrome/browser/gtk/tabs/tab_renderer_gtk.cc index 20307d3..c8a0e6b 100644 --- a/chrome/browser/gtk/tabs/tab_renderer_gtk.cc +++ b/chrome/browser/gtk/tabs/tab_renderer_gtk.cc @@ -200,11 +200,11 @@ void TabRendererGtk::LoadingAnimation::Observe( // FaviconCrashAnimation // // A custom animation subclass to manage the favicon crash animation. -class TabRendererGtk::FavIconCrashAnimation : public Animation, +class TabRendererGtk::FavIconCrashAnimation : public LinearAnimation, public AnimationDelegate { public: explicit FavIconCrashAnimation(TabRendererGtk* target) - : ALLOW_THIS_IN_INITIALIZER_LIST(Animation(1000, 25, this)), + : ALLOW_THIS_IN_INITIALIZER_LIST(LinearAnimation(1000, 25, this)), target_(target) { } virtual ~FavIconCrashAnimation() {} @@ -501,7 +501,7 @@ void TabRendererGtk::StartMiniTabTitleAnimation() { mini_title_animation_->SetThrobDuration(kMiniTitleChangeThrobDuration); } - if (!mini_title_animation_->IsAnimating()) { + if (!mini_title_animation_->is_animating()) { mini_title_animation_->StartThrobbing(2); } else if (mini_title_animation_->cycles_remaining() <= 2) { // The title changed while we're already animating. Add at most one more @@ -575,7 +575,7 @@ void TabRendererGtk::StopCrashAnimation() { } bool TabRendererGtk::IsPerformingCrashAnimation() const { - return crash_animation_.get() && crash_animation_->IsAnimating(); + return crash_animation_.get() && crash_animation_->is_animating(); } void TabRendererGtk::SetFavIconHidingOffset(int offset) { @@ -986,7 +986,7 @@ CustomDrawButton* TabRendererGtk::MakeCloseButton() { } double TabRendererGtk::GetThrobValue() { - if (mini_title_animation_.get() && mini_title_animation_->IsAnimating()) { + if (mini_title_animation_.get() && mini_title_animation_->is_animating()) { return mini_title_animation_->GetCurrentValue() * kMiniTitleChangeThrobOpacity; } @@ -1045,7 +1045,7 @@ void TabRendererGtk::OnSizeAllocate(GtkWidget* widget, gboolean TabRendererGtk::OnEnterNotifyEvent(GtkWidget* widget, GdkEventCrossing* event, TabRendererGtk* tab) { - tab->hover_animation_->SetTweenType(SlideAnimation::EASE_OUT); + tab->hover_animation_->SetTweenType(Tween::EASE_OUT); tab->hover_animation_->Show(); return FALSE; } @@ -1054,7 +1054,7 @@ gboolean TabRendererGtk::OnEnterNotifyEvent(GtkWidget* widget, gboolean TabRendererGtk::OnLeaveNotifyEvent(GtkWidget* widget, GdkEventCrossing* event, TabRendererGtk* tab) { - tab->hover_animation_->SetTweenType(SlideAnimation::EASE_IN); + tab->hover_animation_->SetTweenType(Tween::EASE_IN); tab->hover_animation_->Hide(); return FALSE; } diff --git a/chrome/browser/gtk/tabs/tab_strip_gtk.cc b/chrome/browser/gtk/tabs/tab_strip_gtk.cc index 8d1d1c8..7b3bf73 100644 --- a/chrome/browser/gtk/tabs/tab_strip_gtk.cc +++ b/chrome/browser/gtk/tabs/tab_strip_gtk.cc @@ -130,7 +130,7 @@ class TabStripGtk::TabAnimation : public AnimationDelegate { void Start() { animation_.SetSlideDuration(GetDuration()); - animation_.SetTweenType(SlideAnimation::EASE_OUT); + animation_.SetTweenType(Tween::EASE_OUT); if (!animation_.IsShowing()) { animation_.Reset(); animation_.Show(); diff --git a/chrome/browser/gtk/translate_infobars.cc b/chrome/browser/gtk/translate_infobars.cc index 7870e52..63878e2 100644 --- a/chrome/browser/gtk/translate_infobars.cc +++ b/chrome/browser/gtk/translate_infobars.cc @@ -149,7 +149,7 @@ TranslateInfoBar::TranslateInfoBar(TranslateInfoBarDelegate* delegate) swapped_language_placeholders_(false) { // Initialize slide animation for transitioning to and from error state. error_animation_.reset(new SlideAnimation(this)); - error_animation_->SetTweenType(SlideAnimation::NONE); + error_animation_->SetTweenType(Tween::LINEAR); error_animation_->SetSlideDuration(500); BuildWidgets(); diff --git a/chrome/browser/views/autocomplete/autocomplete_popup_contents_view.cc b/chrome/browser/views/autocomplete/autocomplete_popup_contents_view.cc index 4f71b75..f569ff9 100644 --- a/chrome/browser/views/autocomplete/autocomplete_popup_contents_view.cc +++ b/chrome/browser/views/autocomplete/autocomplete_popup_contents_view.cc @@ -522,7 +522,7 @@ AutocompletePopupContentsView::~AutocompletePopupContentsView() { } gfx::Rect AutocompletePopupContentsView::GetPopupBounds() const { - if (!size_animation_.IsAnimating()) + if (!size_animation_.is_animating()) return target_bounds_; gfx::Rect current_frame_bounds = start_bounds_; diff --git a/chrome/browser/views/bookmark_bar_view.cc b/chrome/browser/views/bookmark_bar_view.cc index e67d212..d6b1690 100644 --- a/chrome/browser/views/bookmark_bar_view.cc +++ b/chrome/browser/views/bookmark_bar_view.cc @@ -1104,7 +1104,7 @@ void BookmarkBarView::WriteDragData(View* sender, } int BookmarkBarView::GetDragOperations(View* sender, const gfx::Point& p) { - if (size_animation_->IsAnimating() || + if (size_animation_->is_animating() || (size_animation_->GetCurrentValue() == 0 && !OnNewTabPage())) { // Don't let the user drag while animating open or we're closed (and not on // the new tab page, on the new tab page size_animation_ is always 0). This diff --git a/chrome/browser/views/bookmark_bar_view.h b/chrome/browser/views/bookmark_bar_view.h index 6eb975c..b23641b 100644 --- a/chrome/browser/views/bookmark_bar_view.h +++ b/chrome/browser/views/bookmark_bar_view.h @@ -157,7 +157,7 @@ class BookmarkBarView : public DetachableToolbarView, int GetToolbarOverlap(bool return_max); // Whether or not we are animating. - bool IsAnimating() { return size_animation_->IsAnimating(); } + bool is_animating() { return size_animation_->is_animating(); } // SlideAnimationDelegate implementation. void AnimationProgressed(const Animation* animation); diff --git a/chrome/browser/views/browser_actions_container.cc b/chrome/browser/views/browser_actions_container.cc index c74e333..f4132bb 100644 --- a/chrome/browser/views/browser_actions_container.cc +++ b/chrome/browser/views/browser_actions_container.cc @@ -952,7 +952,7 @@ void BrowserActionsContainer::BrowserActionAdded(Extension* extension, // in the header for why we do this. suppress_chevron_ = !chevron_->IsVisible(); - Animate(SlideAnimation::NONE, target_size); + Animate(Tween::LINEAR, target_size); } } @@ -990,7 +990,7 @@ void BrowserActionsContainer::BrowserActionRemoved(Extension* extension) { int target_size = ClampToNearestIconCount(IconCountToWidth(visible_actions), true); - Animate(SlideAnimation::EASE_OUT, target_size); + Animate(Tween::EASE_OUT, target_size); return; } } @@ -1048,8 +1048,7 @@ int BrowserActionsContainer::ContainerMinSize() const { return resize_gripper_->width() + chevron_->width() + kChevronRightMargin; } -void BrowserActionsContainer::Animate( - SlideAnimation::TweenType tween_type, int target_size) { +void BrowserActionsContainer::Animate(Tween::Type tween_type, int target_size) { if (!disable_animations_during_testing_) { // Animate! We have to set the animation_target_size_ after calling Reset(), // because that could end up calling AnimationEnded which clears the value. @@ -1093,7 +1092,7 @@ void BrowserActionsContainer::OnResize(int resize_amount, bool done_resizing) { container_size_.set_width(new_width); animation_target_size_ = ClampToNearestIconCount(new_width, true); resize_animation_->Reset(); - resize_animation_->SetTweenType(SlideAnimation::EASE_OUT); + resize_animation_->SetTweenType(Tween::EASE_OUT); resize_animation_->Show(); } } diff --git a/chrome/browser/views/browser_actions_container.h b/chrome/browser/views/browser_actions_container.h index ac263ef..a4334f3 100644 --- a/chrome/browser/views/browser_actions_container.h +++ b/chrome/browser/views/browser_actions_container.h @@ -428,7 +428,7 @@ class BrowserActionsContainer // Animate to the target value (unless testing, in which case we go straight // to the target size). - void Animate(SlideAnimation::TweenType tween_type, int target_size); + void Animate(Tween::Type type, int target_size); // Returns true if this extension should be shown in this toolbar. This can // return false if we are in an incognito window and the extension is disabled diff --git a/chrome/browser/views/download_item_view.cc b/chrome/browser/views/download_item_view.cc index 4ae499e..b38f4e7 100644 --- a/chrome/browser/views/download_item_view.cc +++ b/chrome/browser/views/download_item_view.cc @@ -359,7 +359,7 @@ void DownloadItemView::OnDownloadUpdated(DownloadItem* download) { StopDownloadProgress(); complete_animation_.reset(new SlideAnimation(this)); complete_animation_->SetSlideDuration(kCompleteAnimationDurationMs); - complete_animation_->SetTweenType(SlideAnimation::NONE); + complete_animation_->SetTweenType(Tween::LINEAR); complete_animation_->Show(); if (status_text.empty()) show_status_text_ = false; @@ -655,7 +655,7 @@ void DownloadItemView::Paint(gfx::Canvas* canvas) { download_util::SMALL); } else if (download_->state() == DownloadItem::COMPLETE && complete_animation_.get() && - complete_animation_->IsAnimating()) { + complete_animation_->is_animating()) { download_util::PaintDownloadComplete(canvas, this, 0, 0, complete_animation_->GetCurrentValue(), download_util::SMALL); @@ -783,7 +783,7 @@ bool DownloadItemView::OnMousePressed(const views::MouseEvent& event) { return true; // Stop any completion animation. - if (complete_animation_.get() && complete_animation_->IsAnimating()) + if (complete_animation_.get() && complete_animation_->is_animating()) complete_animation_->End(); if (event.IsOnlyLeftMouseButton()) { diff --git a/chrome/browser/views/download_shelf_view.cc b/chrome/browser/views/download_shelf_view.cc index ff6346d..d727d43 100644 --- a/chrome/browser/views/download_shelf_view.cc +++ b/chrome/browser/views/download_shelf_view.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -165,7 +165,7 @@ gfx::Size DownloadShelfView::GetPreferredSize() { prefsize.Enlarge(kDownloadPadding, 0); } prefsize.Enlarge(0, kTopBottomPadding + kTopBottomPadding); - if (shelf_animation_->IsAnimating()) { + if (shelf_animation_->is_animating()) { prefsize.set_height(static_cast<int>( static_cast<double>(prefsize.height()) * shelf_animation_->GetCurrentValue())); @@ -252,7 +252,7 @@ void DownloadShelfView::Layout() { // Figure out width of item. int item_width = view_size.width(); - if (new_item_animation_->IsAnimating() && ri == download_views_.rbegin()) { + if (new_item_animation_->is_animating() && ri == download_views_.rbegin()) { item_width = static_cast<int>(static_cast<double>(view_size.width()) * new_item_animation_->GetCurrentValue()); } diff --git a/chrome/browser/views/download_started_animation_win.cc b/chrome/browser/views/download_started_animation_win.cc index 8f05c46..eb63f1c 100644 --- a/chrome/browser/views/download_started_animation_win.cc +++ b/chrome/browser/views/download_started_animation_win.cc @@ -4,7 +4,7 @@ #include "chrome/browser/download/download_started_animation.h" -#include "app/animation.h" +#include "app/linear_animation.h" #include "app/resource_bundle.h" #include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/common/notification_registrar.h" @@ -32,7 +32,7 @@ namespace { // provided on the constructor, while simultaneously fading it out. To use, // simply call "new DownloadStartAnimation"; the class cleans itself up when it // finishes animating. -class DownloadStartedAnimationWin : public Animation, +class DownloadStartedAnimationWin : public LinearAnimation, public NotificationObserver, public views::ImageView { public: @@ -74,7 +74,7 @@ class DownloadStartedAnimationWin : public Animation, DownloadStartedAnimationWin::DownloadStartedAnimationWin( TabContents* tab_contents) - : Animation(kMoveTimeMs, kFrameRateHz, NULL), + : LinearAnimation(kMoveTimeMs, kFrameRateHz, NULL), popup_(NULL), tab_contents_(tab_contents) { static SkBitmap* kDownloadImage = NULL; diff --git a/chrome/browser/views/dropdown_bar_host.cc b/chrome/browser/views/dropdown_bar_host.cc index e16074c..b722979 100644 --- a/chrome/browser/views/dropdown_bar_host.cc +++ b/chrome/browser/views/dropdown_bar_host.cc @@ -92,7 +92,7 @@ void DropdownBarHost::SetFocusAndSelection() { } bool DropdownBarHost::IsAnimating() const { - return animation_->IsAnimating(); + return animation_->is_animating(); } void DropdownBarHost::Hide(bool animate) { diff --git a/chrome/browser/views/extensions/extension_shelf.cc b/chrome/browser/views/extensions/extension_shelf.cc index 571e21d..e06b494 100644 --- a/chrome/browser/views/extensions/extension_shelf.cc +++ b/chrome/browser/views/extensions/extension_shelf.cc @@ -434,7 +434,7 @@ void ExtensionShelf::Toolstrip::LayoutWindow() { } gfx::Size window_size = GetPreferredSize(); - if (mole_animation_->IsAnimating()) { + if (mole_animation_->is_animating()) { // We only want to animate the body of the mole window. When we're // expanding, this is everything except for the handle. When we're // collapsing, this is everything except for the handle and the toolstrip. @@ -455,7 +455,7 @@ void ExtensionShelf::Toolstrip::LayoutWindow() { // Now figure out where to place the window on the screen. Since it's a top- // level widget, we need to do some coordinate conversion to get this right. gfx::Point origin(-kToolstripPadding, 0); - if (expanded_ || mole_animation_->IsAnimating()) { + if (expanded_ || mole_animation_->is_animating()) { origin.set_y(GetShelfView()->height() - window_size.height()); views::View::ConvertPointToView(GetShelfView(), shelf_->GetRootView(), &origin); @@ -665,7 +665,7 @@ void ExtensionShelf::Toolstrip::ShowShelfHandle() { void ExtensionShelf::Toolstrip::HideShelfHandle(int delay_ms) { StopHandleTimer(); - if (!handle_visible() || dragging_ || mole_animation_->IsAnimating()) + if (!handle_visible() || dragging_ || mole_animation_->is_animating()) return; if (delay_ms) { MessageLoop::current()->PostDelayedTask(FROM_HERE, diff --git a/chrome/browser/views/frame/browser_view.cc b/chrome/browser/views/frame/browser_view.cc index 203b921..ade9dc0 100644 --- a/chrome/browser/views/frame/browser_view.cc +++ b/chrome/browser/views/frame/browser_view.cc @@ -890,10 +890,7 @@ bool BrowserView::IsBookmarkBarVisible() const { } bool BrowserView::IsBookmarkBarAnimating() const { - if (bookmark_bar_view_.get() && - bookmark_bar_view_->IsAnimating()) - return true; - return false; + return bookmark_bar_view_.get() && bookmark_bar_view_->is_animating(); } bool BrowserView::IsToolbarVisible() const { diff --git a/chrome/browser/views/infobars/infobars.cc b/chrome/browser/views/infobars/infobars.cc index dd4354e..ead3d97 100644 --- a/chrome/browser/views/infobars/infobars.cc +++ b/chrome/browser/views/infobars/infobars.cc @@ -136,7 +136,7 @@ InfoBar::InfoBar(InfoBarDelegate* delegate) AddChildView(close_button_); animation_.reset(new SlideAnimation(this)); - animation_->SetTweenType(SlideAnimation::NONE); + animation_->SetTweenType(Tween::LINEAR); } InfoBar::~InfoBar() { diff --git a/chrome/browser/views/infobars/translate_infobars.cc b/chrome/browser/views/infobars/translate_infobars.cc index 3bebe90..7cc9f11 100644 --- a/chrome/browser/views/infobars/translate_infobars.cc +++ b/chrome/browser/views/infobars/translate_infobars.cc @@ -261,7 +261,7 @@ TranslateInfoBar::TranslateInfoBar(TranslateInfoBarDelegate* delegate) // Initialize slide animation for transitioning to and from error state. error_animation_.reset(new SlideAnimation(this)); - error_animation_->SetTweenType(SlideAnimation::NONE); + error_animation_->SetTweenType(Tween::LINEAR); error_animation_->SetSlideDuration(500); // Initialize icon. @@ -564,7 +564,7 @@ void TranslateInfoBar::Layout() { void TranslateInfoBar::PaintBackground(gfx::Canvas* canvas) { // If we're not animating, simply paint background for current state. - if (!error_animation_->IsAnimating()) { + if (!error_animation_->is_animating()) { GetBackground(state_)->Paint(canvas, this); return; } diff --git a/chrome/browser/views/status_bubble_views.cc b/chrome/browser/views/status_bubble_views.cc index ff874f2..a44ef96 100644 --- a/chrome/browser/views/status_bubble_views.cc +++ b/chrome/browser/views/status_bubble_views.cc @@ -6,7 +6,7 @@ #include <algorithm> -#include "app/animation.h" +#include "app/linear_animation.h" #include "app/l10n_util.h" #include "app/resource_bundle.h" #include "app/text_elider.h" @@ -68,12 +68,12 @@ static const int kMaxExpansionStepDurationMS = 150; // StatusView manages the display of the bubble, applying text changes and // fading in or out the bubble as required. class StatusBubbleViews::StatusView : public views::Label, - public Animation, + public LinearAnimation, public AnimationDelegate { public: StatusView(StatusBubble* status_bubble, views::Widget* popup, ThemeProvider* theme_provider) - : ALLOW_THIS_IN_INITIALIZER_LIST(Animation(kFramerate, this)), + : ALLOW_THIS_IN_INITIALIZER_LIST(LinearAnimation(kFramerate, this)), stage_(BUBBLE_HIDDEN), style_(STYLE_STANDARD), ALLOW_THIS_IN_INITIALIZER_LIST(timer_factory_(this)), @@ -310,7 +310,7 @@ void StatusBubbleViews::StatusView::StartShowing() { // Animation functions. double StatusBubbleViews::StatusView::GetCurrentOpacity() { return opacity_start_ + (opacity_end_ - opacity_start_) * - Animation::GetCurrentValue(); + LinearAnimation::GetCurrentValue(); } void StatusBubbleViews::StatusView::SetOpacity(double opacity) { @@ -465,12 +465,12 @@ void StatusBubbleViews::StatusView::Paint(gfx::Canvas* canvas) { // Manages the expansion and contraction of the status bubble as it accommodates // URLs too long to fit in the standard bubble. Changes are passed through the // StatusView to paint. -class StatusBubbleViews::StatusViewExpander : public Animation, +class StatusBubbleViews::StatusViewExpander : public LinearAnimation, public AnimationDelegate { public: StatusViewExpander(StatusBubble* status_bubble, StatusView* status_view) - : ALLOW_THIS_IN_INITIALIZER_LIST(Animation(kFramerate, this)), + : ALLOW_THIS_IN_INITIALIZER_LIST(LinearAnimation(kFramerate, this)), status_bubble_(status_bubble), status_view_(status_view), expansion_start_(0), @@ -530,7 +530,7 @@ void StatusBubbleViews::StatusViewExpander::StartExpansion( int StatusBubbleViews::StatusViewExpander::GetCurrentBubbleWidth() { return static_cast<int>(expansion_start_ + - (expansion_end_ - expansion_start_) * Animation::GetCurrentValue()); + (expansion_end_ - expansion_start_) * LinearAnimation::GetCurrentValue()); } void StatusBubbleViews::StatusViewExpander::SetBubbleWidth(int width) { diff --git a/chrome/browser/views/tabs/dragged_tab_view.cc b/chrome/browser/views/tabs/dragged_tab_view.cc index 6b9306e..adf9a2b 100644 --- a/chrome/browser/views/tabs/dragged_tab_view.cc +++ b/chrome/browser/views/tabs/dragged_tab_view.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -71,7 +71,7 @@ DraggedTabView::DraggedTabView(TabContents* datasource, } DraggedTabView::~DraggedTabView() { - if (close_animation_.IsAnimating()) + if (close_animation_.is_animating()) close_animation_.Stop(); GetParent()->RemoveChildView(this); container_->CloseNow(); @@ -154,7 +154,7 @@ void DraggedTabView::AnimateToBounds(const gfx::Rect& bounds, animation_end_bounds_ = bounds; close_animation_.SetSlideDuration(kAnimateToBoundsDurationMs); - close_animation_.SetTweenType(SlideAnimation::EASE_OUT); + close_animation_.SetTweenType(Tween::EASE_OUT); if (!close_animation_.IsShowing()) { close_animation_.Reset(); close_animation_.Show(); diff --git a/chrome/browser/views/tabs/side_tab.cc b/chrome/browser/views/tabs/side_tab.cc index dfa18e1..54795fb 100644 --- a/chrome/browser/views/tabs/side_tab.cc +++ b/chrome/browser/views/tabs/side_tab.cc @@ -165,7 +165,7 @@ void SideTab::Paint(gfx::Canvas* canvas) { SkPaint paint; SkAlpha opacity = kBackgroundTabAlpha; - if (hover_animation_->IsAnimating()) + if (hover_animation_->is_animating()) opacity = static_cast<SkAlpha>(hover_animation_->GetCurrentValue() * 255); paint.setColor(SkColorSetARGB(kBackgroundTabAlpha, 255, 255, 255)); @@ -181,12 +181,12 @@ gfx::Size SideTab::GetPreferredSize() { } void SideTab::OnMouseEntered(const views::MouseEvent& event) { - hover_animation_->SetTweenType(SlideAnimation::EASE_OUT); + hover_animation_->SetTweenType(Tween::EASE_OUT); hover_animation_->Show(); } void SideTab::OnMouseExited(const views::MouseEvent& event) { - hover_animation_->SetTweenType(SlideAnimation::EASE_IN); + hover_animation_->SetTweenType(Tween::EASE_IN); hover_animation_->Hide(); } diff --git a/chrome/browser/views/tabs/tab_renderer.cc b/chrome/browser/views/tabs/tab_renderer.cc index 8b5a1d8..13aeff9 100644 --- a/chrome/browser/views/tabs/tab_renderer.cc +++ b/chrome/browser/views/tabs/tab_renderer.cc @@ -222,11 +222,11 @@ class TabCloseButton : public views::ImageButton { // FaviconCrashAnimation // // A custom animation subclass to manage the favicon crash animation. -class TabRenderer::FavIconCrashAnimation : public Animation, +class TabRenderer::FavIconCrashAnimation : public LinearAnimation, public AnimationDelegate { public: explicit FavIconCrashAnimation(TabRenderer* target) - : ALLOW_THIS_IN_INITIALIZER_LIST(Animation(1000, 25, this)), + : ALLOW_THIS_IN_INITIALIZER_LIST(LinearAnimation(1000, 25, this)), target_(target) { } virtual ~FavIconCrashAnimation() {} @@ -394,8 +394,7 @@ void TabRenderer::StartPulse() { } void TabRenderer::StopPulse() { - if (pulse_animation_->IsAnimating()) - pulse_animation_->Stop(); + pulse_animation_->Stop(); } void TabRenderer::StartMiniTabTitleAnimation() { @@ -404,7 +403,7 @@ void TabRenderer::StartMiniTabTitleAnimation() { mini_title_animation_->SetThrobDuration(kMiniTitleChangeThrobDuration); } - if (!mini_title_animation_->IsAnimating()) { + if (!mini_title_animation_->is_animating()) { mini_title_animation_->StartThrobbing(2); } else if (mini_title_animation_->cycles_remaining() <= 2) { // The title changed while we're already animating. Add at most one more @@ -449,7 +448,7 @@ void TabRenderer::PaintIcon(gfx::Canvas* canvas) { // effect separately. int size = data_.favicon.width(); if (mini() && mini_title_animation_.get() && - mini_title_animation_->IsAnimating()) { + mini_title_animation_->is_animating()) { int throb_size = mini_title_animation_->CurrentValueBetween( size, kMiniTitleChangeMaxFaviconSize); x -= (throb_size - size) / 2; @@ -507,12 +506,12 @@ std::wstring TabRenderer::GetTitle() const { } void TabRenderer::OnMouseEntered(const views::MouseEvent& e) { - hover_animation_->SetTweenType(SlideAnimation::EASE_OUT); + hover_animation_->SetTweenType(Tween::EASE_OUT); hover_animation_->Show(); } void TabRenderer::OnMouseExited(const views::MouseEvent& e) { - hover_animation_->SetTweenType(SlideAnimation::EASE_IN); + hover_animation_->SetTweenType(Tween::EASE_IN); hover_animation_->Hide(); } @@ -930,7 +929,7 @@ double TabRenderer::GetThrobValue() { if (data_.alpha != 1) return data_.alpha; - if (pulse_animation_->IsAnimating()) + if (pulse_animation_->is_animating()) return pulse_animation_->GetCurrentValue() * kHoverOpacity; return hover_animation_.get() ? @@ -954,7 +953,7 @@ void TabRenderer::StopCrashAnimation() { } bool TabRenderer::IsPerformingCrashAnimation() const { - return crash_animation_ && crash_animation_->IsAnimating(); + return crash_animation_ && crash_animation_->is_animating(); } void TabRenderer::SetFavIconHidingOffset(int offset) { diff --git a/chrome/browser/views/tabs/tab_strip.cc b/chrome/browser/views/tabs/tab_strip.cc index a6e11d3..ced65ab 100644 --- a/chrome/browser/views/tabs/tab_strip.cc +++ b/chrome/browser/views/tabs/tab_strip.cc @@ -1529,7 +1529,7 @@ void TabStrip::NewTabAnimation2Done() { SlideAnimation* animation = new SlideAnimation(NULL); animation->SetSlideDuration(kNewTab3DurationMs); - animation->SetTweenType(SlideAnimation::EASE_IN_OUT); + animation->SetTweenType(Tween::EASE_IN_OUT); // BoundsAnimator takes ownership of animation. bounds_animator_.SetAnimationForView(tab_data_.back().tab, animation); |