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 "content/renderer/fetchers/resource_fetcher_impl.h" | 5 #include "content/renderer/fetchers/resource_fetcher_impl.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
9 #include "base/time/time.h" | 9 #include "base/time/time.h" |
10 #include "third_party/WebKit/public/platform/Platform.h" | 10 #include "third_party/WebKit/public/platform/Platform.h" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 web_http_body.initialize(); | 59 web_http_body.initialize(); |
60 web_http_body.appendData(blink::WebData(body)); | 60 web_http_body.appendData(blink::WebData(body)); |
61 request_.setHTTPBody(web_http_body); | 61 request_.setHTTPBody(web_http_body); |
62 } | 62 } |
63 | 63 |
64 void ResourceFetcherImpl::SetHeader(const std::string& header, | 64 void ResourceFetcherImpl::SetHeader(const std::string& header, |
65 const std::string& value) { | 65 const std::string& value) { |
66 DCHECK(!request_.isNull()); | 66 DCHECK(!request_.isNull()); |
67 DCHECK(!loader_); | 67 DCHECK(!loader_); |
68 | 68 |
69 if (LowerCaseEqualsASCII(header, "referer")) { | 69 if (base::LowerCaseEqualsASCII(header, "referer")) { |
70 blink::WebString referrer = WebSecurityPolicy::generateReferrerHeader( | 70 blink::WebString referrer = WebSecurityPolicy::generateReferrerHeader( |
71 blink::WebReferrerPolicyDefault, | 71 blink::WebReferrerPolicyDefault, |
72 request_.url(), | 72 request_.url(), |
73 blink::WebString::fromUTF8(value)); | 73 blink::WebString::fromUTF8(value)); |
74 request_.setHTTPReferrer(referrer, blink::WebReferrerPolicyDefault); | 74 request_.setHTTPReferrer(referrer, blink::WebReferrerPolicyDefault); |
75 } else { | 75 } else { |
76 request_.setHTTPHeaderField(blink::WebString::fromUTF8(header), | 76 request_.setHTTPHeaderField(blink::WebString::fromUTF8(header), |
77 blink::WebString::fromUTF8(value)); | 77 blink::WebString::fromUTF8(value)); |
78 } | 78 } |
79 } | 79 } |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 | 175 |
176 void ResourceFetcherImpl::didFail(WebURLLoader* loader, | 176 void ResourceFetcherImpl::didFail(WebURLLoader* loader, |
177 const WebURLError& error) { | 177 const WebURLError& error) { |
178 DCHECK(!completed_); | 178 DCHECK(!completed_); |
179 | 179 |
180 // Go ahead and tell our delegate that we're done. | 180 // Go ahead and tell our delegate that we're done. |
181 RunCallback(WebURLResponse(), std::string()); | 181 RunCallback(WebURLResponse(), std::string()); |
182 } | 182 } |
183 | 183 |
184 } // namespace content | 184 } // namespace content |
OLD | NEW |