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

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

Issue 2243863003: Added authorized install with a script to do the copy. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Cleaned up code and made the script waiting not awkward 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
Index: chrome/installer/mac/app/AppDelegate.m
diff --git a/chrome/installer/mac/app/AppDelegate.m b/chrome/installer/mac/app/AppDelegate.m
index f60f0db6e36ed8641e1c40dca619541c7b868187..2896d280129ed6c629a1966ee6af182e347082e7 100644
--- a/chrome/installer/mac/app/AppDelegate.m
+++ b/chrome/installer/mac/app/AppDelegate.m
@@ -7,6 +7,7 @@
#import "InstallerWindowController.h"
#import "NSError+ChromeInstallerAdditions.h"
#import "NSAlert+ChromeInstallerAdditions.h"
+#import "AuthorizedInstall.h"
@interface NSAlert ()
- (void)beginSheetModalForWindow:(NSWindow*)sheetWindow
@@ -16,6 +17,7 @@
@interface AppDelegate ()<OmahaCommunicationDelegate, DownloaderDelegate> {
InstallerWindowController* installerWindowController_;
+ AuthorizedInstall* authorizedInstall_;
}
@property(strong) NSWindow* window;
@end
@@ -25,9 +27,15 @@
// Sets up the main window and begins the downloading process.
- (void)applicationDidFinishLaunching:(NSNotification*)aNotification {
+ // TODO: fix UI not loading until after asking for authorization.
installerWindowController_ =
[[InstallerWindowController alloc] initWithWindow:window_];
- [self startDownload];
+ authorizedInstall_ = [[AuthorizedInstall alloc] init];
+ if ([authorizedInstall_ loadInstallationTool]) {
+ [self startDownload];
+ } else {
+ [self onLoadInstallationToolFailure];
+ }
}
- (void)applicationWillTerminate:(NSNotification*)aNotification {
@@ -70,7 +78,11 @@
- (void)downloader:(Downloader*)download
onDownloadSuccess:(NSURL*)diskImagePath {
[installerWindowController_ updateStatusDescription:@"Done."];
- // TODO: replace the line of code below with real code someday
+ // TODO: Add unpacking step here and pass the path to the app bundle inside
Anna Zeng 2016/08/23 19:36:12 I appreciate the verboseness of this TODO.
ivanhernandez 2016/08/24 18:23:16 Done.
+ // the mounted disk image path to startInstall. Currently passing hardcoded
+ // path to preunpacked app bundle.
+ //[authorizedInstall_
+ // startInstall:@"/Users/ivanhernandez/Downloads/Google Chromo.app"];
Elly Fong-Jones 2016/08/24 16:39:22 In comments it's fine to be like, @"$HOME/Download
ivanhernandez 2016/08/24 18:23:16 Done.
}
- (void)downloader:(Downloader*)download
@@ -82,12 +94,21 @@
[self displayError:downloadError];
}
+- (void)onLoadInstallationToolFailure {
+ NSError* loadToolError = [NSError
+ errorForAlerts:@"Could not load installion tool"
+ withDescription:
+ @"Your Chrome Installer may be corrupted. Download and try again."
+ isRecoverable:NO];
+ [self displayError:loadToolError];
+}
+
// Displays an alert on the main window using the contents of the passed in
// error.
- (void)displayError:(NSError*)error {
NSAlert* alertForUser = [NSAlert alertWithError:error];
- dispatch_sync(dispatch_get_main_queue(), ^{
+ dispatch_async(dispatch_get_main_queue(), ^{
[alertForUser beginSheetModalForWindow:window_
completionHandler:^(NSModalResponse returnCode) {
if (returnCode != [alertForUser quitButton]) {
@@ -99,4 +120,6 @@
});
}
+
Anna Zeng 2016/08/23 19:36:12 Odd that there's extra new lines here. Remove?
ivanhernandez 2016/08/24 18:23:16 Done.
+
@end
« no previous file with comments | « no previous file | chrome/installer/mac/app/AuthorizedInstall.h » ('j') | chrome/installer/mac/app/AuthorizedInstall.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698