OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/enter_proxy.h" | 8 #include "ppapi/proxy/enter_proxy.h" |
9 #include "ppapi/proxy/host_dispatcher.h" | 9 #include "ppapi/proxy/host_dispatcher.h" |
10 #include "ppapi/proxy/plugin_dispatcher.h" | 10 #include "ppapi/proxy/plugin_dispatcher.h" |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 | 80 |
81 // static | 81 // static |
82 PP_Resource PPB_URLResponseInfo_Proxy::CreateResponseForResource( | 82 PP_Resource PPB_URLResponseInfo_Proxy::CreateResponseForResource( |
83 const HostResource& resource) { | 83 const HostResource& resource) { |
84 return (new URLResponseInfo(resource))->GetReference(); | 84 return (new URLResponseInfo(resource))->GetReference(); |
85 } | 85 } |
86 | 86 |
87 bool PPB_URLResponseInfo_Proxy::OnMessageReceived(const IPC::Message& msg) { | 87 bool PPB_URLResponseInfo_Proxy::OnMessageReceived(const IPC::Message& msg) { |
88 bool handled = true; | 88 bool handled = true; |
89 IPC_BEGIN_MESSAGE_MAP(PPB_URLResponseInfo_Proxy, msg) | 89 IPC_BEGIN_MESSAGE_MAP(PPB_URLResponseInfo_Proxy, msg) |
| 90 #if !defined(OS_NACL) |
90 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBURLResponseInfo_GetProperty, | 91 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBURLResponseInfo_GetProperty, |
91 OnMsgGetProperty) | 92 OnMsgGetProperty) |
92 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBURLResponseInfo_GetBodyAsFileRef, | 93 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBURLResponseInfo_GetBodyAsFileRef, |
93 OnMsgGetBodyAsFileRef) | 94 OnMsgGetBodyAsFileRef) |
| 95 #endif |
94 IPC_MESSAGE_UNHANDLED(handled = false) | 96 IPC_MESSAGE_UNHANDLED(handled = false) |
95 IPC_END_MESSAGE_MAP() | 97 IPC_END_MESSAGE_MAP() |
96 // TODO(brettw): handle bad messages. | 98 // TODO(brettw): handle bad messages. |
97 return handled; | 99 return handled; |
98 } | 100 } |
99 | 101 |
| 102 #if !defined(OS_NACL) |
100 void PPB_URLResponseInfo_Proxy::OnMsgGetProperty( | 103 void PPB_URLResponseInfo_Proxy::OnMsgGetProperty( |
101 const HostResource& response, | 104 const HostResource& response, |
102 int32_t property, | 105 int32_t property, |
103 SerializedVarReturnValue result) { | 106 SerializedVarReturnValue result) { |
104 EnterHostFromHostResource<PPB_URLResponseInfo_API> enter(response); | 107 EnterHostFromHostResource<PPB_URLResponseInfo_API> enter(response); |
105 PP_Var result_var = PP_MakeUndefined(); | 108 PP_Var result_var = PP_MakeUndefined(); |
106 if (enter.succeeded()) { | 109 if (enter.succeeded()) { |
107 result_var = enter.object()->GetProperty( | 110 result_var = enter.object()->GetProperty( |
108 static_cast<PP_URLResponseProperty>(property)); | 111 static_cast<PP_URLResponseProperty>(property)); |
109 } | 112 } |
110 result.Return(dispatcher(), result_var); | 113 result.Return(dispatcher(), result_var); |
111 } | 114 } |
112 | 115 |
113 void PPB_URLResponseInfo_Proxy::OnMsgGetBodyAsFileRef( | 116 void PPB_URLResponseInfo_Proxy::OnMsgGetBodyAsFileRef( |
114 const HostResource& response, | 117 const HostResource& response, |
115 PPB_FileRef_CreateInfo* result) { | 118 PPB_FileRef_CreateInfo* result) { |
116 EnterHostFromHostResource<PPB_URLResponseInfo_API> enter(response); | 119 EnterHostFromHostResource<PPB_URLResponseInfo_API> enter(response); |
117 PP_Resource file_ref = 0; | 120 PP_Resource file_ref = 0; |
118 if (enter.succeeded()) | 121 if (enter.succeeded()) |
119 file_ref = enter.object()->GetBodyAsFileRef(); | 122 file_ref = enter.object()->GetBodyAsFileRef(); |
120 | 123 |
121 // Use the FileRef proxy to serialize. | 124 // Use the FileRef proxy to serialize. |
122 PPB_FileRef_Proxy* file_ref_proxy = static_cast<PPB_FileRef_Proxy*>( | 125 PPB_FileRef_Proxy* file_ref_proxy = static_cast<PPB_FileRef_Proxy*>( |
123 dispatcher()->GetInterfaceProxy(API_ID_PPB_FILE_REF)); | 126 dispatcher()->GetInterfaceProxy(API_ID_PPB_FILE_REF)); |
124 file_ref_proxy->SerializeFileRef(file_ref, result); | 127 file_ref_proxy->SerializeFileRef(file_ref, result); |
125 } | 128 } |
| 129 #endif // !defined(OS_NACL) |
126 | 130 |
127 } // namespace proxy | 131 } // namespace proxy |
128 } // namespace ppapi | 132 } // namespace ppapi |
OLD | NEW |