Index: chrome/browser/download/download_status_updater_mac.mm |
diff --git a/chrome/browser/download/download_status_updater_mac.mm b/chrome/browser/download/download_status_updater_mac.mm |
index 240f7ebe6cb649979696709e0b9a2ff3e13eeea3..ce448b68a3809037ecb45e40d995631ea6f53228 100644 |
--- a/chrome/browser/download/download_status_updater_mac.mm |
+++ b/chrome/browser/download/download_status_updater_mac.mm |
@@ -75,6 +75,13 @@ NSString* ProgressString(NSString* string) { |
} |
} |
+ if (!result) { |
+ // Huh. At least return a local copy of the expected string. |
+ result = string; |
+ if ([result hasSuffix:@"Key"]) |
+ result = [result substringToIndex:[result length] - 3]; |
Robert Sesek
2012/08/16 15:30:29
Pull @"Key" into a local so you don't have to coun
Avi (use Gerrit)
2012/08/16 15:41:42
Done.
|
+ } |
+ |
return result; |
} |
@@ -175,7 +182,7 @@ void UpdateAppIcon(int download_count, |
void CreateNSProgress(content::DownloadItem* download) { |
NSURL* source_url = [NSURL URLWithString: |
- base::SysUTF8ToNSString(download->GetURL().spec())]; |
+ base::SysUTF8ToNSString(download->GetURL().possibly_invalid_spec())]; |
FilePath destination_path = download->GetFullPath(); |
NSURL* destination_url = [NSURL fileURLWithPath: |
base::mac::FilePathToNSString(destination_path)]; |
@@ -186,12 +193,12 @@ void CreateNSProgress(content::DownloadItem* download) { |
// - kNSProgressFileIconOriginalRectKey : NSValue of NSRect in global coords |
NSDictionary* user_info = @{ |
- ProgressString(kNSProgressFileDownloadingSourceURLKey) : source_url, |
ProgressString(kNSProgressFileLocationCanChangeKey) : @true, |
ProgressString(kNSProgressFileOperationKindKey) : |
ProgressString(kNSProgressFileOperationKindDownloading), |
Robert Sesek
2012/08/16 15:30:29
nit: this should be indented 2 more
Avi (use Gerrit)
2012/08/16 15:41:42
Done.
|
ProgressString(kNSProgressFileURLKey) : destination_url |
}; |
+ |
Class progress_class = NSClassFromString(@"NSProgress"); |
NSProgress* progress = [progress_class performSelector:@selector(alloc)]; |
progress = [progress performSelector:@selector(initWithParent:userInfo:) |
@@ -199,6 +206,11 @@ void CreateNSProgress(content::DownloadItem* download) { |
withObject:user_info]; |
progress.kind = ProgressString(kNSProgressKindFile); |
+ if (source_url) { |
+ [progress setUserInfoObject:source_url forKey: |
+ ProgressString(kNSProgressFileDownloadingSourceURLKey)]; |
+ } |
+ |
progress.pausable = NO; |
progress.cancellable = YES; |
[progress setCancellationHandler:^{ |