Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(679)

Side by Side Diff: app/throb_animation.h

Issue 6154001: Move animation code to new ui/base/animation directory.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « app/test_animation_delegate.h ('k') | app/throb_animation.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef APP_THROB_ANIMATION_H_ 5 #ifndef APP_THROB_ANIMATION_H_
6 #define APP_THROB_ANIMATION_H_ 6 #define APP_THROB_ANIMATION_H_
7 #pragma once 7 #pragma once
8 8
9 #include "app/slide_animation.h" 9 #include "ui/base/animation/throb_animation.h"
10 10
11 // A subclass of SlideAnimation that can continually slide. All of the Animation 11 using ui::ThrobAnimation;
12 // methods behave like that of SlideAnimation: transition to the next state.
13 // The StartThrobbing method causes the ThrobAnimation to cycle between hidden
14 // and shown for a set number of cycles.
15 //
16 // A ThrobAnimation has two durations: the duration used when behavior like
17 // a SlideAnimation, and the duration used when throbbing.
18 class ThrobAnimation : public SlideAnimation {
19 public:
20 explicit ThrobAnimation(AnimationDelegate* target);
21 virtual ~ThrobAnimation() {}
22
23 // Starts throbbing. cycles_til_stop gives the number of cycles to do before
24 // stopping. A negative value means "throb indefinitely".
25 void StartThrobbing(int cycles_til_stop);
26
27 // Sets the duration of the slide animation when throbbing.
28 void SetThrobDuration(int duration) { throb_duration_ = duration; }
29
30 // Overridden to reset to the slide duration.
31 virtual void Reset();
32 virtual void Show();
33 virtual void Hide();
34
35 // Overridden to maintain the slide duration.
36 virtual void SetSlideDuration(int duration);
37
38 // The number of cycles remaining until the animation stops.
39 void set_cycles_remaining(int value) { cycles_remaining_ = value; }
40 int cycles_remaining() const { return cycles_remaining_; }
41
42 protected:
43 // Overriden to continually throb (assuming we're throbbing).
44 virtual void Step(base::TimeTicks time_now);
45
46 private:
47 // Resets state such that we behave like SlideAnimation.
48 void ResetForSlide();
49
50 // Duration of the slide animation.
51 int slide_duration_;
52
53 // Duration of the slide animation when throbbing.
54 int throb_duration_;
55
56 // If throbbing, this is the number of cycles left.
57 int cycles_remaining_;
58
59 // Are we throbbing?
60 bool throbbing_;
61
62 DISALLOW_COPY_AND_ASSIGN(ThrobAnimation);
63 };
64 12
65 #endif // APP_THROB_ANIMATION_H_ 13 #endif // APP_THROB_ANIMATION_H_
OLDNEW
« no previous file with comments | « app/test_animation_delegate.h ('k') | app/throb_animation.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698