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

@ -316,12 +316,16 @@ bool OpenExternal(const base::string16& url, bool activate) {
return true;
}
bool OpenExternal(const base::string16& url, bool activate,
void OpenExternal(const base::string16& 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& path) {