feat: add shell.trashItem() to replace shell.moveItemToTrash() (#25114)

This commit is contained in:
Jeremy Rose 2020-09-02 10:32:33 -07:00 committed by GitHub
parent e9e7eee25e
commit 1b6534b326
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 212 additions and 21 deletions

View file

@ -19,6 +19,7 @@
#include "dbus/bus.h"
#include "dbus/message.h"
#include "dbus/object_proxy.h"
#include "shell/common/platform_util_internal.h"
#include "ui/gtk/gtk_util.h"
#include "url/gurl.h"
@ -220,6 +221,19 @@ bool MoveItemToTrash(const base::FilePath& full_path, bool delete_on_fail) {
return XDGUtil(argv, base::FilePath(), true, platform_util::OpenCallback());
}
namespace internal {
bool PlatformTrashItem(const base::FilePath& full_path, std::string* error) {
if (!MoveItemToTrash(full_path, false)) {
// TODO(nornagon): at least include the exit code?
*error = "Failed to move item to trash";
return false;
}
return true;
}
} // namespace internal
void Beep() {
// echo '\a' > /dev/console
FILE* fp = fopen("/dev/console", "a");