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..7cc39bcdf2b27f6f9f0115dc6bd227d2f4d7d8ca |
--- /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> |
+#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"; |
+ |
+ 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 |