refactor: make shell.OpenExternal async (#17135)

This commit is contained in:
Shelley Vohr 2019-05-03 13:53:45 -07:00 committed by GitHub
parent 0755857a0c
commit 6d96f30ed3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 70 additions and 140 deletions

View file

@ -81,20 +81,16 @@ bool OpenItem(const base::FilePath& full_path) {
return XDGOpen(full_path.value(), false);
}
bool OpenExternal(const GURL& url, const OpenExternalOptions& options) {
// Don't wait for exit, since we don't want to wait for the browser/email
// client window to close before returning
if (url.SchemeIs("mailto"))
return XDGEmail(url.spec(), false);
else
return XDGOpen(url.spec(), false);
}
void OpenExternal(const GURL& url,
const OpenExternalOptions& options,
OpenExternalCallback callback) {
// TODO(gabriel): Implement async open if callback is specified
std::move(callback).Run(OpenExternal(url, options) ? "" : "Failed to open");
// Don't wait for exit, since we don't want to wait for the browser/email
// client window to close before returning
if (url.SchemeIs("mailto"))
std::move(callback).Run(XDGEmail(url.spec(), false) ? ""
: "Failed to open");
else
std::move(callback).Run(XDGOpen(url.spec(), false) ? "" : "Failed to open");
}
bool MoveItemToTrash(const base::FilePath& full_path) {