| OLD | NEW |
| 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 #import "chrome/browser/ui/cocoa/tabs/throbbing_image_view.h" | 5 #import "chrome/browser/ui/cocoa/tabs/throbbing_image_view.h" |
| 6 | 6 |
| 7 #include "ui/base/animation/animation_delegate.h" | 7 #include "ui/base/animation/animation_delegate.h" |
| 8 | 8 |
| 9 class ThrobbingImageViewAnimationDelegate : public ui::AnimationDelegate { | 9 class ThrobbingImageViewAnimationDelegate : public ui::AnimationDelegate { |
| 10 public: | 10 public: |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 throbImage_.reset([throbImage retain]); | 27 throbImage_.reset([throbImage retain]); |
| 28 | 28 |
| 29 delegate_.reset(new ThrobbingImageViewAnimationDelegate(self)); | 29 delegate_.reset(new ThrobbingImageViewAnimationDelegate(self)); |
| 30 throbAnimation_.reset(new ui::ThrobAnimation(delegate_.get())); | 30 throbAnimation_.reset(new ui::ThrobAnimation(delegate_.get())); |
| 31 throbAnimation_->SetThrobDuration(durationMS); | 31 throbAnimation_->SetThrobDuration(durationMS); |
| 32 throbAnimation_->StartThrobbing(-1); | 32 throbAnimation_->StartThrobbing(-1); |
| 33 } | 33 } |
| 34 return self; | 34 return self; |
| 35 } | 35 } |
| 36 | 36 |
| 37 - (void)setTweenType:(ui::Tween::Type)type { | |
| 38 throbAnimation_->SetTweenType(type); | |
| 39 } | |
| 40 | |
| 41 - (void)dealloc { | 37 - (void)dealloc { |
| 42 throbAnimation_->Stop(); | 38 throbAnimation_->Stop(); |
| 43 [super dealloc]; | 39 [super dealloc]; |
| 44 } | 40 } |
| 45 | 41 |
| 46 - (void)drawRect:(NSRect)rect { | 42 - (void)drawRect:(NSRect)rect { |
| 47 [backgroundImage_ drawInRect:[self bounds] | 43 [backgroundImage_ drawInRect:[self bounds] |
| 48 fromRect:NSZeroRect | 44 fromRect:NSZeroRect |
| 49 operation:NSCompositeSourceOver | 45 operation:NSCompositeSourceOver |
| 50 fraction:1]; | 46 fraction:1]; |
| 51 [throbImage_ drawInRect:[self bounds] | 47 [throbImage_ drawInRect:[self bounds] |
| 52 fromRect:NSZeroRect | 48 fromRect:NSZeroRect |
| 53 operation:NSCompositeSourceOver | 49 operation:NSCompositeSourceOver |
| 54 fraction:throbAnimation_->GetCurrentValue()]; | 50 fraction:throbAnimation_->GetCurrentValue()]; |
| 55 } | 51 } |
| 56 | 52 |
| 57 @end | 53 @end |
| OLD | NEW |