| OLD | NEW |
| 1 // Copyright (c) 2010 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_PROXY_PPB_URL_RESPONSE_INFO_PROXY_H_ | 5 #ifndef PPAPI_PROXY_PPB_URL_RESPONSE_INFO_PROXY_H_ |
| 6 #define PPAPI_PROXY_PPB_URL_RESPONSE_INFO_PROXY_H_ | 6 #define PPAPI_PROXY_PPB_URL_RESPONSE_INFO_PROXY_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.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" |
| 11 #include "ppapi/c/pp_resource.h" | 11 #include "ppapi/c/pp_resource.h" |
| 12 #include "ppapi/proxy/interface_proxy.h" | 12 #include "ppapi/proxy/interface_proxy.h" |
| 13 #include "ppapi/proxy/serialized_resource.h" |
| 13 | 14 |
| 14 struct PPB_URLResponseInfo; | 15 struct PPB_URLResponseInfo; |
| 15 | 16 |
| 16 namespace pp { | 17 namespace pp { |
| 17 namespace proxy { | 18 namespace proxy { |
| 18 | 19 |
| 19 class SerializedVarReturnValue; | 20 class SerializedVarReturnValue; |
| 20 | 21 |
| 21 class PPB_URLResponseInfo_Proxy : public InterfaceProxy { | 22 class PPB_URLResponseInfo_Proxy : public InterfaceProxy { |
| 22 public: | 23 public: |
| 23 PPB_URLResponseInfo_Proxy(Dispatcher* dispatcher, | 24 PPB_URLResponseInfo_Proxy(Dispatcher* dispatcher, |
| 24 const void* target_interface); | 25 const void* target_interface); |
| 25 virtual ~PPB_URLResponseInfo_Proxy(); | 26 virtual ~PPB_URLResponseInfo_Proxy(); |
| 26 | 27 |
| 27 // URLResponseInfo objects are actually returned by the URLLoader class. | 28 // URLResponseInfo objects are actually created and returned by the |
| 28 // This function allows the URLLoader proxy to start the tracking of | 29 // URLLoader. This function allows the URLLoader to convert a new |
| 29 // a response info object in the plugin. | 30 // SerializedResource representing a response info to a properly tracked |
| 30 static void TrackPluginResource(PP_Instance instance, | 31 // URLReponseInfo PluginResource. Returns the plugin resource ID for the |
| 31 PP_Resource response_resource); | 32 // new resource. |
| 33 static PP_Resource CreateResponseForResource(PP_Instance instance, |
| 34 SerializedResource resource); |
| 32 | 35 |
| 33 const PPB_URLResponseInfo* ppb_url_response_info_target() const { | 36 const PPB_URLResponseInfo* ppb_url_response_info_target() const { |
| 34 return static_cast<const PPB_URLResponseInfo*>(target_interface()); | 37 return static_cast<const PPB_URLResponseInfo*>(target_interface()); |
| 35 } | 38 } |
| 36 | 39 |
| 37 // InterfaceProxy implementation. | 40 // InterfaceProxy implementation. |
| 38 virtual const void* GetSourceInterface() const; | 41 virtual const void* GetSourceInterface() const; |
| 39 virtual InterfaceID GetInterfaceId() const; | 42 virtual InterfaceID GetInterfaceId() const; |
| 40 virtual bool OnMessageReceived(const IPC::Message& msg); | 43 virtual bool OnMessageReceived(const IPC::Message& msg); |
| 41 | 44 |
| 42 private: | 45 private: |
| 43 // Message handlers. | 46 // Message handlers. |
| 44 void OnMsgGetProperty(PP_Resource response, | 47 void OnMsgGetProperty(SerializedResource response, |
| 45 int32_t property, | 48 int32_t property, |
| 46 SerializedVarReturnValue result); | 49 SerializedVarReturnValue result); |
| 47 void OnMsgGetBodyAsFileRef(PP_Resource response, | 50 void OnMsgGetBodyAsFileRef(SerializedResource response, |
| 48 PP_Resource* file_ref_result); | 51 SerializedResource* file_ref_result); |
| 49 | 52 |
| 50 DISALLOW_COPY_AND_ASSIGN(PPB_URLResponseInfo_Proxy); | 53 DISALLOW_COPY_AND_ASSIGN(PPB_URLResponseInfo_Proxy); |
| 51 }; | 54 }; |
| 52 | 55 |
| 53 } // namespace proxy | 56 } // namespace proxy |
| 54 } // namespace pp | 57 } // namespace pp |
| 55 | 58 |
| 56 #endif // PPAPI_PROXY_PPB_URL_RESPONSE_INFO_PROXY_H_ | 59 #endif // PPAPI_PROXY_PPB_URL_RESPONSE_INFO_PROXY_H_ |
| OLD | NEW |