OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #include "chrome/browser/ui/cocoa/install_from_dmg.h" | 5 #include "chrome/browser/ui/cocoa/install_from_dmg.h" |
6 | 6 |
7 #include <ApplicationServices/ApplicationServices.h> | 7 #include <ApplicationServices/ApplicationServices.h> |
8 #import <AppKit/AppKit.h> | 8 #import <AppKit/AppKit.h> |
9 #include <CoreFoundation/CoreFoundation.h> | 9 #include <CoreFoundation/CoreFoundation.h> |
10 #include <CoreServices/CoreServices.h> | 10 #include <CoreServices/CoreServices.h> |
11 #include <IOKit/IOKitLib.h> | 11 #include <IOKit/IOKitLib.h> |
12 #include <string.h> | 12 #include <string.h> |
13 #include <sys/param.h> | 13 #include <sys/param.h> |
14 #include <sys/mount.h> | 14 #include <sys/mount.h> |
15 | 15 |
16 #include "app/l10n_util.h" | 16 #include "app/l10n_util.h" |
17 #import "app/l10n_util_mac.h" | 17 #import "app/l10n_util_mac.h" |
18 #include "base/basictypes.h" | 18 #include "base/basictypes.h" |
19 #include "base/command_line.h" | 19 #include "base/command_line.h" |
20 #include "base/logging.h" | 20 #include "base/logging.h" |
21 #import "base/mac_util.h" | 21 #import "base/mac/mac_util.h" |
22 #include "base/mac/scoped_nsautorelease_pool.h" | 22 #include "base/mac/scoped_nsautorelease_pool.h" |
23 #include "chrome/browser/ui/cocoa/authorization_util.h" | 23 #include "chrome/browser/ui/cocoa/authorization_util.h" |
24 #include "chrome/browser/ui/cocoa/scoped_authorizationref.h" | 24 #include "chrome/browser/ui/cocoa/scoped_authorizationref.h" |
25 #import "chrome/browser/ui/cocoa/keystone_glue.h" | 25 #import "chrome/browser/ui/cocoa/keystone_glue.h" |
26 #include "grit/chromium_strings.h" | 26 #include "grit/chromium_strings.h" |
27 #include "grit/generated_resources.h" | 27 #include "grit/generated_resources.h" |
28 | 28 |
29 // When C++ exceptions are disabled, the C++ library defines |try| and | 29 // When C++ exceptions are disabled, the C++ library defines |try| and |
30 // |catch| so as to allow exception-expecting C++ code to build properly when | 30 // |catch| so as to allow exception-expecting C++ code to build properly when |
31 // language support for exceptions is not present. These macros interfere | 31 // language support for exceptions is not present. These macros interfere |
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
402 NSString* application_name = [source_path lastPathComponent]; | 402 NSString* application_name = [source_path lastPathComponent]; |
403 NSString* target_path = | 403 NSString* target_path = |
404 [application_directory stringByAppendingPathComponent:application_name]; | 404 [application_directory stringByAppendingPathComponent:application_name]; |
405 | 405 |
406 if ([file_manager fileExistsAtPath:target_path]) { | 406 if ([file_manager fileExistsAtPath:target_path]) { |
407 VLOG(1) << "Something already exists at " << [target_path UTF8String]; | 407 VLOG(1) << "Something already exists at " << [target_path UTF8String]; |
408 return false; | 408 return false; |
409 } | 409 } |
410 | 410 |
411 NSString* installer_path = | 411 NSString* installer_path = |
412 [mac_util::MainAppBundle() pathForResource:@"install" ofType:@"sh"]; | 412 [base::mac::MainAppBundle() pathForResource:@"install" ofType:@"sh"]; |
413 if (!installer_path) { | 413 if (!installer_path) { |
414 VLOG(1) << "Could not locate install.sh"; | 414 VLOG(1) << "Could not locate install.sh"; |
415 return false; | 415 return false; |
416 } | 416 } |
417 | 417 |
418 if (!ShouldInstallDialog()) { | 418 if (!ShouldInstallDialog()) { |
419 return false; | 419 return false; |
420 } | 420 } |
421 | 421 |
422 scoped_AuthorizationRef authorization( | 422 scoped_AuthorizationRef authorization( |
423 MaybeShowAuthorizationDialog(application_directory)); | 423 MaybeShowAuthorizationDialog(application_directory)); |
424 // authorization will be NULL if it's deemed unnecessary or if | 424 // authorization will be NULL if it's deemed unnecessary or if |
425 // authentication fails. In either case, try to install without privilege | 425 // authentication fails. In either case, try to install without privilege |
426 // escalation. | 426 // escalation. |
427 | 427 |
428 if (!InstallFromDiskImage(authorization.release(), | 428 if (!InstallFromDiskImage(authorization.release(), |
429 installer_path, | 429 installer_path, |
430 source_path, | 430 source_path, |
431 target_path) || | 431 target_path) || |
432 !LaunchInstalledApp(target_path)) { | 432 !LaunchInstalledApp(target_path)) { |
433 ShowErrorDialog(); | 433 ShowErrorDialog(); |
434 return false; | 434 return false; |
435 } | 435 } |
436 | 436 |
437 return true; | 437 return true; |
438 } | 438 } |
OLD | NEW |