| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/sys_string_conversions.h" | 7 #include "base/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_service.h" | 10 #import "chrome/browser/themes/theme_service.h" |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 if (statusText.empty()) { | 168 if (statusText.empty()) { |
| 169 // Remove the status text label. | 169 // Remove the status text label. |
| 170 [self hideSecondaryTitle]; | 170 [self hideSecondaryTitle]; |
| 171 } else { | 171 } else { |
| 172 // Set status text. | 172 // Set status text. |
| 173 NSString* statusString = base::SysUTF16ToNSString(statusText); | 173 NSString* statusString = base::SysUTF16ToNSString(statusText); |
| 174 [self setSecondaryTitle:statusString]; | 174 [self setSecondaryTitle:statusString]; |
| 175 [self showSecondaryTitle]; | 175 [self showSecondaryTitle]; |
| 176 } | 176 } |
| 177 | 177 |
| 178 switch (downloadModel->download()->state()) { | 178 switch (downloadModel->download()->GetState()) { |
| 179 case DownloadItem::COMPLETE: | 179 case DownloadItem::COMPLETE: |
| 180 // Small downloads may start in a complete state due to asynchronous | 180 // Small downloads may start in a complete state due to asynchronous |
| 181 // notifications. In this case, we'll get a second complete notification | 181 // notifications. In this case, we'll get a second complete notification |
| 182 // via the observers, so we ignore it and avoid creating a second complete | 182 // via the observers, so we ignore it and avoid creating a second complete |
| 183 // animation. | 183 // animation. |
| 184 if (completionAnimation_.get()) | 184 if (completionAnimation_.get()) |
| 185 break; | 185 break; |
| 186 completionAnimation_.reset([[DownloadItemCellAnimation alloc] | 186 completionAnimation_.reset([[DownloadItemCellAnimation alloc] |
| 187 initWithDownloadItemCell:self | 187 initWithDownloadItemCell:self |
| 188 duration:kCompleteAnimationDuration | 188 duration:kCompleteAnimationDuration |
| (...skipping 14 matching lines...) Expand all Loading... |
| 203 break; | 203 break; |
| 204 completionAnimation_.reset([[DownloadItemCellAnimation alloc] | 204 completionAnimation_.reset([[DownloadItemCellAnimation alloc] |
| 205 initWithDownloadItemCell:self | 205 initWithDownloadItemCell:self |
| 206 duration:kInterruptedAnimationDuration | 206 duration:kInterruptedAnimationDuration |
| 207 animationCurve:NSAnimationLinear]); | 207 animationCurve:NSAnimationLinear]); |
| 208 [completionAnimation_.get() setDelegate:self]; | 208 [completionAnimation_.get() setDelegate:self]; |
| 209 [completionAnimation_.get() startAnimation]; | 209 [completionAnimation_.get() startAnimation]; |
| 210 percentDone_ = -2; | 210 percentDone_ = -2; |
| 211 break; | 211 break; |
| 212 case DownloadItem::IN_PROGRESS: | 212 case DownloadItem::IN_PROGRESS: |
| 213 percentDone_ = downloadModel->download()->is_paused() ? | 213 percentDone_ = downloadModel->download()->IsPaused() ? |
| 214 -1 : downloadModel->download()->PercentComplete(); | 214 -1 : downloadModel->download()->PercentComplete(); |
| 215 break; | 215 break; |
| 216 default: | 216 default: |
| 217 NOTREACHED(); | 217 NOTREACHED(); |
| 218 } | 218 } |
| 219 | 219 |
| 220 [[self controlView] setNeedsDisplay:YES]; | 220 [[self controlView] setNeedsDisplay:YES]; |
| 221 } | 221 } |
| 222 | 222 |
| 223 - (void)updateTrackingAreas:(id)sender { | 223 - (void)updateTrackingAreas:(id)sender { |
| (...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 684 } | 684 } |
| 685 return self; | 685 return self; |
| 686 } | 686 } |
| 687 | 687 |
| 688 - (void)setCurrentProgress:(NSAnimationProgress)progress { | 688 - (void)setCurrentProgress:(NSAnimationProgress)progress { |
| 689 [super setCurrentProgress:progress]; | 689 [super setCurrentProgress:progress]; |
| 690 [cell_ animation:self progressed:progress]; | 690 [cell_ animation:self progressed:progress]; |
| 691 } | 691 } |
| 692 | 692 |
| 693 @end | 693 @end |
| OLD | NEW |