Use AuthCredentials throughout the network stack instead of username/password.
This is a refactor only - no behavior change should happen.
Review URL: http://codereview.chromium.org/8340026
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@107766 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/net/url_request/url_request_http_job.cc b/net/url_request/url_request_http_job.cc
index 7e0d8da..7fca837a 100644
--- a/net/url_request/url_request_http_job.cc
+++ b/net/url_request/url_request_http_job.cc
@@ -282,7 +282,7 @@
// URLRequestTestHTTP.BasicAuthWithCookies
// where OnBeforeSendHeaders -> OnSendHeaders -> OnBeforeSendHeaders
// occurs.
- RestartTransactionWithAuth(string16(), string16());
+ RestartTransactionWithAuth(AuthCredentials());
return;
}
@@ -334,7 +334,7 @@
// NOTE: This method assumes that request_info_ is already setup properly.
// If we already have a transaction, then we should restart the transaction
- // with auth provided by username_ and password_.
+ // with auth provided by auth_credentials_.
int rv;
@@ -344,9 +344,8 @@
}
if (transaction_.get()) {
- rv = transaction_->RestartWithAuth(username_, password_, &start_callback_);
- username_.clear();
- password_.clear();
+ rv = transaction_->RestartWithAuth(auth_credentials_, &start_callback_);
+ auth_credentials_ = AuthCredentials();
} else {
DCHECK(request_->context());
DCHECK(request_->context()->http_transaction_factory());
@@ -765,10 +764,8 @@
}
void URLRequestHttpJob::RestartTransactionWithAuth(
- const string16& username,
- const string16& password) {
- username_ = username;
- password_ = password;
+ const AuthCredentials& credentials) {
+ auth_credentials_ = credentials;
// These will be reset in OnStartCompleted.
response_info_ = NULL;
@@ -997,8 +994,7 @@
*result = response_info_->auth_challenge;
}
-void URLRequestHttpJob::SetAuth(const string16& username,
- const string16& password) {
+void URLRequestHttpJob::SetAuth(const AuthCredentials& credentials) {
DCHECK(transaction_.get());
// Proxy gets set first, then WWW.
@@ -1009,7 +1005,7 @@
server_auth_state_ = AUTH_STATE_HAVE_AUTH;
}
- RestartTransactionWithAuth(username, password);
+ RestartTransactionWithAuth(credentials);
}
void URLRequestHttpJob::CancelAuth() {