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 int64_t encoded_data_length) { | 127 int64_t encoded_data_length) { |
128 DCHECK(out_of_order_replies_.empty()); | 128 DCHECK(out_of_order_replies_.empty()); |
129 if (!request_data_.follow_redirects) { | 129 if (!request_data_.follow_redirects) { |
130 SaveResponse(redirect_response); | 130 SaveResponse(redirect_response); |
131 SetDefersLoading(true); | 131 SetDefersLoading(true); |
132 } | 132 } |
| 133 return true; |
133 } | 134 } |
134 | 135 |
135 void PepperURLLoaderHost::didSendData( | 136 void PepperURLLoaderHost::didSendData( |
136 WebURLLoader* loader, | 137 WebURLLoader* loader, |
137 unsigned long long bytes_sent, | 138 unsigned long long bytes_sent, |
138 unsigned long long total_bytes_to_be_sent) { | 139 unsigned long long total_bytes_to_be_sent) { |
139 // TODO(darin): Bounds check input? | 140 // TODO(darin): Bounds check input? |
140 bytes_sent_ = static_cast<int64_t>(bytes_sent); | 141 bytes_sent_ = static_cast<int64_t>(bytes_sent); |
141 total_bytes_to_be_sent_ = static_cast<int64_t>(total_bytes_to_be_sent); | 142 total_bytes_to_be_sent_ = static_cast<int64_t>(total_bytes_to_be_sent); |
142 UpdateProgress(); | 143 UpdateProgress(); |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
439 ppapi::proxy::ResourceMessageReplyParams params; | 440 ppapi::proxy::ResourceMessageReplyParams params; |
440 SendUpdateToPlugin(new PpapiPluginMsg_URLLoader_UpdateProgress( | 441 SendUpdateToPlugin(new PpapiPluginMsg_URLLoader_UpdateProgress( |
441 record_upload ? bytes_sent_ : -1, | 442 record_upload ? bytes_sent_ : -1, |
442 record_upload ? total_bytes_to_be_sent_ : -1, | 443 record_upload ? total_bytes_to_be_sent_ : -1, |
443 record_download ? bytes_received_ : -1, | 444 record_download ? bytes_received_ : -1, |
444 record_download ? total_bytes_to_be_received_ : -1)); | 445 record_download ? total_bytes_to_be_received_ : -1)); |
445 } | 446 } |
446 } | 447 } |
447 | 448 |
448 } // namespace content | 449 } // namespace content |
OLD | NEW |