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_util_proxy.h" | 5 #include "ppapi/proxy/ppb_url_util_proxy.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "ppapi/c/dev/ppb_url_util_dev.h" | 8 #include "ppapi/c/dev/ppb_url_util_dev.h" |
9 #include "ppapi/c/dev/ppb_var_deprecated.h" | 9 #include "ppapi/c/dev/ppb_var_deprecated.h" |
10 #include "ppapi/c/ppb_core.h" | 10 #include "ppapi/c/ppb_core.h" |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 &Canonicalize, | 122 &Canonicalize, |
123 &ResolveRelativeToURL, | 123 &ResolveRelativeToURL, |
124 &ResolveRelativeToDocument, | 124 &ResolveRelativeToDocument, |
125 &IsSameSecurityOrigin, | 125 &IsSameSecurityOrigin, |
126 &DocumentCanRequest, | 126 &DocumentCanRequest, |
127 &DocumentCanAccessDocument, | 127 &DocumentCanAccessDocument, |
128 &GetDocumentURL, | 128 &GetDocumentURL, |
129 &GetPluginInstanceURL | 129 &GetPluginInstanceURL |
130 }; | 130 }; |
131 | 131 |
132 InterfaceProxy* CreateURLUtilProxy(Dispatcher* dispatcher) { | 132 InterfaceProxy* CreateURLUtilProxy(Dispatcher* dispatcher, |
133 return new PPB_URLUtil_Proxy(dispatcher); | 133 const void* target_interface) { |
| 134 return new PPB_URLUtil_Proxy(dispatcher, target_interface); |
134 } | 135 } |
135 | 136 |
136 } // namespace | 137 } // namespace |
137 | 138 |
138 PPB_URLUtil_Proxy::PPB_URLUtil_Proxy(Dispatcher* dispatcher) | 139 PPB_URLUtil_Proxy::PPB_URLUtil_Proxy(Dispatcher* dispatcher, |
139 : InterfaceProxy(dispatcher), | 140 const void* target_interface) |
140 ppb_url_util_impl_(NULL) { | 141 : InterfaceProxy(dispatcher, target_interface) { |
141 if (!dispatcher->IsPlugin()) { | |
142 ppb_url_util_impl_ = static_cast<const PPB_URLUtil_Dev*>( | |
143 dispatcher->local_get_interface()(PPB_URLUTIL_DEV_INTERFACE)); | |
144 } | |
145 } | 142 } |
146 | 143 |
147 PPB_URLUtil_Proxy::~PPB_URLUtil_Proxy() { | 144 PPB_URLUtil_Proxy::~PPB_URLUtil_Proxy() { |
148 } | 145 } |
149 | 146 |
150 // static | 147 // static |
151 const InterfaceProxy::Info* PPB_URLUtil_Proxy::GetInfo() { | 148 const InterfaceProxy::Info* PPB_URLUtil_Proxy::GetInfo() { |
152 static const Info info = { | 149 static const Info info = { |
153 &url_util_interface, | 150 &url_util_interface, |
154 PPB_URLUTIL_DEV_INTERFACE, | 151 PPB_URLUTIL_DEV_INTERFACE, |
(...skipping 20 matching lines...) Expand all Loading... |
175 IPC_MESSAGE_UNHANDLED(handled = false) | 172 IPC_MESSAGE_UNHANDLED(handled = false) |
176 IPC_END_MESSAGE_MAP() | 173 IPC_END_MESSAGE_MAP() |
177 return handled; | 174 return handled; |
178 } | 175 } |
179 | 176 |
180 void PPB_URLUtil_Proxy::OnMsgResolveRelativeToDocument( | 177 void PPB_URLUtil_Proxy::OnMsgResolveRelativeToDocument( |
181 PP_Instance instance, | 178 PP_Instance instance, |
182 SerializedVarReceiveInput relative, | 179 SerializedVarReceiveInput relative, |
183 SerializedVarReturnValue result) { | 180 SerializedVarReturnValue result) { |
184 result.Return(dispatcher(), | 181 result.Return(dispatcher(), |
185 ppb_url_util_impl_->ResolveRelativeToDocument( | 182 ppb_url_util_target()->ResolveRelativeToDocument( |
186 instance, relative.Get(dispatcher()), NULL)); | 183 instance, relative.Get(dispatcher()), NULL)); |
187 } | 184 } |
188 | 185 |
189 void PPB_URLUtil_Proxy::OnMsgDocumentCanRequest(PP_Instance instance, | 186 void PPB_URLUtil_Proxy::OnMsgDocumentCanRequest(PP_Instance instance, |
190 SerializedVarReceiveInput url, | 187 SerializedVarReceiveInput url, |
191 PP_Bool* result) { | 188 PP_Bool* result) { |
192 *result = ppb_url_util_impl_->DocumentCanRequest(instance, | 189 *result = ppb_url_util_target()->DocumentCanRequest(instance, |
193 url.Get(dispatcher())); | 190 url.Get(dispatcher())); |
194 } | 191 } |
195 | 192 |
196 void PPB_URLUtil_Proxy::OnMsgDocumentCanAccessDocument(PP_Instance active, | 193 void PPB_URLUtil_Proxy::OnMsgDocumentCanAccessDocument(PP_Instance active, |
197 PP_Instance target, | 194 PP_Instance target, |
198 PP_Bool* result) { | 195 PP_Bool* result) { |
199 *result = ppb_url_util_impl_->DocumentCanAccessDocument( | 196 *result = ppb_url_util_target()->DocumentCanAccessDocument( |
200 active, target); | 197 active, target); |
201 } | 198 } |
202 | 199 |
203 void PPB_URLUtil_Proxy::OnMsgGetDocumentURL(PP_Instance instance, | 200 void PPB_URLUtil_Proxy::OnMsgGetDocumentURL(PP_Instance instance, |
204 SerializedVarReturnValue result) { | 201 SerializedVarReturnValue result) { |
205 result.Return(dispatcher(), | 202 result.Return(dispatcher(), |
206 ppb_url_util_impl_->GetDocumentURL(instance, NULL)); | 203 ppb_url_util_target()->GetDocumentURL(instance, NULL)); |
207 } | 204 } |
208 | 205 |
209 void PPB_URLUtil_Proxy::OnMsgGetPluginInstanceURL( | 206 void PPB_URLUtil_Proxy::OnMsgGetPluginInstanceURL( |
210 PP_Instance instance, SerializedVarReturnValue result) { | 207 PP_Instance instance, SerializedVarReturnValue result) { |
211 result.Return(dispatcher(), | 208 result.Return(dispatcher(), |
212 ppb_url_util_impl_->GetPluginInstanceURL(instance, NULL)); | 209 ppb_url_util_target()->GetPluginInstanceURL(instance, NULL)); |
213 } | 210 } |
214 | 211 |
215 } // namespace proxy | 212 } // namespace proxy |
216 } // namespace ppapi | 213 } // namespace ppapi |
217 | 214 |
OLD | NEW |