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

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: Changed BUILD.gn so that only the app would compile AuthorizedInstall.m and not the tests. 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/AuthorizedInstall.h » ('j') | no next file with comments »
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 ab05d489cf93123af33ee5c139dc8539e2603f91..e7a11a5ddc84c428dc68360dc30e5df972994b0f 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 {
@@ -71,7 +79,11 @@
onDownloadSuccess:(NSURL*)diskImagePath {
[installerWindowController_ updateStatusDescription:@"Done."];
[installerWindowController_ enableLaunchButton];
- // 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
+ // the mounted disk image path to startInstall. Currently passing hardcoded
+ // path to preunpacked app bundle.
+ //[authorizedInstall_
+ // startInstall:@"$HOME/Downloads/Google Chrome.app"];
}
- (void)downloader:(Downloader*)download
@@ -83,12 +95,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]) {
« no previous file with comments | « no previous file | chrome/installer/mac/app/AuthorizedInstall.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698