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/common/fileapi/file_system_messages.h" | 9 #include "content/common/fileapi/file_system_messages.h" |
10 #include "content/renderer/pepper/common.h" | 10 #include "content/renderer/pepper/common.h" |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 bool CreateWebURLRequest(ppapi::URLRequestInfoData* data, | 117 bool CreateWebURLRequest(ppapi::URLRequestInfoData* data, |
118 WebFrame* frame, | 118 WebFrame* frame, |
119 WebURLRequest* dest) { | 119 WebURLRequest* dest) { |
120 // In the out-of-process case, we've received the URLRequestInfoData | 120 // In the out-of-process case, we've received the URLRequestInfoData |
121 // from the untrusted plugin and done no validation on it. We need to be | 121 // from the untrusted plugin and done no validation on it. We need to be |
122 // sure it's not being malicious by checking everything for consistency. | 122 // sure it's not being malicious by checking everything for consistency. |
123 if (!ValidateURLRequestData(*data) || !EnsureFileRefObjectsPopulated(data)) | 123 if (!ValidateURLRequestData(*data) || !EnsureFileRefObjectsPopulated(data)) |
124 return false; | 124 return false; |
125 | 125 |
126 dest->initialize(); | 126 dest->initialize(); |
127 dest->setTargetType(WebURLRequest::TargetIsObject); | |
128 dest->setURL(frame->document().completeURL(WebString::fromUTF8( | 127 dest->setURL(frame->document().completeURL(WebString::fromUTF8( |
129 data->url))); | 128 data->url))); |
130 dest->setDownloadToFile(data->stream_to_file); | 129 dest->setDownloadToFile(data->stream_to_file); |
131 dest->setReportUploadProgress(data->record_upload_progress); | 130 dest->setReportUploadProgress(data->record_upload_progress); |
132 | 131 |
133 if (!data->method.empty()) | 132 if (!data->method.empty()) |
134 dest->setHTTPMethod(WebString::fromUTF8(data->method)); | 133 dest->setHTTPMethod(WebString::fromUTF8(data->method)); |
135 | 134 |
136 dest->setFirstPartyForCookies(frame->document().firstPartyForCookies()); | 135 dest->setFirstPartyForCookies(frame->document().firstPartyForCookies()); |
137 | 136 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 | 191 |
193 bool URLRequestRequiresUniversalAccess(const ppapi::URLRequestInfoData& data) { | 192 bool URLRequestRequiresUniversalAccess(const ppapi::URLRequestInfoData& data) { |
194 return | 193 return |
195 data.has_custom_referrer_url || | 194 data.has_custom_referrer_url || |
196 data.has_custom_content_transfer_encoding || | 195 data.has_custom_content_transfer_encoding || |
197 data.has_custom_user_agent || | 196 data.has_custom_user_agent || |
198 url_util::FindAndCompareScheme(data.url, "javascript", NULL); | 197 url_util::FindAndCompareScheme(data.url, "javascript", NULL); |
199 } | 198 } |
200 | 199 |
201 } // namespace content | 200 } // namespace content |
OLD | NEW |