Callback uses (platform specific) error, with message

This commit is contained in:
Gabriel Handford 2016-11-02 16:20:26 -07:00 committed by Cheng Zhao
parent 5e8059e0fa
commit 99a5258999
5 changed files with 83 additions and 35 deletions

View file

@ -89,12 +89,16 @@ bool OpenExternal(const GURL& url, bool activate) {
return XDGOpen(url.spec(), false);
}
bool OpenExternal(const GURL& url, bool activate,
void OpenExternal(const GURL& url, bool activate,
const OpenExternalCallback& callback) {
// TODO(gabriel): Implement async open if callback is specified
bool opened = OpenExternal(url, activate);
callback.Run(opened);
return opened;
if (!opened) {
callback.Run(v8::Exception::Error(
v8::String::NewFromUtf8(isolate, @"Failed to open")));
} else {
callback.Run(v8::Null(isolate);)
}
}
bool MoveItemToTrash(const base::FilePath& full_path) {