| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <algorithm> | 7 #include <algorithm> |
| 8 #include <deque> | 8 #include <deque> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 | 50 |
| 51 // Called in the renderer when the byte counts have changed. We send a message | 51 // Called in the renderer when the byte counts have changed. We send a message |
| 52 // to the plugin to synchronize its counts so it can respond to status polls | 52 // to the plugin to synchronize its counts so it can respond to status polls |
| 53 // from the plugin. | 53 // from the plugin. |
| 54 void UpdateResourceLoadStatus(PP_Instance pp_instance, | 54 void UpdateResourceLoadStatus(PP_Instance pp_instance, |
| 55 PP_Resource pp_resource, | 55 PP_Resource pp_resource, |
| 56 int64 bytes_sent, | 56 int64 bytes_sent, |
| 57 int64 total_bytes_to_be_sent, | 57 int64 total_bytes_to_be_sent, |
| 58 int64 bytes_received, | 58 int64 bytes_received, |
| 59 int64 total_bytes_to_be_received) { | 59 int64 total_bytes_to_be_received) { |
| 60 #if !defined(OS_NACL) |
| 60 Dispatcher* dispatcher = HostDispatcher::GetForInstance(pp_instance); | 61 Dispatcher* dispatcher = HostDispatcher::GetForInstance(pp_instance); |
| 61 if (!dispatcher) | 62 if (!dispatcher) |
| 62 return; | 63 return; |
| 63 | 64 |
| 64 PPBURLLoader_UpdateProgress_Params params; | 65 PPBURLLoader_UpdateProgress_Params params; |
| 65 params.instance = pp_instance; | 66 params.instance = pp_instance; |
| 66 params.resource.SetHostResource(pp_instance, pp_resource); | 67 params.resource.SetHostResource(pp_instance, pp_resource); |
| 67 params.bytes_sent = bytes_sent; | 68 params.bytes_sent = bytes_sent; |
| 68 params.total_bytes_to_be_sent = total_bytes_to_be_sent; | 69 params.total_bytes_to_be_sent = total_bytes_to_be_sent; |
| 69 params.bytes_received = bytes_received; | 70 params.bytes_received = bytes_received; |
| 70 params.total_bytes_to_be_received = total_bytes_to_be_received; | 71 params.total_bytes_to_be_received = total_bytes_to_be_received; |
| 71 dispatcher->Send(new PpapiMsg_PPBURLLoader_UpdateProgress( | 72 dispatcher->Send(new PpapiMsg_PPBURLLoader_UpdateProgress( |
| 72 API_ID_PPB_URL_LOADER, params)); | 73 API_ID_PPB_URL_LOADER, params)); |
| 74 #endif |
| 73 } | 75 } |
| 74 | 76 |
| 75 InterfaceProxy* CreateURLLoaderProxy(Dispatcher* dispatcher) { | 77 InterfaceProxy* CreateURLLoaderProxy(Dispatcher* dispatcher) { |
| 76 return new PPB_URLLoader_Proxy(dispatcher); | 78 return new PPB_URLLoader_Proxy(dispatcher); |
| 77 } | 79 } |
| 78 | 80 |
| 79 } // namespace | 81 } // namespace |
| 80 | 82 |
| 81 // URLLoader ------------------------------------------------------------------- | 83 // URLLoader ------------------------------------------------------------------- |
| 82 | 84 |
| (...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 417 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBURLLoader_GetResponseInfo, | 419 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBURLLoader_GetResponseInfo, |
| 418 OnMsgGetResponseInfo) | 420 OnMsgGetResponseInfo) |
| 419 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBURLLoader_ReadResponseBody, | 421 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBURLLoader_ReadResponseBody, |
| 420 OnMsgReadResponseBody) | 422 OnMsgReadResponseBody) |
| 421 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBURLLoader_FinishStreamingToFile, | 423 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBURLLoader_FinishStreamingToFile, |
| 422 OnMsgFinishStreamingToFile) | 424 OnMsgFinishStreamingToFile) |
| 423 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBURLLoader_Close, | 425 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBURLLoader_Close, |
| 424 OnMsgClose) | 426 OnMsgClose) |
| 425 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBURLLoader_GrantUniversalAccess, | 427 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBURLLoader_GrantUniversalAccess, |
| 426 OnMsgGrantUniversalAccess) | 428 OnMsgGrantUniversalAccess) |
| 427 | 429 #if !defined(OS_NACL) |
| 428 IPC_MESSAGE_HANDLER(PpapiMsg_PPBURLLoader_UpdateProgress, | 430 IPC_MESSAGE_HANDLER(PpapiMsg_PPBURLLoader_UpdateProgress, |
| 429 OnMsgUpdateProgress) | 431 OnMsgUpdateProgress) |
| 432 #endif |
| 430 IPC_MESSAGE_HANDLER(PpapiMsg_PPBURLLoader_ReadResponseBody_Ack, | 433 IPC_MESSAGE_HANDLER(PpapiMsg_PPBURLLoader_ReadResponseBody_Ack, |
| 431 OnMsgReadResponseBodyAck) | 434 OnMsgReadResponseBodyAck) |
| 432 IPC_MESSAGE_HANDLER(PpapiMsg_PPBURLLoader_CallbackComplete, | 435 IPC_MESSAGE_HANDLER(PpapiMsg_PPBURLLoader_CallbackComplete, |
| 433 OnMsgCallbackComplete) | 436 OnMsgCallbackComplete) |
| 434 IPC_MESSAGE_UNHANDLED(handled = false) | 437 IPC_MESSAGE_UNHANDLED(handled = false) |
| 435 IPC_END_MESSAGE_MAP() | 438 IPC_END_MESSAGE_MAP() |
| 436 // TODO(brettw) handle bad messages! | 439 // TODO(brettw) handle bad messages! |
| 437 return handled; | 440 return handled; |
| 438 } | 441 } |
| 439 | 442 |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 595 } | 598 } |
| 596 | 599 |
| 597 void PPB_URLLoader_Proxy::OnCallback(int32_t result, | 600 void PPB_URLLoader_Proxy::OnCallback(int32_t result, |
| 598 const HostResource& resource) { | 601 const HostResource& resource) { |
| 599 dispatcher()->Send(new PpapiMsg_PPBURLLoader_CallbackComplete( | 602 dispatcher()->Send(new PpapiMsg_PPBURLLoader_CallbackComplete( |
| 600 API_ID_PPB_URL_LOADER, resource, result)); | 603 API_ID_PPB_URL_LOADER, resource, result)); |
| 601 } | 604 } |
| 602 | 605 |
| 603 } // namespace proxy | 606 } // namespace proxy |
| 604 } // namespace ppapi | 607 } // namespace ppapi |
| OLD | NEW |