Chromium Code Reviews| 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..3df72fdb27a5b11640ecc37dcac55f9ebd1f2b70 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,13 @@ 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)]; |
| + if (![[NSFileManager defaultManager] trashItemAtURL:disk_image_path_nsurl |
| + resultingItemURL:nil |
| + error:nil]) { |
|
tapted
2016/10/07 04:33:15
We're probably not interested in resultingItemURL,
Patti Lor
2016/10/07 05:51:25
Done.
|
| + LOG(ERROR) << "NSFileManager trashItemAtURL::"; |
| 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; |
| - } |
| } |