| Index: chrome/browser/mac/install_from_dmg.mm
|
| diff --git a/chrome/browser/mac/install_from_dmg.mm b/chrome/browser/mac/install_from_dmg.mm
|
| index 8b936ed1213d9d2d7e1c43a44d55ea91b84dfc59..53448fa18737273bffcdfdaacf2a7d53f9690c05 100644
|
| --- a/chrome/browser/mac/install_from_dmg.mm
|
| +++ b/chrome/browser/mac/install_from_dmg.mm
|
| @@ -30,6 +30,7 @@
|
| #include "base/mac/scoped_cftyperef.h"
|
| #include "base/mac/scoped_ioobject.h"
|
| #include "base/mac/scoped_nsautorelease_pool.h"
|
| +#include "base/mac/sdk_forward_declarations.h"
|
| #include "base/macros.h"
|
| #include "base/strings/string_util.h"
|
| #include "base/strings/stringprintf.h"
|
| @@ -679,30 +680,14 @@ void EjectAndTrashDiskImage(const std::string& dmg_bsd_device_name) {
|
| return;
|
| }
|
|
|
| - char* disk_image_path_in_trash_c;
|
| - OSStatus status = FSPathMoveObjectToTrashSync(disk_image_path.c_str(),
|
| - &disk_image_path_in_trash_c,
|
| - kFSFileOperationDefaultOptions);
|
| - if (status != noErr) {
|
| - OSSTATUS_LOG(ERROR, status) << "FSPathMoveObjectToTrashSync";
|
| + NSURL* disk_image_path_nsurl =
|
| + [NSURL fileURLWithPath:base::SysUTF8ToNSString(disk_image_path)];
|
| + NSError* ns_error = nil;
|
| + if (![[NSFileManager defaultManager] trashItemAtURL:disk_image_path_nsurl
|
| + resultingItemURL:nil
|
| + error:&ns_error]) {
|
| + LOG(ERROR) << base::SysNSStringToUTF8([ns_error localizedDescription]);
|
| return;
|
| }
|
|
|
| - // FSPathMoveObjectToTrashSync alone doesn't result in the Trash icon in the
|
| - // Dock indicating that any garbage has been placed within it. Using the
|
| - // trash path that FSPathMoveObjectToTrashSync claims to have used, call
|
| - // FNNotifyByPath to fatten up the icon.
|
| - base::FilePath disk_image_path_in_trash(disk_image_path_in_trash_c);
|
| - free(disk_image_path_in_trash_c);
|
| -
|
| - base::FilePath trash_path = disk_image_path_in_trash.DirName();
|
| - const UInt8* trash_path_u8 = reinterpret_cast<const UInt8*>(
|
| - trash_path.value().c_str());
|
| - status = FNNotifyByPath(trash_path_u8,
|
| - kFNDirectoryModifiedMessage,
|
| - kNilOptions);
|
| - if (status != noErr) {
|
| - OSSTATUS_LOG(ERROR, status) << "FNNotifyByPath";
|
| - return;
|
| - }
|
| }
|
|
|