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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "content/renderer/pepper/pepper_plugin_instance_impl.h" | 9 #include "content/renderer/pepper/pepper_plugin_instance_impl.h" |
10 #include "content/renderer/pepper/renderer_ppapi_host_impl.h" | 10 #include "content/renderer/pepper/renderer_ppapi_host_impl.h" |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 OnHostMsgSetDeferLoading) | 113 OnHostMsgSetDeferLoading) |
114 PPAPI_DISPATCH_HOST_RESOURCE_CALL_0(PpapiHostMsg_URLLoader_Close, | 114 PPAPI_DISPATCH_HOST_RESOURCE_CALL_0(PpapiHostMsg_URLLoader_Close, |
115 OnHostMsgClose); | 115 OnHostMsgClose); |
116 PPAPI_DISPATCH_HOST_RESOURCE_CALL_0( | 116 PPAPI_DISPATCH_HOST_RESOURCE_CALL_0( |
117 PpapiHostMsg_URLLoader_GrantUniversalAccess, | 117 PpapiHostMsg_URLLoader_GrantUniversalAccess, |
118 OnHostMsgGrantUniversalAccess) | 118 OnHostMsgGrantUniversalAccess) |
119 PPAPI_END_MESSAGE_MAP() | 119 PPAPI_END_MESSAGE_MAP() |
120 return PP_ERROR_FAILED; | 120 return PP_ERROR_FAILED; |
121 } | 121 } |
122 | 122 |
123 void PepperURLLoaderHost::willFollowRedirect( | 123 bool PepperURLLoaderHost::willFollowRedirect( |
124 WebURLLoader* loader, | 124 WebURLLoader* loader, |
125 WebURLRequest& new_request, | 125 WebURLRequest& new_request, |
126 const WebURLResponse& redirect_response) { | 126 const WebURLResponse& redirect_response) { |
127 DCHECK(out_of_order_replies_.empty()); | 127 DCHECK(out_of_order_replies_.empty()); |
128 if (!request_data_.follow_redirects) { | 128 if (!request_data_.follow_redirects) { |
129 SaveResponse(redirect_response); | 129 SaveResponse(redirect_response); |
130 SetDefersLoading(true); | 130 SetDefersLoading(true); |
| 131 // Defer the request and wait the plugin to audit the redirect. We |
| 132 // shouldn't return false here as decision has been delegated to the |
| 133 // plugin. |
131 } | 134 } |
| 135 return true; |
132 } | 136 } |
133 | 137 |
134 void PepperURLLoaderHost::didSendData( | 138 void PepperURLLoaderHost::didSendData( |
135 WebURLLoader* loader, | 139 WebURLLoader* loader, |
136 unsigned long long bytes_sent, | 140 unsigned long long bytes_sent, |
137 unsigned long long total_bytes_to_be_sent) { | 141 unsigned long long total_bytes_to_be_sent) { |
138 // TODO(darin): Bounds check input? | 142 // TODO(darin): Bounds check input? |
139 bytes_sent_ = static_cast<int64_t>(bytes_sent); | 143 bytes_sent_ = static_cast<int64_t>(bytes_sent); |
140 total_bytes_to_be_sent_ = static_cast<int64_t>(total_bytes_to_be_sent); | 144 total_bytes_to_be_sent_ = static_cast<int64_t>(total_bytes_to_be_sent); |
141 UpdateProgress(); | 145 UpdateProgress(); |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
438 ppapi::proxy::ResourceMessageReplyParams params; | 442 ppapi::proxy::ResourceMessageReplyParams params; |
439 SendUpdateToPlugin(new PpapiPluginMsg_URLLoader_UpdateProgress( | 443 SendUpdateToPlugin(new PpapiPluginMsg_URLLoader_UpdateProgress( |
440 record_upload ? bytes_sent_ : -1, | 444 record_upload ? bytes_sent_ : -1, |
441 record_upload ? total_bytes_to_be_sent_ : -1, | 445 record_upload ? total_bytes_to_be_sent_ : -1, |
442 record_download ? bytes_received_ : -1, | 446 record_download ? bytes_received_ : -1, |
443 record_download ? total_bytes_to_be_received_ : -1)); | 447 record_download ? total_bytes_to_be_received_ : -1)); |
444 } | 448 } |
445 } | 449 } |
446 | 450 |
447 } // namespace content | 451 } // namespace content |
OLD | NEW |