| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "OmahaXMLRequest.h" | 5 #include "OmahaXMLRequest.h" |
| 6 | 6 |
| 7 #include "SystemInfo.h" | 7 #include "SystemInfo.h" |
| 8 | 8 |
| 9 @implementation OmahaXMLRequest : NSObject | 9 @implementation OmahaXMLRequest : NSObject |
| 10 | 10 |
| 11 + (NSXMLElement*)createElementWithName:(NSString*)name { | 11 + (NSXMLElement*)createElementWithName:(NSString*)name { |
| 12 return [[NSXMLElement alloc] initWithName:name]; | 12 return [[NSXMLElement alloc] initWithName:name]; |
| 13 } | 13 } |
| 14 | 14 |
| 15 + (void)forElement:(NSXMLElement*)element | 15 + (void)forElement:(NSXMLElement*)element |
| 16 AddAttribute:(NSString*)attribute | 16 AddAttribute:(NSString*)attribute |
| 17 WithValue:(NSString*)value { | 17 WithValue:(NSString*)value { |
| 18 [element | 18 [element |
| 19 addAttribute:[NSXMLNode attributeWithName:attribute stringValue:value]]; | 19 addAttribute:[NSXMLNode attributeWithName:attribute stringValue:value]]; |
| 20 } | 20 } |
| 21 | 21 |
| 22 // borisv@ indicated that the OS version, platform, appid, and version are the | 22 // borisv@ indicated that the OS version, platform, appid, and version are the |
| 23 // user attributes that Omaha actually looks at. The other parameters are useful | 23 // user attributes that Omaha actually looks at. The other parameters are useful |
| 24 // for logging purposes but otherwise not directly used. | 24 // for logging purposes but otherwise not directly used. |
| 25 + (NSXMLDocument*)createXMLRequestBody { | 25 + (NSXMLDocument*)createXMLRequestBody { |
| 26 // TODO: not hard-code protocol version #? | 26 // TODO: This protocol version number probably shouldn't be hard-coded. Check |
| 27 // with borisv@ regarding changing protocol verions. |
| 27 NSString* protocol = @"3.0"; | 28 NSString* protocol = @"3.0"; |
| 28 | 29 |
| 29 NSString* platform = @"mac"; | 30 NSString* platform = @"mac"; |
| 30 NSString* operatingSystem = [SystemInfo getOSVersion]; | 31 NSString* operatingSystem = [SystemInfo getOSVersion]; |
| 31 NSString* architecture = [SystemInfo getArch]; | 32 NSString* architecture = [SystemInfo getArch]; |
| 32 NSString* plat_arch = | 33 NSString* plat_arch = |
| 33 [NSString stringWithFormat:@"%@_%@", operatingSystem, architecture]; | 34 [NSString stringWithFormat:@"%@_%@", operatingSystem, architecture]; |
| 34 | 35 |
| 35 NSString* appid = @"com.google.Chrome"; | 36 NSString* appid = @"com.google.Chrome"; |
| 36 NSString* version = @"0.0.0.0"; | 37 NSString* version = @"0.0.0.0"; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 63 NSXMLElement* updateChildChild = | 64 NSXMLElement* updateChildChild = |
| 64 [OmahaXMLRequest createElementWithName:@"updatecheck"]; | 65 [OmahaXMLRequest createElementWithName:@"updatecheck"]; |
| 65 [appChild addChild:updateChildChild]; | 66 [appChild addChild:updateChildChild]; |
| 66 | 67 |
| 67 NSXMLDocument* requestXMLDocument = | 68 NSXMLDocument* requestXMLDocument = |
| 68 [[NSXMLDocument alloc] initWithRootElement:root]; | 69 [[NSXMLDocument alloc] initWithRootElement:root]; |
| 69 return requestXMLDocument; | 70 return requestXMLDocument; |
| 70 } | 71 } |
| 71 | 72 |
| 72 @end | 73 @end |
| OLD | NEW |