OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "ppapi/proxy/ppb_url_loader_proxy.h" | 5 #include "ppapi/proxy/ppb_url_loader_proxy.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 // Initialized to -1. Will be set to nonnegative values by the UpdateProgress | 40 // Initialized to -1. Will be set to nonnegative values by the UpdateProgress |
41 // message when the values are known. | 41 // message when the values are known. |
42 int64_t bytes_sent_; | 42 int64_t bytes_sent_; |
43 int64_t total_bytes_to_be_sent_; | 43 int64_t total_bytes_to_be_sent_; |
44 int64_t bytes_received_; | 44 int64_t bytes_received_; |
45 int64_t total_bytes_to_be_received_; | 45 int64_t total_bytes_to_be_received_; |
46 | 46 |
47 // When an asynchronous read is pending, this will contain the callback and | 47 // When an asynchronous read is pending, this will contain the callback and |
48 // the buffer to put the data. | 48 // the buffer to put the data. |
49 PP_CompletionCallback current_read_callback_; | 49 PP_CompletionCallback current_read_callback_; |
50 char* current_read_buffer_; | 50 void* current_read_buffer_; |
51 | 51 |
52 // Cached copy of the response info. When nonzero, we're holding a reference | 52 // Cached copy of the response info. When nonzero, we're holding a reference |
53 // to this resource. | 53 // to this resource. |
54 PP_Resource response_info_; | 54 PP_Resource response_info_; |
55 | 55 |
56 private: | 56 private: |
57 DISALLOW_COPY_AND_ASSIGN(URLLoader); | 57 DISALLOW_COPY_AND_ASSIGN(URLLoader); |
58 }; | 58 }; |
59 | 59 |
60 URLLoader::URLLoader(const HostResource& resource) | 60 URLLoader::URLLoader(const HostResource& resource) |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 } | 198 } |
199 | 199 |
200 PP_Resource GetResponseInfo(PP_Resource loader_id) { | 200 PP_Resource GetResponseInfo(PP_Resource loader_id) { |
201 URLLoader* object = PluginResource::GetAs<URLLoader>(loader_id); | 201 URLLoader* object = PluginResource::GetAs<URLLoader>(loader_id); |
202 if (!object) | 202 if (!object) |
203 return 0; | 203 return 0; |
204 return object->GetResponseInfo(); | 204 return object->GetResponseInfo(); |
205 } | 205 } |
206 | 206 |
207 int32_t ReadResponseBody(PP_Resource loader_id, | 207 int32_t ReadResponseBody(PP_Resource loader_id, |
208 char* buffer, | 208 void* buffer, |
209 int32_t bytes_to_read, | 209 int32_t bytes_to_read, |
210 PP_CompletionCallback callback) { | 210 PP_CompletionCallback callback) { |
211 URLLoader* loader_object; | 211 URLLoader* loader_object; |
212 PluginDispatcher* dispatcher; | 212 PluginDispatcher* dispatcher; |
213 if (!RoutingDataFromURLLoader(loader_id, &loader_object, &dispatcher)) | 213 if (!RoutingDataFromURLLoader(loader_id, &loader_object, &dispatcher)) |
214 return PP_ERROR_BADRESOURCE; | 214 return PP_ERROR_BADRESOURCE; |
215 | 215 |
216 if (!buffer) | 216 if (!buffer) |
217 return PP_ERROR_BADARGUMENT; // Must specify an output buffer. | 217 return PP_ERROR_BADARGUMENT; // Must specify an output buffer. |
218 if (loader_object->current_read_callback_.func) | 218 if (loader_object->current_read_callback_.func) |
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
537 return handled; | 537 return handled; |
538 } | 538 } |
539 | 539 |
540 void PPB_URLLoaderTrusted_Proxy::OnMsgGrantUniversalAccess( | 540 void PPB_URLLoaderTrusted_Proxy::OnMsgGrantUniversalAccess( |
541 const HostResource& loader) { | 541 const HostResource& loader) { |
542 ppb_url_loader_trusted_target()->GrantUniversalAccess(loader.host_resource()); | 542 ppb_url_loader_trusted_target()->GrantUniversalAccess(loader.host_resource()); |
543 } | 543 } |
544 | 544 |
545 } // namespace proxy | 545 } // namespace proxy |
546 } // namespace pp | 546 } // namespace pp |
OLD | NEW |