Commit 19e0ff7b authored by mark@chromium.org's avatar mark@chromium.org

Map update check failure to "update server not available."

BUG=25948
TEST=With a suitably recent KSR, mess up the update server URL in the ticket,
     and verify that the update status line in the About box shows the gray
     icon with "update server not available" after attempting to check for
     an update.
Review URL: http://codereview.chromium.org/344002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@30240 0039d316-1c4b-4281-b951-d872f2087c98
parent 513cb2b7
......@@ -9,6 +9,8 @@
#import "base/worker_pool_mac.h"
#include "chrome/common/chrome_constants.h"
namespace {
// Provide declarations of the Keystone registration bits needed here. From
// KSRegistration.h.
typedef enum { kKSPathExistenceChecker } KSExistenceCheckerType;
......@@ -17,6 +19,7 @@ NSString *KSRegistrationCheckForUpdateNotification =
@"KSRegistrationCheckForUpdateNotification";
NSString *KSRegistrationStatusKey = @"Status";
NSString *KSRegistrationVersionKey = @"Version";
NSString *KSRegistrationUpdateCheckErrorKey = @"Error";
NSString *KSRegistrationStartUpdateNotification =
@"KSRegistrationStartUpdateNotification";
......@@ -26,6 +29,8 @@ NSString *KSUpdateCheckSuccessfullyInstalledKey = @"SuccessfullyInstalled";
NSString *KSRegistrationRemoveExistingTag = @"";
#define KSRegistrationPreserveExistingTag nil
} // namespace
@interface KSRegistration : NSObject
+ (id)registrationWithProductID:(NSString*)productID;
......@@ -253,10 +258,10 @@ static KeystoneGlue* sDefaultKeystoneGlue = nil; // leaked
- (void)checkForUpdateComplete:(NSNotification*)notification {
NSDictionary* userInfo = [notification userInfo];
BOOL updatesAvailable =
[[userInfo objectForKey:KSRegistrationStatusKey] boolValue];
if (updatesAvailable) {
if ([[userInfo objectForKey:KSRegistrationUpdateCheckErrorKey] boolValue]) {
[self updateStatus:kAutoupdateCheckFailed version:nil];
} else if ([[userInfo objectForKey: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:KSRegistrationVersionKey];
......@@ -287,12 +292,10 @@ static KeystoneGlue* sDefaultKeystoneGlue = nil; // leaked
- (void)installUpdateComplete:(NSNotification*)notification {
NSDictionary* userInfo = [notification userInfo];
BOOL checkSuccessful =
[[userInfo objectForKey:KSUpdateCheckSuccessfulKey] boolValue];
int installs =
[[userInfo objectForKey:KSUpdateCheckSuccessfullyInstalledKey] intValue];
if (!checkSuccessful || !installs) {
if (![[userInfo objectForKey:KSUpdateCheckSuccessfulKey] boolValue] ||
![[userInfo objectForKey:KSUpdateCheckSuccessfullyInstalledKey]
intValue]) {
[self updateStatus:kAutoupdateInstallFailed version:nil];
} else {
updateSuccessfullyInstalled_ = YES;
......
......@@ -323,8 +323,6 @@ static BOOL recentShownInstallFailedStatus = NO;
// Fall through.
case kAutoupdateCheckFailed:
// TODO(mark): Keystone doesn't currently indicate when a check for
// updates failed. Fix that.
imageID = IDR_UPDATE_FAIL;
message = l10n_util::GetNSStringFWithFixup(IDS_UPGRADE_ERROR,
IntToString16(status));
......
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