diff options
author | jrg@chromium.org <jrg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-10 23:16:47 +0000 |
---|---|---|
committer | jrg@chromium.org <jrg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-10 23:16:47 +0000 |
commit | 0f92c0ed876391b257ba6d542df76b31d7bbc2ae (patch) | |
tree | 705023db575d465e0ededcab24870caa54805139 /chrome | |
parent | 2026d87f9e993833be099cc4ebd984158a5ab6fb (diff) | |
download | chromium_src-0f92c0ed876391b257ba6d542df76b31d7bbc2ae.zip chromium_src-0f92c0ed876391b257ba6d542df76b31d7bbc2ae.tar.gz chromium_src-0f92c0ed876391b257ba6d542df76b31d7bbc2ae.tar.bz2 |
Use new tag/channel API for Keystone.
Review URL: http://codereview.chromium.org/164224
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@22969 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/app/keystone_glue.h | 1 | ||||
-rw-r--r-- | chrome/app/keystone_glue.m | 40 |
2 files changed, 37 insertions, 4 deletions
diff --git a/chrome/app/keystone_glue.h b/chrome/app/keystone_glue.h index d9d0fac..9a8eb01 100644 --- a/chrome/app/keystone_glue.h +++ b/chrome/app/keystone_glue.h @@ -49,6 +49,7 @@ NSString* url_; NSString* productID_; NSString* version_; + NSString* channel_; // Logically: Dev, Beta, or Stable. // And the Keystone registration itself, with the active timer KSRegistration* registration_; // strong diff --git a/chrome/app/keystone_glue.m b/chrome/app/keystone_glue.m index 56a8e5f..0ebf7998 100644 --- a/chrome/app/keystone_glue.m +++ b/chrome/app/keystone_glue.m @@ -26,12 +26,23 @@ NSString *KSRegistrationStartUpdateNotification = NSString *KSUpdateCheckSuccessfulKey = @"CheckSuccessful"; NSString *KSUpdateCheckSuccessfullyInstalledKey = @"SuccessfullyInstalled"; +NSString *KSRegistrationRemoveExistingTag = @""; +#define KSRegistrationPreserveExistingTag nil + @interface KSRegistration : NSObject + (id)registrationWithProductID:(NSString*)productID; +// Older API - (BOOL)registerWithVersion:(NSString*)version existenceCheckerType:(KSExistenceCheckerType)xctype existenceCheckerString:(NSString*)xc serverURLString:(NSString*)serverURLString; +// Newer API +- (BOOL)registerWithVersion:(NSString*)version + existenceCheckerType:(KSExistenceCheckerType)xctype + existenceCheckerString:(NSString*)xc + serverURLString:(NSString*)serverURLString + preserveTTToken:(BOOL)preserveToken + tag:(NSString *)tag; - (void)setActive; - (void)checkForUpdate; - (void)startUpdate; @@ -60,6 +71,7 @@ NSString *KSUpdateCheckSuccessfullyInstalledKey = @"SuccessfullyInstalled"; [url_ release]; [productID_ release]; [version_ release]; + [channel_ release]; [registration_ release]; [super dealloc]; } @@ -81,9 +93,16 @@ NSString *KSUpdateCheckSuccessfullyInstalledKey = @"SuccessfullyInstalled"; return; } + NSString* channel = [infoDictionary objectForKey:@"KSChannelID"]; + // The stable channel has no tag. If updating to stable, remove the + // dev and beta tags since we've been "promoted". + if (channel == nil) + channel = KSRegistrationRemoveExistingTag; + url_ = [url retain]; productID_ = [product retain]; version_ = [version retain]; + channel_ = [channel retain]; } - (BOOL)loadKeystoneRegistration { @@ -109,10 +128,23 @@ NSString *KSUpdateCheckSuccessfullyInstalledKey = @"SuccessfullyInstalled"; } - (void)registerWithKeystone { - [registration_ registerWithVersion:version_ - existenceCheckerType:kKSPathExistenceChecker - existenceCheckerString:[[NSBundle mainBundle] bundlePath] - serverURLString:url_]; + // Only use new API if we can. This lets us land the new call + // before the new Keystone has been released. + // + // TODO(jrg): once we hit Beta and the new Keystone is released, + // make this call unconditional. + if ([registration_ respondsToSelector:@selector(registerWithVersion:existenceCheckerType:existenceCheckerString:serverURLString:preserveTTToken:tag:)]) + [registration_ registerWithVersion:version_ + existenceCheckerType:kKSPathExistenceChecker + existenceCheckerString:[[NSBundle mainBundle] bundlePath] + serverURLString:url_ + preserveTTToken:YES + tag:channel_]; + else + [registration_ registerWithVersion:version_ + existenceCheckerType:kKSPathExistenceChecker + existenceCheckerString:[[NSBundle mainBundle] bundlePath] + serverURLString:url_]; // Mark an active RIGHT NOW; don't wait an hour for the first one. [registration_ setActive]; |