| 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 <Security/Security.h> | 7 #include <Security/Security.h> |
| 8 | 8 |
| 9 #include "chrome/common/chrome_switches.h" |
| 10 |
| 9 #import "Downloader.h" | 11 #import "Downloader.h" |
| 10 #import "InstallerWindowController.h" | 12 #import "InstallerWindowController.h" |
| 11 #import "NSError+ChromeInstallerAdditions.h" | 13 #import "NSError+ChromeInstallerAdditions.h" |
| 12 #import "NSAlert+ChromeInstallerAdditions.h" | 14 #import "NSAlert+ChromeInstallerAdditions.h" |
| 13 #import "AuthorizedInstall.h" | 15 #import "AuthorizedInstall.h" |
| 14 #import "OmahaCommunication.h" | 16 #import "OmahaCommunication.h" |
| 15 #import "Unpacker.h" | 17 #import "Unpacker.h" |
| 16 | 18 |
| 17 @interface NSAlert () | 19 @interface NSAlert () |
| 18 - (void)beginSheetModalForWindow:(NSWindow*)sheetWindow | 20 - (void)beginSheetModalForWindow:(NSWindow*)sheetWindow |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 // one. We won't need to update the progress bar any more after this point. | 157 // one. We won't need to update the progress bar any more after this point. |
| 156 [installerWindowController_ updateDownloadProgress:-1.0]; | 158 [installerWindowController_ updateDownloadProgress:-1.0]; |
| 157 // By disabling closing the window or quitting, we can tell the user that | 159 // By disabling closing the window or quitting, we can tell the user that |
| 158 // closing the application at this point is not a good idea. | 160 // closing the application at this point is not a good idea. |
| 159 window_.styleMask &= ~NSClosableWindowMask; | 161 window_.styleMask &= ~NSClosableWindowMask; |
| 160 preventTermination_ = YES; | 162 preventTermination_ = YES; |
| 161 | 163 |
| 162 NSString* chromeInApplicationsFolder = | 164 NSString* chromeInApplicationsFolder = |
| 163 [authorizedInstall_ startInstall:tempAppPath]; | 165 [authorizedInstall_ startInstall:tempAppPath]; |
| 164 | 166 |
| 167 NSMutableArray* installerSettings = [[NSMutableArray alloc] init]; |
| 168 if ([installerWindowController_ isUserMetricsChecked]) |
| 169 [installerSettings |
| 170 addObject:[NSString stringWithUTF8String:switches::kEnableUserMetrics]]; |
| 171 if ([installerWindowController_ isDefaultBrowserChecked]) |
| 172 [installerSettings |
| 173 addObject:[NSString |
| 174 stringWithUTF8String:switches::kMakeDefaultBrowser]]; |
| 175 |
| 165 NSError* error = nil; | 176 NSError* error = nil; |
| 166 [[NSWorkspace sharedWorkspace] | 177 [[NSWorkspace sharedWorkspace] |
| 167 launchApplicationAtURL:[NSURL fileURLWithPath:chromeInApplicationsFolder | 178 launchApplicationAtURL:[NSURL fileURLWithPath:chromeInApplicationsFolder |
| 168 isDirectory:NO] | 179 isDirectory:NO] |
| 169 options:NSWorkspaceLaunchDefault | 180 options:NSWorkspaceLaunchDefault |
| 170 configuration:@{} | 181 configuration:@{ |
| 182 NSWorkspaceLaunchConfigurationArguments : installerSettings |
| 183 } |
| 171 error:&error]; | 184 error:&error]; |
| 172 if (error) { | 185 if (error) { |
| 173 NSLog(@"Chrome failed to launch: %@", error); | 186 NSLog(@"Chrome failed to launch: %@", error); |
| 174 } | 187 } |
| 175 | 188 |
| 176 // Begin teardown stuff! | 189 // Begin teardown stuff! |
| 177 dispatch_async(dispatch_get_main_queue(), ^{ | 190 dispatch_async(dispatch_get_main_queue(), ^{ |
| 178 [window_ orderOut:nil]; | 191 [window_ orderOut:nil]; |
| 179 }); | 192 }); |
| 180 | 193 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 if (returnCode != [alertForUser quitResponse]) { | 226 if (returnCode != [alertForUser quitResponse]) { |
| 214 [self startDownload]; | 227 [self startDownload]; |
| 215 } else { | 228 } else { |
| 216 [NSApp terminate:nil]; | 229 [NSApp terminate:nil]; |
| 217 } | 230 } |
| 218 }]; | 231 }]; |
| 219 }); | 232 }); |
| 220 } | 233 } |
| 221 | 234 |
| 222 @end | 235 @end |
| OLD | NEW |