summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-07 17:33:39 +0000
committerben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-07 17:33:39 +0000
commitf676780687464428e340d008a0d1ca13d9944628 (patch)
tree489e8bd8188e31a7f6c53f15e8d1d9c6ba36d023
parent3b65bfd55c56cf8a6db025087d937494f49dc15f (diff)
downloadchromium_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
-rw-r--r--app/app.gyp4
-rw-r--r--app/app_base.gypi16
-rw-r--r--build/all.gyp1
-rw-r--r--chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc22
-rw-r--r--chrome/browser/autocomplete/autocomplete_edit_view_gtk.h21
-rw-r--r--chrome/browser/chromeos/panels/panel_scroller.cc10
-rw-r--r--chrome/browser/chromeos/panels/panel_scroller.h12
-rw-r--r--chrome/browser/chromeos/setting_level_bubble.cc12
-rw-r--r--chrome/browser/chromeos/setting_level_bubble.h14
-rw-r--r--chrome/browser/chromeos/status/network_dropdown_button.cc7
-rw-r--r--chrome/browser/chromeos/status/network_dropdown_button.h10
-rw-r--r--chrome/browser/chromeos/status/network_menu_button.cc6
-rw-r--r--chrome/browser/chromeos/status/network_menu_button.h8
-rw-r--r--chrome/browser/chromeos/wm_overview_controller.h1
-rw-r--r--chrome/browser/dom_ui/app_launcher_handler.cc4
-rw-r--r--chrome/browser/dom_ui/ntp_resource_cache.cc4
-rw-r--r--chrome/browser/gtk/bookmark_bar_gtk.cc8
-rw-r--r--chrome/browser/gtk/bookmark_bar_gtk.h17
-rw-r--r--chrome/browser/gtk/browser_actions_toolbar_gtk.cc5
-rw-r--r--chrome/browser/gtk/browser_actions_toolbar_gtk.h14
-rw-r--r--chrome/browser/gtk/custom_button.cc2
-rw-r--r--chrome/browser/gtk/custom_button.h10
-rw-r--r--chrome/browser/gtk/download_item_gtk.cc10
-rw-r--r--chrome/browser/gtk/download_item_gtk.h15
-rw-r--r--chrome/browser/gtk/download_started_animation_gtk.cc6
-rw-r--r--chrome/browser/gtk/hover_controller_gtk.cc6
-rw-r--r--chrome/browser/gtk/hover_controller_gtk.h20
-rw-r--r--chrome/browser/gtk/infobar_arrow_model.cc8
-rw-r--r--chrome/browser/gtk/infobar_arrow_model.h16
-rw-r--r--chrome/browser/gtk/notifications/balloon_view_gtk.cc6
-rw-r--r--chrome/browser/gtk/notifications/balloon_view_gtk.h13
-rw-r--r--chrome/browser/gtk/slide_animator_gtk.cc13
-rw-r--r--chrome/browser/gtk/slide_animator_gtk.h14
-rw-r--r--chrome/browser/gtk/status_bubble_gtk.cc10
-rw-r--r--chrome/browser/gtk/status_bubble_gtk.h15
-rw-r--r--chrome/browser/gtk/tabs/dragged_tab_gtk.cc10
-rw-r--r--chrome/browser/gtk/tabs/dragged_tab_gtk.h16
-rw-r--r--chrome/browser/gtk/tabs/tab_renderer_gtk.cc32
-rw-r--r--chrome/browser/gtk/tabs/tab_renderer_gtk.h21
-rw-r--r--chrome/browser/gtk/tabs/tab_strip_gtk.cc34
-rw-r--r--chrome/browser/gtk/translate/translate_infobar_base_gtk.cc8
-rw-r--r--chrome/browser/gtk/translate/translate_infobar_base_gtk.h10
-rw-r--r--chrome/browser/renderer_host/render_widget_host_view_gtk.cc8
-rw-r--r--chrome/browser/renderer_host/render_widget_host_view_gtk.h16
-rw-r--r--chrome/browser/ui/browser.cc4
-rw-r--r--chrome/browser/ui/views/app_launched_animation_win.cc30
-rw-r--r--chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.cc2
-rw-r--r--chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.h12
-rw-r--r--chrome/browser/ui/views/bookmark_bar_view.cc16
-rw-r--r--chrome/browser/ui/views/bookmark_bar_view.h13
-rw-r--r--chrome/browser/ui/views/browser_actions_container.cc17
-rw-r--r--chrome/browser/ui/views/browser_actions_container.h22
-rw-r--r--chrome/browser/ui/views/download_item_view.cc12
-rw-r--r--chrome/browser/ui/views/download_item_view.h26
-rw-r--r--chrome/browser/ui/views/download_shelf_view.cc10
-rw-r--r--chrome/browser/ui/views/download_shelf_view.h27
-rw-r--r--chrome/browser/ui/views/download_started_animation_win.cc6
-rw-r--r--chrome/browser/ui/views/dropdown_bar_host.cc10
-rw-r--r--chrome/browser/ui/views/dropdown_bar_host.h19
-rw-r--r--chrome/browser/ui/views/frame/contents_container.cc14
-rw-r--r--chrome/browser/ui/views/frame/contents_container.h15
-rw-r--r--chrome/browser/ui/views/fullscreen_exit_bubble.cc8
-rw-r--r--chrome/browser/ui/views/fullscreen_exit_bubble.h18
-rw-r--r--chrome/browser/ui/views/info_bubble.cc10
-rw-r--r--chrome/browser/ui/views/info_bubble.h30
-rw-r--r--chrome/browser/ui/views/infobars/extension_infobar.cc2
-rw-r--r--chrome/browser/ui/views/infobars/infobars.cc12
-rw-r--r--chrome/browser/ui/views/infobars/infobars.h18
-rw-r--r--chrome/browser/ui/views/infobars/translate_infobar_base.cc8
-rw-r--r--chrome/browser/ui/views/infobars/translate_infobar_base.h6
-rw-r--r--chrome/browser/ui/views/location_bar/content_setting_image_view.cc2
-rw-r--r--chrome/browser/ui/views/location_bar/content_setting_image_view.h6
-rw-r--r--chrome/browser/ui/views/location_bar/suggested_text_view.cc26
-rw-r--r--chrome/browser/ui/views/location_bar/suggested_text_view.h14
-rw-r--r--chrome/browser/ui/views/notifications/balloon_view.cc6
-rw-r--r--chrome/browser/ui/views/notifications/balloon_view.h13
-rw-r--r--chrome/browser/ui/views/page_info_bubble_view.cc4
-rw-r--r--chrome/browser/ui/views/page_info_bubble_view.h14
-rw-r--r--chrome/browser/ui/views/status_bubble_views.cc27
-rw-r--r--chrome/browser/ui/views/tabs/base_tab.cc30
-rw-r--r--chrome/browser/ui/views/tabs/base_tab.h39
-rw-r--r--chrome/browser/ui/views/tabs/base_tab_strip.cc10
-rw-r--r--chrome/browser/ui/views/tabs/base_tab_strip.h2
-rw-r--r--chrome/browser/ui/views/tabs/dragged_tab_controller.cc14
-rw-r--r--chrome/browser/ui/views/tabs/tab.cc27
-rw-r--r--chrome/browser/ui/views/tabs/tab.h4
-rw-r--r--chrome/browser/ui/views/tabs/tab_strip.cc4
-rw-r--r--chrome/browser/ui/views/tabs/tab_strip.h4
-rw-r--r--chrome/browser/ui/views/toolbar_view.h2
-rw-r--r--chrome/chrome.gyp1
-rw-r--r--chrome/chrome_browser.gypi1
-rw-r--r--ui/base/animation/animation.cc (renamed from app/animation.cc)14
-rw-r--r--ui/base/animation/animation.h109
-rw-r--r--ui/base/animation/animation_container.cc (renamed from app/animation_container.cc)12
-rw-r--r--ui/base/animation/animation_container.h90
-rw-r--r--ui/base/animation/animation_container_element.h34
-rw-r--r--ui/base/animation/animation_container_observer.h31
-rw-r--r--ui/base/animation/animation_container_unittest.cc (renamed from app/animation_container_unittest.cc)14
-rw-r--r--ui/base/animation/animation_delegate.h34
-rw-r--r--ui/base/animation/animation_unittest.cc (renamed from app/animation_unittest.cc)12
-rw-r--r--ui/base/animation/linear_animation.cc (renamed from app/linear_animation.cc)12
-rw-r--r--ui/base/animation/linear_animation.h74
-rw-r--r--ui/base/animation/multi_animation.cc (renamed from app/multi_animation.cc)10
-rw-r--r--ui/base/animation/multi_animation.h94
-rw-r--r--ui/base/animation/multi_animation_unittest.cc (renamed from app/multi_animation_unittest.cc)10
-rw-r--r--ui/base/animation/slide_animation.cc (renamed from app/slide_animation.cc)8
-rw-r--r--ui/base/animation/slide_animation.h100
-rw-r--r--ui/base/animation/slide_animation_unittest.cc (renamed from app/slide_animation_unittest.cc)10
-rw-r--r--ui/base/animation/test_animation_delegate.h49
-rw-r--r--ui/base/animation/throb_animation.cc (renamed from app/throb_animation.cc)8
-rw-r--r--ui/base/animation/throb_animation.h69
-rw-r--r--ui/base/animation/tween.cc (renamed from app/tween.cc)8
-rw-r--r--ui/base/animation/tween.h48
-rw-r--r--ui/base/run_all_unittests.cc9
-rw-r--r--ui/base/test_suite.h38
-rw-r--r--ui/base/ui_base.gypi100
-rw-r--r--ui/ui.gyp52
-rw-r--r--views/animation/bounds_animator.cc9
-rw-r--r--views/animation/bounds_animator.h47
-rw-r--r--views/animation/bounds_animator_unittest.cc6
-rw-r--r--views/controls/button/custom_button.cc8
-rw-r--r--views/controls/button/custom_button.h12
-rw-r--r--views/controls/button/image_button.cc2
-rw-r--r--views/controls/button/text_button.cc2
124 files changed, 1651 insertions, 616 deletions
diff --git a/app/app.gyp b/app/app.gyp
index bac326b..8bcc0e3 100644
--- a/app/app.gyp
+++ b/app/app.gyp
@@ -38,16 +38,12 @@
'<(libjpeg_gyp_path):libjpeg',
],
'sources': [
- 'animation_container_unittest.cc',
- 'animation_unittest.cc',
'clipboard/clipboard_unittest.cc',
'data_pack_unittest.cc',
'l10n_util_mac_unittest.mm',
'l10n_util_unittest.cc',
- 'multi_animation_unittest.cc',
'os_exchange_data_win_unittest.cc',
'run_all_unittests.cc',
- 'slide_animation_unittest.cc',
'sql/connection_unittest.cc',
'sql/statement_unittest.cc',
'sql/transaction_unittest.cc',
diff --git a/app/app_base.gypi b/app/app_base.gypi
index 6bcad0e..3f27573 100644
--- a/app/app_base.gypi
+++ b/app/app_base.gypi
@@ -91,12 +91,6 @@
# Files that are not required for Win64 Native Client loader
'active_window_watcher_x.cc',
'active_window_watcher_x.h',
- 'animation_container.cc',
- 'animation_container.h',
- 'animation_container_element.h',
- 'animation_container_observer.h',
- 'animation.cc',
- 'animation.h',
'bidi_line_iterator.cc',
'clipboard/clipboard.cc',
'clipboard/clipboard.h',
@@ -161,8 +155,6 @@
'l10n_util_posix.cc',
'l10n_util_win.cc',
'l10n_util_win.h',
- 'linear_animation.cc',
- 'linear_animation.h',
'mac/nsimage_cache.h',
'mac/nsimage_cache.mm',
'mac/scoped_nsdisable_screen_updates.h',
@@ -176,8 +168,6 @@
'menus/simple_menu_model.cc',
'menus/simple_menu_model.h',
'message_box_flags.h',
- 'multi_animation.cc',
- 'multi_animation.h',
'os_exchange_data_provider_gtk.cc',
'os_exchange_data_provider_gtk.h',
'os_exchange_data_provider_win.cc',
@@ -190,8 +180,6 @@
'resource_bundle_mac.mm',
'resource_bundle_posix.cc',
'resource_bundle_win.cc',
- 'slide_animation.cc',
- 'slide_animation.h',
'sql/connection.cc',
'sql/connection.h',
'sql/diagnostic_error_delegate.h',
@@ -217,10 +205,6 @@
'text_elider.h',
'theme_provider.cc',
'theme_provider.h',
- 'throb_animation.cc',
- 'throb_animation.h',
- 'tween.cc',
- 'tween.h',
'view_prop.cc',
'view_prop.h',
'win/drag_source.cc',
diff --git a/build/all.gyp b/build/all.gyp
index 212c6c9..ba9bc45 100644
--- a/build/all.gyp
+++ b/build/all.gyp
@@ -46,6 +46,7 @@
'../third_party/sqlite/sqlite.gyp:*',
'../third_party/WebKit/WebKit/chromium/WebKit.gyp:*',
'../third_party/zlib/zlib.gyp:*',
+ '../ui/ui.gyp:*',
'../webkit/support/webkit_support.gyp:*',
'../webkit/webkit.gyp:*',
'util/build_util.gyp:*',
diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc b/chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc
index 911775e..3f435a3 100644
--- a/chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc
+++ b/chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc
@@ -10,7 +10,6 @@
#include <algorithm>
#include "app/l10n_util.h"
-#include "app/multi_animation.h"
#include "base/logging.h"
#include "base/string_util.h"
#include "base/utf_string_conversions.h"
@@ -36,6 +35,7 @@
#include "grit/generated_resources.h"
#include "net/base/escape.h"
#include "third_party/undoview/undo_view.h"
+#include "ui/base/animation/multi_animation.h"
#if defined(TOOLKIT_VIEWS)
#include "chrome/browser/views/autocomplete/autocomplete_popup_contents_view.h"
@@ -381,12 +381,12 @@ void AutocompleteEditViewGtk::Init() {
AdjustVerticalAlignmentOfInstantView();
- MultiAnimation::Parts parts;
- parts.push_back(MultiAnimation::Part(
- InstantController::kAutoCommitPauseTimeMS, Tween::ZERO));
- parts.push_back(MultiAnimation::Part(
- InstantController::kAutoCommitFadeInTimeMS, Tween::EASE_IN));
- instant_animation_.reset(new MultiAnimation(parts));
+ 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));
+ instant_animation_.reset(new ui::MultiAnimation(parts));
instant_animation_->set_continuous(false);
#if !defined(TOOLKIT_VIEWS)
@@ -798,15 +798,17 @@ void AutocompleteEditViewGtk::Observe(NotificationType type,
SetBaseColor();
}
-void AutocompleteEditViewGtk::AnimationEnded(const Animation* animation) {
+void AutocompleteEditViewGtk::AnimationEnded(const ui::Animation* animation) {
controller_->OnCommitSuggestedText(GetText());
}
-void AutocompleteEditViewGtk::AnimationProgressed(const Animation* animation) {
+void AutocompleteEditViewGtk::AnimationProgressed(
+ const ui::Animation* animation) {
UpdateInstantViewColors();
}
-void AutocompleteEditViewGtk::AnimationCanceled(const Animation* animation) {
+void AutocompleteEditViewGtk::AnimationCanceled(
+ const ui::Animation* animation) {
UpdateInstantViewColors();
}
diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_gtk.h b/chrome/browser/autocomplete/autocomplete_edit_view_gtk.h
index dc09d91..9e45db6 100644
--- a/chrome/browser/autocomplete/autocomplete_edit_view_gtk.h
+++ b/chrome/browser/autocomplete/autocomplete_edit_view_gtk.h
@@ -11,7 +11,6 @@
#include <algorithm>
#include <string>
-#include "app/animation_delegate.h"
#include "app/gtk_signal.h"
#include "app/gtk_signal_registrar.h"
#include "base/basictypes.h"
@@ -24,19 +23,23 @@
#include "chrome/common/notification_registrar.h"
#include "chrome/common/page_transition_types.h"
#include "gfx/rect.h"
+#include "ui/base/animation/animation_delegate.h"
#include "webkit/glue/window_open_disposition.h"
class AutocompleteEditController;
class AutocompleteEditModel;
class AutocompletePopupView;
-class MultiAnimation;
class Profile;
class TabContents;
-namespace gfx{
+namespace gfx {
class Font;
}
+namespace ui {
+class MultiAnimation;
+}
+
namespace views {
class View;
}
@@ -47,7 +50,7 @@ class GtkThemeProvider;
class AutocompleteEditViewGtk : public AutocompleteEditView,
public NotificationObserver,
- public AnimationDelegate {
+ public ui::AnimationDelegate {
public:
// Modeled like the Windows CHARRANGE. Represent a pair of cursor position
// offsets. Since GtkTextIters are invalid after the buffer is changed, we
@@ -149,10 +152,10 @@ class AutocompleteEditViewGtk : public AutocompleteEditView,
const NotificationSource& source,
const NotificationDetails& details);
- // Overridden from AnimationDelegate.
- virtual void AnimationEnded(const Animation* animation);
- virtual void AnimationProgressed(const Animation* animation);
- virtual void AnimationCanceled(const Animation* animation);
+ // Overridden from ui::AnimationDelegate.
+ virtual void AnimationEnded(const ui::Animation* animation);
+ virtual void AnimationProgressed(const ui::Animation* animation);
+ virtual void AnimationCanceled(const ui::Animation* animation);
// Sets the colors of the text view according to the theme.
void SetBaseColor();
@@ -366,7 +369,7 @@ class AutocompleteEditViewGtk : public AutocompleteEditView,
GtkWidget* instant_view_;
// Animation from instant suggest (faded text) to autocomplete (selected
// text).
- scoped_ptr<MultiAnimation> instant_animation_;
+ scoped_ptr<ui::MultiAnimation> instant_animation_;
// A mark to split the content and the instant anchor. Wherever the end
// iterator of the text buffer is required, the iterator to this mark should
diff --git a/chrome/browser/chromeos/panels/panel_scroller.cc b/chrome/browser/chromeos/panels/panel_scroller.cc
index a568341..b2c5b3cf 100644
--- a/chrome/browser/chromeos/panels/panel_scroller.cc
+++ b/chrome/browser/chromeos/panels/panel_scroller.cc
@@ -1,6 +1,6 @@
-// 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.
+// Copyright (c) 2011 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.
#include "chrome/browser/chromeos/panels/panel_scroller.h"
@@ -27,7 +27,7 @@ PanelScroller::PanelScroller()
ALLOW_THIS_IN_INITIALIZER_LIST(animation_(this)),
animated_scroll_begin_(0),
animated_scroll_end_(0) {
- animation_.SetTweenType(Tween::EASE_IN_OUT);
+ animation_.SetTweenType(ui::Tween::EASE_IN_OUT);
animation_.SetSlideDuration(300);
Panel* panel = new Panel;
@@ -238,7 +238,7 @@ void PanelScroller::ScrollToPanel(int index) {
animation_.Show();
}
-void PanelScroller::AnimationProgressed(const Animation* animation) {
+void PanelScroller::AnimationProgressed(const ui::Animation* animation) {
scroll_pos_ = static_cast<int>(
static_cast<double>(animated_scroll_end_ - animated_scroll_begin_) *
animation_.GetCurrentValue()) + animated_scroll_begin_;
diff --git a/chrome/browser/chromeos/panels/panel_scroller.h b/chrome/browser/chromeos/panels/panel_scroller.h
index 366bc5a..e4d7eab 100644
--- a/chrome/browser/chromeos/panels/panel_scroller.h
+++ b/chrome/browser/chromeos/panels/panel_scroller.h
@@ -8,14 +8,14 @@
#include <vector>
-#include "app/animation_delegate.h"
-#include "app/slide_animation.h"
#include "base/basictypes.h"
+#include "ui/base/animation/animation_delegate.h"
+#include "ui/base/animation/slide_animation.h"
#include "views/view.h"
class PanelScrollerHeader;
-class PanelScroller : public views::View, public AnimationDelegate {
+class PanelScroller : public views::View, public ui::AnimationDelegate {
public:
PanelScroller();
~PanelScroller();
@@ -39,8 +39,8 @@ class PanelScroller : public views::View, public AnimationDelegate {
private:
struct Panel;
- // AnimationDelegate overrides.
- virtual void AnimationProgressed(const Animation* animation);
+ // ui::AnimationDelegate overrides.
+ virtual void AnimationProgressed(const ui::Animation* animation);
// Scrolls to the panel at the given index. It will be moved to the top.
void ScrollToPanel(int index);
@@ -56,7 +56,7 @@ class PanelScroller : public views::View, public AnimationDelegate {
// The current scroll position.
int scroll_pos_;
- SlideAnimation animation_;
+ ui::SlideAnimation animation_;
// When animating a scroll, these indicate the beginning and ending of the
// scroll. The scroll_pos_ always indicates the current one.
diff --git a/chrome/browser/chromeos/setting_level_bubble.cc b/chrome/browser/chromeos/setting_level_bubble.cc
index 22aeced..8395673 100644
--- a/chrome/browser/chromeos/setting_level_bubble.cc
+++ b/chrome/browser/chromeos/setting_level_bubble.cc
@@ -67,7 +67,7 @@ SettingLevelBubble::SettingLevelBubble(SkBitmap* increase_icon,
view_(NULL),
animation_(this) {
animation_.SetSlideDuration(kAnimationDurationMs);
- animation_.SetTweenType(Tween::LINEAR);
+ animation_.SetTweenType(ui::Tween::LINEAR);
}
void SettingLevelBubble::ShowBubble(int percent) {
@@ -136,16 +136,16 @@ void SettingLevelBubble::InfoBubbleClosing(InfoBubble* info_bubble, bool) {
view_ = NULL;
}
-void SettingLevelBubble::AnimationEnded(const Animation* animation) {
+void SettingLevelBubble::AnimationEnded(const ui::Animation* animation) {
previous_percent_ = current_percent_;
}
-void SettingLevelBubble::AnimationProgressed(const Animation* animation) {
+void SettingLevelBubble::AnimationProgressed(const ui::Animation* animation) {
if (view_) {
view_->Update(
- Tween::ValueBetween(animation->GetCurrentValue(),
- previous_percent_,
- current_percent_));
+ ui::Tween::ValueBetween(animation->GetCurrentValue(),
+ previous_percent_,
+ current_percent_));
}
}
diff --git a/chrome/browser/chromeos/setting_level_bubble.h b/chrome/browser/chromeos/setting_level_bubble.h
index 262bbdc..9cc43d9 100644
--- a/chrome/browser/chromeos/setting_level_bubble.h
+++ b/chrome/browser/chromeos/setting_level_bubble.h
@@ -6,11 +6,11 @@
#define CHROME_BROWSER_CHROMEOS_SETTING_LEVEL_BUBBLE_H_
#pragma once
-#include "app/animation_delegate.h"
-#include "app/slide_animation.h"
#include "base/basictypes.h"
#include "base/timer.h"
#include "chrome/browser/views/info_bubble.h"
+#include "ui/base/animation/animation_delegate.h"
+#include "ui/base/animation/slide_animation.h"
class SkBitmap;
@@ -21,7 +21,7 @@ class SettingLevelBubbleView;
// Singleton class controlling a bubble displaying a level-based setting like
// volume or brightness.
class SettingLevelBubble : public InfoBubbleDelegate,
- public AnimationDelegate {
+ public ui::AnimationDelegate {
public:
void ShowBubble(int percent);
void HideBubble();
@@ -41,9 +41,9 @@ class SettingLevelBubble : public InfoBubbleDelegate,
virtual bool CloseOnEscape() { return true; }
virtual bool FadeInOnShow() { return false; }
- // 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);
// Previous and current percentages, or -1 if not yet shown.
int previous_percent_;
@@ -61,7 +61,7 @@ class SettingLevelBubble : public InfoBubbleDelegate,
// Its contents view, owned by InfoBubble.
SettingLevelBubbleView* view_;
- SlideAnimation animation_;
+ ui::SlideAnimation animation_;
base::OneShotTimer<SettingLevelBubble> timeout_timer_;
DISALLOW_COPY_AND_ASSIGN(SettingLevelBubble);
diff --git a/chrome/browser/chromeos/status/network_dropdown_button.cc b/chrome/browser/chromeos/status/network_dropdown_button.cc
index 3b74333..c850997 100644
--- a/chrome/browser/chromeos/status/network_dropdown_button.cc
+++ b/chrome/browser/chromeos/status/network_dropdown_button.cc
@@ -33,7 +33,7 @@ NetworkDropdownButton::NetworkDropdownButton(bool browser_mode,
ALLOW_THIS_IN_INITIALIZER_LIST(animation_connecting_(this)),
parent_window_(parent_window) {
animation_connecting_.SetThrobDuration(kThrobDuration);
- animation_connecting_.SetTweenType(Tween::EASE_IN_OUT);
+ animation_connecting_.SetTweenType(ui::Tween::EASE_IN_OUT);
CrosLibrary::Get()->GetNetworkLibrary()->AddNetworkManagerObserver(this);
// The initial state will be updated on Refresh.
// See network_selection_view.cc.
@@ -44,9 +44,10 @@ NetworkDropdownButton::~NetworkDropdownButton() {
}
////////////////////////////////////////////////////////////////////////////////
-// NetworkMenuButton, AnimationDelegate implementation:
+// NetworkMenuButton, ui::AnimationDelegate implementation:
-void NetworkDropdownButton::AnimationProgressed(const Animation* animation) {
+void NetworkDropdownButton::AnimationProgressed(
+ const ui::Animation* animation) {
if (animation == &animation_connecting_) {
SetIcon(IconForNetworkConnecting(animation_connecting_.GetCurrentValue(),
true));
diff --git a/chrome/browser/chromeos/status/network_dropdown_button.h b/chrome/browser/chromeos/status/network_dropdown_button.h
index 68ac84f..8a9ac7aa 100644
--- a/chrome/browser/chromeos/status/network_dropdown_button.h
+++ b/chrome/browser/chromeos/status/network_dropdown_button.h
@@ -6,11 +6,11 @@
#define CHROME_BROWSER_CHROMEOS_STATUS_NETWORK_DROPDOWN_BUTTON_H_
#pragma once
-#include "app/animation_delegate.h"
-#include "app/throb_animation.h"
#include "chrome/browser/chromeos/cros/network_library.h"
#include "chrome/browser/chromeos/status/network_menu.h"
#include "chrome/browser/chromeos/views/dropdown_button.h"
+#include "ui/base/animation/animation_delegate.h"
+#include "ui/base/animation/throb_animation.h"
namespace chromeos {
@@ -25,8 +25,8 @@ class NetworkDropdownButton : public DropDownButton,
NetworkDropdownButton(bool browser_mode, gfx::NativeWindow parent_window);
virtual ~NetworkDropdownButton();
- // AnimationDelegate implementation.
- virtual void AnimationProgressed(const Animation* animation);
+ // ui::AnimationDelegate implementation.
+ virtual void AnimationProgressed(const ui::Animation* animation);
// NetworkLibrary::NetworkManagerObserver implementation.
virtual void OnNetworkManagerChanged(NetworkLibrary* obj);
@@ -45,7 +45,7 @@ class NetworkDropdownButton : public DropDownButton,
bool browser_mode_;
// The throb animation that does the wifi connecting animation.
- ThrobAnimation animation_connecting_;
+ ui::ThrobAnimation animation_connecting_;
// The duration of the icon throbbing in milliseconds.
static const int kThrobDuration;
diff --git a/chrome/browser/chromeos/status/network_menu_button.cc b/chrome/browser/chromeos/status/network_menu_button.cc
index 2beb02a..164f7b1 100644
--- a/chrome/browser/chromeos/status/network_menu_button.cc
+++ b/chrome/browser/chromeos/status/network_menu_button.cc
@@ -33,7 +33,7 @@ NetworkMenuButton::NetworkMenuButton(StatusAreaHost* host)
host_(host),
ALLOW_THIS_IN_INITIALIZER_LIST(animation_connecting_(this)) {
animation_connecting_.SetThrobDuration(kThrobDuration);
- animation_connecting_.SetTweenType(Tween::EASE_IN_OUT);
+ animation_connecting_.SetTweenType(ui::Tween::EASE_IN_OUT);
OnNetworkManagerChanged(CrosLibrary::Get()->GetNetworkLibrary());
CrosLibrary::Get()->GetNetworkLibrary()->AddNetworkManagerObserver(this);
CrosLibrary::Get()->GetNetworkLibrary()->AddCellularDataPlanObserver(this);
@@ -47,9 +47,9 @@ NetworkMenuButton::~NetworkMenuButton() {
}
////////////////////////////////////////////////////////////////////////////////
-// NetworkMenuButton, AnimationDelegate implementation:
+// NetworkMenuButton, ui::AnimationDelegate implementation:
-void NetworkMenuButton::AnimationProgressed(const Animation* animation) {
+void NetworkMenuButton::AnimationProgressed(const ui::Animation* animation) {
if (animation == &animation_connecting_) {
SetIcon(IconForNetworkConnecting(animation_connecting_.GetCurrentValue(),
false));
diff --git a/chrome/browser/chromeos/status/network_menu_button.h b/chrome/browser/chromeos/status/network_menu_button.h
index 76c3dce..12ae6c2 100644
--- a/chrome/browser/chromeos/status/network_menu_button.h
+++ b/chrome/browser/chromeos/status/network_menu_button.h
@@ -8,11 +8,11 @@
#include <string>
-#include "app/throb_animation.h"
#include "base/timer.h"
#include "chrome/browser/chromeos/cros/network_library.h"
#include "chrome/browser/chromeos/status/network_menu.h"
#include "chrome/browser/chromeos/status/status_area_button.h"
+#include "ui/base/animation/throb_animation.h"
namespace gfx {
class Canvas;
@@ -55,8 +55,8 @@ class NetworkMenuButton : public StatusAreaButton,
explicit NetworkMenuButton(StatusAreaHost* host);
virtual ~NetworkMenuButton();
- // AnimationDelegate implementation.
- virtual void AnimationProgressed(const Animation* animation);
+ // ui::AnimationDelegate implementation.
+ virtual void AnimationProgressed(const ui::Animation* animation);
// NetworkLibrary::NetworkManagerObserver implementation.
virtual void OnNetworkManagerChanged(NetworkLibrary* cros);
@@ -93,7 +93,7 @@ class NetworkMenuButton : public StatusAreaButton,
SkBitmap badge_;
// The throb animation that does the wifi connecting animation.
- ThrobAnimation animation_connecting_;
+ ui::ThrobAnimation animation_connecting_;
// The duration of the icon throbbing in milliseconds.
static const int kThrobDuration;
diff --git a/chrome/browser/chromeos/wm_overview_controller.h b/chrome/browser/chromeos/wm_overview_controller.h
index d5999b5..f5f5348 100644
--- a/chrome/browser/chromeos/wm_overview_controller.h
+++ b/chrome/browser/chromeos/wm_overview_controller.h
@@ -20,7 +20,6 @@ namespace views {
class Widget;
}
-class Animation;
class Browser;
class RenderWidgetHost;
diff --git a/chrome/browser/dom_ui/app_launcher_handler.cc b/chrome/browser/dom_ui/app_launcher_handler.cc
index 58ee56f..aba23f1 100644
--- a/chrome/browser/dom_ui/app_launcher_handler.cc
+++ b/chrome/browser/dom_ui/app_launcher_handler.cc
@@ -4,7 +4,6 @@
#include "chrome/browser/dom_ui/app_launcher_handler.h"
-#include "app/animation.h"
#include "base/metrics/histogram.h"
#include "base/string_number_conversions.h"
#include "base/string_split.h"
@@ -32,6 +31,7 @@
#include "gfx/rect.h"
#include "grit/browser_resources.h"
#include "grit/generated_resources.h"
+#include "ui/base/animation/animation.h"
namespace {
@@ -410,7 +410,7 @@ void AppLauncherHandler::AnimateAppIcon(const Extension* extension,
const gfx::Rect& rect) {
// We make this check for the case of minimized windows, unit tests, etc.
if (platform_util::IsVisible(dom_ui_->tab_contents()->GetNativeView()) &&
- Animation::ShouldRenderRichAnimation()) {
+ ui::Animation::ShouldRenderRichAnimation()) {
#if defined(OS_WIN)
AppLaunchedAnimation::Show(extension, rect);
#else
diff --git a/chrome/browser/dom_ui/ntp_resource_cache.cc b/chrome/browser/dom_ui/ntp_resource_cache.cc
index 6c9edac..8cca8b4 100644
--- a/chrome/browser/dom_ui/ntp_resource_cache.cc
+++ b/chrome/browser/dom_ui/ntp_resource_cache.cc
@@ -7,7 +7,6 @@
#include <algorithm>
#include <vector>
-#include "app/animation.h"
#include "app/l10n_util.h"
#include "app/resource_bundle.h"
#include "app/theme_provider.h"
@@ -41,6 +40,7 @@
#include "grit/generated_resources.h"
#include "grit/locale_settings.h"
#include "grit/theme_resources.h"
+#include "ui/base/animation/animation.h"
#if defined(OS_WIN) || defined(TOOLKIT_VIEWS)
#include "chrome/browser/views/bookmark_bar_view.h"
@@ -352,7 +352,7 @@ void NTPResourceCache::CreateNewTabHTML() {
// Control fade and resize animations.
std::string anim =
- Animation::ShouldRenderRichAnimation() ? "true" : "false";
+ ui::Animation::ShouldRenderRichAnimation() ? "true" : "false";
localized_strings.SetString("anim", anim);
// Pass the shown_sections pref early so that we can prevent flicker.
diff --git a/chrome/browser/gtk/bookmark_bar_gtk.cc b/chrome/browser/gtk/bookmark_bar_gtk.cc
index ea48a94..cd1ea94 100644
--- a/chrome/browser/gtk/bookmark_bar_gtk.cc
+++ b/chrome/browser/gtk/bookmark_bar_gtk.cc
@@ -7,7 +7,6 @@
#include <vector>
#include "app/gtk_dnd_util.h"
-#include "app/slide_animation.h"
#include "app/resource_bundle.h"
#include "base/utf_string_conversions.h"
#include "chrome/browser/bookmarks/bookmark_node_data.h"
@@ -46,6 +45,7 @@
#include "grit/app_resources.h"
#include "grit/generated_resources.h"
#include "grit/theme_resources.h"
+#include "ui/base/animation/slide_animation.h"
namespace {
@@ -277,7 +277,7 @@ void BookmarkBarGtk::Init(Profile* profile) {
gtk_widget_set_size_request(event_box_.get(), -1, kBookmarkBarMinimumHeight);
- slide_animation_.reset(new SlideAnimation(this));
+ slide_animation_.reset(new ui::SlideAnimation(this));
ViewIDUtil::SetID(other_bookmarks_button_, VIEW_ID_OTHER_BOOKMARKS);
ViewIDUtil::SetID(widget(), VIEW_ID_BOOKMARK_BAR);
@@ -772,7 +772,7 @@ bool BookmarkBarGtk::IsAlwaysShown() {
return profile_->GetPrefs()->GetBoolean(prefs::kShowBookmarkBar);
}
-void BookmarkBarGtk::AnimationProgressed(const Animation* animation) {
+void BookmarkBarGtk::AnimationProgressed(const ui::Animation* animation) {
DCHECK_EQ(animation, slide_animation_.get());
int max_height = ShouldBeFloating() ?
@@ -784,7 +784,7 @@ void BookmarkBarGtk::AnimationProgressed(const Animation* animation) {
gtk_widget_set_size_request(event_box_.get(), -1, height);
}
-void BookmarkBarGtk::AnimationEnded(const Animation* animation) {
+void BookmarkBarGtk::AnimationEnded(const ui::Animation* animation) {
DCHECK_EQ(animation, slide_animation_.get());
if (!slide_animation_->IsShowing()) {
diff --git a/chrome/browser/gtk/bookmark_bar_gtk.h b/chrome/browser/gtk/bookmark_bar_gtk.h
index f0abe1b..7d62572 100644
--- a/chrome/browser/gtk/bookmark_bar_gtk.h
+++ b/chrome/browser/gtk/bookmark_bar_gtk.h
@@ -10,7 +10,6 @@
#include <vector>
-#include "app/animation_delegate.h"
#include "app/gtk_signal.h"
#include "base/gtest_prod_util.h"
#include "base/scoped_ptr.h"
@@ -25,6 +24,7 @@
#include "chrome/common/notification_registrar.h"
#include "gfx/point.h"
#include "gfx/size.h"
+#include "ui/base/animation/animation_delegate.h"
class BookmarkMenuController;
class Browser;
@@ -34,10 +34,13 @@ class GtkThemeProvider;
class MenuGtk;
class PageNavigator;
class Profile;
-class SlideAnimation;
class TabstripOriginProvider;
-class BookmarkBarGtk : public AnimationDelegate,
+namespace ui {
+class SlideAnimation;
+}
+
+class BookmarkBarGtk : public ui::AnimationDelegate,
public ProfileSyncServiceObserver,
public BookmarkModelObserver,
public MenuBarHelper::Delegate,
@@ -96,9 +99,9 @@ class BookmarkBarGtk : public AnimationDelegate,
// Returns true if the bookmarks bar preference is set to 'always show'.
bool IsAlwaysShown();
- // 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);
// MenuBarHelper::Delegate implementation ------------------------------------
virtual void PopupForButton(GtkWidget* button);
@@ -367,7 +370,7 @@ class BookmarkBarGtk : public AnimationDelegate,
// displayed yet.
scoped_ptr<BookmarkMenuController> current_menu_;
- scoped_ptr<SlideAnimation> slide_animation_;
+ scoped_ptr<ui::SlideAnimation> slide_animation_;
// Whether we are currently configured as floating (detached from the
// toolbar). This reflects our actual state, and can be out of sync with
diff --git a/chrome/browser/gtk/browser_actions_toolbar_gtk.cc b/chrome/browser/gtk/browser_actions_toolbar_gtk.cc
index 9ed0106..93b126d 100644
--- a/chrome/browser/gtk/browser_actions_toolbar_gtk.cc
+++ b/chrome/browser/gtk/browser_actions_toolbar_gtk.cc
@@ -635,7 +635,8 @@ void BrowserActionsToolbarGtk::ModelLoaded() {
SetContainerWidth();
}
-void BrowserActionsToolbarGtk::AnimationProgressed(const Animation* animation) {
+void BrowserActionsToolbarGtk::AnimationProgressed(
+ const ui::Animation* animation) {
int width = start_width_ + (desired_width_ - start_width_) *
animation->GetCurrentValue();
gtk_widget_set_size_request(button_hbox_.get(), width, -1);
@@ -644,7 +645,7 @@ void BrowserActionsToolbarGtk::AnimationProgressed(const Animation* animation) {
resize_animation_.Reset();
}
-void BrowserActionsToolbarGtk::AnimationEnded(const Animation* animation) {
+void BrowserActionsToolbarGtk::AnimationEnded(const ui::Animation* animation) {
gtk_widget_set_size_request(button_hbox_.get(), desired_width_, -1);
UpdateChevronVisibility();
}
diff --git a/chrome/browser/gtk/browser_actions_toolbar_gtk.h b/chrome/browser/gtk/browser_actions_toolbar_gtk.h
index 452a642..4d49416 100644
--- a/chrome/browser/gtk/browser_actions_toolbar_gtk.h
+++ b/chrome/browser/gtk/browser_actions_toolbar_gtk.h
@@ -9,11 +9,9 @@
#include <map>
#include <string>
-#include "app/animation_delegate.h"
#include "app/gtk_signal.h"
#include "app/gtk_signal_registrar.h"
#include "app/menus/simple_menu_model.h"
-#include "app/slide_animation.h"
#include "base/linked_ptr.h"
#include "base/task.h"
#include "chrome/browser/extensions/extension_toolbar_model.h"
@@ -23,6 +21,8 @@
#include "chrome/browser/gtk/owned_widget_gtk.h"
#include "chrome/common/notification_observer.h"
#include "chrome/common/notification_registrar.h"
+#include "ui/base/animation/animation_delegate.h"
+#include "ui/base/animation/slide_animation.h"
class Browser;
class BrowserActionButton;
@@ -34,7 +34,7 @@ typedef struct _GdkDragContext GdkDragContext;
typedef struct _GtkWidget GtkWidget;
class BrowserActionsToolbarGtk : public ExtensionToolbarModel::Observer,
- public AnimationDelegate,
+ public ui::AnimationDelegate,
public MenuGtk::Delegate,
public menus::SimpleMenuModel::Delegate,
public NotificationObserver {
@@ -111,9 +111,9 @@ class BrowserActionsToolbarGtk : public ExtensionToolbarModel::Observer,
virtual void BrowserActionMoved(const Extension* extension, int index);
virtual void ModelLoaded();
- // 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);
// SimpleMenuModel::Delegate implementation.
// In our case, |command_id| is be the index into the model's extension list.
@@ -205,7 +205,7 @@ class BrowserActionsToolbarGtk : public ExtensionToolbarModel::Observer,
ExtensionButtonMap extension_button_map_;
// We use this animation for the smart resizing of the toolbar.
- SlideAnimation resize_animation_;
+ ui::SlideAnimation resize_animation_;
// This is the final width we are animating towards.
int desired_width_;
// This is the width we were at when we started animating.
diff --git a/chrome/browser/gtk/custom_button.cc b/chrome/browser/gtk/custom_button.cc
index 08cd54d..375452d 100644
--- a/chrome/browser/gtk/custom_button.cc
+++ b/chrome/browser/gtk/custom_button.cc
@@ -192,7 +192,7 @@ void CustomDrawHoverController::Init(GtkWidget* widget) {
}
void CustomDrawHoverController::AnimationProgressed(
- const Animation* animation) {
+ const ui::Animation* animation) {
gtk_widget_queue_draw(widget_);
}
diff --git a/chrome/browser/gtk/custom_button.h b/chrome/browser/gtk/custom_button.h
index 785df6b..85f07b1 100644
--- a/chrome/browser/gtk/custom_button.h
+++ b/chrome/browser/gtk/custom_button.h
@@ -8,15 +8,15 @@
#include <gtk/gtk.h>
-#include "app/animation_delegate.h"
#include "app/gtk_signal.h"
-#include "app/slide_animation.h"
#include "base/scoped_ptr.h"
#include "chrome/browser/gtk/owned_widget_gtk.h"
#include "chrome/common/notification_observer.h"
#include "chrome/common/notification_registrar.h"
#include "gfx/rect.h"
#include "third_party/skia/include/core/SkColor.h"
+#include "ui/base/animation/animation_delegate.h"
+#include "ui/base/animation/slide_animation.h"
class CairoCachedSurface;
class GtkThemeProvider;
@@ -98,7 +98,7 @@ class CustomDrawButtonBase : public NotificationObserver {
// of controlling the hover state of a button. The "hover state" refers to the
// percent opacity of a button's PRELIGHT. The PRELIGHT is animated such that
// when a user moves a mouse over a button the PRELIGHT fades in.
-class CustomDrawHoverController : public AnimationDelegate {
+class CustomDrawHoverController : public ui::AnimationDelegate {
public:
explicit CustomDrawHoverController(GtkWidget* widget);
CustomDrawHoverController();
@@ -112,14 +112,14 @@ class CustomDrawHoverController : public AnimationDelegate {
}
private:
- virtual void AnimationProgressed(const Animation* animation);
+ virtual void AnimationProgressed(const ui::Animation* animation);
CHROMEGTK_CALLBACK_1(CustomDrawHoverController, gboolean, OnEnter,
GdkEventCrossing*);
CHROMEGTK_CALLBACK_1(CustomDrawHoverController, gboolean, OnLeave,
GdkEventCrossing*);
- SlideAnimation slide_animation_;
+ ui::SlideAnimation slide_animation_;
GtkWidget* widget_;
};
diff --git a/chrome/browser/gtk/download_item_gtk.cc b/chrome/browser/gtk/download_item_gtk.cc
index 84cfd63..b0acf44 100644
--- a/chrome/browser/gtk/download_item_gtk.cc
+++ b/chrome/browser/gtk/download_item_gtk.cc
@@ -6,7 +6,6 @@
#include "app/l10n_util.h"
#include "app/resource_bundle.h"
-#include "app/slide_animation.h"
#include "app/text_elider.h"
#include "base/basictypes.h"
#include "base/callback.h"
@@ -35,6 +34,7 @@
#include "grit/generated_resources.h"
#include "grit/theme_resources.h"
#include "third_party/skia/include/core/SkBitmap.h"
+#include "ui/base/animation/slide_animation.h"
namespace {
@@ -245,7 +245,7 @@ DownloadItemGtk::DownloadItemGtk(DownloadShelfGtk* parent_shelf,
get_download()->AddObserver(this);
- new_item_animation_.reset(new SlideAnimation(this));
+ new_item_animation_.reset(new ui::SlideAnimation(this));
new_item_animation_->SetSlideDuration(kNewItemAnimationDurationMs);
gtk_widget_show_all(hbox_.get());
@@ -382,9 +382,9 @@ void DownloadItemGtk::OnDownloadUpdated(DownloadItem* download) {
// Set up the widget as a drag source.
DownloadItemDrag::SetSource(body_.get(), get_download(), icon_large_);
- 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();
break;
case DownloadItem::IN_PROGRESS:
@@ -411,7 +411,7 @@ void DownloadItemGtk::OnDownloadUpdated(DownloadItem* download) {
UpdateStatusLabel(status_text_);
}
-void DownloadItemGtk::AnimationProgressed(const Animation* animation) {
+void DownloadItemGtk::AnimationProgressed(const ui::Animation* animation) {
if (animation == complete_animation_.get()) {
gtk_widget_queue_draw(progress_area_.get());
} else {
diff --git a/chrome/browser/gtk/download_item_gtk.h b/chrome/browser/gtk/download_item_gtk.h
index 8d79080..56a0890 100644
--- a/chrome/browser/gtk/download_item_gtk.h
+++ b/chrome/browser/gtk/download_item_gtk.h
@@ -10,7 +10,6 @@
#include <string>
-#include "app/animation_delegate.h"
#include "app/gtk_signal.h"
#include "base/scoped_ptr.h"
#include "base/time.h"
@@ -19,6 +18,7 @@
#include "chrome/browser/gtk/owned_widget_gtk.h"
#include "chrome/common/notification_observer.h"
#include "chrome/common/notification_registrar.h"
+#include "ui/base/animation/animation_delegate.h"
class BaseDownloadItemModel;
class DownloadShelfContextMenuGtk;
@@ -26,10 +26,13 @@ class DownloadShelfGtk;
class GtkThemeProvider;
class NineBox;
class SkBitmap;
+
+namespace ui {
class SlideAnimation;
+}
class DownloadItemGtk : public DownloadItem::Observer,
- public AnimationDelegate,
+ public ui::AnimationDelegate,
public NotificationObserver {
public:
// DownloadItemGtk takes ownership of |download_item_model|.
@@ -44,8 +47,8 @@ class DownloadItemGtk : public DownloadItem::Observer,
virtual void OnDownloadFileCompleted(DownloadItem* download) { }
virtual void OnDownloadOpened(DownloadItem* download) { }
- // AnimationDelegate implementation.
- virtual void AnimationProgressed(const Animation* animation);
+ // ui::AnimationDelegate implementation.
+ virtual void AnimationProgressed(const ui::Animation* animation);
// Overridden from NotificationObserver:
virtual void Observe(NotificationType type,
@@ -189,13 +192,13 @@ class DownloadItemGtk : public DownloadItem::Observer,
int dangerous_hbox_full_width_;
// The animation when this item is first added to the shelf.
- scoped_ptr<SlideAnimation> new_item_animation_;
+ scoped_ptr<ui::SlideAnimation> new_item_animation_;
// Progress animation.
base::RepeatingTimer<DownloadItemGtk> progress_timer_;
// Animation for download complete.
- scoped_ptr<SlideAnimation> complete_animation_;
+ scoped_ptr<ui::SlideAnimation> complete_animation_;
// The file icon for the download. May be null. The small version is used
// for display in the shelf; the large version is for use as a drag icon.
diff --git a/chrome/browser/gtk/download_started_animation_gtk.cc b/chrome/browser/gtk/download_started_animation_gtk.cc
index 5015b80..e54e1a7 100644
--- a/chrome/browser/gtk/download_started_animation_gtk.cc
+++ b/chrome/browser/gtk/download_started_animation_gtk.cc
@@ -6,7 +6,6 @@
#include <gtk/gtk.h>
-#include "app/linear_animation.h"
#include "app/resource_bundle.h"
#include "base/message_loop.h"
#include "chrome/browser/tab_contents/tab_contents.h"
@@ -14,6 +13,7 @@
#include "chrome/common/notification_source.h"
#include "gfx/rect.h"
#include "grit/theme_resources.h"
+#include "ui/base/animation/linear_animation.h"
namespace {
@@ -28,7 +28,7 @@ const int kFrameRateHz = 60;
// the frame.
const double kMoveFraction = 1.0 / 3.0;
-class DownloadStartedAnimationGtk : public LinearAnimation,
+class DownloadStartedAnimationGtk : public ui::LinearAnimation,
public NotificationObserver {
public:
explicit DownloadStartedAnimationGtk(TabContents* tab_contents);
@@ -78,7 +78,7 @@ class DownloadStartedAnimationGtk : public LinearAnimation,
DownloadStartedAnimationGtk::DownloadStartedAnimationGtk(
TabContents* tab_contents)
- : LinearAnimation(kMoveTimeMs, kFrameRateHz, NULL),
+ : ui::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 f33554a..f7fe91a 100644
--- a/chrome/browser/gtk/hover_controller_gtk.cc
+++ b/chrome/browser/gtk/hover_controller_gtk.cc
@@ -64,7 +64,7 @@ void HoverControllerGtk::Destroy() {
delete this;
}
-void HoverControllerGtk::AnimationProgressed(const Animation* animation) {
+void HoverControllerGtk::AnimationProgressed(const ui::Animation* animation) {
if (!button_)
return;
@@ -76,7 +76,7 @@ void HoverControllerGtk::AnimationProgressed(const Animation* animation) {
animation->GetCurrentValue());
}
-void HoverControllerGtk::AnimationEnded(const Animation* animation) {
+void HoverControllerGtk::AnimationEnded(const ui::Animation* animation) {
if (!button_)
return;
if (animation != &throb_animation_)
@@ -86,7 +86,7 @@ void HoverControllerGtk::AnimationEnded(const Animation* animation) {
gtk_chrome_button_set_hover_state(GTK_CHROME_BUTTON(button_), 0);
}
-void HoverControllerGtk::AnimationCanceled(const Animation* animation) {
+void HoverControllerGtk::AnimationCanceled(const ui::Animation* animation) {
AnimationEnded(animation);
}
diff --git a/chrome/browser/gtk/hover_controller_gtk.h b/chrome/browser/gtk/hover_controller_gtk.h
index 5504720..9172167 100644
--- a/chrome/browser/gtk/hover_controller_gtk.h
+++ b/chrome/browser/gtk/hover_controller_gtk.h
@@ -8,17 +8,17 @@
#include <gtk/gtk.h>
-#include "app/animation_delegate.h"
#include "app/gtk_signal.h"
#include "app/gtk_signal_registrar.h"
-#include "app/slide_animation.h"
-#include "app/throb_animation.h"
+#include "ui/base/animation/animation_delegate.h"
+#include "ui/base/animation/slide_animation.h"
+#include "ui/base/animation/throb_animation.h"
// This class handles the "throbbing" of a GtkChromeButton. The visual effect
// of throbbing is created by painting partially transparent hover effects. It
// only works in non-gtk theme mode. This class mainly exists to glue an
// AnimationDelegate (C++ class) to a GtkChromeButton* (GTK/c object).
-class HoverControllerGtk : public AnimationDelegate {
+class HoverControllerGtk : public ui::AnimationDelegate {
public:
virtual ~HoverControllerGtk();
@@ -42,10 +42,10 @@ class HoverControllerGtk : public AnimationDelegate {
private:
explicit HoverControllerGtk(GtkWidget* button);
- // Overridden from AnimationDelegate.
- virtual void AnimationProgressed(const Animation* animation);
- virtual void AnimationEnded(const Animation* animation);
- virtual void AnimationCanceled(const Animation* animation);
+ // Overridden from ui::AnimationDelegate.
+ virtual void AnimationProgressed(const ui::Animation* animation);
+ virtual void AnimationEnded(const ui::Animation* animation);
+ virtual void AnimationCanceled(const ui::Animation* animation);
CHROMEGTK_CALLBACK_1(HoverControllerGtk, gboolean, OnEnter,
GdkEventCrossing*);
@@ -55,8 +55,8 @@ class HoverControllerGtk : public AnimationDelegate {
GtkWidget*);
CHROMEGTK_CALLBACK_0(HoverControllerGtk, void, OnDestroy);
- ThrobAnimation throb_animation_;
- SlideAnimation hover_animation_;
+ ui::ThrobAnimation throb_animation_;
+ ui::SlideAnimation hover_animation_;
GtkWidget* button_;
GtkSignalRegistrar signals_;
diff --git a/chrome/browser/gtk/infobar_arrow_model.cc b/chrome/browser/gtk/infobar_arrow_model.cc
index e66bb02..fc2f889 100644
--- a/chrome/browser/gtk/infobar_arrow_model.cc
+++ b/chrome/browser/gtk/infobar_arrow_model.cc
@@ -14,7 +14,7 @@
InfoBarArrowModel::InfoBarArrowModel(Observer* observer)
: observer_(observer),
animation_(this) {
- animation_.SetTweenType(Tween::LINEAR);
+ animation_.SetTweenType(ui::Tween::LINEAR);
animation_.Reset(1.0);
target_colors_.top = target_colors_.bottom = SkColorSetARGB(0, 0, 0, 0);
previous_colors_ = target_colors_;
@@ -111,14 +111,14 @@ void InfoBarArrowModel::Paint(GtkWidget* widget,
canvas.drawPath(path, paint);
}
-void InfoBarArrowModel::AnimationEnded(const Animation* animation) {
+void InfoBarArrowModel::AnimationEnded(const ui::Animation* animation) {
observer_->PaintStateChanged();
}
-void InfoBarArrowModel::AnimationProgressed(const Animation* animation) {
+void InfoBarArrowModel::AnimationProgressed(const ui::Animation* animation) {
observer_->PaintStateChanged();
}
-void InfoBarArrowModel::AnimationCanceled(const Animation* animation) {
+void InfoBarArrowModel::AnimationCanceled(const ui::Animation* animation) {
observer_->PaintStateChanged();
}
diff --git a/chrome/browser/gtk/infobar_arrow_model.h b/chrome/browser/gtk/infobar_arrow_model.h
index 721f32b..331089b 100644
--- a/chrome/browser/gtk/infobar_arrow_model.h
+++ b/chrome/browser/gtk/infobar_arrow_model.h
@@ -7,9 +7,9 @@
#include <gtk/gtk.h>
-#include "app/animation_delegate.h"
-#include "app/slide_animation.h"
#include "third_party/skia/include/core/SkPaint.h"
+#include "ui/base/animation/animation_delegate.h"
+#include "ui/base/animation/slide_animation.h"
namespace gfx {
class Point;
@@ -19,7 +19,7 @@ class InfoBar;
// A helper class that tracks the state of an infobar arrow and provides a
// utility to draw it.
-class InfoBarArrowModel : public AnimationDelegate {
+class InfoBarArrowModel : public ui::AnimationDelegate {
public:
class Observer {
public:
@@ -44,10 +44,10 @@ class InfoBarArrowModel : public AnimationDelegate {
const gfx::Point& origin,
const GdkColor& border_color);
- // Overridden from AnimationDelegate.
- virtual void AnimationEnded(const Animation* animation);
- virtual void AnimationProgressed(const Animation* animation);
- virtual void AnimationCanceled(const Animation* animation);
+ // Overridden from ui::AnimationDelegate.
+ virtual void AnimationEnded(const ui::Animation* animation);
+ virtual void AnimationProgressed(const ui::Animation* animation);
+ virtual void AnimationCanceled(const ui::Animation* animation);
private:
// A pair of colors used to draw a gradient for an arrow.
@@ -65,7 +65,7 @@ class InfoBarArrowModel : public AnimationDelegate {
// An animation that tracks the progress of the transition from the last color
// to the new color.
- SlideAnimation animation_;
+ ui::SlideAnimation animation_;
// The color we are animating towards.
InfoBarColors target_colors_;
diff --git a/chrome/browser/gtk/notifications/balloon_view_gtk.cc b/chrome/browser/gtk/notifications/balloon_view_gtk.cc
index bbca070..edb475e 100644
--- a/chrome/browser/gtk/notifications/balloon_view_gtk.cc
+++ b/chrome/browser/gtk/notifications/balloon_view_gtk.cc
@@ -11,7 +11,6 @@
#include "app/l10n_util.h"
#include "app/resource_bundle.h"
-#include "app/slide_animation.h"
#include "base/message_loop.h"
#include "base/string_util.h"
#include "chrome/browser/browser_list.h"
@@ -43,6 +42,7 @@
#include "gfx/native_widget_types.h"
#include "grit/generated_resources.h"
#include "grit/theme_resources.h"
+#include "ui/base/animation/slide_animation.h"
namespace {
@@ -163,11 +163,11 @@ void BalloonViewImpl::RepositionToBalloon() {
anim_frame_start_ = gfx::Rect(start_x, start_y, start_w, start_h);
anim_frame_end_ = gfx::Rect(end_x, end_y, end_w, end_h);
- animation_.reset(new SlideAnimation(this));
+ animation_.reset(new ui::SlideAnimation(this));
animation_->Show();
}
-void BalloonViewImpl::AnimationProgressed(const Animation* animation) {
+void BalloonViewImpl::AnimationProgressed(const ui::Animation* animation) {
DCHECK_EQ(animation, animation_.get());
// Linear interpolation from start to end position.
diff --git a/chrome/browser/gtk/notifications/balloon_view_gtk.h b/chrome/browser/gtk/notifications/balloon_view_gtk.h
index de95e71..0db221b 100644
--- a/chrome/browser/gtk/notifications/balloon_view_gtk.h
+++ b/chrome/browser/gtk/notifications/balloon_view_gtk.h
@@ -8,7 +8,6 @@
#define CHROME_BROWSER_GTK_NOTIFICATIONS_BALLOON_VIEW_GTK_H_
#pragma once
-#include "app/animation_delegate.h"
#include "app/gtk_signal.h"
#include "base/basictypes.h"
#include "base/scoped_ptr.h"
@@ -20,6 +19,7 @@
#include "gfx/point.h"
#include "gfx/rect.h"
#include "gfx/size.h"
+#include "ui/base/animation/animation_delegate.h"
class BalloonCollection;
class CustomDrawButton;
@@ -28,14 +28,17 @@ class MenuGtk;
class NotificationDetails;
class NotificationOptionsMenuModel;
class NotificationSource;
+
+namespace ui {
class SlideAnimation;
+}
// A balloon view is the UI component for desktop notification toasts.
// It draws a border, and within the border an HTML renderer.
class BalloonViewImpl : public BalloonView,
public MenuGtk::Delegate,
public NotificationObserver,
- public AnimationDelegate {
+ public ui::AnimationDelegate {
public:
explicit BalloonViewImpl(BalloonCollection* collection);
~BalloonViewImpl();
@@ -54,8 +57,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);
// Do the delayed close work.
void DelayedClose(bool by_user);
@@ -109,7 +112,7 @@ class BalloonViewImpl : public BalloonView,
scoped_ptr<CustomDrawButton> close_button_;
// 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/gtk/slide_animator_gtk.cc b/chrome/browser/gtk/slide_animator_gtk.cc
index 0534a7c..a3ae9cc 100644
--- a/chrome/browser/gtk/slide_animator_gtk.cc
+++ b/chrome/browser/gtk/slide_animator_gtk.cc
@@ -4,10 +4,9 @@
#include "chrome/browser/gtk/slide_animator_gtk.h"
-#include "app/animation.h"
-#include "app/slide_animation.h"
-
#include "chrome/browser/gtk/gtk_expanded_container.h"
+#include "ui/base/animation/animation.h"
+#include "ui/base/animation/slide_animation.h"
namespace {
@@ -56,10 +55,10 @@ SlideAnimatorGtk::SlideAnimatorGtk(GtkWidget* child,
child_needs_move_ = (direction == DOWN);
- animation_.reset(new SlideAnimation(this));
+ animation_.reset(new ui::SlideAnimation(this));
// Default tween type is EASE_OUT.
if (linear)
- animation_->SetTweenType(Tween::LINEAR);
+ animation_->SetTweenType(ui::Tween::LINEAR);
if (duration != 0)
animation_->SetSlideDuration(duration);
}
@@ -113,7 +112,7 @@ bool SlideAnimatorGtk::IsAnimating() {
return animation_->is_animating();
}
-void SlideAnimatorGtk::AnimationProgressed(const Animation* animation) {
+void SlideAnimatorGtk::AnimationProgressed(const ui::Animation* animation) {
GtkRequisition req;
gtk_widget_size_request(child_, &req);
@@ -127,7 +126,7 @@ void SlideAnimatorGtk::AnimationProgressed(const Animation* animation) {
gtk_widget_set_size_request(widget_.get(), -1, showing_height);
}
-void SlideAnimatorGtk::AnimationEnded(const Animation* animation) {
+void SlideAnimatorGtk::AnimationEnded(const ui::Animation* animation) {
if (!animation_->IsShowing()) {
gtk_widget_hide(widget_.get());
if (delegate_)
diff --git a/chrome/browser/gtk/slide_animator_gtk.h b/chrome/browser/gtk/slide_animator_gtk.h
index 8028367..b0f5c73 100644
--- a/chrome/browser/gtk/slide_animator_gtk.h
+++ b/chrome/browser/gtk/slide_animator_gtk.h
@@ -17,13 +17,15 @@
#include <gtk/gtk.h>
-#include "app/animation_delegate.h"
#include "base/scoped_ptr.h"
#include "chrome/browser/gtk/owned_widget_gtk.h"
+#include "ui/base/animation/animation_delegate.h"
+namespace ui {
class SlideAnimation;
+}
-class SlideAnimatorGtk : public AnimationDelegate {
+class SlideAnimatorGtk : public ui::AnimationDelegate {
public:
class Delegate {
public:
@@ -82,9 +84,9 @@ class SlideAnimatorGtk : public AnimationDelegate {
// animation.
bool IsAnimating();
- // 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);
// Used during testing; disable or enable animations (default is enabled).
static void SetAnimationsForTesting(bool enable);
@@ -94,7 +96,7 @@ class SlideAnimatorGtk : public AnimationDelegate {
GtkAllocation* allocation,
SlideAnimatorGtk* slider);
- scoped_ptr<SlideAnimation> animation_;
+ scoped_ptr<ui::SlideAnimation> animation_;
// The top level widget of the SlideAnimatorGtk. It is a GtkFixed.
OwnedWidgetGtk widget_;
diff --git a/chrome/browser/gtk/status_bubble_gtk.cc b/chrome/browser/gtk/status_bubble_gtk.cc
index 08eab1a..1dd95a6 100644
--- a/chrome/browser/gtk/status_bubble_gtk.cc
+++ b/chrome/browser/gtk/status_bubble_gtk.cc
@@ -8,7 +8,6 @@
#include <algorithm>
-#include "app/slide_animation.h"
#include "app/text_elider.h"
#include "base/i18n/rtl.h"
#include "base/message_loop.h"
@@ -18,6 +17,7 @@
#include "chrome/browser/gtk/rounded_window.h"
#include "chrome/browser/gtk/slide_animator_gtk.h"
#include "chrome/common/notification_service.h"
+#include "ui/base/animation/slide_animation.h"
namespace {
@@ -315,8 +315,8 @@ void StatusBubbleGtk::SetFlipHorizontally(bool flip_horizontally) {
void StatusBubbleGtk::ExpandURL() {
start_width_ = label_->allocation.width;
- expand_animation_.reset(new SlideAnimation(this));
- expand_animation_->SetTweenType(Tween::LINEAR);
+ expand_animation_.reset(new ui::SlideAnimation(this));
+ expand_animation_->SetTweenType(ui::Tween::LINEAR);
expand_animation_->Show();
SetStatusTextToURL();
@@ -339,10 +339,10 @@ gboolean StatusBubbleGtk::HandleMotionNotify(GtkWidget* sender,
return FALSE;
}
-void StatusBubbleGtk::AnimationEnded(const Animation* animation) {
+void StatusBubbleGtk::AnimationEnded(const ui::Animation* animation) {
UpdateLabelSizeRequest();
}
-void StatusBubbleGtk::AnimationProgressed(const Animation* animation) {
+void StatusBubbleGtk::AnimationProgressed(const ui::Animation* animation) {
UpdateLabelSizeRequest();
}
diff --git a/chrome/browser/gtk/status_bubble_gtk.h b/chrome/browser/gtk/status_bubble_gtk.h
index 82253d4..859383b 100644
--- a/chrome/browser/gtk/status_bubble_gtk.h
+++ b/chrome/browser/gtk/status_bubble_gtk.h
@@ -10,7 +10,6 @@
#include <string>
-#include "app/animation_delegate.h"
#include "app/gtk_signal.h"
#include "base/scoped_ptr.h"
#include "base/timer.h"
@@ -20,10 +19,14 @@
#include "chrome/common/notification_registrar.h"
#include "gfx/point.h"
#include "googleurl/src/gurl.h"
+#include "ui/base/animation/animation_delegate.h"
class GtkThemeProvider;
class Profile;
+
+namespace ui {
class SlideAnimation;
+}
// GTK implementation of StatusBubble. Unlike Windows, our status bubble
// doesn't have the nice leave-the-window effect since we can't rely on the
@@ -31,7 +34,7 @@ class SlideAnimation;
// We therefore position it absolutely in a GtkFixed, that we don't own.
class StatusBubbleGtk : public StatusBubble,
public NotificationObserver,
- public AnimationDelegate {
+ public ui::AnimationDelegate {
public:
explicit StatusBubbleGtk(Profile* profile);
virtual ~StatusBubbleGtk();
@@ -45,9 +48,9 @@ class StatusBubbleGtk : public StatusBubble,
virtual void Hide();
virtual void MouseMoved(const gfx::Point& location, bool left_content);
- // AnimationDelegate implementation.
- virtual void AnimationEnded(const Animation* animation);
- virtual void AnimationProgressed(const Animation* animation);
+ // ui::AnimationDelegate implementation.
+ virtual void AnimationEnded(const ui::Animation* animation);
+ virtual void AnimationProgressed(const ui::Animation* animation);
// Called when the download shelf becomes visible or invisible.
// This is used by to ensure that the status bubble does not obscure
@@ -139,7 +142,7 @@ class StatusBubbleGtk : public StatusBubble,
base::OneShotTimer<StatusBubbleGtk> expand_timer_;
// The animation for resizing the status bubble on long hovers.
- scoped_ptr<SlideAnimation> expand_animation_;
+ scoped_ptr<ui::SlideAnimation> expand_animation_;
// The start and end width of the current resize animation.
int start_width_;
diff --git a/chrome/browser/gtk/tabs/dragged_tab_gtk.cc b/chrome/browser/gtk/tabs/dragged_tab_gtk.cc
index a1fda13..299f183 100644
--- a/chrome/browser/gtk/tabs/dragged_tab_gtk.cc
+++ b/chrome/browser/gtk/tabs/dragged_tab_gtk.cc
@@ -126,7 +126,7 @@ void DraggedTabGtk::AnimateToBounds(const gfx::Rect& bounds,
animation_end_bounds_ = bounds;
close_animation_.SetSlideDuration(kAnimateToBoundsDurationMs);
- close_animation_.SetTweenType(Tween::EASE_OUT);
+ close_animation_.SetTweenType(ui::Tween::EASE_OUT);
if (!close_animation_.IsShowing()) {
close_animation_.Reset();
close_animation_.Show();
@@ -134,9 +134,9 @@ void DraggedTabGtk::AnimateToBounds(const gfx::Rect& bounds,
}
////////////////////////////////////////////////////////////////////////////////
-// DraggedTabGtk, AnimationDelegate implementation:
+// DraggedTabGtk, ui::AnimationDelegate implementation:
-void DraggedTabGtk::AnimationProgressed(const Animation* animation) {
+void DraggedTabGtk::AnimationProgressed(const ui::Animation* animation) {
int delta_x = (animation_end_bounds_.x() - animation_start_bounds_.x());
int x = animation_start_bounds_.x() +
static_cast<int>(delta_x * animation->GetCurrentValue());
@@ -144,11 +144,11 @@ void DraggedTabGtk::AnimationProgressed(const Animation* animation) {
gdk_window_move(container_->window, x, y);
}
-void DraggedTabGtk::AnimationEnded(const Animation* animation) {
+void DraggedTabGtk::AnimationEnded(const ui::Animation* animation) {
animation_callback_->Run();
}
-void DraggedTabGtk::AnimationCanceled(const Animation* animation) {
+void DraggedTabGtk::AnimationCanceled(const ui::Animation* animation) {
AnimationEnded(animation);
}
diff --git a/chrome/browser/gtk/tabs/dragged_tab_gtk.h b/chrome/browser/gtk/tabs/dragged_tab_gtk.h
index 6d7fcc4..ae4c0f1 100644
--- a/chrome/browser/gtk/tabs/dragged_tab_gtk.h
+++ b/chrome/browser/gtk/tabs/dragged_tab_gtk.h
@@ -8,8 +8,6 @@
#include <gtk/gtk.h>
-#include "app/animation_delegate.h"
-#include "app/slide_animation.h"
#include "base/callback.h"
#include "base/scoped_ptr.h"
#include "base/task.h"
@@ -17,11 +15,13 @@
#include "gfx/point.h"
#include "gfx/rect.h"
#include "gfx/size.h"
+#include "ui/base/animation/animation_delegate.h"
+#include "ui/base/animation/slide_animation.h"
class TabContents;
class TabRendererGtk;
-class DraggedTabGtk : public AnimationDelegate {
+class DraggedTabGtk : public ui::AnimationDelegate {
public:
DraggedTabGtk(TabContents* datasource,
const gfx::Point& mouse_tab_offset,
@@ -63,10 +63,10 @@ class DraggedTabGtk : public AnimationDelegate {
GtkWidget* widget() const { return container_; }
private:
- // Overridden from AnimationDelegate:
- virtual void AnimationProgressed(const Animation* animation);
- virtual void AnimationEnded(const Animation* animation);
- virtual void AnimationCanceled(const Animation* animation);
+ // Overridden from ui::AnimationDelegate:
+ virtual void AnimationProgressed(const ui::Animation* animation);
+ virtual void AnimationEnded(const ui::Animation* animation);
+ virtual void AnimationCanceled(const ui::Animation* animation);
// Arranges the contents of the dragged tab.
void Layout();
@@ -132,7 +132,7 @@ class DraggedTabGtk : public AnimationDelegate {
gfx::Size contents_size_;
// The animation used to slide the attached tab to its final location.
- SlideAnimation close_animation_;
+ ui::SlideAnimation close_animation_;
// A callback notified when the animation is complete.
scoped_ptr<Callback0::Type> animation_callback_;
diff --git a/chrome/browser/gtk/tabs/tab_renderer_gtk.cc b/chrome/browser/gtk/tabs/tab_renderer_gtk.cc
index 52ab163..b3f1c91 100644
--- a/chrome/browser/gtk/tabs/tab_renderer_gtk.cc
+++ b/chrome/browser/gtk/tabs/tab_renderer_gtk.cc
@@ -9,8 +9,6 @@
#include "app/l10n_util.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/gtk/bookmark_utils_gtk.h"
@@ -28,6 +26,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"
namespace {
@@ -205,16 +205,16 @@ void TabRendererGtk::LoadingAnimation::Observe(
// FaviconCrashAnimation
//
// A custom animation subclass to manage the favicon crash animation.
-class TabRendererGtk::FavIconCrashAnimation : public LinearAnimation,
- public AnimationDelegate {
+class TabRendererGtk::FavIconCrashAnimation : public ui::LinearAnimation,
+ public ui::AnimationDelegate {
public:
explicit FavIconCrashAnimation(TabRendererGtk* 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;
@@ -229,8 +229,8 @@ class TabRendererGtk::FavIconCrashAnimation : public LinearAnimation,
}
}
- // AnimationDelegate overrides:
- virtual void AnimationCanceled(const Animation* animation) {
+ // ui::AnimationDelegate overrides:
+ virtual void AnimationCanceled(const ui::Animation* animation) {
target_->SetFavIconHidingOffset(0);
}
@@ -263,7 +263,7 @@ TabRendererGtk::TabRendererGtk(ThemeProvider* theme_provider)
close_button_.reset(MakeCloseButton());
gtk_widget_show(tab_.get());
- hover_animation_.reset(new SlideAnimation(this));
+ hover_animation_.reset(new ui::SlideAnimation(this));
hover_animation_->SetSlideDuration(kHoverDurationMs);
registrar_.Add(this, NotificationType::BROWSER_THEME_CHANGED,
@@ -520,7 +520,7 @@ gfx::Rect TabRendererGtk::GetRequisition() const {
void TabRendererGtk::StartMiniTabTitleAnimation() {
if (!mini_title_animation_.get()) {
- mini_title_animation_.reset(new ThrobAnimation(this));
+ mini_title_animation_.reset(new ui::ThrobAnimation(this));
mini_title_animation_->SetThrobDuration(kMiniTitleChangeThrobDuration);
}
@@ -567,17 +567,17 @@ string16 TabRendererGtk::GetTitle() const {
}
///////////////////////////////////////////////////////////////////////////////
-// TabRendererGtk, AnimationDelegate implementation:
+// TabRendererGtk, ui::AnimationDelegate implementation:
-void TabRendererGtk::AnimationProgressed(const Animation* animation) {
+void TabRendererGtk::AnimationProgressed(const ui::Animation* animation) {
gtk_widget_queue_draw(tab_.get());
}
-void TabRendererGtk::AnimationCanceled(const Animation* animation) {
+void TabRendererGtk::AnimationCanceled(const ui::Animation* animation) {
AnimationEnded(animation);
}
-void TabRendererGtk::AnimationEnded(const Animation* animation) {
+void TabRendererGtk::AnimationEnded(const ui::Animation* animation) {
gtk_widget_queue_draw(tab_.get());
}
@@ -1052,14 +1052,14 @@ void TabRendererGtk::OnSizeAllocate(GtkWidget* widget,
gboolean TabRendererGtk::OnEnterNotifyEvent(GtkWidget* widget,
GdkEventCrossing* event) {
- hover_animation_->SetTweenType(Tween::EASE_OUT);
+ hover_animation_->SetTweenType(ui::Tween::EASE_OUT);
hover_animation_->Show();
return FALSE;
}
gboolean TabRendererGtk::OnLeaveNotifyEvent(GtkWidget* widget,
GdkEventCrossing* event) {
- hover_animation_->SetTweenType(Tween::EASE_IN);
+ hover_animation_->SetTweenType(ui::Tween::EASE_IN);
hover_animation_->Hide();
return FALSE;
}
diff --git a/chrome/browser/gtk/tabs/tab_renderer_gtk.h b/chrome/browser/gtk/tabs/tab_renderer_gtk.h
index 8ec952f..0593e68 100644
--- a/chrome/browser/gtk/tabs/tab_renderer_gtk.h
+++ b/chrome/browser/gtk/tabs/tab_renderer_gtk.h
@@ -9,7 +9,6 @@
#include <gtk/gtk.h>
#include <map>
-#include "app/animation_delegate.h"
#include "app/gtk_signal.h"
#include "base/basictypes.h"
#include "base/scoped_ptr.h"
@@ -21,6 +20,7 @@
#include "gfx/font.h"
#include "gfx/rect.h"
#include "third_party/skia/include/core/SkBitmap.h"
+#include "ui/base/animation/animation_delegate.h"
namespace gfx {
class Size;
@@ -28,12 +28,15 @@ class Size;
class CustomDrawButton;
class GtkThemeProvider;
-class SlideAnimation;
class TabContents;
class ThemeProvider;
+
+namespace ui {
+class SlideAnimation;
class ThrobAnimation;
+}
-class TabRendererGtk : public AnimationDelegate,
+class TabRendererGtk : public ui::AnimationDelegate,
public NotificationObserver {
public:
// Possible animation states.
@@ -288,10 +291,10 @@ class TabRendererGtk : public AnimationDelegate,
int y_offset;
};
- // Overridden from AnimationDelegate:
- virtual void AnimationProgressed(const Animation* animation);
- virtual void AnimationCanceled(const Animation* animation);
- virtual void AnimationEnded(const Animation* animation);
+ // Overridden from ui::AnimationDelegate:
+ virtual void AnimationProgressed(const ui::Animation* animation);
+ virtual void AnimationCanceled(const ui::Animation* animation);
+ virtual void AnimationEnded(const ui::Animation* animation);
// Starts/Stops the crash animation.
void StartCrashAnimation();
@@ -420,10 +423,10 @@ class TabRendererGtk : public AnimationDelegate,
gfx::Rect requisition_;
// Hover animation.
- scoped_ptr<SlideAnimation> hover_animation_;
+ scoped_ptr<ui::SlideAnimation> hover_animation_;
// Animation used when the title of an inactive mini-tab changes.
- scoped_ptr<ThrobAnimation> mini_title_animation_;
+ scoped_ptr<ui::ThrobAnimation> mini_title_animation_;
// Contains the loading animation state.
LoadingAnimation loading_animation_;
diff --git a/chrome/browser/gtk/tabs/tab_strip_gtk.cc b/chrome/browser/gtk/tabs/tab_strip_gtk.cc
index 4c307d8..8cadca9 100644
--- a/chrome/browser/gtk/tabs/tab_strip_gtk.cc
+++ b/chrome/browser/gtk/tabs/tab_strip_gtk.cc
@@ -6,10 +6,8 @@
#include <algorithm>
-#include "app/animation_delegate.h"
#include "app/gtk_dnd_util.h"
#include "app/resource_bundle.h"
-#include "app/slide_animation.h"
#include "base/i18n/rtl.h"
#include "base/string_util.h"
#include "base/utf_string_conversions.h"
@@ -34,6 +32,8 @@
#include "gfx/point.h"
#include "grit/app_resources.h"
#include "grit/theme_resources.h"
+#include "ui/base/animation/animation_delegate.h"
+#include "ui/base/animation/slide_animation.h"
namespace {
@@ -107,7 +107,7 @@ bool GdkRectMatchesTabFavIconBounds(const GdkRectangle& gdk_rect, TabGtk* tab) {
//
// A base class for all TabStrip animations.
//
-class TabStripGtk::TabAnimation : public AnimationDelegate {
+class TabStripGtk::TabAnimation : public ui::AnimationDelegate {
public:
friend class TabStripGtk;
@@ -137,7 +137,7 @@ class TabStripGtk::TabAnimation : public AnimationDelegate {
void Start() {
animation_.SetSlideDuration(GetDuration());
- animation_.SetTweenType(Tween::EASE_OUT);
+ animation_.SetTweenType(ui::Tween::EASE_OUT);
if (!animation_.IsShowing()) {
animation_.Reset();
animation_.Show();
@@ -176,17 +176,17 @@ class TabStripGtk::TabAnimation : public AnimationDelegate {
return tab_width;
}
- // Overridden from AnimationDelegate:
- virtual void AnimationProgressed(const Animation* animation) {
+ // Overridden from ui::AnimationDelegate:
+ virtual void AnimationProgressed(const ui::Animation* animation) {
tabstrip_->AnimationLayout(end_unselected_width_);
}
- virtual void AnimationEnded(const Animation* animation) {
+ virtual void AnimationEnded(const ui::Animation* animation) {
tabstrip_->FinishAnimation(this, layout_on_completion_);
// This object is destroyed now, so we can't do anything else after this.
}
- virtual void AnimationCanceled(const Animation* animation) {
+ virtual void AnimationCanceled(const ui::Animation* animation) {
AnimationEnded(animation);
}
@@ -234,7 +234,7 @@ class TabStripGtk::TabAnimation : public AnimationDelegate {
}
TabStripGtk* tabstrip_;
- SlideAnimation animation_;
+ ui::SlideAnimation animation_;
double start_selected_width_;
double start_unselected_width_;
@@ -388,7 +388,7 @@ class RemoveTabAnimation : public TabStripGtk::TabAnimation {
return start_unselected_width_ + (delta * animation_.GetCurrentValue());
}
- virtual void AnimationEnded(const Animation* animation) {
+ virtual void AnimationEnded(const ui::Animation* animation) {
tabstrip_->RemoveTabAt(index_);
TabStripGtk::TabAnimation::AnimationEnded(animation);
}
@@ -418,8 +418,8 @@ class MoveTabAnimation : public TabStripGtk::TabAnimation {
}
virtual ~MoveTabAnimation() {}
- // Overridden from AnimationDelegate:
- virtual void AnimationProgressed(const Animation* animation) {
+ // Overridden from ui::AnimationDelegate:
+ virtual void AnimationProgressed(const ui::Animation* animation) {
// Position Tab A
double distance = start_tab_b_bounds_.x() - start_tab_a_bounds_.x();
double delta = distance * animation_.GetCurrentValue();
@@ -469,8 +469,8 @@ class ResizeLayoutAnimation : public TabStripGtk::TabAnimation {
}
virtual ~ResizeLayoutAnimation() {}
- // Overridden from AnimationDelegate:
- virtual void AnimationEnded(const Animation* animation) {
+ // Overridden from ui::AnimationDelegate:
+ virtual void AnimationEnded(const ui::Animation* animation) {
tabstrip_->needs_resize_layout_ = false;
TabStripGtk::TabAnimation::AnimationEnded(animation);
}
@@ -603,8 +603,8 @@ class MiniMoveAnimation : public TabStripGtk::TabAnimation {
tab_->set_animating_mini_change(true);
}
- // Overridden from AnimationDelegate:
- virtual void AnimationProgressed(const Animation* animation) {
+ // Overridden from ui::AnimationDelegate:
+ virtual void AnimationProgressed(const ui::Animation* animation) {
// Do the normal layout.
TabAnimation::AnimationProgressed(animation);
@@ -618,7 +618,7 @@ class MiniMoveAnimation : public TabStripGtk::TabAnimation {
tabstrip_->SetTabBounds(tab_, tab_bounds);
}
- virtual void AnimationEnded(const Animation* animation) {
+ virtual void AnimationEnded(const ui::Animation* animation) {
tabstrip_->needs_resize_layout_ = false;
TabStripGtk::TabAnimation::AnimationEnded(animation);
}
diff --git a/chrome/browser/gtk/translate/translate_infobar_base_gtk.cc b/chrome/browser/gtk/translate/translate_infobar_base_gtk.cc
index 5560662..3d78de4 100644
--- a/chrome/browser/gtk/translate/translate_infobar_base_gtk.cc
+++ b/chrome/browser/gtk/translate/translate_infobar_base_gtk.cc
@@ -5,7 +5,6 @@
#include "chrome/browser/gtk/translate/translate_infobar_base_gtk.h"
#include "app/l10n_util.h"
-#include "app/slide_animation.h"
#include "base/utf_string_conversions.h"
#include "chrome/browser/translate/options_menu_model.h"
#include "chrome/browser/translate/translate_infobar_delegate.h"
@@ -16,6 +15,7 @@
#include "chrome/browser/gtk/menu_gtk.h"
#include "gfx/canvas.h"
#include "grit/generated_resources.h"
+#include "ui/base/animation/slide_animation.h"
namespace {
@@ -35,8 +35,8 @@ TranslateInfoBarBase::TranslateInfoBarBase(TranslateInfoBarDelegate* delegate)
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();
@@ -117,7 +117,7 @@ void TranslateInfoBarBase::GetBottomColor(InfoBarDelegate::Type type,
}
}
-void TranslateInfoBarBase::AnimationProgressed(const Animation* animation) {
+void TranslateInfoBarBase::AnimationProgressed(const ui::Animation* animation) {
DCHECK(animation == background_color_animation_.get());
background_error_percent_ = animation->GetCurrentValue();
// Queue the info bar widget for redisplay so it repaints its background.
diff --git a/chrome/browser/gtk/translate/translate_infobar_base_gtk.h b/chrome/browser/gtk/translate/translate_infobar_base_gtk.h
index ae147ca..6adf98a 100644
--- a/chrome/browser/gtk/translate/translate_infobar_base_gtk.h
+++ b/chrome/browser/gtk/translate/translate_infobar_base_gtk.h
@@ -6,9 +6,9 @@
#define CHROME_BROWSER_GTK_TRANSLATE_TRANSLATE_INFOBAR_BASE_GTK_H_
#pragma once
-#include "app/animation_delegate.h"
#include "chrome/browser/translate/translate_infobar_view.h"
#include "chrome/browser/gtk/infobar_gtk.h"
+#include "ui/base/animation/animation_delegate.h"
class MenuGtk;
class OptionsMenuModel;
@@ -18,7 +18,7 @@ class TranslateInfoBarDelegate;
// use.
class TranslateInfoBarBase : public TranslateInfoBarView,
public InfoBar,
- public AnimationDelegate {
+ public ui::AnimationDelegate {
public:
explicit TranslateInfoBarBase(TranslateInfoBarDelegate* delegate);
virtual ~TranslateInfoBarBase();
@@ -37,8 +37,8 @@ class TranslateInfoBarBase : public TranslateInfoBarView,
virtual void OriginalLanguageChanged() {}
virtual void TargetLanguageChanged() {}
- // Overridden from AnimationDelegate:
- virtual void AnimationProgressed(const Animation* animation);
+ // Overridden from ui::AnimationDelegate:
+ virtual void AnimationProgressed(const ui::Animation* animation);
protected:
// Sub-classes that want to have the options menu button showing sould
@@ -81,7 +81,7 @@ class TranslateInfoBarBase : public TranslateInfoBarView,
double background_error_percent_;
// Changes the color of the background from normal to error color and back.
- scoped_ptr<SlideAnimation> background_color_animation_;
+ scoped_ptr<ui::SlideAnimation> background_color_animation_;
DISALLOW_COPY_AND_ASSIGN(TranslateInfoBarBase);
};
diff --git a/chrome/browser/renderer_host/render_widget_host_view_gtk.cc b/chrome/browser/renderer_host/render_widget_host_view_gtk.cc
index 1616378..2d10e4e 100644
--- a/chrome/browser/renderer_host/render_widget_host_view_gtk.cc
+++ b/chrome/browser/renderer_host/render_widget_host_view_gtk.cc
@@ -1106,15 +1106,17 @@ void RenderWidgetHostViewGtk::ForwardKeyboardEvent(
host_->ForwardKeyboardEvent(event);
}
-void RenderWidgetHostViewGtk::AnimationEnded(const Animation* animation) {
+void RenderWidgetHostViewGtk::AnimationEnded(const ui::Animation* animation) {
gtk_widget_queue_draw(view_.get());
}
-void RenderWidgetHostViewGtk::AnimationProgressed(const Animation* animation) {
+void RenderWidgetHostViewGtk::AnimationProgressed(
+ const ui::Animation* animation) {
gtk_widget_queue_draw(view_.get());
}
-void RenderWidgetHostViewGtk::AnimationCanceled(const Animation* animation) {
+void RenderWidgetHostViewGtk::AnimationCanceled(
+ const ui::Animation* animation) {
gtk_widget_queue_draw(view_.get());
}
diff --git a/chrome/browser/renderer_host/render_widget_host_view_gtk.h b/chrome/browser/renderer_host/render_widget_host_view_gtk.h
index 2c47c01..fcc5e75 100644
--- a/chrome/browser/renderer_host/render_widget_host_view_gtk.h
+++ b/chrome/browser/renderer_host/render_widget_host_view_gtk.h
@@ -11,14 +11,14 @@
#include <vector>
#include <string>
-#include "app/animation_delegate.h"
-#include "app/slide_animation.h"
#include "base/scoped_ptr.h"
#include "base/time.h"
#include "chrome/browser/gtk/owned_widget_gtk.h"
#include "chrome/browser/renderer_host/render_widget_host_view.h"
#include "gfx/native_widget_types.h"
#include "gfx/rect.h"
+#include "ui/base/animation/animation_delegate.h"
+#include "ui/base/animation/slide_animation.h"
#include "webkit/glue/webcursor.h"
#include "webkit/plugins/npapi/gtk_plugin_container_manager.h"
@@ -43,7 +43,7 @@ typedef struct _GtkSelectionData GtkSelectionData;
// See comments in render_widget_host_view.h about this class and its members.
// -----------------------------------------------------------------------------
class RenderWidgetHostViewGtk : public RenderWidgetHostView,
- public AnimationDelegate {
+ public ui::AnimationDelegate {
public:
explicit RenderWidgetHostViewGtk(RenderWidgetHost* widget);
~RenderWidgetHostViewGtk();
@@ -92,10 +92,10 @@ class RenderWidgetHostViewGtk : public RenderWidgetHostView,
virtual bool ContainsNativeView(gfx::NativeView native_view) const;
virtual void AcceleratedCompositingActivated(bool activated);
- // AnimationDelegate implementation.
- virtual void AnimationEnded(const Animation* animation);
- virtual void AnimationProgressed(const Animation* animation);
- virtual void AnimationCanceled(const Animation* animation);
+ // ui::AnimationDelegate implementation.
+ virtual void AnimationEnded(const ui::Animation* animation);
+ virtual void AnimationProgressed(const ui::Animation* animation);
+ virtual void AnimationCanceled(const ui::Animation* animation);
gfx::NativeView native_view() const { return view_.get(); }
@@ -179,7 +179,7 @@ class RenderWidgetHostViewGtk : public RenderWidgetHostView,
// The animation used for the abovementioned shade effect. The animation's
// value affects the alpha we use for |overlay_color_|.
- SlideAnimation overlay_animation_;
+ ui::SlideAnimation overlay_animation_;
// Variables used only for popups --------------------------------------------
// Our parent widget.
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"
diff --git a/chrome/chrome.gyp b/chrome/chrome.gyp
index 5d294f4..a466ca4 100644
--- a/chrome/chrome.gyp
+++ b/chrome/chrome.gyp
@@ -1663,6 +1663,7 @@
'../third_party/qcms/qcms.gyp:*',
'../third_party/sqlite/sqlite.gyp:*',
'../third_party/zlib/zlib.gyp:*',
+ '../ui/ui.gyp:*',
'../webkit/support/webkit_support.gyp:*',
'../webkit/webkit.gyp:*',
diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi
index e01b64e..48fcf77 100644
--- a/chrome/chrome_browser.gypi
+++ b/chrome/chrome_browser.gypi
@@ -40,6 +40,7 @@
'../third_party/npapi/npapi.gyp:npapi',
'../third_party/hunspell/hunspell.gyp:hunspell',
'../third_party/speex/speex.gyp:libspeex',
+ '../ui/ui.gyp:ui_base',
'../webkit/support/webkit_support.gyp:appcache',
'../webkit/support/webkit_support.gyp:blob',
'../webkit/support/webkit_support.gyp:database',
diff --git a/app/animation.cc b/ui/base/animation/animation.cc
index ff20117..1824774 100644
--- a/app/animation.cc
+++ b/ui/base/animation/animation.cc
@@ -1,18 +1,20 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
-#include "app/animation.h"
+#include "ui/base/animation/animation.h"
-#include "app/animation_container.h"
-#include "app/animation_delegate.h"
-#include "app/tween.h"
#include "gfx/rect.h"
+#include "ui/base/animation/animation_container.h"
+#include "ui/base/animation/animation_delegate.h"
+#include "ui/base/animation/tween.h"
#if defined(OS_WIN)
#include "base/win/windows_version.h"
#endif
+namespace ui {
+
Animation::Animation(base::TimeDelta timer_interval)
: timer_interval_(timer_interval),
is_animating_(false),
@@ -118,3 +120,5 @@ void Animation::SetStartTime(base::TimeTicks start_time) {
base::TimeDelta Animation::GetTimerInterval() const {
return timer_interval_;
}
+
+} // namespace ui
diff --git a/ui/base/animation/animation.h b/ui/base/animation/animation.h
new file mode 100644
index 0000000..bb4be5a
--- /dev/null
+++ b/ui/base/animation/animation.h
@@ -0,0 +1,109 @@
+// Copyright (c) 2011 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.
+
+#ifndef UI_BASE_ANIMATION_ANIMATION_H_
+#define UI_BASE_ANIMATION_ANIMATION_H_
+#pragma once
+
+#include "base/ref_counted.h"
+#include "base/time.h"
+#include "ui/base/animation/animation_container_element.h"
+
+namespace gfx {
+class Rect;
+}
+
+namespace ui {
+
+class AnimationContainer;
+class AnimationDelegate;
+
+// Base class used in implementing animations. You only need use this class if
+// you're implementing a new animation type, otherwise you'll likely want one of
+// LinearAnimation, SlideAnimation, ThrobAnimation or MultiAnimation.
+//
+// To subclass override Step, which is invoked as the animation progresses and
+// GetCurrentValue() to return the value appropriate to the animation.
+class Animation : public AnimationContainerElement {
+ public:
+ explicit Animation(base::TimeDelta timer_interval);
+ virtual ~Animation();
+
+ // Starts the animation. Does nothing if the animation is already running.
+ void Start();
+
+ // Stops the animation. Does nothing if the animation is not running.
+ void Stop();
+
+ // Gets the value for the current state, according to the animation
+ // curve in use.
+ virtual double GetCurrentValue() const = 0;
+
+ // Convenience for returning a value between |start| and |target| based on
+ // the current value. This is (target - start) * GetCurrentValue() + start.
+ double CurrentValueBetween(double start, double target) const;
+ int CurrentValueBetween(int start, int target) const;
+ gfx::Rect CurrentValueBetween(const gfx::Rect& start_bounds,
+ const gfx::Rect& target_bounds) const;
+
+ // Sets the delegate.
+ void set_delegate(AnimationDelegate* delegate) { delegate_ = delegate; }
+
+ // Sets the container used to manage the timer. A value of NULL results in
+ // creating a new AnimationContainer.
+ void SetContainer(AnimationContainer* container);
+
+ bool is_animating() const { return is_animating_; }
+
+ base::TimeDelta timer_interval() const { return timer_interval_; }
+
+ // Returns true if rich animations should be rendered.
+ // Looks at session type (e.g. remote desktop) and accessibility settings
+ // to give guidance for heavy animations such as "start download" arrow.
+ static bool ShouldRenderRichAnimation();
+
+ protected:
+ // Invoked from Start to allow subclasses to prepare for the animation.
+ virtual void AnimationStarted() {}
+
+ // Invoked from Stop after we're removed from the container but before the
+ // delegate has been invoked.
+ virtual void AnimationStopped() {}
+
+ // Invoked from stop to determine if cancel should be invoked. If this returns
+ // true the delegate is notified the animation was canceled, otherwise the
+ // delegate is notified the animation stopped.
+ virtual bool ShouldSendCanceledFromStop();
+
+ AnimationContainer* container() { return container_.get(); }
+ base::TimeTicks start_time() const { return start_time_; }
+ AnimationDelegate* delegate() { return delegate_; }
+
+ // AnimationContainer::Element overrides
+ virtual void SetStartTime(base::TimeTicks start_time);
+ virtual void Step(base::TimeTicks time_now) = 0;
+ virtual base::TimeDelta GetTimerInterval() const;
+
+ private:
+ // Interval for the animation.
+ const base::TimeDelta timer_interval_;
+
+ // If true we're running.
+ bool is_animating_;
+
+ // Our delegate; may be null.
+ AnimationDelegate* delegate_;
+
+ // Container we're in. If non-null we're animating.
+ scoped_refptr<AnimationContainer> container_;
+
+ // Time we started at.
+ base::TimeTicks start_time_;
+
+ DISALLOW_COPY_AND_ASSIGN(Animation);
+};
+
+} // namespace ui
+
+#endif // UI_BASE_ANIMATION_ANIMATION_H_
diff --git a/app/animation_container.cc b/ui/base/animation/animation_container.cc
index cba3d4b..1e316cd 100644
--- a/app/animation_container.cc
+++ b/ui/base/animation/animation_container.cc
@@ -1,15 +1,17 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
-#include "app/animation_container.h"
+#include "ui/base/animation/animation_container.h"
-#include "app/animation_container_element.h"
-#include "app/animation_container_observer.h"
+#include "ui/base/animation/animation_container_element.h"
+#include "ui/base/animation/animation_container_observer.h"
using base::TimeDelta;
using base::TimeTicks;
+namespace ui {
+
AnimationContainer::AnimationContainer()
: last_tick_time_(TimeTicks::Now()),
observer_(NULL) {
@@ -98,3 +100,5 @@ TimeDelta AnimationContainer::GetMinInterval() {
}
return min;
}
+
+} // namespace ui
diff --git a/ui/base/animation/animation_container.h b/ui/base/animation/animation_container.h
new file mode 100644
index 0000000..337b421
--- /dev/null
+++ b/ui/base/animation/animation_container.h
@@ -0,0 +1,90 @@
+// Copyright (c) 2011 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.
+
+#ifndef UI_BASE_ANIMATION_ANIMATION_CONTAINER_H_
+#define UI_BASE_ANIMATION_ANIMATION_CONTAINER_H_
+#pragma once
+
+#include <set>
+
+#include "base/ref_counted.h"
+#include "base/time.h"
+#include "base/timer.h"
+
+namespace ui {
+
+class AnimationContainerElement;
+class AnimationContainerObserver;
+
+// AnimationContainer is used by Animation to manage the underlying timer.
+// Internally each Animation creates a single AnimationContainer. You can
+// group a set of Animations into the same AnimationContainer by way of
+// Animation::SetContainer. Grouping a set of Animations into the same
+// AnimationContainer ensures they all update and start at the same time.
+//
+// AnimationContainer is ref counted. Each Animation contained within the
+// AnimationContainer own it.
+class AnimationContainer : public base::RefCounted<AnimationContainer> {
+ public:
+ AnimationContainer();
+
+ // Invoked by Animation when it needs to start. Starts the timer if necessary.
+ // NOTE: This is invoked by Animation for you, you shouldn't invoke this
+ // directly.
+ void Start(AnimationContainerElement* animation);
+
+ // Invoked by Animation when it needs to stop. If there are no more animations
+ // running the timer stops.
+ // NOTE: This is invoked by Animation for you, you shouldn't invoke this
+ // directly.
+ void Stop(AnimationContainerElement* animation);
+
+ void set_observer(AnimationContainerObserver* observer) {
+ observer_ = observer;
+ }
+
+ // The time the last animation ran at.
+ base::TimeTicks last_tick_time() const { return last_tick_time_; }
+
+ // Are there any timers running?
+ bool is_running() const { return !elements_.empty(); }
+
+ private:
+ friend class base::RefCounted<AnimationContainer>;
+
+ typedef std::set<AnimationContainerElement*> Elements;
+
+ ~AnimationContainer();
+
+ // Timer callback method.
+ void Run();
+
+ // Sets min_timer_interval_ and restarts the timer.
+ void SetMinTimerInterval(base::TimeDelta delta);
+
+ // Returns the min timer interval of all the timers.
+ base::TimeDelta GetMinInterval();
+
+ // Represents one of two possible values:
+ // . If only a single animation has been started and the timer hasn't yet
+ // fired this is the time the animation was added.
+ // . The time the last animation ran at (::Run was invoked).
+ base::TimeTicks last_tick_time_;
+
+ // Set of elements (animations) being managed.
+ Elements elements_;
+
+ // Minimum interval the timers run at.
+ base::TimeDelta min_timer_interval_;
+
+ base::RepeatingTimer<AnimationContainer> timer_;
+
+ AnimationContainerObserver* observer_;
+
+ DISALLOW_COPY_AND_ASSIGN(AnimationContainer);
+};
+
+} // namespace ui
+
+#endif // UI_BASE_ANIMATION_ANIMATION_CONTAINER_H_
diff --git a/ui/base/animation/animation_container_element.h b/ui/base/animation/animation_container_element.h
new file mode 100644
index 0000000..8ac63a5
--- /dev/null
+++ b/ui/base/animation/animation_container_element.h
@@ -0,0 +1,34 @@
+// Copyright (c) 2011 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.
+
+#ifndef UI_BASE_ANIMATION_ANIMATION_CONTAINER_ELEMENT_H_
+#define UI_BASE_ANIMATION_ANIMATION_CONTAINER_ELEMENT_H_
+#pragma once
+
+#include "base/time.h"
+
+namespace ui {
+
+// Interface for the elements the AnimationContainer contains. This is
+// implemented by Animation.
+class AnimationContainerElement {
+ public:
+ // Sets the start of the animation. This is invoked from
+ // AnimationContainer::Start.
+ virtual void SetStartTime(base::TimeTicks start_time) = 0;
+
+ // Invoked when the animation is to progress.
+ virtual void Step(base::TimeTicks time_now) = 0;
+
+ // Returns the time interval of the animation. If an Element needs to change
+ // this it should first invoke Stop, then Start.
+ virtual base::TimeDelta GetTimerInterval() const = 0;
+
+ protected:
+ virtual ~AnimationContainerElement() {}
+};
+
+} // namespace ui
+
+#endif // UI_BASE_ANIMATION_ANIMATION_CONTAINER_ELEMENT_H_
diff --git a/ui/base/animation/animation_container_observer.h b/ui/base/animation/animation_container_observer.h
new file mode 100644
index 0000000..b01a476
--- /dev/null
+++ b/ui/base/animation/animation_container_observer.h
@@ -0,0 +1,31 @@
+// Copyright (c) 2011 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.
+
+#ifndef UI_BASE_ANIMATION_ANIMATION_CONTAINER_OBSERVER_H_
+#define UI_BASE_ANIMATION_ANIMATION_CONTAINER_OBSERVER_H_
+#pragma once
+
+namespace ui {
+
+class AnimationContainer;
+
+// The observer is notified after every update of the animations managed by
+// the container.
+class AnimationContainerObserver {
+ public:
+ // Invoked on every tick of the timer managed by the container and after
+ // all the animations have updated.
+ virtual void AnimationContainerProgressed(
+ AnimationContainer* container) = 0;
+
+ // Invoked when no more animations are being managed by this container.
+ virtual void AnimationContainerEmpty(AnimationContainer* container) = 0;
+
+ protected:
+ virtual ~AnimationContainerObserver() {}
+};
+
+} // namespace ui
+
+#endif // UI_BASE_ANIMATION_ANIMATION_CONTAINER_OBSERVER_H_
diff --git a/app/animation_container_unittest.cc b/ui/base/animation/animation_container_unittest.cc
index 5aa3be6..6345591 100644
--- a/app/animation_container_unittest.cc
+++ b/ui/base/animation/animation_container_unittest.cc
@@ -1,17 +1,19 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
-#include "app/animation_container.h"
-#include "app/animation_container_observer.h"
-#include "app/linear_animation.h"
-#include "app/test_animation_delegate.h"
#include "base/scoped_ptr.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "ui/base/animation/animation_container.h"
+#include "ui/base/animation/animation_container_observer.h"
+#include "ui/base/animation/linear_animation.h"
+#include "ui/base/animation/test_animation_delegate.h"
using testing::AtLeast;
+namespace ui {
+
namespace {
class MockObserver : public AnimationContainerObserver {
@@ -120,3 +122,5 @@ TEST_F(AnimationContainerTest, Observer) {
container->set_observer(NULL);
}
+
+} // namespace ui
diff --git a/ui/base/animation/animation_delegate.h b/ui/base/animation/animation_delegate.h
new file mode 100644
index 0000000..958aa89
--- /dev/null
+++ b/ui/base/animation/animation_delegate.h
@@ -0,0 +1,34 @@
+// Copyright (c) 2011 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.
+
+#ifndef UI_BASE_ANIMATION_ANIMATION_DELEGATE_H_
+#define UI_BASE_ANIMATION_ANIMATION_DELEGATE_H_
+#pragma once
+
+namespace ui {
+
+class Animation;
+
+// AnimationDelegate
+//
+// Implement this interface when you want to receive notifications about the
+// state of an animation.
+class AnimationDelegate {
+ public:
+ // Called when an animation has completed.
+ virtual void AnimationEnded(const Animation* animation) {}
+
+ // Called when an animation has progressed.
+ virtual void AnimationProgressed(const Animation* animation) {}
+
+ // Called when an animation has been canceled.
+ virtual void AnimationCanceled(const Animation* animation) {}
+
+ protected:
+ virtual ~AnimationDelegate() {}
+};
+
+} // namespace ui
+
+#endif // UI_BASE_ANIMATION_ANIMATION_DELEGATE_H_
diff --git a/app/animation_unittest.cc b/ui/base/animation/animation_unittest.cc
index a4ab2fe..7d87600 100644
--- a/app/animation_unittest.cc
+++ b/ui/base/animation/animation_unittest.cc
@@ -1,16 +1,18 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
-#include "app/animation_delegate.h"
-#include "app/linear_animation.h"
-#include "app/test_animation_delegate.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "ui/base/animation/animation_delegate.h"
+#include "ui/base/animation/linear_animation.h"
+#include "ui/base/animation/test_animation_delegate.h"
#if defined(OS_WIN)
#include "base/win/windows_version.h"
#endif
+namespace ui {
+
class AnimationTest: public testing::Test {
private:
MessageLoopForUI message_loop_;
@@ -140,3 +142,5 @@ TEST_F(AnimationTest, ShouldRenderRichAnimation) {
EXPECT_TRUE(Animation::ShouldRenderRichAnimation());
#endif
}
+
+} // namespace ui
diff --git a/app/linear_animation.cc b/ui/base/animation/linear_animation.cc
index 5eb05dd..60054d9 100644
--- a/app/linear_animation.cc
+++ b/ui/base/animation/linear_animation.cc
@@ -1,17 +1,19 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
-#include "app/linear_animation.h"
+#include "ui/base/animation/linear_animation.h"
#include <math.h>
-#include "app/animation_container.h"
-#include "app/animation_delegate.h"
+#include "ui/base/animation/animation_container.h"
+#include "ui/base/animation/animation_delegate.h"
using base::Time;
using base::TimeDelta;
+namespace ui {
+
static TimeDelta CalculateInterval(int frame_rate) {
int timer_interval = 1000000 / frame_rate;
if (timer_interval < 10000)
@@ -90,3 +92,5 @@ void LinearAnimation::AnimationStopped() {
bool LinearAnimation::ShouldSendCanceledFromStop() {
return state_ != 1;
}
+
+} // namespace ui
diff --git a/ui/base/animation/linear_animation.h b/ui/base/animation/linear_animation.h
new file mode 100644
index 0000000..38205ea
--- /dev/null
+++ b/ui/base/animation/linear_animation.h
@@ -0,0 +1,74 @@
+// Copyright (c) 2011 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.
+
+#ifndef UI_BASE_ANIMATION_LINEAR_ANIMATION_H_
+#define UI_BASE_ANIMATION_LINEAR_ANIMATION_H_
+#pragma once
+
+#include "base/time.h"
+#include "ui/base/animation/animation.h"
+
+namespace ui {
+
+class AnimationDelegate;
+
+// Linear time bounded animation. As the animation progresses AnimateToState is
+// invoked.
+class LinearAnimation : public Animation {
+ public:
+ // Initializes everything except the duration.
+ //
+ // Caller must make sure to call SetDuration() if they use this
+ // constructor; it is preferable to use the full one, but sometimes
+ // duration can change between calls to Start() and we need to
+ // expose this interface.
+ LinearAnimation(int frame_rate, AnimationDelegate* delegate);
+
+ // Initializes all fields.
+ LinearAnimation(int duration, int frame_rate, AnimationDelegate* delegate);
+
+ // Gets the value for the current state, according to the animation curve in
+ // use. This class provides only for a linear relationship, however subclasses
+ // can override this to provide others.
+ virtual double GetCurrentValue() const;
+
+ // Skip to the end of the current animation.
+ void End();
+
+ // Changes the length of the animation. This resets the current
+ // state of the animation to the beginning.
+ void SetDuration(int duration);
+
+ protected:
+ // Called when the animation progresses. Subclasses override this to
+ // efficiently update their state.
+ virtual void AnimateToState(double state) = 0;
+
+ // Invoked by the AnimationContainer when the animation is running to advance
+ // the animation. Use |time_now| rather than Time::Now to avoid multiple
+ // animations running at the same time diverging.
+ virtual void Step(base::TimeTicks time_now);
+
+ // Overriden to advance to the end (if End was invoked).
+ virtual void AnimationStopped();
+
+ // Overriden to return true if state is not 1.
+ virtual bool ShouldSendCanceledFromStop();
+
+ private:
+ base::TimeDelta duration_;
+
+ // Current state, on a scale from 0.0 to 1.0.
+ double state_;
+
+ // If true, we're in end. This is used to determine if the animation should
+ // be advanced to the end from AnimationStopped.
+ bool in_end_;
+
+ DISALLOW_COPY_AND_ASSIGN(LinearAnimation);
+};
+
+} // namespace ui
+
+#endif // APP_LINEAR_ANIMATION_H_
diff --git a/app/multi_animation.cc b/ui/base/animation/multi_animation.cc
index f43470e..5a0c1e1 100644
--- a/app/multi_animation.cc
+++ b/ui/base/animation/multi_animation.cc
@@ -1,11 +1,13 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
-#include "app/multi_animation.h"
+#include "ui/base/animation/multi_animation.h"
-#include "app/animation_delegate.h"
#include "base/logging.h"
+#include "ui/base/animation/animation_delegate.h"
+
+namespace ui {
// Default interval, in ms.
static const int kDefaultInterval = 20;
@@ -82,3 +84,5 @@ const MultiAnimation::Part& MultiAnimation::GetPart(int* time_ms,
*part_index = 0;
return parts_[0];
}
+
+} // namespace ui
diff --git a/ui/base/animation/multi_animation.h b/ui/base/animation/multi_animation.h
new file mode 100644
index 0000000..fbacde3
--- /dev/null
+++ b/ui/base/animation/multi_animation.h
@@ -0,0 +1,94 @@
+// Copyright (c) 2011 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.
+
+#ifndef UI_BASE_ANIMATION_MULTI_ANIMATION_H_
+#define UI_BASE_ANIMATION_MULTI_ANIMATION_H_
+#pragma once
+
+#include <vector>
+
+#include "ui/base/animation/animation.h"
+#include "ui/base/animation/tween.h"
+
+namespace ui {
+
+// MultiAnimation is an animation that consists of a number of sub animations.
+// To create a MultiAnimation pass in the parts, invoke Start() and the delegate
+// is notified as the animation progresses. By default MultiAnimation runs until
+// Stop is invoked, see |set_continuous()| for details.
+class MultiAnimation : public Animation {
+ public:
+ // Defines part of the animation. Each part consists of the following:
+ //
+ // time_ms: the time of the part.
+ // start_time_ms: the amount of time to offset this part by when calculating
+ // the percented completed.
+ // end_time_ms: the end time used to calculate the percentange completed.
+ //
+ // In most cases |start_time_ms| = 0 and |end_time_ms| = |time_ms|. But you
+ // can adjust the start/end for different effects. For example, to run a part
+ // for 200ms with a % between .25 and .75 use the following three values: 200,
+ // 100, 400.
+ struct Part {
+ Part() : time_ms(0), start_time_ms(0), end_time_ms(0), type(Tween::ZERO) {}
+ Part(int time_ms, Tween::Type type)
+ : time_ms(time_ms),
+ start_time_ms(0),
+ end_time_ms(time_ms),
+ type(type) {}
+
+ int time_ms;
+ int start_time_ms;
+ int end_time_ms;
+ Tween::Type type;
+ };
+
+ typedef std::vector<Part> Parts;
+
+ explicit MultiAnimation(const Parts& parts);
+ virtual ~MultiAnimation();
+
+ // Sets whether the animation continues after it reaches the end. If true, the
+ // animation runs until explicitly stopped. The default is true.
+ void set_continuous(bool continuous) { continuous_ = continuous; }
+
+ // Returns the current value. The current value for a MultiAnimation is
+ // determined from the tween type of the current part.
+ virtual double GetCurrentValue() const;
+
+ // Returns the index of the current part.
+ size_t current_part_index() const { return current_part_index_; }
+
+ protected:
+ // Animation overrides.
+ virtual void Step(base::TimeTicks time_now);
+ virtual void SetStartTime(base::TimeTicks start_time);
+
+ private:
+ // Returns the part containing the specified time. |time_ms| is reset to be
+ // relative to the part containing the time and |part_index| the index of the
+ // part.
+ const Part& GetPart(int* time_ms, size_t* part_index);
+
+ // The parts that make up the animation.
+ const Parts parts_;
+
+ // Total time of all the parts.
+ const int cycle_time_ms_;
+
+ // Current value for the animation.
+ double current_value_;
+
+ // Index of the current part.
+ size_t current_part_index_;
+
+ // See description above setter.
+ bool continuous_;
+
+ DISALLOW_COPY_AND_ASSIGN(MultiAnimation);
+};
+
+} // namespace ui
+
+#endif // UI_BASE_ANIMATION_MULTI_ANIMATION_H_
diff --git a/app/multi_animation_unittest.cc b/ui/base/animation/multi_animation_unittest.cc
index 393b01c..dfc015d 100644
--- a/app/multi_animation_unittest.cc
+++ b/ui/base/animation/multi_animation_unittest.cc
@@ -1,10 +1,12 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
-#include "app/animation_container_element.h"
-#include "app/multi_animation.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "ui/base/animation/animation_container_element.h"
+#include "ui/base/animation/multi_animation.h"
+
+namespace ui {
typedef testing::Test MultiAnimationTest;
@@ -87,3 +89,5 @@ TEST_F(MultiAnimationTest, Cycle) {
as_element->Step(base::TimeTicks() + base::TimeDelta::FromMilliseconds(300));
EXPECT_EQ(.5, animation.GetCurrentValue());
}
+
+} // namespace ui
diff --git a/app/slide_animation.cc b/ui/base/animation/slide_animation.cc
index 9029fd8..ec08334 100644
--- a/app/slide_animation.cc
+++ b/ui/base/animation/slide_animation.cc
@@ -1,11 +1,13 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
-#include "app/slide_animation.h"
+#include "ui/base/animation/slide_animation.h"
#include <math.h>
+namespace ui {
+
// How many frames per second to target.
static const int kDefaultFramerateHz = 50;
@@ -108,3 +110,5 @@ void SlideAnimation::AnimateToState(double state) {
value_current_ = value_end_;
}
}
+
+} // namespace ui
diff --git a/ui/base/animation/slide_animation.h b/ui/base/animation/slide_animation.h
new file mode 100644
index 0000000..8f5e67c
--- /dev/null
+++ b/ui/base/animation/slide_animation.h
@@ -0,0 +1,100 @@
+// Copyright (c) 2011 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.
+
+#ifndef UI_BASE_ANIMATION_SLIDE_ANIMATION_H_
+#define UI_BASE_ANIMATION_SLIDE_ANIMATION_H_
+#pragma once
+
+#include "ui/base/animation/linear_animation.h"
+#include "ui/base/animation/tween.h"
+
+namespace ui {
+
+// Slide Animation
+//
+// Used for reversible animations and as a general helper class. Typical usage:
+//
+// #include "ui/base/animation/slide_animation.h"
+//
+// class MyClass : public AnimationDelegate {
+// public:
+// MyClass() {
+// animation_.reset(new SlideAnimation(this));
+// animation_->SetSlideDuration(500);
+// }
+// void OnMouseOver() {
+// animation_->Show();
+// }
+// void OnMouseOut() {
+// animation_->Hide();
+// }
+// void AnimationProgressed(const Animation* animation) {
+// if (animation == animation_.get()) {
+// Layout();
+// SchedulePaint();
+// } else if (animation == other_animation_.get()) {
+// ...
+// }
+// }
+// void Layout() {
+// if (animation_->is_animating()) {
+// hover_image_.SetOpacity(animation_->GetCurrentValue());
+// }
+// }
+// private:
+// scoped_ptr<SlideAnimation> animation_;
+// }
+class SlideAnimation : public LinearAnimation {
+ public:
+ explicit SlideAnimation(AnimationDelegate* target);
+ virtual ~SlideAnimation();
+
+ // Set the animation back to the 0 state.
+ virtual void Reset();
+ virtual void Reset(double value);
+
+ // Begin a showing animation or reverse a hiding animation in progress.
+ virtual void Show();
+
+ // Begin a hiding animation or reverse a showing animation in progress.
+ virtual void Hide();
+
+ // Sets the time a slide will take. Note that this isn't actually
+ // the amount of time an animation will take as the current value of
+ // the slide is considered.
+ virtual void SetSlideDuration(int duration);
+ int GetSlideDuration() const { return slide_duration_; }
+ void SetTweenType(Tween::Type tween_type) { tween_type_ = tween_type; }
+
+ virtual double GetCurrentValue() const;
+ bool IsShowing() const { return showing_; }
+ bool IsClosing() const { return !showing_ && value_end_ < value_current_; }
+
+ private:
+ // Overridden from Animation.
+ virtual void AnimateToState(double state);
+
+ AnimationDelegate* target_;
+
+ Tween::Type tween_type_;
+
+ // Used to determine which way the animation is going.
+ bool showing_;
+
+ // Animation values. These are a layer on top of Animation::state_ to
+ // provide the reversability.
+ double value_start_;
+ double value_end_;
+ double value_current_;
+
+ // How long a hover in/out animation will last for. This defaults to
+ // kHoverFadeDurationMS, but can be overridden with SetDuration.
+ int slide_duration_;
+
+ DISALLOW_COPY_AND_ASSIGN(SlideAnimation);
+};
+
+} // namespace ui
+
+#endif // UI_BASE_ANIMATION_SLIDE_ANIMATION_H_
diff --git a/app/slide_animation_unittest.cc b/ui/base/animation/slide_animation_unittest.cc
index d34b975..dcce5c0 100644
--- a/app/slide_animation_unittest.cc
+++ b/ui/base/animation/slide_animation_unittest.cc
@@ -1,11 +1,13 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
-#include "app/slide_animation.h"
-#include "app/test_animation_delegate.h"
#include "base/scoped_ptr.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "ui/base/animation/slide_animation.h"
+#include "ui/base/animation/test_animation_delegate.h"
+
+namespace ui {
class SlideAnimationTest: public testing::Test {
private:
@@ -28,3 +30,5 @@ TEST_F(SlideAnimationTest, DontNotifyOnDelete) {
EXPECT_FALSE(delegate.finished());
EXPECT_FALSE(delegate.canceled());
}
+
+} // namespace ui
diff --git a/ui/base/animation/test_animation_delegate.h b/ui/base/animation/test_animation_delegate.h
new file mode 100644
index 0000000..e6c4047
--- /dev/null
+++ b/ui/base/animation/test_animation_delegate.h
@@ -0,0 +1,49 @@
+// Copyright (c) 2011 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.
+
+#ifndef UI_BASE_ANIMATION_TEST_ANIMATION_DELEGATE_H_
+#define UI_BASE_ANIMATION_TEST_ANIMATION_DELEGATE_H_
+#pragma once
+
+#include "base/message_loop.h"
+#include "ui/base/animation/animation_delegate.h"
+
+namespace ui {
+
+// Trivial AnimationDelegate implementation. AnimationEnded/Canceled quit the
+// message loop.
+class TestAnimationDelegate : public AnimationDelegate {
+ public:
+ TestAnimationDelegate() : canceled_(false), finished_(false) {
+ }
+
+ virtual void AnimationEnded(const Animation* animation) {
+ finished_ = true;
+ MessageLoop::current()->Quit();
+ }
+
+ virtual void AnimationCanceled(const Animation* animation) {
+ finished_ = true;
+ canceled_ = true;
+ MessageLoop::current()->Quit();
+ }
+
+ bool finished() const {
+ return finished_;
+ }
+
+ bool canceled() const {
+ return canceled_;
+ }
+
+ private:
+ bool canceled_;
+ bool finished_;
+
+ DISALLOW_COPY_AND_ASSIGN(TestAnimationDelegate);
+};
+
+} // namespace ui
+
+#endif // UI_BASE_ANIMATION_TEST_ANIMATION_DELEGATE_H_
diff --git a/app/throb_animation.cc b/ui/base/animation/throb_animation.cc
index 9ce8f5b..95e9a65 100644
--- a/app/throb_animation.cc
+++ b/ui/base/animation/throb_animation.cc
@@ -1,11 +1,13 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
-#include "app/throb_animation.h"
+#include "ui/base/animation/throb_animation.h"
#include <limits>
+namespace ui {
+
static const int kDefaultThrobDurationMS = 400;
ThrobAnimation::ThrobAnimation(AnimationDelegate* target)
@@ -75,3 +77,5 @@ void ThrobAnimation::ResetForSlide() {
cycles_remaining_ = 0;
throbbing_ = false;
}
+
+} // namespace ui
diff --git a/ui/base/animation/throb_animation.h b/ui/base/animation/throb_animation.h
new file mode 100644
index 0000000..21dc03b
--- /dev/null
+++ b/ui/base/animation/throb_animation.h
@@ -0,0 +1,69 @@
+// Copyright (c) 2011 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.
+
+#ifndef UI_BASE_ANIMATION_THROB_ANIMATION_H_
+#define UI_BASE_ANIMATION_THROB_ANIMATION_H_
+#pragma once
+
+#include "ui/base/animation/slide_animation.h"
+
+namespace ui {
+
+// A subclass of SlideAnimation that can continually slide. All of the Animation
+// methods behave like that of SlideAnimation: transition to the next state.
+// The StartThrobbing method causes the ThrobAnimation to cycle between hidden
+// and shown for a set number of cycles.
+//
+// A ThrobAnimation has two durations: the duration used when behavior like
+// a SlideAnimation, and the duration used when throbbing.
+class ThrobAnimation : public SlideAnimation {
+ public:
+ explicit ThrobAnimation(AnimationDelegate* target);
+ virtual ~ThrobAnimation() {}
+
+ // Starts throbbing. cycles_til_stop gives the number of cycles to do before
+ // stopping. A negative value means "throb indefinitely".
+ void StartThrobbing(int cycles_til_stop);
+
+ // Sets the duration of the slide animation when throbbing.
+ void SetThrobDuration(int duration) { throb_duration_ = duration; }
+
+ // Overridden to reset to the slide duration.
+ virtual void Reset();
+ virtual void Show();
+ virtual void Hide();
+
+ // Overridden to maintain the slide duration.
+ virtual void SetSlideDuration(int duration);
+
+ // The number of cycles remaining until the animation stops.
+ void set_cycles_remaining(int value) { cycles_remaining_ = value; }
+ int cycles_remaining() const { return cycles_remaining_; }
+
+ protected:
+ // Overriden to continually throb (assuming we're throbbing).
+ virtual void Step(base::TimeTicks time_now);
+
+ private:
+ // Resets state such that we behave like SlideAnimation.
+ void ResetForSlide();
+
+ // Duration of the slide animation.
+ int slide_duration_;
+
+ // Duration of the slide animation when throbbing.
+ int throb_duration_;
+
+ // If throbbing, this is the number of cycles left.
+ int cycles_remaining_;
+
+ // Are we throbbing?
+ bool throbbing_;
+
+ DISALLOW_COPY_AND_ASSIGN(ThrobAnimation);
+};
+
+} // namespace ui
+
+#endif // UI_BASE_ANIMATION_THROB_ANIMATION_H_
diff --git a/app/tween.cc b/ui/base/animation/tween.cc
index 610e01a..131e686 100644
--- a/app/tween.cc
+++ b/ui/base/animation/tween.cc
@@ -1,8 +1,8 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
-#include "app/tween.h"
+#include "ui/base/animation/tween.h"
#include <math.h>
@@ -13,6 +13,8 @@
#include "base/logging.h"
#include "gfx/rect.h"
+namespace ui {
+
// static
double Tween::CalculateValue(Tween::Type type, double state) {
DCHECK_GE(state, 0);
@@ -80,3 +82,5 @@ gfx::Rect Tween::ValueBetween(double value,
ValueBetween(value, start_bounds.height(),
target_bounds.height()));
}
+
+} // namespace ui
diff --git a/ui/base/animation/tween.h b/ui/base/animation/tween.h
new file mode 100644
index 0000000..873281f
--- /dev/null
+++ b/ui/base/animation/tween.h
@@ -0,0 +1,48 @@
+// Copyright (c) 2011 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.
+
+#ifndef UI_BASE_ANIMATION_TWEEN_H_
+#define UI_BASE_ANIMATION_TWEEN_H_
+#pragma once
+
+#include "base/basictypes.h"
+
+namespace gfx {
+class Rect;
+}
+
+namespace ui {
+
+class Tween {
+ public:
+ enum Type {
+ LINEAR, // Linear.
+ EASE_OUT, // Fast in, slow out (default).
+ EASE_IN, // Slow in, fast out.
+ EASE_IN_OUT, // Slow in and out, fast in the middle.
+ FAST_IN_OUT, // Fast in and out, slow in the middle.
+ EASE_OUT_SNAP, // Fast in, slow out, snap to final value.
+ ZERO, // Returns a value of 0 always.
+ };
+
+ // Returns the value based on the tween type. |state| is from 0-1.
+ static double CalculateValue(Type type, double state);
+
+ // Conveniences for getting a value between a start and end point.
+ static double ValueBetween(double value, double start, double target);
+ static int ValueBetween(double value, int start, int target);
+ static gfx::Rect ValueBetween(double value,
+ const gfx::Rect& start_bounds,
+ const gfx::Rect& target_bounds);
+
+ private:
+ Tween();
+ ~Tween();
+
+ DISALLOW_COPY_AND_ASSIGN(Tween);
+};
+
+} // namespace ui
+
+#endif // UI_BASE_ANIMATION_TWEEN_H_
diff --git a/ui/base/run_all_unittests.cc b/ui/base/run_all_unittests.cc
new file mode 100644
index 0000000..3be8d08
--- /dev/null
+++ b/ui/base/run_all_unittests.cc
@@ -0,0 +1,9 @@
+// Copyright (c) 2011 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.
+
+#include "ui/base/test_suite.h"
+
+int main(int argc, char** argv) {
+ return UiBaseTestSuite(argc, argv).Run();
+}
diff --git a/ui/base/test_suite.h b/ui/base/test_suite.h
new file mode 100644
index 0000000..c548d6a
--- /dev/null
+++ b/ui/base/test_suite.h
@@ -0,0 +1,38 @@
+// Copyright (c) 2011 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.
+
+#ifndef UI_BASE_TEST_SUITE_H_
+#define UI_BASE_TEST_SUITE_H_
+#pragma once
+
+#include "build/build_config.h"
+
+#include "base/path_service.h"
+#include "base/mac/scoped_nsautorelease_pool.h"
+#include "base/test/test_suite.h"
+#include "build/build_config.h"
+
+#if defined(OS_MACOSX)
+#include "base/mac/mac_util.h"
+#endif
+
+class UiBaseTestSuite : public base::TestSuite {
+ public:
+ UiBaseTestSuite(int argc, char** argv) : TestSuite(argc, argv) {
+ }
+
+ protected:
+
+ virtual void Initialize() {
+ base::mac::ScopedNSAutoreleasePool autorelease_pool;
+
+ TestSuite::Initialize();
+ }
+
+ virtual void Shutdown() {
+ TestSuite::Shutdown();
+ }
+};
+
+#endif // UI_BASE_TEST_SUITE_H_
diff --git a/ui/base/ui_base.gypi b/ui/base/ui_base.gypi
new file mode 100644
index 0000000..f441c6f
--- /dev/null
+++ b/ui/base/ui_base.gypi
@@ -0,0 +1,100 @@
+# Copyright (c) 2011 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.
+
+{
+ 'variables': {
+ 'chromium_code': 1,
+ },
+ 'target_defaults': {
+ 'sources/': [
+ ['exclude', '/(cocoa|gtk|win)/'],
+ ['exclude', '_(cocoa|gtk|linux|mac|posix|skia|win|x)\\.(cc|mm?)$'],
+ ['exclude', '/(gtk|win|x11)_[^/]*\\.cc$'],
+ ],
+ 'conditions': [
+ ['OS=="linux" or OS=="freebsd" or OS=="openbsd"', {'sources/': [
+ ['include', '/gtk/'],
+ ['include', '_(gtk|linux|posix|skia|x)\\.cc$'],
+ ['include', '/(gtk|x11)_[^/]*\\.cc$'],
+ ]}],
+ ['OS=="mac"', {'sources/': [
+ ['include', '/cocoa/'],
+ ['include', '_(cocoa|mac|posix)\\.(cc|mm?)$'],
+ ]}, { # else: OS != "mac"
+ 'sources/': [
+ ['exclude', '\\.mm?$'],
+ ],
+ }],
+ ['OS=="win"', {'sources/': [
+ ['include', '_(win)\\.cc$'],
+ ['include', '/win/'],
+ ['include', '/win_[^/]*\\.cc$'],
+ ]}],
+ ['touchui==0', {'sources/': [
+ ['exclude', 'event_x.cc$'],
+ ['exclude', 'native_menu_x.cc$'],
+ ['exclude', 'native_menu_x.h$'],
+ ['exclude', 'touchui/'],
+ ['exclude', '_(touch)\\.cc$'],
+ ]}],
+ ],
+ },
+ 'targets': [
+ {
+ 'target_name': 'ui_base',
+ 'type': '<(library)',
+ 'dependencies': [
+ '../base/base.gyp:base',
+ '../gfx/gfx.gyp:gfx',
+ '../skia/skia.gyp:skia',
+ '../third_party/icu/icu.gyp:icui18n',
+ '../third_party/icu/icu.gyp:icuuc',
+ ],
+ 'sources': [
+ 'animation/animation.cc',
+ 'animation/animation.h',
+ 'animation/animation_container.cc',
+ 'animation/animation_container.h',
+ 'animation/animation_container_element.h',
+ 'animation/animation_container_observer.h',
+ 'animation/animation_delegate.h',
+ 'animation/linear_animation.cc',
+ 'animation/linear_animation.h',
+ 'animation/multi_animation.cc',
+ 'animation/multi_animation.h',
+ 'animation/slide_animation.cc',
+ 'animation/slide_animation.h',
+ 'animation/throb_animation.cc',
+ 'animation/throb_animation.h',
+ 'animation/tween.cc',
+ 'animation/tween.h',
+ ],
+ },
+ {
+ 'target_name': 'ui_base_unittests',
+ 'type': 'executable',
+ 'dependencies': [
+ '../base/base.gyp:base',
+ '../base/base.gyp:test_support_base',
+ '../testing/gmock.gyp:gmock',
+ '../testing/gtest.gyp:gtest',
+ 'ui_base',
+ ],
+ 'sources': [
+ 'animation/animation_container_unittest.cc',
+ 'animation/animation_unittest.cc',
+ 'animation/multi_animation_unittest.cc',
+ 'animation/slide_animation_unittest.cc',
+ 'run_all_unittests.cc',
+ 'test_suite.h',
+ ],
+ },
+ ],
+}
+
+# Local Variables:
+# tab-width:2
+# indent-tabs-mode:nil
+# End:
+# vim: set expandtab tabstop=2 shiftwidth=2:
diff --git a/ui/ui.gyp b/ui/ui.gyp
new file mode 100644
index 0000000..e289b0b
--- /dev/null
+++ b/ui/ui.gyp
@@ -0,0 +1,52 @@
+# Copyright (c) 2011 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.
+
+{
+ 'variables': {
+ 'chromium_code': 1,
+ },
+ 'target_defaults': {
+ 'sources/': [
+ ['exclude', '/(cocoa|gtk|win)/'],
+ ['exclude', '_(cocoa|gtk|linux|mac|posix|skia|win|x)\\.(cc|mm?)$'],
+ ['exclude', '/(gtk|win|x11)_[^/]*\\.cc$'],
+ ],
+ 'conditions': [
+ ['OS=="linux" or OS=="freebsd" or OS=="openbsd"', {'sources/': [
+ ['include', '/gtk/'],
+ ['include', '_(gtk|linux|posix|skia|x)\\.cc$'],
+ ['include', '/(gtk|x11)_[^/]*\\.cc$'],
+ ]}],
+ ['OS=="mac"', {'sources/': [
+ ['include', '/cocoa/'],
+ ['include', '_(cocoa|mac|posix)\\.(cc|mm?)$'],
+ ]}, { # else: OS != "mac"
+ 'sources/': [
+ ['exclude', '\\.mm?$'],
+ ],
+ }],
+ ['OS=="win"', {'sources/': [
+ ['include', '_(win)\\.cc$'],
+ ['include', '/win/'],
+ ['include', '/win_[^/]*\\.cc$'],
+ ]}],
+ ['touchui==0', {'sources/': [
+ ['exclude', 'event_x.cc$'],
+ ['exclude', 'native_menu_x.cc$'],
+ ['exclude', 'native_menu_x.h$'],
+ ['exclude', 'touchui/'],
+ ['exclude', '_(touch)\\.cc$'],
+ ]}],
+ ],
+ },
+ 'includes': [
+ 'base/ui_base.gypi',
+ ],
+}
+
+# Local Variables:
+# tab-width:2
+# indent-tabs-mode:nil
+# End:
+# vim: set expandtab tabstop=2 shiftwidth=2:
diff --git a/views/animation/bounds_animator.cc b/views/animation/bounds_animator.cc
index ad17ec9..4ba8d86 100644
--- a/views/animation/bounds_animator.cc
+++ b/views/animation/bounds_animator.cc
@@ -4,14 +4,19 @@
#include "views/animation/bounds_animator.h"
-#include "app/animation_container.h"
-#include "app/slide_animation.h"
#include "base/scoped_ptr.h"
+#include "ui/base/animation/animation_container.h"
+#include "ui/base/animation/slide_animation.h"
#include "views/view.h"
// Duration in milliseconds for animations.
static const int kAnimationDuration = 200;
+using ui::Animation;
+using ui::AnimationContainer;
+using ui::SlideAnimation;
+using ui::Tween;
+
namespace views {
BoundsAnimator::BoundsAnimator(View* parent)
diff --git a/views/animation/bounds_animator.h b/views/animation/bounds_animator.h
index 5e5d976..a2fed4e 100644
--- a/views/animation/bounds_animator.h
+++ b/views/animation/bounds_animator.h
@@ -8,13 +8,14 @@
#include <map>
-#include "app/animation_container_observer.h"
-#include "app/animation_delegate.h"
#include "base/ref_counted.h"
#include "gfx/rect.h"
+#include "ui/base/animation/animation_container_observer.h"
+#include "ui/base/animation/animation_delegate.h"
-class AnimationContainer;
+namespace ui {
class SlideAnimation;
+}
namespace views {
@@ -37,12 +38,12 @@ class BoundsAnimatorObserver {
// You can attach an AnimationDelegate to the individual animation for a view
// by way of SetAnimationDelegate. Additionally you can attach an observer to
// the BoundsAnimator that is notified when all animations are complete.
-class BoundsAnimator : public AnimationDelegate,
- public AnimationContainerObserver {
+class BoundsAnimator : public ui::AnimationDelegate,
+ public ui::AnimationContainerObserver {
public:
// If |delete_when_done| is set to true in |SetAnimationDelegate| the
// |AnimationDelegate| must subclass this class.
- class OwnedAnimationDelegate : public AnimationDelegate {
+ class OwnedAnimationDelegate : public ui::AnimationDelegate {
public:
virtual ~OwnedAnimationDelegate() {}
};
@@ -58,11 +59,11 @@ class BoundsAnimator : public AnimationDelegate,
// Sets the animation for the specified view. BoundsAnimator takes ownership
// of the specified animation.
- void SetAnimationForView(View* view, SlideAnimation* animation);
+ void SetAnimationForView(View* view, ui::SlideAnimation* animation);
// Returns the animation for the specified view. BoundsAnimator owns the
// returned Animation.
- const SlideAnimation* GetAnimationForView(View* view);
+ const ui::SlideAnimation* GetAnimationForView(View* view);
// Stops animating the specified view. If the view was scheduled for deletion
// it is deleted. This does nothing if |view| is not currently animating.
@@ -72,7 +73,7 @@ class BoundsAnimator : public AnimationDelegate,
// |delete_when_done| is true the |delegate| is deleted when done and
// |delegate| must subclass OwnedAnimationDelegate.
void SetAnimationDelegate(View* view,
- AnimationDelegate* delegate,
+ ui::AnimationDelegate* delegate,
bool delete_when_done);
// Returns true if BoundsAnimator is animating the bounds of |view|.
@@ -91,7 +92,7 @@ class BoundsAnimator : public AnimationDelegate,
protected:
// Creates the animation to use for animating views.
- virtual SlideAnimation* CreateAnimation();
+ virtual ui::SlideAnimation* CreateAnimation();
private:
// Tracks data about the view being animated.
@@ -111,10 +112,10 @@ class BoundsAnimator : public AnimationDelegate,
gfx::Rect target_bounds;
// The animation. We own this.
- SlideAnimation* animation;
+ ui::SlideAnimation* animation;
// Additional delegate for the animation, may be null.
- AnimationDelegate* delegate;
+ ui::AnimationDelegate* delegate;
};
// Used by AnimationEndedOrCanceled.
@@ -125,7 +126,7 @@ class BoundsAnimator : public AnimationDelegate,
typedef std::map<View*, Data> ViewToDataMap;
- typedef std::map<const Animation*, View*> AnimationToViewMap;
+ typedef std::map<const ui::Animation*, View*> AnimationToViewMap;
// Removes references to |view| and its animation. This does NOT delete the
// animation or delegate.
@@ -138,20 +139,20 @@ class BoundsAnimator : public AnimationDelegate,
// Used when changing the animation for a view. This resets the maps for
// the animation used by view and returns the current animation. Ownership
// of the returned animation passes to the caller.
- Animation* ResetAnimationForView(View* view);
+ ui::Animation* ResetAnimationForView(View* view);
// Invoked from AnimationEnded and AnimationCanceled.
- void AnimationEndedOrCanceled(const Animation* animation,
+ void AnimationEndedOrCanceled(const ui::Animation* animation,
AnimationEndType type);
- // AnimationDelegate overrides.
- virtual void AnimationProgressed(const Animation* animation);
- virtual void AnimationEnded(const Animation* animation);
- virtual void AnimationCanceled(const Animation* animation);
+ // ui::AnimationDelegate overrides.
+ virtual void AnimationProgressed(const ui::Animation* animation);
+ virtual void AnimationEnded(const ui::Animation* animation);
+ virtual void AnimationCanceled(const ui::Animation* animation);
- // AnimationContainerObserver overrides.
- virtual void AnimationContainerProgressed(AnimationContainer* container);
- virtual void AnimationContainerEmpty(AnimationContainer* container);
+ // ui::AnimationContainerObserver overrides.
+ virtual void AnimationContainerProgressed(ui::AnimationContainer* container);
+ virtual void AnimationContainerEmpty(ui::AnimationContainer* container);
// Parent of all views being animated.
View* parent_;
@@ -159,7 +160,7 @@ class BoundsAnimator : public AnimationDelegate,
BoundsAnimatorObserver* observer_;
// All animations we create up with the same container.
- scoped_refptr<AnimationContainer> container_;
+ scoped_refptr<ui::AnimationContainer> container_;
// Maps from view being animated to info about the view.
ViewToDataMap data_;
diff --git a/views/animation/bounds_animator_unittest.cc b/views/animation/bounds_animator_unittest.cc
index d85b185..0c02e2d 100644
--- a/views/animation/bounds_animator_unittest.cc
+++ b/views/animation/bounds_animator_unittest.cc
@@ -2,13 +2,15 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "app/slide_animation.h"
-#include "app/test_animation_delegate.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "ui/base/animation/slide_animation.h"
+#include "ui/base/animation/test_animation_delegate.h"
#include "views/animation/bounds_animator.h"
#include "views/view.h"
using views::BoundsAnimator;
+using ui::Animation;
+using ui::SlideAnimation;
namespace {
diff --git a/views/controls/button/custom_button.cc b/views/controls/button/custom_button.cc
index 7a3eca2..baf0209 100644
--- a/views/controls/button/custom_button.cc
+++ b/views/controls/button/custom_button.cc
@@ -5,7 +5,7 @@
#include "views/controls/button/custom_button.h"
#include "app/keyboard_codes.h"
-#include "app/throb_animation.h"
+#include "ui/base/animation/throb_animation.h"
#include "views/screen.h"
namespace views {
@@ -120,7 +120,7 @@ CustomButton::CustomButton(ButtonListener* listener)
is_throbbing_(false),
triggerable_event_flags_(MouseEvent::EF_LEFT_BUTTON_DOWN),
request_focus_on_press_(true) {
- hover_animation_.reset(new ThrobAnimation(this));
+ hover_animation_.reset(new ui::ThrobAnimation(this));
hover_animation_->SetSlideDuration(kHoverFadeDurationMs);
}
@@ -262,9 +262,9 @@ void CustomButton::WillLoseFocus() {
}
////////////////////////////////////////////////////////////////////////////////
-// CustomButton, AnimationDelegate implementation:
+// CustomButton, ui::AnimationDelegate implementation:
-void CustomButton::AnimationProgressed(const Animation* animation) {
+void CustomButton::AnimationProgressed(const ui::Animation* animation) {
SchedulePaint();
}
diff --git a/views/controls/button/custom_button.h b/views/controls/button/custom_button.h
index 6e35a3f..e0dcb2b 100644
--- a/views/controls/button/custom_button.h
+++ b/views/controls/button/custom_button.h
@@ -6,10 +6,12 @@
#define VIEWS_CONTROLS_BUTTON_CUSTOM_BUTTON_H_
#pragma once
-#include "app/animation_delegate.h"
#include "views/controls/button/button.h"
+#include "ui/base/animation/animation_delegate.h"
+namespace ui {
class ThrobAnimation;
+}
namespace views {
@@ -19,7 +21,7 @@ namespace views {
// part of the focus chain. Call SetFocusable(true) to make it part of the
// focus chain.
class CustomButton : public Button,
- public AnimationDelegate {
+ public ui::AnimationDelegate {
public:
// The menu button's class name.
static const char kViewClassName[];
@@ -104,8 +106,8 @@ class CustomButton : public Button,
virtual bool IsHotTracked() const;
virtual void WillLoseFocus();
- // Overridden from AnimationDelegate:
- virtual void AnimationProgressed(const Animation* animation);
+ // Overridden from ui::AnimationDelegate:
+ virtual void AnimationProgressed(const ui::Animation* animation);
// Returns true if the button should become pressed when the user
// holds the mouse down over the button. For this implementation,
@@ -116,7 +118,7 @@ class CustomButton : public Button,
ButtonState state_;
// Hover animation.
- scoped_ptr<ThrobAnimation> hover_animation_;
+ scoped_ptr<ui::ThrobAnimation> hover_animation_;
private:
// Should we animate when the state changes? Defaults to true.
diff --git a/views/controls/button/image_button.cc b/views/controls/button/image_button.cc
index 362b7abe..306633e 100644
--- a/views/controls/button/image_button.cc
+++ b/views/controls/button/image_button.cc
@@ -4,9 +4,9 @@
#include "views/controls/button/image_button.h"
-#include "app/throb_animation.h"
#include "gfx/canvas.h"
#include "gfx/skbitmap_operations.h"
+#include "ui/base/animation/throb_animation.h"
namespace views {
diff --git a/views/controls/button/text_button.cc b/views/controls/button/text_button.cc
index 1df698a..4c3460f 100644
--- a/views/controls/button/text_button.cc
+++ b/views/controls/button/text_button.cc
@@ -6,11 +6,11 @@
#include <algorithm>
-#include "app/throb_animation.h"
#include "app/resource_bundle.h"
#include "base/logging.h"
#include "base/utf_string_conversions.h"
#include "gfx/canvas_skia.h"
+#include "ui/base/animation/throb_animation.h"
#include "views/controls/button/button.h"
#include "views/event.h"
#include "grit/app_resources.h"