OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/mac/install_from_dmg.h" | 5 #include "chrome/browser/mac/install_from_dmg.h" |
6 | 6 |
7 #import <AppKit/AppKit.h> | 7 #import <AppKit/AppKit.h> |
8 #include <ApplicationServices/ApplicationServices.h> | 8 #include <ApplicationServices/ApplicationServices.h> |
9 #include <CoreFoundation/CoreFoundation.h> | 9 #include <CoreFoundation/CoreFoundation.h> |
10 #include <CoreServices/CoreServices.h> | 10 #include <CoreServices/CoreServices.h> |
11 #include <DiskArbitration/DiskArbitration.h> | 11 #include <DiskArbitration/DiskArbitration.h> |
12 #include <IOKit/IOKitLib.h> | 12 #include <IOKit/IOKitLib.h> |
13 #include <signal.h> | 13 #include <signal.h> |
14 #include <stdlib.h> | 14 #include <stdlib.h> |
15 #include <string.h> | 15 #include <string.h> |
16 #include <sys/param.h> | 16 #include <sys/param.h> |
17 #include <sys/mount.h> | 17 #include <sys/mount.h> |
18 | 18 |
19 #include "base/auto_reset.h" | 19 #include "base/auto_reset.h" |
20 #include "base/basictypes.h" | 20 #include "base/basictypes.h" |
21 #include "base/command_line.h" | 21 #include "base/command_line.h" |
22 #include "base/files/file_path.h" | 22 #include "base/files/file_path.h" |
23 #include "base/logging.h" | 23 #include "base/logging.h" |
24 #include "base/mac/authorization_util.h" | 24 #include "base/mac/authorization_util.h" |
25 #include "base/mac/bundle_locations.h" | 25 #include "base/mac/bundle_locations.h" |
26 #include "base/mac/mac_logging.h" | 26 #include "base/mac/mac_logging.h" |
| 27 #include "base/mac/mach_logging.h" |
27 #import "base/mac/mac_util.h" | 28 #import "base/mac/mac_util.h" |
28 #include "base/mac/scoped_authorizationref.h" | 29 #include "base/mac/scoped_authorizationref.h" |
29 #include "base/mac/scoped_cftyperef.h" | 30 #include "base/mac/scoped_cftyperef.h" |
30 #include "base/mac/scoped_ioobject.h" | 31 #include "base/mac/scoped_ioobject.h" |
31 #include "base/mac/scoped_nsautorelease_pool.h" | 32 #include "base/mac/scoped_nsautorelease_pool.h" |
32 #include "base/strings/string_util.h" | 33 #include "base/strings/string_util.h" |
33 #include "base/strings/sys_string_conversions.h" | 34 #include "base/strings/sys_string_conversions.h" |
34 #include "chrome/browser/mac/dock.h" | 35 #include "chrome/browser/mac/dock.h" |
35 #import "chrome/browser/mac/keystone_glue.h" | 36 #import "chrome/browser/mac/keystone_glue.h" |
36 #include "chrome/browser/mac/relauncher.h" | 37 #include "chrome/browser/mac/relauncher.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 } | 75 } |
75 | 76 |
76 io_iterator_t iterator_ref; | 77 io_iterator_t iterator_ref; |
77 kern_return_t kr = | 78 kern_return_t kr = |
78 IORegistryEntryCreateIterator(media, | 79 IORegistryEntryCreateIterator(media, |
79 kIOServicePlane, | 80 kIOServicePlane, |
80 kIORegistryIterateRecursively | | 81 kIORegistryIterateRecursively | |
81 kIORegistryIterateParents, | 82 kIORegistryIterateParents, |
82 &iterator_ref); | 83 &iterator_ref); |
83 if (kr != KERN_SUCCESS) { | 84 if (kr != KERN_SUCCESS) { |
84 LOG(ERROR) << "IORegistryEntryCreateIterator: " << kr; | 85 MACH_LOG(ERROR, kr) << "IORegistryEntryCreateIterator"; |
85 return IO_OBJECT_NULL; | 86 return IO_OBJECT_NULL; |
86 } | 87 } |
87 base::mac::ScopedIOObject<io_iterator_t> iterator(iterator_ref); | 88 base::mac::ScopedIOObject<io_iterator_t> iterator(iterator_ref); |
88 iterator_ref = IO_OBJECT_NULL; | 89 iterator_ref = IO_OBJECT_NULL; |
89 | 90 |
90 // Look at each of the ancestor services, beginning with the parent, | 91 // Look at each of the ancestor services, beginning with the parent, |
91 // iterating all the way up to the device tree's root. If any ancestor | 92 // iterating all the way up to the device tree's root. If any ancestor |
92 // service matches the class used for disk images, the media resides on a | 93 // service matches the class used for disk images, the media resides on a |
93 // disk image, and the disk image file's path can be determined by examining | 94 // disk image, and the disk image file's path can be determined by examining |
94 // the image-path property. | 95 // the image-path property. |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 if (!match_dict) { | 201 if (!match_dict) { |
201 LOG(ERROR) << "IOBSDNameMatching " << dmg_bsd_device_name; | 202 LOG(ERROR) << "IOBSDNameMatching " << dmg_bsd_device_name; |
202 return false; | 203 return false; |
203 } | 204 } |
204 | 205 |
205 io_iterator_t iterator_ref; | 206 io_iterator_t iterator_ref; |
206 kern_return_t kr = IOServiceGetMatchingServices(master_port, | 207 kern_return_t kr = IOServiceGetMatchingServices(master_port, |
207 match_dict, | 208 match_dict, |
208 &iterator_ref); | 209 &iterator_ref); |
209 if (kr != KERN_SUCCESS) { | 210 if (kr != KERN_SUCCESS) { |
210 LOG(ERROR) << "IOServiceGetMatchingServices: " << kr; | 211 MACH_LOG(ERROR, kr) << "IOServiceGetMatchingServices"; |
211 return false; | 212 return false; |
212 } | 213 } |
213 base::mac::ScopedIOObject<io_iterator_t> iterator(iterator_ref); | 214 base::mac::ScopedIOObject<io_iterator_t> iterator(iterator_ref); |
214 iterator_ref = IO_OBJECT_NULL; | 215 iterator_ref = IO_OBJECT_NULL; |
215 | 216 |
216 // There needs to be exactly one matching service. | 217 // There needs to be exactly one matching service. |
217 base::mac::ScopedIOObject<io_service_t> media(IOIteratorNext(iterator)); | 218 base::mac::ScopedIOObject<io_service_t> media(IOIteratorNext(iterator)); |
218 if (!media) { | 219 if (!media) { |
219 LOG(ERROR) << "IOIteratorNext: no service"; | 220 LOG(ERROR) << "IOIteratorNext: no service"; |
220 return false; | 221 return false; |
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
677 const UInt8* trash_path_u8 = reinterpret_cast<const UInt8*>( | 678 const UInt8* trash_path_u8 = reinterpret_cast<const UInt8*>( |
678 trash_path.value().c_str()); | 679 trash_path.value().c_str()); |
679 status = FNNotifyByPath(trash_path_u8, | 680 status = FNNotifyByPath(trash_path_u8, |
680 kFNDirectoryModifiedMessage, | 681 kFNDirectoryModifiedMessage, |
681 kNilOptions); | 682 kNilOptions); |
682 if (status != noErr) { | 683 if (status != noErr) { |
683 OSSTATUS_LOG(ERROR, status) << "FNNotifyByPath"; | 684 OSSTATUS_LOG(ERROR, status) << "FNNotifyByPath"; |
684 return; | 685 return; |
685 } | 686 } |
686 } | 687 } |
OLD | NEW |