From 0291dc8214e8c143f9edcbd063eeaa903e4b66e0 Mon Sep 17 00:00:00 2001 From: Samuel Attard Date: Mon, 18 Dec 2017 12:31:00 +1100 Subject: [PATCH] Calling non-const callbacks requires some tricks --- atom/browser/atom_javascript_dialog_manager.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/atom/browser/atom_javascript_dialog_manager.cc b/atom/browser/atom_javascript_dialog_manager.cc index 4b22c81fe1f7..7532da279537 100644 --- a/atom/browser/atom_javascript_dialog_manager.cc +++ b/atom/browser/atom_javascript_dialog_manager.cc @@ -44,7 +44,7 @@ void AtomJavaScriptDialogManager::RunJavaScriptDialog( if (dialog_type != JavaScriptDialogType::JAVASCRIPT_DIALOG_TYPE_ALERT && dialog_type != JavaScriptDialogType::JAVASCRIPT_DIALOG_TYPE_CONFIRM) { - callback.Run(false, base::string16()); + std::move(callback).Run(false, base::string16()); return; } @@ -81,7 +81,7 @@ void AtomJavaScriptDialogManager::RunBeforeUnloadDialog( bool is_reload, DialogClosedCallback callback) { bool default_prevented = api_web_contents_->Emit("will-prevent-unload"); - callback.Run(default_prevented, base::string16()); + std::move(callback).Run(default_prevented, base::string16()); return; } @@ -95,9 +95,13 @@ void AtomJavaScriptDialogManager::OnMessageBoxCallback( const std::string& origin, int code, bool checkbox_checked) { +<<<<<<< HEAD if (checkbox_checked) origin_counts_[origin] = kUserWantsNoMoreDialogs; callback.Run(code == 0, base::string16()); +======= + std::move(callback).Run(code == 0, base::string16()); +>>>>>>> Calling non-const callbacks requires some tricks } } // namespace atom