diff options
author | yzshen@chromium.org <yzshen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-27 07:18:46 +0000 |
---|---|---|
committer | yzshen@chromium.org <yzshen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-27 07:18:46 +0000 |
commit | 1a559448088694cd4dc077c7a14436942fda5061 (patch) | |
tree | c539c7259f878cf6c43bbbbc2515eaa46b0f4f45 /ppapi | |
parent | 3f84377fbfae99a755a20f8a9a5390526cec9ce1 (diff) | |
download | chromium_src-1a559448088694cd4dc077c7a14436942fda5061.zip chromium_src-1a559448088694cd4dc077c7a14436942fda5061.tar.gz chromium_src-1a559448088694cd4dc077c7a14436942fda5061.tar.bz2 |
Pepper Flash settings integration: implement "deauthorize content licenses".
A few notes about PepperFlashSettingsManager:
- It doesn't re-establish a channel for each request. It might seem unnecessary at this point. But that is needed for implementing content settings (camera/mic and peer networking), which requires more interactions with the broker process.
- Similarly, the support of multiple in-flight requests isn't very useful for deauthorizing content licenses, but that is useful for content settings, e.g., sending multiple GetPermissionSettings requests for different setting types.
BUG=112190
TEST=None
Review URL: https://chromiumcodereview.appspot.com/10391173
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@139210 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi')
-rw-r--r-- | ppapi/api/private/ppp_flash_browser_operations.idl | 106 | ||||
-rw-r--r-- | ppapi/c/private/ppp_flash_browser_operations.h | 133 | ||||
-rw-r--r-- | ppapi/proxy/ppapi_messages.h | 10 |
3 files changed, 243 insertions, 6 deletions
diff --git a/ppapi/api/private/ppp_flash_browser_operations.idl b/ppapi/api/private/ppp_flash_browser_operations.idl index f7dcd8c..f4b4e65 100644 --- a/ppapi/api/private/ppp_flash_browser_operations.idl +++ b/ppapi/api/private/ppp_flash_browser_operations.idl @@ -8,9 +8,40 @@ */ label Chrome { - M20 = 1.0 + M20 = 1.0, + M21 = 1.1 }; +[assert_size(4)] +enum PP_Flash_BrowserOperations_SettingType { + PP_FLASH_BROWSEROPERATIONS_SETTINGTYPE_CAMERAMIC = 0, + PP_FLASH_BROWSEROPERATIONS_SETTINGTYPE_PEERNETWORKING = 1 +}; + +[assert_size(4)] +enum PP_Flash_BrowserOperations_Permission { + // This value is only used with <code>SetSitePermission()</code>. + PP_FLASH_BROWSEROPERATIONS_PERMISSION_DEFAULT = 0, + PP_FLASH_BROWSEROPERATIONS_PERMISSION_ALLOW = 1, + PP_FLASH_BROWSEROPERATIONS_PERMISSION_BLOCK = 2, + PP_FLASH_BROWSEROPERATIONS_PERMISSION_ASK = 3 +}; + +[assert_size(24)] +struct PP_Flash_BrowserOperations_SiteSetting { + PP_Var site; + PP_Flash_BrowserOperations_Permission permission; + // Makes the size consistent across compilers. + int32_t padding; +}; + +typedef void PPB_Flash_BrowserOperations_GetSettingsCallback( + [inout] mem_t user_data, + [in] PP_Bool success, + [in] PP_Flash_BrowserOperations_Permission default_permission, + [in] uint32_t site_count, + [in, size_is(site_count)] PP_Flash_BrowserOperations_SiteSetting[] sites); + /** * This interface allows the browser to request the plugin do things. */ @@ -41,5 +72,76 @@ interface PPP_Flash_BrowserOperations { str_t site, uint64_t flags, uint64_t max_age); -}; + /** + * Requests the plugin to deauthorize content licenses. It prevents Flash from + * playing protected content, such as movies and music the user may have + * rented or purchased. + * + * @param[in] plugin_data_path String containing the directory where the + * plugin settings are stored. + * + * @return <code>PP_TRUE</code> on success, <code>PP_FALSE</code> on failure. + */ + [version=1.1] + PP_Bool DeauthorizeContentLicenses([in] str_t plugin_data_path); + + /** + * Gets permission settings. <code>callback</code> will be called exactly once + * to return the settings. + * + * @param[in] plugin_data_path String containing the directory where the + * plugin settings are stored. + * @param[in] setting_type What type of setting to retrieve. + * @param[in] callback The callback to return retrieved data. + * @param[inout] user_data An opaque pointer that will be passed to + * <code>callback</code>. + */ + [version=1.1] + void GetPermissionSettings( + [in] str_t plugin_data_path, + [in] PP_Flash_BrowserOperations_SettingType setting_type, + [in] PPB_Flash_BrowserOperations_GetSettingsCallback callback, + [inout] mem_t user_data); + + /** + * Sets default permission. It applies to all sites except those with + * site-specific settings. + * + * @param[in] plugin_data_path String containing the directory where the + * plugin settings are stored. + * @param[in] setting_type What type of setting to set. + * @param[in] permission The default permission. + * @param[in] clear_site_specific Whether to remove all site-specific + * settings. + * + * @return <code>PP_TRUE</code> on success, <code>PP_FALSE</code> on failure. + */ + [version=1.1] + PP_Bool SetDefaultPermission( + [in] str_t plugin_data_path, + [in] PP_Flash_BrowserOperations_SettingType setting_type, + [in] PP_Flash_BrowserOperations_Permission permission, + [in] PP_Bool clear_site_speicifc); + + /** + * Sets site-specific permission. If a site has already got site-specific + * permission and it is not in <code>sites</code>, it won't be affected. + * + * @param[in] plugin_data_path String containing the directory where the + * plugin settings are stored. + * @param[in] setting_type What type of setting to set. + * @param[in] site_count How many items are there in <code>sites</code>. + * @param[in] sites The site-specific settings. If a site is specified with + * <code>PP_FLASH_BROWSEROPERATIONS_PERMISSION_DEFAULT</code> permission, it + * will be removed from the site-specific list. + * + * @return <code>PP_TRUE</code> on success, <code>PP_FALSE</code> on failure. + */ + [version=1.1] + PP_Bool SetSitePermission( + [in] str_t plugin_data_path, + [in] PP_Flash_BrowserOperations_SettingType setting_type, + [in] uint32_t site_count, + [in, size_is(site_count)] PP_Flash_BrowserOperations_SiteSetting[] sites); +}; diff --git a/ppapi/c/private/ppp_flash_browser_operations.h b/ppapi/c/private/ppp_flash_browser_operations.h index 9cb3ff9..7e602cc 100644 --- a/ppapi/c/private/ppp_flash_browser_operations.h +++ b/ppapi/c/private/ppp_flash_browser_operations.h @@ -4,7 +4,7 @@ */ /* From private/ppp_flash_browser_operations.idl, - * modified Wed Apr 11 16:26:42 2012. + * modified Thu May 24 15:41:01 2012. */ #ifndef PPAPI_C_PRIVATE_PPP_FLASH_BROWSER_OPERATIONS_H_ @@ -13,11 +13,14 @@ #include "ppapi/c/pp_bool.h" #include "ppapi/c/pp_macros.h" #include "ppapi/c/pp_stdint.h" +#include "ppapi/c/pp_var.h" #define PPP_FLASH_BROWSEROPERATIONS_INTERFACE_1_0 \ "PPP_Flash_BrowserOperations;1.0" +#define PPP_FLASH_BROWSEROPERATIONS_INTERFACE_1_1 \ + "PPP_Flash_BrowserOperations;1.1" #define PPP_FLASH_BROWSEROPERATIONS_INTERFACE \ - PPP_FLASH_BROWSEROPERATIONS_INTERFACE_1_0 + PPP_FLASH_BROWSEROPERATIONS_INTERFACE_1_1 /** * @file @@ -26,13 +29,64 @@ /** + * @addtogroup Enums + * @{ + */ +typedef enum { + PP_FLASH_BROWSEROPERATIONS_SETTINGTYPE_CAMERAMIC = 0, + PP_FLASH_BROWSEROPERATIONS_SETTINGTYPE_PEERNETWORKING = 1 +} PP_Flash_BrowserOperations_SettingType; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_Flash_BrowserOperations_SettingType, 4); + +typedef enum { + /* This value is only used with <code>SetSitePermission()</code>. */ + PP_FLASH_BROWSEROPERATIONS_PERMISSION_DEFAULT = 0, + PP_FLASH_BROWSEROPERATIONS_PERMISSION_ALLOW = 1, + PP_FLASH_BROWSEROPERATIONS_PERMISSION_BLOCK = 2, + PP_FLASH_BROWSEROPERATIONS_PERMISSION_ASK = 3 +} PP_Flash_BrowserOperations_Permission; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_Flash_BrowserOperations_Permission, 4); +/** + * @} + */ + +/** + * @addtogroup Structs + * @{ + */ +struct PP_Flash_BrowserOperations_SiteSetting { + struct PP_Var site; + PP_Flash_BrowserOperations_Permission permission; + /* Makes the size consistent across compilers. */ + int32_t padding; +}; +PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_Flash_BrowserOperations_SiteSetting, 24); +/** + * @} + */ + +/** + * @addtogroup Typedefs + * @{ + */ +typedef void (*PPB_Flash_BrowserOperations_GetSettingsCallback)( + void* user_data, + PP_Bool success, + PP_Flash_BrowserOperations_Permission default_permission, + uint32_t site_count, + const struct PP_Flash_BrowserOperations_SiteSetting sites[]); +/** + * @} + */ + +/** * @addtogroup Interfaces * @{ */ /** * This interface allows the browser to request the plugin do things. */ -struct PPP_Flash_BrowserOperations_1_0 { +struct PPP_Flash_BrowserOperations_1_1 { /** * This function allows the plugin to implement the "Clear site data" feature. * @@ -59,9 +113,80 @@ struct PPP_Flash_BrowserOperations_1_0 { const char* site, uint64_t flags, uint64_t max_age); + /** + * Requests the plugin to deauthorize content licenses. It prevents Flash from + * playing protected content, such as movies and music the user may have + * rented or purchased. + * + * @param[in] plugin_data_path String containing the directory where the + * plugin settings are stored. + * + * @return <code>PP_TRUE</code> on success, <code>PP_FALSE</code> on failure. + */ + PP_Bool (*DeauthorizeContentLicenses)(const char* plugin_data_path); + /** + * Gets permission settings. <code>callback</code> will be called exactly once + * to return the settings. + * + * @param[in] plugin_data_path String containing the directory where the + * plugin settings are stored. + * @param[in] setting_type What type of setting to retrieve. + * @param[in] callback The callback to return retrieved data. + * @param[inout] user_data An opaque pointer that will be passed to + * <code>callback</code>. + */ + void (*GetPermissionSettings)( + const char* plugin_data_path, + PP_Flash_BrowserOperations_SettingType setting_type, + PPB_Flash_BrowserOperations_GetSettingsCallback callback, + void* user_data); + /** + * Sets default permission. It applies to all sites except those with + * site-specific settings. + * + * @param[in] plugin_data_path String containing the directory where the + * plugin settings are stored. + * @param[in] setting_type What type of setting to set. + * @param[in] permission The default permission. + * @param[in] clear_site_specific Whether to remove all site-specific + * settings. + * + * @return <code>PP_TRUE</code> on success, <code>PP_FALSE</code> on failure. + */ + PP_Bool (*SetDefaultPermission)( + const char* plugin_data_path, + PP_Flash_BrowserOperations_SettingType setting_type, + PP_Flash_BrowserOperations_Permission permission, + PP_Bool clear_site_speicifc); + /** + * Sets site-specific permission. If a site has already got site-specific + * permission and it is not in <code>sites</code>, it won't be affected. + * + * @param[in] plugin_data_path String containing the directory where the + * plugin settings are stored. + * @param[in] setting_type What type of setting to set. + * @param[in] site_count How many items are there in <code>sites</code>. + * @param[in] sites The site-specific settings. If a site is specified with + * <code>PP_FLASH_BROWSEROPERATIONS_PERMISSION_DEFAULT</code> permission, it + * will be removed from the site-specific list. + * + * @return <code>PP_TRUE</code> on success, <code>PP_FALSE</code> on failure. + */ + PP_Bool (*SetSitePermission)( + const char* plugin_data_path, + PP_Flash_BrowserOperations_SettingType setting_type, + uint32_t site_count, + const struct PP_Flash_BrowserOperations_SiteSetting sites[]); }; -typedef struct PPP_Flash_BrowserOperations_1_0 PPP_Flash_BrowserOperations; +typedef struct PPP_Flash_BrowserOperations_1_1 PPP_Flash_BrowserOperations; + +struct PPP_Flash_BrowserOperations_1_0 { + PP_Bool (*ClearSiteData)(const char* plugin_data_path, + const char* site, + uint64_t flags, + uint64_t max_age); +}; /** * @} */ diff --git a/ppapi/proxy/ppapi_messages.h b/ppapi/proxy/ppapi_messages.h index 536d702..82b9731 100644 --- a/ppapi/proxy/ppapi_messages.h +++ b/ppapi/proxy/ppapi_messages.h @@ -34,6 +34,7 @@ #include "ppapi/c/private/ppb_host_resolver_private.h" #include "ppapi/c/private/ppb_net_address_private.h" #include "ppapi/c/private/ppb_tcp_socket_private.h" +#include "ppapi/c/private/ppp_flash_browser_operations.h" #include "ppapi/proxy/ppapi_param_traits.h" #include "ppapi/proxy/ppapi_proxy_export.h" #include "ppapi/proxy/serialized_flash_menu.h" @@ -53,6 +54,8 @@ #define IPC_MESSAGE_START PpapiMsgStart IPC_ENUM_TRAITS(PP_DeviceType_Dev) +IPC_ENUM_TRAITS(PP_Flash_BrowserOperations_Permission) +IPC_ENUM_TRAITS(PP_Flash_BrowserOperations_SettingType) IPC_ENUM_TRAITS(PP_InputEvent_MouseButton) IPC_ENUM_TRAITS(PP_InputEvent_Type) IPC_ENUM_TRAITS(PP_NetAddressFamily_Private) @@ -258,6 +261,13 @@ IPC_MESSAGE_CONTROL4(PpapiMsg_ClearSiteData, IPC_MESSAGE_CONTROL1(PpapiHostMsg_ClearSiteDataResult, bool /* success */) +IPC_MESSAGE_CONTROL2(PpapiMsg_DeauthorizeContentLicenses, + uint32 /* request_id */, + FilePath /* plugin_data_path */) +IPC_MESSAGE_CONTROL2(PpapiHostMsg_DeauthorizeContentLicensesResult, + uint32 /* request_id */, + bool /* success */) + // Broker Process. IPC_SYNC_MESSAGE_CONTROL2_1(PpapiMsg_ConnectToPlugin, PP_Instance /* instance */, |