| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef PPAPI_PPB_URL_LOADER_PROXY_H_ | 5 #ifndef PPAPI_PPB_URL_LOADER_PROXY_H_ |
| 6 #define PPAPI_PPB_URL_LOADER_PROXY_H_ | 6 #define PPAPI_PPB_URL_LOADER_PROXY_H_ |
| 7 | 7 |
| 8 #include "ppapi/c/pp_completion_callback.h" | 8 #include "ppapi/c/pp_completion_callback.h" |
| 9 #include "ppapi/c/pp_instance.h" | 9 #include "ppapi/c/pp_instance.h" |
| 10 #include "ppapi/c/pp_module.h" | 10 #include "ppapi/c/pp_module.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 namespace ppapi { | 22 namespace ppapi { |
| 23 | 23 |
| 24 struct PPB_URLRequestInfo_Data; | 24 struct PPB_URLRequestInfo_Data; |
| 25 | 25 |
| 26 namespace proxy { | 26 namespace proxy { |
| 27 | 27 |
| 28 struct PPBURLLoader_UpdateProgress_Params; | 28 struct PPBURLLoader_UpdateProgress_Params; |
| 29 | 29 |
| 30 class PPB_URLLoader_Proxy : public InterfaceProxy { | 30 class PPB_URLLoader_Proxy : public InterfaceProxy { |
| 31 public: | 31 public: |
| 32 PPB_URLLoader_Proxy(Dispatcher* dispatcher); | 32 PPB_URLLoader_Proxy(Dispatcher* dispatcher, const void* target_interface); |
| 33 virtual ~PPB_URLLoader_Proxy(); | 33 virtual ~PPB_URLLoader_Proxy(); |
| 34 | 34 |
| 35 static const Info* GetInfo(); |
| 35 static const Info* GetTrustedInfo(); | 36 static const Info* GetTrustedInfo(); |
| 36 | 37 |
| 37 static PP_Resource CreateProxyResource(PP_Instance instance); | 38 static PP_Resource CreateProxyResource(PP_Instance instance); |
| 38 | 39 |
| 39 // URLLoader objects are normally allocated by the Create function, but | 40 // URLLoader objects are normally allocated by the Create function, but |
| 40 // they are also provided to PPP_Instance.OnMsgHandleDocumentLoad. This | 41 // they are also provided to PPP_Instance.OnMsgHandleDocumentLoad. This |
| 41 // function allows the proxy for DocumentLoad to create the correct plugin | 42 // function allows the proxy for DocumentLoad to create the correct plugin |
| 42 // proxied info for the given browser-supplied URLLoader resource ID. | 43 // proxied info for the given browser-supplied URLLoader resource ID. |
| 43 static PP_Resource TrackPluginResource( | 44 static PP_Resource TrackPluginResource( |
| 44 const ppapi::HostResource& url_loader_resource); | 45 const ppapi::HostResource& url_loader_resource); |
| 45 | 46 |
| 47 const PPB_URLLoader* ppb_url_loader_target() const { |
| 48 return reinterpret_cast<const PPB_URLLoader*>(target_interface()); |
| 49 } |
| 50 |
| 46 // InterfaceProxy implementation. | 51 // InterfaceProxy implementation. |
| 47 virtual bool OnMessageReceived(const IPC::Message& msg); | 52 virtual bool OnMessageReceived(const IPC::Message& msg); |
| 48 | 53 |
| 49 // URLLoader objects are sent from places other than just URLLoader.Create, | 54 // URLLoader objects are sent from places other than just URLLoader.Create, |
| 50 // in particular when doing a full-frame plugin. This function does the | 55 // in particular when doing a full-frame plugin. This function does the |
| 51 // necessary setup in the host before the resource is sent. Call this any | 56 // necessary setup in the host before the resource is sent. Call this any |
| 52 // time you're sending a new URLLoader that the plugin hasn't seen yet. | 57 // time you're sending a new URLLoader that the plugin hasn't seen yet. |
| 53 void PrepareURLLoaderForSendingToPlugin(PP_Resource resource); | 58 void PrepareURLLoaderForSendingToPlugin(PP_Resource resource); |
| 54 | 59 |
| 55 static const InterfaceID kInterfaceID = INTERFACE_ID_PPB_URL_LOADER; | |
| 56 | |
| 57 private: | 60 private: |
| 58 // Data associated with callbacks for ReadResponseBody. | 61 // Data associated with callbacks for ReadResponseBody. |
| 59 struct ReadCallbackInfo; | 62 struct ReadCallbackInfo; |
| 60 | 63 |
| 61 // Plugin->renderer message handlers. | 64 // Plugin->renderer message handlers. |
| 62 void OnMsgCreate(PP_Instance instance, | 65 void OnMsgCreate(PP_Instance instance, |
| 63 ppapi::HostResource* result); | 66 ppapi::HostResource* result); |
| 64 void OnMsgOpen(const ppapi::HostResource& loader, | 67 void OnMsgOpen(const ppapi::HostResource& loader, |
| 65 const PPB_URLRequestInfo_Data& data, | 68 const PPB_URLRequestInfo_Data& data, |
| 66 uint32_t serialized_callback); | 69 uint32_t serialized_callback); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 91 | 94 |
| 92 // Valid only in the host, this lazily-initialized pointer indicates the | 95 // Valid only in the host, this lazily-initialized pointer indicates the |
| 93 // URLLoaderTrusted interface. | 96 // URLLoaderTrusted interface. |
| 94 const PPB_URLLoaderTrusted* host_urlloader_trusted_interface_; | 97 const PPB_URLLoaderTrusted* host_urlloader_trusted_interface_; |
| 95 }; | 98 }; |
| 96 | 99 |
| 97 } // namespace proxy | 100 } // namespace proxy |
| 98 } // namespace ppapi | 101 } // namespace ppapi |
| 99 | 102 |
| 100 #endif // PPAPI_PPB_URL_LOADER_PROXY_H_ | 103 #endif // PPAPI_PPB_URL_LOADER_PROXY_H_ |
| OLD | NEW |