| 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 "Unpacker.h" | 5 #import "Unpacker.h" |
| 6 | 6 |
| 7 #import <AppKit/AppKit.h> | 7 #import <AppKit/AppKit.h> |
| 8 #include <DiskArbitration/DiskArbitration.h> | 8 #include <DiskArbitration/DiskArbitration.h> |
| 9 #include <dispatch/dispatch.h> | 9 #include <dispatch/dispatch.h> |
| 10 | 10 |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 kDADiskUnmountOptionWhole | kDADiskUnmountOptionForce, | 139 kDADiskUnmountOptionWhole | kDADiskUnmountOptionForce, |
| 140 unmount_callback, (__bridge_retained void*)self); | 140 unmount_callback, (__bridge_retained void*)self); |
| 141 | 141 |
| 142 CFRelease(whole_disk); | 142 CFRelease(whole_disk); |
| 143 CFRelease(child_disk); | 143 CFRelease(child_disk); |
| 144 } | 144 } |
| 145 | 145 |
| 146 - (void)didFinishEjectingDisk:(DADiskRef)disk | 146 - (void)didFinishEjectingDisk:(DADiskRef)disk |
| 147 withDissenter:(DADissenterRef)dissenter { | 147 withDissenter:(DADissenterRef)dissenter { |
| 148 DASessionSetDispatchQueue(session_, NULL); | 148 DASessionSetDispatchQueue(session_, NULL); |
| 149 #if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_8 |
| 149 dispatch_release(unpack_dq_); | 150 dispatch_release(unpack_dq_); |
| 151 #endif |
| 150 CFRelease(session_); | 152 CFRelease(session_); |
| 151 NSError* error = nil; | 153 NSError* error = nil; |
| 152 if (dissenter) { | 154 if (dissenter) { |
| 153 DAReturn status = DADissenterGetStatus(dissenter); | 155 DAReturn status = DADissenterGetStatus(dissenter); |
| 154 error = [NSError | 156 error = [NSError |
| 155 errorWithDomain:@"ChromeErrorDomain" | 157 errorWithDomain:@"ChromeErrorDomain" |
| 156 code:err_get_code(status) | 158 code:err_get_code(status) |
| 157 userInfo:@{ | 159 userInfo:@{ |
| 158 NSLocalizedDescriptionKey : | 160 NSLocalizedDescriptionKey : |
| 159 (__bridge NSString*)DADissenterGetStatusString(dissenter) | 161 (__bridge NSString*)DADissenterGetStatusString(dissenter) |
| 160 }]; | 162 }]; |
| 161 [delegate_ unpacker:self onUnmountFailure:error]; | 163 [delegate_ unpacker:self onUnmountFailure:error]; |
| 162 } else { | 164 } else { |
| 163 [self cleanUp]; | 165 [self cleanUp]; |
| 164 [delegate_ unpacker:self onUnmountSuccess:mountPath_]; | 166 [delegate_ unpacker:self onUnmountSuccess:mountPath_]; |
| 165 } | 167 } |
| 166 } | 168 } |
| 167 | 169 |
| 168 @end | 170 @end |
| OLD | NEW |