Shell openExternal can take optional callback (macOS)

This commit is contained in:
Gabriel Handford 2016-10-13 13:28:11 -07:00 committed by Cheng Zhao
parent 1b5b29901c
commit b266533dfc
6 changed files with 85 additions and 10 deletions

View file

@ -79,7 +79,7 @@ bool OpenItem(const base::FilePath& full_path) {
return XDGOpen(full_path.value(), true);
}
bool OpenExternal(const GURL& url, bool activate) {
bool openExternal(const GURL& url, bool activate) {
// 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"))
@ -88,6 +88,17 @@ bool OpenExternal(const GURL& url, bool activate) {
return XDGOpen(url.spec(), false);
}
bool OpenExternal(const GURL& url, bool activate) {
return openExternal(url, activate);
}
bool OpenExternal(const GURL& url, bool activate, const OpenExternalCallback& callback) {
// TODO: Implement async open if callback is specified
bool opened = openExternal(url, activate);
callback(opened);
return opened;
}
bool MoveItemToTrash(const base::FilePath& full_path) {
std::string trash;
if (getenv(ELECTRON_TRASH) != NULL) {