| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
| 8 #include "app/text_elider.h" | 8 #include "app/text_elider.h" |
| 9 #include "base/mac_util.h" | 9 #include "base/mac_util.h" |
| 10 #include "base/sys_string_conversions.h" | 10 #include "base/sys_string_conversions.h" |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 } | 230 } |
| 231 [secondaryTitle_ release]; | 231 [secondaryTitle_ release]; |
| 232 [secondaryFont_ release]; | 232 [secondaryFont_ release]; |
| 233 [super dealloc]; | 233 [super dealloc]; |
| 234 } | 234 } |
| 235 | 235 |
| 236 - (void)setStateFromDownload:(BaseDownloadItemModel*)downloadModel { | 236 - (void)setStateFromDownload:(BaseDownloadItemModel*)downloadModel { |
| 237 // Set the name of the download. | 237 // Set the name of the download. |
| 238 downloadPath_ = downloadModel->download()->GetFileNameToReportUser(); | 238 downloadPath_ = downloadModel->download()->GetFileNameToReportUser(); |
| 239 | 239 |
| 240 std::wstring statusText = downloadModel->GetStatusText(); | 240 string16 statusText = downloadModel->GetStatusText(); |
| 241 if (statusText.empty()) { | 241 if (statusText.empty()) { |
| 242 // Remove the status text label. | 242 // Remove the status text label. |
| 243 [self hideSecondaryTitle]; | 243 [self hideSecondaryTitle]; |
| 244 isStatusTextVisible_ = NO; | 244 isStatusTextVisible_ = NO; |
| 245 } else { | 245 } else { |
| 246 // Set status text. | 246 // Set status text. |
| 247 NSString* statusString = base::SysWideToNSString(statusText); | 247 NSString* statusString = base::SysUTF16ToNSString(statusText); |
| 248 [self setSecondaryTitle:statusString]; | 248 [self setSecondaryTitle:statusString]; |
| 249 isStatusTextVisible_ = YES; | 249 isStatusTextVisible_ = YES; |
| 250 } | 250 } |
| 251 | 251 |
| 252 switch (downloadModel->download()->state()) { | 252 switch (downloadModel->download()->state()) { |
| 253 case DownloadItem::COMPLETE: | 253 case DownloadItem::COMPLETE: |
| 254 // Small downloads may start in a complete state due to asynchronous | 254 // Small downloads may start in a complete state due to asynchronous |
| 255 // notifications. In this case, we'll get a second complete notification | 255 // notifications. In this case, we'll get a second complete notification |
| 256 // via the observers, so we ignore it and avoid creating a second complete | 256 // via the observers, so we ignore it and avoid creating a second complete |
| 257 // animation. | 257 // animation. |
| (...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 699 } | 699 } |
| 700 return self; | 700 return self; |
| 701 } | 701 } |
| 702 | 702 |
| 703 - (void)setCurrentProgress:(NSAnimationProgress)progress { | 703 - (void)setCurrentProgress:(NSAnimationProgress)progress { |
| 704 [super setCurrentProgress:progress]; | 704 [super setCurrentProgress:progress]; |
| 705 [cell_ animation:self progressed:progress]; | 705 [cell_ animation:self progressed:progress]; |
| 706 } | 706 } |
| 707 | 707 |
| 708 @end | 708 @end |
| OLD | NEW |