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: |
11 ThrobbingImageViewAnimationDelegate(NSView* view) : view_(view) {} | 11 explicit ThrobbingImageViewAnimationDelegate(NSView* view) : view_(view) {} |
12 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE { | 12 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE { |
13 [view_ setNeedsDisplay:YES]; | 13 [view_ setNeedsDisplay:YES]; |
14 } | 14 } |
15 private: | 15 private: |
16 NSView* view_; // weak | 16 NSView* view_; // weak |
17 }; | 17 }; |
18 | 18 |
19 @implementation ThrobbingImageView | 19 @implementation ThrobbingImageView |
20 | 20 |
21 - (id)initWithFrame:(NSRect)rect | 21 - (id)initWithFrame:(NSRect)rect |
(...skipping 22 matching lines...) Expand all Loading... |
44 fromRect:NSZeroRect | 44 fromRect:NSZeroRect |
45 operation:NSCompositeSourceOver | 45 operation:NSCompositeSourceOver |
46 fraction:1]; | 46 fraction:1]; |
47 [throbImage_ drawInRect:[self bounds] | 47 [throbImage_ drawInRect:[self bounds] |
48 fromRect:NSZeroRect | 48 fromRect:NSZeroRect |
49 operation:NSCompositeSourceOver | 49 operation:NSCompositeSourceOver |
50 fraction:throbAnimation_->GetCurrentValue()]; | 50 fraction:throbAnimation_->GetCurrentValue()]; |
51 } | 51 } |
52 | 52 |
53 @end | 53 @end |
OLD | NEW |