Commit 12d36ad6 authored by mark@chromium.org's avatar mark@chromium.org

Register with Keystone using a versionPath and versionKey.

Providing this data to Keystone will cause it to check the application's
Info.plist to determine the installed version, rather than using the version
embedded within the ticket. The version in the ticket can become stale in
some rare situations through innocent user action.

This allows a user to replace Chrome with an earlier version (perhaps on
another channel) and not get "stuck" without autoupdates until that channel
catches up with the version listed in the ticket. (b/2506062)

This also prevents Keystone from believing an update is still available if
Chrome is updated but not restarted and the user subsequently promotes
Chrome's user ticket to a system ticket from within Chrome. (crbug.com/38696)

BUG=38696
TEST=On a user ticket, ksadmin -p should show a versionPath and versionKey
     after Chrome is launched. If promoted to a system ticket, ksadmin -Sp
     should show these same two parameters.
Review URL: http://codereview.chromium.org/6990046

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@86387 0039d316-1c4b-4281-b951-d872f2087c98
parent 5e119782
......@@ -49,6 +49,8 @@ NSString* const KSRegistrationTagPathKey = @"TagPath";
NSString* const KSRegistrationTagKeyKey = @"TagKey";
NSString* const KSRegistrationBrandPathKey = @"BrandPath";
NSString* const KSRegistrationBrandKeyKey = @"BrandKey";
NSString* const KSRegistrationVersionPathKey = @"VersionPath";
NSString* const KSRegistrationVersionKeyKey = @"VersionKey";
NSString* const KSRegistrationDidCompleteNotification =
@"KSRegistrationDidCompleteNotification";
......@@ -69,8 +71,8 @@ NSString* const KSUpdateCheckSuccessfullyInstalledKey =
NSString* const KSRegistrationRemoveExistingTag = @"";
#define KSRegistrationPreserveExistingTag nil
// Constants for the brand file (uses an external file so it can survive updates
// to Chrome.
// Constants for the brand file (uses an external file so it can survive
// updates to Chrome.)
#if defined(GOOGLE_CHROME_BUILD)
#define kBrandFileName @"Google Chrome Brand.plist";
......@@ -155,7 +157,7 @@ class PerformBridge : public base::RefCountedThreadSafe<PerformBridge> {
@end // @interface KSRegistration
@interface KeystoneGlue(Private)
@interface KeystoneGlue (Private)
// Returns the path to the application's Info.plist file. This returns the
// outer application bundle's Info.plist, not the framework's Info.plist.
......@@ -228,7 +230,7 @@ class PerformBridge : public base::RefCountedThreadSafe<PerformBridge> {
// Returns the brand file path to use for Keystone.
- (NSString*)brandFilePath;
@end // @interface KeystoneGlue(Private)
@end // @interface KeystoneGlue (Private)
NSString* const kAutoupdateStatusNotification = @"AutoupdateStatusNotification";
NSString* const kAutoupdateStatusStatus = @"status";
......@@ -238,6 +240,7 @@ namespace {
NSString* const kChannelKey = @"KSChannelID";
NSString* const kBrandKey = @"KSBrandID";
NSString* const kVersionKey = @"KSVersion";
} // namespace
......@@ -320,7 +323,7 @@ NSString* const kBrandKey = @"KSBrandID";
NSString* appPath = [appBundle bundlePath];
NSString* url = [infoDictionary objectForKey:@"KSUpdateURL"];
NSString* version = [infoDictionary objectForKey:@"KSVersion"];
NSString* version = [infoDictionary objectForKey:kVersionKey];
if (!productID || !appPath || !url || !version) {
// If parameters required for Keystone are missing, don't use it.
......@@ -482,8 +485,7 @@ NSString* const kBrandKey = @"KSBrandID";
- (NSDictionary*)keystoneParameters {
NSNumber* xcType = [NSNumber numberWithInt:kKSPathExistenceChecker];
NSNumber* preserveTTToken = [NSNumber numberWithBool:YES];
NSString* tagPath = [self appInfoPlistPath];
NSString* appInfoPlistPath = [self appInfoPlistPath];
NSString* brandKey = kBrandKey;
NSString* brandPath = [self brandFilePath];
......@@ -495,12 +497,14 @@ NSString* const kBrandKey = @"KSBrandID";
return [NSDictionary dictionaryWithObjectsAndKeys:
version_, KSRegistrationVersionKey,
appInfoPlistPath, KSRegistrationVersionPathKey,
kVersionKey, KSRegistrationVersionKeyKey,
xcType, KSRegistrationExistenceCheckerTypeKey,
appPath_, KSRegistrationExistenceCheckerStringKey,
url_, KSRegistrationServerURLStringKey,
preserveTTToken, KSRegistrationPreserveTrustedTesterTokenKey,
channel_, KSRegistrationTagKey,
tagPath, KSRegistrationTagPathKey,
appInfoPlistPath, KSRegistrationTagPathKey,
kChannelKey, KSRegistrationTagKeyKey,
brandPath, KSRegistrationBrandPathKey,
brandKey, KSRegistrationBrandKeyKey,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment