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/download/download_item_cell.h" | 5 #import "chrome/browser/ui/cocoa/download/download_item_cell.h" |
6 | 6 |
7 #include "base/strings/sys_string_conversions.h" | 7 #include "base/strings/sys_string_conversions.h" |
8 #include "chrome/browser/download/download_item_model.h" | 8 #include "chrome/browser/download/download_item_model.h" |
9 #include "chrome/browser/download/download_util.h" | 9 #include "chrome/browser/download/download_util.h" |
10 #import "chrome/browser/themes/theme_properties.h" | 10 #import "chrome/browser/themes/theme_properties.h" |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 | 89 |
90 @end | 90 @end |
91 | 91 |
92 // Timer used to animate indeterminate progress. An NSTimer retains its target. | 92 // Timer used to animate indeterminate progress. An NSTimer retains its target. |
93 // This means that the target must explicitly invalidate the timer before it | 93 // This means that the target must explicitly invalidate the timer before it |
94 // can be deleted. This class keeps a weak reference to the target so the | 94 // can be deleted. This class keeps a weak reference to the target so the |
95 // timer can be invalidated from the destructor. | 95 // timer can be invalidated from the destructor. |
96 @interface IndeterminateProgressTimer : NSObject { | 96 @interface IndeterminateProgressTimer : NSObject { |
97 @private | 97 @private |
98 DownloadItemCell* cell_; | 98 DownloadItemCell* cell_; |
99 scoped_nsobject<NSTimer> timer_; | 99 base::scoped_nsobject<NSTimer> timer_; |
100 } | 100 } |
101 | 101 |
102 - (id)initWithDownloadItemCell:(DownloadItemCell*)cell; | 102 - (id)initWithDownloadItemCell:(DownloadItemCell*)cell; |
103 - (void)invalidate; | 103 - (void)invalidate; |
104 | 104 |
105 @end | 105 @end |
106 | 106 |
107 @interface DownloadItemCell(Private) | 107 @interface DownloadItemCell(Private) |
108 - (void)updateTrackingAreas:(id)sender; | 108 - (void)updateTrackingAreas:(id)sender; |
109 - (void)setupToggleStatusVisibilityAnimation; | 109 - (void)setupToggleStatusVisibilityAnimation; |
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
614 cy - kDropdownArrowHeight/3 + kDropdownAreaY); | 614 cy - kDropdownArrowHeight/3 + kDropdownAreaY); |
615 NSPoint p3 = NSMakePoint(cx, cy + kDropdownArrowHeight*2/3 + kDropdownAreaY); | 615 NSPoint p3 = NSMakePoint(cx, cy + kDropdownArrowHeight*2/3 + kDropdownAreaY); |
616 NSBezierPath *triangle = [NSBezierPath bezierPath]; | 616 NSBezierPath *triangle = [NSBezierPath bezierPath]; |
617 [triangle moveToPoint:p1]; | 617 [triangle moveToPoint:p1]; |
618 [triangle lineToPoint:p2]; | 618 [triangle lineToPoint:p2]; |
619 [triangle lineToPoint:p3]; | 619 [triangle lineToPoint:p3]; |
620 [triangle closePath]; | 620 [triangle closePath]; |
621 | 621 |
622 gfx::ScopedNSGraphicsContextSaveGState scopedGState; | 622 gfx::ScopedNSGraphicsContextSaveGState scopedGState; |
623 | 623 |
624 scoped_nsobject<NSShadow> shadow([[NSShadow alloc] init]); | 624 base::scoped_nsobject<NSShadow> shadow([[NSShadow alloc] init]); |
625 [shadow.get() setShadowColor:[NSColor whiteColor]]; | 625 [shadow.get() setShadowColor:[NSColor whiteColor]]; |
626 [shadow.get() setShadowOffset:NSMakeSize(0, -1)]; | 626 [shadow.get() setShadowOffset:NSMakeSize(0, -1)]; |
627 [shadow setShadowBlurRadius:0.0]; | 627 [shadow setShadowBlurRadius:0.0]; |
628 [shadow set]; | 628 [shadow set]; |
629 | 629 |
630 NSColor* fill = [self titleColorForPart:kDownloadItemMouseOverDropdownPart]; | 630 NSColor* fill = [self titleColorForPart:kDownloadItemMouseOverDropdownPart]; |
631 [fill setFill]; | 631 [fill setFill]; |
632 | 632 |
633 [triangle fill]; | 633 [triangle fill]; |
634 } | 634 } |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
765 | 765 |
766 - (void)invalidate { | 766 - (void)invalidate { |
767 [timer_ invalidate]; | 767 [timer_ invalidate]; |
768 } | 768 } |
769 | 769 |
770 - (void)onTimer:(NSTimer*)timer { | 770 - (void)onTimer:(NSTimer*)timer { |
771 [cell_ updateIndeterminateDownload]; | 771 [cell_ updateIndeterminateDownload]; |
772 } | 772 } |
773 | 773 |
774 @end | 774 @end |
OLD | NEW |