| 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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 // invoke InstanceWasDeleted() upon this URLLoaderResource, thereby | 97 // invoke InstanceWasDeleted() upon this URLLoaderResource, thereby |
| 98 // re-entering the scoped_ptr destructor with the same scoped_ptr object | 98 // re-entering the scoped_ptr destructor with the same scoped_ptr object |
| 99 // via loader_.reset(). Be sure that loader_ is first NULL then destroy | 99 // via loader_.reset(). Be sure that loader_ is first NULL then destroy |
| 100 // the scoped_ptr. See http://crbug.com/159429. | 100 // the scoped_ptr. See http://crbug.com/159429. |
| 101 scoped_ptr<blink::WebURLLoader> for_destruction_only(loader_.release()); | 101 scoped_ptr<blink::WebURLLoader> for_destruction_only(loader_.release()); |
| 102 } | 102 } |
| 103 | 103 |
| 104 int32_t PepperURLLoaderHost::OnResourceMessageReceived( | 104 int32_t PepperURLLoaderHost::OnResourceMessageReceived( |
| 105 const IPC::Message& msg, | 105 const IPC::Message& msg, |
| 106 ppapi::host::HostMessageContext* context) { | 106 ppapi::host::HostMessageContext* context) { |
| 107 IPC_BEGIN_MESSAGE_MAP(PepperURLLoaderHost, msg) | 107 PPAPI_BEGIN_MESSAGE_MAP(PepperURLLoaderHost, msg) |
| 108 PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_URLLoader_Open, OnHostMsgOpen) | 108 PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_URLLoader_Open, |
| 109 PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_URLLoader_SetDeferLoading, | 109 OnHostMsgOpen) |
| 110 OnHostMsgSetDeferLoading) | 110 PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_URLLoader_SetDeferLoading, |
| 111 PPAPI_DISPATCH_HOST_RESOURCE_CALL_0(PpapiHostMsg_URLLoader_Close, | 111 OnHostMsgSetDeferLoading) |
| 112 OnHostMsgClose); | 112 PPAPI_DISPATCH_HOST_RESOURCE_CALL_0(PpapiHostMsg_URLLoader_Close, |
| 113 PPAPI_DISPATCH_HOST_RESOURCE_CALL_0( | 113 OnHostMsgClose); |
| 114 PpapiHostMsg_URLLoader_GrantUniversalAccess, | 114 PPAPI_DISPATCH_HOST_RESOURCE_CALL_0( |
| 115 OnHostMsgGrantUniversalAccess) | 115 PpapiHostMsg_URLLoader_GrantUniversalAccess, |
| 116 IPC_END_MESSAGE_MAP() | 116 OnHostMsgGrantUniversalAccess) |
| 117 PPAPI_END_MESSAGE_MAP() |
| 117 return PP_ERROR_FAILED; | 118 return PP_ERROR_FAILED; |
| 118 } | 119 } |
| 119 | 120 |
| 120 void PepperURLLoaderHost::willSendRequest( | 121 void PepperURLLoaderHost::willSendRequest( |
| 121 WebURLLoader* loader, | 122 WebURLLoader* loader, |
| 122 WebURLRequest& new_request, | 123 WebURLRequest& new_request, |
| 123 const WebURLResponse& redirect_response) { | 124 const WebURLResponse& redirect_response) { |
| 124 DCHECK(out_of_order_replies_.empty()); | 125 DCHECK(out_of_order_replies_.empty()); |
| 125 if (!request_data_.follow_redirects) { | 126 if (!request_data_.follow_redirects) { |
| 126 SaveResponse(redirect_response); | 127 SaveResponse(redirect_response); |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 419 ppapi::proxy::ResourceMessageReplyParams params; | 420 ppapi::proxy::ResourceMessageReplyParams params; |
| 420 SendUpdateToPlugin(new PpapiPluginMsg_URLLoader_UpdateProgress( | 421 SendUpdateToPlugin(new PpapiPluginMsg_URLLoader_UpdateProgress( |
| 421 record_upload ? bytes_sent_ : -1, | 422 record_upload ? bytes_sent_ : -1, |
| 422 record_upload ? total_bytes_to_be_sent_ : -1, | 423 record_upload ? total_bytes_to_be_sent_ : -1, |
| 423 record_download ? bytes_received_ : -1, | 424 record_download ? bytes_received_ : -1, |
| 424 record_download ? total_bytes_to_be_received_ : -1)); | 425 record_download ? total_bytes_to_be_received_ : -1)); |
| 425 } | 426 } |
| 426 } | 427 } |
| 427 | 428 |
| 428 } // namespace content | 429 } // namespace content |
| OLD | NEW |