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..1fbbb03ca3f1f8933974689ec6940a067149cb82 |
| --- /dev/null |
| +++ b/chrome/installer/mac/app/OmahaXMLRequest.m |
| @@ -0,0 +1,61 @@ |
| +// 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> |
| +#include "OmahaXMLRequest.h" |
| + |
| +@implementation OmahaXMLRequest : NSObject |
| + |
| +// 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
|
| +// are the user attributes that Omaha actually looks at. The other parameters |
| +// are useful for logging purposes but otherwise not directly used. |
| ++ (NSXMLDocument*)createXMLRequestBodyWithOS:(NSString*) operatingSystem |
| + andArchitecture:(NSString*) architecture { |
| + NSString* protocol = @"3.0"; |
| + NSString* keystoneVersion = @"KeystoneAgent-1.99.4.0"; |
| + |
| + NSString* platform = @"mac"; |
| + 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 |