| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 744 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 755 } | 755 } |
| 756 | 756 |
| 757 int64 URLRequest::GetExpectedContentSize() const { | 757 int64 URLRequest::GetExpectedContentSize() const { |
| 758 int64 expected_content_size = -1; | 758 int64 expected_content_size = -1; |
| 759 if (job_) | 759 if (job_) |
| 760 expected_content_size = job_->expected_content_size(); | 760 expected_content_size = job_->expected_content_size(); |
| 761 | 761 |
| 762 return expected_content_size; | 762 return expected_content_size; |
| 763 } | 763 } |
| 764 | 764 |
| 765 URLRequest::UserData* URLRequest::GetUserData(const void* key) const { | |
| 766 UserDataMap::const_iterator found = user_data_.find(key); | |
| 767 if (found != user_data_.end()) | |
| 768 return found->second.get(); | |
| 769 return NULL; | |
| 770 } | |
| 771 | |
| 772 void URLRequest::SetUserData(const void* key, UserData* data) { | |
| 773 user_data_[key] = linked_ptr<UserData>(data); | |
| 774 } | |
| 775 | |
| 776 void URLRequest::NotifyAuthRequired(AuthChallengeInfo* auth_info) { | 765 void URLRequest::NotifyAuthRequired(AuthChallengeInfo* auth_info) { |
| 777 NetworkDelegate::AuthRequiredResponse rv = | 766 NetworkDelegate::AuthRequiredResponse rv = |
| 778 NetworkDelegate::AUTH_REQUIRED_RESPONSE_NO_ACTION; | 767 NetworkDelegate::AUTH_REQUIRED_RESPONSE_NO_ACTION; |
| 779 auth_info_ = auth_info; | 768 auth_info_ = auth_info; |
| 780 if (context_ && context_->network_delegate()) { | 769 if (context_ && context_->network_delegate()) { |
| 781 rv = context_->network_delegate()->NotifyAuthRequired( | 770 rv = context_->network_delegate()->NotifyAuthRequired( |
| 782 this, | 771 this, |
| 783 *auth_info, | 772 *auth_info, |
| 784 base::Bind(&URLRequest::NotifyAuthRequiredComplete, | 773 base::Bind(&URLRequest::NotifyAuthRequiredComplete, |
| 785 base::Unretained(this)), | 774 base::Unretained(this)), |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 886 | 875 |
| 887 void URLRequest::SetUnblockedOnDelegate() { | 876 void URLRequest::SetUnblockedOnDelegate() { |
| 888 if (!blocked_on_delegate_) | 877 if (!blocked_on_delegate_) |
| 889 return; | 878 return; |
| 890 blocked_on_delegate_ = false; | 879 blocked_on_delegate_ = false; |
| 891 load_state_param_.clear(); | 880 load_state_param_.clear(); |
| 892 net_log_.EndEvent(NetLog::TYPE_URL_REQUEST_BLOCKED_ON_DELEGATE, NULL); | 881 net_log_.EndEvent(NetLog::TYPE_URL_REQUEST_BLOCKED_ON_DELEGATE, NULL); |
| 893 } | 882 } |
| 894 | 883 |
| 895 } // namespace net | 884 } // namespace net |
| OLD | NEW |