summaryrefslogtreecommitdiffstats
path: root/chromium/content/renderer/pepper/pepper_url_loader_host.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/content/renderer/pepper/pepper_url_loader_host.cc')
-rw-r--r--chromium/content/renderer/pepper/pepper_url_loader_host.cc66
1 files changed, 36 insertions, 30 deletions
diff --git a/chromium/content/renderer/pepper/pepper_url_loader_host.cc b/chromium/content/renderer/pepper/pepper_url_loader_host.cc
index 178548ee718..7b01400c2e6 100644
--- a/chromium/content/renderer/pepper/pepper_url_loader_host.cc
+++ b/chromium/content/renderer/pepper/pepper_url_loader_host.cc
@@ -21,13 +21,13 @@
#include "third_party/WebKit/public/platform/WebURLResponse.h"
#include "third_party/WebKit/public/web/WebDocument.h"
#include "third_party/WebKit/public/web/WebElement.h"
-#include "third_party/WebKit/public/web/WebFrame.h"
#include "third_party/WebKit/public/web/WebKit.h"
+#include "third_party/WebKit/public/web/WebLocalFrame.h"
#include "third_party/WebKit/public/web/WebPluginContainer.h"
#include "third_party/WebKit/public/web/WebSecurityOrigin.h"
#include "third_party/WebKit/public/web/WebURLLoaderOptions.h"
-using blink::WebFrame;
+using blink::WebLocalFrame;
using blink::WebString;
using blink::WebURL;
using blink::WebURLError;
@@ -104,20 +104,17 @@ PepperURLLoaderHost::~PepperURLLoaderHost() {
int32_t PepperURLLoaderHost::OnResourceMessageReceived(
const IPC::Message& msg,
ppapi::host::HostMessageContext* context) {
- IPC_BEGIN_MESSAGE_MAP(PepperURLLoaderHost, msg)
- PPAPI_DISPATCH_HOST_RESOURCE_CALL(
- PpapiHostMsg_URLLoader_Open,
- OnHostMsgOpen)
- PPAPI_DISPATCH_HOST_RESOURCE_CALL(
- PpapiHostMsg_URLLoader_SetDeferLoading,
- OnHostMsgSetDeferLoading)
- PPAPI_DISPATCH_HOST_RESOURCE_CALL_0(
- PpapiHostMsg_URLLoader_Close,
- OnHostMsgClose);
+ PPAPI_BEGIN_MESSAGE_MAP(PepperURLLoaderHost, msg)
+ PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_URLLoader_Open,
+ OnHostMsgOpen)
+ PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_URLLoader_SetDeferLoading,
+ OnHostMsgSetDeferLoading)
+ PPAPI_DISPATCH_HOST_RESOURCE_CALL_0(PpapiHostMsg_URLLoader_Close,
+ OnHostMsgClose);
PPAPI_DISPATCH_HOST_RESOURCE_CALL_0(
PpapiHostMsg_URLLoader_GrantUniversalAccess,
OnHostMsgGrantUniversalAccess)
- IPC_END_MESSAGE_MAP()
+ PPAPI_END_MESSAGE_MAP()
return PP_ERROR_FAILED;
}
@@ -173,13 +170,14 @@ void PepperURLLoaderHost::didReceiveData(WebURLLoader* loader,
}
void PepperURLLoaderHost::didFinishLoading(WebURLLoader* loader,
- double finish_time) {
+ double finish_time,
+ int64_t total_encoded_data_length) {
// Note that |loader| will be NULL for document loads.
SendUpdateToPlugin(new PpapiPluginMsg_URLLoader_FinishedLoading(PP_OK));
}
void PepperURLLoaderHost::didFail(WebURLLoader* loader,
- const WebURLError& error) {
+ const WebURLError& error) {
// Note that |loader| will be NULL for document loads.
int32_t pp_error = PP_ERROR_FAILED;
if (error.domain.equals(WebString::fromUTF8(net::kErrorDomain))) {
@@ -236,7 +234,9 @@ int32_t PepperURLLoaderHost::InternalOnHostMsgOpen(
if (URLRequestRequiresUniversalAccess(filled_in_request_data) &&
!has_universal_access_) {
ppapi::PpapiGlobals::Get()->LogWithSource(
- pp_instance(), PP_LOGLEVEL_ERROR, std::string(),
+ pp_instance(),
+ PP_LOGLEVEL_ERROR,
+ std::string(),
"PPB_URLLoader.Open: The URL you're requesting is "
" on a different security origin than your plugin. To request "
" cross-origin resources, see "
@@ -247,15 +247,13 @@ int32_t PepperURLLoaderHost::InternalOnHostMsgOpen(
if (loader_.get())
return PP_ERROR_INPROGRESS;
- WebFrame* frame = GetFrame();
+ WebLocalFrame* frame = GetFrame();
if (!frame)
return PP_ERROR_FAILED;
WebURLRequest web_request;
- if (!CreateWebURLRequest(pp_instance(),
- &filled_in_request_data,
- frame,
- &web_request)) {
+ if (!CreateWebURLRequest(
+ pp_instance(), &filled_in_request_data, frame, &web_request)) {
return PP_ERROR_FAILED;
}
@@ -361,13 +359,21 @@ void PepperURLLoaderHost::SendOrderedUpdateToPlugin(IPC::Message* message) {
}
void PepperURLLoaderHost::Close() {
- if (loader_.get())
+ if (loader_.get()) {
loader_->cancel();
- else if (main_document_loader_)
- GetFrame()->stopLoading();
+ } else if (main_document_loader_) {
+ // TODO(raymes): Calling WebLocalFrame::stopLoading here is incorrect as it
+ // cancels all URL loaders associated with the frame. If a client has opened
+ // other URLLoaders and then closes the main one, the others should still
+ // remain connected. Work out how to only cancel the main request:
+ // crbug.com/384197.
+ blink::WebLocalFrame* frame = GetFrame();
+ if (frame)
+ frame->stopLoading();
+ }
}
-blink::WebFrame* PepperURLLoaderHost::GetFrame() {
+blink::WebLocalFrame* PepperURLLoaderHost::GetFrame() {
PepperPluginInstance* instance_object =
renderer_ppapi_host_->GetPluginInstance(pp_instance());
if (!instance_object)
@@ -401,7 +407,7 @@ void PepperURLLoaderHost::SaveResponse(const WebURLResponse& response) {
pp_instance(),
response,
base::Bind(&PepperURLLoaderHost::DidDataFromWebURLResponse,
- weak_factory_.GetWeakPtr()));
+ weak_factory_.GetWeakPtr()));
}
}
@@ -421,10 +427,10 @@ void PepperURLLoaderHost::UpdateProgress() {
// flag.
ppapi::proxy::ResourceMessageReplyParams params;
SendUpdateToPlugin(new PpapiPluginMsg_URLLoader_UpdateProgress(
- record_upload ? bytes_sent_ : -1,
- record_upload ? total_bytes_to_be_sent_ : -1,
- record_download ? bytes_received_ : -1,
- record_download ? total_bytes_to_be_received_ : -1));
+ record_upload ? bytes_sent_ : -1,
+ record_upload ? total_bytes_to_be_sent_ : -1,
+ record_download ? bytes_received_ : -1,
+ record_download ? total_bytes_to_be_received_ : -1));
}
}