Home | History | Annotate | Download | only in private
      1 /* Copyright (c) 2012 The Chromium Authors. All rights reserved.
      2  * Use of this source code is governed by a BSD-style license that can be
      3  * found in the LICENSE file.
      4  */
      5 
      6 /* From private/ppp_flash_browser_operations.idl,
      7  *   modified Thu Mar 28 10:23:11 2013.
      8  */
      9 
     10 #ifndef PPAPI_C_PRIVATE_PPP_FLASH_BROWSER_OPERATIONS_H_
     11 #define PPAPI_C_PRIVATE_PPP_FLASH_BROWSER_OPERATIONS_H_
     12 
     13 #include "ppapi/c/pp_bool.h"
     14 #include "ppapi/c/pp_macros.h"
     15 #include "ppapi/c/pp_stdint.h"
     16 
     17 #define PPP_FLASH_BROWSEROPERATIONS_INTERFACE_1_0 \
     18     "PPP_Flash_BrowserOperations;1.0"
     19 #define PPP_FLASH_BROWSEROPERATIONS_INTERFACE_1_2 \
     20     "PPP_Flash_BrowserOperations;1.2"
     21 #define PPP_FLASH_BROWSEROPERATIONS_INTERFACE_1_3 \
     22     "PPP_Flash_BrowserOperations;1.3"
     23 #define PPP_FLASH_BROWSEROPERATIONS_INTERFACE \
     24     PPP_FLASH_BROWSEROPERATIONS_INTERFACE_1_3
     25 
     26 /**
     27  * @file
     28  * This file contains the <code>PPP_Flash_BrowserOperations</code> interface.
     29  */
     30 
     31 
     32 /**
     33  * @addtogroup Enums
     34  * @{
     35  */
     36 typedef enum {
     37   PP_FLASH_BROWSEROPERATIONS_SETTINGTYPE_CAMERAMIC = 0,
     38   PP_FLASH_BROWSEROPERATIONS_SETTINGTYPE_PEERNETWORKING = 1
     39 } PP_Flash_BrowserOperations_SettingType;
     40 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_Flash_BrowserOperations_SettingType, 4);
     41 
     42 typedef enum {
     43   /* This value is only used with <code>SetSitePermission()</code>. */
     44   PP_FLASH_BROWSEROPERATIONS_PERMISSION_DEFAULT = 0,
     45   PP_FLASH_BROWSEROPERATIONS_PERMISSION_ALLOW = 1,
     46   PP_FLASH_BROWSEROPERATIONS_PERMISSION_BLOCK = 2,
     47   PP_FLASH_BROWSEROPERATIONS_PERMISSION_ASK = 3
     48 } PP_Flash_BrowserOperations_Permission;
     49 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_Flash_BrowserOperations_Permission, 4);
     50 /**
     51  * @}
     52  */
     53 
     54 /**
     55  * @addtogroup Structs
     56  * @{
     57  */
     58 struct PP_Flash_BrowserOperations_SiteSetting {
     59   const char* site;
     60   PP_Flash_BrowserOperations_Permission permission;
     61 };
     62 /**
     63  * @}
     64  */
     65 
     66 /**
     67  * @addtogroup Typedefs
     68  * @{
     69  */
     70 typedef void (*PPB_Flash_BrowserOperations_GetSettingsCallback)(
     71     void* user_data,
     72     PP_Bool success,
     73     PP_Flash_BrowserOperations_Permission default_permission,
     74     uint32_t site_count,
     75     const struct PP_Flash_BrowserOperations_SiteSetting sites[]);
     76 /**
     77  * @}
     78  */
     79 
     80 /**
     81  * @addtogroup Interfaces
     82  * @{
     83  */
     84 /**
     85  * This interface allows the browser to request the plugin do things.
     86  */
     87 struct PPP_Flash_BrowserOperations_1_3 {
     88   /**
     89    * This function allows the plugin to implement the "Clear site data" feature.
     90    *
     91    * @param[in] plugin_data_path String containing the directory where the
     92    * plugin data is
     93    * stored. On UTF16 systems (Windows), this will be encoded as UTF-8. It will
     94    * be an absolute path and will not have a directory separator (slash) at the
     95    * end.
     96    * @param[in] site String specifying which site to clear the data for. This
     97    * will be null to clear data for all sites.
     98    * @param[in] flags Currently always 0 in Chrome to clear all data. This may
     99    * be extended in the future to clear only specific types of data.
    100    * @param[in] max_age The maximum age in seconds to clear data for. This
    101    * allows the plugin to implement "clear past hour" and "clear past data",
    102    * etc.
    103    *
    104    * @return PP_TRUE on success, PP_FALSE on failure.
    105    *
    106    * See also the NPP_ClearSiteData function in NPAPI.
    107    * https://wiki.mozilla.org/NPAPI:ClearSiteData
    108    */
    109   PP_Bool (*ClearSiteData)(const char* plugin_data_path,
    110                            const char* site,
    111                            uint64_t flags,
    112                            uint64_t max_age);
    113   /**
    114    * Requests the plugin to deauthorize content licenses. It prevents Flash from
    115    * playing protected content, such as movies and music the user may have
    116    * rented or purchased.
    117    *
    118    * @param[in] plugin_data_path String containing the directory where the
    119    * plugin settings are stored.
    120    *
    121    * @return <code>PP_TRUE</code> on success, <code>PP_FALSE</code> on failure.
    122    */
    123   PP_Bool (*DeauthorizeContentLicenses)(const char* plugin_data_path);
    124   /**
    125    * Gets permission settings. <code>callback</code> will be called exactly once
    126    * to return the settings.
    127    *
    128    * @param[in] plugin_data_path String containing the directory where the
    129    * plugin settings are stored.
    130    * @param[in] setting_type What type of setting to retrieve.
    131    * @param[in] callback The callback to return retrieved data.
    132    * @param[inout] user_data An opaque pointer that will be passed to
    133    * <code>callback</code>.
    134    */
    135   void (*GetPermissionSettings)(
    136       const char* plugin_data_path,
    137       PP_Flash_BrowserOperations_SettingType setting_type,
    138       PPB_Flash_BrowserOperations_GetSettingsCallback callback,
    139       void* user_data);
    140   /**
    141    * Sets default permission. It applies to all sites except those with
    142    * site-specific settings.
    143    *
    144    * @param[in] plugin_data_path String containing the directory where the
    145    * plugin settings are stored.
    146    * @param[in] setting_type What type of setting to set.
    147    * @param[in] permission The default permission.
    148    * @param[in] clear_site_specific Whether to remove all site-specific
    149    * settings.
    150    *
    151    * @return <code>PP_TRUE</code> on success, <code>PP_FALSE</code> on failure.
    152    */
    153   PP_Bool (*SetDefaultPermission)(
    154       const char* plugin_data_path,
    155       PP_Flash_BrowserOperations_SettingType setting_type,
    156       PP_Flash_BrowserOperations_Permission permission,
    157       PP_Bool clear_site_specific);
    158   /**
    159    * Sets site-specific permission. If a site has already got site-specific
    160    * permission and it is not in <code>sites</code>, it won't be affected.
    161    *
    162    * @param[in] plugin_data_path String containing the directory where the
    163    * plugin settings are stored.
    164    * @param[in] setting_type What type of setting to set.
    165    * @param[in] site_count How many items are there in <code>sites</code>.
    166    * @param[in] sites The site-specific settings. If a site is specified with
    167    * <code>PP_FLASH_BROWSEROPERATIONS_PERMISSION_DEFAULT</code> permission, it
    168    * will be removed from the site-specific list.
    169    *
    170    * @return <code>PP_TRUE</code> on success, <code>PP_FALSE</code> on failure.
    171    */
    172   PP_Bool (*SetSitePermission)(
    173       const char* plugin_data_path,
    174       PP_Flash_BrowserOperations_SettingType setting_type,
    175       uint32_t site_count,
    176       const struct PP_Flash_BrowserOperations_SiteSetting sites[]);
    177   /**
    178    * Returns a list of sites that have stored data, for use with the
    179    * "Clear site data" feature.
    180    *
    181    * @param[in] plugin_data_path String containing the directory where the
    182    * plugin data is stored.
    183    * @param[out] sites A NULL-terminated array of sites that have stored data.
    184    * Use FreeSiteList on the array when done.
    185    *
    186    * See also the NPP_GetSitesWithData function in NPAPI:
    187    * https://wiki.mozilla.org/NPAPI:ClearSiteData
    188    */
    189   void (*GetSitesWithData)(const char* plugin_data_path, char** sites[]);
    190   /**
    191    * Frees the list of sites returned by GetSitesWithData.
    192    *
    193    * @param[in] sites A NULL-terminated array of strings.
    194    */
    195   void (*FreeSiteList)(char* sites[]);
    196 };
    197 
    198 typedef struct PPP_Flash_BrowserOperations_1_3 PPP_Flash_BrowserOperations;
    199 
    200 struct PPP_Flash_BrowserOperations_1_0 {
    201   PP_Bool (*ClearSiteData)(const char* plugin_data_path,
    202                            const char* site,
    203                            uint64_t flags,
    204                            uint64_t max_age);
    205 };
    206 
    207 struct PPP_Flash_BrowserOperations_1_2 {
    208   PP_Bool (*ClearSiteData)(const char* plugin_data_path,
    209                            const char* site,
    210                            uint64_t flags,
    211                            uint64_t max_age);
    212   PP_Bool (*DeauthorizeContentLicenses)(const char* plugin_data_path);
    213   void (*GetPermissionSettings)(
    214       const char* plugin_data_path,
    215       PP_Flash_BrowserOperations_SettingType setting_type,
    216       PPB_Flash_BrowserOperations_GetSettingsCallback callback,
    217       void* user_data);
    218   PP_Bool (*SetDefaultPermission)(
    219       const char* plugin_data_path,
    220       PP_Flash_BrowserOperations_SettingType setting_type,
    221       PP_Flash_BrowserOperations_Permission permission,
    222       PP_Bool clear_site_specific);
    223   PP_Bool (*SetSitePermission)(
    224       const char* plugin_data_path,
    225       PP_Flash_BrowserOperations_SettingType setting_type,
    226       uint32_t site_count,
    227       const struct PP_Flash_BrowserOperations_SiteSetting sites[]);
    228 };
    229 /**
    230  * @}
    231  */
    232 
    233 #endif  /* PPAPI_C_PRIVATE_PPP_FLASH_BROWSER_OPERATIONS_H_ */
    234 
    235