0

Remove type alias

Fulfil a TODO and remove a type alias.

Bug: none
Change-Id: I681865a22b5466a74c352b470662fbacca2cb42f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6280957
Commit-Queue: Devon Loehr <dloehr@google.com>
Owners-Override: Avi Drissman <avi@chromium.org>
Reviewed-by: Devon Loehr <dloehr@google.com>
Auto-Submit: Avi Drissman <avi@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1422559}
This commit is contained in:
Avi Drissman
2025-02-20 07:39:11 -08:00
committed by Chromium LUCI CQ
parent c1a28a7d8d
commit 1e230250af
24 changed files with 84 additions and 74 deletions

@ -870,7 +870,7 @@ AwContentBrowserClient::CreateLoginDelegate(
scoped_refptr<net::HttpResponseHeaders> response_headers,
bool first_auth_attempt,
content::GuestPageHolder* guest,
LoginAuthRequiredCallback auth_required_callback) {
content::LoginDelegate::LoginAuthRequiredCallback auth_required_callback) {
return std::make_unique<AwHttpAuthHandler>(auth_info, web_contents,
first_auth_attempt,
std::move(auth_required_callback));

@ -201,7 +201,8 @@ class AwContentBrowserClient : public content::ContentBrowserClient {
scoped_refptr<net::HttpResponseHeaders> response_headers,
bool first_auth_attempt,
content::GuestPageHolder* guest,
LoginAuthRequiredCallback auth_required_callback) override;
content::LoginDelegate::LoginAuthRequiredCallback auth_required_callback)
override;
bool HandleExternalProtocol(
const GURL& url,
content::WebContents::Getter web_contents_getter,

@ -25,10 +25,11 @@ using content::BrowserThread;
namespace android_webview {
AwHttpAuthHandler::AwHttpAuthHandler(const net::AuthChallengeInfo& auth_info,
content::WebContents* web_contents,
bool first_auth_attempt,
LoginAuthRequiredCallback callback)
AwHttpAuthHandler::AwHttpAuthHandler(
const net::AuthChallengeInfo& auth_info,
content::WebContents* web_contents,
bool first_auth_attempt,
content::LoginDelegate::LoginAuthRequiredCallback callback)
: host_(auth_info.challenger.host()),
realm_(auth_info.realm),
callback_(std::move(callback)) {

@ -30,7 +30,7 @@ class AwHttpAuthHandler : public content::LoginDelegate {
AwHttpAuthHandler(const net::AuthChallengeInfo& auth_info,
content::WebContents* web_contents,
bool first_auth_attempt,
LoginAuthRequiredCallback callback);
content::LoginDelegate::LoginAuthRequiredCallback callback);
~AwHttpAuthHandler() override;
// from AwHttpAuthHandler
@ -49,7 +49,7 @@ class AwHttpAuthHandler : public content::LoginDelegate {
base::android::ScopedJavaGlobalRef<jobject> http_auth_handler_;
std::string host_;
std::string realm_;
LoginAuthRequiredCallback callback_;
content::LoginDelegate::LoginAuthRequiredCallback callback_;
base::WeakPtrFactory<AwHttpAuthHandler> weak_factory_{this};
};

@ -69,7 +69,8 @@ class SystemProxyLoginHandler : public content::LoginDelegate {
void AuthenticateWithCredentials(
const std::string& username,
const std::string& password,
LoginAuthRequiredCallback auth_required_callback) {
content::LoginDelegate::LoginAuthRequiredCallback
auth_required_callback) {
base::SingleThreadTaskRunner::GetCurrentDefault()->PostTask(
FROM_HERE,
base::BindOnce(&SystemProxyLoginHandler::InvokeWithCredentials,
@ -80,7 +81,8 @@ class SystemProxyLoginHandler : public content::LoginDelegate {
private:
void InvokeWithCredentials(const std::string& username,
const std::string& password,
LoginAuthRequiredCallback auth_required_callback) {
content::LoginDelegate::LoginAuthRequiredCallback
auth_required_callback) {
std::move(auth_required_callback)
.Run(std::make_optional<net::AuthCredentials>(
base::UTF8ToUTF16(username), base::UTF8ToUTF16(password)));
@ -497,7 +499,7 @@ bool SystemProxyManager::CanUsePolicyCredentials(
}
std::unique_ptr<content::LoginDelegate> SystemProxyManager::CreateLoginDelegate(
LoginAuthRequiredCallback auth_required_callback) {
content::LoginDelegate::LoginAuthRequiredCallback auth_required_callback) {
auto login_delegate = std::make_unique<SystemProxyLoginHandler>();
login_delegate->AuthenticateWithCredentials(
system_services_username_, system_services_password_,

@ -142,7 +142,7 @@ class SystemProxyManager : public NetworkStateHandlerObserver {
// credentials provided by the policy SystemProxySettings. Callers must verify
// that `CanUsePolicyCredentials` is true before calling this method.
std::unique_ptr<content::LoginDelegate> CreateLoginDelegate(
LoginAuthRequiredCallback auth_required_callback);
content::LoginDelegate::LoginAuthRequiredCallback auth_required_callback);
private:
// NetworkStateHandlerObserver implementation

@ -7012,7 +7012,7 @@ ChromeContentBrowserClient::CreateLoginDelegate(
scoped_refptr<net::HttpResponseHeaders> response_headers,
bool first_auth_attempt,
content::GuestPageHolder* guest,
LoginAuthRequiredCallback auth_required_callback) {
content::LoginDelegate::LoginAuthRequiredCallback auth_required_callback) {
#if BUILDFLAG(IS_CHROMEOS)
// Negotiate challenge is handled via GSSAPI library, which can not receive
// external credentials. However, on ChromeOS we can suggest the user to

@ -787,7 +787,8 @@ class ChromeContentBrowserClient : public content::ContentBrowserClient {
scoped_refptr<net::HttpResponseHeaders> response_headers,
bool first_auth_attempt,
content::GuestPageHolder* guest,
LoginAuthRequiredCallback auth_required_callback) override;
content::LoginDelegate::LoginAuthRequiredCallback auth_required_callback)
override;
bool HandleExternalProtocol(
const GURL& url,
content::WebContents::Getter web_contents_getter,

@ -25,9 +25,10 @@ namespace {
class LoginHandlerAndroid : public LoginHandler {
public:
LoginHandlerAndroid(const net::AuthChallengeInfo& auth_info,
content::WebContents* web_contents,
LoginAuthRequiredCallback auth_required_callback)
LoginHandlerAndroid(
const net::AuthChallengeInfo& auth_info,
content::WebContents* web_contents,
content::LoginDelegate::LoginAuthRequiredCallback auth_required_callback)
: LoginHandler(auth_info,
web_contents,
std::move(auth_required_callback)) {}
@ -83,7 +84,7 @@ class LoginHandlerAndroid : public LoginHandler {
std::unique_ptr<LoginHandler> LoginHandler::Create(
const net::AuthChallengeInfo& auth_info,
content::WebContents* web_contents,
LoginAuthRequiredCallback auth_required_callback) {
content::LoginDelegate::LoginAuthRequiredCallback auth_required_callback) {
return std::make_unique<LoginHandlerAndroid>(
auth_info, web_contents, std::move(auth_required_callback));
}

@ -150,7 +150,8 @@ void LoginHandler::SetAuth(std::u16string_view username,
}
}
LoginAuthRequiredCallback callback = std::move(auth_required_callback_);
content::LoginDelegate::LoginAuthRequiredCallback callback =
std::move(auth_required_callback_);
// Calling NotifyAuthSupplied() first allows other LoginHandler instances to
// call CloseContents() before us. Closing dialogs in the opposite order as
@ -168,7 +169,8 @@ void LoginHandler::CancelAuth(bool notify_others) {
return;
}
LoginAuthRequiredCallback callback = std::move(auth_required_callback_);
content::LoginDelegate::LoginAuthRequiredCallback callback =
std::move(auth_required_callback_);
if (notify_others) {
NotifyAuthCancelled();
@ -178,9 +180,10 @@ void LoginHandler::CancelAuth(bool notify_others) {
std::move(callback).Run(std::nullopt);
}
LoginHandler::LoginHandler(const net::AuthChallengeInfo& auth_info,
content::WebContents* web_contents,
LoginAuthRequiredCallback auth_required_callback)
LoginHandler::LoginHandler(
const net::AuthChallengeInfo& auth_info,
content::WebContents* web_contents,
content::LoginDelegate::LoginAuthRequiredCallback auth_required_callback)
: web_contents_(web_contents->GetWeakPtr()),
auth_info_(auth_info),
auth_required_callback_(std::move(auth_required_callback)) {

@ -55,7 +55,7 @@ class LoginHandler : public content::LoginDelegate {
static std::unique_ptr<LoginHandler> Create(
const net::AuthChallengeInfo& auth_info,
content::WebContents* web_contents,
LoginAuthRequiredCallback auth_required_callback);
content::LoginDelegate::LoginAuthRequiredCallback auth_required_callback);
// Call after `Create()` to show the dialog.
void ShowLoginPrompt(const GURL& request_url);
@ -79,9 +79,10 @@ class LoginHandler : public content::LoginDelegate {
content::WebContents* web_contents() { return web_contents_.get(); }
protected:
LoginHandler(const net::AuthChallengeInfo& auth_info,
content::WebContents* web_contents,
LoginAuthRequiredCallback auth_required_callback);
LoginHandler(
const net::AuthChallengeInfo& auth_info,
content::WebContents* web_contents,
content::LoginDelegate::LoginAuthRequiredCallback auth_required_callback);
// Implement this to initialize the underlying platform specific view. If
// |login_model_data| is not null, the contained LoginModel and PasswordForm
@ -166,7 +167,7 @@ class LoginHandler : public content::LoginDelegate {
// or rejected. This should only be accessed on the UI loop.
password_manager::PasswordForm password_form_;
LoginAuthRequiredCallback auth_required_callback_;
content::LoginDelegate::LoginAuthRequiredCallback auth_required_callback_;
base::WeakPtrFactory<LoginHandler> weak_factory_{this};
};

@ -164,7 +164,8 @@ class LoginTabHelperFake : public LoginTabHelper {
std::unique_ptr<LoginHandler> CreateLoginHandler(
const net::AuthChallengeInfo& auth_info,
content::WebContents* web_contents,
LoginAuthRequiredCallback auth_required_callback) override {
content::LoginDelegate::LoginAuthRequiredCallback auth_required_callback)
override {
return std::make_unique<LoginHandlerFake>(auth_info, web_contents,
std::move(auth_required_callback),
browser_client_);

@ -193,7 +193,7 @@ LoginTabHelper::LoginTabHelper(content::WebContents* web_contents)
std::unique_ptr<LoginHandler> LoginTabHelper::CreateLoginHandler(
const net::AuthChallengeInfo& auth_info,
content::WebContents* web_contents,
LoginAuthRequiredCallback auth_required_callback) {
content::LoginDelegate::LoginAuthRequiredCallback auth_required_callback) {
return LoginHandler::Create(auth_info, web_contents,
std::move(auth_required_callback));
}

@ -69,7 +69,7 @@ class LoginTabHelper : public content::WebContentsObserver,
virtual std::unique_ptr<LoginHandler> CreateLoginHandler(
const net::AuthChallengeInfo& auth_info,
content::WebContents* web_contents,
LoginAuthRequiredCallback auth_required_callback);
content::LoginDelegate::LoginAuthRequiredCallback auth_required_callback);
private:
friend class content::WebContentsUserData<LoginTabHelper>;

@ -28,9 +28,10 @@ namespace {
// `auth_required_callback`.
class LoginHandlerViews : public LoginHandler {
public:
LoginHandlerViews(const net::AuthChallengeInfo& auth_info,
content::WebContents* web_contents,
LoginAuthRequiredCallback auth_required_callback)
LoginHandlerViews(
const net::AuthChallengeInfo& auth_info,
content::WebContents* web_contents,
content::LoginDelegate::LoginAuthRequiredCallback auth_required_callback)
: LoginHandler(auth_info,
web_contents,
std::move(auth_required_callback)),
@ -191,7 +192,7 @@ class LoginHandlerViews : public LoginHandler {
std::unique_ptr<LoginHandler> LoginHandler::Create(
const net::AuthChallengeInfo& auth_info,
content::WebContents* web_contents,
LoginAuthRequiredCallback auth_required_callback) {
content::LoginDelegate::LoginAuthRequiredCallback auth_required_callback) {
return std::make_unique<LoginHandlerViews>(auth_info, web_contents,
std::move(auth_required_callback));
}

@ -113,7 +113,7 @@ std::unique_ptr<HttpAuthDialog> HttpAuthDialog::Create(
const net::AuthChallengeInfo& auth_info,
content::WebContents* web_contents,
const GURL& url,
LoginAuthRequiredCallback auth_required_callback) {
content::LoginDelegate::LoginAuthRequiredCallback auth_required_callback) {
// This class cannot handle UI-less auth dialog requests. Once Lacros ships,
// this should no longer be possible and this can become a CHECK.
if (!web_contents) {
@ -254,10 +254,11 @@ views::View* HttpAuthDialog::DialogView::GetInitiallyFocusedView() {
return username_field_;
}
HttpAuthDialog::HttpAuthDialog(const net::AuthChallengeInfo& auth_info,
content::WebContents* web_contents,
const GURL& url,
LoginAuthRequiredCallback auth_required_callback)
HttpAuthDialog::HttpAuthDialog(
const net::AuthChallengeInfo& auth_info,
content::WebContents* web_contents,
const GURL& url,
content::LoginDelegate::LoginAuthRequiredCallback auth_required_callback)
: callback_(std::move(auth_required_callback)),
web_contents_(web_contents) {
CHECK(!callback_.is_null());
@ -319,7 +320,8 @@ void HttpAuthDialog::SupplyCredentials(std::u16string_view username,
// synchronously invoked as a callback.
auto run_callback = base::BindOnce(
[](base::WeakPtr<HttpAuthDialog> dialog,
LoginAuthRequiredCallback callback, net::AuthCredentials credentials) {
content::LoginDelegate::LoginAuthRequiredCallback callback,
net::AuthCredentials credentials) {
if (dialog) {
std::move(callback).Run(std::move(credentials));
}
@ -337,7 +339,7 @@ void HttpAuthDialog::Cancel() {
// synchronously invoked as a callback.
auto run_callback = base::BindOnce(
[](base::WeakPtr<HttpAuthDialog> dialog,
LoginAuthRequiredCallback callback) {
content::LoginDelegate::LoginAuthRequiredCallback callback) {
if (dialog) {
std::move(callback).Run(std::nullopt);
}

@ -57,7 +57,7 @@ class COMPONENT_EXPORT(CHROMEOS_ASH_COMPONENTS_HTTP_AUTH_DIALOG)
const net::AuthChallengeInfo& auth_info,
content::WebContents* web_contents,
const GURL& url,
LoginAuthRequiredCallback auth_required_callback);
content::LoginDelegate::LoginAuthRequiredCallback auth_required_callback);
class Observer : public base::CheckedObserver {
public:
@ -108,10 +108,11 @@ class COMPONENT_EXPORT(CHROMEOS_ASH_COMPONENTS_HTTP_AUTH_DIALOG)
};
// The constructor creates and shows a dialog.
HttpAuthDialog(const net::AuthChallengeInfo& auth_info,
content::WebContents* web_contents,
const GURL& url,
LoginAuthRequiredCallback auth_required_callback);
HttpAuthDialog(
const net::AuthChallengeInfo& auth_info,
content::WebContents* web_contents,
const GURL& url,
content::LoginDelegate::LoginAuthRequiredCallback auth_required_callback);
// In the production use-case, this method is called by views when the user
// clicks the OK button. The dialog is in the process of closing. This method
@ -134,7 +135,7 @@ class COMPONENT_EXPORT(CHROMEOS_ASH_COMPONENTS_HTTP_AUTH_DIALOG)
// This class is owned by the //content layer. The only way to delete this
// class is to invoke this callback.
LoginAuthRequiredCallback callback_;
content::LoginDelegate::LoginAuthRequiredCallback callback_;
// Handles configuration and callbacks from the dialog.
views::DialogDelegate dialog_delegate_;

@ -385,16 +385,17 @@ class DummyAuthContentBrowserClient
// ContentBrowserClient method:
std::unique_ptr<LoginDelegate> CreateLoginDelegate(
const net::AuthChallengeInfo& auth_info,
content::WebContents* web_contents,
content::BrowserContext* browser_context,
WebContents* web_contents,
BrowserContext* browser_context,
const GlobalRequestID& request_id,
bool is_request_for_primary_main_frame_navigation,
bool is_request_for_navigation,
const GURL& url,
scoped_refptr<net::HttpResponseHeaders> response_headers,
bool first_auth_attempt,
content::GuestPageHolder* guest,
LoginAuthRequiredCallback auth_required_callback) override {
GuestPageHolder* guest,
LoginDelegate::LoginAuthRequiredCallback auth_required_callback)
override {
create_login_delegate_called_ = true;
base::SequencedTaskRunner::GetCurrentDefault()->PostTask(
FROM_HERE,

@ -1299,7 +1299,7 @@ ContentBrowserClient::CreateClientCertStore(BrowserContext* browser_context) {
std::unique_ptr<LoginDelegate> ContentBrowserClient::CreateLoginDelegate(
const net::AuthChallengeInfo& auth_info,
content::WebContents* web_contents,
WebContents* web_contents,
BrowserContext* browser_context,
const GlobalRequestID& request_id,
bool is_request_for_primary_main_frame_navigation,
@ -1308,7 +1308,7 @@ std::unique_ptr<LoginDelegate> ContentBrowserClient::CreateLoginDelegate(
scoped_refptr<net::HttpResponseHeaders> response_headers,
bool first_auth_attempt,
GuestPageHolder* guest,
LoginAuthRequiredCallback auth_required_callback) {
LoginDelegate::LoginAuthRequiredCallback auth_required_callback) {
return nullptr;
}

@ -118,12 +118,6 @@ class IsolationInfo;
class GURL;
// TODO(ellyjones): This synonym shouldn't need to exist - call sites should get
// the definition from LoginDelegate directly. Migrate all users over, then
// delete this.
using LoginAuthRequiredCallback =
content::LoginDelegate::LoginAuthRequiredCallback;
namespace base {
class CommandLine;
class FilePath;
@ -2407,7 +2401,7 @@ class CONTENT_EXPORT ContentBrowserClient {
scoped_refptr<net::HttpResponseHeaders> response_headers,
bool first_auth_attempt,
GuestPageHolder* guest_page_holder,
LoginAuthRequiredCallback auth_required_callback);
LoginDelegate::LoginAuthRequiredCallback auth_required_callback);
// 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

@ -695,16 +695,16 @@ ShellContentBrowserClient::CreateThrottlesForNavigation(
std::unique_ptr<LoginDelegate> ShellContentBrowserClient::CreateLoginDelegate(
const net::AuthChallengeInfo& auth_info,
content::WebContents* web_contents,
content::BrowserContext* browser_context,
const content::GlobalRequestID& request_id,
WebContents* web_contents,
BrowserContext* browser_context,
const GlobalRequestID& request_id,
bool is_request_for_primary_main_frame_navigation,
bool is_request_for_navigation,
const GURL& url,
scoped_refptr<net::HttpResponseHeaders> response_headers,
bool first_auth_attempt,
GuestPageHolder* guest,
LoginAuthRequiredCallback auth_required_callback) {
LoginDelegate::LoginAuthRequiredCallback auth_required_callback) {
if (!login_request_callback_.is_null()) {
std::move(login_request_callback_)
.Run(is_request_for_primary_main_frame_navigation,

@ -137,7 +137,7 @@ class ShellContentBrowserClient : public ContentBrowserClient {
scoped_refptr<net::HttpResponseHeaders> response_headers,
bool first_auth_attempt,
GuestPageHolder* guest,
LoginAuthRequiredCallback auth_required_callback) override;
LoginDelegate::LoginAuthRequiredCallback auth_required_callback) override;
base::Value::Dict GetNetLogConstants() override;
base::FilePath GetSandboxedStorageServiceDataDirectory() override;
base::FilePath GetFirstPartySetsDirectory() override;

@ -678,16 +678,16 @@ void WebTestContentBrowserClient::BindWebPressureManagerAutomation(
std::unique_ptr<LoginDelegate> WebTestContentBrowserClient::CreateLoginDelegate(
const net::AuthChallengeInfo& auth_info,
content::WebContents* web_contents,
content::BrowserContext* browser_context,
const content::GlobalRequestID& request_id,
WebContents* web_contents,
BrowserContext* browser_context,
const GlobalRequestID& request_id,
bool is_request_for_primary_main_frame_navigation,
bool is_request_for_navigation,
const GURL& url,
scoped_refptr<net::HttpResponseHeaders> response_headers,
bool first_auth_attempt,
GuestPageHolder* guest,
LoginAuthRequiredCallback auth_required_callback) {
LoginDelegate::LoginAuthRequiredCallback auth_required_callback) {
return nullptr;
}

@ -104,16 +104,16 @@ class WebTestContentBrowserClient : public ShellContentBrowserClient {
content::TtsPlatform* GetTtsPlatform() override;
std::unique_ptr<LoginDelegate> CreateLoginDelegate(
const net::AuthChallengeInfo& auth_info,
content::WebContents* web_contents,
content::BrowserContext* browser_context,
const content::GlobalRequestID& request_id,
WebContents* web_contents,
BrowserContext* browser_context,
const GlobalRequestID& request_id,
bool is_request_for_primary_main_frame_navigation,
bool is_request_for_navigation,
const GURL& url,
scoped_refptr<net::HttpResponseHeaders> response_headers,
bool first_auth_attempt,
GuestPageHolder* guest,
LoginAuthRequiredCallback auth_required_callback) override;
LoginDelegate::LoginAuthRequiredCallback auth_required_callback) override;
#if BUILDFLAG(IS_WIN)
bool PreSpawnChild(sandbox::TargetConfig* config,
sandbox::mojom::Sandbox sandbox_type,