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/parser.m

Issue 2094583004: Initial commit for Chrome metainstaller on Mac. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Additional progress addressing downloader and parser, moved BUILD dependencies away from root. 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 (c) 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 "parser.h"
6
7 @implementation Parser
8 /*
9 @synthesize chromeDownloadURLs;
10 @synthesize filename;
11
12 - (id)init {
13 if ((self = [super init])) {
14 _chromeDownloadURLs = [[NSMutableArray alloc] init];
15 }
16 return self;
17 }
18
19 - (void)parseXML:(NSData*)someData {
20 NSData *data = someData;
21 NSXMLParser *parser = [[NSXMLParser alloc] initWithData:data];
22 - (void)parseXML:(NSData*)omahaResponseXML {
23 NSData *response = omahaResponseXML;
24 NSXMLParser *parser = [[NSXMLParser alloc] initWithData:response];
25
26 [parser setDelegate:self];
27 bool success = [parser parse];
28 if (!success) {
29 NSError *err = [parser parserError];
30 NSLog(@"%@",err);
31 }
32 }
33
34 - (void)appendFilenameToURL {
35 int count = [_chromeDownloadURLs count];
36 for (int i = 0; i < count; i++) {
37 NSString *fullFilename = [[_chromeDownloadURLs objectAtIndex:i]
38 stringByAppendingString: _filename];
39 [_chromeDownloadURLs replaceObjectAtIndex:i withObject: fullFilename];
40 }
41 }
42
43 int count = [chromeDownloadURLs count];
44 for (int i = 0; i < count; i++) {
45 NSString *fullFilename = [[chromeDownloadURLs objectAtIndex:i]
46 stringByAppendingString: filename];
47 [chromeDownloadURLs replaceObjectAtIndex:i withObject: fullFilename];
48 }
49 }
50
51 // Method implementation for XMLParserDelegate.
52 // Will search the XML data for the tag "url" and the subsequent "codebase" attr ibute
53 // that indicates a URL follows. Will next copy each URL into an array.
54
55 - (void)parser:(NSXMLParser *)parser
56 didStartElement:(NSString *)elementName
57 namespaceURI:(NSString *)namespaceURI
58 qualifiedName:(NSString *)qName
59 attributes:(NSDictionary *)attributeDict {
60 if ([elementName isEqualToString:@"url"]) {
61 NSString *extractedURL = [attributeDict objectForKey:@"codebase"];
62 [_chromeDownloadURLs addObject: extractedURL];
63 }
64 if ([elementName isEqualToString:@"package"]) {
65 _filename = [attributeDict objectForKey:@"name"];
66 }
67 }
68 [chromeDownloadURLs addObject: extractedURL];
69 }
70 if ([elementName isEqualToString:@"package"]) {
71 filename = [attributeDict objectForKey:@"name"];
72 }
73 }
74 */
75
76 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698