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

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

Issue 1236463002: Vectorize download shelf progress indicators (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 5 years, 5 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 6b0bda42d9da8eca8c994032d423c4b235d93ece..1af022cfcbbd4893fc382142c75d30ba5bc80143 100644
--- a/chrome/browser/ui/cocoa/download/download_item_cell.mm
+++ b/chrome/browser/ui/cocoa/download/download_item_cell.mm
@@ -76,16 +76,6 @@ const CGFloat kInterruptedAnimationDuration = 2.5;
using content::DownloadItem;
-namespace {
-
-// Passed as a callback to DownloadShelf paint functions. On toolkit-views
-// platforms it will mirror the position of the download progress, but that's
-// not done on Mac.
-void DummyRTLMirror(gfx::Rect* bounds) {
-}
-
-} // namespace
-
// This is a helper class to animate the fading out of the status text.
@interface DownloadItemCellAnimation : NSAnimation {
@private
@@ -140,7 +130,6 @@ void DummyRTLMirror(gfx::Rect* bounds) {
isStatusTextVisible_ = NO;
titleY_ = kPrimaryTextOnlyPosTop;
statusAlpha_ = 0.0;
- indeterminateProgressAngle_ = DownloadShelf::kStartAngleDegrees;
[self setFont:[NSFont systemFontOfSize:
[NSFont systemFontSizeForControlSize:NSSmallControlSize]]];
@@ -252,6 +241,7 @@ void DummyRTLMirror(gfx::Rect* bounds) {
if (!indeterminateProgressTimer_) {
indeterminateProgressTimer_.reset([[IndeterminateProgressTimer alloc]
initWithDownloadItemCell:self]);
+ progressStartTime_ = base::TimeTicks::Now();
}
} else {
percentDone_ = downloadModel->PercentComplete();
@@ -562,21 +552,20 @@ void DummyRTLMirror(gfx::Rect* bounds) {
gfx::CanvasSkiaPaint canvas(dirtyRect, false);
canvas.set_composite_alpha(true);
+ canvas.Translate(gfx::Vector2d(x, y));
+
if (completionAnimation_.get()) {
if ([completionAnimation_ isAnimating]) {
if (percentDone_ == -1) {
DownloadShelf::PaintDownloadComplete(
- &canvas, base::Bind(&DummyRTLMirror), x, y,
- [completionAnimation_ currentValue]);
+ &canvas, [completionAnimation_ currentValue]);
} else {
DownloadShelf::PaintDownloadInterrupted(
- &canvas, base::Bind(&DummyRTLMirror), x, y,
- [completionAnimation_ currentValue]);
+ &canvas, [completionAnimation_ currentValue]);
}
}
} else if (percentDone_ >= 0 || indeterminateProgressTimer_) {
- DownloadShelf::PaintDownloadProgress(&canvas, base::Bind(&DummyRTLMirror),
- x, y, indeterminateProgressAngle_,
+ DownloadShelf::PaintDownloadProgress(&canvas, progressStartTime_,
percentDone_);
}
}
@@ -689,9 +678,6 @@ void DummyRTLMirror(gfx::Rect* bounds) {
}
- (void)updateIndeterminateDownload {
- indeterminateProgressAngle_ =
- (indeterminateProgressAngle_ + DownloadShelf::kUnknownIncrementDegrees) %
- DownloadShelf::kMaxDegrees;
[[self controlView] setNeedsDisplay:YES];
}

Powered by Google App Engine
This is Rietveld 408576698