OLD | NEW |
---|---|
(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 <Foundation/Foundation.h> | |
6 #include "OmahaXMLRequest.h" | |
7 | |
8 @implementation OmahaXMLRequest : NSObject | |
9 | |
10 // Boris (borisv) indicated that the OS version, platform, appid, and version | |
Elly Fong-Jones
2016/07/06 15:22:02
I'd just write "borisv@" here, no need for the fir
| |
11 // are the user attributes that Omaha actually looks at. The other parameters | |
12 // are useful for logging purposes but otherwise not directly used. | |
13 + (NSXMLDocument*)createXMLRequestBodyWithOS:(NSString*) operatingSystem | |
14 andArchitecture:(NSString*) architecture { | |
15 NSString* protocol = @"3.0"; | |
16 NSString* keystoneVersion = @"KeystoneAgent-1.99.4.0"; | |
17 | |
18 NSString* platform = @"mac"; | |
19 NSString* plat_arch = [NSString stringWithFormat:@"%@_%@", operatingSystem, | |
20 architecture]; | |
21 | |
22 NSString* appid = @"com.google.Chrome"; | |
23 NSString* version = @"0.0.0.0"; | |
24 NSString* language = @"en-us"; | |
25 | |
26 NSXMLElement* root = [[NSXMLElement alloc] initWithName:@"request"]; | |
27 [root addAttribute:[NSXMLNode attributeWithName:@"protocol" | |
28 stringValue:protocol]]; | |
29 [root addAttribute:[NSXMLNode attributeWithName:@"version" | |
30 stringValue:keystoneVersion]]; | |
31 | |
32 NSXMLElement* osChild = [[NSXMLElement alloc] initWithName:@"os"]; | |
33 [osChild addAttribute:[NSXMLNode attributeWithName:@"platform" | |
34 stringValue:platform]]; | |
35 [osChild addAttribute:[NSXMLNode attributeWithName:@"version" | |
36 stringValue:operatingSystem]]; | |
37 [osChild addAttribute:[NSXMLNode attributeWithName:@"arch" | |
38 stringValue:architecture]]; | |
39 [osChild addAttribute:[NSXMLNode attributeWithName:@"sp" | |
40 stringValue:plat_arch]]; | |
41 [root addChild:osChild]; | |
42 | |
43 NSXMLElement* appChild = [[NSXMLElement alloc] initWithName:@"app"]; | |
44 [appChild addAttribute:[NSXMLNode attributeWithName:@"appid" | |
45 stringValue:appid]]; | |
46 [appChild addAttribute:[NSXMLNode attributeWithName:@"version" | |
47 stringValue:version]]; | |
48 [appChild addAttribute:[NSXMLNode attributeWithName:@"lang" | |
49 stringValue:language]]; | |
50 [root addChild:appChild]; | |
51 | |
52 NSXMLElement* updateChildChild = [[NSXMLElement alloc] | |
53 initWithName:@"updatecheck"]; | |
54 [appChild addChild:updateChildChild]; | |
55 | |
56 NSXMLDocument* requestXMLDocument = [[NSXMLDocument alloc] | |
57 initWithRootElement:root]; | |
58 return requestXMLDocument; | |
59 } | |
60 | |
61 @end | |
OLD | NEW |