Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7215)

Unified Diff: chrome/installer/mac/app/AppDelegate.m

Issue 2281263003: Use AuthorizedInstall to move Chrome into place and set up permissions (Closed)
Patch Set: Bridge pointer bug fixes, integration of AuthorizedInstall Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/installer/mac/app/Unpacker.m » ('j') | chrome/installer/mac/app/Unpacker.m » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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]
« no previous file with comments | « no previous file | chrome/installer/mac/app/Unpacker.m » ('j') | chrome/installer/mac/app/Unpacker.m » ('J')

Powered by Google App Engine
This is Rietveld 408576698