From d141d2445da4a36c5bdec7bb32cf9fd6cbc2e20c Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Mon, 12 Mar 2018 17:27:43 +0900 Subject: [PATCH] Fix build error caused by base::Passed changes --- atom/browser/atom_javascript_dialog_manager.cc | 12 +++++++----- atom/browser/atom_javascript_dialog_manager.h | 2 +- atom/browser/web_contents_preferences.cc | 1 + 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/atom/browser/atom_javascript_dialog_manager.cc b/atom/browser/atom_javascript_dialog_manager.cc index d84c6af591..8e80e58a94 100644 --- a/atom/browser/atom_javascript_dialog_manager.cc +++ b/atom/browser/atom_javascript_dialog_manager.cc @@ -37,9 +37,9 @@ void AtomJavaScriptDialogManager::RunJavaScriptDialog( const base::string16& default_prompt_text, DialogClosedCallback callback, bool* did_suppress_message) { - const std::string origin = origin_url.GetOrigin().spec(); + const std::string& origin = origin_url.GetOrigin().spec(); if (origin_counts_[origin] == kUserWantsNoMoreDialogs) { - return callback.Run(false, base::string16()); + return std::move(callback).Run(false, base::string16()); } if (dialog_type != JavaScriptDialogType::JAVASCRIPT_DIALOG_TYPE_ALERT && @@ -73,7 +73,9 @@ void AtomJavaScriptDialogManager::RunJavaScriptDialog( base::UTF16ToUTF8(message_text), "", checkbox_string, false, gfx::ImageSkia(), base::Bind(&AtomJavaScriptDialogManager::OnMessageBoxCallback, - base::Unretained(this), callback, origin)); + base::Unretained(this), + base::Passed(std::move(callback)), + origin)); } void AtomJavaScriptDialogManager::RunBeforeUnloadDialog( @@ -91,13 +93,13 @@ void AtomJavaScriptDialogManager::CancelDialogs( } void AtomJavaScriptDialogManager::OnMessageBoxCallback( - const DialogClosedCallback& callback, + DialogClosedCallback callback, const std::string& origin, int code, bool checkbox_checked) { if (checkbox_checked) origin_counts_[origin] = kUserWantsNoMoreDialogs; - callback.Run(code == 0, base::string16()); + std::move(callback).Run(code == 0, base::string16()); } } // namespace atom diff --git a/atom/browser/atom_javascript_dialog_manager.h b/atom/browser/atom_javascript_dialog_manager.h index dffedd91e6..bbfd94479d 100644 --- a/atom/browser/atom_javascript_dialog_manager.h +++ b/atom/browser/atom_javascript_dialog_manager.h @@ -37,7 +37,7 @@ class AtomJavaScriptDialogManager : public content::JavaScriptDialogManager { bool reset_state) override; private: - void OnMessageBoxCallback(const DialogClosedCallback& callback, + void OnMessageBoxCallback(DialogClosedCallback callback, const std::string& origin, int code, bool checkbox_checked); diff --git a/atom/browser/web_contents_preferences.cc b/atom/browser/web_contents_preferences.cc index bc8b0f27bd..6b912469f8 100644 --- a/atom/browser/web_contents_preferences.cc +++ b/atom/browser/web_contents_preferences.cc @@ -16,6 +16,7 @@ #include "base/memory/ptr_util.h" #include "base/strings/string_number_conversions.h" #include "cc/base/switches.h" +#include "content/public/browser/render_frame_host.h" #include "content/public/browser/render_process_host.h" #include "content/public/common/content_switches.h" #include "content/public/common/web_preferences.h"