| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #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> |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 observed_type.assign(", observed "); | 134 observed_type.assign(", observed "); |
| 135 observed_type.append(base::SysCFStringRefToUTF8(observed_type_cf)); | 135 observed_type.append(base::SysCFStringRefToUTF8(observed_type_cf)); |
| 136 } | 136 } |
| 137 LOG(ERROR) << "image-path: expected CFData, observed " << observed_type; | 137 LOG(ERROR) << "image-path: expected CFData, observed " << observed_type; |
| 138 return true; | 138 return true; |
| 139 } | 139 } |
| 140 | 140 |
| 141 CFDataRef image_path_data = static_cast<CFDataRef>( | 141 CFDataRef image_path_data = static_cast<CFDataRef>( |
| 142 image_path_cftyperef.get()); | 142 image_path_cftyperef.get()); |
| 143 CFIndex length = CFDataGetLength(image_path_data); | 143 CFIndex length = CFDataGetLength(image_path_data); |
| 144 if (length <= 0) { |
| 145 LOG(ERROR) << "image_path_data is unexpectedly empty"; |
| 146 return true; |
| 147 } |
| 144 char* image_path_c = WriteInto(image_path, length + 1); | 148 char* image_path_c = WriteInto(image_path, length + 1); |
| 145 CFDataGetBytes(image_path_data, | 149 CFDataGetBytes(image_path_data, |
| 146 CFRangeMake(0, length), | 150 CFRangeMake(0, length), |
| 147 reinterpret_cast<UInt8*>(image_path_c)); | 151 reinterpret_cast<UInt8*>(image_path_c)); |
| 148 } | 152 } |
| 149 | 153 |
| 150 return true; | 154 return true; |
| 151 } | 155 } |
| 152 | 156 |
| 153 // Returns true if |path| is located on a read-only filesystem of a disk | 157 // Returns true if |path| is located on a read-only filesystem of a disk |
| (...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 669 const UInt8* trash_path_u8 = reinterpret_cast<const UInt8*>( | 673 const UInt8* trash_path_u8 = reinterpret_cast<const UInt8*>( |
| 670 trash_path.value().c_str()); | 674 trash_path.value().c_str()); |
| 671 status = FNNotifyByPath(trash_path_u8, | 675 status = FNNotifyByPath(trash_path_u8, |
| 672 kFNDirectoryModifiedMessage, | 676 kFNDirectoryModifiedMessage, |
| 673 kNilOptions); | 677 kNilOptions); |
| 674 if (status != noErr) { | 678 if (status != noErr) { |
| 675 LOG(ERROR) << "FNNotifyByPath: " << status; | 679 LOG(ERROR) << "FNNotifyByPath: " << status; |
| 676 return; | 680 return; |
| 677 } | 681 } |
| 678 } | 682 } |
| OLD | NEW |