| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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.h" | 5 #include "net/url_request/url_request.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/memory/singleton.h" | 10 #include "base/memory/singleton.h" |
| (...skipping 598 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 609 } | 609 } |
| 610 } | 610 } |
| 611 | 611 |
| 612 void URLRequest::FollowDeferredRedirect() { | 612 void URLRequest::FollowDeferredRedirect() { |
| 613 CHECK(job_); | 613 CHECK(job_); |
| 614 CHECK(status_.is_success()); | 614 CHECK(status_.is_success()); |
| 615 | 615 |
| 616 job_->FollowDeferredRedirect(); | 616 job_->FollowDeferredRedirect(); |
| 617 } | 617 } |
| 618 | 618 |
| 619 void URLRequest::SetAuth(const string16& username, const string16& password) { | 619 void URLRequest::SetAuth(const AuthCredentials& credentials) { |
| 620 DCHECK(job_); | 620 DCHECK(job_); |
| 621 DCHECK(job_->NeedsAuth()); | 621 DCHECK(job_->NeedsAuth()); |
| 622 | 622 |
| 623 job_->SetAuth(username, password); | 623 job_->SetAuth(credentials); |
| 624 } | 624 } |
| 625 | 625 |
| 626 void URLRequest::CancelAuth() { | 626 void URLRequest::CancelAuth() { |
| 627 DCHECK(job_); | 627 DCHECK(job_); |
| 628 DCHECK(job_->NeedsAuth()); | 628 DCHECK(job_->NeedsAuth()); |
| 629 | 629 |
| 630 job_->CancelAuth(); | 630 job_->CancelAuth(); |
| 631 } | 631 } |
| 632 | 632 |
| 633 void URLRequest::ContinueWithCertificate(X509Certificate* client_cert) { | 633 void URLRequest::ContinueWithCertificate(X509Certificate* client_cert) { |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 812 | 812 |
| 813 switch (result) { | 813 switch (result) { |
| 814 case NetworkDelegate::AUTH_REQUIRED_RESPONSE_NO_ACTION: | 814 case NetworkDelegate::AUTH_REQUIRED_RESPONSE_NO_ACTION: |
| 815 // Defer to the URLRequest::Delegate, since the NetworkDelegate | 815 // Defer to the URLRequest::Delegate, since the NetworkDelegate |
| 816 // didn't take an action. | 816 // didn't take an action. |
| 817 if (delegate_) | 817 if (delegate_) |
| 818 delegate_->OnAuthRequired(this, auth_info.get()); | 818 delegate_->OnAuthRequired(this, auth_info.get()); |
| 819 break; | 819 break; |
| 820 | 820 |
| 821 case NetworkDelegate::AUTH_REQUIRED_RESPONSE_SET_AUTH: | 821 case NetworkDelegate::AUTH_REQUIRED_RESPONSE_SET_AUTH: |
| 822 SetAuth(credentials.username, credentials.password); | 822 SetAuth(credentials); |
| 823 break; | 823 break; |
| 824 | 824 |
| 825 case NetworkDelegate::AUTH_REQUIRED_RESPONSE_CANCEL_AUTH: | 825 case NetworkDelegate::AUTH_REQUIRED_RESPONSE_CANCEL_AUTH: |
| 826 CancelAuth(); | 826 CancelAuth(); |
| 827 break; | 827 break; |
| 828 | 828 |
| 829 case NetworkDelegate::AUTH_REQUIRED_RESPONSE_IO_PENDING: | 829 case NetworkDelegate::AUTH_REQUIRED_RESPONSE_IO_PENDING: |
| 830 NOTREACHED(); | 830 NOTREACHED(); |
| 831 break; | 831 break; |
| 832 } | 832 } |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 888 | 888 |
| 889 void URLRequest::SetUnblockedOnDelegate() { | 889 void URLRequest::SetUnblockedOnDelegate() { |
| 890 if (!blocked_on_delegate_) | 890 if (!blocked_on_delegate_) |
| 891 return; | 891 return; |
| 892 blocked_on_delegate_ = false; | 892 blocked_on_delegate_ = false; |
| 893 load_state_param_.clear(); | 893 load_state_param_.clear(); |
| 894 net_log_.EndEvent(NetLog::TYPE_URL_REQUEST_BLOCKED_ON_DELEGATE, NULL); | 894 net_log_.EndEvent(NetLog::TYPE_URL_REQUEST_BLOCKED_ON_DELEGATE, NULL); |
| 895 } | 895 } |
| 896 | 896 |
| 897 } // namespace net | 897 } // namespace net |
| OLD | NEW |