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

Side by Side Diff: chrome/installer/mac/app/DownloadDelegate.m

Issue 2094583004: Initial commit for Chrome metainstaller on Mac. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Made small changes according to LGTM comments Created 4 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 unified diff | Download patch
« no previous file with comments | « chrome/installer/mac/app/DownloadDelegate.h ('k') | chrome/installer/mac/app/Downloader.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #import <assert.h>
6
7 #import "DownloadDelegate.h"
8 #import "Downloader.h"
9
10 @implementation DownloadDelegate : NSObject
11
12 // Skeleton of delegate method to provide download progress updates.
13 // TODO: Make use of (totalBytesWritten/totalBytesExpectedToWrite)*100
14 // to generate download progress percentage.
15 - (void)URLSession:(NSURLSession*)session
16 downloadTask:(NSURLSessionDownloadTask*)downloadTask
17 didWriteData:(int64_t)bytesWritten
18 totalBytesWritten:(int64_t)totalBytesWritten
19 totalBytesExpectedToWrite:(int64_t)totalBytesExpectedToWrite {
20 }
21
22 // Delegate method to move downloaded disk image to user's Download directory.
23 - (void)URLSession:(NSURLSession*)session
24 downloadTask:(NSURLSessionDownloadTask*)downloadTask
25 didFinishDownloadingToURL:(NSURL*)location {
26 assert([location isFileURL]);
27 NSFileManager* manager = [[NSFileManager alloc] init];
28 NSURL* downloadsDirectory =
29 [[NSURL alloc] initFileURLWithPath:[Downloader getDownloadsFilePath]];
30 if ([manager fileExistsAtPath:location.path]) {
31 [manager copyItemAtURL:location toURL:downloadsDirectory error:nil];
32 } else {
33 // TODO: Error Handling
34 }
35 }
36
37 - (void)URLSession:(NSURLSession*)session
38 task:(NSURLSessionTask*)task
39 didCompleteWithError:(NSError*)error {
40 // TODO: Error Handling
41 }
42 @end
OLDNEW
« no previous file with comments | « chrome/installer/mac/app/DownloadDelegate.h ('k') | chrome/installer/mac/app/Downloader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698