Skip to content

Commit

Permalink
Move animation code to new ui/base/animation directory.
Browse files Browse the repository at this point in the history
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
  • Loading branch information
ben@chromium.org committed Jan 7, 2011
1 parent 3b65bfd commit f676780
Show file tree
Hide file tree
Showing 124 changed files with 1,651 additions and 616 deletions.
4 changes: 0 additions & 4 deletions app/app.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
16 changes: 0 additions & 16 deletions app/app_base.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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',
Expand All @@ -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',
Expand All @@ -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',
Expand All @@ -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',
Expand Down
1 change: 1 addition & 0 deletions build/all.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -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:*',
Expand Down
22 changes: 12 additions & 10 deletions chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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();
}

Expand Down
21 changes: 12 additions & 9 deletions chrome/browser/autocomplete/autocomplete_edit_view_gtk.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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;
}
Expand All @@ -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
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions chrome/browser/chromeos/panels/panel_scroller.cc
Original file line number Diff line number Diff line change
@@ -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"

Expand All @@ -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;
Expand Down Expand Up @@ -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_;
Expand Down
12 changes: 6 additions & 6 deletions chrome/browser/chromeos/panels/panel_scroller.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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);
Expand All @@ -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.
Expand Down
12 changes: 6 additions & 6 deletions chrome/browser/chromeos/setting_level_bubble.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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_));
}
}

Expand Down
14 changes: 7 additions & 7 deletions chrome/browser/chromeos/setting_level_bubble.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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();
Expand All @@ -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_;
Expand All @@ -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);
Expand Down
7 changes: 4 additions & 3 deletions chrome/browser/chromeos/status/network_dropdown_button.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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));
Expand Down
10 changes: 5 additions & 5 deletions chrome/browser/chromeos/status/network_dropdown_button.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand All @@ -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);
Expand All @@ -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;
Expand Down
Loading

0 comments on commit f676780

Please sign in to comment.