OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #import <Foundation/Foundation.h> | |
Mark Mentovai
2016/07/11 17:56:16
Blank line after this one.
| |
6 #import "downloader.h" | |
7 #import "systemInfo.h" | |
8 #import "OmahaXMLRequest.h" | |
9 #import "OmahaCommunication.h" | |
10 | |
11 void talkToOmahaThenExecuteBlock(OmahaRequestCompletionHandler block) { | |
12 NSXMLDocument* requestBody = [OmahaXMLRequest createXMLRequestBody]; | |
13 OmahaCommunication* messenger = | |
14 [[OmahaCommunication alloc] initWithBody:requestBody]; | |
15 [messenger sendRequestWithBlock:block]; | |
16 } | |
17 | |
18 int main() { | |
19 talkToOmahaThenExecuteBlock(^(NSData* data, NSError* error) { | |
20 if (error) { | |
21 NSLog(@"%@", [error localizedDescription]); | |
22 return; | |
23 } | |
24 Downloader* download = [[Downloader alloc] init]; | |
25 [download downloadChromeImageToDownloadsDirectory:data]; | |
26 }); | |
27 | |
28 // [[NSRunLoop mainRunLoop] run]; | |
29 [[NSRunLoop mainRunLoop] | |
30 runUntilDate:[NSDate dateWithTimeIntervalSinceNow:1]]; | |
31 return 1; | |
32 } | |
OLD | NEW |