| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "net/url_request/url_request_ftp_job.h" | 5 #include "net/url_request/url_request_ftp_job.h" |
| 6 | 6 |
| 7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "net/base/auth.h" | 9 #include "net/base/auth.h" |
| 10 #include "net/base/net_errors.h" | 10 #include "net/base/net_errors.h" |
| 11 #include "net/base/net_util.h" | 11 #include "net/base/net_util.h" |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 (server_auth_->state == net::AUTH_STATE_NEED_AUTH)); | 83 (server_auth_->state == net::AUTH_STATE_NEED_AUTH)); |
| 84 scoped_refptr<net::AuthChallengeInfo> auth_info = new net::AuthChallengeInfo; | 84 scoped_refptr<net::AuthChallengeInfo> auth_info = new net::AuthChallengeInfo; |
| 85 auth_info->is_proxy = false; | 85 auth_info->is_proxy = false; |
| 86 auth_info->host_and_port = ASCIIToWide( | 86 auth_info->host_and_port = ASCIIToWide( |
| 87 net::GetHostAndPort(request_->url())); | 87 net::GetHostAndPort(request_->url())); |
| 88 auth_info->scheme = L""; | 88 auth_info->scheme = L""; |
| 89 auth_info->realm = L""; | 89 auth_info->realm = L""; |
| 90 result->swap(auth_info); | 90 result->swap(auth_info); |
| 91 } | 91 } |
| 92 | 92 |
| 93 void URLRequestFtpJob::SetAuth(const std::wstring& username, | 93 void URLRequestFtpJob::SetAuth(const string16& username, |
| 94 const std::wstring& password) { | 94 const string16& password) { |
| 95 DCHECK(NeedsAuth()); | 95 DCHECK(NeedsAuth()); |
| 96 server_auth_->state = net::AUTH_STATE_HAVE_AUTH; | 96 server_auth_->state = net::AUTH_STATE_HAVE_AUTH; |
| 97 server_auth_->username = username; | 97 server_auth_->username = username; |
| 98 server_auth_->password = password; | 98 server_auth_->password = password; |
| 99 | 99 |
| 100 request_->context()->ftp_auth_cache()->Add(request_->url().GetOrigin(), | 100 request_->context()->ftp_auth_cache()->Add(request_->url().GetOrigin(), |
| 101 username, password); | 101 username, password); |
| 102 | 102 |
| 103 RestartTransactionWithAuth(); | 103 RestartTransactionWithAuth(); |
| 104 } | 104 } |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 // URLRequest delegate via the message loop. | 235 // URLRequest delegate via the message loop. |
| 236 MessageLoop::current()->PostTask(FROM_HERE, NewRunnableMethod( | 236 MessageLoop::current()->PostTask(FROM_HERE, NewRunnableMethod( |
| 237 this, &URLRequestFtpJob::OnStartCompleted, rv)); | 237 this, &URLRequestFtpJob::OnStartCompleted, rv)); |
| 238 } | 238 } |
| 239 | 239 |
| 240 void URLRequestFtpJob::DestroyTransaction() { | 240 void URLRequestFtpJob::DestroyTransaction() { |
| 241 DCHECK(transaction_.get()); | 241 DCHECK(transaction_.get()); |
| 242 | 242 |
| 243 transaction_.reset(); | 243 transaction_.reset(); |
| 244 } | 244 } |
| OLD | NEW |