Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(360)

Unified Diff: chrome/browser/mac/install_from_dmg.mm

Issue 2393793002: Mac: Port deprecated methods to 10.8+ alternatives in install_from_dmg.mm. (Closed)
Patch Set: Delete incorrect & unneeded sys_string_conversations_mac.mm import. Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/mac/sdk_forward_declarations.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
- }
}
« no previous file with comments | « base/mac/sdk_forward_declarations.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698