| OLD | NEW |
| 1 // Copyright (c) 20010 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.h" | 5 #include "net/url_request/url_request.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 "base/singleton.h" | 9 #include "base/singleton.h" |
| 10 #include "base/stats_counters.h" | 10 #include "base/stats_counters.h" |
| 11 #include "net/base/load_flags.h" | 11 #include "net/base/load_flags.h" |
| 12 #include "net/base/net_errors.h" | 12 #include "net/base/net_errors.h" |
| 13 #include "net/base/net_log.h" | 13 #include "net/base/net_log.h" |
| 14 #include "net/base/ssl_cert_request_info.h" | 14 #include "net/base/ssl_cert_request_info.h" |
| 15 #include "net/base/upload_data.h" | 15 #include "net/base/upload_data.h" |
| 16 #include "net/http/http_response_headers.h" | 16 #include "net/http/http_response_headers.h" |
| 17 #include "net/http/http_util.h" | 17 #include "net/http/http_util.h" |
| 18 #include "net/url_request/url_request_context.h" | 18 #include "net/url_request/url_request_context.h" |
| 19 #include "net/url_request/url_request_job.h" | 19 #include "net/url_request/url_request_job.h" |
| 20 #include "net/url_request/url_request_job_manager.h" | 20 #include "net/url_request/url_request_job_manager.h" |
| 21 #include "net/url_request/url_request_netlog_params.h" | 21 #include "net/url_request/url_request_netlog_params.h" |
| 22 | 22 |
| 23 using base::Time; | 23 using base::Time; |
| 24 using net::UploadData; | 24 using net::UploadData; |
| 25 using std::string; | 25 using std::string; |
| 26 using std::wstring; | |
| 27 | 26 |
| 28 namespace { | 27 namespace { |
| 29 | 28 |
| 30 // Max number of http redirects to follow. Same number as gecko. | 29 // Max number of http redirects to follow. Same number as gecko. |
| 31 const int kMaxRedirects = 20; | 30 const int kMaxRedirects = 20; |
| 32 | 31 |
| 33 URLRequestJobManager* GetJobManager() { | 32 URLRequestJobManager* GetJobManager() { |
| 34 return Singleton<URLRequestJobManager>::get(); | 33 return Singleton<URLRequestJobManager>::get(); |
| 35 } | 34 } |
| 36 | 35 |
| (...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 388 } | 387 } |
| 389 } | 388 } |
| 390 | 389 |
| 391 void URLRequest::FollowDeferredRedirect() { | 390 void URLRequest::FollowDeferredRedirect() { |
| 392 CHECK(job_); | 391 CHECK(job_); |
| 393 CHECK(status_.is_success()); | 392 CHECK(status_.is_success()); |
| 394 | 393 |
| 395 job_->FollowDeferredRedirect(); | 394 job_->FollowDeferredRedirect(); |
| 396 } | 395 } |
| 397 | 396 |
| 398 void URLRequest::SetAuth(const wstring& username, const wstring& password) { | 397 void URLRequest::SetAuth(const string16& username, const string16& password) { |
| 399 DCHECK(job_); | 398 DCHECK(job_); |
| 400 DCHECK(job_->NeedsAuth()); | 399 DCHECK(job_->NeedsAuth()); |
| 401 | 400 |
| 402 job_->SetAuth(username, password); | 401 job_->SetAuth(username, password); |
| 403 } | 402 } |
| 404 | 403 |
| 405 void URLRequest::CancelAuth() { | 404 void URLRequest::CancelAuth() { |
| 406 DCHECK(job_); | 405 DCHECK(job_); |
| 407 DCHECK(job_->NeedsAuth()); | 406 DCHECK(job_->NeedsAuth()); |
| 408 | 407 |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 532 URLRequest::UserData* URLRequest::GetUserData(const void* key) const { | 531 URLRequest::UserData* URLRequest::GetUserData(const void* key) const { |
| 533 UserDataMap::const_iterator found = user_data_.find(key); | 532 UserDataMap::const_iterator found = user_data_.find(key); |
| 534 if (found != user_data_.end()) | 533 if (found != user_data_.end()) |
| 535 return found->second.get(); | 534 return found->second.get(); |
| 536 return NULL; | 535 return NULL; |
| 537 } | 536 } |
| 538 | 537 |
| 539 void URLRequest::SetUserData(const void* key, UserData* data) { | 538 void URLRequest::SetUserData(const void* key, UserData* data) { |
| 540 user_data_[key] = linked_ptr<UserData>(data); | 539 user_data_[key] = linked_ptr<UserData>(data); |
| 541 } | 540 } |
| OLD | NEW |