Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / content / renderer / pepper / pepper_url_loader_host.cc
index e6a2b5c..4a327d1 100644 (file)
 #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;
@@ -105,18 +105,14 @@ 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_DISPATCH_HOST_RESOURCE_CALL_0(
-        PpapiHostMsg_URLLoader_GrantUniversalAccess,
-        OnHostMsgGrantUniversalAccess)
+  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()
   return PP_ERROR_FAILED;
 }
@@ -180,7 +176,7 @@ void PepperURLLoaderHost::didFinishLoading(WebURLLoader* loader,
 }
 
 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))) {
@@ -237,7 +233,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 "
@@ -248,15 +246,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;
   }
 
@@ -368,7 +364,7 @@ void PepperURLLoaderHost::Close() {
     GetFrame()->stopLoading();
 }
 
-blink::WebFrame* PepperURLLoaderHost::GetFrame() {
+blink::WebLocalFrame* PepperURLLoaderHost::GetFrame() {
   PepperPluginInstance* instance_object =
       renderer_ppapi_host_->GetPluginInstance(pp_instance());
   if (!instance_object)
@@ -402,7 +398,7 @@ void PepperURLLoaderHost::SaveResponse(const WebURLResponse& response) {
         pp_instance(),
         response,
         base::Bind(&PepperURLLoaderHost::DidDataFromWebURLResponse,
-            weak_factory_.GetWeakPtr()));
+                   weak_factory_.GetWeakPtr()));
   }
 }
 
@@ -422,10 +418,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));
   }
 }