OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/pepper_url_loader_host.h" | 5 #include "content/renderer/pepper/pepper_url_loader_host.h" |
6 | 6 |
7 #include "content/renderer/pepper/pepper_plugin_instance_impl.h" | 7 #include "content/renderer/pepper/pepper_plugin_instance_impl.h" |
8 #include "content/renderer/pepper/renderer_ppapi_host_impl.h" | 8 #include "content/renderer/pepper/renderer_ppapi_host_impl.h" |
9 #include "content/renderer/pepper/url_request_info_util.h" | 9 #include "content/renderer/pepper/url_request_info_util.h" |
10 #include "content/renderer/pepper/url_response_info_util.h" | 10 #include "content/renderer/pepper/url_response_info_util.h" |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 return PP_ERROR_NOACCESS; | 243 return PP_ERROR_NOACCESS; |
244 } | 244 } |
245 | 245 |
246 if (loader_.get()) | 246 if (loader_.get()) |
247 return PP_ERROR_INPROGRESS; | 247 return PP_ERROR_INPROGRESS; |
248 | 248 |
249 WebFrame* frame = GetFrame(); | 249 WebFrame* frame = GetFrame(); |
250 if (!frame) | 250 if (!frame) |
251 return PP_ERROR_FAILED; | 251 return PP_ERROR_FAILED; |
252 WebURLRequest web_request; | 252 WebURLRequest web_request; |
253 if (!CreateWebURLRequest(&filled_in_request_data, frame, &web_request)) | 253 if (!CreateWebURLRequest(pp_instance(), |
| 254 &filled_in_request_data, |
| 255 frame, |
| 256 &web_request)) { |
254 return PP_ERROR_FAILED; | 257 return PP_ERROR_FAILED; |
| 258 } |
255 web_request.setRequestorProcessID(renderer_ppapi_host_->GetPluginPID()); | 259 web_request.setRequestorProcessID(renderer_ppapi_host_->GetPluginPID()); |
256 | 260 |
257 WebURLLoaderOptions options; | 261 WebURLLoaderOptions options; |
258 if (has_universal_access_) { | 262 if (has_universal_access_) { |
259 options.allowCredentials = true; | 263 options.allowCredentials = true; |
260 options.crossOriginRequestPolicy = | 264 options.crossOriginRequestPolicy = |
261 WebURLLoaderOptions::CrossOriginRequestPolicyAllow; | 265 WebURLLoaderOptions::CrossOriginRequestPolicyAllow; |
262 } else { | 266 } else { |
263 // All other HTTP requests are untrusted. | 267 // All other HTTP requests are untrusted. |
264 options.untrustedHTTP = true; | 268 options.untrustedHTTP = true; |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
382 // up-front should be valid (plugin document loads happen after all | 386 // up-front should be valid (plugin document loads happen after all |
383 // redirects are processed since WebKit has to know the MIME type). | 387 // redirects are processed since WebKit has to know the MIME type). |
384 if (!main_document_loader_) { | 388 if (!main_document_loader_) { |
385 // We note when there's a callback in flight for a response to ensure that | 389 // We note when there's a callback in flight for a response to ensure that |
386 // messages we send to the plugin are not sent out of order. See | 390 // messages we send to the plugin are not sent out of order. See |
387 // SendUpdateToPlugin() for more details. | 391 // SendUpdateToPlugin() for more details. |
388 DCHECK(!pending_response_); | 392 DCHECK(!pending_response_); |
389 pending_response_ = true; | 393 pending_response_ = true; |
390 | 394 |
391 DataFromWebURLResponse( | 395 DataFromWebURLResponse( |
| 396 renderer_ppapi_host_, |
392 pp_instance(), | 397 pp_instance(), |
393 response, | 398 response, |
394 base::Bind(&PepperURLLoaderHost::DidDataFromWebURLResponse, | 399 base::Bind(&PepperURLLoaderHost::DidDataFromWebURLResponse, |
395 weak_factory_.GetWeakPtr())); | 400 weak_factory_.GetWeakPtr())); |
396 } | 401 } |
397 } | 402 } |
398 | 403 |
399 void PepperURLLoaderHost::DidDataFromWebURLResponse( | 404 void PepperURLLoaderHost::DidDataFromWebURLResponse( |
400 const ppapi::URLResponseInfoData& data) { | 405 const ppapi::URLResponseInfoData& data) { |
401 SendUpdateToPlugin(new PpapiPluginMsg_URLLoader_ReceivedResponse(data)); | 406 SendUpdateToPlugin(new PpapiPluginMsg_URLLoader_ReceivedResponse(data)); |
(...skipping 11 matching lines...) Expand all Loading... |
413 ppapi::proxy::ResourceMessageReplyParams params; | 418 ppapi::proxy::ResourceMessageReplyParams params; |
414 SendUpdateToPlugin(new PpapiPluginMsg_URLLoader_UpdateProgress( | 419 SendUpdateToPlugin(new PpapiPluginMsg_URLLoader_UpdateProgress( |
415 record_upload ? bytes_sent_ : -1, | 420 record_upload ? bytes_sent_ : -1, |
416 record_upload ? total_bytes_to_be_sent_ : -1, | 421 record_upload ? total_bytes_to_be_sent_ : -1, |
417 record_download ? bytes_received_ : -1, | 422 record_download ? bytes_received_ : -1, |
418 record_download ? total_bytes_to_be_received_ : -1)); | 423 record_download ? total_bytes_to_be_received_ : -1)); |
419 } | 424 } |
420 } | 425 } |
421 | 426 |
422 } // namespace content | 427 } // namespace content |
OLD | NEW |