Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(945)

Unified Diff: ppapi/thunk/ppb_broker_thunk.cc

Issue 11316316: Implement an IsAllowed function in the pepper PPB_Broker_Trusted API (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ppapi/thunk/ppb_broker_api.h ('k') | webkit/plugins/ppapi/host_var_tracker_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/thunk/ppb_broker_thunk.cc
diff --git a/ppapi/thunk/ppb_broker_thunk.cc b/ppapi/thunk/ppb_broker_thunk.cc
index fa192b6f48017753382422a69fa9085191341952..0f2f1c9ebd06f72ae382a3dae2f1b95d1d7d7cce 100644
--- a/ppapi/thunk/ppb_broker_thunk.cc
+++ b/ppapi/thunk/ppb_broker_thunk.cc
@@ -42,17 +42,44 @@ int32_t GetHandle(PP_Resource resource, int32_t* handle) {
return enter.object()->GetHandle(handle);
}
-const PPB_BrokerTrusted g_ppb_broker_thunk = {
+PP_Bool IsAllowed(PP_Resource resource) {
+ // TODO(raymes): This is a hack. See the note in ppb_broker_api.h.
+ PP_Instance instance = 0;
+ {
+ EnterResource<PPB_Broker_API> enter_resource(resource, true);
+ if (enter_resource.failed())
+ return PP_FALSE;
+ instance = enter_resource.resource()->pp_instance();
+ }
+ EnterInstanceAPI<PPB_Broker_Instance_API> enter_instance(instance);
+ if (enter_instance.failed())
+ return PP_FALSE;
+ return enter_instance.functions()->IsAllowed();
+}
+
+const PPB_BrokerTrusted_0_2 g_ppb_broker_0_2_thunk = {
+ &CreateTrusted,
+ &IsBrokerTrusted,
+ &Connect,
+ &GetHandle,
+};
+
+const PPB_BrokerTrusted_0_3 g_ppb_broker_0_3_thunk = {
&CreateTrusted,
&IsBrokerTrusted,
&Connect,
&GetHandle,
+ &IsAllowed,
};
} // namespace
const PPB_BrokerTrusted_0_2* GetPPB_BrokerTrusted_0_2_Thunk() {
- return &g_ppb_broker_thunk;
+ return &g_ppb_broker_0_2_thunk;
+}
+
+const PPB_BrokerTrusted_0_3* GetPPB_BrokerTrusted_0_3_Thunk() {
+ return &g_ppb_broker_0_3_thunk;
}
} // namespace thunk
« no previous file with comments | « ppapi/thunk/ppb_broker_api.h ('k') | webkit/plugins/ppapi/host_var_tracker_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698