Skip to content

Commit

Permalink
Update CreateLoginDelegate() parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
hferreiro authored and darkdh committed Aug 3, 2018
1 parent d79795e commit 79a285c
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 21 deletions.
17 changes: 9 additions & 8 deletions atom/browser/login_handler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,22 @@ using content::BrowserThread;

namespace atom {

LoginHandler::LoginHandler(net::AuthChallengeInfo* auth_info,
content::ResourceRequestInfo::WebContentsGetter web_contents_getter,
bool is_main_frame,
const GURL& url,
const base::Callback<void(const base::Optional<net::AuthCredentials>&)>&
auth_required_callback)
LoginHandler::LoginHandler(
net::AuthChallengeInfo* auth_info,
content::ResourceRequestInfo::WebContentsGetter web_contents_getter,
bool is_request_for_main_frame,
const GURL& url,
LoginAuthRequiredCallback auth_required_callback)
: handled_auth_(false),
auth_info_(auth_info),
web_contents_getter_(web_contents_getter),
auth_required_callback_(auth_required_callback) {
auth_required_callback_(std::move(auth_required_callback)) {
// Fill request details on IO thread.
std::unique_ptr<base::DictionaryValue> request_details(
new base::DictionaryValue);
request_details->SetKey("url", base::Value(url.spec()));
request_details->SetKey("isMainFrame", base::Value(is_main_frame));
request_details->SetKey("isMainFrame",
base::Value(is_request_for_main_frame));

BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE,
Expand Down
11 changes: 6 additions & 5 deletions atom/browser/login_handler.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
#include "content/public/browser/resource_request_info.h"
#include "net/base/auth.h"

using LoginAuthRequiredCallback =
base::OnceCallback<void(const base::Optional<net::AuthCredentials>&)>;

namespace content {
class WebContents;
}
Expand All @@ -26,10 +29,9 @@ class LoginHandler : public content::LoginDelegate {
public:
LoginHandler(net::AuthChallengeInfo* auth_info,
content::ResourceRequestInfo::WebContentsGetter web_contents_getter,
bool is_main_frame,
bool is_request_for_main_frame,
const GURL& url,
const base::Callback<void(const base::Optional<net::AuthCredentials>&)>&
auth_required_callback);
LoginAuthRequiredCallback auth_required_callback);

// Returns the WebContents associated with the request, must be called on UI
// thread.
Expand Down Expand Up @@ -67,8 +69,7 @@ class LoginHandler : public content::LoginDelegate {

content::ResourceRequestInfo::WebContentsGetter web_contents_getter_;

base::Callback<void(const base::Optional<net::AuthCredentials>&)>
auth_required_callback_;
LoginAuthRequiredCallback auth_required_callback_;

DISALLOW_COPY_AND_ASSIGN(LoginHandler);
};
Expand Down
10 changes: 5 additions & 5 deletions brave/browser/brave_content_browser_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -893,13 +893,13 @@ scoped_refptr<content::LoginDelegate>
BraveContentBrowserClient::CreateLoginDelegate(
net::AuthChallengeInfo* auth_info,
content::ResourceRequestInfo::WebContentsGetter web_contents_getter,
bool is_main_frame,
bool is_request_for_main_frame,
const GURL& url,
bool first_auth_attempt,
const base::Callback<void(const base::Optional<net::AuthCredentials>&)>&
auth_required_callback) {
return base::MakeRefCounted<atom::LoginHandler>(auth_info,
web_contents_getter, is_main_frame, url, auth_required_callback);
LoginAuthRequiredCallback auth_required_callback) {
return base::MakeRefCounted<atom::LoginHandler>(
auth_info, web_contents_getter, is_request_for_main_frame, url,
std::move(auth_required_callback));
}

std::unique_ptr<base::Value>
Expand Down
5 changes: 2 additions & 3 deletions brave/browser/brave_content_browser_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -150,11 +150,10 @@ class BraveContentBrowserClient : public atom::AtomBrowserClient {
scoped_refptr<content::LoginDelegate> CreateLoginDelegate(
net::AuthChallengeInfo* auth_info,
content::ResourceRequestInfo::WebContentsGetter web_contents_getter,
bool is_main_frame,
bool is_request_for_main_frame,
const GURL& url,
bool first_auth_attempt,
const base::Callback<void(const base::Optional<net::AuthCredentials>&)>&
auth_required_callback) override;
LoginAuthRequiredCallback auth_required_callback) override;

std::vector<std::unique_ptr<content::NavigationThrottle>>
CreateThrottlesForNavigation(
Expand Down

0 comments on commit 79a285c

Please sign in to comment.