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/ppb_flash.idl modified Thu Apr 18 15:06:12 2013. */
      7 
      8 #ifndef PPAPI_C_PRIVATE_PPB_FLASH_H_
      9 #define PPAPI_C_PRIVATE_PPB_FLASH_H_
     10 
     11 #include "ppapi/c/pp_array_output.h"
     12 #include "ppapi/c/pp_bool.h"
     13 #include "ppapi/c/pp_instance.h"
     14 #include "ppapi/c/pp_macros.h"
     15 #include "ppapi/c/pp_module.h"
     16 #include "ppapi/c/pp_point.h"
     17 #include "ppapi/c/pp_rect.h"
     18 #include "ppapi/c/pp_resource.h"
     19 #include "ppapi/c/pp_size.h"
     20 #include "ppapi/c/pp_stdint.h"
     21 #include "ppapi/c/pp_time.h"
     22 #include "ppapi/c/pp_var.h"
     23 #include "ppapi/c/trusted/ppb_browser_font_trusted.h"
     24 
     25 #define PPB_FLASH_INTERFACE_12_4 "PPB_Flash;12.4"
     26 #define PPB_FLASH_INTERFACE_12_5 "PPB_Flash;12.5"
     27 #define PPB_FLASH_INTERFACE_12_6 "PPB_Flash;12.6"
     28 #define PPB_FLASH_INTERFACE_13_0 "PPB_Flash;13.0"
     29 #define PPB_FLASH_INTERFACE PPB_FLASH_INTERFACE_13_0
     30 
     31 /**
     32  * @file
     33  * This file contains the <code>PPB_Flash</code> interface.
     34  */
     35 
     36 
     37 /**
     38  * @addtogroup Enums
     39  * @{
     40  */
     41 typedef enum {
     42   /**
     43    * No restrictions on Flash LSOs.
     44    */
     45   PP_FLASHLSORESTRICTIONS_NONE = 1,
     46   /**
     47    * Don't allow access to Flash LSOs.
     48    */
     49   PP_FLASHLSORESTRICTIONS_BLOCK = 2,
     50   /**
     51    * Store Flash LSOs in memory only.
     52    */
     53   PP_FLASHLSORESTRICTIONS_IN_MEMORY = 3
     54 } PP_FlashLSORestrictions;
     55 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_FlashLSORestrictions, 4);
     56 
     57 typedef enum {
     58   /**
     59    * Specifies if the system likely supports 3D hardware acceleration.
     60    *
     61    * The result is a boolean PP_Var, depending on the supported nature of 3D
     62    * acceleration. If querying this function returns true, the 3D system will
     63    * normally use the native hardware for rendering which will be much faster.
     64    *
     65    * Having this set to true only means that 3D should be used to draw 2D and
     66    * video elements. PP_FLASHSETTING_STAGE3D_ENABLED should be checked to
     67    * determine if it's ok to use 3D for arbitrary content.
     68    *
     69    * In rare cases (depending on the platform) this value will be true but a
     70    * created 3D context will use emulation because context initialization
     71    * failed.
     72    */
     73   PP_FLASHSETTING_3DENABLED = 1,
     74   /**
     75    * Specifies if the given instance is in private/incognito/off-the-record mode
     76    * (returns true) or "regular" mode (returns false). Returns an undefined
     77    * PP_Var on invalid instance.
     78    */
     79   PP_FLASHSETTING_INCOGNITO = 2,
     80   /**
     81    * Specifies if arbitrary 3d commands are supported (returns true), or if 3d
     82    * should only be used for drawing 2d and video (returns false).
     83    *
     84    * This should only be enabled if PP_FLASHSETTING_3DENABLED is true.
     85    */
     86   PP_FLASHSETTING_STAGE3DENABLED = 3,
     87   /**
     88    * Specifies the string for the language code of the UI of the browser.
     89    *
     90    * For example: "en-US" or "de".
     91    *
     92    * Returns an undefined PP_Var on invalid instance.
     93    */
     94   PP_FLASHSETTING_LANGUAGE = 4,
     95   /**
     96    * Specifies the number of CPU cores that are present on the system.
     97    */
     98   PP_FLASHSETTING_NUMCORES = 5,
     99   /**
    100    * Specifies restrictions on how flash should handle LSOs. The result is an
    101    * int from <code>PP_FlashLSORestrictions</code>.
    102    */
    103   PP_FLASHSETTING_LSORESTRICTIONS = 6,
    104   /**
    105    * Specifies if the driver is reliable enough to use Shader Model 3 commands
    106    * with it.
    107    *
    108    * This should only be enabled if PP_FLASHSETTING_STAGE3DENABLED is true.
    109    */
    110   PP_FLASHSETTING_STAGE3DBASELINEENABLED = 7
    111 } PP_FlashSetting;
    112 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_FlashSetting, 4);
    113 
    114 /**
    115  * This enum provides keys for setting breakpad crash report data.
    116  */
    117 typedef enum {
    118   /**
    119    * Specifies the document URL which contains the flash instance.
    120    */
    121   PP_FLASHCRASHKEY_URL = 1,
    122   /**
    123    * Specifies the URL of the current swf.
    124    */
    125   PP_FLASHCRASHKEY_RESOURCE_URL = 2
    126 } PP_FlashCrashKey;
    127 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_FlashCrashKey, 4);
    128 /**
    129  * @}
    130  */
    131 
    132 /**
    133  * @addtogroup Interfaces
    134  * @{
    135  */
    136 /**
    137  * The <code>PPB_Flash</code> interface contains pointers to various functions
    138  * that are only needed to support Pepper Flash.
    139  */
    140 struct PPB_Flash_13_0 {
    141   /**
    142    * Sets or clears the rendering hint that the given plugin instance is always
    143    * on top of page content. Somewhat more optimized painting can be used in
    144    * this case.
    145    */
    146   void (*SetInstanceAlwaysOnTop)(PP_Instance instance, PP_Bool on_top);
    147   /**
    148    * Draws the given pre-laid-out text. It is almost equivalent to Windows'
    149    * ExtTextOut with the addition of the transformation (a 3x3 matrix given the
    150    * transform to apply before drawing). It also adds the allow_subpixel_aa
    151    * flag which when true, will use subpixel antialiasing if enabled in the
    152    * system settings. For this to work properly, the graphics layer that the
    153    * text is being drawn into must be opaque.
    154    */
    155   PP_Bool (*DrawGlyphs)(
    156       PP_Instance instance,
    157       PP_Resource pp_image_data,
    158       const struct PP_BrowserFont_Trusted_Description* font_desc,
    159       uint32_t color,
    160       const struct PP_Point* position,
    161       const struct PP_Rect* clip,
    162       const float transformation[3][3],
    163       PP_Bool allow_subpixel_aa,
    164       uint32_t glyph_count,
    165       const uint16_t glyph_indices[],
    166       const struct PP_Point glyph_advances[]);
    167   /**
    168    * Retrieves the proxy that will be used for the given URL. The result will
    169    * be a string in PAC format, or an undefined var on error.
    170    */
    171   struct PP_Var (*GetProxyForURL)(PP_Instance instance, const char* url);
    172   /**
    173    * Navigate to the URL given by the given URLRequestInfo. (This supports GETs,
    174    * POSTs, and javascript: URLs.) May open a new tab if target is not "_self".
    175    */
    176   int32_t (*Navigate)(PP_Resource request_info,
    177                       const char* target,
    178                       PP_Bool from_user_action);
    179   /**
    180    * Retrieves the local time zone offset from GM time for the given UTC time.
    181    */
    182   double (*GetLocalTimeZoneOffset)(PP_Instance instance, PP_Time t);
    183   /**
    184    * Gets a (string) with "command-line" options for Flash; used to pass
    185    * run-time debugging parameters, etc.
    186    */
    187   struct PP_Var (*GetCommandLineArgs)(PP_Module module);
    188   /**
    189    * Loads the given font in a more privileged process on Windows. Call this if
    190    * Windows is giving errors for font calls. See
    191    * content/renderer/font_cache_dispatcher_win.cc
    192    *
    193    * The parameter is a pointer to a LOGFONTW structure.
    194    *
    195    * On non-Windows platforms, this function does nothing.
    196    */
    197   void (*PreloadFontWin)(const void* logfontw);
    198   /**
    199    * Returns whether the given rectangle (in the plugin) is topmost, i.e., above
    200    * all other web content.
    201    */
    202   PP_Bool (*IsRectTopmost)(PP_Instance instance, const struct PP_Rect* rect);
    203   /**
    204    * Indicates that there's activity and, e.g., the screensaver shouldn't kick
    205    * in.
    206    */
    207   void (*UpdateActivity)(PP_Instance instance);
    208   /**
    209    * Returns the value associated with the given setting. Invalid enums will
    210    * result in an undefined PP_Var return value.
    211    */
    212   struct PP_Var (*GetSetting)(PP_Instance instance, PP_FlashSetting setting);
    213   /**
    214    * Allows setting breakpad crash data which will be included in plugin crash
    215    * reports. Returns PP_FALSE if crash data could not be set.
    216    */
    217   PP_Bool (*SetCrashData)(PP_Instance instance,
    218                           PP_FlashCrashKey key,
    219                           struct PP_Var value);
    220   /**
    221    * Enumerates video capture devices. |video_capture| is a valid
    222    * PPB_VideoCapture_Dev resource. Once the operation has completed
    223    * successfully, |devices| will be set up with an array of
    224    * PPB_DeviceRef_Dev resources.
    225    *
    226    * PP_OK is returned on success and different pepper error code on failure.
    227    * The ref count of the returned |devices| has already been increased by 1 for
    228    * the caller.
    229    *
    230    * NOTE: This method is a synchronous version of |EnumerateDevices| in
    231    * PPB_VideoCapture_Dev.
    232    */
    233   int32_t (*EnumerateVideoCaptureDevices)(PP_Instance instance,
    234                                           PP_Resource video_capture,
    235                                           struct PP_ArrayOutput devices);
    236 };
    237 
    238 typedef struct PPB_Flash_13_0 PPB_Flash;
    239 
    240 struct PPB_Flash_12_4 {
    241   void (*SetInstanceAlwaysOnTop)(PP_Instance instance, PP_Bool on_top);
    242   PP_Bool (*DrawGlyphs)(
    243       PP_Instance instance,
    244       PP_Resource pp_image_data,
    245       const struct PP_BrowserFont_Trusted_Description* font_desc,
    246       uint32_t color,
    247       const struct PP_Point* position,
    248       const struct PP_Rect* clip,
    249       const float transformation[3][3],
    250       PP_Bool allow_subpixel_aa,
    251       uint32_t glyph_count,
    252       const uint16_t glyph_indices[],
    253       const struct PP_Point glyph_advances[]);
    254   struct PP_Var (*GetProxyForURL)(PP_Instance instance, const char* url);
    255   int32_t (*Navigate)(PP_Resource request_info,
    256                       const char* target,
    257                       PP_Bool from_user_action);
    258   void (*RunMessageLoop)(PP_Instance instance);
    259   void (*QuitMessageLoop)(PP_Instance instance);
    260   double (*GetLocalTimeZoneOffset)(PP_Instance instance, PP_Time t);
    261   struct PP_Var (*GetCommandLineArgs)(PP_Module module);
    262   void (*PreloadFontWin)(const void* logfontw);
    263   PP_Bool (*IsRectTopmost)(PP_Instance instance, const struct PP_Rect* rect);
    264   int32_t (*InvokePrinting)(PP_Instance instance);
    265   void (*UpdateActivity)(PP_Instance instance);
    266   struct PP_Var (*GetDeviceID)(PP_Instance instance);
    267   int32_t (*GetSettingInt)(PP_Instance instance, PP_FlashSetting setting);
    268   struct PP_Var (*GetSetting)(PP_Instance instance, PP_FlashSetting setting);
    269 };
    270 
    271 struct PPB_Flash_12_5 {
    272   void (*SetInstanceAlwaysOnTop)(PP_Instance instance, PP_Bool on_top);
    273   PP_Bool (*DrawGlyphs)(
    274       PP_Instance instance,
    275       PP_Resource pp_image_data,
    276       const struct PP_BrowserFont_Trusted_Description* font_desc,
    277       uint32_t color,
    278       const struct PP_Point* position,
    279       const struct PP_Rect* clip,
    280       const float transformation[3][3],
    281       PP_Bool allow_subpixel_aa,
    282       uint32_t glyph_count,
    283       const uint16_t glyph_indices[],
    284       const struct PP_Point glyph_advances[]);
    285   struct PP_Var (*GetProxyForURL)(PP_Instance instance, const char* url);
    286   int32_t (*Navigate)(PP_Resource request_info,
    287                       const char* target,
    288                       PP_Bool from_user_action);
    289   void (*RunMessageLoop)(PP_Instance instance);
    290   void (*QuitMessageLoop)(PP_Instance instance);
    291   double (*GetLocalTimeZoneOffset)(PP_Instance instance, PP_Time t);
    292   struct PP_Var (*GetCommandLineArgs)(PP_Module module);
    293   void (*PreloadFontWin)(const void* logfontw);
    294   PP_Bool (*IsRectTopmost)(PP_Instance instance, const struct PP_Rect* rect);
    295   int32_t (*InvokePrinting)(PP_Instance instance);
    296   void (*UpdateActivity)(PP_Instance instance);
    297   struct PP_Var (*GetDeviceID)(PP_Instance instance);
    298   int32_t (*GetSettingInt)(PP_Instance instance, PP_FlashSetting setting);
    299   struct PP_Var (*GetSetting)(PP_Instance instance, PP_FlashSetting setting);
    300   PP_Bool (*SetCrashData)(PP_Instance instance,
    301                           PP_FlashCrashKey key,
    302                           struct PP_Var value);
    303 };
    304 
    305 struct PPB_Flash_12_6 {
    306   void (*SetInstanceAlwaysOnTop)(PP_Instance instance, PP_Bool on_top);
    307   PP_Bool (*DrawGlyphs)(
    308       PP_Instance instance,
    309       PP_Resource pp_image_data,
    310       const struct PP_BrowserFont_Trusted_Description* font_desc,
    311       uint32_t color,
    312       const struct PP_Point* position,
    313       const struct PP_Rect* clip,
    314       const float transformation[3][3],
    315       PP_Bool allow_subpixel_aa,
    316       uint32_t glyph_count,
    317       const uint16_t glyph_indices[],
    318       const struct PP_Point glyph_advances[]);
    319   struct PP_Var (*GetProxyForURL)(PP_Instance instance, const char* url);
    320   int32_t (*Navigate)(PP_Resource request_info,
    321                       const char* target,
    322                       PP_Bool from_user_action);
    323   void (*RunMessageLoop)(PP_Instance instance);
    324   void (*QuitMessageLoop)(PP_Instance instance);
    325   double (*GetLocalTimeZoneOffset)(PP_Instance instance, PP_Time t);
    326   struct PP_Var (*GetCommandLineArgs)(PP_Module module);
    327   void (*PreloadFontWin)(const void* logfontw);
    328   PP_Bool (*IsRectTopmost)(PP_Instance instance, const struct PP_Rect* rect);
    329   int32_t (*InvokePrinting)(PP_Instance instance);
    330   void (*UpdateActivity)(PP_Instance instance);
    331   struct PP_Var (*GetDeviceID)(PP_Instance instance);
    332   int32_t (*GetSettingInt)(PP_Instance instance, PP_FlashSetting setting);
    333   struct PP_Var (*GetSetting)(PP_Instance instance, PP_FlashSetting setting);
    334   PP_Bool (*SetCrashData)(PP_Instance instance,
    335                           PP_FlashCrashKey key,
    336                           struct PP_Var value);
    337   int32_t (*EnumerateVideoCaptureDevices)(PP_Instance instance,
    338                                           PP_Resource video_capture,
    339                                           struct PP_ArrayOutput devices);
    340 };
    341 /**
    342  * @}
    343  */
    344 
    345 #endif  /* PPAPI_C_PRIVATE_PPB_FLASH_H_ */
    346 
    347