Beispiel #1
0
 /**
  * Logs a message to the console with the given source information rather
  * than using the internal PPAPI plugin name. The name must be a string var.
  *
  * The regular log function will automatically prepend the name of your
  * plugin to the message as the "source" of the message. Some plugins may
  * wish to override this. For example, if your plugin is a Python
  * interpreter, you would want log messages to contain the source .py file
  * doing the log statement rather than have "python" show up in the console.
  */
 public static void LogWithSource(PPInstance instance,
                                  PPLogLevel level,
                                  PPVar source,
                                  PPVar value)
 {
     _LogWithSource(instance, level, source, value);
 }
Beispiel #2
0
 /**
  * Create() allocates an image data resource with the given format and size.
  *
  * For security reasons, if uninitialized, the bitmap will not contain random
  * memory, but may contain data from a previous image produced by the same
  * module if the bitmap was cached and re-used.
  *
  * @param[in] instance A <code>PP_Instance</code> identifying one instance
  * of a module.
  * @param[in] format The desired image data format.
  * @param[in] size A pointer to a <code>PP_Size</code> containing the image
  * size.
  * @param[in] init_to_zero A <code>PP_Bool</code> to determine transparency
  * at creation.
  * Set the <code>init_to_zero</code> flag if you want the bitmap initialized
  * to transparent during the creation process. If this flag is not set, the
  * current contents of the bitmap will be undefined, and the module should
  * be sure to set all the pixels.
  *
  * @return A <code>PP_Resource</code> with a nonzero ID on success or zero on
  * failure. Failure means the instance, image size, or format was invalid.
  */
 public static PPResource Create(PPInstance instance,
                                 PPImageDataFormat format,
                                 PPSize size,
                                 PPBool init_to_zero)
 {
     return(_Create(instance, format, size, init_to_zero));
 }
Beispiel #3
0
 /**
  * Retrieves the proxy that will be used for the given URL. The result will
  * be a string in PAC format. For more details about PAC format, please see
  * http://en.wikipedia.org/wiki/Proxy_auto-config
  *
  * @param[in] instance A <code>PP_Instance</code> identifying one instance
  * of a module.
  *
  * @param[in] url A string <code>PP_Var</code> containing a URL.
  *
  * @param[out] proxy_string A <code>PP_Var</code> that GetProxyForURL will
  * set upon successful completion. If the call fails, <code>proxy_string
  * </code> will be unchanged. Otherwise, it will be set to a string <code>
  * PP_Var</code> containing the appropriate PAC string for <code>url</code>.
  * If set, <code>proxy_string</code> will have a reference count of 1 which
  * the plugin must manage.
  *
  * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon
  * completion.
  *
  * @return An int32_t containing an error code from <code>pp_errors.h</code>.
  */
 public static int GetProxyForURL(PPInstance instance,
                                  PPVar url,
                                  out PPVar proxy_string,
                                  PPCompletionCallback callback)
 {
     return(_GetProxyForURL(instance, url, out proxy_string, callback));
 }
Beispiel #4
0
 /**
  * Create() creates an audio resource. No sound will be heard until
  * StartPlayback() is called. The callback is called with the buffer address
  * and given user data whenever the buffer needs to be filled. From within the
  * callback, you should not call <code>PPB_Audio</code> functions. The
  * callback will be called on a different thread than the one which created
  * the interface. For performance-critical applications (i.e. low-latency
  * audio), the callback should avoid blocking or calling functions that can
  * obtain locks, such as malloc. The layout and the size of the buffer passed
  * to the audio callback will be determined by the device configuration and is
  * specified in the <code>AudioConfig</code> documentation.
  *
  * @param[in] instance A <code>PP_Instance</code> identifying one instance
  * of a module.
  * @param[in] config A <code>PP_Resource</code> corresponding to an audio
  * config resource.
  * @param[in] audio_callback A <code>PPB_Audio_Callback</code> callback
  * function that the browser calls when it needs more samples to play.
  * @param[in] user_data A pointer to user data used in the callback function.
  *
  * @return A <code>PP_Resource</code> containing the audio resource if
  * successful or 0 if the configuration cannot be honored or the callback is
  * null.
  */
 public static PPResource Create(PPInstance instance,
                                 PPResource config,
                                 PPBAudioCallback audio_callback,
                                 IntPtr user_data)
 {
     return(_Create(instance, config, audio_callback, user_data));
 }
Beispiel #5
0
 /**
  * Sets the given mouse cursor. The mouse cursor will be in effect whenever
  * the mouse is over the given instance until it is set again by another
  * call. Note that you can hide the mouse cursor by setting it to the
  * <code>PP_MOUSECURSOR_TYPE_NONE</code> type.
  *
  * This function allows setting both system defined mouse cursors and
  * custom cursors. To set a system-defined cursor, pass the type you want
  * and set the custom image to 0 and the hot spot to NULL. To set a custom
  * cursor, set the type to <code>PP_MOUSECURSOR_TYPE_CUSTOM</code> and
  * specify your image and hot spot.
  *
  * @param[in] instance A <code>PP_Instance</code> identifying the instance
  * that the mouse cursor will affect.
  *
  * @param[in] type A <code>PP_MouseCursor_Type</code> identifying the type of
  * mouse cursor to show.
  *
  * @param[in] image A <code>PPB_ImageData</code> resource identifying the
  * custom image to set when the type is
  * <code>PP_MOUSECURSOR_TYPE_CUSTOM</code>. The image must be less than 32
  * pixels in each direction and must be of the system's native image format.
  * When you are specifying a predefined cursor, this parameter must be 0.
  *
  * @param[in] hot_spot When setting a custom cursor, this identifies the
  * pixel position within the given image of the "hot spot" of the cursor.
  * When specifying a stock cursor, this parameter is ignored.
  *
  * @return PP_TRUE on success, or PP_FALSE if the instance or cursor type
  * is invalid, or if the image is too large.
  */
 public static PPBool SetCursor(PPInstance instance,
                                PPMouseCursorType type,
                                PPResource image,
                                PPPoint hot_spot)
 {
     return(_SetCursor(instance, type, image, hot_spot));
 }
Beispiel #6
0
 /**
  * Invoked as a result of JavaScript invoking postMessageAndAwaitResponse()
  * on the plugin's DOM element.
  *
  * NOTE: JavaScript execution is blocked during the duration of this call.
  * Hence, the plugin should respond as quickly as possible. For this reason,
  * blocking completion callbacks are disallowed while handling a blocking
  * message.
  *
  * @param[in] instance A <code>PP_Instance</code> identifying one instance
  * of a module.
  * @param[in] user_data is the same pointer which was provided by a call to
  * RegisterMessageHandler().
  * @param[in] message is a copy of the parameter that JavaScript provided
  * to postMessageAndAwaitResponse().
  * @param[out] response will be copied to a JavaScript object which is
  * returned as the result of postMessageAndAwaitResponse() to the invoking
  *
  */
 public static void HandleBlockingMessage(PPInstance instance,
                                          IntPtr user_data,
                                          PPVar message,
                                          out PPVar response)
 {
     _HandleBlockingMessage(instance, user_data, message, out response);
 }
Beispiel #7
0
 /**
  * Registers a handler for receiving messages from JavaScript. If a handler
  * is registered this way, it will replace PPP_Messaging, and all messages
  * sent from JavaScript via postMessage and postMessageAndAwaitResponse will
  * be dispatched to <code>handler</code>.
  *
  * The function calls will be dispatched via <code>message_loop</code>. This
  * means that the functions will be invoked on the thread to which
  * <code>message_loop</code> is attached, when <code>message_loop</code> is
  * run. It is illegal to pass the main thread message loop;
  * RegisterMessageHandler will return PP_ERROR_WRONG_THREAD in that case.
  * If you quit <code>message_loop</code> before calling Unregister(),
  * the browser will not be able to call functions in the plugin's message
  * handler any more. That could mean missing some messages or could cause a
  * leak if you depend on Destroy() to free hander data. So you should,
  * whenever possible, Unregister() the handler prior to quitting its event
  * loop.
  *
  * Attempting to register a message handler when one is already registered
  * will cause the current MessageHandler to be unregistered and replaced. In
  * that case, no messages will be sent to the "default" message handler
  * (PPP_Messaging). Messages will stop arriving at the prior message handler
  * and will begin to be dispatched at the new message handler.
  *
  * @param[in] instance A <code>PP_Instance</code> identifying one instance
  * of a module.
  * @param[in] user_data A pointer the plugin may choose to use when handling
  * calls to functions within PPP_MessageHandler. The browser will pass this
  * same pointer when invoking functions within PPP_MessageHandler.
  * @param[in] handler The plugin-provided set of functions for handling
  * messages.
  * @param[in] message_loop Represents the message loop on which
  * PPP_MessageHandler functions should be invoked.
  * @return PP_OK on success, or an error from pp_errors.h.
  */
 public static int RegisterMessageHandler(
     PPInstance instance,
     IntPtr user_data,
     IntPtr handler,
     PPResource message_loop)
 {
     return(_RegisterMessageHandler(instance, user_data, handler, message_loop));
 }
Beispiel #8
0
 /**
  * RecommendSampleFrameCount() returns the supported sample frame count
  * closest to the requested count. The sample frame count determines the
  * overall latency of audio. Since one "frame" is always buffered in advance,
  * smaller frame counts will yield lower latency, but higher CPU utilization.
  *
  * Supported sample frame counts will vary by hardware and system (consider
  * that the local system might be anywhere from a cell phone or a high-end
  * audio workstation). Sample counts less than
  * <code>PP_AUDIOMINSAMPLEFRAMECOUNT</code> and greater than
  * <code>PP_AUDIOMAXSAMPLEFRAMECOUNT</code> are never supported on any
  * system, but values in between aren't necessarily valid. This function
  * will return a supported count closest to the requested frame count.
  *
  * RecommendSampleFrameCount() result is intended for audio output devices.
  *
  * @param[in] instance
  * @param[in] sample_rate A <code>PP_AudioSampleRate</code> which is either
  * <code>PP_AUDIOSAMPLERATE_44100</code> or
  * <code>PP_AUDIOSAMPLERATE_48000.</code>
  * @param[in] requested_sample_frame_count A <code>uint_32t</code> requested
  * frame count.
  *
  * @return A <code>uint32_t</code> containing the recommended sample frame
  * count if successful.
  */
 public static uint RecommendSampleFrameCount(
     PPInstance instance,
     PPAudioSampleRate sample_rate,
     uint requested_sample_frame_count)
 {
     return(_RecommendSampleFrameCount(instance,
                                       sample_rate,
                                       requested_sample_frame_count));
 }
Beispiel #9
0
 /**
  * BindGraphics() binds the given graphics as the current display surface.
  * The contents of this device is what will be displayed in the instance's
  * area on the web page. The device must be a 2D or a 3D device.
  *
  * You can pass a <code>NULL</code> resource as the device parameter to
  * unbind all devices from the given instance. The instance will then appear
  * transparent. Re-binding the same device will return <code>PP_TRUE</code>
  * and will do nothing.
  *
  * Any previously-bound device will be released. It is an error to bind
  * a device when it is already bound to another instance. If you want
  * to move a device between instances, first unbind it from the old one, and
  * then rebind it to the new one.
  *
  * Binding a device will invalidate that portion of the web page to flush the
  * contents of the new device to the screen.
  *
  * @param[in] instance A PP_Instance identifying one instance of a module.
  * @param[in] device A PP_Resource corresponding to a graphics device.
  *
  * @return <code>PP_Bool</code> containing <code>PP_TRUE</code> if bind was
  * successful or <code>PP_FALSE</code> if the device was not the correct
  * type. On success, a reference to the device will be held by the
  * instance, so the caller can release its reference if it chooses.
  */
 public static PPBool BindGraphics(PPInstance instance, PPResource device)
 {
     return(_BindGraphics(instance, device));
 }
Beispiel #10
0
 extern static PPBool _BindGraphics(PPInstance instance, PPResource device);
Beispiel #11
0
 /**
  * Invoked as a result of JavaScript invoking postMessage() on the plugin's
  * DOM element.
  *
  * @param[in] instance A <code>PP_Instance</code> identifying one instance
  * of a module.
  * @param[in] user_data is the same pointer which was provided by a call to
  * RegisterMessageHandler().
  * @param[in] message A copy of the parameter that JavaScript provided to
  * postMessage().
  */
 public static void HandleMessage(PPInstance instance,
                                  IntPtr user_data,
                                  PPVar message)
 {
     _HandleMessage(instance, user_data, message);
 }
Beispiel #12
0
 /**
  * Invoked when the handler object is no longer needed. After this, no more
  * calls will be made which pass this same value for <code>instance</code>
  * and <code>user_data</code>.
  *
  * @param[in] instance A <code>PP_Instance</code> identifying one instance
  * of a module.
  * @param[in] user_data is the same pointer which was provided by a call to
  * RegisterMessageHandler.
  */
 public static void Destroy(PPInstance instance, IntPtr user_data)
 {
     _Destroy(instance, user_data);
 }
Beispiel #13
0
 /** Create() creates a file system object of the given type.
  *
  * @param[in] instance A <code>PP_Instance</code> identifying the instance
  * with the file.
  * @param[in] type A file system type as defined by
  * <code>PP_FileSystemType</code> enum (except PP_FILESYSTEMTYPE_ISOLATED,
  * which is currently not supported).
  * @return A <code>PP_Resource</code> corresponding to a file system if
  * successful.
  */
 public static PPResource Create(PPInstance instance,
                                 PPFileSystemType type)
 {
     return(_Create(instance, type));
 }
Beispiel #14
0
 extern static PPResource _Create(PPInstance instance,
                                  PPFileSystemType type);
Beispiel #15
0
 /**
  * GetScreenSize() gets the size of the screen in pixels. The module instance
  * will be resized to this size when SetFullscreen() is called to enter
  * fullscreen mode.
  *
  * @param[in] instance A <code>PP_Instance</code> identifying one instance
  * of a module.
  * @param[out] size The size of the entire screen in pixels.
  *
  * @return <code>PP_TRUE</code> on success or <code>PP_FALSE</code> on
  * failure.
  */
 public static PPBool GetScreenSize(PPInstance instance, out PPSize size)
 {
     return(_GetScreenSize(instance, out size));
 }
Beispiel #16
0
 extern static PPBool _GetScreenSize(PPInstance instance, out PPSize size);
Beispiel #17
0
 /**
  * SetFullscreen() switches the module instance to and from fullscreen
  * mode.
  *
  * The transition to and from fullscreen mode is asynchronous. During the
  * transition, IsFullscreen() will return the previous value and
  * no 2D or 3D device can be bound. The transition ends at DidChangeView()
  * when IsFullscreen() returns the new value. You might receive other
  * DidChangeView() calls while in transition.
  *
  * The transition to fullscreen mode can only occur while the browser is
  * processing a user gesture, even if <code>PP_TRUE</code> is returned.
  *
  * @param[in] instance A <code>PP_Instance</code> identifying one instance
  * of a module.
  * @param[in] fullscreen <code>PP_TRUE</code> to enter fullscreen mode, or
  * <code>PP_FALSE</code> to exit fullscreen mode.
  *
  * @return <code>PP_TRUE</code> on success or <code>PP_FALSE</code> on
  * failure.
  */
 public static PPBool SetFullscreen(PPInstance instance, PPBool fullscreen)
 {
     return(_SetFullscreen(instance, fullscreen));
 }
Beispiel #18
0
 extern static PPBool _IsFullFrame(PPInstance instance);
Beispiel #19
0
 /**
  * IsFullFrame() determines if the instance is full-frame. Such an instance
  * represents the entire document in a frame rather than an embedded
  * resource. This can happen if the user does a top-level navigation or the
  * page specifies an iframe to a resource with a MIME type registered by the
  * module.
  *
  * @param[in] instance A <code>PP_Instance</code> identifying one instance
  * of a module.
  *
  * @return A <code>PP_Bool</code> containing <code>PP_TRUE</code> if the
  * instance is full-frame.
  */
 public static PPBool IsFullFrame(PPInstance instance)
 {
     return(_IsFullFrame(instance));
 }
Beispiel #20
0
 extern static PPBool _SetCursor(PPInstance instance,
                                 PPMouseCursorType type,
                                 PPResource image,
                                 PPPoint hot_spot);
Beispiel #21
0
 extern static void _HandleMessage(PPInstance instance,
                                   IntPtr user_data,
                                   PPVar message);
Beispiel #22
0
 extern static PPResource _Create(PPInstance instance,
                                  PPImageDataFormat format,
                                  PPSize size,
                                  PPBool init_to_zero);
Beispiel #23
0
 extern static void _HandleBlockingMessage(PPInstance instance,
                                           IntPtr user_data,
                                           PPVar message,
                                           out PPVar response);
Beispiel #24
0
 extern static PPResource _Create(PPInstance instance);
Beispiel #25
0
 extern static void _Destroy(PPInstance instance, IntPtr user_data);
Beispiel #26
0
 extern static PPBool _HandleInputEvent(PPInstance instance,
                                        PPResource input_event);
Beispiel #27
0
 /**
  * Creates a TCP socket resource.
  *
  * @param[in] instance A <code>PP_Instance</code> identifying one instance of
  * a module.
  *
  * @return A <code>PP_Resource</code> corresponding to a TCP socket or 0
  * on failure.
  */
 public static PPResource Create(PPInstance instance)
 {
     return(_Create(instance));
 }
Beispiel #28
0
 extern static void _Sample(PPInstance instance,
                            out PPGamepadsSampleData data);
Beispiel #29
0
 /**
  * Function for receiving input events from the browser.
  *
  * In order to receive input events, you must register for them by calling
  * PPB_InputEvent.RequestInputEvents() or RequestFilteringInputEvents(). By
  * default, no events are delivered.
  *
  * If the event was handled, it will not be forwarded to the default handlers
  * in the web page.  If it was not handled, it may be dispatched to a default
  * handler. So it is important that an instance respond accurately with
  * whether event propagation should continue.
  *
  * Event propagation also controls focus. If you handle an event like a mouse
  * event, typically the instance will be given focus. Returning false from
  * a filtered event handler or not registering for an event type means that
  * the click will be given to a lower part of the page and your instance will
  * not receive focus. This allows an instance to be partially transparent,
  * where clicks on the transparent areas will behave like clicks to the
  * underlying page.
  *
  * In general, you should try to keep input event handling short. Especially
  * for filtered input events, the browser or page may be blocked waiting for
  * you to respond.
  *
  * The caller of this function will maintain a reference to the input event
  * resource during this call. Unless you take a reference to the resource
  * to hold it for later, you don't need to release it.
  *
  * <strong>Note:</strong> If you're not receiving input events, make sure you
  * register for the event classes you want by calling RequestInputEvents or
  * RequestFilteringInputEvents. If you're still not receiving keyboard input
  * events, make sure you're returning true (or using a non-filtered event
  * handler) for mouse events. Otherwise, the instance will not receive focus
  * and keyboard events will not be sent.
  *
  * \see PPB_InputEvent.RequestInputEvents and
  * PPB_InputEvent.RequestFilteringInputEvents
  *
  * @return PP_TRUE if the event was handled, PP_FALSE if not. If you have
  * registered to filter this class of events by calling
  * RequestFilteringInputEvents, and you return PP_FALSE, the event will
  * be forwarded to the page (and eventually the browser) for the default
  * handling. For non-filtered events, the return value will be ignored.
  */
 public static PPBool HandleInputEvent(PPInstance instance,
                                       PPResource input_event)
 {
     return(_HandleInputEvent(instance, input_event));
 }
Beispiel #30
0
 /**
  * Samples the current state of the available gamepads.
  */
 public static void Sample(PPInstance instance,
                           out PPGamepadsSampleData data)
 {
     _Sample(instance, out data);
 }