Commit 7cfcd110 authored by Mark Pilgrim's avatar Mark Pilgrim Committed by Commit Bot

Migrate LoginAuthRequiredCallback to BindOnce

Bug: 714018
Change-Id: Icf71c24297709c96513db23e7f562dce298e6374
Reviewed-on: https://chromium-review.googlesource.com/1048070Reviewed-by: default avatarScott Violet <sky@chromium.org>
Commit-Queue: Mark Pilgrim <pilgrim@chromium.org>
Cr-Commit-Position: refs/heads/master@{#556617}
parent 9aa277ca
...@@ -696,11 +696,10 @@ AwContentBrowserClient::CreateLoginDelegate( ...@@ -696,11 +696,10 @@ AwContentBrowserClient::CreateLoginDelegate(
bool is_main_frame, bool is_main_frame,
const GURL& url, const GURL& url,
bool first_auth_attempt, bool first_auth_attempt,
const base::Callback<void(const base::Optional<net::AuthCredentials>&)>& LoginAuthRequiredCallback auth_required_callback) {
auth_required_callback) { return base::MakeRefCounted<AwLoginDelegate>(
return base::MakeRefCounted<AwLoginDelegate>(auth_info, web_contents_getter, auth_info, web_contents_getter, first_auth_attempt,
first_auth_attempt, std::move(auth_required_callback));
auth_required_callback);
} }
bool AwContentBrowserClient::HandleExternalProtocol( bool AwContentBrowserClient::HandleExternalProtocol(
......
...@@ -175,8 +175,7 @@ class AwContentBrowserClient : public content::ContentBrowserClient { ...@@ -175,8 +175,7 @@ class AwContentBrowserClient : public content::ContentBrowserClient {
bool is_main_frame, bool is_main_frame,
const GURL& url, const GURL& url,
bool first_auth_attempt, bool first_auth_attempt,
const base::Callback<void(const base::Optional<net::AuthCredentials>&)>& LoginAuthRequiredCallback auth_required_callback) override;
auth_required_callback) override;
bool HandleExternalProtocol( bool HandleExternalProtocol(
const GURL& url, const GURL& url,
content::ResourceRequestInfo::WebContentsGetter web_contents_getter, content::ResourceRequestInfo::WebContentsGetter web_contents_getter,
......
...@@ -24,9 +24,9 @@ AwLoginDelegate::AwLoginDelegate( ...@@ -24,9 +24,9 @@ AwLoginDelegate::AwLoginDelegate(
net::AuthChallengeInfo* auth_info, net::AuthChallengeInfo* auth_info,
content::ResourceRequestInfo::WebContentsGetter web_contents_getter, content::ResourceRequestInfo::WebContentsGetter web_contents_getter,
bool first_auth_attempt, bool first_auth_attempt,
const base::Callback<void(const base::Optional<net::AuthCredentials>&)>& LoginAuthRequiredCallback auth_required_callback)
auth_required_callback) : auth_info_(auth_info),
: auth_info_(auth_info), auth_required_callback_(auth_required_callback) { auth_required_callback_(std::move(auth_required_callback)) {
BrowserThread::PostTask( BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE, BrowserThread::UI, FROM_HERE,
base::BindOnce(&AwLoginDelegate::HandleHttpAuthRequestOnUIThread, this, base::BindOnce(&AwLoginDelegate::HandleHttpAuthRequestOnUIThread, this,
......
...@@ -12,12 +12,12 @@ ...@@ -12,12 +12,12 @@
#include "base/memory/ref_counted.h" #include "base/memory/ref_counted.h"
#include "base/optional.h" #include "base/optional.h"
#include "base/strings/string16.h" #include "base/strings/string16.h"
#include "content/public/browser/content_browser_client.h"
#include "content/public/browser/login_delegate.h" #include "content/public/browser/login_delegate.h"
#include "content/public/browser/resource_request_info.h" #include "content/public/browser/resource_request_info.h"
namespace net { namespace net {
class AuthChallengeInfo; class AuthChallengeInfo;
class AuthCredentials;
} }
namespace android_webview { namespace android_webview {
...@@ -28,8 +28,7 @@ class AwLoginDelegate : public content::LoginDelegate { ...@@ -28,8 +28,7 @@ class AwLoginDelegate : public content::LoginDelegate {
net::AuthChallengeInfo* auth_info, net::AuthChallengeInfo* auth_info,
content::ResourceRequestInfo::WebContentsGetter web_contents_getter, content::ResourceRequestInfo::WebContentsGetter web_contents_getter,
bool first_auth_attempt, bool first_auth_attempt,
const base::Callback<void(const base::Optional<net::AuthCredentials>&)>& LoginAuthRequiredCallback auth_required_callback);
auth_required_callback);
virtual void Proceed(const base::string16& user, virtual void Proceed(const base::string16& user,
const base::string16& password); const base::string16& password);
...@@ -51,8 +50,7 @@ class AwLoginDelegate : public content::LoginDelegate { ...@@ -51,8 +50,7 @@ class AwLoginDelegate : public content::LoginDelegate {
std::unique_ptr<AwHttpAuthHandler> aw_http_auth_handler_; std::unique_ptr<AwHttpAuthHandler> aw_http_auth_handler_;
scoped_refptr<net::AuthChallengeInfo> auth_info_; scoped_refptr<net::AuthChallengeInfo> auth_info_;
base::Callback<void(const base::Optional<net::AuthCredentials>&)> LoginAuthRequiredCallback auth_required_callback_;
auth_required_callback_;
}; };
} // namespace android_webview } // namespace android_webview
......
...@@ -4179,10 +4179,9 @@ ChromeContentBrowserClient::CreateLoginDelegate( ...@@ -4179,10 +4179,9 @@ ChromeContentBrowserClient::CreateLoginDelegate(
bool is_main_frame, bool is_main_frame,
const GURL& url, const GURL& url,
bool first_auth_attempt, bool first_auth_attempt,
const base::Callback<void(const base::Optional<net::AuthCredentials>&)>& LoginAuthRequiredCallback auth_required_callback) {
auth_required_callback) {
return CreateLoginPrompt(auth_info, web_contents_getter, is_main_frame, url, return CreateLoginPrompt(auth_info, web_contents_getter, is_main_frame, url,
auth_required_callback); std::move(auth_required_callback));
} }
bool ChromeContentBrowserClient::HandleExternalProtocol( bool ChromeContentBrowserClient::HandleExternalProtocol(
......
...@@ -426,8 +426,7 @@ class ChromeContentBrowserClient : public content::ContentBrowserClient { ...@@ -426,8 +426,7 @@ class ChromeContentBrowserClient : public content::ContentBrowserClient {
bool is_main_frame, bool is_main_frame,
const GURL& url, const GURL& url,
bool first_auth_attempt, bool first_auth_attempt,
const base::Callback<void(const base::Optional<net::AuthCredentials>&)>& LoginAuthRequiredCallback auth_required_callback) override;
auth_required_callback) override;
bool HandleExternalProtocol( bool HandleExternalProtocol(
const GURL& url, const GURL& url,
content::ResourceRequestInfo::WebContentsGetter web_contents_getter, content::ResourceRequestInfo::WebContentsGetter web_contents_getter,
......
...@@ -27,9 +27,10 @@ class LoginHandlerAndroid : public LoginHandler { ...@@ -27,9 +27,10 @@ class LoginHandlerAndroid : public LoginHandler {
LoginHandlerAndroid( LoginHandlerAndroid(
net::AuthChallengeInfo* auth_info, net::AuthChallengeInfo* auth_info,
content::ResourceRequestInfo::WebContentsGetter web_contents_getter, content::ResourceRequestInfo::WebContentsGetter web_contents_getter,
const base::Callback<void(const base::Optional<net::AuthCredentials>&)>& LoginAuthRequiredCallback auth_required_callback)
auth_required_callback) : LoginHandler(auth_info,
: LoginHandler(auth_info, web_contents_getter, auth_required_callback) {} web_contents_getter,
std::move(auth_required_callback)) {}
// LoginHandler methods: // LoginHandler methods:
...@@ -96,8 +97,7 @@ class LoginHandlerAndroid : public LoginHandler { ...@@ -96,8 +97,7 @@ class LoginHandlerAndroid : public LoginHandler {
scoped_refptr<LoginHandler> LoginHandler::Create( scoped_refptr<LoginHandler> LoginHandler::Create(
net::AuthChallengeInfo* auth_info, net::AuthChallengeInfo* auth_info,
content::ResourceRequestInfo::WebContentsGetter web_contents_getter, content::ResourceRequestInfo::WebContentsGetter web_contents_getter,
const base::Callback<void(const base::Optional<net::AuthCredentials>&)>& LoginAuthRequiredCallback auth_required_callback) {
auth_required_callback) {
return base::MakeRefCounted<LoginHandlerAndroid>( return base::MakeRefCounted<LoginHandlerAndroid>(
auth_info, web_contents_getter, auth_required_callback); auth_info, web_contents_getter, std::move(auth_required_callback));
} }
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include "base/strings/string16.h" #include "base/strings/string16.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "chrome/browser/ui/bookmarks/bookmark_editor.h" #include "chrome/browser/ui/bookmarks/bookmark_editor.h"
#include "content/public/browser/content_browser_client.h"
#include "content/public/browser/resource_request_info.h" #include "content/public/browser/resource_request_info.h"
#include "third_party/skia/include/core/SkColor.h" #include "third_party/skia/include/core/SkColor.h"
#include "ui/gfx/native_widget_types.h" #include "ui/gfx/native_widget_types.h"
...@@ -47,7 +48,6 @@ class Extension; ...@@ -47,7 +48,6 @@ class Extension;
namespace net { namespace net {
class AuthChallengeInfo; class AuthChallengeInfo;
class AuthCredentials;
} }
namespace payments { namespace payments {
...@@ -162,8 +162,7 @@ void ShowUpdateChromeDialogViews(gfx::NativeWindow parent); ...@@ -162,8 +162,7 @@ void ShowUpdateChromeDialogViews(gfx::NativeWindow parent);
scoped_refptr<LoginHandler> CreateLoginHandlerViews( scoped_refptr<LoginHandler> CreateLoginHandlerViews(
net::AuthChallengeInfo* auth_info, net::AuthChallengeInfo* auth_info,
content::ResourceRequestInfo::WebContentsGetter web_contents_getter, content::ResourceRequestInfo::WebContentsGetter web_contents_getter,
const base::Callback<void(const base::Optional<net::AuthCredentials>&)>& LoginAuthRequiredCallback auth_required_callback);
auth_required_callback);
// Shows the toolkit-views based BookmarkEditor. // Shows the toolkit-views based BookmarkEditor.
void ShowBookmarkEditorViews(gfx::NativeWindow parent_window, void ShowBookmarkEditorViews(gfx::NativeWindow parent_window,
......
...@@ -41,9 +41,10 @@ class LoginHandlerMac : public LoginHandler, ...@@ -41,9 +41,10 @@ class LoginHandlerMac : public LoginHandler,
LoginHandlerMac( LoginHandlerMac(
net::AuthChallengeInfo* auth_info, net::AuthChallengeInfo* auth_info,
content::ResourceRequestInfo::WebContentsGetter web_contents_getter, content::ResourceRequestInfo::WebContentsGetter web_contents_getter,
const base::Callback<void(const base::Optional<net::AuthCredentials>&)>& LoginAuthRequiredCallback auth_required_callback)
auth_required_callback) : LoginHandler(auth_info,
: LoginHandler(auth_info, web_contents_getter, auth_required_callback) {} web_contents_getter,
std::move(auth_required_callback)) {}
// LoginModelObserver implementation. // LoginModelObserver implementation.
void OnAutofillDataAvailableInternal( void OnAutofillDataAvailableInternal(
...@@ -139,14 +140,13 @@ class LoginHandlerMac : public LoginHandler, ...@@ -139,14 +140,13 @@ class LoginHandlerMac : public LoginHandler,
scoped_refptr<LoginHandler> LoginHandler::Create( scoped_refptr<LoginHandler> LoginHandler::Create(
net::AuthChallengeInfo* auth_info, net::AuthChallengeInfo* auth_info,
content::ResourceRequestInfo::WebContentsGetter web_contents_getter, content::ResourceRequestInfo::WebContentsGetter web_contents_getter,
const base::Callback<void(const base::Optional<net::AuthCredentials>&)>& LoginAuthRequiredCallback auth_required_callback) {
auth_required_callback) {
if (chrome::ShowPilotDialogsWithViewsToolkit()) { if (chrome::ShowPilotDialogsWithViewsToolkit()) {
return chrome::CreateLoginHandlerViews(auth_info, web_contents_getter, return chrome::CreateLoginHandlerViews(auth_info, web_contents_getter,
auth_required_callback); std::move(auth_required_callback));
} }
return base::MakeRefCounted<LoginHandlerMac>(auth_info, web_contents_getter, return base::MakeRefCounted<LoginHandlerMac>(
auth_required_callback); auth_info, web_contents_getter, std::move(auth_required_callback));
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
......
...@@ -93,14 +93,13 @@ LoginHandler::LoginModelData::LoginModelData( ...@@ -93,14 +93,13 @@ LoginHandler::LoginModelData::LoginModelData(
LoginHandler::LoginHandler( LoginHandler::LoginHandler(
net::AuthChallengeInfo* auth_info, net::AuthChallengeInfo* auth_info,
content::ResourceRequestInfo::WebContentsGetter web_contents_getter, content::ResourceRequestInfo::WebContentsGetter web_contents_getter,
const base::Callback<void(const base::Optional<net::AuthCredentials>&)>& LoginAuthRequiredCallback auth_required_callback)
auth_required_callback)
: handled_auth_(false), : handled_auth_(false),
auth_info_(auth_info), auth_info_(auth_info),
password_manager_(NULL), password_manager_(NULL),
web_contents_getter_(web_contents_getter), web_contents_getter_(web_contents_getter),
login_model_(NULL), login_model_(NULL),
auth_required_callback_(auth_required_callback), auth_required_callback_(std::move(auth_required_callback)),
has_shown_login_handler_(false), has_shown_login_handler_(false),
release_soon_has_been_called_(false) { release_soon_has_been_called_(false) {
// This constructor is called on the I/O thread, so we cannot load the nib // This constructor is called on the I/O thread, so we cannot load the nib
...@@ -677,10 +676,9 @@ scoped_refptr<LoginHandler> CreateLoginPrompt( ...@@ -677,10 +676,9 @@ scoped_refptr<LoginHandler> CreateLoginPrompt(
content::ResourceRequestInfo::WebContentsGetter web_contents_getter, content::ResourceRequestInfo::WebContentsGetter web_contents_getter,
bool is_main_frame, bool is_main_frame,
const GURL& url, const GURL& url,
const base::Callback<void(const base::Optional<net::AuthCredentials>&)>& LoginAuthRequiredCallback auth_required_callback) {
auth_required_callback) {
scoped_refptr<LoginHandler> handler = LoginHandler::Create( scoped_refptr<LoginHandler> handler = LoginHandler::Create(
auth_info, web_contents_getter, auth_required_callback); auth_info, web_contents_getter, std::move(auth_required_callback));
BrowserThread::PostTask( BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE, BrowserThread::UI, FROM_HERE,
base::BindOnce(&LoginHandler::LoginDialogCallback, url, base::BindOnce(&LoginHandler::LoginDialogCallback, url,
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include "base/optional.h" #include "base/optional.h"
#include "base/synchronization/lock.h" #include "base/synchronization/lock.h"
#include "components/password_manager/core/browser/password_manager.h" #include "components/password_manager/core/browser/password_manager.h"
#include "content/public/browser/content_browser_client.h"
#include "content/public/browser/login_delegate.h" #include "content/public/browser/login_delegate.h"
#include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_observer.h"
#include "content/public/browser/resource_request_info.h" #include "content/public/browser/resource_request_info.h"
...@@ -31,7 +32,6 @@ class WebContents; ...@@ -31,7 +32,6 @@ class WebContents;
namespace net { namespace net {
class AuthChallengeInfo; class AuthChallengeInfo;
class AuthCredentials;
} // namespace net } // namespace net
// This is the base implementation for the OS-specific classes that route // This is the base implementation for the OS-specific classes that route
...@@ -59,16 +59,14 @@ class LoginHandler : public content::LoginDelegate, ...@@ -59,16 +59,14 @@ class LoginHandler : public content::LoginDelegate,
LoginHandler( LoginHandler(
net::AuthChallengeInfo* auth_info, net::AuthChallengeInfo* auth_info,
content::ResourceRequestInfo::WebContentsGetter web_contents_getter, content::ResourceRequestInfo::WebContentsGetter web_contents_getter,
const base::Callback<void(const base::Optional<net::AuthCredentials>&)>& LoginAuthRequiredCallback auth_required_callback);
auth_required_callback);
// Builds the platform specific LoginHandler. Used from within // Builds the platform specific LoginHandler. Used from within
// CreateLoginPrompt() which creates tasks. // CreateLoginPrompt() which creates tasks.
static scoped_refptr<LoginHandler> Create( static scoped_refptr<LoginHandler> Create(
net::AuthChallengeInfo* auth_info, net::AuthChallengeInfo* auth_info,
content::ResourceRequestInfo::WebContentsGetter web_contents_getter, content::ResourceRequestInfo::WebContentsGetter web_contents_getter,
const base::Callback<void(const base::Optional<net::AuthCredentials>&)>& LoginAuthRequiredCallback auth_required_callback);
auth_required_callback);
void SetInterstitialDelegate( void SetInterstitialDelegate(
const base::WeakPtr<LoginInterstitialDelegate> delegate) { const base::WeakPtr<LoginInterstitialDelegate> delegate) {
...@@ -150,8 +148,7 @@ class LoginHandler : public content::LoginDelegate, ...@@ -150,8 +148,7 @@ class LoginHandler : public content::LoginDelegate,
content::ResourceRequestInfo::WebContentsGetter web_contents_getter, content::ResourceRequestInfo::WebContentsGetter web_contents_getter,
bool is_main_frame, bool is_main_frame,
const GURL& url, const GURL& url,
const base::Callback<void(const base::Optional<net::AuthCredentials>&)>& LoginAuthRequiredCallback auth_required_callback);
auth_required_callback);
FRIEND_TEST_ALL_PREFIXES(LoginHandlerTest, DialogStringsAndRealm); FRIEND_TEST_ALL_PREFIXES(LoginHandlerTest, DialogStringsAndRealm);
// Starts observing notifications from other LoginHandlers. // Starts observing notifications from other LoginHandlers.
...@@ -251,8 +248,7 @@ class LoginHandler : public content::LoginDelegate, ...@@ -251,8 +248,7 @@ class LoginHandler : public content::LoginDelegate,
// This is only accessed on the UI thread. // This is only accessed on the UI thread.
std::unique_ptr<content::NotificationRegistrar> registrar_; std::unique_ptr<content::NotificationRegistrar> registrar_;
base::Callback<void(const base::Optional<net::AuthCredentials>&)> LoginAuthRequiredCallback auth_required_callback_;
auth_required_callback_;
base::WeakPtr<LoginInterstitialDelegate> interstitial_delegate_; base::WeakPtr<LoginInterstitialDelegate> interstitial_delegate_;
...@@ -322,7 +318,6 @@ scoped_refptr<LoginHandler> CreateLoginPrompt( ...@@ -322,7 +318,6 @@ scoped_refptr<LoginHandler> CreateLoginPrompt(
content::ResourceRequestInfo::WebContentsGetter web_contents_getter, content::ResourceRequestInfo::WebContentsGetter web_contents_getter,
bool is_main_frame, bool is_main_frame,
const GURL& url, const GURL& url,
const base::Callback<void(const base::Optional<net::AuthCredentials>&)>& LoginAuthRequiredCallback auth_required_callback);
auth_required_callback);
#endif // CHROME_BROWSER_UI_LOGIN_LOGIN_HANDLER_H_ #endif // CHROME_BROWSER_UI_LOGIN_LOGIN_HANDLER_H_
...@@ -29,10 +29,9 @@ ...@@ -29,10 +29,9 @@
scoped_refptr<LoginHandler> LoginHandler::Create( scoped_refptr<LoginHandler> LoginHandler::Create(
net::AuthChallengeInfo* auth_info, net::AuthChallengeInfo* auth_info,
content::ResourceRequestInfo::WebContentsGetter web_contents_getter, content::ResourceRequestInfo::WebContentsGetter web_contents_getter,
const base::Callback<void(const base::Optional<net::AuthCredentials>&)>& LoginAuthRequiredCallback auth_required_callback) {
auth_required_callback) {
return chrome::CreateLoginHandlerViews(auth_info, web_contents_getter, return chrome::CreateLoginHandlerViews(auth_info, web_contents_getter,
auth_required_callback); std::move(auth_required_callback));
} }
// static // static
......
...@@ -32,9 +32,10 @@ class LoginHandlerViews : public LoginHandler, public views::DialogDelegate { ...@@ -32,9 +32,10 @@ class LoginHandlerViews : public LoginHandler, public views::DialogDelegate {
LoginHandlerViews( LoginHandlerViews(
net::AuthChallengeInfo* auth_info, net::AuthChallengeInfo* auth_info,
content::ResourceRequestInfo::WebContentsGetter web_contents_getter, content::ResourceRequestInfo::WebContentsGetter web_contents_getter,
const base::Callback<void(const base::Optional<net::AuthCredentials>&)>& LoginAuthRequiredCallback auth_required_callback)
auth_required_callback) : LoginHandler(auth_info,
: LoginHandler(auth_info, web_contents_getter, auth_required_callback), web_contents_getter,
std::move(auth_required_callback)),
login_view_(nullptr), login_view_(nullptr),
dialog_(nullptr) { dialog_(nullptr) {
chrome::RecordDialogCreation(chrome::DialogIdentifier::LOGIN_HANDLER); chrome::RecordDialogCreation(chrome::DialogIdentifier::LOGIN_HANDLER);
...@@ -163,10 +164,9 @@ namespace chrome { ...@@ -163,10 +164,9 @@ namespace chrome {
scoped_refptr<LoginHandler> CreateLoginHandlerViews( scoped_refptr<LoginHandler> CreateLoginHandlerViews(
net::AuthChallengeInfo* auth_info, net::AuthChallengeInfo* auth_info,
content::ResourceRequestInfo::WebContentsGetter web_contents_getter, content::ResourceRequestInfo::WebContentsGetter web_contents_getter,
const base::Callback<void(const base::Optional<net::AuthCredentials>&)>& LoginAuthRequiredCallback auth_required_callback) {
auth_required_callback) { return base::MakeRefCounted<LoginHandlerViews>(
return base::MakeRefCounted<LoginHandlerViews>(auth_info, web_contents_getter, auth_info, web_contents_getter, std::move(auth_required_callback));
auth_required_callback);
} }
} // namespace chrome } // namespace chrome
...@@ -555,8 +555,8 @@ scoped_refptr<LoginDelegate> ResourceDispatcherHostImpl::CreateLoginDelegate( ...@@ -555,8 +555,8 @@ scoped_refptr<LoginDelegate> ResourceDispatcherHostImpl::CreateLoginDelegate(
GetContentClient()->browser()->CreateLoginDelegate( GetContentClient()->browser()->CreateLoginDelegate(
auth_info, resource_request_info->GetWebContentsGetterForRequest(), auth_info, resource_request_info->GetWebContentsGetterForRequest(),
is_main_frame, url, resource_request_info->first_auth_attempt(), is_main_frame, url, resource_request_info->first_auth_attempt(),
base::Bind(&ResourceDispatcherHostImpl::RunAuthRequiredCallback, base::BindOnce(&ResourceDispatcherHostImpl::RunAuthRequiredCallback,
base::Unretained(this), request_id)); base::Unretained(this), request_id));
resource_request_info->set_first_auth_attempt(false); resource_request_info->set_first_auth_attempt(false);
......
...@@ -228,8 +228,8 @@ class LoginHandlerDelegate { ...@@ -228,8 +228,8 @@ class LoginHandlerDelegate {
login_delegate_ = GetContentClient()->browser()->CreateLoginDelegate( login_delegate_ = GetContentClient()->browser()->CreateLoginDelegate(
auth_info_.get(), web_contents_getter_, is_main_frame_, url_, auth_info_.get(), web_contents_getter_, is_main_frame_, url_,
first_auth_attempt_, first_auth_attempt_,
base::Bind(&LoginHandlerDelegate::RunAuthCredentials, base::BindOnce(&LoginHandlerDelegate::RunAuthCredentials,
base::Unretained(this))); base::Unretained(this)));
if (!login_delegate_) { if (!login_delegate_) {
RunAuthCredentials(base::nullopt); RunAuthCredentials(base::nullopt);
......
...@@ -703,8 +703,7 @@ scoped_refptr<LoginDelegate> ContentBrowserClient::CreateLoginDelegate( ...@@ -703,8 +703,7 @@ scoped_refptr<LoginDelegate> ContentBrowserClient::CreateLoginDelegate(
bool is_main_frame, bool is_main_frame,
const GURL& url, const GURL& url,
bool first_auth_attempt, bool first_auth_attempt,
const base::Callback<void(const base::Optional<net::AuthCredentials>&)>& LoginAuthRequiredCallback auth_required_callback) {
auth_required_callback) {
return nullptr; return nullptr;
} }
......
...@@ -55,6 +55,8 @@ ...@@ -55,6 +55,8 @@
#endif #endif
class GURL; class GURL;
using LoginAuthRequiredCallback =
base::OnceCallback<void(const base::Optional<net::AuthCredentials>&)>;
namespace base { namespace base {
class CommandLine; class CommandLine;
...@@ -1151,8 +1153,7 @@ class CONTENT_EXPORT ContentBrowserClient { ...@@ -1151,8 +1153,7 @@ class CONTENT_EXPORT ContentBrowserClient {
bool is_main_frame, bool is_main_frame,
const GURL& url, const GURL& url,
bool first_auth_attempt, bool first_auth_attempt,
const base::Callback<void(const base::Optional<net::AuthCredentials>&)>& LoginAuthRequiredCallback auth_required_callback);
auth_required_callback);
// Launches the url for the given tab. Returns true if an attempt to handle // Launches the url for the given tab. Returns true if an attempt to handle
// the url was made, e.g. by launching an app. Note that this does not // the url was made, e.g. by launching an app. Note that this does not
......
...@@ -248,8 +248,7 @@ LayoutTestContentBrowserClient::CreateLoginDelegate( ...@@ -248,8 +248,7 @@ LayoutTestContentBrowserClient::CreateLoginDelegate(
bool is_main_frame, bool is_main_frame,
const GURL& url, const GURL& url,
bool first_auth_attempt, bool first_auth_attempt,
const base::Callback<void(const base::Optional<net::AuthCredentials>&)>& LoginAuthRequiredCallback auth_required_callback) {
auth_required_callback) {
return nullptr; return nullptr;
} }
......
...@@ -78,8 +78,7 @@ class LayoutTestContentBrowserClient : public ShellContentBrowserClient { ...@@ -78,8 +78,7 @@ class LayoutTestContentBrowserClient : public ShellContentBrowserClient {
bool is_main_frame, bool is_main_frame,
const GURL& url, const GURL& url,
bool first_auth_attempt, bool first_auth_attempt,
const base::Callback<void(const base::Optional<net::AuthCredentials>&)>& LoginAuthRequiredCallback auth_required_callback) override;
auth_required_callback) override;
private: private:
// Creates and stores a FakeBluetoothChooser instance. // Creates and stores a FakeBluetoothChooser instance.
......
...@@ -355,8 +355,7 @@ scoped_refptr<LoginDelegate> ShellContentBrowserClient::CreateLoginDelegate( ...@@ -355,8 +355,7 @@ scoped_refptr<LoginDelegate> ShellContentBrowserClient::CreateLoginDelegate(
bool is_main_frame, bool is_main_frame,
const GURL& url, const GURL& url,
bool first_auth_attempt, bool first_auth_attempt,
const base::Callback<void(const base::Optional<net::AuthCredentials>&)>& LoginAuthRequiredCallback auth_required_callback) {
auth_required_callback) {
if (!login_request_callback_.is_null()) { if (!login_request_callback_.is_null()) {
std::move(login_request_callback_).Run(); std::move(login_request_callback_).Run();
return nullptr; return nullptr;
...@@ -366,8 +365,8 @@ scoped_refptr<LoginDelegate> ShellContentBrowserClient::CreateLoginDelegate( ...@@ -366,8 +365,8 @@ scoped_refptr<LoginDelegate> ShellContentBrowserClient::CreateLoginDelegate(
// TODO: implement ShellLoginDialog for other platforms, drop this #if // TODO: implement ShellLoginDialog for other platforms, drop this #if
return nullptr; return nullptr;
#else #else
return base::MakeRefCounted<ShellLoginDialog>(auth_info, return base::MakeRefCounted<ShellLoginDialog>(
auth_required_callback); auth_info, std::move(auth_required_callback));
#endif #endif
} }
......
...@@ -75,8 +75,7 @@ class ShellContentBrowserClient : public ContentBrowserClient { ...@@ -75,8 +75,7 @@ class ShellContentBrowserClient : public ContentBrowserClient {
bool is_main_frame, bool is_main_frame,
const GURL& url, const GURL& url,
bool first_auth_attempt, bool first_auth_attempt,
const base::Callback<void(const base::Optional<net::AuthCredentials>&)>& LoginAuthRequiredCallback auth_required_callback) override;
auth_required_callback) override;
#if defined(OS_LINUX) || defined(OS_ANDROID) #if defined(OS_LINUX) || defined(OS_ANDROID)
void GetAdditionalMappedFilesForChildProcess( void GetAdditionalMappedFilesForChildProcess(
......
...@@ -17,9 +17,8 @@ namespace content { ...@@ -17,9 +17,8 @@ namespace content {
ShellLoginDialog::ShellLoginDialog( ShellLoginDialog::ShellLoginDialog(
net::AuthChallengeInfo* auth_info, net::AuthChallengeInfo* auth_info,
base::Callback<void(const base::Optional<net::AuthCredentials>&)> LoginAuthRequiredCallback auth_required_callback)
auth_required_callback) : auth_required_callback_(std::move(auth_required_callback)) {
: auth_required_callback_(auth_required_callback) {
DCHECK_CURRENTLY_ON(BrowserThread::IO); DCHECK_CURRENTLY_ON(BrowserThread::IO);
BrowserThread::PostTask( BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE, BrowserThread::UI, FROM_HERE,
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include "base/optional.h" #include "base/optional.h"
#include "base/strings/string16.h" #include "base/strings/string16.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "content/public/browser/content_browser_client.h"
#include "content/public/browser/login_delegate.h" #include "content/public/browser/login_delegate.h"
#if defined(OS_MACOSX) #if defined(OS_MACOSX)
...@@ -22,7 +23,6 @@ class ShellLoginDialogHelper; ...@@ -22,7 +23,6 @@ class ShellLoginDialogHelper;
namespace net { namespace net {
class AuthChallengeInfo; class AuthChallengeInfo;
class AuthCredentials;
} }
namespace content { namespace content {
...@@ -34,7 +34,7 @@ class ShellLoginDialog : public LoginDelegate { ...@@ -34,7 +34,7 @@ class ShellLoginDialog : public LoginDelegate {
// Threading: IO thread. // Threading: IO thread.
ShellLoginDialog( ShellLoginDialog(
net::AuthChallengeInfo* auth_info, net::AuthChallengeInfo* auth_info,
base::Callback<void(const base::Optional<net::AuthCredentials>&)> base::OnceCallback<void(const base::Optional<net::AuthCredentials>&)>
auth_required_callback); auth_required_callback);
// LoginDelegate implementation: // LoginDelegate implementation:
...@@ -76,8 +76,7 @@ class ShellLoginDialog : public LoginDelegate { ...@@ -76,8 +76,7 @@ class ShellLoginDialog : public LoginDelegate {
const base::string16& username, const base::string16& username,
const base::string16& password); const base::string16& password);
base::Callback<void(const base::Optional<net::AuthCredentials>&)> LoginAuthRequiredCallback auth_required_callback_;
auth_required_callback_;
#if defined(OS_MACOSX) #if defined(OS_MACOSX)
// Threading: UI thread. // Threading: UI thread.
......
Markdown is supported
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