| 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 |
| 37 - (void)dealloc { | 41 - (void)dealloc { |
| 38 throbAnimation_->Stop(); | 42 throbAnimation_->Stop(); |
| 39 [super dealloc]; | 43 [super dealloc]; |
| 40 } | 44 } |
| 41 | 45 |
| 42 - (void)drawRect:(NSRect)rect { | 46 - (void)drawRect:(NSRect)rect { |
| 43 [backgroundImage_ drawInRect:[self bounds] | 47 [backgroundImage_ drawInRect:[self bounds] |
| 44 fromRect:NSZeroRect | 48 fromRect:NSZeroRect |
| 45 operation:NSCompositeSourceOver | 49 operation:NSCompositeSourceOver |
| 46 fraction:1]; | 50 fraction:1]; |
| 47 [throbImage_ drawInRect:[self bounds] | 51 [throbImage_ drawInRect:[self bounds] |
| 48 fromRect:NSZeroRect | 52 fromRect:NSZeroRect |
| 49 operation:NSCompositeSourceOver | 53 operation:NSCompositeSourceOver |
| 50 fraction:throbAnimation_->GetCurrentValue()]; | 54 fraction:throbAnimation_->GetCurrentValue()]; |
| 51 } | 55 } |
| 52 | 56 |
| 53 @end | 57 @end |
| OLD | NEW |