| Index: chrome/installer/mac/app/AppDelegate.m
|
| diff --git a/chrome/installer/mac/app/AppDelegate.m b/chrome/installer/mac/app/AppDelegate.m
|
| index a97b778ce57d38ba4bfe8ea86facf693437bc2bb..e3b9935ff65c37ab4a2be76b0fde7dff8976bffd 100644
|
| --- a/chrome/installer/mac/app/AppDelegate.m
|
| +++ b/chrome/installer/mac/app/AppDelegate.m
|
| @@ -114,11 +114,6 @@
|
| - (void)downloader:(Downloader*)download onSuccess:(NSURL*)diskImageURL {
|
| [installerWindowController_ updateStatusDescription:@"Installing..."];
|
| [installerWindowController_ enableLaunchButton];
|
| - // TODO: Add unpacking step here and pass the path to the app bundle inside
|
| - // the mounted disk image path to startInstall. Currently passing hardcoded
|
| - // path to preunpacked app bundle.
|
| - //[authorizedInstall_
|
| - // startInstall:@"$HOME/Downloads/Google Chrome.app"];
|
|
|
| Unpacker* unpacker = [[Unpacker alloc] init];
|
| unpacker.delegate = self;
|
| @@ -134,6 +129,23 @@
|
| }
|
|
|
| - (void)unpacker:(Unpacker*)unpacker onMountSuccess:(NSString*)tempAppPath {
|
| + SecStaticCodeRef diskStaticCode;
|
| + SecRequirementRef diskRequirement;
|
| + SecStaticCodeCreateWithPath(
|
| + (CFURLRef)CFBridgingRetain(
|
| + [NSURL fileURLWithPath:tempAppPath isDirectory:NO]),
|
| + kSecCSDefaultFlags, &diskStaticCode);
|
| + // TODO: update the requirement in here
|
| + SecRequirementCreateWithString((CFStringRef) @"anchor apple generic",
|
| + kSecCSDefaultFlags, &diskRequirement);
|
| + OSStatus oserror = 0;
|
| + if ((oserror = SecStaticCodeCheckValidity(diskStaticCode, kSecCSDefaultFlags,
|
| + diskRequirement)) !=
|
| + errSecSuccess) {
|
| + // TODO: add in more reasonable error handling
|
| + NSLog(@"verification failed: %d", oserror);
|
| + }
|
| +
|
| // Calling this function will change the progress bar into an indeterminate
|
| // one. We won't need to update the progress bar any more after this point.
|
| [installerWindowController_ updateDownloadProgress:-1.0];
|
| @@ -142,23 +154,10 @@
|
| window_.styleMask &= ~NSClosableWindowMask;
|
| preventTermination_ = YES;
|
|
|
| - // TODO: move the below code into AuthorizedInstall
|
| - NSString* chromeInApplicationsFolder = @"/Applications/Google Chromo.app";
|
| + NSString* chromeInApplicationsFolder =
|
| + [authorizedInstall_ startInstall:tempAppPath];
|
|
|
| NSError* error = nil;
|
| - if ([[NSFileManager defaultManager]
|
| - fileExistsAtPath:chromeInApplicationsFolder]) {
|
| - [[NSFileManager defaultManager] moveItemAtPath:chromeInApplicationsFolder
|
| - toPath:tempAppPath
|
| - error:nil];
|
| - }
|
| - if (![[NSFileManager defaultManager] moveItemAtPath:tempAppPath
|
| - toPath:chromeInApplicationsFolder
|
| - error:&error]) {
|
| - NSLog(@"%@", error);
|
| - }
|
| - // TODO: move the above code into AuthorizedInstall
|
| -
|
| [[NSWorkspace sharedWorkspace]
|
| launchApplicationAtURL:[NSURL fileURLWithPath:chromeInApplicationsFolder
|
| isDirectory:NO]
|
|
|