summaryrefslogtreecommitdiffstats
path: root/ppapi/thunk
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-10 17:23:57 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-10 17:23:57 +0000
commit0346023c3a4180f8cf67d4e825beb87bdbd98f73 (patch)
tree333733068c017be1aa53e0af945c0a0cecc6318d /ppapi/thunk
parentcf58c966ebdca1fcf2adbbe4a2f5bad875a8382a (diff)
downloadchromium_src-0346023c3a4180f8cf67d4e825beb87bdbd98f73.zip
chromium_src-0346023c3a4180f8cf67d4e825beb87bdbd98f73.tar.gz
chromium_src-0346023c3a4180f8cf67d4e825beb87bdbd98f73.tar.bz2
Convert URLUtil to the thunk system.
This removes some duplicate code between the proxy and the impl. Review URL: http://codereview.chromium.org/8159012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@104741 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/thunk')
-rw-r--r--ppapi/thunk/interfaces_ppb_public_dev.h1
-rw-r--r--ppapi/thunk/ppb_instance_api.h14
-rw-r--r--ppapi/thunk/ppb_instance_thunk.cc10
-rw-r--r--ppapi/thunk/ppb_url_util_thunk.cc74
4 files changed, 94 insertions, 5 deletions
diff --git a/ppapi/thunk/interfaces_ppb_public_dev.h b/ppapi/thunk/interfaces_ppb_public_dev.h
index ced24e6..fb744db0 100644
--- a/ppapi/thunk/interfaces_ppb_public_dev.h
+++ b/ppapi/thunk/interfaces_ppb_public_dev.h
@@ -46,6 +46,7 @@ PROXIED_IFACE(PPB_Instance, PPB_MOUSELOCK_DEV_INTERFACE_0_1,
PPB_MouseLock_Dev)
UNPROXIED_IFACE(PPB_Instance, PPB_QUERYPOLICY_DEV_INTERFACE_0_1,
PPB_QueryPolicy_Dev)
+PROXIED_IFACE(PPB_Instance, PPB_URLUTIL_DEV_INTERFACE_0_6, PPB_URLUtil_Dev)
UNPROXIED_IFACE(PPB_Instance, PPB_ZOOM_DEV_INTERFACE_0_2, PPB_Zoom_Dev)
UNPROXIED_IFACE(PPB_LayerCompositor, PPB_LAYER_COMPOSITOR_DEV_INTERFACE_0_2,
PPB_LayerCompositor_Dev)
diff --git a/ppapi/thunk/ppb_instance_api.h b/ppapi/thunk/ppb_instance_api.h
index 0ce23f4..fa66e2e 100644
--- a/ppapi/thunk/ppb_instance_api.h
+++ b/ppapi/thunk/ppb_instance_api.h
@@ -5,6 +5,7 @@
#ifndef PPAPI_THUNK_INSTANCE_API_H_
#define PPAPI_THUNK_INSTANCE_API_H_
+#include "ppapi/c/dev/ppb_url_util_dev.h"
#include "ppapi/c/pp_completion_callback.h"
#include "ppapi/c/ppb_instance.h"
#include "ppapi/c/pp_bool.h"
@@ -82,6 +83,19 @@ class PPB_Instance_FunctionAPI {
// QueryPolicy.
virtual void SubscribeToPolicyUpdates(PP_Instance instance) = 0;
+ // URLUtil.
+ virtual PP_Var ResolveRelativeToDocument(
+ PP_Instance instance,
+ PP_Var relative,
+ PP_URLComponents_Dev* components) = 0;
+ virtual PP_Bool DocumentCanRequest(PP_Instance instance, PP_Var url) = 0;
+ virtual PP_Bool DocumentCanAccessDocument(PP_Instance instance,
+ PP_Instance target) = 0;
+ virtual PP_Var GetDocumentURL(PP_Instance instance,
+ PP_URLComponents_Dev* components) = 0;
+ virtual PP_Var GetPluginInstanceURL(PP_Instance instance,
+ PP_URLComponents_Dev* components) = 0;
+
static const proxy::InterfaceID interface_id =
proxy::INTERFACE_ID_PPB_INSTANCE;
};
diff --git a/ppapi/thunk/ppb_instance_thunk.cc b/ppapi/thunk/ppb_instance_thunk.cc
index 9cc9bd5..07951bc 100644
--- a/ppapi/thunk/ppb_instance_thunk.cc
+++ b/ppapi/thunk/ppb_instance_thunk.cc
@@ -13,28 +13,28 @@ namespace thunk {
namespace {
PP_Var GetWindowObject(PP_Instance instance) {
- EnterFunction<PPB_Instance_FunctionAPI> enter(instance, true);
+ EnterInstance enter(instance);
if (enter.failed())
return PP_MakeUndefined();
return enter.functions()->GetWindowObject(instance);
}
PP_Var GetOwnerElementObject(PP_Instance instance) {
- EnterFunction<PPB_Instance_FunctionAPI> enter(instance, true);
+ EnterInstance enter(instance);
if (enter.failed())
return PP_MakeUndefined();
return enter.functions()->GetOwnerElementObject(instance);
}
PP_Bool BindGraphics(PP_Instance instance, PP_Resource graphics_id) {
- EnterFunction<PPB_Instance_FunctionAPI> enter(instance, true);
+ EnterInstance enter(instance);
if (enter.failed())
return PP_FALSE;
return enter.functions()->BindGraphics(instance, graphics_id);
}
PP_Bool IsFullFrame(PP_Instance instance) {
- EnterFunction<PPB_Instance_FunctionAPI> enter(instance, true);
+ EnterInstance enter(instance);
if (enter.failed())
return PP_FALSE;
return enter.functions()->IsFullFrame(instance);
@@ -43,7 +43,7 @@ PP_Bool IsFullFrame(PP_Instance instance) {
PP_Var ExecuteScript(PP_Instance instance,
PP_Var script,
PP_Var* exception) {
- EnterFunction<PPB_Instance_FunctionAPI> enter(instance, true);
+ EnterInstance enter(instance);
if (enter.failed())
return PP_MakeUndefined();
return enter.functions()->ExecuteScript(instance, script, exception);
diff --git a/ppapi/thunk/ppb_url_util_thunk.cc b/ppapi/thunk/ppb_url_util_thunk.cc
new file mode 100644
index 0000000..1a6b4a8
--- /dev/null
+++ b/ppapi/thunk/ppb_url_util_thunk.cc
@@ -0,0 +1,74 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/shared_impl/url_util_impl.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_instance_api.h"
+#include "ppapi/thunk/thunk.h"
+
+namespace ppapi {
+namespace thunk {
+
+namespace {
+
+PP_Var ResolveRelativeToDocument(PP_Instance instance,
+ PP_Var relative,
+ PP_URLComponents_Dev* components) {
+ EnterInstance enter(instance);
+ if (enter.failed())
+ return PP_MakeUndefined();
+ return enter.functions()->ResolveRelativeToDocument(instance, relative,
+ components);
+}
+
+PP_Bool DocumentCanRequest(PP_Instance instance, PP_Var url) {
+ EnterInstance enter(instance);
+ if (enter.failed())
+ return PP_FALSE;
+ return enter.functions()->DocumentCanRequest(instance, url);
+}
+
+PP_Bool DocumentCanAccessDocument(PP_Instance active, PP_Instance target) {
+ EnterInstance enter(active);
+ if (enter.failed())
+ return PP_FALSE;
+ return enter.functions()->DocumentCanAccessDocument(active, target);
+}
+
+PP_Var GetDocumentURL(PP_Instance instance,
+ PP_URLComponents_Dev* components) {
+ EnterInstance enter(instance);
+ if (enter.failed())
+ return PP_MakeUndefined();
+ return enter.functions()->GetDocumentURL(instance, components);
+}
+
+PP_Var GetPluginInstanceURL(PP_Instance instance,
+ PP_URLComponents_Dev* components) {
+ EnterInstance enter(instance);
+ if (enter.failed())
+ return PP_MakeUndefined();
+ return enter.functions()->GetPluginInstanceURL(instance, components);
+}
+
+const PPB_URLUtil_Dev g_ppb_url_util = {
+ &URLUtilImpl::Canonicalize,
+ &URLUtilImpl::ResolveRelativeToURL,
+ &ResolveRelativeToDocument,
+ &URLUtilImpl::IsSameSecurityOrigin,
+ &DocumentCanRequest,
+ &DocumentCanAccessDocument,
+ &GetDocumentURL,
+ &GetPluginInstanceURL
+};
+
+} // namespace
+
+const PPB_URLUtil_Dev* GetPPB_URLUtil_Dev_Thunk() {
+ return &g_ppb_url_util;
+}
+
+} // namespace thunk
+} // namespace ppapi