Index: chrome/installer/mac/app/downloader.h |
diff --git a/chrome/installer/mac/app/downloader.h b/chrome/installer/mac/app/downloader.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..639fab4f3c70dc3517f66933cc496260d52f2539 |
--- /dev/null |
+++ b/chrome/installer/mac/app/downloader.h |
@@ -0,0 +1,49 @@ |
+// 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.
|
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CHROME_INSTALLER_MAC_APP_DOWNLOADER_H_ |
+#define CHROME_INSTALLER_MAC_APP_DOWNLOADER_H_ |
+ |
+#import <Foundation/Foundation.h> |
+ |
+@interface Downloader : NSObject <NSXMLParserDelegate> |
+@property(nonatomic, copy) NSMutableArray *chromeDownloadURLs; |
Mark Mentovai
2016/06/28 15:42:50
Nit: Chrome style is to put the * on the type name
|
+@property(nonatomic, copy) NSString *chromeImageFilename; |
+ |
+// 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,
|
+- (id)init; |
+ |
+// 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.
|
+// 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
|
+// any errors it had. |
+- (void)parseXML:(NSData*)omahaResponseXML; |
+ |
+// The URL's we got from the previous method are incomplete and need the |
Mark Mentovai
2016/06/28 15:42:50
go/avoidwe
|
+// filename (which is the same for all the links) appended to the end. |
+// This method iterates through the array and appends the filename to each URL. |
+- (void)appendFilenameToURL; |
Mark Mentovai
2016/06/28 15:42:50
Not sure this makes sense to expose from this clas
|
+ |
+// 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,
|
+// 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.
|
+// version of Chrome and return the first entry in that array |
+// TODO(ivan): check the URL's actually work ie. response is a 200/202 and |
+// return the first working URL. |
+- (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
|
+ |
+// 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.
|
+// downloading. |
+- (NSData*)downloadChromeAsData: (NSURL*)chromeURL; |
+ |
+// Returns a path to an individuals home download folder. |
Mark Mentovai
2016/06/28 15:42:50
an individuals→the user’s
|
+- (NSString*)getDownloadsFilePath; |
+ |
+// Uses the packaged data from before as well as the filepath from before to |
Mark Mentovai
2016/06/28 15:42:50
“before” = when?
|
+// download the chrome install image to the downloads folder. |
+- (void)writeChromeImageToDownloadsDirectory: (NSData*)chromeImageAsData; |
+ |
+- (void)downloadChromeImageToDownloadsDirectory: (NSData*)responseXMLData; |
Mark Mentovai
2016/06/28 15:42:50
What’s this do?
|
+ |
+@end |
+ |
+#endif // CHROME_INSTALLER_MAC_APP_DOWNLOADER_H_ |