Chromium Code Reviews| Index: chrome/installer/mac/app/OmahaXMLRequest.m |
| diff --git a/chrome/installer/mac/app/OmahaXMLRequest.m b/chrome/installer/mac/app/OmahaXMLRequest.m |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..cabb8d7b2fd55665e485b5039fe2f4050c867547 |
| --- /dev/null |
| +++ b/chrome/installer/mac/app/OmahaXMLRequest.m |
| @@ -0,0 +1,63 @@ |
| +// Copyright (c) 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#import <Foundation/Foundation.h> |
|
Mark Mentovai
2016/07/11 17:56:16
#import "OmahaXMLRequest.h>
#import <Foundation/F
|
| +#include "OmahaXMLRequest.h" |
| +#include "SystemInfo.h" |
| + |
| +@implementation OmahaXMLRequest : NSObject |
| + |
| +// borisv@ indicated that the OS version, platform, appid, and version are the |
| +// user attributes that Omaha actually looks at. The other parameters are useful |
| +// for logging purposes but otherwise not directly used. |
| ++ (NSXMLDocument*)createXMLRequestBody { |
| + NSString* protocol = @"3.0"; |
| + 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
|
| + |
| + NSString* platform = @"mac"; |
| + NSString* operatingSystem = [SystemInfo getOSVersion]; |
| + NSString* architecture = [SystemInfo getArch]; |
| + NSString* plat_arch = |
| + [NSString stringWithFormat:@"%@_%@", operatingSystem, architecture]; |
| + |
| + NSString* appid = @"com.google.Chrome"; |
| + NSString* version = @"0.0.0.0"; |
| + NSString* language = @"en-us"; |
| + |
| + NSXMLElement* root = [[NSXMLElement alloc] initWithName:@"request"]; |
| + [root addAttribute:[NSXMLNode attributeWithName:@"protocol" |
| + stringValue:protocol]]; |
| + [root addAttribute:[NSXMLNode attributeWithName:@"version" |
| + stringValue:keystoneVersion]]; |
| + |
| + NSXMLElement* osChild = [[NSXMLElement alloc] initWithName:@"os"]; |
| + [osChild addAttribute:[NSXMLNode attributeWithName:@"platform" |
| + stringValue:platform]]; |
| + [osChild addAttribute:[NSXMLNode attributeWithName:@"version" |
| + stringValue:operatingSystem]]; |
| + [osChild addAttribute:[NSXMLNode attributeWithName:@"arch" |
| + stringValue:architecture]]; |
| + [osChild |
| + addAttribute:[NSXMLNode attributeWithName:@"sp" stringValue:plat_arch]]; |
| + [root addChild:osChild]; |
| + |
| + NSXMLElement* appChild = [[NSXMLElement alloc] initWithName:@"app"]; |
| + [appChild |
| + addAttribute:[NSXMLNode attributeWithName:@"appid" stringValue:appid]]; |
| + [appChild addAttribute:[NSXMLNode attributeWithName:@"version" |
| + stringValue:version]]; |
| + [appChild |
| + addAttribute:[NSXMLNode attributeWithName:@"lang" stringValue:language]]; |
| + [root addChild:appChild]; |
| + |
| + NSXMLElement* updateChildChild = |
| + [[NSXMLElement alloc] initWithName:@"updatecheck"]; |
| + [appChild addChild:updateChildChild]; |
| + |
| + NSXMLDocument* requestXMLDocument = |
| + [[NSXMLDocument alloc] initWithRootElement:root]; |
| + return requestXMLDocument; |
| +} |
| + |
| +@end |