Skip to content
Snippets Groups Projects
Unverified Commit c081f6e4 authored by alice's avatar alice
Browse files

refactor: update to explicit task runner

parent 0eaeedab
No related merge requests found
......@@ -19,7 +19,7 @@
#include "base/logging.h"
#include "base/mac/scoped_aedesc.h"
#include "base/strings/sys_string_conversions.h"
#include "base/task/bind_post_task.h"
#include "base/task/sequenced_task_runner.h"
#include "base/task/thread_pool.h"
#include "content/public/browser/browser_task_traits.h"
#include "electron/mas.h"
......@@ -152,19 +152,23 @@ void OpenExternal(const GURL& url,
[NSWorkspaceOpenConfiguration configuration];
configuration.activates = options.activate;
__block OpenCallback copied_callback =
base::BindPostTaskToCurrentDefault(std::move(callback));
[[NSWorkspace sharedWorkspace] openURL:ns_url
configuration:configuration
completionHandler:^(NSRunningApplication* _Nullable app,
NSError* _Nullable error) {
if (error) {
std::move(copied_callback).Run("Failed to open URL");
} else {
std::move(copied_callback).Run("");
}
}];
__block OpenCallback copied_callback = std::move(callback);
scoped_refptr<base::SequencedTaskRunner> runner =
base::SequencedTaskRunner::GetCurrentDefault();
[[NSWorkspace sharedWorkspace]
openURL:ns_url
configuration:configuration
completionHandler:^(NSRunningApplication* _Nullable app,
NSError* _Nullable error) {
if (error) {
runner->PostTask(FROM_HERE, base::BindOnce(std::move(copied_callback),
"Failed to open URL"));
} else {
runner->PostTask(FROM_HERE,
base::BindOnce(std::move(copied_callback), ""));
}
}];
}
bool MoveItemToTrashWithError(const base::FilePath& full_path,
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment