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

Side by Side Diff: ui/gfx/animation/throb_animation.cc

Issue 26880010: gfx: Add FrameTime and DisplayTime classes (Closed) Base URL: http://git.chromium.org/chromium/src.git@checkHighResNow4
Patch Set: WIP Created 7 years, 1 month 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
« no previous file with comments | « ui/gfx/animation/throb_animation.h ('k') | ui/gfx/frame_time.h » ('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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #include "ui/gfx/animation/throb_animation.h" 5 #include "ui/gfx/animation/throb_animation.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 namespace gfx { 9 namespace gfx {
10 10
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 50
51 void ThrobAnimation::Hide() { 51 void ThrobAnimation::Hide() {
52 ResetForSlide(); 52 ResetForSlide();
53 SlideAnimation::Hide(); 53 SlideAnimation::Hide();
54 } 54 }
55 55
56 void ThrobAnimation::SetSlideDuration(int duration) { 56 void ThrobAnimation::SetSlideDuration(int duration) {
57 slide_duration_ = duration; 57 slide_duration_ = duration;
58 } 58 }
59 59
60 void ThrobAnimation::Step(base::TimeTicks time_now) { 60 void ThrobAnimation::Step(gfx::FrameTime time_now) {
61 LinearAnimation::Step(time_now); 61 LinearAnimation::Step(time_now);
62 62
63 if (!is_animating() && throbbing_) { 63 if (!is_animating() && throbbing_) {
64 // Were throbbing a finished a cycle. Start the next cycle unless we're at 64 // Were throbbing a finished a cycle. Start the next cycle unless we're at
65 // the end of the cycles, in which case we stop. 65 // the end of the cycles, in which case we stop.
66 cycles_remaining_--; 66 cycles_remaining_--;
67 if (IsShowing()) { 67 if (IsShowing()) {
68 // We want to stop hidden, hence this doesn't check cycles_remaining_. 68 // We want to stop hidden, hence this doesn't check cycles_remaining_.
69 SlideAnimation::Hide(); 69 SlideAnimation::Hide();
70 } else if (cycles_remaining_ > 0) { 70 } else if (cycles_remaining_ > 0) {
71 SlideAnimation::Show(); 71 SlideAnimation::Show();
72 } else { 72 } else {
73 // We're done throbbing. 73 // We're done throbbing.
74 throbbing_ = false; 74 throbbing_ = false;
75 } 75 }
76 } 76 }
77 } 77 }
78 78
79 void ThrobAnimation::ResetForSlide() { 79 void ThrobAnimation::ResetForSlide() {
80 SlideAnimation::SetSlideDuration(slide_duration_); 80 SlideAnimation::SetSlideDuration(slide_duration_);
81 cycles_remaining_ = 0; 81 cycles_remaining_ = 0;
82 throbbing_ = false; 82 throbbing_ = false;
83 } 83 }
84 84
85 } // namespace gfx 85 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gfx/animation/throb_animation.h ('k') | ui/gfx/frame_time.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698