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/pepper/url_request_info_util.h" | 5 #include "content/renderer/pepper/url_request_info_util.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 "content/child/request_extra_data.h" |
9 #include "content/common/fileapi/file_system_messages.h" | 10 #include "content/common/fileapi/file_system_messages.h" |
10 #include "content/renderer/pepper/common.h" | 11 #include "content/renderer/pepper/common.h" |
11 #include "content/renderer/pepper/host_globals.h" | 12 #include "content/renderer/pepper/host_globals.h" |
12 #include "content/renderer/pepper/pepper_file_ref_renderer_host.h" | 13 #include "content/renderer/pepper/pepper_file_ref_renderer_host.h" |
13 #include "content/renderer/pepper/pepper_plugin_instance_impl.h" | 14 #include "content/renderer/pepper/pepper_plugin_instance_impl.h" |
14 #include "content/renderer/pepper/plugin_module.h" | 15 #include "content/renderer/pepper/plugin_module.h" |
15 #include "content/renderer/pepper/renderer_ppapi_host_impl.h" | 16 #include "content/renderer/pepper/renderer_ppapi_host_impl.h" |
16 #include "content/renderer/render_thread_impl.h" | 17 #include "content/renderer/render_thread_impl.h" |
17 #include "net/http/http_util.h" | 18 #include "net/http/http_util.h" |
18 #include "ppapi/proxy/ppapi_messages.h" | 19 #include "ppapi/proxy/ppapi_messages.h" |
19 #include "ppapi/shared_impl/url_request_info_data.h" | 20 #include "ppapi/shared_impl/url_request_info_data.h" |
20 #include "ppapi/shared_impl/var.h" | 21 #include "ppapi/shared_impl/var.h" |
21 #include "ppapi/thunk/enter.h" | 22 #include "ppapi/thunk/enter.h" |
22 #include "third_party/WebKit/public/platform/WebData.h" | 23 #include "third_party/WebKit/public/platform/WebData.h" |
23 #include "third_party/WebKit/public/platform/WebHTTPBody.h" | 24 #include "third_party/WebKit/public/platform/WebHTTPBody.h" |
24 #include "third_party/WebKit/public/platform/WebURL.h" | 25 #include "third_party/WebKit/public/platform/WebURL.h" |
25 #include "third_party/WebKit/public/platform/WebURLRequest.h" | 26 #include "third_party/WebKit/public/platform/WebURLRequest.h" |
26 #include "third_party/WebKit/public/web/WebDocument.h" | 27 #include "third_party/WebKit/public/web/WebDocument.h" |
27 #include "third_party/WebKit/public/web/WebFrame.h" | 28 #include "third_party/WebKit/public/web/WebFrame.h" |
28 #include "url/gurl.h" | 29 #include "url/gurl.h" |
29 #include "url/url_util.h" | 30 #include "url/url_util.h" |
30 #include "webkit/child/weburlrequest_extradata_impl.h" | |
31 | 31 |
32 using ppapi::Resource; | 32 using ppapi::Resource; |
33 using ppapi::URLRequestInfoData; | 33 using ppapi::URLRequestInfoData; |
34 using ppapi::thunk::EnterResourceNoLock; | 34 using ppapi::thunk::EnterResourceNoLock; |
35 using blink::WebData; | 35 using blink::WebData; |
36 using blink::WebHTTPBody; | 36 using blink::WebHTTPBody; |
37 using blink::WebString; | 37 using blink::WebString; |
38 using blink::WebFrame; | 38 using blink::WebFrame; |
39 using blink::WebURL; | 39 using blink::WebURL; |
40 using blink::WebURLRequest; | 40 using blink::WebURLRequest; |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 | 169 |
170 if (data->has_custom_content_transfer_encoding && | 170 if (data->has_custom_content_transfer_encoding && |
171 !data->custom_content_transfer_encoding.empty()) { | 171 !data->custom_content_transfer_encoding.empty()) { |
172 dest->addHTTPHeaderField( | 172 dest->addHTTPHeaderField( |
173 WebString::fromUTF8("Content-Transfer-Encoding"), | 173 WebString::fromUTF8("Content-Transfer-Encoding"), |
174 WebString::fromUTF8(data->custom_content_transfer_encoding)); | 174 WebString::fromUTF8(data->custom_content_transfer_encoding)); |
175 } | 175 } |
176 | 176 |
177 if (data->has_custom_user_agent) { | 177 if (data->has_custom_user_agent) { |
178 bool was_after_preconnect_request = false; | 178 bool was_after_preconnect_request = false; |
179 dest->setExtraData(new webkit_glue::WebURLRequestExtraDataImpl( | 179 RequestExtraData* extraData = new RequestExtraData(); |
180 WebString::fromUTF8(data->custom_user_agent), | 180 extraData->set_custom_user_agent( |
181 was_after_preconnect_request)); | 181 WebString::fromUTF8(data->custom_user_agent)); |
| 182 extraData->set_was_after_preconnect_request(was_after_preconnect_request); |
| 183 dest->setExtraData(extraData); |
182 } | 184 } |
183 | 185 |
184 return true; | 186 return true; |
185 } | 187 } |
186 | 188 |
187 bool URLRequestRequiresUniversalAccess(const URLRequestInfoData& data) { | 189 bool URLRequestRequiresUniversalAccess(const URLRequestInfoData& data) { |
188 return | 190 return |
189 data.has_custom_referrer_url || | 191 data.has_custom_referrer_url || |
190 data.has_custom_content_transfer_encoding || | 192 data.has_custom_content_transfer_encoding || |
191 data.has_custom_user_agent || | 193 data.has_custom_user_agent || |
192 url_util::FindAndCompareScheme(data.url, "javascript", NULL); | 194 url_util::FindAndCompareScheme(data.url, "javascript", NULL); |
193 } | 195 } |
194 | 196 |
195 } // namespace content | 197 } // namespace content |
OLD | NEW |