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"; ...@@ -49,6 +49,8 @@ NSString* const KSRegistrationTagPathKey = @"TagPath";
NSString* const KSRegistrationTagKeyKey = @"TagKey"; NSString* const KSRegistrationTagKeyKey = @"TagKey";
NSString* const KSRegistrationBrandPathKey = @"BrandPath"; NSString* const KSRegistrationBrandPathKey = @"BrandPath";
NSString* const KSRegistrationBrandKeyKey = @"BrandKey"; NSString* const KSRegistrationBrandKeyKey = @"BrandKey";
NSString* const KSRegistrationVersionPathKey = @"VersionPath";
NSString* const KSRegistrationVersionKeyKey = @"VersionKey";
NSString* const KSRegistrationDidCompleteNotification = NSString* const KSRegistrationDidCompleteNotification =
@"KSRegistrationDidCompleteNotification"; @"KSRegistrationDidCompleteNotification";
...@@ -69,8 +71,8 @@ NSString* const KSUpdateCheckSuccessfullyInstalledKey = ...@@ -69,8 +71,8 @@ NSString* const KSUpdateCheckSuccessfullyInstalledKey =
NSString* const KSRegistrationRemoveExistingTag = @""; NSString* const KSRegistrationRemoveExistingTag = @"";
#define KSRegistrationPreserveExistingTag nil #define KSRegistrationPreserveExistingTag nil
// Constants for the brand file (uses an external file so it can survive updates // Constants for the brand file (uses an external file so it can survive
// to Chrome. // updates to Chrome.)
#if defined(GOOGLE_CHROME_BUILD) #if defined(GOOGLE_CHROME_BUILD)
#define kBrandFileName @"Google Chrome Brand.plist"; #define kBrandFileName @"Google Chrome Brand.plist";
...@@ -155,7 +157,7 @@ class PerformBridge : public base::RefCountedThreadSafe<PerformBridge> { ...@@ -155,7 +157,7 @@ class PerformBridge : public base::RefCountedThreadSafe<PerformBridge> {
@end // @interface KSRegistration @end // @interface KSRegistration
@interface KeystoneGlue(Private) @interface KeystoneGlue (Private)
// Returns the path to the application's Info.plist file. This returns the // 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. // outer application bundle's Info.plist, not the framework's Info.plist.
...@@ -228,7 +230,7 @@ class PerformBridge : public base::RefCountedThreadSafe<PerformBridge> { ...@@ -228,7 +230,7 @@ class PerformBridge : public base::RefCountedThreadSafe<PerformBridge> {
// Returns the brand file path to use for Keystone. // Returns the brand file path to use for Keystone.
- (NSString*)brandFilePath; - (NSString*)brandFilePath;
@end // @interface KeystoneGlue(Private) @end // @interface KeystoneGlue (Private)
NSString* const kAutoupdateStatusNotification = @"AutoupdateStatusNotification"; NSString* const kAutoupdateStatusNotification = @"AutoupdateStatusNotification";
NSString* const kAutoupdateStatusStatus = @"status"; NSString* const kAutoupdateStatusStatus = @"status";
...@@ -238,6 +240,7 @@ namespace { ...@@ -238,6 +240,7 @@ namespace {
NSString* const kChannelKey = @"KSChannelID"; NSString* const kChannelKey = @"KSChannelID";
NSString* const kBrandKey = @"KSBrandID"; NSString* const kBrandKey = @"KSBrandID";
NSString* const kVersionKey = @"KSVersion";
} // namespace } // namespace
...@@ -320,7 +323,7 @@ NSString* const kBrandKey = @"KSBrandID"; ...@@ -320,7 +323,7 @@ NSString* const kBrandKey = @"KSBrandID";
NSString* appPath = [appBundle bundlePath]; NSString* appPath = [appBundle bundlePath];
NSString* url = [infoDictionary objectForKey:@"KSUpdateURL"]; NSString* url = [infoDictionary objectForKey:@"KSUpdateURL"];
NSString* version = [infoDictionary objectForKey:@"KSVersion"]; NSString* version = [infoDictionary objectForKey:kVersionKey];
if (!productID || !appPath || !url || !version) { if (!productID || !appPath || !url || !version) {
// If parameters required for Keystone are missing, don't use it. // If parameters required for Keystone are missing, don't use it.
...@@ -482,8 +485,7 @@ NSString* const kBrandKey = @"KSBrandID"; ...@@ -482,8 +485,7 @@ NSString* const kBrandKey = @"KSBrandID";
- (NSDictionary*)keystoneParameters { - (NSDictionary*)keystoneParameters {
NSNumber* xcType = [NSNumber numberWithInt:kKSPathExistenceChecker]; NSNumber* xcType = [NSNumber numberWithInt:kKSPathExistenceChecker];
NSNumber* preserveTTToken = [NSNumber numberWithBool:YES]; NSNumber* preserveTTToken = [NSNumber numberWithBool:YES];
NSString* tagPath = [self appInfoPlistPath]; NSString* appInfoPlistPath = [self appInfoPlistPath];
NSString* brandKey = kBrandKey; NSString* brandKey = kBrandKey;
NSString* brandPath = [self brandFilePath]; NSString* brandPath = [self brandFilePath];
...@@ -495,12 +497,14 @@ NSString* const kBrandKey = @"KSBrandID"; ...@@ -495,12 +497,14 @@ NSString* const kBrandKey = @"KSBrandID";
return [NSDictionary dictionaryWithObjectsAndKeys: return [NSDictionary dictionaryWithObjectsAndKeys:
version_, KSRegistrationVersionKey, version_, KSRegistrationVersionKey,
appInfoPlistPath, KSRegistrationVersionPathKey,
kVersionKey, KSRegistrationVersionKeyKey,
xcType, KSRegistrationExistenceCheckerTypeKey, xcType, KSRegistrationExistenceCheckerTypeKey,
appPath_, KSRegistrationExistenceCheckerStringKey, appPath_, KSRegistrationExistenceCheckerStringKey,
url_, KSRegistrationServerURLStringKey, url_, KSRegistrationServerURLStringKey,
preserveTTToken, KSRegistrationPreserveTrustedTesterTokenKey, preserveTTToken, KSRegistrationPreserveTrustedTesterTokenKey,
channel_, KSRegistrationTagKey, channel_, KSRegistrationTagKey,
tagPath, KSRegistrationTagPathKey, appInfoPlistPath, KSRegistrationTagPathKey,
kChannelKey, KSRegistrationTagKeyKey, kChannelKey, KSRegistrationTagKeyKey,
brandPath, KSRegistrationBrandPathKey, brandPath, KSRegistrationBrandPathKey,
brandKey, KSRegistrationBrandKeyKey, brandKey, KSRegistrationBrandKeyKey,
...@@ -827,7 +831,7 @@ NSString* const kBrandKey = @"KSBrandID"; ...@@ -827,7 +831,7 @@ NSString* const kBrandKey = @"KSBrandID";
// if the synchronous parameter is NO. // if the synchronous parameter is NO.
NSString* preflightPath = NSString* preflightPath =
[base::mac::MainAppBundle() pathForResource:@"keystone_promote_preflight" [base::mac::MainAppBundle() pathForResource:@"keystone_promote_preflight"
ofType:@"sh"]; ofType:@"sh"];
const char* preflightPathC = [preflightPath fileSystemRepresentation]; const char* preflightPathC = [preflightPath fileSystemRepresentation];
const char* userBrandFile = NULL; const char* userBrandFile = NULL;
const char* systemBrandFile = NULL; const char* systemBrandFile = NULL;
...@@ -913,7 +917,7 @@ NSString* const kBrandKey = @"KSBrandID"; ...@@ -913,7 +917,7 @@ NSString* const kBrandKey = @"KSBrandID";
SEL selector = @selector(changePermissionsForPromotionWithTool:); SEL selector = @selector(changePermissionsForPromotionWithTool:);
NSString* toolPath = NSString* toolPath =
[base::mac::MainAppBundle() pathForResource:@"keystone_promote_postflight" [base::mac::MainAppBundle() pathForResource:@"keystone_promote_postflight"
ofType:@"sh"]; ofType:@"sh"];
PerformBridge::PostPerform(self, selector, toolPath); PerformBridge::PostPerform(self, selector, toolPath);
} }
......
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