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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
118 } | 118 } |
119 | 119 |
120 void URLRequest::Delegate::OnSSLCertificateError(URLRequest* request, | 120 void URLRequest::Delegate::OnSSLCertificateError(URLRequest* request, |
121 const SSLInfo& ssl_info, | 121 const SSLInfo& ssl_info, |
122 bool is_hsts_ok) { | 122 bool is_hsts_ok) { |
123 request->Cancel(); | 123 request->Cancel(); |
124 } | 124 } |
125 | 125 |
126 bool URLRequest::Delegate::CanGetCookies(const URLRequest* request, | 126 bool URLRequest::Delegate::CanGetCookies(const URLRequest* request, |
127 const CookieList& cookie_list) const { | 127 const CookieList& cookie_list) const { |
128 return true; | 128 return false; |
jam
2012/03/01 19:30:42
why?
jochen (gone - plz use gerrit)
2012/03/01 19:39:11
The default of URLRequest::CanSetCookies is false,
willchan no longer on Chromium
2012/03/01 20:30:10
Please just remove this method. Having it in both
| |
129 } | 129 } |
130 | 130 |
131 bool URLRequest::Delegate::CanSetCookie(const URLRequest* request, | 131 bool URLRequest::Delegate::CanSetCookie(const URLRequest* request, |
132 const std::string& cookie_line, | 132 const std::string& cookie_line, |
133 CookieOptions* options) const { | 133 CookieOptions* options) const { |
134 return true; | 134 return false; |
135 } | 135 } |
136 | 136 |
137 /////////////////////////////////////////////////////////////////////////////// | 137 /////////////////////////////////////////////////////////////////////////////// |
138 // URLRequest | 138 // URLRequest |
139 | 139 |
140 URLRequest::URLRequest(const GURL& url, Delegate* delegate) | 140 URLRequest::URLRequest(const GURL& url, Delegate* delegate) |
141 : url_chain_(1, url), | 141 : url_chain_(1, url), |
142 method_("GET"), | 142 method_("GET"), |
143 load_flags_(LOAD_NORMAL), | 143 load_flags_(LOAD_NORMAL), |
144 delegate_(delegate), | 144 delegate_(delegate), |
(...skipping 685 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
830 delegate_->OnCertificateRequested(this, cert_request_info); | 830 delegate_->OnCertificateRequested(this, cert_request_info); |
831 } | 831 } |
832 | 832 |
833 void URLRequest::NotifySSLCertificateError(const SSLInfo& ssl_info, | 833 void URLRequest::NotifySSLCertificateError(const SSLInfo& ssl_info, |
834 bool fatal) { | 834 bool fatal) { |
835 if (delegate_) | 835 if (delegate_) |
836 delegate_->OnSSLCertificateError(this, ssl_info, fatal); | 836 delegate_->OnSSLCertificateError(this, ssl_info, fatal); |
837 } | 837 } |
838 | 838 |
839 bool URLRequest::CanGetCookies(const CookieList& cookie_list) const { | 839 bool URLRequest::CanGetCookies(const CookieList& cookie_list) const { |
840 if (context_ && context_->network_delegate()) { | |
841 return context_->network_delegate()->NotifyReadingCookies(this, | |
842 cookie_list); | |
843 } | |
840 if (delegate_) | 844 if (delegate_) |
841 return delegate_->CanGetCookies(this, cookie_list); | 845 return delegate_->CanGetCookies(this, cookie_list); |
842 return false; | 846 return false; |
843 } | 847 } |
844 | 848 |
845 bool URLRequest::CanSetCookie(const std::string& cookie_line, | 849 bool URLRequest::CanSetCookie(const std::string& cookie_line, |
846 CookieOptions* options) const { | 850 CookieOptions* options) const { |
851 if (context_ && context_->network_delegate()) { | |
852 return context_->network_delegate()->NotifySettingCookie(this, | |
853 cookie_line, | |
854 options); | |
855 } | |
847 if (delegate_) | 856 if (delegate_) |
848 return delegate_->CanSetCookie(this, cookie_line, options); | 857 return delegate_->CanSetCookie(this, cookie_line, options); |
849 return false; | 858 return false; |
850 } | 859 } |
851 | 860 |
852 | 861 |
853 void URLRequest::NotifyReadCompleted(int bytes_read) { | 862 void URLRequest::NotifyReadCompleted(int bytes_read) { |
854 // Notify in case the entire URL Request has been finished. | 863 // Notify in case the entire URL Request has been finished. |
855 if (bytes_read <= 0) | 864 if (bytes_read <= 0) |
856 NotifyRequestCompleted(); | 865 NotifyRequestCompleted(); |
(...skipping 23 matching lines...) Expand all Loading... | |
880 | 889 |
881 void URLRequest::SetUnblockedOnDelegate() { | 890 void URLRequest::SetUnblockedOnDelegate() { |
882 if (!blocked_on_delegate_) | 891 if (!blocked_on_delegate_) |
883 return; | 892 return; |
884 blocked_on_delegate_ = false; | 893 blocked_on_delegate_ = false; |
885 load_state_param_.clear(); | 894 load_state_param_.clear(); |
886 net_log_.EndEvent(NetLog::TYPE_URL_REQUEST_BLOCKED_ON_DELEGATE, NULL); | 895 net_log_.EndEvent(NetLog::TYPE_URL_REQUEST_BLOCKED_ON_DELEGATE, NULL); |
887 } | 896 } |
888 | 897 |
889 } // namespace net | 898 } // namespace net |
OLD | NEW |