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 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 void PepperURLLoaderHost::SendOrderedUpdateToPlugin(IPC::Message* message) { | 352 void PepperURLLoaderHost::SendOrderedUpdateToPlugin(IPC::Message* message) { |
353 if (pp_resource() == 0) { | 353 if (pp_resource() == 0) { |
354 pending_replies_.push_back(message); | 354 pending_replies_.push_back(message); |
355 } else { | 355 } else { |
356 host()->SendUnsolicitedReply(pp_resource(), *message); | 356 host()->SendUnsolicitedReply(pp_resource(), *message); |
357 delete message; | 357 delete message; |
358 } | 358 } |
359 } | 359 } |
360 | 360 |
361 void PepperURLLoaderHost::Close() { | 361 void PepperURLLoaderHost::Close() { |
362 if (loader_.get()) | 362 if (loader_.get()) { |
363 loader_->cancel(); | 363 loader_->cancel(); |
364 else if (main_document_loader_) | 364 } else if (main_document_loader_) { |
365 GetFrame()->stopLoading(); | 365 // TODO(raymes): Calling WebLocalFrame::stopLoading here is incorrect as it |
| 366 // cancels all URL loaders associated with the frame. If a client has opened |
| 367 // other URLLoaders and then closes the main one, the others should still |
| 368 // remain connected. Work out how to only cancel the main request: |
| 369 // crbug.com/384197. |
| 370 blink::WebLocalFrame* frame = GetFrame(); |
| 371 if (frame) |
| 372 frame->stopLoading(); |
| 373 } |
366 } | 374 } |
367 | 375 |
368 blink::WebLocalFrame* PepperURLLoaderHost::GetFrame() { | 376 blink::WebLocalFrame* PepperURLLoaderHost::GetFrame() { |
369 PepperPluginInstance* instance_object = | 377 PepperPluginInstance* instance_object = |
370 renderer_ppapi_host_->GetPluginInstance(pp_instance()); | 378 renderer_ppapi_host_->GetPluginInstance(pp_instance()); |
371 if (!instance_object) | 379 if (!instance_object) |
372 return NULL; | 380 return NULL; |
373 return instance_object->GetContainer()->element().document().frame(); | 381 return instance_object->GetContainer()->element().document().frame(); |
374 } | 382 } |
375 | 383 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
420 ppapi::proxy::ResourceMessageReplyParams params; | 428 ppapi::proxy::ResourceMessageReplyParams params; |
421 SendUpdateToPlugin(new PpapiPluginMsg_URLLoader_UpdateProgress( | 429 SendUpdateToPlugin(new PpapiPluginMsg_URLLoader_UpdateProgress( |
422 record_upload ? bytes_sent_ : -1, | 430 record_upload ? bytes_sent_ : -1, |
423 record_upload ? total_bytes_to_be_sent_ : -1, | 431 record_upload ? total_bytes_to_be_sent_ : -1, |
424 record_download ? bytes_received_ : -1, | 432 record_download ? bytes_received_ : -1, |
425 record_download ? total_bytes_to_be_received_ : -1)); | 433 record_download ? total_bytes_to_be_received_ : -1)); |
426 } | 434 } |
427 } | 435 } |
428 | 436 |
429 } // namespace content | 437 } // namespace content |
OLD | NEW |