diff options
author | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-07 17:33:39 +0000 |
---|---|---|
committer | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-07 17:33:39 +0000 |
commit | f676780687464428e340d008a0d1ca13d9944628 (patch) | |
tree | 489e8bd8188e31a7f6c53f15e8d1d9c6ba36d023 /chrome/browser/ui | |
parent | 3b65bfd55c56cf8a6db025087d937494f49dc15f (diff) | |
download | chromium_src-f676780687464428e340d008a0d1ca13d9944628.zip chromium_src-f676780687464428e340d008a0d1ca13d9944628.tar.gz chromium_src-f676780687464428e340d008a0d1ca13d9944628.tar.bz2 |
Move animation code to new ui/base/animation directory.
BUG=none
TEST=none
TBR=brettw
Review URL: http://codereview.chromium.org/6154001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@70743 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/ui')
45 files changed, 329 insertions, 286 deletions
diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc index bed9899..6ee459b 100644 --- a/chrome/browser/ui/browser.cc +++ b/chrome/browser/ui/browser.cc @@ -12,7 +12,6 @@ #include <algorithm> #include <string> -#include "app/animation.h" #include "app/l10n_util.h" #include "base/base_paths.h" #include "base/command_line.h" @@ -108,6 +107,7 @@ #include "net/base/registry_controlled_domain.h" #include "net/base/static_cookie_policy.h" #include "net/url_request/url_request_context.h" +#include "ui/base/animation/animation.h" #include "webkit/glue/webkit_glue.h" #include "webkit/glue/window_open_disposition.h" @@ -3060,7 +3060,7 @@ void Browser::OnStartDownload(DownloadItem* download, TabContents* tab) { TabContents* current_tab = GetSelectedTabContents(); // We make this check for the case of minimized windows, unit tests, etc. if (platform_util::IsVisible(current_tab->GetNativeView()) && - Animation::ShouldRenderRichAnimation()) { + ui::Animation::ShouldRenderRichAnimation()) { DownloadStartedAnimation::Show(current_tab); } #endif diff --git a/chrome/browser/ui/views/app_launched_animation_win.cc b/chrome/browser/ui/views/app_launched_animation_win.cc index 0fe5d05..a2007d3 100644 --- a/chrome/browser/ui/views/app_launched_animation_win.cc +++ b/chrome/browser/ui/views/app_launched_animation_win.cc @@ -4,14 +4,14 @@ #include "chrome/browser/app_launched_animation.h" -#include "app/animation.h" -#include "app/animation_delegate.h" -#include "app/slide_animation.h" #include "chrome/browser/extensions/image_loading_tracker.h" #include "chrome/common/extensions/extension.h" #include "chrome/common/extensions/extension_icon_set.h" #include "chrome/common/extensions/extension_resource.h" #include "gfx/rect.h" +#include "ui/base/animation/animation.h" +#include "ui/base/animation/animation_delegate.h" +#include "ui/base/animation/slide_animation.h" #include "views/controls/image_view.h" #include "views/widget/widget_win.h" @@ -35,17 +35,17 @@ static const int kDelayMS = 100; // AppLaunchedAnimation creates an animation. It loads the icon for the // extension and once the image is loaded the animation starts. The icon fades // out after a short delay. -class AppLaunchedAnimationWin : public AnimationDelegate, +class AppLaunchedAnimationWin : public ui::AnimationDelegate, public ImageLoadingTracker::Observer, public views::ImageView { public: AppLaunchedAnimationWin(const Extension* extension, const gfx::Rect& rect); private: - // AnimationDelegate - virtual void AnimationProgressed(const Animation* animation); - virtual void AnimationCanceled(const Animation* animation); - virtual void AnimationEnded(const Animation* animation); + // ui::AnimationDelegate + virtual void AnimationProgressed(const ui::Animation* animation); + virtual void AnimationCanceled(const ui::Animation* animation); + virtual void AnimationEnded(const ui::Animation* animation); // We use a HWND for the popup so that it may float above any HWNDs in our UI. views::WidgetWin* popup_; @@ -61,7 +61,7 @@ class AppLaunchedAnimationWin : public AnimationDelegate, int index); // Hover animation. - scoped_ptr<SlideAnimation> animation_; + scoped_ptr<ui::SlideAnimation> animation_; DISALLOW_COPY_AND_ASSIGN(AppLaunchedAnimationWin); }; @@ -80,15 +80,17 @@ AppLaunchedAnimationWin::AppLaunchedAnimationWin(const Extension* extension, ImageLoadingTracker::DONT_CACHE); } -void AppLaunchedAnimationWin::AnimationCanceled(const Animation* animation) { +void AppLaunchedAnimationWin::AnimationCanceled( + const ui::Animation* animation) { AnimationEnded(animation); } -void AppLaunchedAnimationWin::AnimationEnded(const Animation* animation) { +void AppLaunchedAnimationWin::AnimationEnded(const ui::Animation* animation) { popup_->Close(); } -void AppLaunchedAnimationWin::AnimationProgressed(const Animation* animation) { +void AppLaunchedAnimationWin::AnimationProgressed( + const ui::Animation* animation) { // GetCurrentValue goes from 1 to 0 since we are hiding. const double current_value = 1.0 - animation->GetCurrentValue(); const double current_time = current_value * (kDelayMS + kDurationMS); @@ -118,9 +120,9 @@ void AppLaunchedAnimationWin::OnImageLoaded(SkBitmap* image, popup_->Show(); // Start animation. - animation_.reset(new SlideAnimation(this)); + animation_.reset(new ui::SlideAnimation(this)); animation_->SetSlideDuration(kDelayMS + kDurationMS); - animation_->SetTweenType(Tween::LINEAR); + animation_->SetTweenType(ui::Tween::LINEAR); animation_->Reset(1.0); animation_->Hide(); } diff --git a/chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.cc b/chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.cc index 857db9d..059de7e 100644 --- a/chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.cc +++ b/chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.cc @@ -939,7 +939,7 @@ const SkBitmap* AutocompletePopupContentsView::GetSpecialIcon( // AutocompletePopupContentsView, AnimationDelegate implementation: void AutocompletePopupContentsView::AnimationProgressed( - const Animation* animation) { + const ui::Animation* animation) { // We should only be running the animation when the popup is already visible. DCHECK(popup_ != NULL); popup_->SetBounds(GetPopupBounds()); diff --git a/chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.h b/chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.h index d6adea1..72cb7bd 100644 --- a/chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.h +++ b/chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.h @@ -6,12 +6,12 @@ #define CHROME_BROWSER_UI_VIEWS_AUTOCOMPLETE_AUTOCOMPLETE_POPUP_CONTENTS_VIEW_H_ #pragma once -#include "app/animation_delegate.h" -#include "app/slide_animation.h" #include "chrome/browser/autocomplete/autocomplete.h" #include "chrome/browser/autocomplete/autocomplete_popup_model.h" #include "chrome/browser/autocomplete/autocomplete_popup_view.h" #include "gfx/font.h" +#include "ui/base/animation/animation_delegate.h" +#include "ui/base/animation/slide_animation.h" #include "views/view.h" #include "webkit/glue/window_open_disposition.h" @@ -46,7 +46,7 @@ class AutocompleteResultViewModel { class AutocompletePopupContentsView : public views::View, public AutocompleteResultViewModel, public AutocompletePopupView, - public AnimationDelegate { + public ui::AnimationDelegate { public: AutocompletePopupContentsView(const gfx::Font& font, AutocompleteEditView* edit_view, @@ -73,8 +73,8 @@ class AutocompletePopupContentsView : public views::View, virtual bool IsHoveredIndex(size_t index) const; virtual const SkBitmap* GetSpecialIcon(size_t index) const; - // Overridden from AnimationDelegate: - virtual void AnimationProgressed(const Animation* animation); + // Overridden from ui::AnimationDelegate: + virtual void AnimationProgressed(const ui::Animation* animation); // Overridden from views::View: virtual void Paint(gfx::Canvas* canvas); @@ -165,7 +165,7 @@ class AutocompletePopupContentsView : public views::View, // The popup sizes vertically using an animation when the popup is getting // shorter (not larger, that makes it look "slow"). - SlideAnimation size_animation_; + ui::SlideAnimation size_animation_; gfx::Rect start_bounds_; gfx::Rect target_bounds_; diff --git a/chrome/browser/ui/views/bookmark_bar_view.cc b/chrome/browser/ui/views/bookmark_bar_view.cc index 924d9cb..42f481e 100644 --- a/chrome/browser/ui/views/bookmark_bar_view.cc +++ b/chrome/browser/ui/views/bookmark_bar_view.cc @@ -12,7 +12,6 @@ #include "app/l10n_util.h" #include "app/os_exchange_data.h" #include "app/resource_bundle.h" -#include "app/slide_animation.h" #include "app/text_elider.h" #include "base/i18n/rtl.h" #include "base/string_util.h" @@ -43,6 +42,7 @@ #include "grit/app_resources.h" #include "grit/generated_resources.h" #include "grit/theme_resources.h" +#include "ui/base/animation/slide_animation.h" #include "views/controls/button/menu_button.h" #include "views/controls/label.h" #include "views/controls/menu/menu_item_view.h" @@ -179,7 +179,7 @@ class BookmarkButton : public views::TextButton { : TextButton(listener, title), url_(url), profile_(profile) { - show_animation_.reset(new SlideAnimation(this)); + show_animation_.reset(new ui::SlideAnimation(this)); if (BookmarkBarView::testing_) { // For some reason during testing the events generated by animating // throw off the test. So, don't animate while testing. @@ -204,7 +204,7 @@ class BookmarkButton : public views::TextButton { private: const GURL& url_; Profile* profile_; - scoped_ptr<SlideAnimation> show_animation_; + scoped_ptr<ui::SlideAnimation> show_animation_; DISALLOW_COPY_AND_ASSIGN(BookmarkButton); }; @@ -220,7 +220,7 @@ class BookmarkFolderButton : public views::MenuButton { views::ViewMenuDelegate* menu_delegate, bool show_menu_marker) : MenuButton(listener, title, menu_delegate, show_menu_marker) { - show_animation_.reset(new SlideAnimation(this)); + show_animation_.reset(new ui::SlideAnimation(this)); if (BookmarkBarView::testing_) { // For some reason during testing the events generated by animating // throw off the test. So, don't animate while testing. @@ -247,7 +247,7 @@ class BookmarkFolderButton : public views::MenuButton { } private: - scoped_ptr<SlideAnimation> show_animation_; + scoped_ptr<ui::SlideAnimation> show_animation_; DISALLOW_COPY_AND_ASSIGN(BookmarkFolderButton); }; @@ -779,12 +779,12 @@ bool BookmarkBarView::is_animating() { return size_animation_->is_animating(); } -void BookmarkBarView::AnimationProgressed(const Animation* animation) { +void BookmarkBarView::AnimationProgressed(const ui::Animation* animation) { if (browser_) browser_->ToolbarSizeChanged(true); } -void BookmarkBarView::AnimationEnded(const Animation* animation) { +void BookmarkBarView::AnimationEnded(const ui::Animation* animation) { if (browser_) browser_->ToolbarSizeChanged(false); @@ -923,7 +923,7 @@ void BookmarkBarView::Init() { SetContextMenuController(this); - size_animation_.reset(new SlideAnimation(this)); + size_animation_.reset(new ui::SlideAnimation(this)); } MenuButton* BookmarkBarView::CreateOtherBookmarkedButton() { diff --git a/chrome/browser/ui/views/bookmark_bar_view.h b/chrome/browser/ui/views/bookmark_bar_view.h index 9fadd8b..79709f4 100644 --- a/chrome/browser/ui/views/bookmark_bar_view.h +++ b/chrome/browser/ui/views/bookmark_bar_view.h @@ -8,7 +8,6 @@ #include <set> -#include "app/animation_delegate.h" #include "chrome/browser/bookmarks/bookmark_node_data.h" #include "chrome/browser/bookmarks/bookmark_model_observer.h" #include "chrome/browser/sync/profile_sync_service.h" @@ -16,13 +15,17 @@ #include "chrome/browser/views/bookmark_menu_controller_views.h" #include "chrome/browser/views/detachable_toolbar_view.h" #include "chrome/common/notification_registrar.h" +#include "ui/base/animation/animation_delegate.h" #include "views/controls/button/button.h" #include "views/controls/menu/view_menu_delegate.h" class Browser; class PageNavigator; class PrefService; + +namespace ui { class SlideAnimation; +} namespace views { class CustomButton; @@ -46,7 +49,7 @@ class BookmarkBarView : public DetachableToolbarView, public NotificationObserver, public views::ContextMenuController, public views::DragController, - public AnimationDelegate, + public ui::AnimationDelegate, public BookmarkMenuController::Observer, public BookmarkBarInstructionsView::Delegate { friend class ShowFolderMenuTask; @@ -180,8 +183,8 @@ class BookmarkBarView : public DetachableToolbarView, bool is_animating(); // SlideAnimationDelegate implementation. - void AnimationProgressed(const Animation* animation); - void AnimationEnded(const Animation* animation); + void AnimationProgressed(const ui::Animation* animation); + void AnimationEnded(const ui::Animation* animation); // BookmarkMenuController::Observer virtual void BookmarkMenuDeleted(BookmarkMenuController* controller); @@ -491,7 +494,7 @@ class BookmarkBarView : public DetachableToolbarView, bool infobar_visible_; // Animation controlling showing and hiding of the bar. - scoped_ptr<SlideAnimation> size_animation_; + scoped_ptr<ui::SlideAnimation> size_animation_; // If the bookmark bubble is showing, this is the visible ancestor of the URL. // The visible ancestor is either the other_bookmarked_button_, diff --git a/chrome/browser/ui/views/browser_actions_container.cc b/chrome/browser/ui/views/browser_actions_container.cc index 39cb337..44a4a00 100644 --- a/chrome/browser/ui/views/browser_actions_container.cc +++ b/chrome/browser/ui/views/browser_actions_container.cc @@ -6,7 +6,6 @@ #include "app/l10n_util.h" #include "app/resource_bundle.h" -#include "app/slide_animation.h" #include "base/stl_util-inl.h" #include "base/string_util.h" #include "base/utf_string_conversions.h" @@ -38,6 +37,7 @@ #include "third_party/skia/include/core/SkBitmap.h" #include "third_party/skia/include/core/SkTypeface.h" #include "third_party/skia/include/effects/SkGradientShader.h" +#include "ui/base/animation/slide_animation.h" #include "views/controls/button/menu_button.h" #include "views/controls/button/text_button.h" #include "views/controls/menu/menu_2.h" @@ -366,7 +366,7 @@ BrowserActionsContainer::BrowserActionsContainer(Browser* browser, model_->AddObserver(this); } - resize_animation_.reset(new SlideAnimation(this)); + resize_animation_.reset(new ui::SlideAnimation(this)); resize_area_ = new views::ResizeArea(this); resize_area_->SetAccessibleName( UTF16ToWide(l10n_util::GetStringUTF16(IDS_ACCNAME_SEPARATOR))); @@ -799,18 +799,19 @@ void BrowserActionsContainer::OnResize(int resize_amount, bool done_resizing) { int max_width = IconCountToWidth(-1, false); container_width_ = std::min(std::max(0, container_width_ - resize_amount), max_width); - SaveDesiredSizeAndAnimate(Tween::EASE_OUT, + SaveDesiredSizeAndAnimate(ui::Tween::EASE_OUT, WidthToIconCount(container_width_)); } -void BrowserActionsContainer::AnimationProgressed(const Animation* animation) { +void BrowserActionsContainer::AnimationProgressed( + const ui::Animation* animation) { DCHECK_EQ(resize_animation_.get(), animation); resize_amount_ = static_cast<int>(resize_animation_->GetCurrentValue() * (container_width_ - animation_target_size_)); OnBrowserActionVisibilityChanged(); } -void BrowserActionsContainer::AnimationEnded(const Animation* animation) { +void BrowserActionsContainer::AnimationEnded(const ui::Animation* animation) { container_width_ = animation_target_size_; animation_target_size_ = 0; resize_amount_ = 0; @@ -920,7 +921,7 @@ void BrowserActionsContainer::BrowserActionAdded(const Extension* extension, if ((model_->GetVisibleIconCount() < 0) && !profile_->GetExtensionService()->IsBeingUpgraded(extension)) { suppress_chevron_ = true; - SaveDesiredSizeAndAnimate(Tween::LINEAR, visible_actions + 1); + SaveDesiredSizeAndAnimate(ui::Tween::LINEAR, visible_actions + 1); } else { // Just redraw the (possibly modified) visible icon set. OnBrowserActionVisibilityChanged(); @@ -956,7 +957,7 @@ void BrowserActionsContainer::BrowserActionRemoved(const Extension* extension) { // Either we went from overflow to no-overflow, or we shrunk the no- // overflow container by 1. Either way the size changed, so animate. chevron_->SetVisible(false); - SaveDesiredSizeAndAnimate(Tween::EASE_OUT, + SaveDesiredSizeAndAnimate(ui::Tween::EASE_OUT, browser_action_views_.size()); } return; @@ -1068,7 +1069,7 @@ int BrowserActionsContainer::ContainerMinSize() const { } void BrowserActionsContainer::SaveDesiredSizeAndAnimate( - Tween::Type tween_type, + ui::Tween::Type tween_type, size_t num_visible_icons) { // Save off the desired number of visible icons. We do this now instead of at // the end of the animation so that even if the browser is shut down while diff --git a/chrome/browser/ui/views/browser_actions_container.h b/chrome/browser/ui/views/browser_actions_container.h index 62b567f..5291ece 100644 --- a/chrome/browser/ui/views/browser_actions_container.h +++ b/chrome/browser/ui/views/browser_actions_container.h @@ -10,8 +10,6 @@ #include <string> #include <vector> -#include "app/animation_delegate.h" -#include "app/tween.h" #include "base/task.h" #include "chrome/browser/extensions/extension_context_menu_model.h" #include "chrome/browser/extensions/extension_toolbar_model.h" @@ -21,6 +19,8 @@ #include "chrome/browser/views/extensions/extension_popup.h" #include "chrome/common/notification_observer.h" #include "chrome/common/notification_registrar.h" +#include "ui/base/animation/animation_delegate.h" +#include "ui/base/animation/tween.h" #include "views/controls/button/menu_button.h" #include "views/controls/menu/view_menu_delegate.h" #include "views/controls/resize_area.h" @@ -35,12 +35,15 @@ class ExtensionAction; class ExtensionPopup; class PrefService; class Profile; -class SlideAnimation; namespace gfx { class CanvasSkia; } +namespace ui { +class SlideAnimation; +} + namespace views { class Menu2; } @@ -254,7 +257,7 @@ class BrowserActionsContainer public views::ViewMenuDelegate, public views::DragController, public views::ResizeArea::ResizeAreaDelegate, - public AnimationDelegate, + public ui::AnimationDelegate, public ExtensionToolbarModel::Observer, public BrowserActionOverflowMenuController::Observer, public ExtensionContextMenuModel::PopupDelegate, @@ -345,9 +348,9 @@ class BrowserActionsContainer // Overridden from ResizeArea::ResizeAreaDelegate: virtual void OnResize(int resize_amount, bool done_resizing); - // Overridden from AnimationDelegate: - virtual void AnimationProgressed(const Animation* animation); - virtual void AnimationEnded(const Animation* animation); + // Overridden from ui::AnimationDelegate: + virtual void AnimationProgressed(const ui::Animation* animation); + virtual void AnimationEnded(const ui::Animation* animation); // Overridden from BrowserActionOverflowMenuController::Observer: virtual void NotifyMenuDeleted( @@ -439,7 +442,8 @@ class BrowserActionsContainer // Animate to the target size (unless testing, in which case we go straight to // the target size). This also saves the target number of visible icons in // the pref if we're not off the record. - void SaveDesiredSizeAndAnimate(Tween::Type type, size_t num_visible_icons); + void SaveDesiredSizeAndAnimate(ui::Tween::Type type, + size_t num_visible_icons); // 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 @@ -483,7 +487,7 @@ class BrowserActionsContainer BrowserActionOverflowMenuController* overflow_menu_; // The animation that happens when the container snaps to place. - scoped_ptr<SlideAnimation> resize_animation_; + scoped_ptr<ui::SlideAnimation> resize_animation_; // Don't show the chevron while animating. bool suppress_chevron_; diff --git a/chrome/browser/ui/views/download_item_view.cc b/chrome/browser/ui/views/download_item_view.cc index 27406db..474b27b 100644 --- a/chrome/browser/ui/views/download_item_view.cc +++ b/chrome/browser/ui/views/download_item_view.cc @@ -8,7 +8,6 @@ #include "app/l10n_util.h" #include "app/resource_bundle.h" -#include "app/slide_animation.h" #include "app/text_elider.h" #include "base/callback.h" #include "base/file_path.h" @@ -26,6 +25,7 @@ #include "gfx/color_utils.h" #include "grit/generated_resources.h" #include "grit/theme_resources.h" +#include "ui/base/animation/slide_animation.h" #include "views/controls/button/native_button.h" #include "views/controls/menu/menu_2.h" #include "views/widget/root_view.h" @@ -237,8 +237,8 @@ DownloadItemView::DownloadItemView(DownloadItem* download, drop_down_x_right_ = size.width(); } - body_hover_animation_.reset(new SlideAnimation(this)); - drop_hover_animation_.reset(new SlideAnimation(this)); + body_hover_animation_.reset(new ui::SlideAnimation(this)); + drop_hover_animation_.reset(new ui::SlideAnimation(this)); if (download->safety_state() == DownloadItem::DANGEROUS) { tooltip_text_.clear(); @@ -367,9 +367,9 @@ void DownloadItemView::OnDownloadUpdated(DownloadItem* download) { return; } StopDownloadProgress(); - complete_animation_.reset(new SlideAnimation(this)); + complete_animation_.reset(new ui::SlideAnimation(this)); complete_animation_->SetSlideDuration(kCompleteAnimationDurationMs); - complete_animation_->SetTweenType(Tween::LINEAR); + complete_animation_->SetTweenType(ui::Tween::LINEAR); complete_animation_->Show(); if (status_text.empty()) show_status_text_ = false; @@ -942,7 +942,7 @@ AccessibilityTypes::State DownloadItemView::GetAccessibleState() { } } -void DownloadItemView::AnimationProgressed(const Animation* animation) { +void DownloadItemView::AnimationProgressed(const ui::Animation* animation) { // We don't care if what animation (body button/drop button/complete), // is calling back, as they all have to go through the same paint call. SchedulePaint(); diff --git a/chrome/browser/ui/views/download_item_view.h b/chrome/browser/ui/views/download_item_view.h index 476f479..c2beb3c 100644 --- a/chrome/browser/ui/views/download_item_view.h +++ b/chrome/browser/ui/views/download_item_view.h @@ -19,7 +19,6 @@ #include <string> -#include "app/animation_delegate.h" #include "base/basictypes.h" #include "base/scoped_ptr.h" #include "base/time.h" @@ -29,24 +28,29 @@ #include "chrome/browser/download/download_manager.h" #include "chrome/browser/icon_manager.h" #include "gfx/font.h" +#include "ui/base/animation/animation_delegate.h" #include "views/event.h" #include "views/controls/button/button.h" #include "views/view.h" -namespace views { -class Label; -class NativeButton; -} class BaseDownloadItemModel; class DownloadShelfView; class SkBitmap; class DownloadShelfContextMenuWin; + +namespace ui { class SlideAnimation; +} + +namespace views { +class Label; +class NativeButton; +} class DownloadItemView : public views::ButtonListener, public views::View, public DownloadItem::Observer, - public AnimationDelegate { + public ui::AnimationDelegate { public: DownloadItemView(DownloadItem* download, DownloadShelfView* parent, @@ -75,8 +79,8 @@ class DownloadItemView : public views::ButtonListener, // ButtonListener implementation. virtual void ButtonPressed(views::Button* sender, const views::Event& event); - // AnimationDelegate implementation. - virtual void AnimationProgressed(const Animation* animation); + // ui::AnimationDelegate implementation. + virtual void AnimationProgressed(const ui::Animation* animation); // Timer callback for handling animations void UpdateDownloadProgress(); @@ -231,11 +235,11 @@ class DownloadItemView : public views::ButtonListener, scoped_ptr<BaseDownloadItemModel> model_; // Hover animations for our body and drop buttons. - scoped_ptr<SlideAnimation> body_hover_animation_; - scoped_ptr<SlideAnimation> drop_hover_animation_; + scoped_ptr<ui::SlideAnimation> body_hover_animation_; + scoped_ptr<ui::SlideAnimation> drop_hover_animation_; // Animation for download complete. - scoped_ptr<SlideAnimation> complete_animation_; + scoped_ptr<ui::SlideAnimation> complete_animation_; // Progress animation base::RepeatingTimer<DownloadItemView> progress_timer_; diff --git a/chrome/browser/ui/views/download_shelf_view.cc b/chrome/browser/ui/views/download_shelf_view.cc index 17c4fd1..c3a4ea3 100644 --- a/chrome/browser/ui/views/download_shelf_view.cc +++ b/chrome/browser/ui/views/download_shelf_view.cc @@ -8,7 +8,6 @@ #include "app/l10n_util.h" #include "app/resource_bundle.h" -#include "app/slide_animation.h" #include "base/logging.h" #include "base/utf_string_conversions.h" #include "chrome/browser/download/download_item.h" @@ -23,6 +22,7 @@ #include "gfx/canvas.h" #include "grit/generated_resources.h" #include "grit/theme_resources.h" +#include "ui/base/animation/slide_animation.h" #include "views/background.h" #include "views/controls/button/image_button.h" #include "views/controls/image_view.h" @@ -120,10 +120,10 @@ void DownloadShelfView::Init() { UpdateButtonColors(); AddChildView(close_button_); - new_item_animation_.reset(new SlideAnimation(this)); + new_item_animation_.reset(new ui::SlideAnimation(this)); new_item_animation_->SetSlideDuration(kNewItemAnimationDurationMs); - shelf_animation_.reset(new SlideAnimation(this)); + shelf_animation_.reset(new ui::SlideAnimation(this)); shelf_animation_->SetSlideDuration(kShelfAnimationDurationMs); Show(); } @@ -224,7 +224,7 @@ gfx::Size DownloadShelfView::GetPreferredSize() { return prefsize; } -void DownloadShelfView::AnimationProgressed(const Animation *animation) { +void DownloadShelfView::AnimationProgressed(const ui::Animation *animation) { if (animation == new_item_animation_.get()) { Layout(); SchedulePaint(); @@ -239,7 +239,7 @@ void DownloadShelfView::AnimationProgressed(const Animation *animation) { } } -void DownloadShelfView::AnimationEnded(const Animation *animation) { +void DownloadShelfView::AnimationEnded(const ui::Animation *animation) { if (animation == shelf_animation_.get()) { parent_->SetDownloadShelfVisible(shelf_animation_->IsShowing()); if (!shelf_animation_->IsShowing()) diff --git a/chrome/browser/ui/views/download_shelf_view.h b/chrome/browser/ui/views/download_shelf_view.h index 4394a2f..e7c1253 100644 --- a/chrome/browser/ui/views/download_shelf_view.h +++ b/chrome/browser/ui/views/download_shelf_view.h @@ -6,24 +6,27 @@ #define CHROME_BROWSER_UI_VIEWS_DOWNLOAD_SHELF_VIEW_H_ #pragma once -#include "app/animation_delegate.h" #include "chrome/browser/download/download_shelf.h" #include "chrome/browser/views/accessible_pane_view.h" +#include "ui/base/animation/animation_delegate.h" #include "views/controls/button/button.h" #include "views/controls/link.h" #include "views/mouse_watcher.h" -namespace views { -class ImageButton; -class ImageView; -} - class BaseDownloadItemModel; class Browser; class BrowserView; class DownloadAnimation; class DownloadItemView; + +namespace ui { class SlideAnimation; +} + +namespace views { +class ImageButton; +class ImageView; +} // DownloadShelfView is a view that contains individual views for each download, // as well as a close button and a link to show all downloads. @@ -31,7 +34,7 @@ class SlideAnimation; // DownloadShelfView does not hold an infinite number of download views, rather // it'll automatically remove views once a certain point is reached. class DownloadShelfView : public AccessiblePaneView, - public AnimationDelegate, + public ui::AnimationDelegate, public DownloadShelf, public views::ButtonListener, public views::LinkController, @@ -48,9 +51,9 @@ class DownloadShelfView : public AccessiblePaneView, virtual void Layout(); virtual void Paint(gfx::Canvas* canvas); - // Implementation of AnimationDelegate. - virtual void AnimationProgressed(const Animation* animation); - virtual void AnimationEnded(const Animation* animation); + // Implementation of ui::AnimationDelegate. + virtual void AnimationProgressed(const ui::Animation* animation); + virtual void AnimationEnded(const ui::Animation* animation); // Implementation of LinkController. // Invoked when the user clicks the 'show all downloads' link button. @@ -124,10 +127,10 @@ class DownloadShelfView : public AccessiblePaneView, Browser* browser_; // The animation for adding new items to the shelf. - scoped_ptr<SlideAnimation> new_item_animation_; + scoped_ptr<ui::SlideAnimation> new_item_animation_; // The show/hide animation for the shelf itself. - scoped_ptr<SlideAnimation> shelf_animation_; + scoped_ptr<ui::SlideAnimation> shelf_animation_; // The download views. These are also child Views, and deleted when // the DownloadShelfView is deleted. diff --git a/chrome/browser/ui/views/download_started_animation_win.cc b/chrome/browser/ui/views/download_started_animation_win.cc index 23989939..cbcbc97 100644 --- a/chrome/browser/ui/views/download_started_animation_win.cc +++ b/chrome/browser/ui/views/download_started_animation_win.cc @@ -4,7 +4,6 @@ #include "chrome/browser/download/download_started_animation.h" -#include "app/linear_animation.h" #include "app/resource_bundle.h" #include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/common/notification_details.h" @@ -12,6 +11,7 @@ #include "chrome/common/notification_source.h" #include "gfx/rect.h" #include "grit/theme_resources.h" +#include "ui/base/animation/linear_animation.h" #include "views/controls/image_view.h" #include "views/widget/widget_win.h" @@ -33,7 +33,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 LinearAnimation, +class DownloadStartedAnimationWin : public ui::LinearAnimation, public NotificationObserver, public views::ImageView { public: @@ -75,7 +75,7 @@ class DownloadStartedAnimationWin : public LinearAnimation, DownloadStartedAnimationWin::DownloadStartedAnimationWin( TabContents* tab_contents) - : LinearAnimation(kMoveTimeMs, kFrameRateHz, NULL), + : ui::LinearAnimation(kMoveTimeMs, kFrameRateHz, NULL), popup_(NULL), tab_contents_(tab_contents) { static SkBitmap* kDownloadImage = NULL; diff --git a/chrome/browser/ui/views/dropdown_bar_host.cc b/chrome/browser/ui/views/dropdown_bar_host.cc index 1134c8c..5a1c2ad 100644 --- a/chrome/browser/ui/views/dropdown_bar_host.cc +++ b/chrome/browser/ui/views/dropdown_bar_host.cc @@ -5,13 +5,13 @@ #include "chrome/browser/views/dropdown_bar_host.h" #include "app/keyboard_codes.h" -#include "app/slide_animation.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/view_ids.h" #include "chrome/browser/ui/views/dropdown_bar_view.h" #include "chrome/browser/ui/views/frame/browser_view.h" #include "gfx/path.h" #include "gfx/scrollbar_size.h" +#include "ui/base/animation/slide_animation.h" #include "views/focus/external_focus_tracker.h" #include "views/focus/view_storage.h" #include "views/widget/widget.h" @@ -68,7 +68,7 @@ void DropdownBarHost::Init(DropdownBarView* view) { } // Start the process of animating the opening of the widget. - animation_.reset(new SlideAnimation(this)); + animation_.reset(new ui::SlideAnimation(this)); } DropdownBarHost::~DropdownBarHost() { @@ -150,9 +150,9 @@ void DropdownBarHost::FocusWillChange(views::View* focused_before, } //////////////////////////////////////////////////////////////////////////////// -// DropdownBarHost, AnimationDelegate implementation: +// DropdownBarHost, ui::AnimationDelegate implementation: -void DropdownBarHost::AnimationProgressed(const Animation* animation) { +void DropdownBarHost::AnimationProgressed(const ui::Animation* animation) { // First, we calculate how many pixels to slide the widget. gfx::Size pref_size = view_->GetPreferredSize(); animation_offset_ = static_cast<int>((1.0 - animation_->GetCurrentValue()) * @@ -169,7 +169,7 @@ void DropdownBarHost::AnimationProgressed(const Animation* animation) { view_->SchedulePaint(); } -void DropdownBarHost::AnimationEnded(const Animation* animation) { +void DropdownBarHost::AnimationEnded(const ui::Animation* animation) { // Place the dropdown widget in its fully opened state. animation_offset_ = 0; diff --git a/chrome/browser/ui/views/dropdown_bar_host.h b/chrome/browser/ui/views/dropdown_bar_host.h index 65e4bdf..d9f1d7b 100644 --- a/chrome/browser/ui/views/dropdown_bar_host.h +++ b/chrome/browser/ui/views/dropdown_bar_host.h @@ -6,19 +6,22 @@ #define CHROME_BROWSER_UI_VIEWS_DROPDOWN_BAR_HOST_H_ #pragma once -#include "app/animation_delegate.h" #include "base/scoped_ptr.h" #include "chrome/common/native_web_keyboard_event.h" #include "gfx/native_widget_types.h" #include "gfx/rect.h" +#include "ui/base/animation/animation_delegate.h" #include "views/controls/textfield/textfield.h" #include "views/focus/focus_manager.h" class BrowserView; class DropdownBarView; -class SlideAnimation; class TabContents; +namespace ui { +class SlideAnimation; +} + namespace views { class ExternalFocusTracker; class View; @@ -37,7 +40,7 @@ class Widget; //////////////////////////////////////////////////////////////////////////////// class DropdownBarHost : public views::AcceleratorTarget, public views::FocusChangeListener, - public AnimationDelegate { + public ui::AnimationDelegate { public: explicit DropdownBarHost(BrowserView* browser_view); virtual ~DropdownBarHost(); @@ -74,9 +77,9 @@ class DropdownBarHost : public views::AcceleratorTarget, // Overridden from views::AcceleratorTarget: virtual bool AcceleratorPressed(const views::Accelerator& accelerator) = 0; - // AnimationDelegate implementation: - virtual void AnimationProgressed(const Animation* animation); - virtual void AnimationEnded(const Animation* animation); + // ui::AnimationDelegate implementation: + virtual void AnimationProgressed(const ui::Animation* animation); + virtual void AnimationEnded(const ui::Animation* animation); // During testing we can disable animations by setting this flag to true, // so that opening and closing the dropdown bar is shown instantly, instead of @@ -145,7 +148,7 @@ class DropdownBarHost : public views::AcceleratorTarget, const views::KeyEvent& key_event); // Returns the animation for the dropdown. - SlideAnimation* animation() { + ui::SlideAnimation* animation() { return animation_.get(); } @@ -161,7 +164,7 @@ class DropdownBarHost : public views::AcceleratorTarget, int animation_offset_; // The animation class to use when opening the Dropdown widget. - scoped_ptr<SlideAnimation> animation_; + scoped_ptr<ui::SlideAnimation> animation_; // The focus manager we register with to keep track of focus changes. views::FocusManager* focus_manager_; diff --git a/chrome/browser/ui/views/frame/contents_container.cc b/chrome/browser/ui/views/frame/contents_container.cc index ccf0abd..1c8abfd 100644 --- a/chrome/browser/ui/views/frame/contents_container.cc +++ b/chrome/browser/ui/views/frame/contents_container.cc @@ -4,9 +4,9 @@ #include "chrome/browser/views/frame/contents_container.h" -#include "app/slide_animation.h" #include "base/logging.h" #include "third_party/skia/include/core/SkColor.h" +#include "ui/base/animation/slide_animation.h" #include "views/background.h" #include "views/widget/root_view.h" #include "views/widget/widget.h" @@ -95,7 +95,7 @@ gfx::Rect ContentsContainer::GetPreviewBounds() { } void ContentsContainer::FadeActiveContents() { - if (active_overlay_ || !Animation::ShouldRenderRichAnimation()) + if (active_overlay_ || !ui::Animation::ShouldRenderRichAnimation()) return; #if !defined(OS_WIN) @@ -104,7 +104,7 @@ void ContentsContainer::FadeActiveContents() { return; #endif - overlay_animation_.reset(new SlideAnimation(this)); + overlay_animation_.reset(new ui::SlideAnimation(this)); overlay_animation_->SetDuration(300); overlay_animation_->SetSlideDuration(300); overlay_animation_->Show(); @@ -113,7 +113,7 @@ void ContentsContainer::FadeActiveContents() { } void ContentsContainer::ShowFade() { - if (active_overlay_ || !Animation::ShouldRenderRichAnimation()) + if (active_overlay_ || !ui::Animation::ShouldRenderRichAnimation()) return; CreateOverlay(kMaxOpacity); @@ -129,10 +129,10 @@ void ContentsContainer::RemoveFade() { } } -void ContentsContainer::AnimationProgressed(const Animation* animation) { +void ContentsContainer::AnimationProgressed(const ui::Animation* animation) { active_overlay_->SetOpacity( - Tween::ValueBetween(animation->GetCurrentValue(), kMinOpacity, - kMaxOpacity)); + ui::Tween::ValueBetween(animation->GetCurrentValue(), kMinOpacity, + kMaxOpacity)); active_overlay_->GetRootView()->SchedulePaint(); } diff --git a/chrome/browser/ui/views/frame/contents_container.h b/chrome/browser/ui/views/frame/contents_container.h index 0429b9f..2a2ef68 100644 --- a/chrome/browser/ui/views/frame/contents_container.h +++ b/chrome/browser/ui/views/frame/contents_container.h @@ -6,13 +6,16 @@ #define CHROME_BROWSER_UI_VIEWS_FRAME_CONTENTS_CONTAINER_H_ #pragma once -#include "app/animation_delegate.h" #include "base/scoped_ptr.h" +#include "ui/base/animation/animation_delegate.h" #include "views/view.h" -class SlideAnimation; class TabContents; +namespace ui { +class SlideAnimation; +} + namespace views { class Widget; } @@ -20,7 +23,7 @@ class Widget; // ContentsContainer is responsible for managing the TabContents views. // ContentsContainer has up to two children: one for the currently active // TabContents and one for instant's TabContents. -class ContentsContainer : public views::View, public AnimationDelegate { +class ContentsContainer : public views::View, public ui::AnimationDelegate { public: explicit ContentsContainer(views::View* active); virtual ~ContentsContainer(); @@ -54,8 +57,8 @@ class ContentsContainer : public views::View, public AnimationDelegate { // View overrides: virtual void Layout(); - // AnimationDelegate overrides: - virtual void AnimationProgressed(const Animation* animation); + // ui::AnimationDelegate overrides: + virtual void AnimationProgressed(const ui::Animation* animation); private: class OverlayContentView; @@ -80,7 +83,7 @@ class ContentsContainer : public views::View, public AnimationDelegate { OverlayContentView* overlay_view_; // Animation used to vary the opacity of active_overlay. - scoped_ptr<SlideAnimation> overlay_animation_; + scoped_ptr<ui::SlideAnimation> overlay_animation_; // The margin between the top and the active view. This is used to make the // preview overlap the bookmark bar on the new tab page. diff --git a/chrome/browser/ui/views/fullscreen_exit_bubble.cc b/chrome/browser/ui/views/fullscreen_exit_bubble.cc index 41bac15..e94ed66 100644 --- a/chrome/browser/ui/views/fullscreen_exit_bubble.cc +++ b/chrome/browser/ui/views/fullscreen_exit_bubble.cc @@ -7,11 +7,11 @@ #include "app/keyboard_codes.h" #include "app/l10n_util.h" #include "app/resource_bundle.h" -#include "app/slide_animation.h" #include "base/utf_string_conversions.h" #include "chrome/app/chrome_command_ids.h" #include "gfx/canvas_skia.h" #include "grit/generated_resources.h" +#include "ui/base/animation/slide_animation.h" #include "views/screen.h" #include "views/widget/root_view.h" #include "views/window/window.h" @@ -143,7 +143,7 @@ FullscreenExitBubble::FullscreenExitBubble( : root_view_(frame->GetRootView()), delegate_(delegate), popup_(NULL), - size_animation_(new SlideAnimation(this)) { + size_animation_(new ui::SlideAnimation(this)) { size_animation_->Reset(1); // Create the contents view. @@ -198,7 +198,7 @@ void FullscreenExitBubble::LinkActivated(views::Link* source, int event_flags) { } void FullscreenExitBubble::AnimationProgressed( - const Animation* animation) { + const ui::Animation* animation) { gfx::Rect popup_rect(GetPopupRect(false)); if (popup_rect.IsEmpty()) { popup_->Hide(); @@ -213,7 +213,7 @@ void FullscreenExitBubble::AnimationProgressed( } } void FullscreenExitBubble::AnimationEnded( - const Animation* animation) { + const ui::Animation* animation) { AnimationProgressed(animation); } diff --git a/chrome/browser/ui/views/fullscreen_exit_bubble.h b/chrome/browser/ui/views/fullscreen_exit_bubble.h index bb1c550..32c56bd 100644 --- a/chrome/browser/ui/views/fullscreen_exit_bubble.h +++ b/chrome/browser/ui/views/fullscreen_exit_bubble.h @@ -6,26 +6,28 @@ #define CHROME_BROWSER_UI_VIEWS_FULLSCREEN_EXIT_BUBBLE_H__ #pragma once -#include "app/animation_delegate.h" #include "base/scoped_ptr.h" #include "base/timer.h" #include "chrome/browser/command_updater.h" +#include "ui/base/animation/animation_delegate.h" #include "views/controls/link.h" +namespace ui { +class SlideAnimation; +} + #if defined(OS_LINUX) namespace views { class WidgetGtk; } #endif -class SlideAnimation; - // FullscreenExitBubble is responsible for showing a bubble atop the screen in // fullscreen mode, telling users how to exit and providing a click target. // The bubble auto-hides, and re-shows when the user moves to the screen top. class FullscreenExitBubble : public views::LinkController, - public AnimationDelegate { + public ui::AnimationDelegate { public: explicit FullscreenExitBubble( views::Widget* frame, @@ -48,9 +50,9 @@ class FullscreenExitBubble : public views::LinkController, // views::LinkController virtual void LinkActivated(views::Link* source, int event_flags); - // AnimationDelegate - virtual void AnimationProgressed(const Animation* animation); - virtual void AnimationEnded(const Animation* animation); + // ui::AnimationDelegate + virtual void AnimationProgressed(const ui::Animation* animation); + virtual void AnimationEnded(const ui::Animation* animation); // Called repeatedly to get the current mouse position and animate the bubble // on or off the screen as appropriate. @@ -84,7 +86,7 @@ class FullscreenExitBubble : public views::LinkController, FullscreenExitView* view_; // Animation controlling sliding into/out of the top of the screen. - scoped_ptr<SlideAnimation> size_animation_; + scoped_ptr<ui::SlideAnimation> size_animation_; // Timer to delay before allowing the bubble to hide after it's initially // shown. diff --git a/chrome/browser/ui/views/info_bubble.cc b/chrome/browser/ui/views/info_bubble.cc index cc9e574..8d07a57 100644 --- a/chrome/browser/ui/views/info_bubble.cc +++ b/chrome/browser/ui/views/info_bubble.cc @@ -7,13 +7,13 @@ #include <vector> #include "app/keyboard_codes.h" -#include "app/slide_animation.h" #include "chrome/browser/ui/window_sizer.h" #include "chrome/common/notification_service.h" #include "gfx/canvas_skia.h" #include "gfx/color_utils.h" #include "gfx/path.h" #include "third_party/skia/include/core/SkPaint.h" +#include "ui/base/animation/slide_animation.h" #include "views/fill_layout.h" #include "views/widget/root_view.h" #include "views/widget/widget.h" @@ -282,7 +282,7 @@ void InfoBubble::Close() { DoClose(false); } -void InfoBubble::AnimationEnded(const Animation* animation) { +void InfoBubble::AnimationEnded(const ui::Animation* animation) { if (static_cast<int>(animation_->GetCurrentValue()) == 0) { // When fading out we just need to close the bubble at the end DoClose(false); @@ -295,7 +295,7 @@ void InfoBubble::AnimationEnded(const Animation* animation) { } } -void InfoBubble::AnimationProgressed(const Animation* animation) { +void InfoBubble::AnimationProgressed(const ui::Animation* animation) { #if defined(OS_WIN) // Set the opacity for the main contents window. unsigned char opacity = static_cast<unsigned char>( @@ -545,9 +545,9 @@ void InfoBubble::FadeOut() { } void InfoBubble::Fade(bool fade_in) { - animation_.reset(new SlideAnimation(this)); + animation_.reset(new ui::SlideAnimation(this)); animation_->SetSlideDuration(kHideFadeDurationMS); - animation_->SetTweenType(Tween::LINEAR); + animation_->SetTweenType(ui::Tween::LINEAR); animation_->Reset(fade_in ? 0.0 : 1.0); if (fade_in) diff --git a/chrome/browser/ui/views/info_bubble.h b/chrome/browser/ui/views/info_bubble.h index d32b4b5..74fffb2 100644 --- a/chrome/browser/ui/views/info_bubble.h +++ b/chrome/browser/ui/views/info_bubble.h @@ -6,8 +6,8 @@ #define CHROME_BROWSER_UI_VIEWS_INFO_BUBBLE_H_ #pragma once -#include "app/animation_delegate.h" #include "third_party/skia/include/core/SkColor.h" +#include "ui/base/animation/animation_delegate.h" #include "views/accelerator.h" #include "views/view.h" #include "chrome/browser/views/bubble_border.h" @@ -27,20 +27,22 @@ // InfoBubble insets the contents for you, so the contents typically shouldn't // have any additional margins. +#if defined(OS_WIN) +class BorderWidget; +#endif class InfoBubble; -class SlideAnimation; - -namespace views { -class Widget; -} namespace gfx { class Path; } -#if defined(OS_WIN) -class BorderWidget; -#endif +namespace ui { +class SlideAnimation; +} + +namespace views { +class Widget; +} // This is used to paint the border of the InfoBubble. Windows uses this via // BorderWidget (see below), while others can use it directly in the bubble. @@ -182,7 +184,7 @@ class InfoBubble : public views::WidgetGtk, #endif public views::AcceleratorTarget, - public AnimationDelegate { + public ui::AnimationDelegate { public: // Shows the InfoBubble. |parent| is set as the parent window, |contents| are // the contents shown in the bubble, and |position_relative_to| is a rect in @@ -229,9 +231,9 @@ class InfoBubble // Overridden from WidgetWin: virtual void Close(); - // Overridden from AnimationDelegate: - virtual void AnimationEnded(const Animation* animation); - virtual void AnimationProgressed(const Animation* animation); + // Overridden from ui::AnimationDelegate: + virtual void AnimationEnded(const ui::Animation* animation); + virtual void AnimationProgressed(const ui::Animation* animation); static const SkColor kBackgroundColor; @@ -295,7 +297,7 @@ class InfoBubble InfoBubbleDelegate* delegate_; // The animation used to fade the bubble out. - scoped_ptr<SlideAnimation> animation_; + scoped_ptr<ui::SlideAnimation> animation_; // The current visibility status of the bubble. ShowStatus show_status_; diff --git a/chrome/browser/ui/views/infobars/extension_infobar.cc b/chrome/browser/ui/views/infobars/extension_infobar.cc index e2fb43f..9540b5d 100644 --- a/chrome/browser/ui/views/infobars/extension_infobar.cc +++ b/chrome/browser/ui/views/infobars/extension_infobar.cc @@ -5,7 +5,6 @@ #include "chrome/browser/views/infobars/extension_infobar.h" #include "app/resource_bundle.h" -#include "app/slide_animation.h" #include "chrome/browser/extensions/extension_context_menu_model.h" #include "chrome/browser/extensions/extension_infobar_delegate.h" #include "chrome/browser/extensions/extension_host.h" @@ -16,6 +15,7 @@ #include "chrome/common/extensions/extension_resource.h" #include "gfx/canvas_skia.h" #include "grit/theme_resources.h" +#include "ui/base/animation/slide_animation.h" #include "views/controls/button/menu_button.h" #include "views/controls/menu/menu_2.h" #include "views/widget/widget.h" diff --git a/chrome/browser/ui/views/infobars/infobars.cc b/chrome/browser/ui/views/infobars/infobars.cc index 4cda653..d1af02e 100644 --- a/chrome/browser/ui/views/infobars/infobars.cc +++ b/chrome/browser/ui/views/infobars/infobars.cc @@ -6,7 +6,6 @@ #include "app/l10n_util.h" #include "app/resource_bundle.h" -#include "app/slide_animation.h" #include "base/message_loop.h" #include "base/utf_string_conversions.h" #include "chrome/browser/views/event_utils.h" @@ -14,6 +13,7 @@ #include "gfx/canvas.h" #include "grit/generated_resources.h" #include "grit/theme_resources.h" +#include "ui/base/animation/slide_animation.h" #include "views/background.h" #include "views/controls/button/image_button.h" #include "views/controls/button/native_button.h" @@ -119,8 +119,8 @@ InfoBar::InfoBar(InfoBarDelegate* delegate) UTF16ToWide(l10n_util::GetStringUTF16(IDS_ACCNAME_CLOSE))); AddChildView(close_button_); - animation_.reset(new SlideAnimation(this)); - animation_->SetTweenType(Tween::LINEAR); + animation_.reset(new ui::SlideAnimation(this)); + animation_->SetTweenType(ui::Tween::LINEAR); } InfoBar::~InfoBar() { @@ -210,14 +210,14 @@ void InfoBar::FocusWillChange(View* focused_before, View* focused_now) { } } -// InfoBar, AnimationDelegate implementation: ---------------------------------- +// InfoBar, ui::AnimationDelegate implementation: ------------------------------ -void InfoBar::AnimationProgressed(const Animation* animation) { +void InfoBar::AnimationProgressed(const ui::Animation* animation) { if (container_) container_->InfoBarAnimated(true); } -void InfoBar::AnimationEnded(const Animation* animation) { +void InfoBar::AnimationEnded(const ui::Animation* animation) { if (container_) { container_->InfoBarAnimated(false); diff --git a/chrome/browser/ui/views/infobars/infobars.h b/chrome/browser/ui/views/infobars/infobars.h index 2e32ac6..b6fc879 100644 --- a/chrome/browser/ui/views/infobars/infobars.h +++ b/chrome/browser/ui/views/infobars/infobars.h @@ -6,15 +6,19 @@ #define CHROME_BROWSER_UI_VIEWS_INFOBARS_INFOBARS_H_ #pragma once -#include "app/animation_delegate.h" #include "base/task.h" #include "chrome/browser/tab_contents/infobar_delegate.h" +#include "ui/base/animation/animation_delegate.h" #include "views/controls/button/button.h" #include "views/controls/link.h" #include "views/focus/focus_manager.h" class InfoBarContainer; + +namespace ui { class SlideAnimation; +} + namespace views { class ExternalFocusTracker; class ImageButton; @@ -43,7 +47,7 @@ class InfoBarBackground : public views::Background { class InfoBar : public views::View, public views::ButtonListener, public views::FocusChangeListener, - public AnimationDelegate { + public ui::AnimationDelegate { public: explicit InfoBar(InfoBarDelegate* delegate); virtual ~InfoBar(); @@ -86,7 +90,7 @@ class InfoBar : public views::View, void set_target_height(double height) { target_height_ = height; } - SlideAnimation* animation() { return animation_.get(); } + ui::SlideAnimation* animation() { return animation_.get(); } // Returns a centered y-position of a control of height specified in // |prefsize| within the standard InfoBar height. Stable during an animation. @@ -104,9 +108,9 @@ class InfoBar : public views::View, // Overridden from views::FocusChangeListener: virtual void FocusWillChange(View* focused_before, View* focused_now); - // Overridden from AnimationDelegate: - virtual void AnimationProgressed(const Animation* animation); - virtual void AnimationEnded(const Animation* animation); + // Overridden from ui::AnimationDelegate: + virtual void AnimationProgressed(const ui::Animation* animation); + virtual void AnimationEnded(const ui::Animation* animation); private: friend class InfoBarContainer; @@ -150,7 +154,7 @@ class InfoBar : public views::View, views::ImageButton* close_button_; // The animation that runs when the InfoBar is opened or closed. - scoped_ptr<SlideAnimation> animation_; + scoped_ptr<ui::SlideAnimation> animation_; // Tracks and stores the last focused view which is not the InfoBar or any of // its children. Used to restore focus once the InfoBar is closed. diff --git a/chrome/browser/ui/views/infobars/translate_infobar_base.cc b/chrome/browser/ui/views/infobars/translate_infobar_base.cc index 4eb0bdd..fec6886 100644 --- a/chrome/browser/ui/views/infobars/translate_infobar_base.cc +++ b/chrome/browser/ui/views/infobars/translate_infobar_base.cc @@ -5,7 +5,6 @@ #include "chrome/browser/views/infobars/translate_infobar_base.h" #include "app/resource_bundle.h" -#include "app/slide_animation.h" #include "base/utf_string_conversions.h" #include "chrome/browser/translate/translate_infobar_delegate.h" #include "chrome/browser/views/infobars/after_translate_infobar.h" @@ -14,6 +13,7 @@ #include "chrome/browser/views/infobars/infobar_button_border.h" #include "gfx/canvas_skia.h" #include "grit/theme_resources.h" +#include "ui/base/animation/slide_animation.h" #include "views/controls/button/menu_button.h" #include "views/controls/image_view.h" @@ -31,8 +31,8 @@ TranslateInfoBarBase::TranslateInfoBarBase( TranslateInfoBarDelegate::BackgroundAnimationType animation = delegate->background_animation_type(); if (animation != TranslateInfoBarDelegate::NONE) { - background_color_animation_.reset(new SlideAnimation(this)); - background_color_animation_->SetTweenType(Tween::LINEAR); + background_color_animation_.reset(new ui::SlideAnimation(this)); + background_color_animation_->SetTweenType(ui::Tween::LINEAR); background_color_animation_->SetSlideDuration(500); if (animation == TranslateInfoBarDelegate::NORMAL_TO_ERROR) { background_color_animation_->Show(); @@ -81,7 +81,7 @@ void TranslateInfoBarBase::PaintBackground(gfx::Canvas* canvas) { error_background_); } -void TranslateInfoBarBase::AnimationProgressed(const Animation* animation) { +void TranslateInfoBarBase::AnimationProgressed(const ui::Animation* animation) { if (background_color_animation_.get() == animation) SchedulePaint(); // That'll trigger a PaintBackgroud. else diff --git a/chrome/browser/ui/views/infobars/translate_infobar_base.h b/chrome/browser/ui/views/infobars/translate_infobar_base.h index 2c5d091..3f49c01 100644 --- a/chrome/browser/ui/views/infobars/translate_infobar_base.h +++ b/chrome/browser/ui/views/infobars/translate_infobar_base.h @@ -33,8 +33,8 @@ class TranslateInfoBarBase : public TranslateInfoBarView, virtual void PaintBackground(gfx::Canvas* canvas); protected: - // Overridden from AnimationDelegate: - virtual void AnimationProgressed(const Animation* animation); + // Overridden from ui::AnimationDelegate: + virtual void AnimationProgressed(const ui::Animation* animation); // Creates a label with the appropriate font and color for the translate // infobars. @@ -57,7 +57,7 @@ class TranslateInfoBarBase : public TranslateInfoBarView, InfoBarBackground normal_background_; InfoBarBackground error_background_; - scoped_ptr<SlideAnimation> background_color_animation_; + scoped_ptr<ui::SlideAnimation> background_color_animation_; private: // Returns the background that should be displayed when not animating. diff --git a/chrome/browser/ui/views/location_bar/content_setting_image_view.cc b/chrome/browser/ui/views/location_bar/content_setting_image_view.cc index a1bf8ee..bbc0d76 100644 --- a/chrome/browser/ui/views/location_bar/content_setting_image_view.cc +++ b/chrome/browser/ui/views/location_bar/content_setting_image_view.cc @@ -48,7 +48,7 @@ ContentSettingImageView::ContentSettingImageView( ContentSettingsType content_type, LocationBarView* parent, Profile* profile) - : LinearAnimation(kMoveTimeMs, kFrameRateHz, NULL), + : ui::LinearAnimation(kMoveTimeMs, kFrameRateHz, NULL), content_setting_image_model_( ContentSettingImageModel::CreateContentSettingImageModel( content_type)), diff --git a/chrome/browser/ui/views/location_bar/content_setting_image_view.h b/chrome/browser/ui/views/location_bar/content_setting_image_view.h index fd112da..3281a38 100644 --- a/chrome/browser/ui/views/location_bar/content_setting_image_view.h +++ b/chrome/browser/ui/views/location_bar/content_setting_image_view.h @@ -6,11 +6,11 @@ #define CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_CONTENT_SETTING_IMAGE_VIEW_H_ #pragma once -#include "app/linear_animation.h" #include "base/scoped_ptr.h" #include "base/string16.h" #include "chrome/browser/views/info_bubble.h" #include "chrome/common/content_settings_types.h" +#include "ui/base/animation/linear_animation.h" #include "views/controls/image_view.h" class ContentSettingImageModel; @@ -25,7 +25,7 @@ class MouseEvent; class ContentSettingImageView : public views::ImageView, public InfoBubbleDelegate, - public LinearAnimation { + public ui::LinearAnimation { public: ContentSettingImageView(ContentSettingsType content_type, LocationBarView* parent, @@ -54,7 +54,7 @@ class ContentSettingImageView : public views::ImageView, virtual bool CloseOnEscape(); virtual bool FadeInOnShow() { return false; } - // LinearAnimation override: + // ui::LinearAnimation override: virtual void AnimateToState(double state); scoped_ptr<ContentSettingImageModel> content_setting_image_model_; diff --git a/chrome/browser/ui/views/location_bar/suggested_text_view.cc b/chrome/browser/ui/views/location_bar/suggested_text_view.cc index 4c0d208..6da1a7b8 100644 --- a/chrome/browser/ui/views/location_bar/suggested_text_view.cc +++ b/chrome/browser/ui/views/location_bar/suggested_text_view.cc @@ -4,11 +4,11 @@ #include "chrome/browser/ui/views/location_bar/suggested_text_view.h" -#include "app/multi_animation.h" #include "chrome/browser/instant/instant_controller.h" #include "chrome/browser/ui/views/location_bar/location_bar_view.h" #include "gfx/canvas.h" #include "gfx/color_utils.h" +#include "ui/base/animation/multi_animation.h" SuggestedTextView::SuggestedTextView(LocationBarView* location_bar) : location_bar_(location_bar), @@ -49,11 +49,11 @@ void SuggestedTextView::PaintBackground(gfx::Canvas* canvas) { canvas->FillRectInt(bg_color_, 0, 2, width(), height() - 5); } -void SuggestedTextView::AnimationEnded(const Animation* animation) { +void SuggestedTextView::AnimationEnded(const ui::Animation* animation) { location_bar_->OnCommitSuggestedText(); } -void SuggestedTextView::AnimationProgressed(const Animation* animation) { +void SuggestedTextView::AnimationProgressed(const ui::Animation* animation) { UpdateBackgroundColor(); SkColor fg_color = LocationBarView::GetColor( @@ -62,21 +62,21 @@ void SuggestedTextView::AnimationProgressed(const Animation* animation) { ToolbarModel::NONE, LocationBarView::SELECTED_TEXT); SetColor(color_utils::AlphaBlend( sel_fg_color, fg_color, - Tween::ValueBetween(animation->GetCurrentValue(), 0, 255))); + ui::Tween::ValueBetween(animation->GetCurrentValue(), 0, 255))); SchedulePaint(); } -void SuggestedTextView::AnimationCanceled(const Animation* animation) { +void SuggestedTextView::AnimationCanceled(const ui::Animation* animation) { } -Animation* SuggestedTextView::CreateAnimation() { - MultiAnimation::Parts parts; - parts.push_back(MultiAnimation::Part( - InstantController::kAutoCommitPauseTimeMS, Tween::ZERO)); - parts.push_back(MultiAnimation::Part( - InstantController::kAutoCommitFadeInTimeMS, Tween::EASE_IN)); - MultiAnimation* animation = new MultiAnimation(parts); +ui::Animation* SuggestedTextView::CreateAnimation() { + ui::MultiAnimation::Parts parts; + parts.push_back(ui::MultiAnimation::Part( + InstantController::kAutoCommitPauseTimeMS, ui::Tween::ZERO)); + parts.push_back(ui::MultiAnimation::Part( + InstantController::kAutoCommitFadeInTimeMS, ui::Tween::EASE_IN)); + ui::MultiAnimation* animation = new ui::MultiAnimation(parts); animation->set_delegate(this); animation->set_continuous(false); return animation; @@ -99,5 +99,5 @@ void SuggestedTextView::UpdateBackgroundColor() { SkColor s_color = SK_ColorLTGRAY; #endif bg_color_ = color_utils::AlphaBlend(s_color, bg_color, - Tween::ValueBetween(value, 0, 255)); + ui::Tween::ValueBetween(value, 0, 255)); } diff --git a/chrome/browser/ui/views/location_bar/suggested_text_view.h b/chrome/browser/ui/views/location_bar/suggested_text_view.h index 688346f..893901a 100644 --- a/chrome/browser/ui/views/location_bar/suggested_text_view.h +++ b/chrome/browser/ui/views/location_bar/suggested_text_view.h @@ -6,7 +6,7 @@ #define CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_SUGGESTED_TEXT_VIEW_H_ #pragma once -#include "app/animation_delegate.h" +#include "ui/base/animation/animation_delegate.h" #include "views/controls/label.h" class LocationBarView; @@ -15,7 +15,7 @@ class LocationBarView; // Invoke |StartAnimation| to start an animation that when done invokes // |OnCommitSuggestedText| on the LocationBar to commit the suggested text. class SuggestedTextView : public views::Label, - public AnimationDelegate { + public ui::AnimationDelegate { public: explicit SuggestedTextView(LocationBarView* location_bar); virtual ~SuggestedTextView(); @@ -33,20 +33,20 @@ class SuggestedTextView : public views::Label, virtual void PaintBackground(gfx::Canvas* canvas); // AnimationDelegate overrides: - virtual void AnimationEnded(const Animation* animation); - virtual void AnimationProgressed(const Animation* animation); - virtual void AnimationCanceled(const Animation* animation); + virtual void AnimationEnded(const ui::Animation* animation); + virtual void AnimationProgressed(const ui::Animation* animation); + virtual void AnimationCanceled(const ui::Animation* animation); private: // Creates the animation to use. - Animation* CreateAnimation(); + ui::Animation* CreateAnimation(); // Resets the background color. void UpdateBackgroundColor(); LocationBarView* location_bar_; - scoped_ptr<Animation> animation_; + scoped_ptr<ui::Animation> animation_; SkColor bg_color_; diff --git a/chrome/browser/ui/views/notifications/balloon_view.cc b/chrome/browser/ui/views/notifications/balloon_view.cc index 1a9fced..43ed162 100644 --- a/chrome/browser/ui/views/notifications/balloon_view.cc +++ b/chrome/browser/ui/views/notifications/balloon_view.cc @@ -8,7 +8,6 @@ #include "app/l10n_util.h" #include "app/resource_bundle.h" -#include "app/slide_animation.h" #include "base/message_loop.h" #include "base/utf_string_conversions.h" #include "chrome/browser/notifications/balloon.h" @@ -29,6 +28,7 @@ #include "gfx/native_widget_types.h" #include "grit/generated_resources.h" #include "grit/theme_resources.h" +#include "ui/base/animation/slide_animation.h" #include "views/controls/button/button.h" #include "views/controls/button/image_button.h" #include "views/controls/button/text_button.h" @@ -213,7 +213,7 @@ void BalloonViewImpl::RepositionToBalloon() { balloon_->GetPosition().x(), balloon_->GetPosition().y(), GetTotalWidth(), GetTotalHeight()); frame_container_->GetBounds(&anim_frame_start_, false); - animation_.reset(new SlideAnimation(this)); + animation_.reset(new ui::SlideAnimation(this)); animation_->Show(); } @@ -224,7 +224,7 @@ void BalloonViewImpl::Update() { balloon_->notification().content_url()); } -void BalloonViewImpl::AnimationProgressed(const Animation* animation) { +void BalloonViewImpl::AnimationProgressed(const ui::Animation* animation) { DCHECK(animation == animation_.get()); // Linear interpolation from start to end position. diff --git a/chrome/browser/ui/views/notifications/balloon_view.h b/chrome/browser/ui/views/notifications/balloon_view.h index c069a0a..a551f5a 100644 --- a/chrome/browser/ui/views/notifications/balloon_view.h +++ b/chrome/browser/ui/views/notifications/balloon_view.h @@ -8,7 +8,6 @@ #define CHROME_BROWSER_UI_VIEWS_NOTIFICATIONS_BALLOON_VIEW_H_ #pragma once -#include "app/animation_delegate.h" #include "base/basictypes.h" #include "base/scoped_ptr.h" #include "base/task.h" @@ -19,6 +18,7 @@ #include "gfx/point.h" #include "gfx/rect.h" #include "gfx/size.h" +#include "ui/base/animation/animation_delegate.h" #include "views/controls/button/menu_button.h" #include "views/controls/label.h" #include "views/controls/menu/view_menu_delegate.h" @@ -38,7 +38,10 @@ class BalloonCollection; class NotificationDetails; class NotificationOptionsMenuModel; class NotificationSource; + +namespace ui { class SlideAnimation; +} // A balloon view is the UI component for a desktop notification toasts. // It draws a border, and within the border an HTML renderer. @@ -48,7 +51,7 @@ class BalloonViewImpl : public BalloonView, public views::WidgetDelegate, public views::ButtonListener, public NotificationObserver, - public AnimationDelegate { + public ui::AnimationDelegate { public: explicit BalloonViewImpl(BalloonCollection* collection); ~BalloonViewImpl(); @@ -83,8 +86,8 @@ class BalloonViewImpl : public BalloonView, const NotificationSource& source, const NotificationDetails& details); - // AnimationDelegate interface. - virtual void AnimationProgressed(const Animation* animation); + // ui::AnimationDelegate interface. + virtual void AnimationProgressed(const ui::Animation* animation); // Launches the options menu at screen coordinates |pt|. void RunOptionsMenu(const gfx::Point& pt); @@ -152,7 +155,7 @@ class BalloonViewImpl : public BalloonView, views::Label* source_label_; // An animation to move the balloon on the screen as its position changes. - scoped_ptr<SlideAnimation> animation_; + scoped_ptr<ui::SlideAnimation> animation_; gfx::Rect anim_frame_start_; gfx::Rect anim_frame_end_; diff --git a/chrome/browser/ui/views/page_info_bubble_view.cc b/chrome/browser/ui/views/page_info_bubble_view.cc index 5c27cd4..d872399 100644 --- a/chrome/browser/ui/views/page_info_bubble_view.cc +++ b/chrome/browser/ui/views/page_info_bubble_view.cc @@ -213,11 +213,11 @@ void PageInfoBubbleView::LinkActivated(views::Link* source, int event_flags) { browser->OpenURL(url, GURL(), NEW_FOREGROUND_TAB, PageTransition::LINK); } -void PageInfoBubbleView::AnimationEnded(const Animation* animation) { +void PageInfoBubbleView::AnimationEnded(const ui::Animation* animation) { info_bubble_->SizeToContents(); } -void PageInfoBubbleView::AnimationProgressed(const Animation* animation) { +void PageInfoBubbleView::AnimationProgressed(const ui::Animation* animation) { info_bubble_->SizeToContents(); } diff --git a/chrome/browser/ui/views/page_info_bubble_view.h b/chrome/browser/ui/views/page_info_bubble_view.h index f0df41ff..fc2917b 100644 --- a/chrome/browser/ui/views/page_info_bubble_view.h +++ b/chrome/browser/ui/views/page_info_bubble_view.h @@ -6,10 +6,10 @@ #define CHROME_BROWSER_UI_VIEWS_PAGE_INFO_BUBBLE_VIEW_H_ #pragma once -#include "app/animation_delegate.h" -#include "app/slide_animation.h" #include "chrome/browser/page_info_model.h" #include "chrome/browser/views/info_bubble.h" +#include "ui/base/animation/animation_delegate.h" +#include "ui/base/animation/slide_animation.h" #include "views/controls/link.h" #include "views/view.h" @@ -21,7 +21,7 @@ class PageInfoBubbleView : public views::View, public PageInfoModel::PageInfoModelObserver, public InfoBubbleDelegate, public views::LinkController, - public AnimationDelegate { + public ui::AnimationDelegate { public: PageInfoBubbleView(gfx::NativeWindow parent_window, Profile* profile, @@ -51,9 +51,9 @@ class PageInfoBubbleView : public views::View, // LinkController methods: virtual void LinkActivated(views::Link* source, int event_flags); - // Overridden from AnimationDelegate. - virtual void AnimationEnded(const Animation* animation); - virtual void AnimationProgressed(const Animation* animation); + // Overridden from ui::AnimationDelegate. + virtual void AnimationEnded(const ui::Animation* animation); + virtual void AnimationProgressed(const ui::Animation* animation); private: // Layout the sections within the bubble. @@ -74,7 +74,7 @@ class PageInfoBubbleView : public views::View, views::Link* help_center_link_; // Animation that helps us change size smoothly as more data comes in. - SlideAnimation resize_animation_; + ui::SlideAnimation resize_animation_; // The height of the info bubble at the start of the resize animation. int animation_start_height_; diff --git a/chrome/browser/ui/views/status_bubble_views.cc b/chrome/browser/ui/views/status_bubble_views.cc index b4abc31..a684464 100644 --- a/chrome/browser/ui/views/status_bubble_views.cc +++ b/chrome/browser/ui/views/status_bubble_views.cc @@ -6,8 +6,6 @@ #include <algorithm> -#include "app/animation_delegate.h" -#include "app/linear_animation.h" #include "app/resource_bundle.h" #include "app/text_elider.h" #include "base/i18n/rtl.h" @@ -24,6 +22,8 @@ #include "third_party/skia/include/core/SkPaint.h" #include "third_party/skia/include/core/SkPath.h" #include "third_party/skia/include/core/SkRect.h" +#include "ui/base/animation/animation_delegate.h" +#include "ui/base/animation/linear_animation.h" #include "views/controls/label.h" #include "views/controls/scrollbar/native_scroll_bar.h" #include "views/screen.h" @@ -69,12 +69,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 LinearAnimation, - public AnimationDelegate { + public ui::LinearAnimation, + public ui::AnimationDelegate { public: StatusView(StatusBubble* status_bubble, views::Widget* popup, ThemeProvider* theme_provider) - : ALLOW_THIS_IN_INITIALIZER_LIST(LinearAnimation(kFramerate, this)), + : ALLOW_THIS_IN_INITIALIZER_LIST(ui::LinearAnimation(kFramerate, this)), stage_(BUBBLE_HIDDEN), style_(STYLE_STANDARD), ALLOW_THIS_IN_INITIALIZER_LIST(timer_factory_(this)), @@ -304,7 +304,7 @@ void StatusBubbleViews::StatusView::StartShowing() { // Animation functions. double StatusBubbleViews::StatusView::GetCurrentOpacity() { return opacity_start_ + (opacity_end_ - opacity_start_) * - LinearAnimation::GetCurrentValue(); + ui::LinearAnimation::GetCurrentValue(); } void StatusBubbleViews::StatusView::SetOpacity(double opacity) { @@ -317,7 +317,7 @@ void StatusBubbleViews::StatusView::AnimateToState(double state) { } void StatusBubbleViews::StatusView::AnimationEnded( - const Animation* animation) { + const ui::Animation* animation) { SetOpacity(opacity_end_); if (stage_ == BUBBLE_HIDING_FADE) { @@ -460,12 +460,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 LinearAnimation, - public AnimationDelegate { +class StatusBubbleViews::StatusViewExpander : public ui::LinearAnimation, + public ui::AnimationDelegate { public: StatusViewExpander(StatusBubbleViews* status_bubble, StatusView* status_view) - : ALLOW_THIS_IN_INITIALIZER_LIST(LinearAnimation(kFramerate, this)), + : ALLOW_THIS_IN_INITIALIZER_LIST(ui::LinearAnimation(kFramerate, this)), status_bubble_(status_bubble), status_view_(status_view), expansion_start_(0), @@ -484,7 +484,7 @@ class StatusBubbleViews::StatusViewExpander : public LinearAnimation, int GetCurrentBubbleWidth(); void SetBubbleWidth(int width); void AnimateToState(double state); - void AnimationEnded(const Animation* animation); + void AnimationEnded(const ui::Animation* animation); // Manager that owns us. StatusBubbleViews* status_bubble_; @@ -505,7 +505,7 @@ void StatusBubbleViews::StatusViewExpander::AnimateToState(double state) { } void StatusBubbleViews::StatusViewExpander::AnimationEnded( - const Animation* animation) { + const ui::Animation* animation) { SetBubbleWidth(expansion_end_); status_view_->SetText(expanded_text_, false); } @@ -525,7 +525,8 @@ void StatusBubbleViews::StatusViewExpander::StartExpansion( int StatusBubbleViews::StatusViewExpander::GetCurrentBubbleWidth() { return static_cast<int>(expansion_start_ + - (expansion_end_ - expansion_start_) * LinearAnimation::GetCurrentValue()); + (expansion_end_ - expansion_start_) * + ui::LinearAnimation::GetCurrentValue()); } void StatusBubbleViews::StatusViewExpander::SetBubbleWidth(int width) { diff --git a/chrome/browser/ui/views/tabs/base_tab.cc b/chrome/browser/ui/views/tabs/base_tab.cc index 52801bd..0a60a11 100644 --- a/chrome/browser/ui/views/tabs/base_tab.cc +++ b/chrome/browser/ui/views/tabs/base_tab.cc @@ -8,9 +8,7 @@ #include "app/l10n_util.h" #include "app/resource_bundle.h" -#include "app/slide_animation.h" #include "app/theme_provider.h" -#include "app/throb_animation.h" #include "base/command_line.h" #include "base/utf_string_conversions.h" #include "chrome/browser/tab_contents/tab_contents.h" @@ -24,6 +22,8 @@ #include "grit/app_resources.h" #include "grit/generated_resources.h" #include "grit/theme_resources.h" +#include "ui/base/animation/slide_animation.h" +#include "ui/base/animation/throb_animation.h" #include "views/controls/button/image_button.h" // How long the pulse throb takes. @@ -81,16 +81,16 @@ int BaseTab::font_height_ = 0; // FaviconCrashAnimation // // A custom animation subclass to manage the favicon crash animation. -class BaseTab::FavIconCrashAnimation : public LinearAnimation, - public AnimationDelegate { +class BaseTab::FavIconCrashAnimation : public ui::LinearAnimation, + public ui::AnimationDelegate { public: explicit FavIconCrashAnimation(BaseTab* target) - : ALLOW_THIS_IN_INITIALIZER_LIST(LinearAnimation(1000, 25, this)), + : ALLOW_THIS_IN_INITIALIZER_LIST(ui::LinearAnimation(1000, 25, this)), target_(target) { } virtual ~FavIconCrashAnimation() {} - // Animation overrides: + // ui::Animation overrides: virtual void AnimateToState(double state) { const double kHidingOffset = 27; @@ -105,8 +105,8 @@ class BaseTab::FavIconCrashAnimation : public LinearAnimation, } } - // AnimationDelegate overrides: - virtual void AnimationCanceled(const Animation* animation) { + // ui::AnimationDelegate overrides: + virtual void AnimationCanceled(const ui::Animation* animation) { target_->SetFavIconHidingOffset(0); } @@ -197,7 +197,7 @@ void BaseTab::UpdateLoadingAnimation(TabRendererData::NetworkState state) { void BaseTab::StartPulse() { if (!pulse_animation_.get()) { - pulse_animation_.reset(new ThrobAnimation(this)); + pulse_animation_.reset(new ui::ThrobAnimation(this)); pulse_animation_->SetSlideDuration(kPulseDurationMs); if (animation_container_.get()) pulse_animation_->SetContainer(animation_container_.get()); @@ -224,16 +224,16 @@ bool BaseTab::IsCloseable() const { void BaseTab::OnMouseEntered(const views::MouseEvent& e) { if (!hover_animation_.get()) { - hover_animation_.reset(new SlideAnimation(this)); + hover_animation_.reset(new ui::SlideAnimation(this)); hover_animation_->SetContainer(animation_container_.get()); hover_animation_->SetSlideDuration(kHoverDurationMs); } - hover_animation_->SetTweenType(Tween::EASE_OUT); + hover_animation_->SetTweenType(ui::Tween::EASE_OUT); hover_animation_->Show(); } void BaseTab::OnMouseExited(const views::MouseEvent& e) { - hover_animation_->SetTweenType(Tween::EASE_IN); + hover_animation_->SetTweenType(ui::Tween::EASE_IN); hover_animation_->Hide(); } @@ -411,15 +411,15 @@ void BaseTab::PaintTitle(gfx::Canvas* canvas, SkColor title_color) { title_bounds().width(), title_bounds().height()); } -void BaseTab::AnimationProgressed(const Animation* animation) { +void BaseTab::AnimationProgressed(const ui::Animation* animation) { SchedulePaint(); } -void BaseTab::AnimationCanceled(const Animation* animation) { +void BaseTab::AnimationCanceled(const ui::Animation* animation) { SchedulePaint(); } -void BaseTab::AnimationEnded(const Animation* animation) { +void BaseTab::AnimationEnded(const ui::Animation* animation) { SchedulePaint(); } diff --git a/chrome/browser/ui/views/tabs/base_tab.h b/chrome/browser/ui/views/tabs/base_tab.h index 8f47c51..1a98bdc 100644 --- a/chrome/browser/ui/views/tabs/base_tab.h +++ b/chrome/browser/ui/views/tabs/base_tab.h @@ -6,30 +6,33 @@ #define CHROME_BROWSER_UI_VIEWS_TABS_BASE_TAB_H_ #pragma once -#include "app/animation_container.h" -#include "app/animation_delegate.h" #include "base/ref_counted.h" #include "base/scoped_ptr.h" #include "chrome/browser/views/tabs/tab_renderer_data.h" +#include "ui/base/animation/animation_container.h" +#include "ui/base/animation/animation_delegate.h" #include "views/controls/button/button.h" #include "views/view.h" -class AnimationContainer; class BaseTab; -class SlideAnimation; class TabController; -class ThrobAnimation; namespace gfx { class Font; -} // namespace gfx +} + +namespace ui { +class AnimationContainer; +class SlideAnimation; +class ThrobAnimation; +} namespace views { class ImageButton; -} // namespace views +} // Base class for tab renderers. -class BaseTab : public AnimationDelegate, +class BaseTab : public ui::AnimationDelegate, public views::ButtonListener, public views::ContextMenuController, public views::View { @@ -59,10 +62,10 @@ class BaseTab : public AnimationDelegate, bool dragging() const { return dragging_; } // Sets the container all animations run from. - void set_animation_container(AnimationContainer* container) { + void set_animation_container(ui::AnimationContainer* container) { animation_container_ = container; } - AnimationContainer* animation_container() const { + ui::AnimationContainer* animation_container() const { return animation_container_.get(); } @@ -102,10 +105,10 @@ class BaseTab : public AnimationDelegate, // Returns the pulse animation. The pulse animation is non-null if StartPulse // has been invoked. - ThrobAnimation* pulse_animation() const { return pulse_animation_.get(); } + ui::ThrobAnimation* pulse_animation() const { return pulse_animation_.get(); } // Returns the hover animation. This may return null. - const SlideAnimation* hover_animation() const { + const ui::SlideAnimation* hover_animation() const { return hover_animation_.get(); } @@ -116,9 +119,9 @@ class BaseTab : public AnimationDelegate, void PaintTitle(gfx::Canvas* canvas, SkColor title_color); // Overridden from AnimationDelegate: - virtual void AnimationProgressed(const Animation* animation); - virtual void AnimationCanceled(const Animation* animation); - virtual void AnimationEnded(const Animation* animation); + virtual void AnimationProgressed(const ui::Animation* animation); + virtual void AnimationCanceled(const ui::Animation* animation); + virtual void AnimationEnded(const ui::Animation* animation); // views::ButtonListener overrides: virtual void ButtonPressed(views::Button* sender, @@ -168,15 +171,15 @@ class BaseTab : public AnimationDelegate, bool dragging_; // Pulse animation. - scoped_ptr<ThrobAnimation> pulse_animation_; + scoped_ptr<ui::ThrobAnimation> pulse_animation_; // Hover animation. - scoped_ptr<SlideAnimation> hover_animation_; + scoped_ptr<ui::SlideAnimation> hover_animation_; // Crash animation. scoped_ptr<FavIconCrashAnimation> crash_animation_; - scoped_refptr<AnimationContainer> animation_container_; + scoped_refptr<ui::AnimationContainer> animation_container_; views::ImageButton* close_button_; diff --git a/chrome/browser/ui/views/tabs/base_tab_strip.cc b/chrome/browser/ui/views/tabs/base_tab_strip.cc index a013d68..8a467d9 100644 --- a/chrome/browser/ui/views/tabs/base_tab_strip.cc +++ b/chrome/browser/ui/views/tabs/base_tab_strip.cc @@ -25,11 +25,11 @@ class ResetDraggingStateDelegate explicit ResetDraggingStateDelegate(BaseTab* tab) : tab_(tab) { } - virtual void AnimationEnded(const Animation* animation) { + virtual void AnimationEnded(const ui::Animation* animation) { tab_->set_dragging(false); } - virtual void AnimationCanceled(const Animation* animation) { + virtual void AnimationCanceled(const ui::Animation* animation) { tab_->set_dragging(false); } @@ -51,11 +51,11 @@ class BaseTabStrip::RemoveTabDelegate tab_(tab) { } - virtual void AnimationEnded(const Animation* animation) { + virtual void AnimationEnded(const ui::Animation* animation) { CompleteRemove(); } - virtual void AnimationCanceled(const Animation* animation) { + virtual void AnimationCanceled(const ui::Animation* animation) { // We can be canceled for two interesting reasons: // . The tab we reference was dragged back into the tab strip. In this case // we don't want to remove the tab (closing is false). @@ -463,7 +463,7 @@ void BaseTabStrip::PrepareForAnimation() { } } -AnimationDelegate* BaseTabStrip::CreateRemoveTabDelegate(BaseTab* tab) { +ui::AnimationDelegate* BaseTabStrip::CreateRemoveTabDelegate(BaseTab* tab) { return new RemoveTabDelegate(this, tab); } diff --git a/chrome/browser/ui/views/tabs/base_tab_strip.h b/chrome/browser/ui/views/tabs/base_tab_strip.h index 491f991..98b304e 100644 --- a/chrome/browser/ui/views/tabs/base_tab_strip.h +++ b/chrome/browser/ui/views/tabs/base_tab_strip.h @@ -224,7 +224,7 @@ class BaseTabStrip : public views::View, // Creates an AnimationDelegate that resets state after a remove animation // completes. The caller owns the returned object. - AnimationDelegate* CreateRemoveTabDelegate(BaseTab* tab); + ui::AnimationDelegate* CreateRemoveTabDelegate(BaseTab* tab); // Invoked from Layout if the size changes or layout is really needed. virtual void DoLayout(); diff --git a/chrome/browser/ui/views/tabs/dragged_tab_controller.cc b/chrome/browser/ui/views/tabs/dragged_tab_controller.cc index e09065e..e23e1c4 100644 --- a/chrome/browser/ui/views/tabs/dragged_tab_controller.cc +++ b/chrome/browser/ui/views/tabs/dragged_tab_controller.cc @@ -7,9 +7,6 @@ #include <math.h> #include <set> -#include "app/animation.h" -#include "app/animation_delegate.h" -#include "app/slide_animation.h" #include "app/resource_bundle.h" #include "base/callback.h" #include "base/i18n/rtl.h" @@ -33,6 +30,9 @@ #include "gfx/canvas_skia.h" #include "grit/theme_resources.h" #include "third_party/skia/include/core/SkBitmap.h" +#include "ui/base/animation/animation.h" +#include "ui/base/animation/animation_delegate.h" +#include "ui/base/animation/slide_animation.h" #include "views/event.h" #include "views/widget/root_view.h" #include "views/widget/widget.h" @@ -199,7 +199,7 @@ int MajorAxisValue(const gfx::Point& point, BaseTabStrip* tabstrip) { // possible dock position (as represented by DockInfo). DockDisplayer shows // a window with a DockView in it. Two animations are used that correspond to // the state of DockInfo::in_enable_area. -class DraggedTabController::DockDisplayer : public AnimationDelegate { +class DraggedTabController::DockDisplayer : public ui::AnimationDelegate { public: DockDisplayer(DraggedTabController* controller, const DockInfo& info) @@ -265,11 +265,11 @@ class DraggedTabController::DockDisplayer : public AnimationDelegate { animation_.Hide(); } - virtual void AnimationProgressed(const Animation* animation) { + virtual void AnimationProgressed(const ui::Animation* animation) { UpdateLayeredAlpha(); } - virtual void AnimationEnded(const Animation* animation) { + virtual void AnimationEnded(const ui::Animation* animation) { if (!hidden_) return; #if defined(OS_WIN) @@ -303,7 +303,7 @@ class DraggedTabController::DockDisplayer : public AnimationDelegate { gfx::NativeView popup_view_; // Animation for when first made visible. - SlideAnimation animation_; + ui::SlideAnimation animation_; // Have we been hidden? bool hidden_; diff --git a/chrome/browser/ui/views/tabs/tab.cc b/chrome/browser/ui/views/tabs/tab.cc index 42c82c1..98e19cc 100644 --- a/chrome/browser/ui/views/tabs/tab.cc +++ b/chrome/browser/ui/views/tabs/tab.cc @@ -6,10 +6,7 @@ #include <limits> -#include "app/multi_animation.h" #include "app/resource_bundle.h" -#include "app/slide_animation.h" -#include "app/throb_animation.h" #include "base/utf_string_conversions.h" #include "chrome/browser/defaults.h" #include "chrome/browser/themes/browser_theme_provider.h" @@ -22,6 +19,9 @@ #include "grit/generated_resources.h" #include "grit/theme_resources.h" #include "third_party/skia/include/effects/SkGradientShader.h" +#include "ui/base/animation/multi_animation.h" +#include "ui/base/animation/slide_animation.h" +#include "ui/base/animation/throb_animation.h" #include "views/controls/button/image_button.h" #include "views/widget/tooltip_manager.h" #include "views/widget/widget.h" @@ -114,18 +114,21 @@ Tab::~Tab() { void Tab::StartMiniTabTitleAnimation() { if (!mini_title_animation_.get()) { - MultiAnimation::Parts parts; - parts.push_back(MultiAnimation::Part(kMiniTitleChangeAnimationDuration1MS, - Tween::EASE_OUT)); - parts.push_back(MultiAnimation::Part(kMiniTitleChangeAnimationDuration2MS, - Tween::ZERO)); - parts.push_back(MultiAnimation::Part(kMiniTitleChangeAnimationDuration3MS, - Tween::EASE_IN)); + ui::MultiAnimation::Parts parts; + parts.push_back( + ui::MultiAnimation::Part(kMiniTitleChangeAnimationDuration1MS, + ui::Tween::EASE_OUT)); + parts.push_back( + ui::MultiAnimation::Part(kMiniTitleChangeAnimationDuration2MS, + ui::Tween::ZERO)); + parts.push_back( + ui::MultiAnimation::Part(kMiniTitleChangeAnimationDuration3MS, + ui::Tween::EASE_IN)); parts[0].start_time_ms = kMiniTitleChangeAnimationStart1MS; parts[0].end_time_ms = kMiniTitleChangeAnimationEnd1MS; parts[2].start_time_ms = kMiniTitleChangeAnimationStart3MS; parts[2].end_time_ms = kMiniTitleChangeAnimationEnd3MS; - mini_title_animation_.reset(new MultiAnimation(parts)); + mini_title_animation_.reset(new ui::MultiAnimation(parts)); mini_title_animation_->SetContainer(animation_container()); mini_title_animation_->set_delegate(this); } @@ -588,7 +591,7 @@ SkBitmap Tab::DrawHoverGlowBitmap(int width_input, int height_input) { SkPoint loc = { SkIntToScalar(hover_point_.x()), SkIntToScalar(hover_point_.y()) }; SkColor colors[2]; - const SlideAnimation* hover_slide = hover_animation(); + const ui::SlideAnimation* hover_slide = hover_animation(); int hover_alpha = 0; if (hover_slide) { hover_alpha = diff --git a/chrome/browser/ui/views/tabs/tab.h b/chrome/browser/ui/views/tabs/tab.h index a3da1c5..743f818 100644 --- a/chrome/browser/ui/views/tabs/tab.h +++ b/chrome/browser/ui/views/tabs/tab.h @@ -12,8 +12,10 @@ #include "chrome/browser/views/tabs/base_tab.h" #include "gfx/point.h" +namespace ui { class MultiAnimation; class SlideAnimation; +} /////////////////////////////////////////////////////////////////////////////// // @@ -110,7 +112,7 @@ class Tab : public BaseTab { gfx::Point hover_point_; // Animation used when the title of an inactive mini tab changes. - scoped_ptr<MultiAnimation> mini_title_animation_; + scoped_ptr<ui::MultiAnimation> mini_title_animation_; struct TabImage { SkBitmap* image_l; diff --git a/chrome/browser/ui/views/tabs/tab_strip.cc b/chrome/browser/ui/views/tabs/tab_strip.cc index 64bc896..f0c6017 100644 --- a/chrome/browser/ui/views/tabs/tab_strip.cc +++ b/chrome/browser/ui/views/tabs/tab_strip.cc @@ -4,7 +4,6 @@ #include "chrome/browser/views/tabs/tab_strip.h" -#include "app/animation_container.h" #include "app/drag_drop_types.h" #include "app/l10n_util.h" #include "app/resource_bundle.h" @@ -23,6 +22,7 @@ #include "gfx/size.h" #include "grit/generated_resources.h" #include "grit/theme_resources.h" +#include "ui/base/animation/animation_container.h" #include "views/controls/image_view.h" #include "views/widget/default_theme_provider.h" #include "views/window/non_client_view.h" @@ -120,7 +120,7 @@ TabStrip::TabStrip(TabStripController* controller) current_selected_width_(Tab::GetStandardSize().width()), available_width_for_tabs_(-1), in_tab_close_(false), - animation_container_(new AnimationContainer()) { + animation_container_(new ui::AnimationContainer()) { Init(); } diff --git a/chrome/browser/ui/views/tabs/tab_strip.h b/chrome/browser/ui/views/tabs/tab_strip.h index d01938e..ca2aed3 100644 --- a/chrome/browser/ui/views/tabs/tab_strip.h +++ b/chrome/browser/ui/views/tabs/tab_strip.h @@ -6,12 +6,12 @@ #define CHROME_BROWSER_UI_VIEWS_TABS_TAB_STRIP_H_ #pragma once -#include "app/animation_container.h" #include "base/ref_counted.h" #include "base/timer.h" #include "chrome/browser/views/tabs/base_tab_strip.h" #include "gfx/point.h" #include "gfx/rect.h" +#include "ui/base/animation/animation_container.h" #include "views/controls/button/image_button.h" #include "views/mouse_watcher.h" @@ -271,7 +271,7 @@ class TabStrip : public BaseTabStrip, // To ensure all tabs pulse at the same time they share the same animation // container. This is that animation container. - scoped_refptr<AnimationContainer> animation_container_; + scoped_refptr<ui::AnimationContainer> animation_container_; // Used for stage 1 of new tab animation. base::OneShotTimer<TabStrip> new_tab_timer_; diff --git a/chrome/browser/ui/views/toolbar_view.h b/chrome/browser/ui/views/toolbar_view.h index e8c13af..8c07dc2 100644 --- a/chrome/browser/ui/views/toolbar_view.h +++ b/chrome/browser/ui/views/toolbar_view.h @@ -9,7 +9,6 @@ #include <vector> #include "app/menus/accelerator.h" -#include "app/slide_animation.h" #include "base/ref_counted.h" #include "base/scoped_ptr.h" #include "chrome/browser/command_updater.h" @@ -18,6 +17,7 @@ #include "chrome/browser/ui/views/accessible_pane_view.h" #include "chrome/browser/ui/views/location_bar/location_bar_view.h" #include "chrome/browser/ui/views/reload_button.h" +#include "ui/base/animation/slide_animation.h" #include "views/controls/button/menu_button.h" #include "views/controls/menu/menu.h" #include "views/controls/menu/menu_wrapper.h" |