OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef PPAPI_PPB_URL_LOADER_PROXY_H_ |
| 6 #define PPAPI_PPB_URL_LOADER_PROXY_H_ |
| 7 |
| 8 #include "base/weak_ptr.h" |
| 9 #include "ppapi/c/pp_completion_callback.h" |
| 10 #include "ppapi/c/pp_instance.h" |
| 11 #include "ppapi/c/pp_module.h" |
| 12 #include "ppapi/c/pp_resource.h" |
| 13 #include "ppapi/c/pp_size.h" |
| 14 #include "ppapi/c/pp_var.h" |
| 15 #include "ppapi/proxy/interface_proxy.h" |
| 16 |
| 17 struct PPB_URLLoader_Dev; |
| 18 |
| 19 namespace pp { |
| 20 namespace proxy { |
| 21 |
| 22 class PPB_URLLoader_Proxy : public InterfaceProxy, |
| 23 public base::SupportsWeakPtr<PPB_URLLoader_Proxy> { |
| 24 public: |
| 25 PPB_URLLoader_Proxy(Dispatcher* dispatcher, const void* target_interface); |
| 26 virtual ~PPB_URLLoader_Proxy(); |
| 27 |
| 28 // URLLoader objects are normally allocated by the Create function, but |
| 29 // they are also provided to PPP_Instance.OnMsgHandleDocumentLoad. This |
| 30 // function allows the proxy for DocumentLoad to create the correct plugin |
| 31 // proxied info for the given browser-supplied URLLoader resource ID. |
| 32 static void TrackPluginResource(PP_Resource url_loader_resource); |
| 33 |
| 34 const PPB_URLLoader_Dev* ppb_url_loader_target() const { |
| 35 return reinterpret_cast<const PPB_URLLoader_Dev*>(target_interface()); |
| 36 } |
| 37 |
| 38 // InterfaceProxy implementation. |
| 39 virtual const void* GetSourceInterface() const; |
| 40 virtual InterfaceID GetInterfaceId() const; |
| 41 virtual void OnMessageReceived(const IPC::Message& msg); |
| 42 |
| 43 private: |
| 44 // Plugin->renderer message handlers. |
| 45 void OnMsgCreate(PP_Instance instance, |
| 46 PP_Resource* result); |
| 47 void OnMsgOpen(PP_Resource loader, |
| 48 PP_Resource request_info, |
| 49 uint32_t serialized_callback); |
| 50 void OnMsgFollowRedirect(PP_Resource loader, |
| 51 uint32_t serialized_callback); |
| 52 void OnMsgGetResponseInfo(PP_Resource loader, |
| 53 PP_Resource* result); |
| 54 void OnMsgReadResponseBody(PP_Resource loader, |
| 55 int32_t bytes_to_read); |
| 56 void OnMsgFinishStreamingToFile(PP_Resource loader, |
| 57 uint32_t serialized_callback); |
| 58 void OnMsgClose(PP_Resource loader); |
| 59 |
| 60 // Renderer->plugin message handlers. |
| 61 void OnMsgUpdateProgress(PP_Resource resource, |
| 62 int64_t bytes_sent, |
| 63 int64_t total_bytes_to_be_sent, |
| 64 int64_t bytes_received, |
| 65 int64_t total_bytes_to_be_received); |
| 66 void OnMsgReadResponseBodyAck(PP_Resource pp_resource, |
| 67 int32_t result, |
| 68 const std::string& data); |
| 69 }; |
| 70 |
| 71 } // namespace proxy |
| 72 } // namespace pp |
| 73 |
| 74 #endif // PPAPI_PPB_URL_LOADER_PROXY_H_ |
OLD | NEW |