Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(463)

Unified Diff: net/url_request/url_request_ftp_job.cc

Issue 8340026: Use AuthCredentials throughout the network stack instead of username/password. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: mac compile fix Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: net/url_request/url_request_ftp_job.cc
diff --git a/net/url_request/url_request_ftp_job.cc b/net/url_request/url_request_ftp_job.cc
index b14d88d00bd775adef2c7c44b068b568ab58e377..669a8898bb2fe458e4ce6813ad8abc8c56a280e1 100644
--- a/net/url_request/url_request_ftp_job.cc
+++ b/net/url_request/url_request_ftp_job.cc
@@ -107,9 +107,7 @@ void URLRequestFtpJob::OnStartCompleted(int result) {
GURL origin = request_->url().GetOrigin();
if (server_auth_ && server_auth_->state == AUTH_STATE_HAVE_AUTH) {
request_->context()->ftp_auth_cache()->Remove(
- origin,
- server_auth_->credentials.username,
- server_auth_->credentials.password);
+ origin, server_auth_->credentials);
} else if (!server_auth_) {
server_auth_ = new AuthData();
}
@@ -120,8 +118,7 @@ void URLRequestFtpJob::OnStartCompleted(int result) {
if (cached_auth) {
// Retry using cached auth data.
- SetAuth(cached_auth->username,
- cached_auth->password);
+ SetAuth(cached_auth->credentials);
} else {
// Prompt for a username/password.
NotifyHeadersComplete();
@@ -151,8 +148,7 @@ void URLRequestFtpJob::RestartTransactionWithAuth() {
// be notifying our consumer asynchronously via OnStartCompleted.
SetStatus(URLRequestStatus(URLRequestStatus::IO_PENDING, 0));
- int rv = transaction_->RestartWithAuth(server_auth_->credentials.username,
- server_auth_->credentials.password,
+ int rv = transaction_->RestartWithAuth(server_auth_->credentials,
&start_callback_);
if (rv == ERR_IO_PENDING)
return;
@@ -203,15 +199,13 @@ void URLRequestFtpJob::GetAuthChallengeInfo(
result->swap(auth_info);
}
-void URLRequestFtpJob::SetAuth(const string16& username,
- const string16& password) {
+void URLRequestFtpJob::SetAuth(const AuthCredentials& credentials) {
DCHECK(NeedsAuth());
server_auth_->state = AUTH_STATE_HAVE_AUTH;
- server_auth_->credentials.username = username;
- server_auth_->credentials.password = password;
+ server_auth_->credentials = credentials;
request_->context()->ftp_auth_cache()->Add(request_->url().GetOrigin(),
- username, password);
+ server_auth_->credentials);
RestartTransactionWithAuth();
}

Powered by Google App Engine
This is Rietveld 408576698