Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | |
|
Mark Mentovai
2016/06/28 15:42:50
Minor nit: we don’t put the “(c)” in anymore.
| |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_INSTALLER_MAC_APP_DOWNLOADER_H_ | |
| 6 #define CHROME_INSTALLER_MAC_APP_DOWNLOADER_H_ | |
| 7 | |
| 8 #import <Foundation/Foundation.h> | |
| 9 | |
| 10 @interface Downloader : NSObject <NSXMLParserDelegate> | |
| 11 @property(nonatomic, copy) NSMutableArray *chromeDownloadURLs; | |
|
Mark Mentovai
2016/06/28 15:42:50
Nit: Chrome style is to put the * on the type name
| |
| 12 @property(nonatomic, copy) NSString *chromeImageFilename; | |
| 13 | |
| 14 // Prepares the array for use in the following methods. | |
|
Mark Mentovai
2016/06/28 15:42:50
A comment isn’t normally needed for -init methods,
| |
| 15 - (id)init; | |
| 16 | |
| 17 // Will parse the XML passed into it and extract all the url's it finds as well | |
|
Mark Mentovai
2016/06/28 15:42:50
Comments should be written more directly. Instead
Mark Mentovai
2016/06/28 15:42:50
URLs, not url's. Elsewhere, too.
| |
| 18 // as the filename. Will then add each url into the array of url's and report | |
|
Mark Mentovai
2016/06/28 15:42:50
How does it report errors? It has a void return va
| |
| 19 // any errors it had. | |
| 20 - (void)parseXML:(NSData*)omahaResponseXML; | |
| 21 | |
| 22 // The URL's we got from the previous method are incomplete and need the | |
|
Mark Mentovai
2016/06/28 15:42:50
go/avoidwe
| |
| 23 // filename (which is the same for all the links) appended to the end. | |
| 24 // This method iterates through the array and appends the filename to each URL. | |
| 25 - (void)appendFilenameToURL; | |
|
Mark Mentovai
2016/06/28 15:42:50
Not sure this makes sense to expose from this clas
| |
| 26 | |
| 27 // Expects the NSData object passed in to be an Omaha XML response file | |
|
Mark Mentovai
2016/06/28 15:42:50
Start with a description of what this method does,
| |
| 28 // Will then call the XML parser and extract the four URL's to the current | |
|
Mark Mentovai
2016/06/28 15:42:50
Why four? It might not always be four.
| |
| 29 // version of Chrome and return the first entry in that array | |
| 30 // TODO(ivan): check the URL's actually work ie. response is a 200/202 and | |
| 31 // return the first working URL. | |
| 32 - (NSURL*)getChromeImageURL: (NSData*)chromeImageAsData; | |
|
Mark Mentovai
2016/06/28 15:42:50
Style nit: no space after the colon. Do it like yo
Mark Mentovai
2016/06/28 15:42:50
but I think that chromeImageAsData is a misleading
| |
| 33 | |
| 34 // Takes the URL from getChromeImageURL and packages it into a NSData for easier | |
|
Mark Mentovai
2016/06/28 15:42:50
Not sure what this does.
| |
| 35 // downloading. | |
| 36 - (NSData*)downloadChromeAsData: (NSURL*)chromeURL; | |
| 37 | |
| 38 // Returns a path to an individuals home download folder. | |
|
Mark Mentovai
2016/06/28 15:42:50
an individuals→the user’s
| |
| 39 - (NSString*)getDownloadsFilePath; | |
| 40 | |
| 41 // Uses the packaged data from before as well as the filepath from before to | |
|
Mark Mentovai
2016/06/28 15:42:50
“before” = when?
| |
| 42 // download the chrome install image to the downloads folder. | |
| 43 - (void)writeChromeImageToDownloadsDirectory: (NSData*)chromeImageAsData; | |
| 44 | |
| 45 - (void)downloadChromeImageToDownloadsDirectory: (NSData*)responseXMLData; | |
|
Mark Mentovai
2016/06/28 15:42:50
What’s this do?
| |
| 46 | |
| 47 @end | |
| 48 | |
| 49 #endif // CHROME_INSTALLER_MAC_APP_DOWNLOADER_H_ | |
| OLD | NEW |