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 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 } | 245 } |
246 | 246 |
247 if (loader_.get()) | 247 if (loader_.get()) |
248 return PP_ERROR_INPROGRESS; | 248 return PP_ERROR_INPROGRESS; |
249 | 249 |
250 WebFrame* frame = GetFrame(); | 250 WebFrame* frame = GetFrame(); |
251 if (!frame) | 251 if (!frame) |
252 return PP_ERROR_FAILED; | 252 return PP_ERROR_FAILED; |
253 | 253 |
254 WebURLRequest web_request; | 254 WebURLRequest web_request; |
255 if (!CreateWebURLRequest(pp_instance(), | 255 if (!CreateWebURLRequest(&filled_in_request_data, frame, &web_request)) |
256 &filled_in_request_data, | |
257 frame, | |
258 &web_request)) { | |
259 return PP_ERROR_FAILED; | 256 return PP_ERROR_FAILED; |
260 } | |
261 | 257 |
262 web_request.setTargetType(WebURLRequest::TargetIsObject); | 258 web_request.setTargetType(WebURLRequest::TargetIsObject); |
263 web_request.setRequestorProcessID(renderer_ppapi_host_->GetPluginPID()); | 259 web_request.setRequestorProcessID(renderer_ppapi_host_->GetPluginPID()); |
264 | 260 |
265 WebURLLoaderOptions options; | 261 WebURLLoaderOptions options; |
266 if (has_universal_access_) { | 262 if (has_universal_access_) { |
267 options.allowCredentials = true; | 263 options.allowCredentials = true; |
268 options.crossOriginRequestPolicy = | 264 options.crossOriginRequestPolicy = |
269 WebURLLoaderOptions::CrossOriginRequestPolicyAllow; | 265 WebURLLoaderOptions::CrossOriginRequestPolicyAllow; |
270 } else { | 266 } else { |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
390 // up-front should be valid (plugin document loads happen after all | 386 // up-front should be valid (plugin document loads happen after all |
391 // redirects are processed since WebKit has to know the MIME type). | 387 // redirects are processed since WebKit has to know the MIME type). |
392 if (!main_document_loader_) { | 388 if (!main_document_loader_) { |
393 // 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 |
394 // 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 |
395 // SendUpdateToPlugin() for more details. | 391 // SendUpdateToPlugin() for more details. |
396 DCHECK(!pending_response_); | 392 DCHECK(!pending_response_); |
397 pending_response_ = true; | 393 pending_response_ = true; |
398 | 394 |
399 DataFromWebURLResponse( | 395 DataFromWebURLResponse( |
400 renderer_ppapi_host_, | |
401 pp_instance(), | 396 pp_instance(), |
402 response, | 397 response, |
403 base::Bind(&PepperURLLoaderHost::DidDataFromWebURLResponse, | 398 base::Bind(&PepperURLLoaderHost::DidDataFromWebURLResponse, |
404 weak_factory_.GetWeakPtr())); | 399 weak_factory_.GetWeakPtr())); |
405 } | 400 } |
406 } | 401 } |
407 | 402 |
408 void PepperURLLoaderHost::DidDataFromWebURLResponse( | 403 void PepperURLLoaderHost::DidDataFromWebURLResponse( |
409 const ppapi::URLResponseInfoData& data) { | 404 const ppapi::URLResponseInfoData& data) { |
410 SendUpdateToPlugin(new PpapiPluginMsg_URLLoader_ReceivedResponse(data)); | 405 SendUpdateToPlugin(new PpapiPluginMsg_URLLoader_ReceivedResponse(data)); |
(...skipping 11 matching lines...) Expand all Loading... |
422 ppapi::proxy::ResourceMessageReplyParams params; | 417 ppapi::proxy::ResourceMessageReplyParams params; |
423 SendUpdateToPlugin(new PpapiPluginMsg_URLLoader_UpdateProgress( | 418 SendUpdateToPlugin(new PpapiPluginMsg_URLLoader_UpdateProgress( |
424 record_upload ? bytes_sent_ : -1, | 419 record_upload ? bytes_sent_ : -1, |
425 record_upload ? total_bytes_to_be_sent_ : -1, | 420 record_upload ? total_bytes_to_be_sent_ : -1, |
426 record_download ? bytes_received_ : -1, | 421 record_download ? bytes_received_ : -1, |
427 record_download ? total_bytes_to_be_received_ : -1)); | 422 record_download ? total_bytes_to_be_received_ : -1)); |
428 } | 423 } |
429 } | 424 } |
430 | 425 |
431 } // namespace content | 426 } // namespace content |
OLD | NEW |