| 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 #include "ppapi/proxy/ppb_url_response_info_proxy.h" | 5 #include "ppapi/proxy/ppb_url_response_info_proxy.h" |
| 6 | 6 |
| 7 #include "ppapi/c/ppb_url_response_info.h" | 7 #include "ppapi/c/ppb_url_response_info.h" |
| 8 #include "ppapi/proxy/plugin_dispatcher.h" | 8 #include "ppapi/proxy/plugin_dispatcher.h" |
| 9 #include "ppapi/proxy/plugin_resource.h" | 9 #include "ppapi/proxy/plugin_resource.h" |
| 10 #include "ppapi/proxy/ppapi_messages.h" | 10 #include "ppapi/proxy/ppapi_messages.h" |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 PP_Resource GetBodyAsFileRef(PP_Resource response) { | 53 PP_Resource GetBodyAsFileRef(PP_Resource response) { |
| 54 /* | 54 /* |
| 55 dispatcher->Send(new PpapiHostMsg_PPBURLResponseInfo_GetBodyAsFileRef( | 55 dispatcher->Send(new PpapiHostMsg_PPBURLResponseInfo_GetBodyAsFileRef( |
| 56 INTERFACE_ID_PPB_URL_RESPONSE_INFO, response, &result)); | 56 INTERFACE_ID_PPB_URL_RESPONSE_INFO, response, &result)); |
| 57 // TODO(brettw) when we have FileRef proxied, make an object from that | 57 // TODO(brettw) when we have FileRef proxied, make an object from that |
| 58 // ref so we can track it properly and then uncomment this. | 58 // ref so we can track it properly and then uncomment this. |
| 59 */ | 59 */ |
| 60 return 0; | 60 return 0; |
| 61 } | 61 } |
| 62 | 62 |
| 63 const PPB_URLResponseInfo ppb_urlresponseinfo = { | 63 const PPB_URLResponseInfo urlresponseinfo_interface = { |
| 64 &IsURLResponseInfo, | 64 &IsURLResponseInfo, |
| 65 &GetProperty, | 65 &GetProperty, |
| 66 &GetBodyAsFileRef | 66 &GetBodyAsFileRef |
| 67 }; | 67 }; |
| 68 | 68 |
| 69 InterfaceProxy* CreateURLResponseInfoProxy(Dispatcher* dispatcher, |
| 70 const void* target_interface) { |
| 71 return new PPB_URLResponseInfo_Proxy(dispatcher, target_interface); |
| 72 } |
| 73 |
| 69 } // namespace | 74 } // namespace |
| 70 | 75 |
| 71 PPB_URLResponseInfo_Proxy::PPB_URLResponseInfo_Proxy( | 76 PPB_URLResponseInfo_Proxy::PPB_URLResponseInfo_Proxy( |
| 72 Dispatcher* dispatcher, | 77 Dispatcher* dispatcher, |
| 73 const void* target_interface) | 78 const void* target_interface) |
| 74 : InterfaceProxy(dispatcher, target_interface) { | 79 : InterfaceProxy(dispatcher, target_interface) { |
| 75 } | 80 } |
| 76 | 81 |
| 77 PPB_URLResponseInfo_Proxy::~PPB_URLResponseInfo_Proxy() { | 82 PPB_URLResponseInfo_Proxy::~PPB_URLResponseInfo_Proxy() { |
| 78 } | 83 } |
| 79 | 84 |
| 80 // static | 85 // static |
| 86 const InterfaceProxy::Info* PPB_URLResponseInfo_Proxy::GetInfo() { |
| 87 static const Info info = { |
| 88 &urlresponseinfo_interface, |
| 89 PPB_URLRESPONSEINFO_INTERFACE, |
| 90 INTERFACE_ID_PPB_URL_RESPONSE_INFO, |
| 91 false, |
| 92 &CreateURLResponseInfoProxy, |
| 93 }; |
| 94 return &info; |
| 95 } |
| 96 |
| 97 // static |
| 81 PP_Resource PPB_URLResponseInfo_Proxy::CreateResponseForResource( | 98 PP_Resource PPB_URLResponseInfo_Proxy::CreateResponseForResource( |
| 82 const HostResource& resource) { | 99 const HostResource& resource) { |
| 83 linked_ptr<URLResponseInfo> object(new URLResponseInfo(resource)); | 100 linked_ptr<URLResponseInfo> object(new URLResponseInfo(resource)); |
| 84 return PluginResourceTracker::GetInstance()->AddResource(object); | 101 return PluginResourceTracker::GetInstance()->AddResource(object); |
| 85 } | 102 } |
| 86 | 103 |
| 87 const void* PPB_URLResponseInfo_Proxy::GetSourceInterface() const { | |
| 88 return &ppb_urlresponseinfo; | |
| 89 } | |
| 90 | |
| 91 InterfaceID PPB_URLResponseInfo_Proxy::GetInterfaceId() const { | |
| 92 return INTERFACE_ID_PPB_URL_RESPONSE_INFO; | |
| 93 } | |
| 94 | |
| 95 bool PPB_URLResponseInfo_Proxy::OnMessageReceived(const IPC::Message& msg) { | 104 bool PPB_URLResponseInfo_Proxy::OnMessageReceived(const IPC::Message& msg) { |
| 96 bool handled = true; | 105 bool handled = true; |
| 97 IPC_BEGIN_MESSAGE_MAP(PPB_URLResponseInfo_Proxy, msg) | 106 IPC_BEGIN_MESSAGE_MAP(PPB_URLResponseInfo_Proxy, msg) |
| 98 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBURLResponseInfo_GetProperty, | 107 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBURLResponseInfo_GetProperty, |
| 99 OnMsgGetProperty) | 108 OnMsgGetProperty) |
| 100 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBURLResponseInfo_GetBodyAsFileRef, | 109 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBURLResponseInfo_GetBodyAsFileRef, |
| 101 OnMsgGetBodyAsFileRef) | 110 OnMsgGetBodyAsFileRef) |
| 102 IPC_MESSAGE_UNHANDLED(handled = false) | 111 IPC_MESSAGE_UNHANDLED(handled = false) |
| 103 IPC_END_MESSAGE_MAP() | 112 IPC_END_MESSAGE_MAP() |
| 104 // TODO(brettw): handle bad messages. | 113 // TODO(brettw): handle bad messages. |
| (...skipping 12 matching lines...) Expand all Loading... |
| 117 HostResource response, | 126 HostResource response, |
| 118 HostResource* file_ref_result) { | 127 HostResource* file_ref_result) { |
| 119 file_ref_result->SetHostResource( | 128 file_ref_result->SetHostResource( |
| 120 response.instance(), | 129 response.instance(), |
| 121 ppb_url_response_info_target()->GetBodyAsFileRef( | 130 ppb_url_response_info_target()->GetBodyAsFileRef( |
| 122 response.host_resource())); | 131 response.host_resource())); |
| 123 } | 132 } |
| 124 | 133 |
| 125 } // namespace proxy | 134 } // namespace proxy |
| 126 } // namespace pp | 135 } // namespace pp |
| OLD | NEW |