| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #import "AppDelegate.h" | 5 #import "AppDelegate.h" |
| 6 | 6 |
| 7 #include "chrome/common/chrome_switches.h" |
| 8 |
| 7 #import "Downloader.h" | 9 #import "Downloader.h" |
| 8 #import "InstallerWindowController.h" | 10 #import "InstallerWindowController.h" |
| 9 #import "NSError+ChromeInstallerAdditions.h" | 11 #import "NSError+ChromeInstallerAdditions.h" |
| 10 #import "NSAlert+ChromeInstallerAdditions.h" | 12 #import "NSAlert+ChromeInstallerAdditions.h" |
| 11 #import "OmahaCommunication.h" | 13 #import "OmahaCommunication.h" |
| 12 #import "Unpacker.h" | 14 #import "Unpacker.h" |
| 13 | 15 |
| 14 @interface NSAlert () | 16 @interface NSAlert () |
| 15 - (void)beginSheetModalForWindow:(NSWindow*)sheetWindow | 17 - (void)beginSheetModalForWindow:(NSWindow*)sheetWindow |
| 16 completionHandler: | 18 completionHandler: |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 removeItemAtPath:@"/Applications/Google Chromo.app" | 131 removeItemAtPath:@"/Applications/Google Chromo.app" |
| 130 error:nil]; | 132 error:nil]; |
| 131 } | 133 } |
| 132 if (![[NSFileManager defaultManager] | 134 if (![[NSFileManager defaultManager] |
| 133 moveItemAtPath:tempAppPath | 135 moveItemAtPath:tempAppPath |
| 134 toPath:@"/Applications/Google Chromo.app" | 136 toPath:@"/Applications/Google Chromo.app" |
| 135 error:&error]) { | 137 error:&error]) { |
| 136 NSLog(@"%@", error); | 138 NSLog(@"%@", error); |
| 137 } | 139 } |
| 138 | 140 |
| 139 // TODO: edit the below code to feed in command line arguments | 141 NSMutableArray* installerSettings = [[NSMutableArray alloc] init]; |
| 142 if ([installerWindowController_ isUserMetricsChecked]) |
| 143 [installerSettings |
| 144 addObject:[NSString stringWithUTF8String:switches::kEnableUserMetrics]]; |
| 145 if ([installerWindowController_ isDefaultBrowserChecked]) |
| 146 [installerSettings |
| 147 addObject:[NSString stringWithUTF8String:switches::kSetDefaultBrowser]]; |
| 140 | 148 |
| 141 [[NSWorkspace sharedWorkspace] | 149 [[NSWorkspace sharedWorkspace] |
| 142 launchApplicationAtURL: | 150 launchApplicationAtURL: |
| 143 [NSURL fileURLWithPath:@"/Applications/Google Chromo.app" | 151 [NSURL fileURLWithPath:@"/Applications/Google Chromo.app" |
| 144 isDirectory:NO] | 152 isDirectory:NO] |
| 145 options:NSWorkspaceLaunchDefault | 153 options:NSWorkspaceLaunchDefault |
| 146 configuration:@{} | 154 configuration:@{ |
| 155 NSWorkspaceLaunchConfigurationArguments : installerSettings |
| 156 } |
| 147 error:&error]; | 157 error:&error]; |
| 148 if (error) { | 158 if (error) { |
| 149 NSLog(@"Chromo failed to launch: %@", error); | 159 NSLog(@"Chromo failed to launch: %@", error); |
| 150 } | 160 } |
| 151 | 161 |
| 152 // Begin teardown stuff! | 162 // Begin teardown stuff! |
| 153 dispatch_async(dispatch_get_main_queue(), ^{ | 163 dispatch_async(dispatch_get_main_queue(), ^{ |
| 154 [window_ orderOut:nil]; | 164 [window_ orderOut:nil]; |
| 155 }); | 165 }); |
| 156 | 166 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 if (returnCode != [alertForUser quitResponse]) { | 199 if (returnCode != [alertForUser quitResponse]) { |
| 190 [self startDownload]; | 200 [self startDownload]; |
| 191 } else { | 201 } else { |
| 192 [NSApp terminate:nil]; | 202 [NSApp terminate:nil]; |
| 193 } | 203 } |
| 194 }]; | 204 }]; |
| 195 }); | 205 }); |
| 196 } | 206 } |
| 197 | 207 |
| 198 @end | 208 @end |
| OLD | NEW |