From 83d12c8ddc0ce79975db70edb0ffd35305f49ee2 Mon Sep 17 00:00:00 2001 From: "raymes@chromium.org" Date: Mon, 10 Dec 2012 19:28:46 +0000 Subject: Implement an IsAllowed function in the pepper PPB_Broker_Trusted API Flash sometimes needs to synchronously know if it can launch the broker, otherwise it will try to launch the broker when it shouldn't, and end up popping an infobar. This adds an IsAllowed function to synchronously test whether the broker is allowed to launch without popping the infobar. Note that the document URL of the plugin instance is needed in order to check the broker permissions in the browser process. This is only available in the renderer process. In order to avoid an extra hop to the renderer process just to get this URL, it is sent to the browser (with the render view ID) upon initialization of the instance when the instance is registered with the browser process. BUG=163248 Review URL: https://chromiumcodereview.appspot.com/11316316 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@172104 0039d316-1c4b-4281-b951-d872f2087c98 --- ppapi/c/trusted/ppb_broker_trusted.h | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) (limited to 'ppapi/c') diff --git a/ppapi/c/trusted/ppb_broker_trusted.h b/ppapi/c/trusted/ppb_broker_trusted.h index 44b6118..019e2e9 100644 --- a/ppapi/c/trusted/ppb_broker_trusted.h +++ b/ppapi/c/trusted/ppb_broker_trusted.h @@ -3,7 +3,7 @@ * found in the LICENSE file. */ -/* From trusted/ppb_broker_trusted.idl modified Wed Oct 5 14:06:02 2011. */ +/* From trusted/ppb_broker_trusted.idl modified Mon Dec 3 11:10:40 2012. */ #ifndef PPAPI_C_TRUSTED_PPB_BROKER_TRUSTED_H_ #define PPAPI_C_TRUSTED_PPB_BROKER_TRUSTED_H_ @@ -16,7 +16,8 @@ #include "ppapi/c/pp_stdint.h" #define PPB_BROKER_TRUSTED_INTERFACE_0_2 "PPB_BrokerTrusted;0.2" -#define PPB_BROKER_TRUSTED_INTERFACE PPB_BROKER_TRUSTED_INTERFACE_0_2 +#define PPB_BROKER_TRUSTED_INTERFACE_0_3 "PPB_BrokerTrusted;0.3" +#define PPB_BROKER_TRUSTED_INTERFACE PPB_BROKER_TRUSTED_INTERFACE_0_3 /** * @file @@ -40,7 +41,7 @@ * handle is closed. The handle should be closed before the resource is * released. */ -struct PPB_BrokerTrusted_0_2 { +struct PPB_BrokerTrusted_0_3 { /** * Returns a trusted broker resource. */ @@ -74,9 +75,26 @@ struct PPB_BrokerTrusted_0_2 { * before connect has completed will return PP_ERROR_FAILED. */ int32_t (*GetHandle)(PP_Resource broker, int32_t* handle); + /** + * Returns PP_TRUE if the plugin has permission to launch the broker. A user + * must explicitly grant permission to launch the broker for a particular + * website. This is done through an infobar that is displayed when |Connect| + * is called. This function returns PP_TRUE if the user has already granted + * permission to launch the broker for the website containing this plugin + * instance. Returns PP_FALSE otherwise. + */ + PP_Bool (*IsAllowed)(PP_Resource broker); }; -typedef struct PPB_BrokerTrusted_0_2 PPB_BrokerTrusted; +typedef struct PPB_BrokerTrusted_0_3 PPB_BrokerTrusted; + +struct PPB_BrokerTrusted_0_2 { + PP_Resource (*CreateTrusted)(PP_Instance instance); + PP_Bool (*IsBrokerTrusted)(PP_Resource resource); + int32_t (*Connect)(PP_Resource broker, + struct PP_CompletionCallback connect_callback); + int32_t (*GetHandle)(PP_Resource broker, int32_t* handle); +}; /** * @} */ -- cgit v1.1