| Index: chrome/installer/mac/app/Downloader.m
|
| diff --git a/chrome/installer/mac/app/Downloader.m b/chrome/installer/mac/app/Downloader.m
|
| index ff773dc86d38ec108154eebe5dee1b233ce10ea8..ce8482a41ecea3cd7fcc560ec8254e3e7d72c20e 100644
|
| --- a/chrome/installer/mac/app/Downloader.m
|
| +++ b/chrome/installer/mac/app/Downloader.m
|
| @@ -10,17 +10,9 @@
|
|
|
| @synthesize delegate = delegate_;
|
|
|
| -+ (NSString*)getChromeDownloadFilePath {
|
| - NSArray* downloadPaths = NSSearchPathForDirectoriesInDomains(
|
| - NSDownloadsDirectory, NSUserDomainMask, YES);
|
| - NSString* completeFilePath = [NSString
|
| - pathWithComponents:@[ [downloadPaths firstObject], @"GoogleChrome.dmg" ]];
|
| - return completeFilePath;
|
| -}
|
| -
|
| // Downloads contents of chromeURL to downloads folders and delegates the work
|
| // to the DownloadDelegate class.
|
| -- (void)downloadChromeImageToDownloadsDirectory:(NSURL*)chromeImageURL {
|
| +- (void)downloadChromeImageFrom:(NSURL*)chromeImageURL {
|
| NSURLSession* session =
|
| [NSURLSession sessionWithConfiguration:[NSURLSessionConfiguration
|
| defaultSessionConfiguration]
|
| @@ -38,7 +30,7 @@
|
| totalBytesExpectedToWrite:(int64_t)totalBytesExpectedToWrite {
|
| double downloadProgressPercentage =
|
| (double)totalBytesWritten / totalBytesExpectedToWrite * 100.0;
|
| - [delegate_ didDownloadData:downloadProgressPercentage];
|
| + [delegate_ downloader:self percentProgress:downloadProgressPercentage];
|
| }
|
|
|
| // Delegate method to move downloaded disk image to user's Download directory.
|
| @@ -46,24 +38,14 @@
|
| downloadTask:(NSURLSessionDownloadTask*)downloadTask
|
| didFinishDownloadingToURL:(NSURL*)location {
|
| assert([location isFileURL]);
|
| - NSFileManager* manager = [NSFileManager defaultManager];
|
| - NSURL* downloadsDirectory =
|
| - [NSURL fileURLWithPath:[Downloader getChromeDownloadFilePath]];
|
| - NSError* fileManagerError = nil;
|
| - [manager moveItemAtURL:location
|
| - toURL:downloadsDirectory
|
| - error:&fileManagerError];
|
| - if (fileManagerError) {
|
| - [delegate_ downloader:self onDownloadFailureWithError:fileManagerError];
|
| - }
|
| - [delegate_ downloader:self onDownloadSuccess:location];
|
| + [delegate_ downloader:self onSuccess:location];
|
| }
|
|
|
| - (void)URLSession:(NSURLSession*)session
|
| task:(NSURLSessionTask*)task
|
| didCompleteWithError:(NSError*)error {
|
| if (error) {
|
| - [delegate_ downloader:self onDownloadFailureWithError:error];
|
| + [delegate_ downloader:self onFailure:error];
|
| }
|
| }
|
|
|
|
|