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