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

Unified Diff: chrome/browser/ui/cocoa/download/download_item_cell.mm

Issue 6905049: Detect removed files and reflect the state in chrome://downloads and the download shelf (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Merge with the latest revision Created 9 years, 6 months 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/cocoa/download/download_item_cell.mm
diff --git a/chrome/browser/ui/cocoa/download/download_item_cell.mm b/chrome/browser/ui/cocoa/download/download_item_cell.mm
index 234dc10b656424eabfe4d5fbf2ee47d5a679f24c..3e20cd06ed0285c75baf2564188478b57417f899 100644
--- a/chrome/browser/ui/cocoa/download/download_item_cell.mm
+++ b/chrome/browser/ui/cocoa/download/download_item_cell.mm
@@ -68,6 +68,7 @@ const CGFloat kDropdownArrowHeight = 3;
const CGFloat kDropdownAreaY = -2;
// Duration of the two-lines-to-one-line animation, in seconds.
+NSTimeInterval kShowStatusDuration = 0.3;
NSTimeInterval kHideStatusDuration = 0.3;
// Duration of the 'download complete' animation, in seconds.
@@ -87,6 +88,7 @@ const int kInterruptedAnimationDuration = 2.5;
@interface DownloadItemCell(Private)
- (void)updateTrackingAreas:(id)sender;
+- (void)showSecondaryTitle;
- (void)hideSecondaryTitle;
- (void)animation:(NSAnimation*)animation
progressed:(NSAnimationProgress)progress;
@@ -142,6 +144,8 @@ const int kInterruptedAnimationDuration = 2.5;
[[NSNotificationCenter defaultCenter] removeObserver:self];
if ([completionAnimation_ isAnimating])
[completionAnimation_ stopAnimation];
+ if ([showStatusAnimation_ isAnimating])
+ [showStatusAnimation_ stopAnimation];
if ([hideStatusAnimation_ isAnimating])
[hideStatusAnimation_ stopAnimation];
if (trackingAreaButton_) {
@@ -170,6 +174,7 @@ const int kInterruptedAnimationDuration = 2.5;
// Set status text.
NSString* statusString = base::SysUTF16ToNSString(statusText);
[self setSecondaryTitle:statusString];
+ [self showSecondaryTitle];
isStatusTextVisible_ = YES;
}
@@ -593,6 +598,21 @@ const int kInterruptedAnimationDuration = 2.5;
kImageHeight);
}
+- (void)showSecondaryTitle {
+ if (!isStatusTextVisible_) {
+ // No core animation -- text in CA layers is not subpixel antialiased :-/
+ showStatusAnimation_.reset([[DownloadItemCellAnimation alloc]
+ initWithDownloadItemCell:self
+ duration:kShowStatusDuration
+ animationCurve:NSAnimationEaseIn]);
+ [showStatusAnimation_.get() setDelegate:self];
+ [showStatusAnimation_.get() startAnimation];
+ } else {
+ // If the status line continues to be visible, don't show an animation
+ [self animation:nil progressed:0.0];
+ }
+}
+
- (void)hideSecondaryTitle {
if (isStatusTextVisible_) {
// No core animation -- text in CA layers is not subpixel antialiased :-/
@@ -611,7 +631,12 @@ const int kInterruptedAnimationDuration = 2.5;
- (void)animation:(NSAnimation*)animation
progressed:(NSAnimationProgress)progress {
- if (animation == hideStatusAnimation_ || animation == nil) {
+ if (animation == showStatusAnimation_) {
+ titleY_ = (1 - progress)*kPrimaryTextOnlyPosTop +
+ kPrimaryTextPosTop;
+ statusAlpha_ = progress;
+ [[self controlView] setNeedsDisplay:YES];
+ } else if (animation == hideStatusAnimation_ || animation == nil) {
titleY_ = progress*kPrimaryTextOnlyPosTop +
(1 - progress)*kPrimaryTextPosTop;
statusAlpha_ = 1 - progress;
@@ -622,7 +647,9 @@ const int kInterruptedAnimationDuration = 2.5;
}
- (void)animationDidEnd:(NSAnimation *)animation {
- if (animation == hideStatusAnimation_)
+ if (animation == showStatusAnimation_)
+ showStatusAnimation_.reset();
+ else if (animation == hideStatusAnimation_)
hideStatusAnimation_.reset();
else if (animation == completionAnimation_)
completionAnimation_.reset();
« no previous file with comments | « chrome/browser/ui/cocoa/download/download_item_cell.h ('k') | chrome/browser/ui/gtk/download/download_item_gtk.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698