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 const void* target_interface) { | 133 return new PPB_URLUtil_Proxy(dispatcher); |
134 return new PPB_URLUtil_Proxy(dispatcher, target_interface); | |
135 } | 134 } |
136 | 135 |
137 } // namespace | 136 } // namespace |
138 | 137 |
139 PPB_URLUtil_Proxy::PPB_URLUtil_Proxy(Dispatcher* dispatcher, | 138 PPB_URLUtil_Proxy::PPB_URLUtil_Proxy(Dispatcher* dispatcher) |
140 const void* target_interface) | 139 : InterfaceProxy(dispatcher), |
141 : InterfaceProxy(dispatcher, target_interface) { | 140 ppb_url_util_impl_(NULL) { |
| 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 } |
142 } | 145 } |
143 | 146 |
144 PPB_URLUtil_Proxy::~PPB_URLUtil_Proxy() { | 147 PPB_URLUtil_Proxy::~PPB_URLUtil_Proxy() { |
145 } | 148 } |
146 | 149 |
147 // static | 150 // static |
148 const InterfaceProxy::Info* PPB_URLUtil_Proxy::GetInfo() { | 151 const InterfaceProxy::Info* PPB_URLUtil_Proxy::GetInfo() { |
149 static const Info info = { | 152 static const Info info = { |
150 &url_util_interface, | 153 &url_util_interface, |
151 PPB_URLUTIL_DEV_INTERFACE, | 154 PPB_URLUTIL_DEV_INTERFACE, |
(...skipping 20 matching lines...) Expand all Loading... |
172 IPC_MESSAGE_UNHANDLED(handled = false) | 175 IPC_MESSAGE_UNHANDLED(handled = false) |
173 IPC_END_MESSAGE_MAP() | 176 IPC_END_MESSAGE_MAP() |
174 return handled; | 177 return handled; |
175 } | 178 } |
176 | 179 |
177 void PPB_URLUtil_Proxy::OnMsgResolveRelativeToDocument( | 180 void PPB_URLUtil_Proxy::OnMsgResolveRelativeToDocument( |
178 PP_Instance instance, | 181 PP_Instance instance, |
179 SerializedVarReceiveInput relative, | 182 SerializedVarReceiveInput relative, |
180 SerializedVarReturnValue result) { | 183 SerializedVarReturnValue result) { |
181 result.Return(dispatcher(), | 184 result.Return(dispatcher(), |
182 ppb_url_util_target()->ResolveRelativeToDocument( | 185 ppb_url_util_impl_->ResolveRelativeToDocument( |
183 instance, relative.Get(dispatcher()), NULL)); | 186 instance, relative.Get(dispatcher()), NULL)); |
184 } | 187 } |
185 | 188 |
186 void PPB_URLUtil_Proxy::OnMsgDocumentCanRequest(PP_Instance instance, | 189 void PPB_URLUtil_Proxy::OnMsgDocumentCanRequest(PP_Instance instance, |
187 SerializedVarReceiveInput url, | 190 SerializedVarReceiveInput url, |
188 PP_Bool* result) { | 191 PP_Bool* result) { |
189 *result = ppb_url_util_target()->DocumentCanRequest(instance, | 192 *result = ppb_url_util_impl_->DocumentCanRequest(instance, |
190 url.Get(dispatcher())); | 193 url.Get(dispatcher())); |
191 } | 194 } |
192 | 195 |
193 void PPB_URLUtil_Proxy::OnMsgDocumentCanAccessDocument(PP_Instance active, | 196 void PPB_URLUtil_Proxy::OnMsgDocumentCanAccessDocument(PP_Instance active, |
194 PP_Instance target, | 197 PP_Instance target, |
195 PP_Bool* result) { | 198 PP_Bool* result) { |
196 *result = ppb_url_util_target()->DocumentCanAccessDocument( | 199 *result = ppb_url_util_impl_->DocumentCanAccessDocument( |
197 active, target); | 200 active, target); |
198 } | 201 } |
199 | 202 |
200 void PPB_URLUtil_Proxy::OnMsgGetDocumentURL(PP_Instance instance, | 203 void PPB_URLUtil_Proxy::OnMsgGetDocumentURL(PP_Instance instance, |
201 SerializedVarReturnValue result) { | 204 SerializedVarReturnValue result) { |
202 result.Return(dispatcher(), | 205 result.Return(dispatcher(), |
203 ppb_url_util_target()->GetDocumentURL(instance, NULL)); | 206 ppb_url_util_impl_->GetDocumentURL(instance, NULL)); |
204 } | 207 } |
205 | 208 |
206 void PPB_URLUtil_Proxy::OnMsgGetPluginInstanceURL( | 209 void PPB_URLUtil_Proxy::OnMsgGetPluginInstanceURL( |
207 PP_Instance instance, SerializedVarReturnValue result) { | 210 PP_Instance instance, SerializedVarReturnValue result) { |
208 result.Return(dispatcher(), | 211 result.Return(dispatcher(), |
209 ppb_url_util_target()->GetPluginInstanceURL(instance, NULL)); | 212 ppb_url_util_impl_->GetPluginInstanceURL(instance, NULL)); |
210 } | 213 } |
211 | 214 |
212 } // namespace proxy | 215 } // namespace proxy |
213 } // namespace ppapi | 216 } // namespace ppapi |
214 | 217 |
OLD | NEW |