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