summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormark@chromium.org <mark@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-24 02:19:04 +0000
committermark@chromium.org <mark@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-24 02:19:04 +0000
commit12d36ad61b88473f72773aa95a4eaa09336e6b4b (patch)
treef32155c3053c821c75f61bcf0e4882a72c048a74
parent5e1197827fc1f859a218b078d1db541f294d8aa7 (diff)
downloadchromium_src-12d36ad61b88473f72773aa95a4eaa09336e6b4b.zip
chromium_src-12d36ad61b88473f72773aa95a4eaa09336e6b4b.tar.gz
chromium_src-12d36ad61b88473f72773aa95a4eaa09336e6b4b.tar.bz2
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
-rw-r--r--chrome/browser/cocoa/keystone_glue.mm24
1 files changed, 14 insertions, 10 deletions
diff --git a/chrome/browser/cocoa/keystone_glue.mm b/chrome/browser/cocoa/keystone_glue.mm
index 4c7ca50..2edca3e 100644
--- a/chrome/browser/cocoa/keystone_glue.mm
+++ b/chrome/browser/cocoa/keystone_glue.mm
@@ -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,
@@ -827,7 +831,7 @@ NSString* const kBrandKey = @"KSBrandID";
// if the synchronous parameter is NO.
NSString* preflightPath =
[base::mac::MainAppBundle() pathForResource:@"keystone_promote_preflight"
- ofType:@"sh"];
+ ofType:@"sh"];
const char* preflightPathC = [preflightPath fileSystemRepresentation];
const char* userBrandFile = NULL;
const char* systemBrandFile = NULL;
@@ -913,7 +917,7 @@ NSString* const kBrandKey = @"KSBrandID";
SEL selector = @selector(changePermissionsForPromotionWithTool:);
NSString* toolPath =
[base::mac::MainAppBundle() pathForResource:@"keystone_promote_postflight"
- ofType:@"sh"];
+ ofType:@"sh"];
PerformBridge::PostPerform(self, selector, toolPath);
}