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/cocoa/install_from_dmg.h" | 5 #include "chrome/browser/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_util.h" |
22 #include "base/scoped_nsautorelease_pool.h" | 22 #include "base/mac/scoped_nsautorelease_pool.h" |
23 #include "chrome/browser/cocoa/authorization_util.h" | 23 #include "chrome/browser/cocoa/authorization_util.h" |
24 #include "chrome/browser/cocoa/scoped_authorizationref.h" | 24 #include "chrome/browser/cocoa/scoped_authorizationref.h" |
25 #import "chrome/browser/cocoa/keystone_glue.h" | 25 #import "chrome/browser/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 |
32 // with the use of |@try| and |@catch| in Objective-C files such as this one. | 32 // with the use of |@try| and |@catch| in Objective-C files such as this one. |
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
363 [alert setMessageText:title]; | 363 [alert setMessageText:title]; |
364 [alert setInformativeText:error]; | 364 [alert setInformativeText:error]; |
365 [alert addButtonWithTitle:ok]; | 365 [alert addButtonWithTitle:ok]; |
366 | 366 |
367 [alert runModal]; | 367 [alert runModal]; |
368 } | 368 } |
369 | 369 |
370 } // namespace | 370 } // namespace |
371 | 371 |
372 bool MaybeInstallFromDiskImage() { | 372 bool MaybeInstallFromDiskImage() { |
373 base::ScopedNSAutoreleasePool autorelease_pool; | 373 base::mac::ScopedNSAutoreleasePool autorelease_pool; |
374 | 374 |
375 if (!IsAppRunningFromReadOnlyDiskImage()) { | 375 if (!IsAppRunningFromReadOnlyDiskImage()) { |
376 return false; | 376 return false; |
377 } | 377 } |
378 | 378 |
379 NSArray* application_directories = | 379 NSArray* application_directories = |
380 NSSearchPathForDirectoriesInDomains(NSApplicationDirectory, | 380 NSSearchPathForDirectoriesInDomains(NSApplicationDirectory, |
381 NSLocalDomainMask, | 381 NSLocalDomainMask, |
382 YES); | 382 YES); |
383 if ([application_directories count] == 0) { | 383 if ([application_directories count] == 0) { |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 |