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

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: Addressed all comments except main block comment from elly 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
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 "DownloadDelegate.h"
Mark Mentovai 2016/07/11 17:56:16 DownloadDelegate.m should #import/#include like th
6 #import "downloader.h"
7 #import <assert.h>
8
9 @implementation DownloadDelegate : NSObject
10
11 // Skeleton of delegate method to provide download progress updates.
12 // TODO: Make use of (totalBytesWritten/totalBytesExpectedToWrite)*100
13 // to generate download progress percentage.
14 - (void)URLSession:(NSURLSession*)session
15 downloadTask:(NSURLSessionDownloadTask*)downloadTask
16 didWriteData:(int64_t)bytesWritten
17 totalBytesWritten:(int64_t)totalBytesWritten
18 totalBytesExpectedToWrite:(int64_t)totalBytesExpectedToWrite {
19 }
20
21 // Delegate method to move downloaded disk image to user's Download directory.
22 - (void)URLSession:(NSURLSession*)session
23 downloadTask:(NSURLSessionDownloadTask*)downloadTask
24 didFinishDownloadingToURL:(NSURL*)location {
25 assert([location isFileURL]);
26 NSFileManager* manager = [[NSFileManager alloc] init];
27 NSURL* downloadsDirectory =
28 [[NSURL alloc] initFileURLWithPath:[Downloader getDownloadsFilePath]];
29 if ([manager fileExistsAtPath:location.path]) {
30 [manager copyItemAtURL:location toURL:downloadsDirectory error:nil];
31 } else {
32 // TODO: Error Handling
33 }
34 }
35
36 - (void)URLSession:(NSURLSession*)session
37 task:(NSURLSessionTask*)task
38 didCompleteWithError:(NSError*)error {
39 // TODO: Error Handling
40 }
41 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698