| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 #import "keystone_glue.h" | 5 #import "keystone_glue.h" |
| 6 | 6 |
| 7 // Provide declarations of the Keystone registration bits needed here. From | 7 // Provide declarations of the Keystone registration bits needed here. From |
| 8 // KSRegistration.h. | 8 // KSRegistration.h. |
| 9 typedef enum { kKSPathExistenceChecker } KSExistenceCheckerType; | 9 typedef enum { kKSPathExistenceChecker } KSExistenceCheckerType; |
| 10 @interface KSRegistration : NSObject | 10 @interface KSRegistration : NSObject |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 // updates if not - but keep the periodic activity pings. | 22 // updates if not - but keep the periodic activity pings. |
| 23 + (void)registerWithKeystone { | 23 + (void)registerWithKeystone { |
| 24 // Figure out who we are. | 24 // Figure out who we are. |
| 25 NSBundle* mainBundle = [NSBundle mainBundle]; | 25 NSBundle* mainBundle = [NSBundle mainBundle]; |
| 26 NSDictionary* infoDictionary = [mainBundle infoDictionary]; | 26 NSDictionary* infoDictionary = [mainBundle infoDictionary]; |
| 27 NSString* url = [infoDictionary objectForKey:@"KSUpdateURL"]; | 27 NSString* url = [infoDictionary objectForKey:@"KSUpdateURL"]; |
| 28 NSString* bundleIdentifier = [infoDictionary objectForKey:@"KSProductID"]; | 28 NSString* bundleIdentifier = [infoDictionary objectForKey:@"KSProductID"]; |
| 29 if (bundleIdentifier == nil) { | 29 if (bundleIdentifier == nil) { |
| 30 bundleIdentifier = [mainBundle bundleIdentifier]; | 30 bundleIdentifier = [mainBundle bundleIdentifier]; |
| 31 } | 31 } |
| 32 // TODO(mmentovai): The svn version serves our purposes for now, but it will | 32 NSString* version = [infoDictionary objectForKey:@"KSVersion"]; |
| 33 // likely be replaced. The key problem is that it does not monotonically | |
| 34 // increase for releases when considering svn branches and tags. For the | |
| 35 // purposes of TestShell, though, which will likely only ever survive in | |
| 36 // auto-updatable form in builds straight from the trunk, this is fine. | |
| 37 NSString* version = [infoDictionary objectForKey:@"SVNRevision"]; | |
| 38 if (!bundleIdentifier || !url || !version) { | 33 if (!bundleIdentifier || !url || !version) { |
| 39 // If parameters required for Keystone are missing, don't use it. | 34 // If parameters required for Keystone are missing, don't use it. |
| 40 return; | 35 return; |
| 41 } | 36 } |
| 42 | 37 |
| 43 // Load the KeystoneRegistration framework bundle. | 38 // Load the KeystoneRegistration framework bundle. |
| 44 NSString* ksrPath = | 39 NSString* ksrPath = |
| 45 [[mainBundle privateFrameworksPath] | 40 [[mainBundle privateFrameworksPath] |
| 46 stringByAppendingPathComponent:@"KeystoneRegistration.framework"]; | 41 stringByAppendingPathComponent:@"KeystoneRegistration.framework"]; |
| 47 NSBundle* ksrBundle = [NSBundle bundleWithPath:ksrPath]; | 42 NSBundle* ksrBundle = [NSBundle bundleWithPath:ksrPath]; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 72 userInfo:ksr | 67 userInfo:ksr |
| 73 repeats:YES]; | 68 repeats:YES]; |
| 74 } | 69 } |
| 75 | 70 |
| 76 + (void)markActive:(NSTimer*)timer { | 71 + (void)markActive:(NSTimer*)timer { |
| 77 KSRegistration* ksr = [timer userInfo]; | 72 KSRegistration* ksr = [timer userInfo]; |
| 78 [ksr setActive]; | 73 [ksr setActive]; |
| 79 } | 74 } |
| 80 | 75 |
| 81 @end | 76 @end |
| OLD | NEW |