diff options
author | thakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-16 22:00:55 +0000 |
---|---|---|
committer | thakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-16 22:00:55 +0000 |
commit | fc29bbcab6b087a516b3f427c851d9af5b38662a (patch) | |
tree | b168fa2f86bbe60c557c0ce0a7f876ac788fa55c /chrome/installer/gcapi_mac | |
parent | 9770ce21105a807d9dabd54267bea450828ca609 (diff) | |
download | chromium_src-fc29bbcab6b087a516b3f427c851d9af5b38662a.zip chromium_src-fc29bbcab6b087a516b3f427c851d9af5b38662a.tar.gz chromium_src-fc29bbcab6b087a516b3f427c851d9af5b38662a.tar.bz2 |
gcapi mac: Allow chrome installations if chrome doesn't exist where keystone think it is.
BUG=none
Review URL: https://codereview.chromium.org/11412049
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@168299 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/installer/gcapi_mac')
-rw-r--r-- | chrome/installer/gcapi_mac/gcapi.mm | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/chrome/installer/gcapi_mac/gcapi.mm b/chrome/installer/gcapi_mac/gcapi.mm index b972834..d2e6e6f 100644 --- a/chrome/installer/gcapi_mac/gcapi.mm +++ b/chrome/installer/gcapi_mac/gcapi.mm @@ -153,8 +153,36 @@ BOOL HasChromeTicket(TicketKind kind, const passwd* user) { } [task release]; - if (ksadmin_ran_successfully && [string length] > 0) - return YES; + if (ksadmin_ran_successfully && [string length] > 0) { + // If the user deleted chrome, it doesn't get unregistered in keystone. + // Check if the path keystone thinks chrome is at still exists, and if not + // treat this as "chrome isn't installed". Sniff for + // xc=<KSPathExistenceChecker:1234 path=/Applications/Google Chrome.app> + // in the output. But don't mess with system tickets, since reinstalling + // a user chrome on top of a system ticket produces a non-autoupdating + // chrome. + if (kind == kSystemTicket) + return YES; + + NSRange start = [string rangeOfString:@"\n\txc=<KSPathExistenceChecker:"]; + if (start.location == NSNotFound && start.length == 0) + return YES; // Err on the cautious side. + string = [string substringFromIndex:start.location]; + + start = [string rangeOfString:@"path="]; + if (start.location == NSNotFound && start.length == 0) + return YES; // Err on the cautious side. + string = [string substringFromIndex:start.location]; + + NSRange end = [string rangeOfString:@".app>\n\t"]; + if (end.location == NSNotFound && end.length == 0) + return YES; + + string = [string substringToIndex:NSMaxRange(end) - [@">\n\t" length]]; + string = [string substringFromIndex:start.length]; + + return [[NSFileManager defaultManager] fileExistsAtPath:string]; + } } return NO; |