| 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 19 matching lines...) Expand all Loading... |
| 30 #include "net/url_request/url_request_netlog_params.h" | 30 #include "net/url_request/url_request_netlog_params.h" |
| 31 #include "net/url_request/url_request_redirect_job.h" | 31 #include "net/url_request/url_request_redirect_job.h" |
| 32 | 32 |
| 33 using base::Time; | 33 using base::Time; |
| 34 using std::string; | 34 using std::string; |
| 35 | 35 |
| 36 namespace net { | 36 namespace net { |
| 37 | 37 |
| 38 namespace { | 38 namespace { |
| 39 | 39 |
| 40 static bool g_mac_cookies_enabled = false; | |
| 41 | |
| 42 // Max number of http redirects to follow. Same number as gecko. | 40 // Max number of http redirects to follow. Same number as gecko. |
| 43 const int kMaxRedirects = 20; | 41 const int kMaxRedirects = 20; |
| 44 | 42 |
| 45 // Discard headers which have meaning in POST (Content-Length, Content-Type, | 43 // Discard headers which have meaning in POST (Content-Length, Content-Type, |
| 46 // Origin). | 44 // Origin). |
| 47 void StripPostSpecificHeaders(HttpRequestHeaders* headers) { | 45 void StripPostSpecificHeaders(HttpRequestHeaders* headers) { |
| 48 // These are headers that may be attached to a POST. | 46 // These are headers that may be attached to a POST. |
| 49 headers->RemoveHeader(HttpRequestHeaders::kContentLength); | 47 headers->RemoveHeader(HttpRequestHeaders::kContentLength); |
| 50 headers->RemoveHeader(HttpRequestHeaders::kContentType); | 48 headers->RemoveHeader(HttpRequestHeaders::kContentType); |
| 51 headers->RemoveHeader(HttpRequestHeaders::kOrigin); | 49 headers->RemoveHeader(HttpRequestHeaders::kOrigin); |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 340 // static | 338 // static |
| 341 void URLRequest::AllowFileAccess() { | 339 void URLRequest::AllowFileAccess() { |
| 342 URLRequestJobManager::GetInstance()->set_enable_file_access(true); | 340 URLRequestJobManager::GetInstance()->set_enable_file_access(true); |
| 343 } | 341 } |
| 344 | 342 |
| 345 // static | 343 // static |
| 346 bool URLRequest::IsFileAccessAllowed() { | 344 bool URLRequest::IsFileAccessAllowed() { |
| 347 return URLRequestJobManager::GetInstance()->enable_file_access(); | 345 return URLRequestJobManager::GetInstance()->enable_file_access(); |
| 348 } | 346 } |
| 349 | 347 |
| 350 // static | |
| 351 void URLRequest::EnableMacCookies() { | |
| 352 g_mac_cookies_enabled = true; | |
| 353 } | |
| 354 | |
| 355 // static | |
| 356 bool URLRequest::AreMacCookiesEnabled() { | |
| 357 return g_mac_cookies_enabled; | |
| 358 } | |
| 359 | |
| 360 void URLRequest::set_first_party_for_cookies( | 348 void URLRequest::set_first_party_for_cookies( |
| 361 const GURL& first_party_for_cookies) { | 349 const GURL& first_party_for_cookies) { |
| 362 first_party_for_cookies_ = first_party_for_cookies; | 350 first_party_for_cookies_ = first_party_for_cookies; |
| 363 } | 351 } |
| 364 | 352 |
| 365 void URLRequest::set_method(const std::string& method) { | 353 void URLRequest::set_method(const std::string& method) { |
| 366 DCHECK(!is_pending_); | 354 DCHECK(!is_pending_); |
| 367 method_ = method; | 355 method_ = method; |
| 368 } | 356 } |
| 369 | 357 |
| (...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 876 | 864 |
| 877 void URLRequest::SetUnblockedOnDelegate() { | 865 void URLRequest::SetUnblockedOnDelegate() { |
| 878 if (!blocked_on_delegate_) | 866 if (!blocked_on_delegate_) |
| 879 return; | 867 return; |
| 880 blocked_on_delegate_ = false; | 868 blocked_on_delegate_ = false; |
| 881 load_state_param_.clear(); | 869 load_state_param_.clear(); |
| 882 net_log_.EndEvent(NetLog::TYPE_URL_REQUEST_BLOCKED_ON_DELEGATE, NULL); | 870 net_log_.EndEvent(NetLog::TYPE_URL_REQUEST_BLOCKED_ON_DELEGATE, NULL); |
| 883 } | 871 } |
| 884 | 872 |
| 885 } // namespace net | 873 } // namespace net |
| OLD | NEW |