| Index: chrome/browser/mac/keystone_glue.mm
|
| diff --git a/chrome/browser/mac/keystone_glue.mm b/chrome/browser/mac/keystone_glue.mm
|
| index 959eac28004f85bab192f0cc75642e2472e49c7b..930cb35b79cecd2b12683f7337fa8af8da2dac56 100644
|
| --- a/chrome/browser/mac/keystone_glue.mm
|
| +++ b/chrome/browser/mac/keystone_glue.mm
|
| @@ -125,7 +125,8 @@ class PerformBridge : public base::RefCountedThreadSafe<PerformBridge> {
|
| // Called when an update check or update installation is complete. Posts the
|
| // kAutoupdateStatusNotification notification to the default notification
|
| // center.
|
| -- (void)updateStatus:(AutoupdateStatus)status version:(NSString*)version;
|
| +- (void)updateStatus:(keystone_glue::AutoupdateStatus)status
|
| + version:(NSString*)version;
|
|
|
| // Returns the version of the currently-installed application on disk.
|
| - (NSString*)currentlyInstalledVersion;
|
| @@ -492,7 +493,7 @@ NSString* const kVersionKey = @"KSVersion";
|
| }
|
|
|
| - (void)registerWithKeystone {
|
| - [self updateStatus:kAutoupdateRegistering version:nil];
|
| + [self updateStatus:keystone_glue::kAutoupdateRegistering version:nil];
|
|
|
| NSDictionary* parameters = [self keystoneParameters];
|
| BOOL result;
|
| @@ -504,7 +505,7 @@ NSString* const kVersionKey = @"KSVersion";
|
| result = [registration_ registerWithParameters:parameters];
|
| }
|
| if (!result) {
|
| - [self updateStatus:kAutoupdateRegisterFailed version:nil];
|
| + [self updateStatus:keystone_glue::kAutoupdateRegisterFailed version:nil];
|
| return;
|
| }
|
|
|
| @@ -526,13 +527,13 @@ NSString* const kVersionKey = @"KSVersion";
|
| NSDictionary* userInfo = [notification userInfo];
|
| if ([[userInfo objectForKey:ksr::KSRegistrationStatusKey] boolValue]) {
|
| if ([self isSystemTicketDoomed]) {
|
| - [self updateStatus:kAutoupdateNeedsPromotion version:nil];
|
| + [self updateStatus:keystone_glue::kAutoupdateNeedsPromotion version:nil];
|
| } else {
|
| - [self updateStatus:kAutoupdateRegistered version:nil];
|
| + [self updateStatus:keystone_glue::kAutoupdateRegistered version:nil];
|
| }
|
| } else {
|
| // Dump registration_?
|
| - [self updateStatus:kAutoupdateRegisterFailed version:nil];
|
| + [self updateStatus:keystone_glue::kAutoupdateRegisterFailed version:nil];
|
| }
|
| }
|
|
|
| @@ -549,11 +550,11 @@ NSString* const kVersionKey = @"KSVersion";
|
| DCHECK(![self asyncOperationPending]);
|
|
|
| if (!registration_) {
|
| - [self updateStatus:kAutoupdateCheckFailed version:nil];
|
| + [self updateStatus:keystone_glue::kAutoupdateCheckFailed version:nil];
|
| return;
|
| }
|
|
|
| - [self updateStatus:kAutoupdateChecking version:nil];
|
| + [self updateStatus:keystone_glue::kAutoupdateChecking version:nil];
|
|
|
| [registration_ checkForUpdate];
|
|
|
| @@ -566,12 +567,12 @@ NSString* const kVersionKey = @"KSVersion";
|
|
|
| if ([[userInfo objectForKey:ksr::KSRegistrationUpdateCheckErrorKey]
|
| boolValue]) {
|
| - [self updateStatus:kAutoupdateCheckFailed version:nil];
|
| + [self updateStatus:keystone_glue::kAutoupdateCheckFailed version:nil];
|
| } else if ([[userInfo objectForKey:ksr::KSRegistrationStatusKey] boolValue]) {
|
| // If an update is known to be available, go straight to
|
| // -updateStatus:version:. It doesn't matter what's currently on disk.
|
| NSString* version = [userInfo objectForKey:ksr::KSRegistrationVersionKey];
|
| - [self updateStatus:kAutoupdateAvailable version:version];
|
| + [self updateStatus:keystone_glue::kAutoupdateAvailable version:version];
|
| } else {
|
| // If no updates are available, check what's on disk, because an update
|
| // may have already been installed. This check happens on another thread,
|
| @@ -584,11 +585,11 @@ NSString* const kVersionKey = @"KSVersion";
|
| DCHECK(![self asyncOperationPending]);
|
|
|
| if (!registration_) {
|
| - [self updateStatus:kAutoupdateInstallFailed version:nil];
|
| + [self updateStatus:keystone_glue::kAutoupdateInstallFailed version:nil];
|
| return;
|
| }
|
|
|
| - [self updateStatus:kAutoupdateInstalling version:nil];
|
| + [self updateStatus:keystone_glue::kAutoupdateInstalling version:nil];
|
|
|
| [registration_ startUpdate];
|
|
|
| @@ -605,7 +606,7 @@ NSString* const kVersionKey = @"KSVersion";
|
| // KSUpdateCheckSuccessfullyInstalledKey is checked.
|
| if (![[userInfo objectForKey:ksr::KSUpdateCheckSuccessfullyInstalledKey]
|
| intValue]) {
|
| - [self updateStatus:kAutoupdateInstallFailed version:nil];
|
| + [self updateStatus:keystone_glue::kAutoupdateInstallFailed version:nil];
|
| } else {
|
| updateSuccessfullyInstalled_ = YES;
|
|
|
| @@ -644,11 +645,11 @@ NSString* const kVersionKey = @"KSVersion";
|
| - (void)determineUpdateStatusForVersion:(NSString*)version {
|
| DCHECK([NSThread isMainThread]);
|
|
|
| - AutoupdateStatus status;
|
| + keystone_glue::AutoupdateStatus status;
|
| if (updateSuccessfullyInstalled_) {
|
| // If an update was successfully installed and this object saw it happen,
|
| // then don't even bother comparing versions.
|
| - status = kAutoupdateInstalled;
|
| + status = keystone_glue::kAutoupdateInstalled;
|
| } else {
|
| NSString* currentVersion =
|
| [NSString stringWithUTF8String:chrome::kChromeVersion];
|
| @@ -656,22 +657,24 @@ NSString* const kVersionKey = @"KSVersion";
|
| // If the version on disk could not be determined, assume that
|
| // whatever's running is current.
|
| version = currentVersion;
|
| - status = kAutoupdateCurrent;
|
| + status = keystone_glue::kAutoupdateCurrent;
|
| } else if ([version isEqualToString:currentVersion]) {
|
| - status = kAutoupdateCurrent;
|
| + status = keystone_glue::kAutoupdateCurrent;
|
| } else {
|
| // If the version on disk doesn't match what's currently running, an
|
| // update must have been applied in the background, without this app's
|
| // direct participation. Leave updateSuccessfullyInstalled_ alone
|
| // because there's no direct knowledge of what actually happened.
|
| - status = kAutoupdateInstalled;
|
| + status = keystone_glue::kAutoupdateInstalled;
|
| }
|
| }
|
|
|
| [self updateStatus:status version:version];
|
| }
|
|
|
| -- (void)updateStatus:(AutoupdateStatus)status version:(NSString*)version {
|
| +- (void)updateStatus:(keystone_glue::AutoupdateStatus)status
|
| + version:(NSString*)version {
|
| + DCHECK([NSThread isMainThread]);
|
| NSNumber* statusNumber = [NSNumber numberWithInt:status];
|
| NSMutableDictionary* dictionary =
|
| [NSMutableDictionary dictionaryWithObject:statusNumber
|
| @@ -693,18 +696,18 @@ NSString* const kVersionKey = @"KSVersion";
|
| return [[recentNotification_ retain] autorelease];
|
| }
|
|
|
| -- (AutoupdateStatus)recentStatus {
|
| +- (keystone_glue::AutoupdateStatus)recentStatus {
|
| NSDictionary* dictionary = [recentNotification_ userInfo];
|
| - return static_cast<AutoupdateStatus>(
|
| + return static_cast<keystone_glue::AutoupdateStatus>(
|
| [[dictionary objectForKey:kAutoupdateStatusStatus] intValue]);
|
| }
|
|
|
| - (BOOL)asyncOperationPending {
|
| - AutoupdateStatus status = [self recentStatus];
|
| - return status == kAutoupdateRegistering ||
|
| - status == kAutoupdateChecking ||
|
| - status == kAutoupdateInstalling ||
|
| - status == kAutoupdatePromoting;
|
| + keystone_glue::AutoupdateStatus status = [self recentStatus];
|
| + return status == keystone_glue::kAutoupdateRegistering ||
|
| + status == keystone_glue::kAutoupdateChecking ||
|
| + status == keystone_glue::kAutoupdateInstalling ||
|
| + status == keystone_glue::kAutoupdatePromoting;
|
| }
|
|
|
| - (BOOL)isUserTicket {
|
| @@ -832,7 +835,7 @@ NSString* const kVersionKey = @"KSVersion";
|
|
|
| synchronousPromotion_ = synchronous;
|
|
|
| - [self updateStatus:kAutoupdatePromoting version:nil];
|
| + [self updateStatus:keystone_glue::kAutoupdatePromoting version:nil];
|
|
|
| // TODO(mark): Remove when able!
|
| //
|
| @@ -881,12 +884,12 @@ NSString* const kVersionKey = @"KSVersion";
|
| if (status != errAuthorizationSuccess) {
|
| OSSTATUS_LOG(ERROR, status)
|
| << "AuthorizationExecuteWithPrivileges preflight";
|
| - [self updateStatus:kAutoupdatePromoteFailed version:nil];
|
| + [self updateStatus:keystone_glue::kAutoupdatePromoteFailed version:nil];
|
| return;
|
| }
|
| if (exit_status != 0) {
|
| LOG(ERROR) << "keystone_promote_preflight status " << exit_status;
|
| - [self updateStatus:kAutoupdatePromoteFailed version:nil];
|
| + [self updateStatus:keystone_glue::kAutoupdatePromoteFailed version:nil];
|
| return;
|
| }
|
|
|
| @@ -910,7 +913,7 @@ NSString* const kVersionKey = @"KSVersion";
|
|
|
| if (![registration_ promoteWithParameters:parameters
|
| authorization:authorization_]) {
|
| - [self updateStatus:kAutoupdatePromoteFailed version:nil];
|
| + [self updateStatus:keystone_glue::kAutoupdatePromoteFailed version:nil];
|
| authorization_.reset();
|
| return;
|
| }
|
| @@ -939,7 +942,7 @@ NSString* const kVersionKey = @"KSVersion";
|
| }
|
| } else {
|
| authorization_.reset();
|
| - [self updateStatus:kAutoupdatePromoteFailed version:nil];
|
| + [self updateStatus:keystone_glue::kAutoupdatePromoteFailed version:nil];
|
| }
|
|
|
| if (synchronousPromotion_) {
|
| @@ -995,7 +998,7 @@ NSString* const kVersionKey = @"KSVersion";
|
| - (void)changePermissionsForPromotionComplete {
|
| authorization_.reset();
|
|
|
| - [self updateStatus:kAutoupdatePromoted version:nil];
|
| + [self updateStatus:keystone_glue::kAutoupdatePromoted version:nil];
|
| }
|
|
|
| - (void)setAppPath:(NSString*)appPath {
|
|
|