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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 web_http_body.initialize(); | 49 web_http_body.initialize(); |
50 web_http_body.appendData(blink::WebData(body)); | 50 web_http_body.appendData(blink::WebData(body)); |
51 request_.setHTTPBody(web_http_body); | 51 request_.setHTTPBody(web_http_body); |
52 } | 52 } |
53 | 53 |
54 void ResourceFetcherImpl::SetHeader(const std::string& header, | 54 void ResourceFetcherImpl::SetHeader(const std::string& header, |
55 const std::string& value) { | 55 const std::string& value) { |
56 DCHECK(!request_.isNull()); | 56 DCHECK(!request_.isNull()); |
57 DCHECK(!loader_); | 57 DCHECK(!loader_); |
58 | 58 |
59 if (LowerCaseEqualsASCII(header, "referer")) { | 59 if (base::LowerCaseEqualsASCII(header, "referer")) { |
60 blink::WebString referrer = | 60 blink::WebString referrer = |
61 blink::WebSecurityPolicy::generateReferrerHeader( | 61 blink::WebSecurityPolicy::generateReferrerHeader( |
62 blink::WebReferrerPolicyDefault, | 62 blink::WebReferrerPolicyDefault, |
63 request_.url(), | 63 request_.url(), |
64 blink::WebString::fromUTF8(value)); | 64 blink::WebString::fromUTF8(value)); |
65 request_.setHTTPReferrer(referrer, blink::WebReferrerPolicyDefault); | 65 request_.setHTTPReferrer(referrer, blink::WebReferrerPolicyDefault); |
66 } else { | 66 } else { |
67 request_.setHTTPHeaderField(blink::WebString::fromUTF8(header), | 67 request_.setHTTPHeaderField(blink::WebString::fromUTF8(header), |
68 blink::WebString::fromUTF8(value)); | 68 blink::WebString::fromUTF8(value)); |
69 } | 69 } |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 callback.Run(status() == LOAD_FAILED ? blink::WebURLResponse() : response(), | 144 callback.Run(status() == LOAD_FAILED ? blink::WebURLResponse() : response(), |
145 status() == LOAD_FAILED ? std::string() : data()); | 145 status() == LOAD_FAILED ? std::string() : data()); |
146 } | 146 } |
147 | 147 |
148 void ResourceFetcherImpl::Cancel() { | 148 void ResourceFetcherImpl::Cancel() { |
149 loader_->cancel(); | 149 loader_->cancel(); |
150 WebURLLoaderClientImpl::Cancel(); | 150 WebURLLoaderClientImpl::Cancel(); |
151 } | 151 } |
152 | 152 |
153 } // namespace content | 153 } // namespace content |
OLD | NEW |