summaryrefslogtreecommitdiffstats
path: root/ppapi/api
diff options
context:
space:
mode:
authornoelallen@google.com <noelallen@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-16 23:53:22 +0000
committernoelallen@google.com <noelallen@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-16 23:53:22 +0000
commit745b0d43a1f129f008ec1cdf50cb7afedeba1f02 (patch)
treebc84c5f95a643f85ce5d70967e1075a577dc999f /ppapi/api
parent63e26829823d96127ad24eabbca69e4d6008d7aa (diff)
downloadchromium_src-745b0d43a1f129f008ec1cdf50cb7afedeba1f02.zip
chromium_src-745b0d43a1f129f008ec1cdf50cb7afedeba1f02.tar.gz
chromium_src-745b0d43a1f129f008ec1cdf50cb7afedeba1f02.tar.bz2
Update the IDL
Final update of the IDL so that we can switch to using generated code for ppapi/c/ and ppapi/c/trusted. BUG= http://code.google.com/p/chromium/issues/detail?id=74634 TEST= tryserver TBR= dmichael@chromium.org Review URL: http://codereview.chromium.org/7390023 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@92805 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/api')
-rw-r--r--ppapi/api/pp_bool.idl33
-rw-r--r--ppapi/api/pp_completion_callback.idl192
-rw-r--r--ppapi/api/pp_errors.idl74
-rw-r--r--ppapi/api/pp_file_info.idl74
-rw-r--r--ppapi/api/pp_input_event.idl178
-rw-r--r--ppapi/api/pp_instance.idl13
-rw-r--r--ppapi/api/pp_macros.idl95
-rw-r--r--ppapi/api/pp_module.idl8
-rw-r--r--ppapi/api/pp_point.idl64
-rw-r--r--ppapi/api/pp_rect.idl54
-rw-r--r--ppapi/api/pp_resource.idl30
-rw-r--r--ppapi/api/pp_size.idl40
-rw-r--r--ppapi/api/pp_stdint.idl53
-rw-r--r--ppapi/api/pp_time.idl26
-rw-r--r--ppapi/api/pp_var.idl214
-rw-r--r--ppapi/api/ppb.idl28
-rw-r--r--ppapi/api/ppb_audio.idl131
-rw-r--r--ppapi/api/ppb_audio_config.idl131
-rw-r--r--ppapi/api/ppb_core.idl111
-rw-r--r--ppapi/api/ppb_file_io.idl230
-rw-r--r--ppapi/api/ppb_file_ref.idl172
-rw-r--r--ppapi/api/ppb_file_system.idl77
-rw-r--r--ppapi/api/ppb_graphics_2d.idl305
-rw-r--r--ppapi/api/ppb_image_data.idl168
-rw-r--r--ppapi/api/ppb_input_event.idl463
-rw-r--r--ppapi/api/ppb_instance.idl80
-rw-r--r--ppapi/api/ppb_messaging.idl82
-rw-r--r--ppapi/api/ppb_url_loader.idl213
-rw-r--r--ppapi/api/ppb_url_request_info.idl250
-rw-r--r--ppapi/api/ppb_url_response_info.idl140
-rw-r--r--ppapi/api/ppb_var.idl84
-rw-r--r--ppapi/api/ppp.idl109
-rw-r--r--ppapi/api/ppp_input_event.idl40
-rw-r--r--ppapi/api/ppp_instance.idl250
-rw-r--r--ppapi/api/ppp_messaging.idl59
-rw-r--r--ppapi/api/trusted/ppb_audio_trusted.idl26
-rw-r--r--ppapi/api/trusted/ppb_broker_trusted.idl65
-rw-r--r--ppapi/api/trusted/ppb_buffer_trusted.idl25
-rw-r--r--ppapi/api/trusted/ppb_file_io_trusted.idl49
-rw-r--r--ppapi/api/trusted/ppb_image_data_trusted.idl17
-rw-r--r--ppapi/api/trusted/ppb_url_loader_trusted.idl33
-rw-r--r--ppapi/api/trusted/ppp_broker.idl94
42 files changed, 3798 insertions, 782 deletions
diff --git a/ppapi/api/pp_bool.idl b/ppapi/api/pp_bool.idl
index 61d0b5c..3363dce 100644
--- a/ppapi/api/pp_bool.idl
+++ b/ppapi/api/pp_bool.idl
@@ -3,14 +3,35 @@
* found in the LICENSE file.
*/
-/* This file defines the PP_Bool enumeration for use in PPAPI C headers. */
+/**
+ * This file defines the <code>PP_Bool</code> enumeration for use in PPAPI C
+ * headers.
+ */
-/* The PP_Bool enum is a boolean value for use in PPAPI C headers. The
- * standard bool type is not available to pre-C99 compilers, and is not
- * guaranteed to be compatible between C and C++, whereas the PPAPI C
- * headers can be included from C or C++ code.
+/**
+ * The <code>PP_Bool</code> enum is a boolean value for use in PPAPI C headers.
+ * The standard bool type is not available to pre-C99 compilers, and is not
+ * guaranteed to be compatible between C and C++, whereas the PPAPI C headers
+ * can be included from C or C++ code.
*/
-enum PP_Bool {
+[assert_size(4)] enum PP_Bool {
PP_FALSE = 0,
PP_TRUE = 1
};
+
+#inline cc
+/**
+ * Converts a C++ "bool" type to a PP_Bool.
+ */
+inline PP_Bool PP_FromBool(bool b) {
+ return b ? PP_TRUE : PP_FALSE;
+}
+
+/**
+ * Converts a PP_Bool to a C++ "bool" type.
+ */
+inline bool PP_ToBool(PP_Bool b) {
+ return (b != PP_FALSE);
+}
+#endinl
+
diff --git a/ppapi/api/pp_completion_callback.idl b/ppapi/api/pp_completion_callback.idl
index 5d37354..3d7265a 100644
--- a/ppapi/api/pp_completion_callback.idl
+++ b/ppapi/api/pp_completion_callback.idl
@@ -3,27 +3,191 @@
* found in the LICENSE file.
*/
-/* This file defines the completion callback type. */
+/**
+ * This file defines the API to create and run a callback.
+ */
-/* The callback function. */
+/**
+ * PP_CompletionCallback_Func defines the function signature that you implement
+ * to receive callbacks on asynchronous completion of an operation.
+ *
+ * |user_data| is a pointer to user-specified data associated with this
+ * function at callback creation. See PP_MakeCompletionCallback() for details.
+ *
+ * |result| is the result of the operation. Non-positive values correspond to
+ * the error codes from pp_errors.h (excluding PP_OK_COMPLETIONPENDING).
+ * Positive values indicate additional information such as bytes read.
+ */
typedef void PP_CompletionCallback_Func([inout] mem_t user_data,
[in] int32_t result);
-/* Any method that takes a PP_CompletionCallback has the option of completing
- * asynchronously if the operation would block. Such a method should return
- * PP_Error_WouldBlock to indicate when the method will complete
- * asynchronously. If the completion callback is NULL, then the operation
- * will block if necessary to complete its work. PP_BlockUntilComplete()
- * provides a convenient way to specify blocking behavior.
+/**
+ * This enumeration contains flags used to control how non-NULL callbacks are
+ * scheduled by asynchronous methods.
+ */
+[assert_size(4)]
+enum PP_CompletionCallback_Flag {
+ /**
+ * This flag allows any non-NULL callback to be always invoked asynchronously,
+ * on success or error, even if the operation could complete synchronously
+ * without blocking.
+ *
+ * The method taking such callback will always return PP_OK_COMPLETIONPENDING.
+ * The callback will be invoked on the main thread of PPAPI execution.
+ *
+ * TODO(polina): make this the default once all the clients use flags.
+ */
+ PP_COMPLETIONCALLBACK_FLAG_NONE = 0 << 0,
+ /**
+ * This flag allows any method taking such callback to complete synchronously
+ * and not call the callback if the operation would not block. This is useful
+ * when performance is an issue, and the operation bandwidth should not be
+ * limited to the processing speed of the message loop.
+ *
+ * On synchronous method completion, the completion result will be returned
+ * by the method itself. Otherwise, the method will return
+ * PP_OK_COMPLETIONPENDING, and the callback will be invoked asynchronously on
+ * the main thread of PPAPI execution.
+ */
+ PP_COMPLETIONCALLBACK_FLAG_OPTIONAL = 1 << 0
+};
+
+
+/**
+ * Any method that takes a PP_CompletionCallback can complete asynchronously.
+ * Refer to PP_CompletionCallback_Flag for more information.
+ *
+ * If PP_CompletionCallback_Func is NULL, the operation might block if necessary
+ * to complete the work. Refer to PP_BlockUntilComplete for more information.
*
- * The result parameter passes an int32_t that if negative indicates an error
- * code. Otherwise the result value indicates success. If it is a positive
- * value then it may carry additional information.
+ * See PP_MakeCompletionCallback() for the description of each field.
*/
[passByValue] struct PP_CompletionCallback {
- /* Function to call during callback. */
PP_CompletionCallback_Func func;
-
- /* Data to pass into callback. */
mem_t user_data;
+ int32_t flags;
};
+
+#inline c
+#include <stdlib.h>
+
+/**
+ * @addtogroup Functions
+ * @{
+ */
+/**
+ * PP_MakeCompletionCallback() is used to create a PP_CompletionCallback
+ * without flags. If you want to alter the default callback behavior, set the
+ * flags to a bit field combination of PP_CompletionCallback_Flag's.
+ *
+ * Example:
+ * struct PP_CompletionCallback cc = PP_MakeCompletionCallback(Foo, NULL);
+ * cc.flags = cc.flags | PP_COMPLETIONCALLBACK_FLAG_OPTIONAL;
+ *
+ * @param[in] func A PP_CompletionCallback_Func to be called on completion.
+ * @param[in] user_data A pointer to user data passed to be passed to the
+ * callback function. This is optional and is typically used to help track state
+ * in case of multiple pending callbacks.
+ *
+ * @return A PP_CompletionCallback structure.
+ */
+PP_INLINE struct PP_CompletionCallback PP_MakeCompletionCallback(
+ PP_CompletionCallback_Func func,
+ void* user_data) {
+ struct PP_CompletionCallback cc;
+ cc.func = func;
+ cc.user_data = user_data;
+ /* TODO(polina): switch the default to PP_COMPLETIONCALLBACK_FLAG_NONE. */
+ cc.flags = PP_COMPLETIONCALLBACK_FLAG_OPTIONAL;
+ return cc;
+}
+
+/**
+ * PP_MakeOptionalCompletionCallback() is used to create a PP_CompletionCallback
+ * with PP_COMPLETIONCALLBACK_FLAG_OPTIONAL set.
+ *
+ * @param[in] func A PP_CompletionCallback_Func to be called on completion.
+ * @param[in] user_data A pointer to user data passed to be passed to the
+ * callback function. This is optional and is typically used to help track state
+ * in case of multiple pending callbacks.
+ *
+ * @return A PP_CompletionCallback structure.
+ */
+PP_INLINE struct PP_CompletionCallback PP_MakeOptionalCompletionCallback(
+ PP_CompletionCallback_Func func,
+ void* user_data) {
+ struct PP_CompletionCallback cc = PP_MakeCompletionCallback(func, user_data);
+ cc.flags = cc.flags | PP_COMPLETIONCALLBACK_FLAG_OPTIONAL;
+ return cc;
+}
+/**
+ * @}
+ */
+
+/**
+ * @addtogroup Functions
+ * @{
+ */
+
+/**
+ * PP_RunCompletionCallback() is used to run a callback. It invokes
+ * the callback function passing it user data specified on creation and
+ * completion |result|.
+ *
+ * @param[in] cc A pointer to a PP_CompletionCallback that will be run.
+ * @param[in] result The result of the operation. Non-positive values correspond
+ * to the error codes from pp_errors.h (excluding PP_OK_COMPLETIONPENDING).
+ * Positive values indicate additional information such as bytes read.
+ */
+PP_INLINE void PP_RunCompletionCallback(struct PP_CompletionCallback* cc,
+ int32_t result) {
+ cc->func(cc->user_data, result);
+}
+
+/**
+ * @}
+ */
+
+/**
+ * @addtogroup Functions
+ * @{
+ */
+
+ /**
+ * PP_BlockUntilComplete() is used in place of an actual completion callback
+ * to request blocking behavior. If specified, the calling thread will block
+ * until the function completes. Blocking completion callbacks are only allowed
+ * from background threads.
+ *
+ * @return A PP_CompletionCallback structure corresponding to a NULL callback.
+ */
+PP_INLINE struct PP_CompletionCallback PP_BlockUntilComplete() {
+ return PP_MakeCompletionCallback(NULL, NULL);
+}
+
+/**
+ * Runs a callback and clears the reference to it.
+ *
+ * This is used when the null-ness of a completion callback is used as a signal
+ * for whether a completion callback has been registered. In this case, after
+ * the execution of the callback, it should be cleared.
+ *
+ * However, this introduces a conflict if the completion callback wants to
+ * schedule more work that involves the same completion callback again (for
+ * example, when reading data from an URLLoader, one would typically queue up
+ * another read callback). As a result, this function clears the pointer
+ * *before* the given callback is executed.
+ */
+PP_INLINE void PP_RunAndClearCompletionCallback(
+ struct PP_CompletionCallback* cc,
+ int32_t res) {
+ struct PP_CompletionCallback temp = *cc;
+ *cc = PP_BlockUntilComplete();
+ PP_RunCompletionCallback(&temp, res);
+}
+/**
+ * @}
+ */
+
+#endinl
+
diff --git a/ppapi/api/pp_errors.idl b/ppapi/api/pp_errors.idl
index 3214bae..ca4c58a 100644
--- a/ppapi/api/pp_errors.idl
+++ b/ppapi/api/pp_errors.idl
@@ -3,61 +3,85 @@
* found in the LICENSE file.
*/
-/* This file defines an enumeration of all PPAPI error codes. */
+/**
+ * This file defines an enumeration of all PPAPI error codes.
+ */
-/* This enumeration contains enumerators of all PPAPI error codes.
+/**
+ * This enumeration contains enumerators of all PPAPI error codes.
* Errors are negative valued.
*/
-enum PP_Error {
- /**
+[unnamed] enum PP_Error {
+ /**
* This value is returned by a function on successful synchronous completion
* or is passed as a result to a PP_CompletionCallback_Func on successful
* asynchronous completion.
*/
PP_OK = 0,
- /**
+ /**
* This value is returned by a function that accepts a PP_CompletionCallback
- * and cannot complete synchronously. This code indicates that the given
+ * and cannot complete synchronously. This code indicates that the given
* callback will be asynchronously notified of the final result once it is
* available.
*/
PP_OK_COMPLETIONPENDING = -1,
- PP_ERROR_WOULDBLOCK = -1, /* DEPRECATED: DO NOT USE */
- /* This value indicates failure for unspecified reasons. */
+
+ /** This value indicates failure for unspecified reasons. */
PP_ERROR_FAILED = -2,
- /* This value indicates failure due to an asynchronous operation being
- * interrupted, typically as a result of user action. */
+ /**
+ * This value indicates failure due to an asynchronous operation being
+ * interrupted, typically as a result of user action.
+ */
PP_ERROR_ABORTED = -3,
- /* This value indicates failure due to an invalid argument. */
+
+ /** This value indicates failure due to an invalid argument. */
PP_ERROR_BADARGUMENT = -4,
- /* This value indicates failure due to an invalid PP_Resource. */
+
+ /** This value indicates failure due to an invalid PP_Resource. */
PP_ERROR_BADRESOURCE = -5,
- /* This value indicates failure due to an unavailable PPAPI interface. */
+
+ /** This value indicates failure due to an unavailable PPAPI interface. */
PP_ERROR_NOINTERFACE = -6,
- /* This value indicates failure due to insufficient privileges. */
+
+ /** This value indicates failure due to insufficient privileges. */
PP_ERROR_NOACCESS = -7,
- /* This value indicates failure due to insufficient memory. */
+
+ /** This value indicates failure due to insufficient memory. */
PP_ERROR_NOMEMORY = -8,
- /* This value indicates failure due to insufficient storage space. */
+
+ /** This value indicates failure due to insufficient storage space. */
PP_ERROR_NOSPACE = -9,
- /* This value indicates failure due to insufficient storage quota. */
+
+ /** This value indicates failure due to insufficient storage quota. */
PP_ERROR_NOQUOTA = -10,
- /* This value indicates failure due to an action already being in progress. */
+
+ /**
+ * This value indicates failure due to an action already being in
+ * progress.
+ */
PP_ERROR_INPROGRESS = -11,
- /* This value indicates failure due to a file that does not exist. */
+ /** This value indicates failure due to a file that does not exist. */
+
+ /**
+ * The requested command is not supported by the browser.
+ */
+ PP_ERROR_NOTSUPPORTED = -12,
+
PP_ERROR_FILENOTFOUND = -20,
- /* This value indicates failure due to a file that already exists. */
+ /** This value indicates failure due to a file that already exists. */
PP_ERROR_FILEEXISTS = -21,
- /* This value indicates failure due to a file that is too big. */
+ /** This value indicates failure due to a file that is too big. */
PP_ERROR_FILETOOBIG = -22,
- /* This value indicates failure due to a file having been modified
+ /**
+ * This value indicates failure due to a file having been modified
* unexpectedly.
*/
PP_ERROR_FILECHANGED = -23,
- /* This value indicates failure due to a time limit being exceeded. */
+ /** This value indicates failure due to a time limit being exceeded. */
PP_ERROR_TIMEDOUT = -30,
- /* This value indicates that the user cancelled rather than providing expected
- * input.
+ /**
+ * This value indicates that the user cancelled rather than providing
+ * expected input.
*/
PP_ERROR_USERCANCEL = -40
};
diff --git a/ppapi/api/pp_file_info.idl b/ppapi/api/pp_file_info.idl
new file mode 100644
index 0000000..d974044
--- /dev/null
+++ b/ppapi/api/pp_file_info.idl
@@ -0,0 +1,74 @@
+/* Copyright (c) 2011 The Chromium Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/**
+ * This file defines three enumerations for use in the PPAPI C file IO APIs.
+ */
+
+/**
+ * The <code>PP_FileType</code> enum contains file type constants.
+ */
+[assert_size(4)]
+enum PP_FileType {
+ /** A regular file type */
+ PP_FILETYPE_REGULAR,
+ /** A directory */
+ PP_FILETYPE_DIRECTORY,
+ /** A catch-all for unidentified types */
+ PP_FILETYPE_OTHER
+};
+
+/**
+ * The <code>PP_FileSystemType</code> enum contains file system type constants.
+ */
+[assert_size(4)]
+enum PP_FileSystemType {
+ /** For identified invalid return values */
+ PP_FILESYSTEMTYPE_INVALID = 0,
+ /** For external file system types */
+ PP_FILESYSTEMTYPE_EXTERNAL,
+ /** For local persistant file system types */
+ PP_FILESYSTEMTYPE_LOCALPERSISTENT,
+ /** For local temporary file system types */
+ PP_FILESYSTEMTYPE_LOCALTEMPORARY
+};
+
+/**
+ * The <code>PP_FileInfo</code> struct represents all information about a file,
+ * such as size, type, and creation time.
+ */
+[assert_size(40)]
+struct PP_FileInfo {
+ /** This value represents the size of the file measured in bytes */
+ int64_t size;
+
+ /**
+ * This value represents the type of file as defined by the
+ * <code>PP_FileType</code> enum
+ */
+ PP_FileType type;
+
+ /**
+ * This value represents the file system type of the file as defined by the
+ * <code>PP_FileSystemType</code> enum.
+ */
+ PP_FileSystemType system_type;
+
+ /**
+ * This value represents the creation time of the file.
+ */
+ PP_Time creation_time;
+
+ /**
+ * This value represents the last time the file was accessed.
+ */
+ PP_Time last_access_time;
+
+ /**
+ * This value represents the last time the file was modified.
+ */
+ PP_Time last_modified_time;
+};
+
diff --git a/ppapi/api/pp_input_event.idl b/ppapi/api/pp_input_event.idl
index 5086356..1ed93cc 100644
--- a/ppapi/api/pp_input_event.idl
+++ b/ppapi/api/pp_input_event.idl
@@ -3,59 +3,13 @@
* found in the LICENSE file.
*/
-/* This file defines the API used to handle mouse and keyboard input events. */
-
-/* This enumeration contains constants representing each mouse button. */
-enum PP_InputEvent_MouseButton {
- PP_INPUTEVENT_MOUSEBUTTON_NONE = -1,
- PP_INPUTEVENT_MOUSEBUTTON_LEFT = 0,
- PP_INPUTEVENT_MOUSEBUTTON_MIDDLE = 1,
- PP_INPUTEVENT_MOUSEBUTTON_RIGHT = 2
-};
-
-/* This enumeration contains mouse and keyboard event constants. */
-enum PP_InputEvent_Type {
- PP_INPUTEVENT_TYPE_UNDEFINED = -1,
- /* PP_InputEvent_Mouse */
- PP_INPUTEVENT_TYPE_MOUSEDOWN = 0,
- /* PP_InputEvent_Mouse */
- PP_INPUTEVENT_TYPE_MOUSEUP = 1,
- /* PP_InputEvent_Mouse */
- PP_INPUTEVENT_TYPE_MOUSEMOVE = 2,
- /* PP_InputEvent_Mouse */
- PP_INPUTEVENT_TYPE_MOUSEENTER = 3,
- /* PP_InputEvent_Mouse */
- PP_INPUTEVENT_TYPE_MOUSELEAVE = 4,
- /* PP_InputEvent_Wheel */
- PP_INPUTEVENT_TYPE_MOUSEWHEEL = 5,
- /* PP_InputEvent_Key */
- PP_INPUTEVENT_TYPE_RAWKEYDOWN = 6,
- /* PP_InputEvent_Key */
- PP_INPUTEVENT_TYPE_KEYDOWN = 7,
- /* PP_InputEvent_Key */
- PP_INPUTEVENT_TYPE_KEYUP = 8,
- /* PP_InputEvent_Character */
- PP_INPUTEVENT_TYPE_CHAR = 9,
- /* PP_InputEvent_Mouse */
- PP_INPUTEVENT_TYPE_CONTEXTMENU = 10
-};
-
-/* This enumeration contains event modifier constants. */
-enum PP_InputEvent_Modifier {
- PP_INPUTEVENT_MODIFIER_SHIFTKEY = 1 << 0,
- PP_INPUTEVENT_MODIFIER_CONTROLKEY = 1 << 1,
- PP_INPUTEVENT_MODIFIER_ALTKEY = 1 << 2,
- PP_INPUTEVENT_MODIFIER_METAKEY = 1 << 3,
- PP_INPUTEVENT_MODIFIER_ISKEYPAD = 1 << 4,
- PP_INPUTEVENT_MODIFIER_ISAUTOREPEAT = 1 << 5,
- PP_INPUTEVENT_MODIFIER_LEFTBUTTONDOWN = 1 << 6,
- PP_INPUTEVENT_MODIFIER_MIDDLEBUTTONDOWN = 1 << 7,
- PP_INPUTEVENT_MODIFIER_RIGHTBUTTONDOWN = 1 << 8,
- PP_INPUTEVENT_MODIFIER_CAPSLOCKKEY = 1 << 9,
- PP_INPUTEVENT_MODIFIER_NUMLOCKKEY = 1 << 10
-};
+/**
+ * This file defines the API used to handle mouse and keyboard input events.
+ */
-/* The PP_InputEvent_Key struct represents a key up or key down event.
+/**
+ * The <code>PP_InputEvent_Key</code> struct represents a key up or key down
+ * event.
*
* Key up and key down events correspond to physical keys on the keyboard. The
* actual character that the user typed (if any) will be delivered in a
@@ -70,17 +24,22 @@ enum PP_InputEvent_Modifier {
* If your module depends on receiving key up events, it should also handle
* "lost focus" as the equivalent of "all keys up."
*/
+[assert_size(8)]
struct PP_InputEvent_Key {
- /* This value is a bit field combination of the EVENT_MODIFIER flags. */
+ /** This value is a bit field combination of the EVENT_MODIFIER flags. */
uint32_t modifier;
- /* The key code.
- *
- * TODO(brettw) define what these actually are.
+
+ /**
+ * This value reflects the DOM KeyboardEvent <code>keyCode</code> field.
+ * Chrome populates this with the Windows-style Virtual Key code of the key.
*/
+
uint32_t key_code;
};
-/* The PP_InputEvent_Character struct represents a typed character event.
+/**
+ * The <code>PP_InputEvent_Character</code> struct represents a typed character
+ * event.
*
* Normally, the program will receive a key down event, followed by a character
* event, followed by a key up event. The character event will have any
@@ -99,8 +58,9 @@ struct PP_InputEvent_Key {
* character (can't combine it with 'R', so just send the raw unlaut so it
* isn't lost"), 'R' character event, 'R' key up.
*/
+[assert_size(12)]
struct PP_InputEvent_Character {
- /** A combination of the EVENT_MODIFIER flags. */
+ /** A combination of the <code>PP_InputEvent_Modifier</code> flags. */
uint32_t modifier;
/**
@@ -112,19 +72,27 @@ struct PP_InputEvent_Character {
char[5] text;
};
-/* The PP_InputEvent_Mouse struct represents all mouse events except
- * mouse wheel events.
+/**
+ * The <code>PP_InputEvent_Mouse</code> struct represents all mouse events
+ * except mouse wheel events.
*/
+[assert_size(20)]
struct PP_InputEvent_Mouse {
- /* This value is a bit field combination of the EVENT_MODIFIER flags. */
+ /**
+ * This value is a bit field combination of the
+ * <code>PP_InputEvent_Modifier</code> flags.
+ */
uint32_t modifier;
- /* This value represents the button that changed for mouse down or up events.
- *
- * This value will be PP_EVENT_MOUSEBUTTON_NONE for mouse move, enter, and
- * leave events.
+
+ /**
+ * This value represents the button that changed for mouse down or up events.
+ * This value will be <code>PP_EVENT_MOUSEBUTTON_NONE</code> for mouse move,
+ * enter, and leave events.
*/
PP_InputEvent_MouseButton button;
- /* This values represents the x coordinate of the mouse when the event
+
+ /**
+ * This values represents the x coordinate of the mouse when the event
* occurred.
*
* In most, but not all, cases these coordinates will just be integers.
@@ -133,7 +101,8 @@ struct PP_InputEvent_Mouse {
* plugin will give non-integer values.
*/
float_t x;
- /* This values represents the y coordinate of the mouse when the event
+ /**
+ * This values represents the y coordinate of the mouse when the event
* occurred.
*
* In most, but not all, cases these coordinates will just be integers.
@@ -142,15 +111,24 @@ struct PP_InputEvent_Mouse {
* plugin will give non-integer values.
*/
float_t y;
- /* TODO(brettw) figure out exactly what this means. */
+
+ // TODO(brettw) figure out exactly what this means.
int32_t click_count;
};
-/* The PP_InputEvent_Wheel struct represents all mouse wheel events. */
-struct PP_InputEvent_Wheel {
- /* This value represents a combination of the EVENT_MODIFIER flags. */
+/**
+ * The <code>PP_InputEvent_Wheel</code> struct represents all mouse wheel
+ * events.
+ */
+[assert_size(24)] struct PP_InputEvent_Wheel {
+ /**
+ * This value represents a combination of the <code>EVENT_MODIFIER</code>
+ * flags.
+ */
uint32_t modifier;
- /* Indicates the amount vertically and horizontally the user has requested
+
+ /**
+ * Indicates the amount vertically and horizontally the user has requested
* to scroll by with their mouse wheel. A scroll down or to the right (where
* the content moves up or left) is represented as positive values, and
* a scroll up or to the left (where the content moves down or right) is
@@ -171,12 +149,15 @@ struct PP_InputEvent_Wheel {
* "clicks".
*/
float_t delta_x;
- /* See delta_x. */
+
+ /** This value represents */
float_t delta_y;
- /* The number of "clicks" of the scroll wheel that have produced the
+
+ /**
+ * The number of "clicks" of the scroll wheel that have produced the
* event. The value may have system-specific acceleration applied to it,
* depending on the device. The positive and negative meanings are the same
- * as for |delta|.
+ * as for <code>delta_x</code> and <code>delta_y</code>.
*
* If you are scrolling, you probably want to use the delta values above.
* These tick events can be useful if you aren't doing actual scrolling and
@@ -191,31 +172,39 @@ struct PP_InputEvent_Wheel {
* of scrolling as for a mouse that has a discrete mouse wheel.
*/
float_t wheel_ticks_x;
- /* See wheel_ticks_x. */
+
+ /** This value represents */
float_t wheel_ticks_y;
- /* Indicates if the scroll delta_x/delta_y indicates pages or lines to
- * scroll by. When true, the user is requesting to scroll by pages.
+
+ /**
+ * Indicates if the scroll <code>delta_x</code>/<code>delta_y</code>
+ * indicates pages or lines to scroll by. When true, the user is requesting
+ * to scroll by pages.
*/
PP_Bool scroll_by_page;
};
-/* Event's data.
- *
- * Padding allows new events to be added without changing the size of this
- * struct.
+/**
+ * The PP_InputEventData union represents all input event data types.
*/
-[union, pad=64] struct PP_InputEventData {
- /* Data for key events. */
- PP_InputEvent_Key key;
- /* Data for characted events. */
- PP_InputEvent_Character character;
- /* Data for mouse events. */
- PP_InputEvent_Mouse mouse;
- /* Data for wheel events. */
- PP_InputEvent_Wheel wheel;
+[union] struct PP_InputEventData {
+ [wcomment] PP_InputEvent_Key key;
+ [wcomment] PP_InputEvent_Character character;
+ [wcomment] PP_InputEvent_Mouse mouse;
+ [wcomment] PP_InputEvent_Wheel wheel;
+
+ /**
+ * This value allows new events to be added without changing the size of
+ * this struct.
+ */
+ char[64] padding;
+
};
-/* The PP_InputEvent struct represents all input events. */
+/**
+ * The PP_InputEvent struct represents all input events.
+ */
+[assert_size(80)]
struct PP_InputEvent {
/** This value represents the type of the event. */
PP_InputEvent_Type type;
@@ -233,6 +222,9 @@ struct PP_InputEvent {
*/
PP_TimeTicks time_stamp;
- /** This value represents the event type and its specific data. */
+ /**
+ * This value represents the event type and its specific data.
+ */
PP_InputEventData u;
};
+
diff --git a/ppapi/api/pp_instance.idl b/ppapi/api/pp_instance.idl
index 5e861ce..9fa28ac 100644
--- a/ppapi/api/pp_instance.idl
+++ b/ppapi/api/pp_instance.idl
@@ -3,16 +3,19 @@
* found in the LICENSE file.
*/
-/* This file defines the PP_Instance type which uniquely identifies one module
+/**
+ * This file defines the PP_Instance type which uniquely identifies one module
* instance.
*/
-/* The PP_Instance value uniquely identifies one instance of a module
- * (.nexe/PP_Module). There will be one module instance for every
+/**
+ * The <code>PP_Instance</code> value uniquely identifies one instance of a
+ * module (.nexe/PP_Module). There will be one module instance for every
* \<embed> tag on a page.
*
* This identifier is an opaque handle assigned by the browser to the module.
* It is guaranteed never to be 0, so a module can initialize it to 0 to
- * indicate a NULL handle.
+ * indicate a "NULL handle."
*/
-typedef int32_t PP_Instance;
+[assert_size(4)] typedef int32_t PP_Instance;
+
diff --git a/ppapi/api/pp_macros.idl b/ppapi/api/pp_macros.idl
new file mode 100644
index 0000000..f189d4a
--- /dev/null
+++ b/ppapi/api/pp_macros.idl
@@ -0,0 +1,95 @@
+/* Copyright (c) 2011 The Chromium Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/**
+ * Defines the API ...
+ */
+
+#inline c
+
+/*
+ * @addtogroup PP
+ * @{
+ */
+
+/* Use PP_INLINE to tell the compiler to inline functions. The main purpose of
+ * inline functions in ppapi is to allow us to define convenience functions in
+ * the ppapi header files, without requiring clients or implementers to link a
+ * PPAPI C library. The "inline" keyword is not supported by pre-C99 C
+ * compilers (such as MS Visual Studio 2008 and older versions of GCC). MSVS
+ * supports __forceinline and GCC supports __inline__. Use of the static
+ * keyword ensures (in C) that the function is not compiled on its own, which
+ * could cause multiple definition errors.
+ * http://msdn.microsoft.com/en-us/library/z8y1yy88.aspx
+ * http://gcc.gnu.org/onlinedocs/gcc/Inline.html
+ */
+#if defined(__cplusplus)
+/* The inline keyword is part of C++ and guarantees we won't get multiple
+ * definition errors.
+ */
+# define PP_INLINE inline
+#else
+# if defined(_MSC_VER)
+# define PP_INLINE static __forceinline
+# else
+# define PP_INLINE static __inline__
+# endif
+#endif
+
+/* This is a compile-time assertion useful for ensuring that a given type is
+ a given number of bytes wide. The size of the array is designed to be 1
+ (which should always be valid) if the enum's size is SIZE, and otherwise the
+ size of the array will be -1 (which all/most compilers should flag as an
+ error). This is wrapped inside a struct, because if it is a simple global
+ we get multiple definition errors at link time.
+
+ NAME is the name of the type without any spaces or the struct or enum
+ keywords.
+
+ CTYPENAME is the typename required by C. I.e., for a struct or enum, the
+ appropriate keyword must be included.
+
+ SIZE is the expected size in bytes.
+ */
+#define PP_COMPILE_ASSERT_SIZE_IN_BYTES_IMPL(NAME, CTYPENAME, SIZE) \
+struct PP_Dummy_Struct_For_##NAME { \
+char _COMPILE_ASSERT_FAILED_The_type_named_ \
+## NAME ## _is_not_ ## SIZE ## \
+_bytes_wide[(sizeof(CTYPENAME) == SIZE) ? 1 : -1]; }
+
+/* PP_COMPILE_ASSERT_SIZE_IN_BYTES is for typenames that contain no spaces.
+ E.g.:
+ PP_COMPILE_ASSERT_SIZE_IN_BYTES(int, 4);
+ typedef struct { int a; } Foo;
+ PP_COMPILE_ASSERT_SIZE_IN_BYTES(Foo, 4);
+ */
+#define PP_COMPILE_ASSERT_SIZE_IN_BYTES(NAME, SIZE) \
+PP_COMPILE_ASSERT_SIZE_IN_BYTES_IMPL(NAME, NAME, SIZE)
+
+/* PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES is for typenames that contain 'struct'
+ in C. That is, struct names that are not typedefs.
+ E.g.:
+ struct Foo { int a; };
+ PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(Foo, 4);
+ */
+#define PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(NAME, SIZE) \
+PP_COMPILE_ASSERT_SIZE_IN_BYTES_IMPL(NAME, struct NAME, SIZE)
+
+/* PP_COMPILE_ASSERT_ENUM_SIZE_IN_BYTES is for typenames that contain 'enum'
+ in C. That is, enum names that are not typedefs.
+ E.g.:
+ enum Bar { A = 0, B = 1 };
+ PP_COMPILE_ASSERT_ENUM_SIZE_IN_BYTES(Foo, 4);
+ */
+#define PP_COMPILE_ASSERT_ENUM_SIZE_IN_BYTES(NAME, SIZE) \
+PP_COMPILE_ASSERT_SIZE_IN_BYTES_IMPL(NAME, enum NAME, SIZE)
+
+/**
+ * @}
+ * End of addtogroup PP
+ */
+
+#endinl
+
diff --git a/ppapi/api/pp_module.idl b/ppapi/api/pp_module.idl
index 657bb5c..7cb8080 100644
--- a/ppapi/api/pp_module.idl
+++ b/ppapi/api/pp_module.idl
@@ -3,14 +3,18 @@
* found in the LICENSE file.
*/
-/* This file defines the PP_Module type which uniquely identifies the module
+/**
+ * This file defines the PP_Module type which uniquely identifies the module
* or .nexe.
*/
-/* The PP_Module value uniquely identifies the module or .nexe.
+/**
+ * The PP_Module value uniquely identifies the module or .nexe.
*
* This identifier is an opaque handle assigned by the browser to the module. It
* is guaranteed never to be 0, so a module can initialize it to 0 to
* indicate a "NULL handle."
*/
+[assert_size(4)]
typedef int32_t PP_Module;
+
diff --git a/ppapi/api/pp_point.idl b/ppapi/api/pp_point.idl
index 37aeca7..8568218 100644
--- a/ppapi/api/pp_point.idl
+++ b/ppapi/api/pp_point.idl
@@ -3,18 +3,70 @@
* found in the LICENSE file.
*/
-/* This file defines the API to create a 2 dimensional point.
+/**
+ * This file defines the API to create a 2 dimensional point.
* 0,0 is the upper-left starting coordinate.
*/
-/* The PP_Point structure defines the x and y coordinates of a point. */
+/**
+ * The PP_Point structure defines the integer x and y coordinates of a point.
+ */
+[assert_size(8), returnByValue]
struct PP_Point {
- /* The horizontal coordinate of a point, starting with 0 as the left-most
- * coordinate.
+ /**
+ * This value represents the horizontal coordinate of a point, starting with 0
+ * as the left-most coordinate.
*/
int32_t x;
- /* The vertical coordinate of a point, starting with 0 as the top-most
- * coordinate.
+
+ /**
+ * This value represents the vertical coordinate of a point, starting with 0
+ * as the top-most coordinate.
*/
int32_t y;
};
+
+/**
+ * The PP_FloatPoint structure defines the floating-point x and y coordinates
+ * of a point.
+ */
+[assert_size(8), returnByValue]
+struct PP_FloatPoint {
+ float_t x;
+ float_t y;
+};
+
+#inline c
+/**
+ * @addtogroup Functions
+ * @{
+ */
+
+/**
+ * PP_MakePoint() creates a <code>PP_Point</code> given the x and y coordinates
+ * as int32_t values.
+ * @param[in] x An int32_t value representing a horizontal coordinate of a
+ * point, starting with 0 as the left-most coordinate.
+ * @param[in] y An int32_t value representing a vertical coordinate of a point,
+ * starting with 0 as the top-most coordinate.
+ * @return A <code>PP_Point</code> structure.
+ */
+PP_INLINE struct PP_Point PP_MakePoint(int32_t x, int32_t y) {
+ struct PP_Point ret;
+ ret.x = x;
+ ret.y = y;
+ return ret;
+}
+
+PP_INLINE struct PP_FloatPoint PP_MakeFloatPoint(float x, float y) {
+ struct PP_FloatPoint ret;
+ ret.x = x;
+ ret.y = y;
+ return ret;
+}
+/**
+ * @}
+ */
+
+#endinl
+
diff --git a/ppapi/api/pp_rect.idl b/ppapi/api/pp_rect.idl
index 1e82998..798cd2d 100644
--- a/ppapi/api/pp_rect.idl
+++ b/ppapi/api/pp_rect.idl
@@ -3,12 +3,58 @@
* found in the LICENSE file.
*/
-/* This file defines the APIs for creating a 2-dimensional rectangle. */
+/**
+ * This file defines the APIs for creating a 2 dimensional rectangle.
+ */
-/* The PP_Rect struct contains the size and location of a 2D rectangle. */
+/**
+ * The <code>PP_Rect</code> struct contains the size and location of a 2D
+ * rectangle.
+ */
+[assert_size(16)]
struct PP_Rect {
- /* The x and y coordinates of the upper-left corner of the rectangle. */
+ /**
+ * This value represents the x and y coordinates of the upper-left corner of
+ * the rectangle.
+ */
PP_Point point;
- /* The width and height of the rectangle. */
+
+ /** This value represents the width and height of the rectangle. */
PP_Size size;
};
+
+#inline c
+
+/**
+ * @addtogroup Functions
+ * @{
+ */
+
+/**
+ * PP_MakeRectFromXYWH() creates a <code>PP_Rect</code> given x and y
+ * coordinates and width and height dimensions as int32_t values.
+ *
+ * @param[in] x An int32_t value representing a horizontal coordinate of a
+ * point, starting with 0 as the left-most coordinate.
+ * @param[in] y An int32_t value representing a vertical coordinate of a point,
+ * starting with 0 as the top-most coordinate.
+ * @param[in] w An int32_t value representing a width.
+ * @param[in] h An int32_t value representing a height.
+ *
+ * @return A <code>PP_Rect</code> structure.
+ */
+PP_INLINE struct PP_Rect PP_MakeRectFromXYWH(int32_t x, int32_t y,
+ int32_t w, int32_t h) {
+ struct PP_Rect ret;
+ ret.point.x = x;
+ ret.point.y = y;
+ ret.size.width = w;
+ ret.size.height = h;
+ return ret;
+}
+/**
+ * @}
+ */
+
+#endinl
+
diff --git a/ppapi/api/pp_resource.idl b/ppapi/api/pp_resource.idl
index eeed9a3..e57fd85 100644
--- a/ppapi/api/pp_resource.idl
+++ b/ppapi/api/pp_resource.idl
@@ -3,19 +3,25 @@
* found in the LICENSE file.
*/
-/* This file defines the PP_Resource type. */
+/**
+ * This file defines the <code>PP_Resource</code> type which represents data
+ * associated with the module.
+ */
-/* A resource is data associated with the Pepper plugin interface. While a
- * Var represents something callable to JS or from the plugin to the DOM, a
- * resource has no meaning or visibility outside of the plugin interface.
+/**
+ * This typdef represents an opaque handle assigned by the browser to the
+ * resource. The handle is guaranteed never to be 0 for a valid resource, so a
+ * module can initialize it to 0 to indicate a "NULL handle." Some interfaces
+ * may return a NULL resource to indicate failure.
*
- * Resources are reference counted. Use AddRefResource and ReleaseResource to
- * manage your reference count of a resource. The data will be automatically
- * destroyed when the internal reference count reaches 0.
+ * While a Var represents something callable to JS or from the module to
+ * the DOM, a resource has no meaning or visibility outside of the module
+ * interface.
*
- * Value is an opaque handle assigned by the browser to the resource. It is
- * guaranteed never to be 0 for a valid resource, so a plugin can initialize
- * it to 0 to indicate a "NULL handle." Some interfaces may return a NULL
- * resource to indicate failure.
+ * Resources are reference counted. Use <code>AddRefResource()</code>
+ * and <code>ReleaseResource()</code> in <code>ppb_core.h</code> to manage the
+ * reference count of a resource. The data will be automatically destroyed when
+ * the internal reference count reaches 0.
*/
-typedef int32_t PP_Resource;
+[assert_size(4)] typedef int32_t PP_Resource;
+
diff --git a/ppapi/api/pp_size.idl b/ppapi/api/pp_size.idl
index 2f86724..dc31438 100644
--- a/ppapi/api/pp_size.idl
+++ b/ppapi/api/pp_size.idl
@@ -3,12 +3,44 @@
* found in the LICENSE file.
*/
-/* This file defines the width and height of a 2 dimenstional rectangle. */
+/**
+ * This file defines the width and height of a 2D rectangle.
+ */
-/* The PP_Size struct contains the size of a 2D rectangle. */
+/**
+ * The <code>PP_Size</code> struct contains the size of a 2D rectangle.
+ */
+[assert_size(8)]
struct PP_Size {
- /* This value represents the width of the rectangle. */
+ /** This value represents the width of the rectangle. */
int32_t width;
- /* This value represents the height of the rectangle. */
+ /** This value represents the height of the rectangle. */
int32_t height;
};
+
+#inline c
+/**
+ * @addtogroup Functions
+ * @{
+ */
+
+/**
+ * PP_MakeSize() creates a <code>PP_Size</code> given a width and height as
+ * int32_t values.
+ *
+ * @param[in] w An int32_t value representing a width.
+ * @param[in] h An int32_t value representing a height.
+ *
+ * @return A <code>PP_Size</code> structure.
+ */
+PP_INLINE struct PP_Size PP_MakeSize(int32_t w, int32_t h) {
+ struct PP_Size ret;
+ ret.width = w;
+ ret.height = h;
+ return ret;
+}
+/**
+ * @}
+ */
+#endinl
+
diff --git a/ppapi/api/pp_stdint.idl b/ppapi/api/pp_stdint.idl
new file mode 100644
index 0000000..51a3eeb
--- /dev/null
+++ b/ppapi/api/pp_stdint.idl
@@ -0,0 +1,53 @@
+/* Copyright (c) 2011 The Chromium Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/**
+ * This file provides a definition of C99 sized types
+ * for Microsoft compilers. These definitions only apply
+ * for trusted modules.
+ */
+
+#inline
+
+/**
+ *
+ * @addtogroup Typedefs
+ * @{
+ */
+#if defined(_MSC_VER)
+
+/** This value represents a guaranteed unsigned 8 bit integer. */
+typedef unsigned char uint8_t;
+
+/** This value represents a guaranteed signed 8 bit integer. */
+typedef signed char int8_t;
+
+/** This value represents a guaranteed unsigned 16 bit short. */
+typedef unsigned short uint16_t;
+
+/** This value represents a guaranteed signed 16 bit short. */
+typedef short int16_t;
+
+/** This value represents a guaranteed unsigned 32 bit integer. */
+typedef unsigned int uint32_t;
+
+/** This value represents a guaranteed signed 32 bit integer. */
+typedef int int32_t;
+
+/** This value represents a guaranteed signed 64 bit integer. */
+typedef __int64 int64_t;
+
+/** This value represents a guaranteed unsigned 64 bit integer. */
+typedef unsigned __int64 uint64_t;
+
+#else
+#include <stdint.h>
+#endif
+/**
+ * @}
+ */
+
+#endinl
+
diff --git a/ppapi/api/pp_time.idl b/ppapi/api/pp_time.idl
index 1b86368..05c28d9 100644
--- a/ppapi/api/pp_time.idl
+++ b/ppapi/api/pp_time.idl
@@ -3,21 +3,29 @@
* found in the LICENSE file.
*/
-/* This file defines time and time ticks types. */
+/**
+ * This file defines time and time ticks types.
+ */
+
-/* The PP_Time type represents the "wall clock time" according to the browser
- * and is defined as the number of seconds since the Epoch (00:00:00 UTC,
- * January 1, 1970).
+/**
+ * The <code>PP_Time</code> type represents the "wall clock time" according
+ * to the browser and is defined as the number of seconds since the Epoch
+ * (00:00:00 UTC, January 1, 1970).
*/
+[assert_size(8)]
typedef double_t PP_Time;
-/* A PP_TimeTicks value represents time ticks which are measured in seconds
- * and are used for indicating the time that certain messages were received.
- * In contrast to PP_Time, PP_TimeTicks does not correspond to any actual
- * wall clock time and will not change discontinuously if the user changes
- * their computer clock.
+/**
+ * A <code>PP_TimeTicks</code> value represents time ticks which are measured
+ * in seconds and are used for indicating the time that certain messages were
+ * received. In contrast to <code>PP_Time</code>, <code>PP_TimeTicks</code>
+ * does not correspond to any actual wall clock time and will not change
+ * discontinuously if the user changes their computer clock.
*
* The units are in seconds, but are not measured relative to any particular
* epoch, so the most you can do is compare two values.
*/
+[assert_size(8)]
typedef double_t PP_TimeTicks;
+
diff --git a/ppapi/api/pp_var.idl b/ppapi/api/pp_var.idl
index f6f35e6..5927cbc 100644
--- a/ppapi/api/pp_var.idl
+++ b/ppapi/api/pp_var.idl
@@ -3,100 +3,214 @@
* found in the LICENSE file.
*/
-/* This file defines the API for handling the passing of data types between
+/**
+ * This file defines the API for handling the passing of data types between
* your module and the page.
*/
-/* PP_VarType is an enumeration of the different types that can be contained
- * within a PP_VAR structure.
+/**
+ * The <code>PP_VarType</code> is an enumeration of the different types that
+ * can be contained within a <code>PP_Var</code> structure.
*/
+[assert_size(4)]
enum PP_VarType {
- /*
+ /**
* An undefined value.
*/
- PP_VARTYPE_UNDEFINED = 0,
+ PP_VARTYPE_UNDEFINED,
- /*
+ /**
* A NULL value. This is similar to undefined, but JavaScript differentiates
- * the two so we expose it here as well.
+ * the two so it is exposed here as well.
*/
- PP_VARTYPE_NULL = 1,
+ PP_VARTYPE_NULL,
- /*
- * A boolean value, use the as_bool member of the var.
+ /**
+ * A boolean value, use the <code>as_bool</code> member of the var.
*/
- PP_VARTYPE_BOOL = 2,
+ PP_VARTYPE_BOOL,
- /*
- * A 32-bit integer value. Use the as_int member of the var.
+ /**
+ * A 32-bit integer value. Use the <code>as_int</code> member of the var.
*/
- PP_VARTYPE_INT32 = 3,
+ PP_VARTYPE_INT32,
- /*
- * A double-precision floating point value. Use the as_double member of the
- * var.
+ /**
+ * A double-precision floating point value. Use the <code>as_double</code>
+ * member of the var.
*/
- PP_VARTYPE_DOUBLE = 4,
+ PP_VARTYPE_DOUBLE,
- /*
- * The Var represents a string. The as_id field is used to identify the
- * string, which may be created and retrieved from the PPB_Var interface.
+ /**
+ * The Var represents a string. The <code>as_id</code> field is used to
+ * identify the string, which may be created and retrieved from the
+ * <code>PPB_Var</code> interface.
*/
- PP_VARTYPE_STRING = 5,
+ PP_VARTYPE_STRING,
- /*
+ /**
* Represents a JavaScript object. This vartype is not currently usable
- * from plugins, although it is used internally for some tasks.
+ * from modules, although it is used internally for some tasks.
*/
- PP_VARTYPE_OBJECT = 6,
+ PP_VARTYPE_OBJECT,
- /*
+ /**
* Arrays and dictionaries are not currently supported but will be added
* in future revisions. These objects are reference counted so be sure
* to properly AddRef/Release them as you would with strings to ensure your
- * plugin will continue to work with future versions of the API.
+ * module will continue to work with future versions of the API.
*/
- PP_VARTYPE_ARRAY = 7,
- PP_VARTYPE_DICTIONARY = 8
+ PP_VARTYPE_ARRAY,
+ PP_VARTYPE_DICTIONARY
};
-/* This structure contains the various elements type within the PP_VAR. */
+/**
+ * The PP_VarValue union stores the data for any one of the types listed
+ * in the PP_VarType enum.
+ */
[union] struct PP_VarValue {
- /* Value if type is PP_VARTYPE_BOOL. */
+ /**
+ * If <code>type</code> is <code>PP_VARTYPE_BOOL</code>,
+ * <code>as_bool</code> represents the value of this <code>PP_Var</code> as
+ * <code>PP_Bool</code>.
+ */
PP_Bool as_bool;
-
- /* Value if type is PP_VARTYPE_INT32. */
+
+ /**
+ * If <code>type</code> is <code>PP_VARTYPE_INT32</code>,
+ * <code>as_int</code> represents the value of this <code>PP_Var</code> as
+ * <code>int32_t</code>.
+ */
int32_t as_int;
-
- /* Value if type is PP_VARTYPE_DOUBLE. */
+
+ /**
+ * If <code>type</code> is <code>PP_VARTYPE_DOUBLE</code>,
+ * <code>as_double</code> represents the value of this <code>PP_Var</code>
+ * as <code>double</code>.
+ */
double_t as_double;
-
- /* Internal ID for strings and objects. The identifier is an opaque handle
- * assigned by the browser to the plugin. It is guaranteed never to be 0,
- * so a plugin can initialize this ID to 0 to indicate a "NULL handle."
+
+ /**
+ * If <code>type</code> is <code>PP_VARTYPE_STRING</code>,
+ * <code>PP_VARTYPE_OBJECT</code>, <code>PP_VARTYPE_ARRAY</code>, or
+ * <code>PP_VARTYPE_DICTIONARY</code>,
+ * <code>as_id</code> represents the value of this <code>PP_Var</code> as
+ * an opaque handle assigned by the browser. This handle is guaranteed
+ * never to be 0, so a module can initialize this ID to 0 to indicate a
+ * "NULL handle."
*/
int64_t as_id;
};
-/* The PP_VAR struct is a variant data type and can contain any
- * value of one of the types named in the PP_VarType enum. This structure is
- * for passing data between native code which can be strongly typed and the
- * browser (JavaScript) which isn't strongly typed.
+/**
+ * The <code>PP_VAR</code> struct is a variant data type and can contain any
+ * value of one of the types named in the <code>PP_VarType</code> enum. This
+ * structure is for passing data between native code which can be strongly
+ * typed and the browser (JavaScript) which isn't strongly typed.
*
* JavaScript has a "number" type for holding a number, and does not
* differentiate between floating point and integer numbers. The
* JavaScript operations will try to optimize operations by using
* integers when possible, but could end up with doubles. Therefore,
- * you can't assume a numeric PP_Var will be the type you expect.
- * Your code should be capable of handling either int32_t or double for
- * numeric PP_Vars sent from JavaScript.
+ * you can't assume a numeric <code>PP_Var</code> will be the type you expect.
+ * Your code should be capable of handling either int32_t or double for numeric
+ * PP_Vars sent from JavaScript.
*/
-[passByValue] struct PP_Var {
- /* Type. */
+[passByValue, returnByValue, assert_size(16)]
+struct PP_Var {
PP_VarType type;
-
- /* Type-dependent value. */
+
+ /**
+ * The <code>padding</code> ensures <code>value</code> is aligned on an
+ * 8-byte boundary relative to the start of the struct. Some compilers
+ * align doubles on 8-byte boundaries for 32-bit x86, and some align on
+ * 4-byte boundaries.
+ */
+ int32_t padding;
+
+ /**
+ * This <code>value</code> represents the contents of the PP_Var. Only one of
+ * the fields of <code>value</code> is valid at a time based upon
+ * <code>type</code>.
+ */
PP_VarValue value;
};
+
+#inline c
+/**
+ * @addtogroup Functions
+ * @{
+ */
+
+/**
+ * PP_MakeUndefined() is used to wrap an undefined value into a
+ * <code>PP_Var</code> struct for passing to the browser.
+ *
+ * @return A <code>PP_Var</code> structure.
+ */
+PP_INLINE struct PP_Var PP_MakeUndefined() {
+ struct PP_Var result = { PP_VARTYPE_UNDEFINED, 0, {PP_FALSE} };
+ return result;
+}
+
+/**
+ * PP_MakeNull() is used to wrap a null value into a
+ * <code>PP_Var</code> struct for passing to the browser.
+ *
+ * @return A <code>PP_Var</code> structure,
+ */
+PP_INLINE struct PP_Var PP_MakeNull() {
+ struct PP_Var result = { PP_VARTYPE_NULL, 0, {PP_FALSE} };
+ return result;
+}
+
+/**
+ * PP_MakeBool() is used to wrap a boolean value into a
+ * <code>PP_Var</code> struct for passing to the browser.
+ *
+ * @param[in] value A <code>PP_Bool</code> enumeration to
+ * wrap.
+ *
+ * @return A <code>PP_Var</code> structure.
+ */
+PP_INLINE struct PP_Var PP_MakeBool(PP_Bool value) {
+ struct PP_Var result = { PP_VARTYPE_BOOL, 0, {PP_FALSE} };
+ result.value.as_bool = value;
+ return result;
+}
+
+/**
+ * PP_MakeInt32() is used to wrap a 32 bit integer value
+ * into a <code>PP_Var</code> struct for passing to the browser.
+ *
+ * @param[in] value An int32 to wrap.
+ *
+ * @return A <code>PP_Var</code> structure.
+ */
+PP_INLINE struct PP_Var PP_MakeInt32(int32_t value) {
+ struct PP_Var result = { PP_VARTYPE_INT32, 0, {PP_FALSE} };
+ result.value.as_int = value;
+ return result;
+}
+
+/**
+ * PP_MakeDouble() is used to wrap a double value into a
+ * <code>PP_Var</code> struct for passing to the browser.
+ *
+ * @param[in] value A double to wrap.
+ *
+ * @return A <code>PP_Var</code> structure.
+ */
+PP_INLINE struct PP_Var PP_MakeDouble(double value) {
+ struct PP_Var result = { PP_VARTYPE_DOUBLE, 0, {PP_FALSE} };
+ result.value.as_double = value;
+ return result;
+}
+/**
+ * @}
+ */
+
+#endinl
+
diff --git a/ppapi/api/ppb.idl b/ppapi/api/ppb.idl
index f580dcc..4d4835b6 100644
--- a/ppapi/api/ppb.idl
+++ b/ppapi/api/ppb.idl
@@ -3,17 +3,27 @@
* found in the LICENSE file.
*/
-/* This file defines a function pointer type for the PPB_GetInterface function.
+/**
+ * This file defines a function pointer type for the
+ * <code>PPB_GetInterface</code> function.
*/
-/* This function pointer type defines the signature for the PPB_GetInterface
- * function. A generic PPB_GetInterface pointer is passed to
- * PPP_InitializedModule when your module is loaded. You can use this pointer
- * to request a pointer to a specific browser interface. Browser interface
- * names are ASCII strings and are generally defined in the header file for
- * the interface, such as PP_AUDIO_INTERFACE found in ppb.audio.h or
- * PPB_GRAPHICS_2D_INTERFACE in ppb_graphics_2d.h.
+/**
+ * This function pointer type defines the signature for the
+ * <code>PPB_GetInterface</code> function. A generic
+ * <code>PPB_GetInterface</code> pointer is passed to
+ * <code>PPP_InitializedModule</code> when your module is loaded. You can use
+ * this pointer to request a pointer to a specific browser interface. Browser
+ * interface names are ASCII strings and are generally defined in the header
+ * file for the interface, such as <code>PPB_AUDIO_INTERFACE</code> found in
+ * <code>ppb.audio.h</code> or
+ * <code>PPB_GRAPHICS_2D_INTERFACE</code> in <code>ppb_graphics_2d.h</code>.
+ * Click
+ * <a href="/chrome/nativeclient/docs/reference/pepperc/
+ * globals_defs.html" title="macros">here</a> for a complete list of interface
+ * names.
*
* This value will be NULL if the interface is not supported on the browser.
*/
-typedef mem_t PPB_GetInterface([in] str_t interface_name);
+typedef interface_t PPB_GetInterface([in] str_t interface_name);
+
diff --git a/ppapi/api/ppb_audio.idl b/ppapi/api/ppb_audio.idl
index 71abad6..d13f6bf 100644
--- a/ppapi/api/ppb_audio.idl
+++ b/ppapi/api/ppb_audio.idl
@@ -3,70 +3,131 @@
* found in the LICENSE file.
*/
-/* This file defines the audio API.
+/**
+ * This file defines the <code>PPB_Audio</code> interface, which provides
+ * realtime stereo audio streaming capabilities.
*/
-/* Callback function type for SetCallback. */
+label Chrome {
+ M13 = 0.6,
+ M14 = 1.0
+};
+
+/**
+ * <code>PPB_Audio_Callback</code> defines the type of an audio callback
+ * function used to fill the audio buffer with data. Please see the
+ * <code>Create()</code> function in the <code>PPB_Audio</code> interface for
+ * more details on this callback.
+ */
typedef void PPB_Audio_Callback([out] mem_t sample_buffer,
[in] uint32_t buffer_size_in_bytes,
[inout] mem_t user_data);
-/* Callback-based audio interface. User of audio must set the callback that will
- * be called each time that the buffer needs to be filled.
- *
- * A C++ example:
+/**
+ * The <code>PPB_Audio</code> interface contains pointers to several functions
+ * for handling audio resources. Please refer to the
+ * <a href="/chrome/nativeclient/docs/audio.html">Pepper
+ * Audio API Code Walkthrough</a> for information on using this interface.
+ * Please see descriptions for each <code>PPB_Audio</code> and
+ * <code>PPB_AudioConfig</code> function for more details.
*
+ * A C example using PPB_Audio and PPB_AudioConfig:
+ * @code
* void audio_callback(void* sample_buffer,
- * size_t buffer_size_in_bytes,
+ * uint32_t buffer_size_in_bytes,
* void* user_data) {
- * ... fill in the buffer with samples ...
- * }
+ * ... quickly fill in the buffer with samples and return to caller ...
+ * }
+ *
+ * ...Assume the application has cached the audio configuration interface in
+ * |audio_config_interface| and the audio interface in |audio_interface|...
*
- * uint32_t obtained;
- * AudioConfig config(PP_AUDIOSAMPLERATE_44100, 4096, &obtained);
- * Audio audio(config, audio_callback, NULL);
- * audio.StartPlayback();
+ * uint32_t count = audio_config_interface->RecommendSampleFrameCount(
+ * PP_AUDIOSAMPLERATE_44100, 4096);
+ * PP_Resource pp_audio_config = audio_config_interface->CreateStereo16Bit(
+ * pp_instance, PP_AUDIOSAMPLERATE_44100, count);
+ * PP_Resource pp_audio = audio_interface->Create(pp_instance, pp_audio_config,
+ * audio_callback, NULL);
+ * audio_interface->StartPlayback(pp_audio);
+ *
+ * ...audio_callback() will now be periodically invoked on a seperate thread...
*/
-interface PPB_Audio_0_5 {
- /* Creates a paused audio interface. 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 PPB_Audio 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
- * AudioConfig documentation. If the configuration cannot be honored, or the
- * callback is null, the function returns 0.
- */
+interface PPB_Audio {
+ /**
+ * Create is a pointer to a function that 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 PPB_Audio 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 AudioConfig documentation.
+ *
+ * @param[in] instance A PP_Instance indentifying one instance of a module.
+ * @param[in] config A PP_Resource containing the audio config resource.
+ * @param[in] audio_callback A PPB_Audio_Callback 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 PP_Resource containing the audio resource if successful or
+ * 0 if the configuration cannot be honored or the callback is null.
+ */
PP_Resource Create(
[in] PP_Instance instance,
[in] PP_Resource config,
[in] PPB_Audio_Callback audio_callback,
[inout] mem_t user_data);
- /* Returns PP_TRUE if the given resource is an Audio resource, PP_FALSE
- * otherwise.
+ /**
+ * IsAudio is a pointer to a function that determines if the given
+ * resource is an audio resource.
+ *
+ * @param[in] resource A PP_Resource containing a resource.
+ *
+ * @return A PP_BOOL containing containing PP_TRUE if the given resource is
+ * an Audio resource, otherwise PP_FALSE.
*/
PP_Bool IsAudio(
[in] PP_Resource resource);
- /* Get the current configuration. */
+ /**
+ * GetCurrrentConfig is a pointer to a function that returns an audio config
+ * resource for the given audio resource.
+ *
+ * @param[in] config A PP_Resource containing the audio resource.
+ *
+ * @return A PP_Resource containing the audio config resource if successful.
+ */
PP_Resource GetCurrentConfig(
[in] PP_Resource audio);
- /* Start the playback. Begin periodically calling the callback. If called
- * while playback is already in progress, will return PP_TRUE and be a no-op.
- * On error, return PP_FALSE.
+ /**
+ * StartPlayback is a pointer to a function that starts the playback of
+ * the audio resource and begins periodically calling the callback.
+ *
+ * @param[in] config A PP_Resource containing the audio resource.
+ *
+ * @return A PP_BOOL containing PP_TRUE if successful, otherwise PP_FALSE.
+ * Also returns PP_TRUE (and be a no-op) if called while playback is already
+ * in progress.
*/
PP_Bool StartPlayback(
[in] PP_Resource audio);
- /* Stop the playback. If playback is already stopped, this is a no-op and
- * returns PP_TRUE. On error, returns PP_FALSE. If a callback is in progress,
- * StopPlayback will block until callback completes.
+ /**
+ * StopPlayback is a pointer to a function that stops the playback of
+ * the audio resource.
+ *
+ * @param[in] config A PP_Resource containing the audio resource.
+ *
+ * @return A PP_BOOL containing PP_TRUE if successful, otherwise PP_FALSE.
+ * Also returns PP_TRUE (and is a no-op) if called while playback is already
+ * stopped. If a callback is in progress, StopPlayback will block until the
+ * callback completes.
*/
PP_Bool StopPlayback(
[in] PP_Resource audio);
};
+
diff --git a/ppapi/api/ppb_audio_config.idl b/ppapi/api/ppb_audio_config.idl
index 2c73e03..bef8c22 100644
--- a/ppapi/api/ppb_audio_config.idl
+++ b/ppapi/api/ppb_audio_config.idl
@@ -3,15 +3,23 @@
* found in the LICENSE file.
*/
-/* This file defines the AudioConfig interface. */
+/**
+ * This file defines the PPB_AudioConfig interface for establishing an
+ * audio configuration resource within the browser.
+ */
+label Chrome {
+ M13 = 0.5,
+ M14 = 1.0
+};
/**
* This enumeration contains audio frame count constants.
- * PP_AUDIOMINSAMPLEFRAMECOUNT is the minimum possible frame count.
- * PP_AUDIOMAXSAMPLEFRAMECOUNT is the maximum possible frame count.
+ * <code>PP_AUDIOMINSAMPLEFRAMECOUNT</code> is the minimum possible frame
+ * count. <code>PP_AUDIOMAXSAMPLEFRAMECOUNT</code> is the maximum possible
+ * frame count.
*/
-enum PP_AudioFrameSize {
+[unnamed] enum PP_AudioFrameSize {
PP_AUDIOMINSAMPLEFRAMECOUNT = 64,
PP_AUDIOMAXSAMPLEFRAMECOUNT = 32768
};
@@ -19,10 +27,11 @@ enum PP_AudioFrameSize {
/**
* PP_AudioSampleRate is an enumeration of the different audio sampling rates.
- * PP_AUDIOSAMPLERATE_44100 is the sample rate used on CDs and
- * PP_AUDIOSAMPLERATE_48000 is the sample rate used on DVDs and Digital Audio
- * Tapes.
+ * <code>PP_AUDIOSAMPLERATE_44100</code> is the sample rate used on CDs and
+ * <code>PP_AUDIOSAMPLERATE_48000</code> is the sample rate used on DVDs and
+ * Digital Audio Tapes.
*/
+[assert_size(4)]
enum PP_AudioSampleRate {
PP_AUDIOSAMPLERATE_NONE = 0,
PP_AUDIOSAMPLERATE_44100 = 44100,
@@ -30,67 +39,117 @@ enum PP_AudioSampleRate {
} ;
-/* Interface for configuring audio output */
-interface PPB_AudioConfig_0_5 {
- /* Create a 16 bit stereo config with the given sample rate. We guarantee
- * that PP_AUDIOSAMPLERATE_44100 and PP_AUDIOSAMPLERATE_48000 sample rates
- * are supported. The |sample_frame_count| should be the result of calling
- * RecommendSampleFrameCount. If the sample frame count or bit rate aren't
- * supported, this function will fail and return a null resource.
+/**
+ * The <code>PPB_AudioConfig</code> interface contains pointers to several
+ * functions for establishing your audio configuration within the browser.
+ * This interface only supports stereo * 16bit output.
+ *
+ * Refer to the
+ * <a href="/chrome/nativeclient/docs/audio.html">Pepper
+ * Audio API Code Walkthrough</a> for information on using this interface.
+ */
+[macro="PPB_AUDIO_CONFIG_INTERFACE"]
+interface PPB_AudioConfig {
+ /**
+ * CreateStereo16bit() creates a 16 bit audio configuration resource. The
+ * <code>sample_frame_count</code> should be the result of calling
+ * <code>RecommendSampleFrameCount</code>. If the sample frame count or bit
+ * rate isn't supported, this function will fail and return a null resource.
*
* A single sample frame on a stereo device means one value for the left
* channel and one value for the right channel.
*
* Buffer layout for a stereo int16 configuration:
- * int16_t* buffer16;
- * buffer16[0] is the first left channel sample
- * buffer16[1] is the first right channel sample
- * buffer16[2] is the second left channel sample
- * buffer16[3] is the second right channel sample
+ * <code>int16_t *buffer16;</code>
+ * <code>buffer16[0]</code> is the first left channel sample.
+ * <code>buffer16[1]</code> is the first right channel sample.
+ * <code>buffer16[2]</code> is the second left channel sample.
+ * <code>buffer16[3]</code> is the second right channel sample.
* ...
- * buffer16[2 * (sample_frame_count - 1)] is the last left channel sample
- * buffer16[2 * (sample_frame_count - 1) + 1] is the last right channel
- * sample
+ * <code>buffer16[2 * (sample_frame_count - 1)]</code> is the last left
+ * channel sample.
+ * <code>buffer16[2 * (sample_frame_count - 1) + 1]</code> is the last
+ * right channel sample.
* Data will always be in the native endian format of the platform.
+ *
+ * @param[in] instance A <code>PP_Instance indentifying</code> one instance
+ * of a module.
+ * @param[in] sample_rate A P<code>P_AudioSampleRate</code> which is either
+ * <code>PP_AUDIOSAMPLERATE_44100</code> or
+ * <code>PP_AUDIOSAMPLERATE_48000</code>.
+ * @param[in] sample_frame_count A <code>uint32_t</code> frame count returned
+ * from the <code>RecommendSampleFrameCount</code> function.
+ * @return A <code>PP_Resource</code> containing the
+ * <code>PPB_Audio_Config</code> if successful or a null resource if the
+ * sample frame count or bit rate are not supported.
*/
PP_Resource CreateStereo16Bit(
[in] PP_Instance instance,
[in] PP_AudioSampleRate sample_rate,
[in] uint32_t sample_frame_count);
- /* Returns a supported sample frame count closest to the given 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.
+ /**
+ * 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 PP_AUDIOMINSAMPLEFRAMECOUNT
- * and greater than PP_AUDIOMAXSAMPLEFRAMECOUNT are never supported on any
+ * 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 value.
*
- * If you pass PP_AUDIOSAMPLERATE_NONE as the requested sample count, the
- * recommended sample for the local system is returned.
+ * @param[in] sample_rate A <code>PP_AudioSampleRate 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.
*/
uint32_t RecommendSampleFrameCount(
[in] PP_AudioSampleRate sample_rate,
[in] uint32_t requested_sample_frame_count);
- /* Returns true if the given resource is an AudioConfig object. */
+ /**
+ * IsAudioConfig() determines if the given resource is a
+ * <code>PPB_Audio_Config</code>.
+ *
+ * @param[in] resource A <code>PP_Resource</code> containing the audio config
+ * resource.
+ * @return A <code>PP_BOOL</code> containing <code>PP_TRUE</code> if the given
+ * resource is an <code>AudioConfig</code> resource, otherwise
+ * <code>PP_FALSE</code>.
+ */
PP_Bool IsAudioConfig(
[in] PP_Resource resource);
- /* Returns the sample rate for the given AudioConfig resource. If the
- * resource is invalid, this will return PP_AUDIOSAMPLERATE_NONE.
+ /**
+ * GetSampleRate() returns the sample rate for the given
+ * <code>PPB_Audio_Config</code>.
+ *
+ * @param[in] config A <code>PP_Resource</code> containing the
+ * <code>PPB_Audio_Config</code>.
+ * @return A <code>PP_AudioSampleRate</code> containing sample rate or
+ * <code>PP_AUDIOSAMPLERATE_NONE</code> if the resource is invalid.
*/
PP_AudioSampleRate GetSampleRate(
[in] PP_Resource config);
- /* Returns the sample frame count for the given AudioConfig resource. If the
- * resource is invalid, this will return 0. See RecommendSampleFrameCount for
- * more on sample frame counts.
+ /**
+ * GetSampleFrameCount() returns the sample frame count for the given
+ * <code>PPB_Audio_Config</code>.
+ *
+ * @param[in] config A <code>PP_Resource</code> containing the audio config
+ * resource.
+ * @return A <code>uint32_t</code> containing sample frame count or
+ * 0 if the resource is invalid. See <code>RecommendSampleFrameCount</code>
+ * for more on sample frame counts.
*/
uint32_t GetSampleFrameCount(
[in] PP_Resource config);
};
+
diff --git a/ppapi/api/ppb_core.idl b/ppapi/api/ppb_core.idl
index e28fb0a..d7601cf 100644
--- a/ppapi/api/ppb_core.idl
+++ b/ppapi/api/ppb_core.idl
@@ -3,70 +3,101 @@
* found in the LICENSE file.
*/
-/* Defines the core API. */
-
-/*
- * The PPB_Core interface contains pointers to functions related to memory
- * management, time, and threads on the browser.
+/**
+ * This file defines the <code>PPB_Core</code> interface defined by the browser
+ * and containing pointers to functions related to memory management, time, and
+ * threads.
*/
-interface PPB_Core_0_3 {
- /* Same as AddRefVar for Resources. */
- void AddRefResource(
- [in] PP_Resource resource);
- /* Same as ReleaseVar for Resources. */
- void ReleaseResource(
- [in] PP_Resource resource);
+label Chrome {
+ M14 = 1.0
+};
- /* Allocate memory.
+/**
+ * The <code>PPB_Core</code> interface contains pointers to functions related
+ * to memory management, time, and threads on the browser.
+ *
+ */
+interface PPB_Core {
+ /**
*
- * Returns NULL If the allocation fails.
+ * AddRefResource() adds a reference to a resource.
+ *
+ * @param[in] config A <code>PP_Resource</code> containing the resource.
*/
- mem_t MemAlloc(
- [in] uint32_t num_bytes);
+ void AddRefResource([in] PP_Resource resource);
- /* Free memory; it's safe to pass NULL. */
- void MemFree(
- [inout] mem_t ptr);
+ /**
+ * ReleaseResource() removes a reference from a resource.
+ *
+ * @param[in] config A <code>PP_Resource</code> containing the resource.
+ */
+ void ReleaseResource([in] PP_Resource resource);
- /* Returns the "wall clock time" according to the browser.
+ /**
+ * GetTime() returns the "wall clock time" according to the
+ * browser.
*
- * See the definition of PP_Time.
+ * @return A <code>PP_Time</code> containing the "wall clock time" according
+ * to the browser.
*/
PP_Time GetTime();
- /* Returns the "tick time" according to the browser. This clock is used by
- * the browser when passing some event times to the plugin (e.g., via the
- * PP_InputEvent::time_stamp_seconds field). It is not correlated to any
- * actual wall clock time (like GetTime()). Because of this, it will not run
- * change if the user changes their computer clock.
+ /**
+ * GetTimeTicks() returns the "tick time" according to the browser.
+ * This clock is used by the browser when passing some event times to the
+ * module (e.g. using the <code>PP_InputEvent::time_stamp_seconds</code>
+ * field). It is not correlated to any actual wall clock time
+ * (like GetTime()). Because of this, it will not run change if the user
+ * changes their computer clock.
*
- * TODO(brettw) http://code.google.com/p/chromium/issues/detail?id=57448
- * This currently does change with wall clock time, but will be fixed in
- * a future release.
+ * @return A <code>PP_TimeTicks</code> containing the "tick time" according
+ * to the browser.
*/
+
+// TODO(brettw) http://code.google.com/p/chromium/issues/detail?id=57448
+// This currently does change with wall clock time, but will be fixed in
+// a future release.
PP_TimeTicks GetTimeTicks();
- /* Schedules work to be executed on the main plugin thread after the
- * specified delay. The delay may be 0 to specify a call back as soon as
- * possible.
+ /**
+ * CallOnMainThread() schedules work to be executed on the main module thread
+ * after the specified delay. The delay may be 0 to specify a call back as
+ * soon as possible.
+ *
+ * The <code>result</code> parameter will just be passed as the second
+ * argument to the callback. Many applications won't need this, but it allows
+ * a module to emulate calls of some callbacks which do use this value.
+ *
+ * <strong>Note:</strong> CallOnMainThread, even when used from the main
+ * thread with a delay of 0 milliseconds, will never directly invoke the
+ * callback. Even in this case, the callback will be scheduled
+ * asynchronously.
*
- * The |result| parameter will just be passed as the second argument as the
- * callback. Many applications won't need this, but it allows a plugin to
- * emulate calls of some callbacks which do use this value.
+ * <strong>Note:</strong> If the browser is shutting down or if the module
+ * has no instances, then the callback function may not be called.
*
- * NOTE: If the browser is shutting down or if the plugin has no instances,
- * then the callback function may not be called.
+ * @param[in] delay_in_milliseconds An int32_t delay in milliseconds.
+ * @param[in] callback A <code>PP_CompletionCallback</code> callback function
+ * that the browser will call after the specified delay.
+ * @param[in] result An int32_t that the browser will pass to the given
+ * <code>PP_CompletionCallback</code>.
*/
void CallOnMainThread(
[in] int32_t delay_in_milliseconds,
[in] PP_CompletionCallback callback,
[in] int32_t result);
- /* Returns true if the current thread is the main pepper thread.
+ /**
+ * IsMainThread() returns true if the current thread is the main pepper
+ * thread.
*
- * This is useful for implementing sanity checks, and deciding if dispatching
- * via CallOnMainThread() is required.
+ * This function is useful for implementing sanity checks, and deciding if
+ * dispatching using CallOnMainThread() is required.
+ *
+ * @return A <code>PP_Bool</code> containing <code>PP_TRUE</code> if the
+ * current thread is the main pepper thread, otherwise <code>PP_FALSE</code>.
*/
PP_Bool IsMainThread();
};
+
diff --git a/ppapi/api/ppb_file_io.idl b/ppapi/api/ppb_file_io.idl
new file mode 100644
index 0000000..74ba76e
--- /dev/null
+++ b/ppapi/api/ppb_file_io.idl
@@ -0,0 +1,230 @@
+/* Copyright (c) 2011 The Chromium Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+
+/**
+ * This file defines the API to create a file i/o object.
+ */
+
+label Chrome {
+ M13 = 0.5,
+ M14 = 1.0
+};
+
+/**
+ * The PP_FileOpenFlags enum contains file open constants.
+ */
+[assert_size(4)]
+ enum PP_FileOpenFlags {
+ /** Requests read access to a file. */
+ PP_FILEOPENFLAG_READ = 1 << 0,
+
+ /**
+ * Requests write access to a file. May be combined with
+ * <code>PP_FILEOPENFLAG_READ</code> to request read and write access.
+ */
+ PP_FILEOPENFLAG_WRITE = 1 << 1,
+
+ /**
+ * Requests that the file be created if it does not exist. If the file
+ * already exists, then this flag is ignored unless
+ * <code>PP_FILEOPENFLAG_EXCLUSIVE</code> was also specified, in which case
+ * FileIO::Open() will fail.
+ */
+ PP_FILEOPENFLAG_CREATE = 1 << 2,
+
+ /**
+ * Requests that the file be truncated to length 0 if it exists and is a
+ * regular file. <code>PP_FILEOPENFLAG_WRITE</code> must also be specified.
+ */
+ PP_FILEOPENFLAG_TRUNCATE = 1 << 3,
+
+ /**
+ * Requests that the file is created when this flag is combined with
+ * <code>PP_FILEOPENFLAG_CREATE</code>. If this flag is specified, and the
+ * file already exists, then the FileIO::Open() call will fail.
+ */
+ PP_FILEOPENFLAG_EXCLUSIVE = 1 << 4
+};
+
+
+/**
+ * The <code>PPB_FileIO</code> struct is used to operate on a regular file
+ * (PP_FileType_Regular).
+ */
+[version=0.5]
+interface PPB_FileIO {
+ /**
+ * Create() creates a new FileIO object.
+ *
+ * @param[in] instance A <code>PP_Instance</code> indentifying the instance
+ * with the file.
+ *
+ * @return A <code>PP_Resource</code> corresponding to a FileIO if
+ * successful or 0 if the module is invalid.
+ */
+ PP_Resource Create([in] PP_Instance instance);
+ /**
+ * IsFileIO() determines if the provided resource is a FileIO.
+ *
+ * @param[in] resource A <code>PP_Resource</code> corresponding to a FileIO.
+ *
+ * @return <code>PP_TRUE</code> if the resource is a
+ * <code>PPB_FileIO</code>, <code>PP_FALSE</code> if the resource is
+ * invalid or some type other than <code>PPB_FileIO</code>.
+ */
+ PP_Bool IsFileIO([in] PP_Resource resource);
+
+ /**
+ * Open() opens the specified regular file for I/O according to the given
+ * open flags, which is a bit-mask of the <code>PP_FileOpenFlags</code>
+ * values. Upon success, the corresponding file is classified as "in use"
+ * by this FileIO object until such time as the FileIO object is closed
+ * or destroyed.
+ *
+ * @param[in] file_io A <code>PP_Resource</code> corresponding to a
+ * FileIO.
+ * @param[in] file_ref A <code>PP_Resource</code> corresponding to a file
+ * reference.
+ * @param[in] open_flags A bit-mask of the <code>PP_FileOpenFlags</code>
+ * values.
+ * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon
+ * completion of Open().
+ *
+ * @return An int32_t containing an error code from <code>pp_errors.h</code>.
+ */
+ int32_t Open([in] PP_Resource file_io,
+ [in] PP_Resource file_ref,
+ [in] int32_t open_flags,
+ [in] PP_CompletionCallback callback);
+
+ /**
+ * Query() queries info about the file opened by this FileIO object. This
+ * function will fail if the FileIO object has not been opened.
+ *
+ * @param[in] file_io A <code>PP_Resource</code> corresponding to a
+ * FileIO.
+ * @param[out] info The <code>PP_FileInfo</code> structure representing all
+ * information about the file.
+ * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon
+ * completion of Query().
+ *
+ * @return An int32_t containing an error code from <code>pp_errors.h</code>.
+ */
+ int32_t Query([in] PP_Resource file_io,
+ [out] PP_FileInfo info,
+ [in] PP_CompletionCallback callback);
+
+ /**
+ * Touch() Updates time stamps for the file opened by this FileIO object.
+ * This function will fail if the FileIO object has not been opened.
+ *
+ * @param[in] file_io A <code>PP_Resource</code> corresponding to a file
+ * FileIO.
+ * @param[in] last_access_time The last time the FileIO was accessed.
+ * @param[in] last_modified_time The last time the FileIO was modified.
+ * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon
+ * completion of Touch().
+ *
+ * @return An int32_t containing an error code from <code>pp_errors.h</code>.
+ */
+ int32_t Touch([in] PP_Resource file_io,
+ [in] PP_Time last_access_time,
+ [in] PP_Time last_modified_time,
+ [in] PP_CompletionCallback callback);
+
+ /**
+ * Read() reads from an offset in the file. The size of the buffer must be
+ * large enough to hold the specified number of bytes to read. This function
+ * might perform a partial read.
+ *
+ * @param[in] file_io A <code>PP_Resource</code> corresponding to a file
+ * FileIO.
+ * @param[in] offset The offset into the file.
+ * @param[in] buffer The buffer to hold the specified number of bytes read.
+ * @param[in] bytes_to_read The number of bytes to read from
+ * <code>offset</code>.
+ * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon
+ * completion of Read().
+ *
+ * @return An The number of bytes read an error code from
+ * <code>pp_errors.h</code>. If the return value is 0, then end-of-file was
+ * reached. It is valid to call Read() multiple times with a completion
+ * callback to queue up parallel reads from the file at different offsets.
+ */
+ int32_t Read([in] PP_Resource file_io,
+ [in] int64_t offset,
+ [inout] str_t buffer,
+ [in] int32_t bytes_to_read,
+ [in] PP_CompletionCallback callback);
+
+ /**
+ * Write() writes to an offset in the file. This function might perform a
+ * partial write. The FileIO object must have been opened with write access.
+ *
+ * @param[in] file_io A <code>PP_Resource</code> corresponding to a file
+ * FileIO.
+ * @param[in] offset The offset into the file.
+ * @param[in] buffer The buffer to hold the specified number of bytes read.
+ * @param[in] bytes_to_write The number of bytes to write to
+ * <code>offset</code>.
+ * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon
+ * completion of Write().
+ *
+ * @return An The number of bytes written or an error code from
+ * <code>pp_errors.h</code>. If the return value is 0, then end-of-file was
+ * reached. It is valid to call Write() multiple times with a completion
+ * callback to queue up parallel writes to the file at different offsets.
+ */
+ int32_t Write([in] PP_Resource file_io,
+ [in] int64_t offset,
+ [in] str_t buffer,
+ [in] int32_t bytes_to_write,
+ [in] PP_CompletionCallback callback);
+ /**
+ * SetLength() sets the length of the file. If the file size is extended,
+ * then the extended area of the file is zero-filled. The FileIO object must
+ * have been opened with write access.
+ *
+ * @param[in] file_io A <code>PP_Resource</code> corresponding to a file
+ * FileIO.
+ * @param[in] length The length of the file to be set.
+ * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon
+ * completion of SetLength().
+ *
+ * @return An int32_t containing an error code from <code>pp_errors.h</code>.
+ */
+ int32_t SetLength([in] PP_Resource file_io,
+ [in] int64_t length,
+ [in] PP_CompletionCallback callback);
+
+ /**
+ * Flush() flushes changes to disk. This call can be very expensive!
+ *
+ * @param[in] file_io A <code>PP_Resource</code> corresponding to a file
+ * FileIO.
+ * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon
+ * completion of Flush().
+ *
+ * @return An int32_t containing an error code from <code>pp_errors.h</code>.
+ */
+ int32_t Flush([in] PP_Resource file_io,
+ [in] PP_CompletionCallback callback);
+
+ /**
+ * Close() cancels any IO that may be pending, and closes the FileIO object.
+ * Any pending callbacks will still run, reporting
+ * <code>PP_Error_Aborted</code> if pending IO was interrupted. It is not
+ * valid to call Open() again after a call to this method.
+ * <strong>Note:</strong> If the FileIO object is destroyed, and it is still
+ * open, then it will be implicitly closed, so you are not required to call
+ * Close().
+ *
+ * @param[in] file_io A <code>PP_Resource</code> corresponding to a file
+ * FileIO.
+ */
+ void Close([in] PP_Resource file_io);
+};
+
diff --git a/ppapi/api/ppb_file_ref.idl b/ppapi/api/ppb_file_ref.idl
new file mode 100644
index 0000000..28c1441
--- /dev/null
+++ b/ppapi/api/ppb_file_ref.idl
@@ -0,0 +1,172 @@
+/* Copyright (c) 2011 The Chromium Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/**
+ * This file defines the API to create a file reference or "weak pointer" to a
+ * file in a file system.
+ */
+
+label Chrome {
+ M13 = 0.9,
+ M14 = 1.0
+};
+
+/**
+ * The <code>PPB_FileRef</code> struct represents a "weak pointer" to a file in
+ * a file system. This struct contains a <code>PP_FileSystemType</code>
+ * identifier and a file path string.
+ */
+[version=0.9]
+interface PPB_FileRef {
+ /**
+ * Create() creates a weak pointer to a file in the given file system. File
+ * paths are POSIX style.
+ *
+ * @param[in] resource A <code>PP_Resource</code> corresponding to a file
+ * system.
+ * @param[in] path A path to the file.
+ *
+ * @return A <code>PP_Resource</code> corresponding to a file reference if
+ * successful or 0 if the path is malformed.
+ */
+ PP_Resource Create([in] PP_Resource file_system, [in] str_t path);
+ /**
+ * IsFileRef() determines if the provided resource is a file reference.
+ *
+ * @param[in] resource A <code>PP_Resource</code> corresponding to a file
+ * reference.
+ *
+ * @return <code>PP_TRUE</code> if the resource is a
+ * <code>PPB_FileRef</code>, <code>PP_FALSE</code> if the resource is
+ * invalid or some type other than <code>PPB_FileRef</code>.
+ */
+ PP_Bool IsFileRef([in] PP_Resource resource);
+
+ /**
+ * GetFileSystemType() returns the type of the file system.
+ *
+ * @param[in] file_ref A <code>PP_Resource</code> corresponding to a file
+ * reference.
+ *
+ * @return A <code>PP_FileSystemType</code> with the file system type if
+ * valid or <code>PP_FILESYSTEMTYPE_INVALID</code> if the provided resource
+ * is not a valid file reference.
+ */
+ PP_FileSystemType GetFileSystemType([in] PP_Resource file_ref);
+
+ /**
+ * GetName() returns the name of the file.
+ *
+ * @param[in] file_ref A <code>PP_Resource</code> corresponding to a file
+ * reference.
+ *
+ * @return A <code>PP_Var</code> containing the name of the file. The value
+ * returned by this function does not include any path components (such as
+ * the name of the parent directory, for example). It is just the name of the
+ * file. Use GetPath() to get the full file path.
+ */
+ PP_Var GetName([in] PP_Resource file_ref);
+
+ /**
+ * GetPath() returns the absolute path of the file.
+ *
+ * @param[in] file_ref A <code>PP_Resource</code> corresponding to a file
+ * reference.
+ *
+ * @return A <code>PP_Var</code> containing the absolute path of the file.
+ * This function fails if the file system type is
+ * <code>PP_FileSystemType_External</code>.
+ */
+ PP_Var GetPath([in] PP_Resource file_ref);
+
+ /**
+ * GetParent() returns the parent directory of this file. If
+ * <code>file_ref</code> points to the root of the filesystem, then the root
+ * is returned.
+ *
+ * @param[in] file_ref A <code>PP_Resource</code> corresponding to a file
+ * reference.
+ *
+ * @return A <code>PP_Resource</code> containing the parent directory of the
+ * file. This function fails if the file system type is
+ * <code>PP_FileSystemType_External</code>.
+ */
+ PP_Resource GetParent([in] PP_Resource file_ref);
+
+ /**
+ * MakeDirectory() makes a new directory in the file system as well as any
+ * parent directories if the <code>make_ancestors</code> argument is
+ * <code>PP_TRUE</code>. It is not valid to make a directory in the external
+ * file system.
+ *
+ * @param[in] file_ref A <code>PP_Resource</code> corresponding to a file
+ * reference.
+ * @param[in] make_ancestors A <code>PP_Bool</code> set to
+ * <code>PP_TRUE</code> to make ancestor directories or <code>PP_FALSE</code>
+ * if ancestor directories are not needed.
+ *
+ * @return An int32_t containing an error code from <code>pp_errors.h</code>.
+ * Fails if the directory already exists or if ancestor directories do not
+ * exist and <code>make_ancestors</code> was not passed as
+ * <code>PP_TRUE</code>.
+ */
+ int32_t MakeDirectory([in] PP_Resource directory_ref,
+ [in] PP_Bool make_ancestors,
+ [in] PP_CompletionCallback callback);
+
+ /**
+ * Touch() Updates time stamps for a file. You must have write access to the
+ * file if it exists in the external filesystem.
+ *
+ * @param[in] file_ref A <code>PP_Resource</code> corresponding to a file
+ * reference.
+ * @param[in] last_access_time The last time the file was accessed.
+ * @param[in] last_modified_time The last time the file was modified.
+ * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon
+ * completion of Touch().
+ *
+ * @return An int32_t containing an error code from <code>pp_errors.h</code>.
+ */
+ int32_t Touch([in] PP_Resource file_ref,
+ [in] PP_Time last_access_time,
+ [in] PP_Time last_modified_time,
+ [in] PP_CompletionCallback callback);
+
+ /**
+ * Delete() deletes a file or directory. If <code>file_ref</code> refers to
+ * a directory, then the directory must be empty. It is an error to delete a
+ * file or directory that is in use. It is not valid to delete a file in
+ * the external file system.
+ *
+ * @param[in] file_ref A <code>PP_Resource</code> corresponding to a file
+ * reference.
+ * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon
+ * completion of Delete().
+ *
+ * @return An int32_t containing an error code from <code>pp_errors.h</code>.
+ */
+ int32_t Delete([in] PP_Resource file_ref,
+ [in] PP_CompletionCallback callback);
+
+ /**
+ * Rename() renames a file or directory. Arguments <code>file_ref</code> and
+ * <code>new_file_ref</code> must both refer to files in the same file
+ * system. It is an error to rename a file or directory that is in use. It
+ * is not valid to rename a file in the external file system.
+ *
+ * @param[in] file_ref A <code>PP_Resource</code> corresponding to a file
+ * reference.
+ * @param[in] new_file_ref A <code>PP_Resource</code> corresponding to a new
+ * file reference.
+ * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon
+ * completion of Rename().
+ *
+ * @return An int32_t containing an error code from <code>pp_errors.h</code>.
+ */
+ int32_t Rename([in] PP_Resource file_ref,
+ [in] PP_Resource new_file_ref,
+ [in] PP_CompletionCallback callback);
+};
+
diff --git a/ppapi/api/ppb_file_system.idl b/ppapi/api/ppb_file_system.idl
new file mode 100644
index 0000000..7a5abe7
--- /dev/null
+++ b/ppapi/api/ppb_file_system.idl
@@ -0,0 +1,77 @@
+/* Copyright (c) 2011 The Chromium Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/**
+ * This file defines the API to create a file system associated with a file.
+ */
+
+label Chrome {
+ M13 = 0.7,
+ M14 = 1.0
+};
+
+/**
+ * The <code>PPB_FileSystem</code> struct identifies the file system type
+ * associated with a file.
+ */
+[version=0.7]
+interface PPB_FileSystem {
+ /** Create() creates a file system object of the given type.
+ *
+ * @param[in] instance A <code>PP_Instance</code> indentifying the instance
+ * with the file.
+ * @param[in] type A file system type as defined by
+ * <code>PP_FileSystemType</code> enum.
+ *
+ * @return A <code>PP_Resource</code> corresponding to a file system if
+ * successful.
+ */
+ PP_Resource Create([in] PP_Instance instance, [in] PP_FileSystemType type);
+
+ /**
+ * IsFileSystem() determines if the provided resource is a file system.
+ *
+ * @param[in] resource A <code>PP_Resource</code> corresponding to a file
+ * system.
+ *
+ * @return <code>PP_TRUE</code> if the resource is a
+ * <code>PPB_FileSystem</code>, <code>PP_FALSE</code> if the resource is
+ * invalid or some type other than <code>PPB_FileSystem</code>.
+ */
+ PP_Bool IsFileSystem([in] PP_Resource resource);
+
+ /**
+ * Open() opens the file system. A file system must be opened before running
+ * any other operation on it.
+ *
+ * @param[in] file_system A <code>PP_Resource</code> corresponding to a file
+ * system.
+ * @param[in] expected_size The expected size of the file system.
+ * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon
+ * completion of Open().
+ *
+ * @return An int32_t containing an error code from <code>pp_errors.h</code>.
+ *
+ * TODO(brettw) clarify whether this must have completed before a file can
+ * be opened in it. Clarify what it means to be "completed."
+ */
+ int32_t Open([in] PP_Resource file_system,
+ [in] int64_t expected_size,
+ [in] PP_CompletionCallback callback);
+
+ /**
+ * GetType() returns the type of the provided file system.
+ *
+ * @param[in] file_system A <code>PP_Resource</code> corresponding to a file
+ * system.
+ *
+ * @return A <code>PP_FileSystemType</code> with the file system type if
+ * valid or <code>PP_FILESYSTEMTYPE_INVALID</code> if the provided resource
+ * is not a valid file system. It is valid to call this function even before
+ * Open() completes.
+ */
+ PP_FileSystemType GetType([in] PP_Resource file_system);
+};
+
diff --git a/ppapi/api/ppb_graphics_2d.idl b/ppapi/api/ppb_graphics_2d.idl
index 1a013b1..5943415 100644
--- a/ppapi/api/ppb_graphics_2d.idl
+++ b/ppapi/api/ppb_graphics_2d.idl
@@ -3,64 +3,117 @@
* found in the LICENSE file.
*/
-/* Defines the PPB_Graphics2D struct. */
+/**
+ * Defines the <code>PPB_Graphics2D</code> struct representing a 2D graphics
+ * context within the browser.
+ */
+
+label Chrome {
+ M13 = 0.4,
+ M14 = 1.0
+};
-/* TODO(neb): Describe PPB_Graphics2D. */
-interface PPB_Graphics2D_0_3 {
- /* The returned graphics context will not be bound to the plugin instance on
- * creation (call BindGraphics on the plugin instance to do that).
- *
- * Set the is_always_opaque flag if you know that you will be painting only
- * opaque data to this context. This will disable blending when compositing
- * the plugin with the web page, which will give slightly higher performance.
- *
- * If you set is_always_opaque, your alpha channel should always be set to
- * 0xFF or there may be painting artifacts. Being opaque will allow the
- * browser to do a memcpy rather than a blend to paint the plugin, and this
- * means your alpha values will get set on the page backing store. If these
- * values are incorrect, it could mess up future blending.
- *
- * If you aren't sure, it is always correct to specify that it it not opaque.
+/**
+ * <code>PPB_Graphics2D</code> defines the interface for a 2D graphics context.
+ */
+[macro="PPB_GRAPHICS_2D_INTERFACE"]
+interface PPB_Graphics2D {
+ /**
+ * Create() creates a 2D graphics context. The returned graphics context will
+ * not be bound to the module instance on creation (call BindGraphics() on
+ * the module instance to bind the returned graphics context to the module
+ * instance).
+ *
+ * @param[in] instance The module instance.
+ * @param[in] size The size of the graphic context.
+ * @param[in] is_always_opaque Set the <code>is_always_opaque</code> flag to
+ * <code>PP_TRUE</code> if you know that you will be painting only opaque
+ * data to this context. This option will disable blending when compositing
+ * the module with the web page, which might give higher performance on some
+ * computers.
+ *
+ * If you set <code>is_always_opaque</code>, your alpha channel should always
+ * be set to 0xFF or there may be painting artifacts. The alpha values
+ * overwrite the destination alpha values without blending when
+ * <code>is_always_opaque</code> is true.
+ *
+ * @return A <code>PP_Resource</code> containing the 2D graphics context if
+ * successful or 0 if unsuccessful.
*/
PP_Resource Create(
[in] PP_Instance instance,
[in] PP_Size size,
[in] PP_Bool is_always_opaque);
- /* Returns PP_TRUE if the given resource is a valid Graphics2D, PP_FALSE if it
- * is an invalid resource or is a resource of another type.
+ /**
+ * IsGraphics2D() determines if the given resource is a valid
+ * <code>Graphics2D</code>.
+ *
+ * @param[in] resource A <code>Graphics2D</code> context resource.
+ *
+ * @return PP_TRUE if the given resource is a valid <code>Graphics2D</code>,
+ * <code>PP_FALSE</code> if it is an invalid resource or is a resource of
+ * another type.
*/
PP_Bool IsGraphics2D(
[in] PP_Resource resource);
- /* Retrieves the configuration for the given graphics context, filling the
- * given values (which must not be NULL). On success, returns PP_TRUE. If the
- * resource is invalid, the output parameters will be set to 0 and it will
- * return PP_FALSE.
+ /**
+ * Describe() retrieves the configuration for the given graphics context,
+ * filling the given values (which must not be <code>NULL</code>).
+ *
+ * @param[in] resource The 2D Graphics resource.
+ * @param[in,out] size The size of the 2D graphics context in the browser.
+ * @param[in,out] is_always_opaque Identifies whether only opaque data
+ * will be painted.
+ *
+ * @return Returns <code>PP_TRUE</code> on succes or <code>PP_FALSE</code> if
+ * the resource is invalid. The output parameters will be set to 0 on a
+ * <code>PP_FALSE</code>.
*/
PP_Bool Describe(
[in] PP_Resource graphics_2d,
[out] PP_Size size,
[out] PP_Bool is_always_opqaue);
- /* Enqueues a paint of the given image into the context. THIS HAS NO EFFECT
- * UNTIL YOU CALL Flush(). As a result, what counts is the contents of the
- * bitmap when you call Flush, not when you call this function.
+ /**
+ * PaintImageData() enqueues a paint of the given image into the context.
+ * This function has no effect until you call Flush() As a result, what
+ * counts is the contents of the bitmap when you call Flush(), not when
+ * you call this function.
*
- * The given image will be placed at |top_left| from the top left of the
- * context's internal backing store. Then the src_rect will be copied into the
- * backing store. This parameter may not be NULL.
+ * The provided image will be placed at <code>top_left</code> from the top
+ * left of the context's internal backing store. Then the pixels contained
+ * in <code>src_rect</code> will be copied into the backing store. This
+ * means that the rectangle being painted will be at <code>src_rect</code>
+ * offset by <code>top_left</code>.
*
- * The src_rect is specified in the coordinate system of the image being
- * painted, not the context. For the common case of copying the entire image,
- * you may specify a NULL |src_rect| pointer. If you are frequently updating
- * the entire image, consider using ReplaceContents which will give slightly
- * higher performance.
+ * The <code>src_rect</code> is specified in the coordinate system of the
+ * image being painted, not the context. For the common case of copying the
+ * entire image, you may specify an empty <code>src_rect</code>.
*
* The painted area of the source bitmap must fall entirely within the
* context. Attempting to paint outside of the context will result in an
* error. However, the source bitmap may fall outside the context, as long
- * as the src_rect subset of it falls entirely within the context.
+ * as the <code>src_rect</code> subset of it falls entirely within the
+ * context.
+ *
+ * There are two methods most modules will use for painting. The first
+ * method is to generate a new <code>ImageData</code> and then paint it. In
+ * this case, you'll set the location of your painting to
+ * <code>top_left</code> and set <code>src_rect</code> to <code>NULL</code>.
+ * The second is that you're generating small invalid regions out of a larger
+ * bitmap representing your entire instance. In this case, you would set the
+ * location of your image to (0,0) and then set <code>src_rect</code> to the
+ * pixels you changed.
+ *
+ * @param[in] resource The 2D Graphics resource.
+ * @param[in] image The <code>ImageData</code> to be painted.
+ * @param[in] top_left A <code>Point</code> representing the
+ * <code>top_left</code> location where the <code>ImageData</code> will be
+ * painted.
+ * @param[in] src_rect The rectangular area where the <code>ImageData</code>
+ * will be painted.
*/
void PaintImageData(
[in] PP_Resource graphics_2d,
@@ -68,39 +121,47 @@ interface PPB_Graphics2D_0_3 {
[in] PP_Point top_left,
[in] PP_Rect src_rect);
- /* Enqueues a scroll of the context's backing store. THIS HAS NO EFFECT UNTIL
- * YOU CALL Flush(). The data within the given clip rect (you may specify
- * NULL to scroll the entire region) will be shifted by (dx, dy) pixels.
+ /**
+ * Scroll() enqueues a scroll of the context's backing store. This
+ * function has no effect until you call Flush(). The data within the
+ * provided clipping rectangle will be shifted by (dx, dy) pixels.
*
- * This will result in some exposed region which will have undefined
- * contents. The plugin should call PaintImageData on these exposed regions
+ * This function will result in some exposed region which will have undefined
+ * contents. The module should call PaintImageData() on these exposed regions
* to give the correct contents.
*
- * The scroll can be larger than the area of the clip rect, which means the
- * current image will be scrolled out of the rect. This is not an error but
- * will be a no-op.
+ * The scroll can be larger than the area of the clipping rectangle, which
+ * means the current image will be scrolled out of the rectangle. This
+ * scenario is not an error but will result in a no-op.
+ *
+ * @param[in] graphics_2d The 2D Graphics resource.
+ * @param[in] clip The clipping rectangle.
+ * @param[in] amount The amount the area in the clipping rectangle will
+ * shifted.
*/
void Scroll(
[in] PP_Resource graphics_2d,
[in] PP_Rect clip_rect,
[in] PP_Point amount);
- /* This function provides a slightly more efficient way to paint the entire
- * plugin's image. Normally, calling PaintImageData requires that the browser
- * copy the pixels out of the image and into the graphics context's backing
- * store. This function replaces the graphics context's backing store with the
- * given image, avoiding the copy.
+ /**
+ * ReplaceContents() provides a slightly more efficient way to paint the
+ * entire module's image. Normally, calling PaintImageData() requires that
+ * the browser copy the pixels out of the image and into the graphics
+ * context's backing store. This function replaces the graphics context's
+ * backing store with the given image, avoiding the copy.
*
* The new image must be the exact same size as this graphics context. If the
* new image uses a different image format than the browser's native bitmap
- * format (use PPB_ImageData.GetNativeImageDataFormat to retrieve this), then
- * a conversion will be done inside the browser which may slow the performance
- * a little bit.
+ * format (use <code>PPB_ImageData.GetNativeImageDataFormat()</code> to
+ * retrieve the format), then a conversion will be done inside the browser
+ * which may slow the performance a little bit.
*
- * THE NEW IMAGE WILL NOT BE PAINTED UNTIL YOU CALL FLUSH.
+ * <strong>Note:</strong> The new image will not be painted until you call
+ * Flush().
*
* After this call, you should take care to release your references to the
- * image. If you paint to the image after ReplaceContents, there is the
+ * image. If you paint to the image after ReplaceContents(), there is the
* possibility of significant painting artifacts because the page might use
* partially-rendered data when copying out of the backing store.
*
@@ -111,86 +172,86 @@ interface PPB_Graphics2D_0_3 {
* the sizes match). In the optimal case, this means no bitmaps are allocated
* during the animation, and the backing store and "front buffer" (which the
* plugin is painting into) are just being swapped back and forth.
+ *
+ * @param[in] graphics_2d The 2D Graphics resource.
+ * @param[in] image The <code>ImageData</code> to be painted.
*/
void ReplaceContents(
[in] PP_Resource graphics_2d,
[in] PP_Resource image_data);
- /* Flushes any enqueued paint, scroll, and replace commands for the backing
- * store. This actually executes the updates, and causes a repaint of the
- * webpage, assuming this graphics context is bound to a plugin instance. This
- * can run in two modes:
- *
- * - In synchronous mode, you specify NULL for the callback and the callback
- * data. This function will block the calling thread until the image has
- * been painted to the screen. It is not legal to block the main thread of
- * the plugin, you can use synchronous mode only from background threads.
- *
- * - In asynchronous mode, you specify a callback function and the argument
- * for that callback function. The callback function will be executed on
- * the calling thread when the image has been painted to the screen. While
- * you are waiting for a Flush callback, additional calls to Flush will
- * fail.
+ /**
+ * Flush() flushes any enqueued paint, scroll, and replace commands to the
+ * backing store. This function actually executes the updates, and causes a
+ * repaint of the webpage, assuming this graphics context is bound to a module
+ * instance.
+ *
+ * Flush() runs in asynchronous mode. Specify a callback function and the
+ * argument for that callback function. The callback function will be
+ * executed on the calling thread when the image has been painted to the
+ * screen. While you are waiting for a flush callback, additional calls to
+ * Flush() will fail.
*
* Because the callback is executed (or thread unblocked) only when the
- * plugin's current state is actually on the screen, this function provides a
- * way to rate limit animations. By waiting until the image is on the screen
- * before painting the next frame, you can ensure you're not generating
- * updates faster than the screen can be updated.
- *
- * <dl>
- * <dt>Unbound contexts</dt>
- * <dd>
- * If the context is not bound to a plugin instance, you will
- * still get a callback. It will execute after the Flush function returns
- * to avoid reentrancy. Of course, it will not wait until anything is
- * painted to the screen because there will be nothing on the screen. The
- * timing of this callback is not guaranteed and may be deprioritized by
- * the browser because it is not affecting the user experience.
- * </dd>
- *
- * <dt>Off-screen instances</dt>
- * <dd>
- * If the context is bound to an instance that is
- * currently not visible (for example, scrolled out of view) it will behave
- * like the "unbound context" case.
- * </dd>
- *
- * <dt>Detaching a context</dt>
- * <dd>
- * If you detach a context from a plugin instance, any
- * pending flush callbacks will be converted into the "unbound context"
- * case.
- * </dd>
- *
- * <dt>Released contexts</dt>
- * <dd>
- * A callback may or may not still get called even if you have released all
- * of your references to the context. This can occur if there are internal
- * references to the context that means it has not been internally
- * destroyed (for example, if it is still bound to an instance) or due to
- * other implementation details. As a result, you should be careful to
- * check that flush callbacks are for the context you expect and that
- * you're capable of handling callbacks for context that you may have
- * released your reference to.
- * </dd>
- *
- * <dt>Shutdown</dt>
- * <dd>
- * If a plugin instance is removed when a Flush is pending, the
- * callback will not be executed.
- * </dd>
- * </dl>
- *
- * Returns PP_OK on success, PP_Error_BadResource if the graphics context is
- * invalid, PP_Error_BadArgument if the callback is null and Flush is being
- * called from the main thread of the plugin, or PP_Error_InProgress if a
- * Flush is already pending that has not issued its callback yet. In the
- * failure case, nothing will be updated and no callback will be scheduled.
+ * instance's image is actually on the screen, this function provides
+ * a way to rate limit animations. By waiting until the image is on the
+ * screen before painting the next frame, you can ensure you're not
+ * flushing 2D graphics faster than the screen can be updated.
+ *
+ * <strong>Unbound contexts</strong>
+ * If the context is not bound to a module instance, you will
+ * still get a callback. The callback will execute after Flush() returns
+ * to avoid reentrancy. The callback will not wait until anything is
+ * painted to the screen because there will be nothing on the screen. The
+ * timing of this callback is not guaranteed and may be deprioritized by
+ * the browser because it is not affecting the user experience.
+ *
+ * <strong>Off-screen instances</strong>
+ * If the context is bound to an instance that is currently not visible (for
+ * example, scrolled out of view) it will behave like the "unbound context"
+ * case.
+ *
+ * <strong>Detaching a context</strong>
+ * If you detach a context from a module instance, any pending flush
+ * callbacks will be converted into the "unbound context" case.
+ *
+ * <strong>Released contexts</strong>
+ * A callback may or may not get called even if you have released all
+ * of your references to the context. This scenario can occur if there are
+ * internal references to the context suggesting it has not been internally
+ * destroyed (for example, if it is still bound to an instance) or due to
+ * other implementation details. As a result, you should be careful to
+ * check that flush callbacks are for the context you expect and that
+ * you're capable of handling callbacks for unreferenced contexts.
+ *
+ * <strong>Shutdown</strong>
+ * If a module instance is removed when a flush is pending, the
+ * callback will not be executed.
+ *
+ * @param[in] graphics_2d The 2D Graphics resource.
+ * @param[in] callback A <code>CompletionCallback</code> to be called when
+ * the image has been painted on the screen.
+ *
+ * @return Returns <code>PP_OK</code> on success or
+ * <code>PP_Error_BadResource</code> if the graphics context is invalid,
+ * <code>PP_Error_BadArgument</code> if the callback is null and flush is
+ * being called from the main thread of the module, or
+ * <code>PP_Error_InProgress</code> if a flush is already pending that has
+ * not issued its callback yet. In the failure case, nothing will be updated
+ * and no callback will be scheduled.
+ */
+
+ /*
* TODO(darin): We should ensure that the completion callback always runs, so
* that it is easier for consumers to manage memory referenced by a callback.
*/
+
+ /*
+ * TODO(): Add back in the synchronous mode description once we have support
+ * for it.
+ */
int32_t Flush(
[in] PP_Resource graphics_2d,
[in] PP_CompletionCallback callback);
};
+
diff --git a/ppapi/api/ppb_image_data.idl b/ppapi/api/ppb_image_data.idl
index aa3cbd0..f7fc63d 100644
--- a/ppapi/api/ppb_image_data.idl
+++ b/ppapi/api/ppb_image_data.idl
@@ -3,56 +3,125 @@
* found in the LICENSE file.
*/
-/* Defines the image data API. */
+/**
+ * This file defines the <code>PPB_ImageData</code> struct for determining how
+ * a browser handles image data.
+ */
+
+ label Chrome {
+ M13 = 0.3,
+ M14 = 1.0
+ };
-/* Bitmap formats. */
+/**
+ * <code>PP_ImageDataFormat</code> is an enumeration of the different types of
+ * image data formats.
+ *
+ * The third part of each enumeration value describes the memory layout from
+ * the lowest address to the highest. For example, BGRA means the B component
+ * is stored in the lowest address, no matter what endianness the platform is
+ * using.
+ *
+ * The PREMUL suffix implies pre-multiplied alpha is used. In this mode, the
+ * red, green and blue color components of the pixel data supplied to an image
+ * data should be pre-multiplied by their alpha value. For example: starting
+ * with floating point color components, here is how to convert them to 8-bit
+ * premultiplied components for image data:
+ *
+ * ...components of a pixel, floats ranging from 0 to 1...
+ * <code>float red = 1.0f;</code>
+ * <code><code>float green = 0.50f;</code>
+ * <code>float blue = 0.0f;</code>
+ * <code>float alpha = 0.75f;</code>
+ * ...components for image data are 8-bit values ranging from 0 to 255...
+ * <code>uint8_t image_data_red_premul = (uint8_t)(red * alpha * 255.0f);
+ * </code>
+ * <code>uint8_t image_data_green_premul = (uint8_t)(green * alpha * 255.0f);
+ * </code>
+ * <code>uint8_t image_data_blue_premul = (uint8_t)(blue * alpha * 255.0f);
+ * </code>
+ * <code>uint8_t image_data_alpha_premul = (uint8_t)(alpha * 255.0f);</code>
+ *
+ * <strong>Note:</strong> The resulting pre-multiplied red, green and blue
+ * components should not be greater than the alpha value.
+ */
+[assert_size(4)]
enum PP_ImageDataFormat {
- /* 32 bits, BGRA byte order, premultiplied alpha */
- PP_IMAGEDATAFORMAT_BGRA_PREMUL = 0,
- /* 32 bits, RGBA byte order, premultiplied alpha */
- PP_IMAGEDATAFORMAT_RGBA_PREMUL = 1
+ PP_IMAGEDATAFORMAT_BGRA_PREMUL,
+ PP_IMAGEDATAFORMAT_RGBA_PREMUL
};
-/* Description of a bitmap. */
+/**
+ * The <code>PP_ImageDataDesc</code> structure represents a description of
+ * image data.
+ */
+[assert_size(16)]
struct PP_ImageDataDesc {
- /* Byte format. */
+ /**
+ * This value represents one of the image data types in the
+ * <code>PP_ImageDataFormat</code> enum.
+ */
PP_ImageDataFormat format;
- /* Size of the bitmap in pixels. */
+ /** This value represents the size of the bitmap in pixels. */
PP_Size size;
- /* The row width in bytes. This may be different than width * 4 since there
- * may be padding at the end of the lines.
+ /**
+ * This value represents the row width in bytes. This may be different than
+ * width * 4 since there may be padding at the end of the lines.
*/
int32_t stride;
};
-/* Interface for manipulating 2D bitmaps. */
-interface PPB_ImageData_0_3 {
- /* Returns the browser's preferred format for image data. This format will be
- * the format is uses internally for painting. Other formats may require
- * internal conversions to paint or may have additional restrictions depending
- * on the function.
+/**
+ * The <code>PPB_ImageData</code> interface contains pointers to several
+ * functions for determining the browser's treatment of image data.
+ */
+[version=0.3]
+interface PPB_ImageData {
+ /**
+ * GetNativeImageDataFormat() returns the browser's preferred format for
+ * image data. The browser uses this format internally for painting. Other
+ * formats may require internal conversions to paint or may have additional
+ * restrictions depending on the function.
+ *
+ * @return A <code>PP_ImageDataFormat</code> containing the preferred format.
*/
PP_ImageDataFormat GetNativeImageDataFormat();
- /* Returns PP_TRUE if the given image data format is supported by the browser.
+ /**
+ * IsImageDataFormatSupported() determines if the given image data format is
+ * supported by the browser.
+ *
+ * @param[in] format The image data format.
+ *
+ * @return A <code>PP_Bool</code> with <code>PP_TRUE</code> if the given
+ * image data format is supported by the browser.
*/
PP_Bool IsImageDataFormatSupported(
[in] PP_ImageDataFormat format);
- /* Allocates an image data resource with the given format and size. The
- * return value will have a nonzero ID on success, or zero on failure.
- * Failure means the instance, image size, or format was invalid.
- *
- * Set the init_to_zero 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 plugin should
- * be sure to set all the pixels.
+ /**
+ * 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
- * plugin if the bitmap was cached and re-used.
+ * module if the bitmap was cached and re-used.
+ *
+ * @param[in] instance A <code>PP_Instance</code> indentifying 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 succes or zero on
+ * failure. Failure means the instance, image size, or format was invalid.
*/
PP_Resource Create(
[in] PP_Instance instance,
@@ -60,27 +129,56 @@ interface PPB_ImageData_0_3 {
[in] PP_Size size,
[in] PP_Bool init_to_zero);
- /* Returns PP_TRUE if the given resource is an image data. Returns PP_FALSE if
- * the resource is invalid or some type other than an image data.
+ /**
+ * IsImageData() determiens if a given resource is image data.
+ *
+ * @param[in] image_data A <code>PP_Resource</code> corresponding to image
+ * data.
+ *
+ * @return A <code>PP_Bool</code> with <code>PP_TRUE</code> if the given
+ * resrouce is an image data or <code>PP_FALSE</code> if the resource is
+ * invalid or some type other than image data.
*/
PP_Bool IsImageData(
[in] PP_Resource image_data);
- /* Computes the description of the image data. Returns PP_TRUE on success,
- * PP_FALSE if the resource is not an image data. On PP_FALSE, the |desc|
- * structure will be filled with 0.
+ /**
+ * Describe() computes the description of the
+ * image data.
+ *
+ * @param[in] image_data A <code>PP_Resource</code> corresponding to image
+ * data.
+ * @param[in,out] desc A pointer to a <code>PP_ImageDataDesc</code>
+ * containing the description.
+ *
+ * @return A <code>PP_Bool</code> with <code>PP_TRUE</code> on success or
+ * <code>PP_FALSE</code> if the resource is not an image data. On
+ * <code>PP_FALSE</code>, the <code>desc</code> structure will be filled
+ * with 0.
*/
PP_Bool Describe(
[in] PP_Resource image_data,
[out] PP_ImageDataDesc desc);
- /* Maps this bitmap into the plugin address space and returns a pointer to the
- * beginning of the data.
+ /**
+ * Map() maps an image data into the module address space.
+ *
+ * @param[in] image_data A <code>PP_Resource</code> corresponding to image
+ * data.
+ *
+ * @return A pointer to the beginning of the data.
*/
mem_t Map(
[in] PP_Resource image_data);
- /* Unmaps this bitmaps from the plugin address space */
+ /**
+ * Unmap is a pointer to a function that unmaps an image data from the module
+ * address space.
+ *
+ * @param[in] image_data A <code>PP_Resource</code> corresponding to image
+ * data.
+ */
void Unmap(
[in] PP_Resource image_data);
};
+
diff --git a/ppapi/api/ppb_input_event.idl b/ppapi/api/ppb_input_event.idl
new file mode 100644
index 0000000..07e3ea8
--- /dev/null
+++ b/ppapi/api/ppb_input_event.idl
@@ -0,0 +1,463 @@
+/* Copyright (c) 2011 The Chromium Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/**
+ * This file defines the Input Event interfaces.
+ */
+
+label Chrome {
+ M14 = 0.1
+};
+
+/**
+ * This enumeration contains the types of input events.
+ */
+[assert_size(4)]
+enum PP_InputEvent_Type {
+ PP_INPUTEVENT_TYPE_UNDEFINED = -1,
+
+ /**
+ * Notification that a mouse button was pressed.
+ *
+ * Register for this event using the PP_INPUTEVENT_CLASS_MOUSE class.
+ */
+ PP_INPUTEVENT_TYPE_MOUSEDOWN = 0,
+
+ /**
+ * Notification that a mouse button was released.
+ *
+ * Register for this event using the PP_INPUTEVENT_CLASS_MOUSE class.
+ */
+ PP_INPUTEVENT_TYPE_MOUSEUP = 1,
+
+ /**
+ * Notification that a mouse button was moved when it is over the instance
+ * or dragged out of it.
+ *
+ * Register for this event using the PP_INPUTEVENT_CLASS_MOUSE class.
+ */
+ PP_INPUTEVENT_TYPE_MOUSEMOVE = 2,
+
+ /**
+ * Notification that the mouse entered the instance's bounds.
+ *
+ * Register for this event using the PP_INPUTEVENT_CLASS_MOUSE class.
+ */
+ PP_INPUTEVENT_TYPE_MOUSEENTER = 3,
+
+ /**
+ * Notification that a mouse left the instance's bounds.
+ *
+ * Register for this event using the PP_INPUTEVENT_CLASS_MOUSE class.
+ */
+ PP_INPUTEVENT_TYPE_MOUSELEAVE = 4,
+
+ /**
+ * Notification that the scroll wheel was used.
+ *
+ * Register for this event using the PP_INPUTEVENT_CLASS_WHEEL class.
+ */
+ PP_INPUTEVENT_TYPE_MOUSEWHEEL = 5,
+
+ /**
+ * Notification that a key transitioned from "up" to "down".
+ * TODO(brettw) differentiate from KEYDOWN.
+ *
+ * Register for this event using the PP_INPUTEVENT_CLASS_KEYBOARD class.
+ */
+ PP_INPUTEVENT_TYPE_RAWKEYDOWN = 6,
+
+ /**
+ * Notification that a key was pressed. This does not necessarily correspond
+ * to a character depending on the key and language. Use the
+ * PP_INPUTEVENT_TYPE_CHAR for character input.
+ *
+ * Register for this event using the PP_INPUTEVENT_CLASS_KEYBOARD class.
+ */
+ PP_INPUTEVENT_TYPE_KEYDOWN = 7,
+
+ /**
+ * Notification that a key was released.
+ *
+ * Register for this event using the PP_INPUTEVENT_CLASS_KEYBOARD class.
+ */
+ PP_INPUTEVENT_TYPE_KEYUP = 8,
+
+ /**
+ * Notification that a character was typed. Use this for text input. Key
+ * down events may generate 0, 1, or more than one character event depending
+ * on the key, locale, and operating system.
+ *
+ * Register for this event using the PP_INPUTEVENT_CLASS_KEYBOARD class.
+ */
+ PP_INPUTEVENT_TYPE_CHAR = 9,
+
+ /**
+ * TODO(brettw) when is this used?
+ *
+ * Register for this event using the PP_INPUTEVENT_CLASS_MOUSE class.
+ */
+ PP_INPUTEVENT_TYPE_CONTEXTMENU = 10
+};
+
+/**
+ * This enumeration contains event modifier constants. Each modifier is one
+ * bit. Retrieve the modifiers from an input event using the GetEventModifiers
+ * function on PPB_InputEvent.
+ */
+[assert_size(4)]
+enum PP_InputEvent_Modifier {
+ PP_INPUTEVENT_MODIFIER_SHIFTKEY = 1 << 0,
+ PP_INPUTEVENT_MODIFIER_CONTROLKEY = 1 << 1,
+ PP_INPUTEVENT_MODIFIER_ALTKEY = 1 << 2,
+ PP_INPUTEVENT_MODIFIER_METAKEY = 1 << 3,
+ PP_INPUTEVENT_MODIFIER_ISKEYPAD = 1 << 4,
+ PP_INPUTEVENT_MODIFIER_ISAUTOREPEAT = 1 << 5,
+ PP_INPUTEVENT_MODIFIER_LEFTBUTTONDOWN = 1 << 6,
+ PP_INPUTEVENT_MODIFIER_MIDDLEBUTTONDOWN = 1 << 7,
+ PP_INPUTEVENT_MODIFIER_RIGHTBUTTONDOWN = 1 << 8,
+ PP_INPUTEVENT_MODIFIER_CAPSLOCKKEY = 1 << 9,
+ PP_INPUTEVENT_MODIFIER_NUMLOCKKEY = 1 << 10
+};
+
+/**
+ * This enumeration contains constants representing each mouse button. To get
+ * the mouse button for a mouse down or up event, use GetMouseButton on
+ * PPB_InputEvent.
+ */
+[assert_size(4)]
+enum PP_InputEvent_MouseButton {
+ PP_INPUTEVENT_MOUSEBUTTON_NONE = -1,
+ PP_INPUTEVENT_MOUSEBUTTON_LEFT = 0,
+ PP_INPUTEVENT_MOUSEBUTTON_MIDDLE = 1,
+ PP_INPUTEVENT_MOUSEBUTTON_RIGHT = 2
+};
+
+[assert_size(4)]
+enum PP_InputEvent_Class {
+ /**
+ * Request mouse input events.
+ *
+ * Normally you will request mouse events by calling RequestInputEvents().
+ * The only use case for filtered events (via RequestFilteringInputEvents())
+ * is for instances that have irregular outlines and you want to perform hit
+ * testing, which is very uncommon. Requesting non-filtered mouse events will
+ * lead to higher performance.
+ */
+ PP_INPUTEVENT_CLASS_MOUSE = 1 << 0,
+
+ /**
+ * Requests keyboard events. Keyboard events must be requested in filtering
+ * mode via RequestFilteringInputEvents(). This is because many commands
+ * should be forwarded to the page.
+ *
+ * A small number of tab and window management commands like Alt-F4 are never
+ * sent to the page. You can not request these keyboard commands since it
+ * would allow pages to trap users on a page.
+ */
+ PP_INPUTEVENT_CLASS_KEYBOARD = 1 << 1,
+
+ /**
+ * Identifies scroll wheel input event. Wheel events must be requested in
+ * filtering mode via RequestFilteringInputEvents(). This is because many
+ * wheel commands should be forwarded to the page.
+ *
+ * Most instances will not need this event. Consuming wheel events by
+ * returning true from your filtered event handler will prevent the user from
+ * scrolling the page when the mouse is over the instance which can be very
+ * annoying.
+ *
+ * If you handle wheel events (for example, you have a document viewer which
+ * the user can scroll), the recommended behavior is to return false only if
+ * the wheel event actually causes your document to scroll. When the user
+ * reaches the end of the document, return false to indicating that the event
+ * was not handled. This will then forward the event to the containing page
+ * for scrolling, producing the nested scrolling behavior users expect from
+ * frames in a page.
+ */
+ PP_INPUTEVENT_CLASS_WHEEL = 1 << 2,
+
+ /**
+ * Identifies touch input events.
+ *
+ * Request touch events only if you intend to handle them. If the browser
+ * knows you do not need to handle touch events, it can handle them at a
+ * higher level and achieve higher performance.
+ */
+ PP_INPUTEVENT_CLASS_TOUCH = 1 << 3,
+
+ /**
+ * Identifies IME composition input events.
+ *
+ * Request this input event class if you allow on-the-spot IME input.
+ */
+ PP_INPUTEVENT_CLASS_IME = 1 << 4
+};
+
+[version=0.1, macro="PPB_INPUT_EVENT_INTERFACE"]
+interface PPB_InputEvent {
+ /**
+ * Request that input events corresponding to the given input events are
+ * delivered to the instance.
+ *
+ * You can not use this function to request keyboard events
+ * (PP_INPUTEVENT_CLASS_KEYBOARD). You must use RequestFilteringInputEvents()
+ * for this class of input.
+ *
+ * By default, no input events are delivered. Call this function with the
+ * classes of events you are interested in to have them be delivered to
+ * the instance. Calling this function will override any previous setting for
+ * each specified class of input events (for example, if you previously
+ * called RequestFilteringInputEvents(), this function will set those events
+ * to non-filtering mode).
+ *
+ * Input events may have high overhead, so you should only request input
+ * events that your plugin will actually handle. For example, the browser may
+ * do optimizations for scroll or touch events that can be processed
+ * substantially faster if it knows there are no non-default receivers for
+ * that message. Requesting that such messages be delivered, even if they are
+ * processed very quickly, may have a noticable effect on the performance of
+ * the page.
+ *
+ * When requesting input events through this function, the events will be
+ * delivered and <i>not</i> bubbled to the page. This means that even if you
+ * aren't interested in the message, no other parts of the page will get
+ * a crack at the message.
+ *
+ * Example:
+ * RequestInputEvents(instance, PP_INPUTEVENT_CLASS_MOUSE);
+ * RequestFilteringInputEvents(instance,
+ * PP_INPUTEVENT_CLASS_WHEEL | PP_INPUTEVENT_CLASS_KEYBOARD);
+ *
+ * @param instance The <code>PP_Instance</code> of the instance requesting
+ * the given events.
+ *
+ * @param event_classes A combination of flags from PP_InputEvent_Class that
+ * identifies the classes of events the instance is requesting. The flags
+ * are combined by logically ORing their values.
+ *
+ * @return PP_OK if the operation succeeded, PP_ERROR_BADARGUMENT if instance
+ * is invalid, or PP_ERROR_NOTSUPPORTED if one of the event class bits were
+ * illegal. In the case of an invalid bit, all valid bits will be applied
+ * and only the illegal bits will be ignored. The most common cause of a
+ * PP_ERROR_NOTSUPPORTED return value is requesting keyboard events, these
+ * must use RequestFilteringInputEvents().
+ */
+ int32_t RequestInputEvents([in] PP_Instance instance,
+ [in] uint32_t event_classes);
+
+ /**
+ * Request that input events corresponding to the given input events are
+ * delivered to the instance for filtering.
+ *
+ * By default, no input events are delivered. In most cases you would
+ * register to receive events by calling RequestInputEvents(). In some cases,
+ * however, you may wish to filter events such that they can be bubbled up
+ * to the DOM. In this case, register for those classes of events using
+ * this function instead of RequestInputEvents(). Keyboard events must always
+ * be registered in filtering mode.
+ *
+ * Filtering input events requires significantly more overhead than just
+ * delivering them to the instance. As such, you should only request
+ * filtering in those cases where it's absolutely necessary. The reason is
+ * that it requires the browser to stop and block for the instance to handle
+ * the input event, rather than sending the input event asynchronously. This
+ * can have significant overhead.
+ *
+ * Example:
+ * RequestInputEvents(instance, PP_INPUTEVENT_CLASS_MOUSE);
+ * RequestFilteringInputEvents(instance,
+ * PP_INPUTEVENT_CLASS_WHEEL | PP_INPUTEVENT_CLASS_KEYBOARD);
+ *
+ * @return PP_OK if the operation succeeded, PP_ERROR_BADARGUMENT if instance
+ * is invalid, or PP_ERROR_NOTSUPPORTED if one of the event class bits were
+ * illegal. In the case of an invalid bit, all valid bits will be applied
+ * and only the illegal bits will be ignored.
+ */
+ int32_t RequestFilteringInputEvents([in] PP_Instance instance,
+ [in] uint32_t event_classes);
+
+ /**
+ * Request that input events corresponding to the given input classes no
+ * longer be delivered to the instance.
+ *
+ * By default, no input events are delivered. If you have previously
+ * requested input events via RequestInputEvents() or
+ * RequestFilteringInputEvents(), this function will unregister handling
+ * for the given instance. This will allow greater browser performance for
+ * those events.
+ *
+ * Note that you may still get some input events after clearing the flag if
+ * they were dispatched before the request was cleared. For example, if
+ * there are 3 mouse move events waiting to be delivered, and you clear the
+ * mouse event class during the processing of the first one, you'll still
+ * receive the next two. You just won't get more events generated.
+ *
+ * @param instance The <code>PP_Instance</code> of the instance requesting
+ * to no longer receive the given events.
+ *
+ * @param event_classes A combination of flags from PP_InputEvent_Class that
+ * identifies the classes of events the instance is no longer interested in.
+ */
+ void ClearInputEventRequest([in] PP_Instance instance,
+ [in] uint32_t event_classes);
+
+ /**
+ * Returns true if the given resource is a valid input event resource.
+ */
+ PP_Bool IsInputEvent([in] PP_Resource resource);
+
+ /**
+ * Returns the type of input event for the given input event resource.
+ * This is valid for all input events. Returns PP_INPUTEVENT_TYPE_UNDEFINED
+ * if the resource is invalid.
+ */
+ PP_InputEvent_Type GetType([in] PP_Resource event);
+
+ /**
+ * Returns the time that the event was generated. This will be before the
+ * current time since processing and dispatching the event has some overhead.
+ * Use this value to compare the times the user generated two events without
+ * being sensitive to variable processing time.
+ *
+ * The return value is in time ticks, which is a monotonically increasing
+ * clock not related to the wall clock time. It will not change if the user
+ * changes their clock or daylight savings time starts, so can be reliably
+ * used to compare events. This means, however, that you can't correlate
+ * event times to a particular time of day on the system clock.
+ */
+ PP_TimeTicks GetTimeStamp([in] PP_Resource event);
+
+ /**
+ * Returns a bitfield indicating which modifiers were down at the time of
+ * the event. This is a combination of the flags in the
+ * PP_InputEvent_Modifier enum.
+ *
+ * @return The modifiers associated with the event, or 0 if the given
+ * resource is not a valid event resource.
+ */
+ uint32_t GetModifiers([in] PP_Resource event);
+};
+
+[version=0.1, macro="PPB_MOUSE_INPUT_EVENT_INTERFACE"]
+interface PPB_MouseInputEvent {
+ /**
+ * Determines if a resource is a mouse event.
+ *
+ * @return PP_TRUE if the given resource is a valid mouse input event.
+ */
+ PP_Bool IsMouseInputEvent([in] PP_Resource resource);
+
+ /**
+ * Returns which mouse button generated a mouse down or up event.
+ *
+ * @return The mouse button associated with mouse down and up events. This
+ * value will be PP_EVENT_MOUSEBUTTON_NONE for mouse move, enter, and leave
+ * events, and for all non-mouse events.
+ */
+ PP_InputEvent_MouseButton GetMouseButton([in] PP_Resource mouse_event);
+
+ /**
+ * Returns the pixel location of a mouse input event.
+ *
+ * @return The point associated with the mouse event, relative to the upper-
+ * left of the instance receiving the event. These values can be negative for
+ * mouse drags. The return value will be (0, 0) for non-mouse events.
+ */
+ [returnByValue] PP_Point GetMousePosition([in] PP_Resource mouse_event);
+
+ /**
+ * TODO(brettw) figure out exactly what this means.
+ */
+ int32_t GetMouseClickCount([in] PP_Resource mouse_event);
+};
+
+[version=0.1, macro="PPB_WHEEL_INPUT_EVENT_INTERFACE"]
+interface PPB_WheelInputEvent {
+ /**
+ * Determines if a resource is a wheel event.
+ *
+ * @return PP_TRUE if the given resource is a valid wheel input event.
+ */
+ PP_Bool IsWheelInputEvent([in] PP_Resource resource);
+
+ /**
+ * Indicates the amount vertically and horizontally the user has requested
+ * to scroll by with their mouse wheel. A scroll down or to the right (where
+ * the content moves up or left) is represented as positive values, and
+ * a scroll up or to the left (where the content moves down or right) is
+ * represented as negative values.
+ *
+ * The units are either in pixels (when scroll_by_page is false) or pages
+ * (when scroll_by_page is true). For example, y = -3 means scroll up 3
+ * pixels when scroll_by_page is false, and scroll up 3 pages when
+ * scroll_by_page is true.
+ *
+ * This amount is system dependent and will take into account the user's
+ * preferred scroll sensitivity and potentially also nonlinear acceleration
+ * based on the speed of the scrolling.
+ *
+ * Devices will be of varying resolution. Some mice with large detents will
+ * only generate integer scroll amounts. But fractional values are also
+ * possible, for example, on some trackpads and newer mice that don't have
+ * "clicks".
+ */
+ PP_FloatPoint GetWheelDelta([in] PP_Resource wheel_event);
+
+ /**
+ * The number of "clicks" of the scroll wheel that have produced the
+ * event. The value may have system-specific acceleration applied to it,
+ * depending on the device. The positive and negative meanings are the same
+ * as for GetWheelDelta().
+ *
+ * If you are scrolling, you probably want to use the delta values. These
+ * tick events can be useful if you aren't doing actual scrolling and don't
+ * want or pixel values. An example may be cycling between different items in
+ * a game.
+ *
+ * You may receive fractional values for the wheel ticks if the mouse wheel
+ * is high resolution or doesn't have "clicks". If your program wants
+ * discrete events (as in the "picking items" example) you should accumulate
+ * fractional click values from multiple messages until the total value
+ * reaches positive or negative one. This should represent a similar amount
+ * of scrolling as for a mouse that has a discrete mouse wheel.
+ */
+ PP_FloatPoint GetWheelTicks([in] PP_Resource wheel_event);
+
+ /**
+ * Indicates if the scroll delta x/y indicates pages or lines to
+ * scroll by.
+ *
+ * @return PP_TRUE if the event is a wheel event and the user is scrolling
+ * by pages. PP_FALSE if not or if the resource is not a wheel event.
+ */
+ PP_Bool GetScrollByPage([in] PP_Resource wheel_event);
+};
+
+[version=0.1, macro="PPB_KEYBOARD_INPUT_EVENT_INTERFACE"]
+interface PPB_KeyboardInputEvent {
+ /**
+ * Determines if a resource is a keyboard event.
+ *
+ * @return PP_TRUE if the given resource is a valid mouse input event.
+ */
+ PP_Bool IsKeyboardInputEvent([in] PP_Resource resource);
+
+ /**
+ * Returns the DOM |keyCode| field for the keyboard event.
+ * Chrome populates this with the Windows-style Virtual Key code of the key.
+ */
+ uint32_t GetKeyCode([in] PP_Resource key_event);
+
+ /**
+ * Returns the typed character for the given character event.
+ *
+ * @return A string var representing a single typed character for character
+ * input events. For non-character input events the return value will be an
+ * undefined var.
+ */
+ PP_Var GetCharacterText([in] PP_Resource character_event);
+};
+
diff --git a/ppapi/api/ppb_instance.idl b/ppapi/api/ppb_instance.idl
index f237edb..fefc785 100644
--- a/ppapi/api/ppb_instance.idl
+++ b/ppapi/api/ppb_instance.idl
@@ -3,53 +3,81 @@
* found in the LICENSE file.
*/
-/* This file defines the PPB_Instance interface implemented by the
+/**
+ * This file defines the PPB_Instance interface implemented by the
* browser and containing pointers to functions related to
* the module instance on a web page.
*/
-/* The PPB_Instance interface contains pointers to functions
+label Chrome {
+ M13 = 0.5,
+ M14 = 1.0
+ };
+
+/**
+ * The PPB_Instance interface contains pointers to functions
* related to the module instance on a web page.
*/
-interface PPB_Instance_0_5 {
- /* BindGraphics is a pointer to a function that binds the given
- * graphics as the current drawing surface. The
- * contents of this device is what will be displayed in the plugin's area
- * on the web page. The device must be a 2D or a 3D device.
+interface PPB_Instance {
+ /** Deprecated in 1.0 */
+ [deprecate=1.0]
+ PP_Var GetWindowObject([in] PP_Instance instance);
+
+ /** Deprecated in 1.0 */
+ [deprecate=1.0]
+ PP_Var GetOwnerElementObject([in] PP_Instance instance);
+
+ /**
+ * BindGraphics() binds the given graphics as the current drawing surface.
+ * The contents of this device is what will be displayed in the module's
+ * area on the web page. The device must be a 2D or a 3D device.
*
- * You can pass a NULL 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 PP_TRUE and will do
- * nothing. Unbinding a device will drop any pending flush callbacks.
+ * 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. Unbinding a device will drop any pending flush
+ * callbacks.
*
- * Any previously-bound device will be Release()d. It is an error to bind
- * a device when it is already bound to another plugin instance. If you want
+ * 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.
*
- * Returns PP_Bool containing PP_TRUE if bind was successful or PP_FALSE if
- * the device was not the correct type. On success, a reference to the
- * device will be held by the plugin instance, so the caller can release
- * its reference if it chooses.
+ * @param[in] instance A PP_Instance indentifying one instance of a module.
+ * @param[in] device A PP_Resource representing the 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.
*/
PP_Bool BindGraphics(
- /* A PP_Instance indentifying one instance of a module. */
[in] PP_Instance instance,
- /* A PP_Resourse representing the graphics device. */
[in] PP_Resource device);
- /* IsFullFrame is a pointer to a function that determines if the
- * module instance is full-frame (repr). Such a module 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 plugin.
+ /**
+ * IsFullFrame() determines if the module instance is full-frame (repr).
+ * Such a module 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.
*
- * Returns a PP_Bool containing PP_TRUE if the instance is full-frame.
+ * @param[in] instance A <code>PP_Instance</code> indentifying one instance
+ * of a module.
+ *
+ * @return A <code>PP_Bool</code> containing <code>PP_TRUE<code> if the
+ * instance is full-frame.
*/
PP_Bool IsFullFrame(
- /* A PP_Instance indentifying one instance of a module. */
[in] PP_Instance instance);
+
+ /** Deprecated in 0.5 */
+ [deprecate=0.5]
+ PP_Var ExecuteScript([in] PP_Instance instance,
+ [in] PP_Var script,
+ [out] PP_Var exception);
};
+
diff --git a/ppapi/api/ppb_messaging.idl b/ppapi/api/ppb_messaging.idl
new file mode 100644
index 0000000..bbcff58
--- /dev/null
+++ b/ppapi/api/ppb_messaging.idl
@@ -0,0 +1,82 @@
+/* Copyright (c) 2011 The Chromium Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/**
+ * This file defines the <code>PPB_Messaging</code> interface implemented
+ * by the browser for sending messages to DOM elements associated with a
+ * specific module instance.
+ */
+
+label Chrome {
+ M13 = 0.1,
+ M14 = 1.0
+};
+
+/**
+ * The <code>PPB_Messaging</code> interface is implemented by the browser
+ * and is related to sending messages to JavaScript message event listeners on
+ * the DOM element associated with specific module instance.
+ */
+[version=0.1]
+interface PPB_Messaging {
+ /**
+ * PostMessage() asynchronously invokes any listeners for message events on
+ * the DOM element for the given module instance. A call to PostMessage()
+ * will not block while the message is processed.
+ *
+ * @param[in] instance A <code>PP_Instance</code> indentifying one instance
+ * of a module.
+ * @param[in] message A <code>PP_Var</code> containing the data to be sent to
+ * JavaScript.
+ * Message can have a numeric, boolean, or string value; arrays and
+ * dictionaries are not yet supported. Ref-counted var types are copied, and
+ * are therefore not shared between the module instance and the browser.
+ *
+ * Listeners for message events in JavaScript code will receive an object
+ * conforming to the HTML 5 <code>MessageEvent</code> interface.
+ * Specifically, the value of message will be contained as a property called
+ * data in the received <code>MessageEvent</code>.
+ *
+ * This messaging system is similar to the system used for listening for
+ * messages from Web Workers. Refer to
+ * <code>http://www.whatwg.org/specs/web-workers/current-work/</code> for
+ * further information.
+ *
+ * <strong>Example:</strong>
+ *
+ * @code
+ *
+ * <body>
+ * <object id="plugin"
+ * type="application/x-ppapi-postMessage-example"/>
+ * <script type="text/javascript">
+ * var plugin = document.getElementById('plugin');
+ * plugin.AddEventListener("message",
+ * function(message) { alert(message.data); },
+ * false);
+ * </script>
+ * </body>
+ *
+ * @endcode
+ *
+ * The module instance then invokes PostMessage() as follows:
+ *
+ * @code
+ *
+ *
+ * char hello_world[] = "Hello world!";
+ * PP_Var hello_var = ppb_var_interface->VarFromUtf8(instance,
+ * hello_world,
+ * sizeof(hello_world));
+ * ppb_messaging_interface->PostMessage(instance, hello_var); // Copies var.
+ * ppb_var_interface->Release(hello_var);
+ *
+ * @endcode
+ *
+ * The browser will pop-up an alert saying "Hello world!"
+ */
+ void PostMessage([in] PP_Instance instance, [in] PP_Var message);
+};
+
diff --git a/ppapi/api/ppb_url_loader.idl b/ppapi/api/ppb_url_loader.idl
index 6513881..486c3c0 100644
--- a/ppapi/api/ppb_url_loader.idl
+++ b/ppapi/api/ppb_url_loader.idl
@@ -3,92 +3,178 @@
* found in the LICENSE file.
*/
-/* Defines the URL loader API. */
+/**
+ * This file defines the <strong>PPB_URLLoader</strong> interface for loading
+ * URLs.
+ */
+
+label Chrome {
+ M13 = 0.2,
+ M14 = 1.0
+};
-/* The interface for loading URLs.
+/**
+ * The <strong>PPB_URLLoader</strong> interface contains pointers to functions
+ * for loading URLs. The typical steps for loading a URL are:
*
- * Typical steps for loading an URL:
- * 1- Create an URLLoader object.
- * 2- Create an URLRequestInfo object and set properties on it.
- * 3- Call URLLoader's Open method passing the URLRequestInfo.
- * 4- When Open completes, call GetResponseInfo to examine the response headers.
- * 5- Then call ReadResponseBody to stream the data for the response.
+ * -# Call Create() to create a URLLoader object.
+ * -# Create a <code>URLRequestInfo</code> object and set properties on it.
+ * Refer to <code>PPB_URLRequestInfo</code> for further information.
+ * -# Call Open() with the <code>URLRequestInfo</code> as an argument.
+ * -# When Open() completes, call GetResponseInfo() to examine the response
+ * headers. Refer to <code>PPB_URLResponseInfo</code> for further information.
+ * -# Call ReadResponseBody() to stream the data for the response.
*
- * Alternatively, if PP_URLREQUESTPROPERTY_STREAMTOFILE was set on the
- * URLRequestInfo, then call FinishStreamingToFile at step #5 to wait for the
- * downloaded file to be complete. The downloaded file may be accessed via the
- * GetBody method of the URLResponseInfo returned in step #4.
+ * Alternatively, if <code>PP_URLREQUESTPROPERTY_STREAMTOFILE</code> was set on
+ * the <code>URLRequestInfo</code> in step #2:
+ * - Call FinishStreamingToFile(), after examining the response headers
+ * (step #4), to wait for the downloaded file to be complete.
+ * - Then, access the downloaded file using the GetBodyAsFileRef() function of
+ * the <code>URLResponseInfo</code> returned in step #4.
*/
-interface PPB_URLLoader_0_1 {
- /* Create a new URLLoader object. Returns 0 if the instance is invalid. The
- * URLLoader is associated with a particular instance, so that any UI dialogs
- * that need to be shown to the user can be positioned relative to the window
- * containing the instance. It is also important for security reasons to
- * know the origin of the URL request.
+interface PPB_URLLoader {
+ /**
+ * Create() creates a new <code>URLLoader</code> object. The
+ * <code>URLLoader</code> is associated with a particular instance, so that
+ * any UI dialogs that need to be shown to the user can be positioned
+ * relative to the window containing the instance.
+ *
+ * @param[in] instance A <code>PP_Instance</code> indentifying one instance
+ * of a module.
+ *
+ * @return A <code>PP_Resource</code> corresponding to a URLLoader if
+ * successful, 0 if the instance is invalid.
*/
PP_Resource Create(
[in] PP_Instance instance);
- /* Returns PP_TRUE if the given resource is an URLLoader. Returns PP_FALSE if
- * the resource is invalid or some type other than an URLLoader.
+ /**
+ * IsURLLoader() determines if a resource is an <code>URLLoader</code>.
+ *
+ * @param[in] resource A <code>PP_Resource</code> corresponding to a
+ * <code>URLLoader</code>.
+ *
+ * @return <code>PP_TRUE</code> if the resource is a <code>URLLoader</code>,
+ * <code>PP_FALSE</code> if the resource is invalid or some type other
+ * than <code>URLLoader</code>.
*/
PP_Bool IsURLLoader(
[in] PP_Resource resource);
- /* Begins loading the URLRequestInfo. Completes when response headers are
- * received or when an error occurs. Use the GetResponseInfo method to
- * access the response headers.
+ /**
+ * Open() begins loading the <code>URLRequestInfo</code>. The operation
+ * completes when response headers are received or when an error occurs. Use
+ * GetResponseInfo() to access the response headers.
+ *
+ * @param[in] loader A <code>PP_Resource</code> corresponding to a
+ * <code>URLLoader</code>.
+ * @param[in] resource A <code>PP_Resource</code> corresponding to a
+ * <code>URLRequestInfo</code>.
+ * @param[in] callback A <code>PP_CompletionCallback</code> to run on
+ * asynchronous completion of Open(). This callback will run when response
+ * headers for the url are received or error occured. This callback
+ * will only run if Open() returns <code>PP_OK_COMPLETIONPENDING</code>.
+ *
+ * @return An int32_t containing an error code from <code>pp_errors.h</code>.
*/
int32_t Open(
[in] PP_Resource loader,
[in] PP_Resource request_info,
[in] PP_CompletionCallback callback);
- /* If the current URLResponseInfo object corresponds to a redirect, then call
- * this method to follow the redirect.
+ /**
+ * FollowRedirect()can be invoked to follow a redirect after Open() completed
+ * on receiving redirect headers.
+ *
+ * @param[in] loader A <code>PP_Resource</code> corresponding to a
+ * <code>URLLoader</code>.
+ * @param[in] callback A <code>PP_CompletionCallback</code> to run on
+ * asynchronous completion of FollowRedirect(). This callback will run when
+ * response headers for the redirect url are received or error occured. This
+ * callback will only run if FollowRedirect() returns
+ * <code>PP_OK_COMPLETIONPENDING</code>.
+ *
+ * @return An int32_t containing an error code from <code>pp_errors.h</code>.
*/
int32_t FollowRedirect(
[in] PP_Resource loader,
[in] PP_CompletionCallback callback);
- /* Returns the current upload progress, which is meaningful after Open has
- * been called. Progress only refers to the request body and does not include
- * the headers.
+ /**
+ * GetUploadProgress() returns the current upload progress (which is
+ * meaningful after Open() has been called). Progress only refers to the
+ * request body and does not include the headers.
+ *
+ * This data is only available if the <code>URLRequestInfo</code> passed
+ * to Open() had the <code>PP_URLREQUESTPROPERTY_REPORTUPLOADPROGRESS</code>
+ * property set to PP_TRUE.
*
- * This data is only available if the URLRequestInfo passed to Open() had the
- * PP_URLREQUESTPROPERTY_REPORTUPLOADPROGRESS flag set to PP_TRUE.
+ * @param[in] loader A <code>PP_Resource</code> corresponding to a
+ * <code>URLLoader</code>.
+ * @param[in] bytes_sent The number of bytes sent thus far.
+ * @param[in] total_bytes_to_be_sent The total number of bytes to be sent.
*
- * This method returns PP_FALSE if upload progress is not available.
+ * @return <code>PP_TRUE</code> if the upload progress is available,
+ * <code>PP_FALSE</code> if it is not available.
*/
PP_Bool GetUploadProgress(
[in] PP_Resource loader,
[out] int64_t bytes_sent,
[out] int64_t total_bytes_to_be_sent);
- /* Returns the current download progress, which is meaningful after Open has
- * been called. Progress only refers to the response body and does not
- * include the headers.
+ /**
+ * GetDownloadProgress() returns the current download progress, which is
+ * meaningful after Open() has been called. Progress only refers to the
+ * response body and does not include the headers.
*
- * This data is only available if the URLRequestInfo passed to Open() had the
- * PP_URLREQUESTPROPERTY_REPORTDOWNLOADPROGRESS flag set to PP_TRUE.
+ * This data is only available if the <code>URLRequestInfo</code> passed to
+ * Open() had the <code>PP_URLREQUESTPROPERTY_REPORTDOWNLOADPROGRESS</code>
+ * property set to <code>PP_TRUE</code>.
*
- * The total bytes to be received may be unknown, in which case
- * total_bytes_to_be_received will be set to -1. This method returns PP_FALSE
- * if download progress is not available.
+ * @param[in] loader A <code>PP_Resource</code> corresponding to a
+ * <code>URLLoader</code>.
+ * @param[in] bytes_received The number of bytes received thus far.
+ * @param[in] total_bytes_to_be_received The total number of bytes to be
+ * received. The total bytes to be received may be unknown, in which case
+ * <code>total_bytes_to_be_received</code> will be set to -1.
+ *
+ * @return <code>PP_TRUE</code> if the download progress is available,
+ * <code>PP_FALSE</code> if it is not available.
*/
PP_Bool GetDownloadProgress(
[in] PP_Resource loader,
[out] int64_t bytes_received,
[out] int64_t total_bytes_to_be_received);
- /* Returns the current URLResponseInfo object. */
+ /**
+ * GetResponseInfo() returns the current <code>URLResponseInfo</code> object.
+ *
+ * @param[in] instance A <code>PP_Resource</code> corresponding to a
+ * <code>URLLoader</code>.
+ *
+ * @return A <code>PP_Resource</code> corresponding to the
+ * <code>URLResponseInfo</code> if successful, 0 if the loader is not a valid
+ * resource or if Open() has not been called.
+ */
PP_Resource GetResponseInfo(
[in] PP_Resource loader);
- /* Call this method to read the response body. The size of the buffer must
- * be large enough to hold the specified number of bytes to read. May
- * perform a partial read. Returns the number of bytes read or an error
- * code.
+ /**
+ * ReadResponseBody() is used to read the response body. The size of the
+ * buffer must be large enough to hold the specified number of bytes to read.
+ * This function might perform a partial read.
+ *
+ * @param[in] loader A <code>PP_Resource</code> corresponding to a
+ * <code>URLLoader</code>.
+ * @param[in,out] buffer A pointer to the buffer for the response body.
+ * @param[in] bytes_to_read The number of bytes to read.
+ * @param[in] callback A <code>PP_CompletionCallback</code> to run on
+ * asynchronous completion. The callback will run if the bytes (full or
+ * partial) are read or an error occurs asynchronously. This callback will
+ * run only if this function returns <code>PP_OK_COMPLETIONPENDING</code>.
+ *
+ * @return An int32_t containing the number of bytes read or an error code
+ * from <code>pp_errors.h</code>.
*/
int32_t ReadResponseBody(
[in] PP_Resource loader,
@@ -96,22 +182,41 @@ interface PPB_URLLoader_0_1 {
[in] int32_t bytes_to_read,
[in] PP_CompletionCallback callback);
- /* If PP_URLREQUESTPROPERTY_STREAMTOFILE was set on the URLRequestInfo passed
- * to the Open method, then this method may be used to wait for the response
- * body to be completely downloaded to the file provided by URLResponseInfo's
- * GetBody method.
+ /**
+ * FinishStreamingToFile() is used to wait for the response body to be
+ * completely downloaded to the file provided by the GetBodyAsFileRef()
+ * in the current <code>URLResponseInfo</code>. This function is only used if
+ * <code>PP_URLREQUESTPROPERTY_STREAMTOFILE</code> was set on the
+ * <code>URLRequestInfo</code> passed to Open().
+ *
+ * @param[in] loader A <code>PP_Resource</code> corresponding to a
+ * <code>URLLoader</code>.
+ * @param[in] callback A <code>PP_CompletionCallback</code> to run on
+ * asynchronous completion. This callback will run when body is downloaded
+ * or an error occurs after FinishStreamingToFile() returns
+ * <code>PP_OK_COMPLETIONPENDING</code>.
+ *
+ * @return An int32_t containing the number of bytes read or an error code
+ * from <code>pp_errors.h</code>.
*/
int32_t FinishStreamingToFile(
[in] PP_Resource loader,
[in] PP_CompletionCallback callback);
- /* Cancels any IO that may be pending, and closes the URLLoader object. Any
- * pending callbacks will still run, reporting PP_ERROR_ABORTED if pending IO
- * was interrupted. It is NOT valid to call Open again after a call to this
- * method. Note: If the URLLoader object is destroyed, and it is still open,
- * then it will be implicitly closed, so you are not required to call the
- * Close method.
+ /**
+ * Close is a pointer to a function used to cancel any pending IO and close
+ * the <code>URLLoader</code> object. Any pending callbacks will still run,
+ * reporting <code>PP_ERROR_ABORTED</code> if pending IO was interrupted.
+ * It is NOT valid to call Open() again after a call to this function.
+ *
+ * <strong>Note:</strong> If the <code>URLLoader</code> object is destroyed
+ * while it is still open, then it will be implicitly closed so you are not
+ * required to call Close().
+ *
+ * @param[in] loader A <code>PP_Resource</code> corresponding to a
+ * <code>URLLoader</code>.
*/
void Close(
[in] PP_Resource loader);
};
+
diff --git a/ppapi/api/ppb_url_request_info.idl b/ppapi/api/ppb_url_request_info.idl
index 451caa8..f0d9aad 100644
--- a/ppapi/api/ppb_url_request_info.idl
+++ b/ppapi/api/ppb_url_request_info.idl
@@ -3,85 +3,238 @@
* found in the LICENSE file.
*/
-/* Defines the URL request info API. */
+/**
+ * This file defines the <code>PPB_URLRequestInfo</code> API for creating and
+ * manipulating URL requests.
+ */
+
+label Chrome {
+ M13 = 0.2,
+ M14 = 1.0
+};
-/* Request properties. */
+/**
+ * This enumeration contains properties that can be set on a URL request.
+ */
+[assert_size(4)]
enum PP_URLRequestProperty {
- /* string */
- PP_URLREQUESTPROPERTY_URL = 0,
- /* string */
- PP_URLREQUESTPROPERTY_METHOD = 1,
- /* string, \n-delim */
- PP_URLREQUESTPROPERTY_HEADERS = 2,
- /* PP_Bool (default=PP_FALSE) */
- PP_URLREQUESTPROPERTY_STREAMTOFILE = 3,
- /* PP_Bool (default=PP_TRUE) */
- PP_URLREQUESTPROPERTY_FOLLOWREDIRECTS = 4,
-
- /* Set to true if you want to be able to poll the download progress via the
- * URLLoader.GetDownloadProgress function.
+ /** This corresponds to a string (<code>PP_VARTYPE_STRING</code>). */
+ PP_URLREQUESTPROPERTY_URL,
+
+ /**
+ * This corresponds to a string (<code>PP_VARTYPE_STRING</code>); either
+ * POST or GET. Refer to the
+ * <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec5.html">HTTP
+ * Methods</a> documentation for further information.
*
- * Boolean (default = PP_FALSE).
*/
- PP_URLREQUESTPROPERTY_RECORDDOWNLOADPROGRESS = 5,
+ PP_URLREQUESTPROPERTY_METHOD,
- /* Set to true if you want to be able to pull the upload progress via the
- * URLLoader.GetUploadProgress function.
- *
- * Boolean (default = PP_FALSE).
+ /**
+ * This corresponds to a string (<code>PP_VARTYPE_STRING</code>); \n
+ * delimited. Refer to the
+ * <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html"Header
+ * Field Definitions</a> documentaiton for further information.
+ */
+ PP_URLREQUESTPROPERTY_HEADERS,
+
+ /**
+ * This corresponds to a <code>PP_Bool</code> (<code>PP_VARTYPE_BOOL</code>;
+ * default=<code>PP_FALSE</code>).
+ * Set this value to <code>PP_TRUE</code> if you want to download the data
+ * to a file. Use PPB_URLLoader.FinishStreamingToFile() to complete the
+ * download.
+ */
+ PP_URLREQUESTPROPERTY_STREAMTOFILE,
+
+ /**
+ * This corresponds to a <code>PP_Bool</code> (<code>PP_VARTYPE_BOOL</code>;
+ * default=<code>PP_TRUE</code>).
+ * Set this value to <code>PP_FALSE</code> if you want to use
+ * PPB_URLLoader.FollowRedirects() to follow the redirects only after
+ * examining redirect headers.
+ */
+ PP_URLREQUESTPROPERTY_FOLLOWREDIRECTS,
+
+ /**
+ * This corresponds to a <code>PP_Bool</code> (<code>PP_VARTYPE_BOOL</code>;
+ * default=<code>PP_FALSE</code>).
+ * Set this value to <code>PP_TRUE</code> if you want to be able to poll the
+ * download progress using PPB_URLLoader.GetDownloadProgress().
+ */
+ PP_URLREQUESTPROPERTY_RECORDDOWNLOADPROGRESS,
+
+ /**
+ * This corresponds to a <code>PP_Bool (default=<code>PP_FALSE</code>).
+ * Set this value to <code>PP_TRUE</code> if you want to be able to poll the
+ * upload progress using PPB_URLLoader.GetUplaodProgress().
+ */
+ PP_URLREQUESTPROPERTY_RECORDUPLOADPROGRESS,
+
+ /**
+ * This corresponds to a string (<code>PP_VARTYPE_STRING)</code> or may be
+ * undefined (<code>PP_VARTYPE_UNDEFINED</code>; default).
+ * Set it to a string to set a custom referrer (if empty, the referrer header
+ * will be omitted), or to undefined to use the default referrer. Only loaders
+ * with universal access (only available on trusted implementations) will
+ * accept <code>URLRequestInfo</code> objects that try to set a custom
+ * referrer; if given to a loader without universal access,
+ * <code>PP_ERROR_BADARGUMENT</code> will result.
+ */
+ PP_URLREQUESTPROPERTY_CUSTOMREFERRERURL,
+
+ /**
+ * This corresponds to a <code>PP_Bool</code> (<code>PP_VARTYPE_BOOL</code>;
+ * default=<code>PP_FALSE</code>). Whether cross-origin requests are allowed.
+ * Cross-origin requests are made using the CORS (Cross-Origin Resource
+ * Sharing) algorithm to check whether the request should be allowed. For the
+ * complete CORS algorithm, refer to
+ * the <a href="http://www.w3.org/TR/access-control">Cross-Origin Resource
+ * Sharing</a> documentation.
+ */
+ PP_URLREQUESTPROPERTY_ALLOWCROSSORIGINREQUESTS,
+
+ /**
+ * This corresponds to a <code>PP_Bool</code> (<code>PP_VARTYPE_BOOL</code>;
+ * default=<code>PP_FALSE</code>).
+ * Whether HTTP credentials are sent with cross-origin requests. If false,
+ * no credentials are sent with the request and cookies are ignored in the
+ * response. If the request is not cross-origin, this property is ignored.
*/
- PP_URLREQUESTPROPERTY_RECORDUPLOADPROGRESS = 6
+ PP_URLREQUESTPROPERTY_ALLOWCREDENTIALS,
+
+ /**
+ * This corresponds to a string (<code>PP_VARTYPE_STRING</code>) or may be
+ * undefined (<code>PP_VARTYPE_UNDEFINED</code>; default).
+ * Set it to a string to set a custom content-transfer-encoding header (if
+ * empty, that header will be omitted), or to undefined to use the default
+ * (if any). Only loaders with universal access (only available on trusted
+ * implementations) will accept <code>URLRequestInfo</code> objects that try
+ * to set a custom content transfer encoding; if given to a loader without
+ * universal access, <code>PP_ERROR_BADARGUMENT</code> will result.
+ */
+ PP_URLREQUESTPROPERTY_CUSTOMCONTENTTRANSFERENCODING,
+
+ /**
+ * This corresponds to an integer (<code>PP_VARTYPE_INT32</code>); default
+ * is not defined and is set by the browser, possibly depending on system
+ * capabilities. Set it to an integer to set an upper threshold for the
+ * prefetched buffer of an asynchronous load. When exceeded, the browser will
+ * defer loading until
+ * <code>PP_URLREQUESTPROPERTY_PREFETCHBUFFERLOWERERTHRESHOLD</code> is hit,
+ * at which time it will begin prefetching again. When setting this property,
+ * <code>PP_URLREQUESTPROPERTY_PREFETCHBUFFERLOWERERTHRESHOLD</code> must also
+ * be set. Behavior is undefined if the former is <= the latter.
+ */
+ PP_URLREQUESTPROPERTY_PREFETCHBUFFERUPPERTHRESHOLD,
+
+ /**
+ * This corresponds to an integer (<code>PP_VARTYPE_INT32</code>); default is
+ * not defined and is set by the browser to a value appropriate for the
+ * default <code>PP_URLREQUESTPROPERTY_PREFETCHBUFFERUPPERTHRESHOLD</code>.
+ * Set it to an integer to set a lower threshold for the prefetched buffer
+ * of an asynchronous load. When reached, the browser will resume loading if
+ * If <code>PP_URLREQUESTPROPERTY_PREFETCHBUFFERLOWERERTHRESHOLD</code> had
+ * previously been reached.
+ * When setting this property,
+ * <code>PP_URLREQUESTPROPERTY_PREFETCHBUFFERUPPERTHRESHOLD</code> must also
+ * be set. Behavior is undefined if the former is >= the latter.
+ */
+ PP_URLREQUESTPROPERTY_PREFETCHBUFFERLOWERTHRESHOLD
};
-/* Interface for making URL requests to URL loader. */
-interface PPB_URLRequestInfo_0_2 {
- /* Create a new URLRequestInfo object. Returns 0 if the instance is
- * invalid. */
+/**
+ * The <code>PPB_URLRequestInfo</code> interface is used to create
+ * and handle URL requests. This API is used in conjunction with
+ * <code>PPB_URLLoader</code>. Refer to <code>PPB_URLLoader for further
+ * information.
+ */
+interface PPB_URLRequestInfo {
+ /**
+ * Create() creates a new <code>URLRequestInfo</code> object.
+ *
+ * @param[in] instance A <code>PP_Instance</code> indentifying one instance
+ * of a module.
+ *
+ * @return A <code>PP_Resource</code> identifying the
+ * <code>URLRequestInfo</code> if successful, 0 if the instance is invalid.
+ */
PP_Resource Create(
[in] PP_Instance instance);
- /* Returns PP_TRUE if the given resource is an URLRequestInfo. Returns
- * PP_FALSE if the resource is invalid or some type other than an
- * URLRequestInfo.
+ /**
+ * IsURLRequestInfo() determines if a resource is a
+ * <code>URLRequestInfo</code>.
+ *
+ * @param[in] resource A <code>PP_Resource</code> corresponding to a
+ * <code>URLRequestInfo</code>.
+ *
+ * @return <code>PP_TRUE</code> if the resource is a
+ * <code>URLRequestInfo</code>, <code>PP_FALSE</code> if the resource is
+ * invalid or some type other than <code>URLRequestInfo</code>.
*/
PP_Bool IsURLRequestInfo(
[in] PP_Resource resource);
- /* Sets a request property. Returns PP_FALSE if any of the parameters are
- * invalid, PP_TRUE on success. The value property must be the correct type
- * according to the property being set.
+ /**
+ * SetProperty() sets a request property. The value of the property must be
+ * the correct type according to the property being set.
+ *
+ * @param[in] request A <code>PP_Resource</code> corresponding to a
+ * <code>URLRequestInfo</code>.
+ * @param[in] property A <code>PP_URLRequestProperty</code> identifying the
+ * property to set.
+ * @param[in] value A <code>PP_Var</code> containing the property value.
+ *
+ * @return <code>PP_TRUE</code> if successful, <code>PP_FALSE</code> if any
+ * of the parameters are invalid.
*/
PP_Bool SetProperty(
[in] PP_Resource request,
[in] PP_URLRequestProperty property,
[in] PP_Var value);
- /* Append data to the request body.
+ /**
+ * AppendDataToBody() appends data to the request body. A Content-Length
+ * request header will be automatically generated.
+ *
+ * @param[in] request A <code>PP_Resource</code> corresponding to a
+ * <code>URLRequestInfo</code>.
+ * @param[in] data A pointer to a buffer holding the data.
+ * @param[in] len The length, in bytes, of the data.
+ *
+ * @return <code>PP_TRUE</code> if successful, <code>PP_FALSE</code> if any
+ * of the parameters are invalid.
*
- * A Content-Length request header will be automatically generated.
*
- * Returns PP_FALSE if any of the parameters are invalid, PP_TRUE on success.
*/
PP_Bool AppendDataToBody(
[in] PP_Resource request,
[in] mem_t data,
[in] uint32_t len);
- /* Append a file reference to be uploaded.
- *
- * A sub-range of the file starting from start_offset may be specified. If
- * number_of_bytes is -1, then the sub-range to upload extends to the end of
- * the file.
+ /**
+ * AppendFileToBody() appends a file, to be uploaded, to the request body.
+ * A content-length request header will be automatically generated.
*
- * An optional (non-zero) last modified time stamp may be provided, which
- * will be used to validate that the file was not modified since the given
- * time before it is uploaded. The upload will fail with an error code of
- * PP_Error_FileChanged if the file has been modified since the given time.
- * If expected_last_modified_time is 0, then no validation is performed.
+ * @param[in] request A <code>PP_Resource</code> corresponding to a
+ * <code>URLRequestInfo</code>.
+ * @param[in] file_ref A <code>PP_Resource</code> containing the file
+ * reference.
+ * @param[in] start_offset An optional starting point offset within the
+ * file.
+ * @param[in] number_of_bytes An optional number of bytes of the file to
+ * be included. If <code>number_of_bytes</code> is -1, then the sub-range
+ * to upload extends to the end of the file.
+ * @param[in] expected_last_modified_time An optional (non-zero) last
+ * modified time stamp used to validate that the file was not modified since
+ * the given time before it was uploaded. The upload will fail with an error
+ * code of <code>PP_ERROR_FILECHANGED</code> if the file has been modified
+ * since the given time. If <code>expected_last_modified_time</code> is 0,
+ * then no validation is performed.
*
- * A Content-Length request header will be automatically generated.
- *
- * Returns PP_FALSE if any of the parameters are invalid, PP_TRUE on success.
+ * @return <code>PP_TRUE</code> if successful, <code>PP_FALSE</code> if any
+ * of the parameters are invalid.
*/
PP_Bool AppendFileToBody(
[in] PP_Resource request,
@@ -90,3 +243,4 @@ interface PPB_URLRequestInfo_0_2 {
[in] int64_t number_of_bytes,
[in] PP_Time expected_last_modified_time);
};
+
diff --git a/ppapi/api/ppb_url_response_info.idl b/ppapi/api/ppb_url_response_info.idl
index 46f8d6a..ee22bfc 100644
--- a/ppapi/api/ppb_url_response_info.idl
+++ b/ppapi/api/ppb_url_response_info.idl
@@ -3,47 +3,129 @@
* found in the LICENSE file.
*/
-/* Defines the URL response info API. */
-
-/* Response properties. */
-enum PP_URLResponseProperty{
- /* string */
- PP_URLRESPONSEPROPERTY_URL = 0,
- /* string */
- PP_URLRESPONSEPROPERTY_REDIRECTURL = 1,
- /* string */
- PP_URLRESPONSEPROPERTY_REDIRECTMETHOD = 2,
- /* int32 */
- PP_URLRESPONSEPROPERTY_STATUSCODE = 3,
- /* string */
- PP_URLRESPONSEPROPERTY_STATUSLINE = 4,
- /* string, \n-delim */
- PP_URLRESPONSEPROPERTY_HEADERS = 5
+/**
+ * This file defines the <code>PPB_URLResponseInfo</code> API for examining URL
+ * responses.
+ */
+
+label Chrome {
+ M13 = 0.1,
+ M14 = 1.0
};
-/* Interface for receiving URL responses from the URL loader. */
-interface PPB_URLResponseInfo_0_1 {
- /* Returns PP_TRUE if the given resource is an URLResponseInfo. Returns
- * PP_FALSE if the resource is invalid or some type other than an
- * URLResponseInfo.
+/**
+ * This enumeration contains properties set on a URL response.
+ */
+[assert_size(4)]
+enum PP_URLResponseProperty {
+ /**
+ * This corresponds to a string (PP_VARTYPE_STRING); an absolute URL formed by
+ * resolving the relative request URL with the absolute document URL. Refer
+ * to the
+ * <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec5.html#sec5.1.2">
+ * HTTP Request URI</a> and
+ * <a href="http://www.w3.org/TR/html4/struct/links.html#h-12.4.1">
+ * HTML Resolving Relative URIs</a> documentation for further information.
+ */
+ PP_URLRESPONSEPROPERTY_URL,
+
+ /**
+ * This corresponds to a string (PP_VARTYPE_STRING); the absolute URL returned
+ * in the response header's 'Location' field if this is a redirect response,
+ * an empty string otherwise. Refer to the
+ * <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3">
+ * HTTP Status Codes - Redirection</a> documentation for further information.
+ */
+ PP_URLRESPONSEPROPERTY_REDIRECTURL,
+
+ /**
+ * This corresponds to a string (PP_VARTYPE_STRING); the HTTP method to be
+ * used in a new request if this is a redirect response, an empty string
+ * otherwise. Refer to the
+ * <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3">
+ * HTTP Status Codes - Redirection</a> documentation for further information.
+ */
+ PP_URLRESPONSEPROPERTY_REDIRECTMETHOD,
+
+ /**
+ * This corresponds to an int32 (PP_VARETYPE_INT32); the status code from the
+ * response, e.g., 200 if the request was successful. Refer to the
+ * <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec6.html#sec6.1.1">
+ * HTTP Status Code and Reason Phrase</a> documentation for further
+ * information.
+ */
+ PP_URLRESPONSEPROPERTY_STATUSCODE,
+
+ /**
+ * This corresponds to a string (PP_VARTYPE_STRING); the status line
+ * from the response. Refer to the
+ * <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec6.html#sec6.1">
+ * HTTP Response Status Line</a> documentation for further information.
+ */
+ PP_URLRESPONSEPROPERTY_STATUSLINE,
+
+ /**
+ * This corresponds to a string(PP_VARTYPE_STRING), a \n-delimited list of
+ * header field/value pairs of the form "field: value", returned by the
+ * server. Refer to the
+ * <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14">
+ * HTTP Header Field Definitions</a> documentation for further information.
+ */
+ PP_URLRESPONSEPROPERTY_HEADERS
+};
+
+
+/**
+ * The PPB_URLResponseInfo interface contains APIs for
+ * examining URL responses. Refer to <code>PPB_URLLoader</code> for further
+ * information.
+ */
+interface PPB_URLResponseInfo {
+ /**
+ * IsURLResponseInfo() determines if a response is a
+ * <code>URLResponseInfo</code>.
+ *
+ * @param[in] resource A <code>PP_Resource</code> corresponding to a
+ * <code>URLResponseInfo</code>.
+ *
+ * @return <code>PP_TRUE</code> if the resource is a
+ * <code>URLResponseInfo</code>, <code>PP_FALSE</code> if the resource is
+ * invalid or some type other than <code>URLResponseInfo</code>.
*/
PP_Bool IsURLResponseInfo(
[in] PP_Resource resource);
- /* Gets a response property. Return PP_VarType_Void if an input parameter is
- * invalid.
+ /**
+ * GetProperty() gets a response property.
+ *
+ * @param[in] request A <code>PP_Resource</code> corresponding to a
+ * <code>URLResponseInfo</code>.
+ * @param[in] property A <code>PP_URLResponseProperty</code> identifying
+ * the type of property in the response.
+ *
+ * @return A <code>PP_Var</code> containing the response property value if
+ * successful, <code>PP_VARTYPE_VOID</code> if an input parameter is invalid.
*/
PP_Var GetProperty(
[in] PP_Resource response,
[in] PP_URLResponseProperty property);
- /* Returns a FileRef pointing to the file containing the response body. This
- * is only valid if PP_URLREQUESTPROPERTY_STREAMTOFILE was set on the
- * URLRequestInfo used to produce this response. This file remains valid
- * until the URLLoader associated with this URLResponseInfo is closed or
- * destroyed. Returns 0 if PP_URLREQUESTPROPERTY_STREAMTOFILE was not
- * requested or if the URLLoader has not been opened yet.
+ /**
+ * GetBodyAsFileRef() returns a FileRef pointing to the file containing the
+ * response body. This is only valid if
+ * <code>PP_URLREQUESTPROPERTY_STREAMTOFILE</code> was set on the
+ * <code>URLRequestInfo</code> used to produce this response. This file
+ * remains valid until the <code>URLLoader</code> associated with this
+ * <code>URLResponseInfo is closed or destroyed.
+ *
+ * @param[in] request A <code>PP_Resource</code> corresponding to a
+ * <code>URLResponseInfo</code>.
+ *
+ * @return A <code>PP_Resource</code> corresponding to a FileRef if
+ * successful, 0 if <code>PP_URLREQUESTPROPERTY_STREAMTOFILE</code> was not
+ * requested or if the <code>URLLoader</code> has not been opened yet.
*/
PP_Resource GetBodyAsFileRef(
[in] PP_Resource response);
};
+
diff --git a/ppapi/api/ppb_var.idl b/ppapi/api/ppb_var.idl
index 828c608..8319991 100644
--- a/ppapi/api/ppb_var.idl
+++ b/ppapi/api/ppb_var.idl
@@ -3,58 +3,90 @@
* found in the LICENSE file.
*/
-/* This file defines the PPB_Var API. */
+/**
+ * This file defines the <code>PPB_Var</code> struct.
+ */
+
+label Chrome {
+ M13 = 0.5,
+ M14 = 1.0
+};
-/* Defines the PPB_Var struct. */
-interface PPB_Var_0_5 {
- /* Adds a reference to the given var. If this is not a refcounted object,
- * this function will do nothing so you can always call it no matter what the
- * type.
+/**
+ * PPB_Var API
+ */
+interface PPB_Var {
+ /**
+ * AddRef() adds a reference to the given var. If this is not a refcounted
+ * object, this function will do nothing so you can always call it no matter
+ * what the type.
+ *
+ * @param[in] var A <code>PP_Var</code> that will have a reference added.
*/
void AddRef(
[in] PP_Var var);
- /* Removes a reference to given var, deleting it if the internal refcount
- * becomes 0. If the given var is not a refcounted object, this function will
- * do nothing so you can always call it no matter what the type.
+ /**
+ * Release() removes a reference to given var, deleting it if the internal
+ * reference count becomes 0. If the given var is not a refcounted object,
+ * this function will do nothing so you can always call it no matter what
+ * the type.
+ *
+ * @param[in] var A <code>PP_Var</code> that will have a reference removed.
*/
void Release(
[in] PP_Var var);
- /* Creates a string var from a string. The string must be encoded in valid
- * UTF-8 and is NOT NULL-terminated, the length must be specified in |len|.
- * It is an error if the string is not valid UTF-8.
+ /**
+ * VarFromUtf8() creates a string var from a string. The string must be
+ * encoded in valid UTF-8 and is NOT NULL-terminated, the length must be
+ * specified in <code>len</code>. It is an error if the string is not
+ * valid UTF-8.
*
- * If the length is 0, the |data| pointer will not be dereferenced and may
- * be NULL. Note, however, that if you do this, the "NULL-ness" will not be
- * preserved, as VarToUtf8 will never return NULL on success, even for empty
- * strings.
+ * If the length is 0, the <code>*data</code> pointer will not be dereferenced
+ * and may be <code>NULL</code>. Note, however if length is 0, the
+ * "NULL-ness" will not be preserved, as <code>VarToUtf8</code> will never
+ * return <code>NULL</code> on success, even for empty strings.
*
* The resulting object will be a refcounted string object. It will be
- * AddRef()ed for the caller. When the caller is done with it, it should be
- * Release()d.
+ * AddRef'ed for the caller. When the caller is done with it, it should be
+ * Released.
*
* On error (basically out of memory to allocate the string, or input that
* is not valid UTF-8), this function will return a Null var.
+ *
+ * @param[in] module A PP_Module uniquely identifying the module or .nexe.
+ * @param[in] data A string
+ * @param[in] len The length of the string.
+ *
+ * @return A <code>PP_Var</code> structure containing a reference counted
+ * string object.
*/
PP_Var VarFromUtf8(
[in] PP_Module module,
[in] str_t data,
[in] uint32_t len);
- /* Converts a string-type var to a char* encoded in UTF-8. This string is NOT
- * NULL-terminated. The length will be placed in |*len|. If the string is
- * valid but empty the return value will be non-NULL, but |*len| will still
- * be 0.
+ /**
+ * VarToUtf8() converts a string-type var to a char* encoded in UTF-8. This
+ * string is NOT NULL-terminated. The length will be placed in
+ * <code>*len</code>. If the string is valid but empty the return value will
+ * be non-NULL, but <code>*len</code> will still be 0.
*
- * If the var is not a string, this function will return NULL and |*len| will
- * be 0.
+ * If the var is not a string, this function will return NULL and
+ * <code>*len</code> will be 0.
*
* The returned buffer will be valid as long as the underlying var is alive.
- * If the plugin frees its reference, the string will be freed and the pointer
- * will be to random memory.
+ * If the instance frees its reference, the string will be freed and the
+ * pointer will be to arbitrary memory.
+ *
+ * @param[in] var A PP_Var struct containing a string-type var.
+ * @param[in,out] len A pointer to the length of the string-type var.
+ *
+ * @return A char* encoded in UTF-8.
*/
str_t VarToUtf8(
[in] PP_Var var,
[out] uint32_t len);
};
+
diff --git a/ppapi/api/ppp.idl b/ppapi/api/ppp.idl
new file mode 100644
index 0000000..8be3ebf
--- /dev/null
+++ b/ppapi/api/ppp.idl
@@ -0,0 +1,109 @@
+/* Copyright (c) 2011 The Chromium Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/**
+ * This file defines three functions that your module must
+ * implement to interact with the browser.
+ */
+
+#inline c
+
+#include "ppapi/c/pp_module.h"
+#include "ppapi/c/pp_stdint.h"
+#include "ppapi/c/ppb.h"
+
+#if __GNUC__ >= 4
+#define PP_EXPORT __attribute__ ((visibility("default")))
+#elif defined(_MSC_VER)
+#define PP_EXPORT __declspec(dllexport)
+#endif
+
+// {PENDING: undefine PP_EXPORT?}
+
+/* We don't want name mangling for these external functions. We only need
+ * 'extern "C"' if we're compiling with a C++ compiler.
+ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @addtogroup Functions
+ * @{
+ */
+
+/**
+ * PPP_InitializeModule() is the entry point for a module and is called by the
+ * browser when your module loads. Your code must implement this function.
+ *
+ * Failure indicates to the browser that this module can not be used. In this
+ * case, the module will be unloaded and ShutdownModule will NOT be called.
+ *
+ * @param[in] module A handle to your module. Generally you should store this
+ * value since it will be required for other API calls.
+ * @param[in] get_browser_interface A pointer to the function that you can
+ * use to query for browser interfaces. Generally you should store this value
+ * for future use.
+ *
+ * @return <code>PP_OK</code> on success. Any other value on failure.
+*/
+PP_EXPORT int32_t PPP_InitializeModule(PP_Module module,
+ PPB_GetInterface get_browser_interface);
+/**
+ * @}
+ */
+
+/**
+ * @addtogroup Functions
+ * @{
+ */
+
+/**
+ * PPP_ShutdownModule() is <strong>sometimes</strong> called before the module
+ * is unloaded. It is not recommended that you implement this function.
+ *
+ * There is no practical use of this function for third party modules. Its
+ * existence is because of some internal use cases inside Chrome.
+ *
+ * Since your module runs in a separate process, there's no need to free
+ * allocated memory. There is also no need to free any resources since all of
+ * resources associated with an instance will be force-freed when that instance
+ * is deleted. Moreover, this function will not be called when Chrome does
+ * "fast shutdown" of a web page.
+ */
+PP_EXPORT void PPP_ShutdownModule();
+/**
+ * @}
+ */
+
+/**
+ * @addtogroup Functions
+ * @{
+ */
+
+/**
+ * PPP_GetInterface() is called by the browser to query the module for
+ * interfaces it supports.
+ *
+ * Your module must implement the <code>PPP_Instance</code> interface or it
+ * will be unloaded. Other interfaces are optional.
+ *
+ * @param[in] interface_name A pointer to a "PPP" (plugin) interface name.
+ * Interface names are null-terminated ASCII strings.
+ *
+ * @return A pointer for the interface or <code>NULL</code> if the interface is
+ * not supported.
+ */
+PP_EXPORT const void* PPP_GetInterface(const char* interface_name);
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endinl
+
diff --git a/ppapi/api/ppp_input_event.idl b/ppapi/api/ppp_input_event.idl
new file mode 100644
index 0000000..cfaf398
--- /dev/null
+++ b/ppapi/api/ppp_input_event.idl
@@ -0,0 +1,40 @@
+/* Copyright (c) 2011 The Chromium Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/**
+ * This file defines the API for receiving input events form the browser.
+ */
+
+label Chrome {
+ M14 = 0.1
+};
+
+[version=0.1, macro="PPP_INPUT_EVENT_INTERFACE"]
+interface PPP_InputEvent {
+ /**
+ * 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.
+ *
+ * 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.
+ *
+ * @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.
+ */
+ PP_Bool HandleInputEvent([in] PP_Instance instance,
+ [in] PP_Resource input_event);
+};
+
diff --git a/ppapi/api/ppp_instance.idl b/ppapi/api/ppp_instance.idl
index d3ce47e..da8f7a9 100644
--- a/ppapi/api/ppp_instance.idl
+++ b/ppapi/api/ppp_instance.idl
@@ -3,30 +3,61 @@
* found in the LICENSE file.
*/
-/* This file defines the PPP_Instance structure - a series of points to methods
- * that you must implement in your model.
+/**
+ * This file defines the <code>PPP_Instance</code> structure - a series of
+ * pointers to methods that you must implement in your module.
*/
-/* The PPP_Instance interface contains series of functions that you must
- * implement in your module. These functions can be trivial (simply return the
- * default return value) unless you want your module to handle events such as
- * change of focus or input events (keyboard/mouse) events.
+label Chrome {
+ M14 = 0.5
+};
+
+/**
+ * The <code>PPP_Instance</code> interface contains pointers to a series of
+ * functions that you must implement in your module. These functions can be
+ * trivial (simply return the default return value) unless you want your module
+ * to handle events such as change of focus or input events (keyboard/mouse)
+ * events.
*/
-interface PPP_Instance_0_4 {
- /* Function that is called when a new module is instantiated on the web
- * page. The identifier of the new instance will be passed in as the first
- * argument (this value is generated by the browser and is an opaque
- * handle). This is called for each instantiation of the NaCl module, which
- * is each time the <embed> tag for this module is encountered.
+interface PPP_Instance {
+ /**
+ * DidCreate() is a creation handler that is called when a new instance is
+ * created. This function is called for each instantiation on the page,
+ * corresponding to one \<embed\> tag on the page.
+ *
+ * Generally you would handle this call by initializing the information
+ * your module associates with an instance and creating a mapping from the
+ * given <code>PP_Instance</code> handle to this data. The
+ * <code>PP_Instance</code> handle will be used in subsequent calls to
+ * identify which instance the call pertains to.
+ *
+ * It's possible for more than one instance to be created in a single module.
+ * This means that you may get more than one <code>OnCreate</code> without an
+ * <code>OnDestroy</code> in between, and should be prepared to maintain
+ * multiple states associated with each instance.
+ *
+ * If this function reports a failure (by returning <code>PP_FALSE</code>),
+ * the instance will be deleted.
*
- * It's possible for more than one module instance to be created
- * (i.e. you may get more than one OnCreate without an OnDestroy
- * in between).
+ * @param[in] instance A new <code>PP_Instance</code> indentifying one
+ * instance of a module. This is an opaque handle.
*
- * If this function reports a failure (by returning @a PP_FALSE), the NaCl
- * module will be deleted and DidDestroy will be called.
+ * @param[in] argc The number of arguments contained in <code>argn</code>
+ * and <code>argv</code>.
*
- * Returns PP_TRUE on success.
+ * @param[in] argn An array of argument names. These argument names are
+ * supplied in the \<embed\> tag, for example:
+ * <code>\<embed id="nacl_module" dimensions="2"\></code> will produce two
+ * argument names: "id" and "dimensions."
+ *
+ * @param[in] argv An array of argument values. These are the values of the
+ * arguments listed in the \<embed\> tag, for example
+ * <code>\<embed id="nacl_module" dimensions="2"\></code> will produce two
+ * argument values: "nacl_module" and "2". The indices of these values match
+ * the indices of the corresponding names in <code>argn</code>.
+ *
+ * @return <code>PP_TRUE</code> on success or <code>PP_FALSE</code> on
+ * failure.
*/
PP_Bool DidCreate(
/* A PP_Instance indentifying one instance of a module. */
@@ -38,26 +69,77 @@ interface PPP_Instance_0_4 {
* <embed id="nacl_module" dimensions="2"> will produce two argument
* names: "id" and "dimensions."
*/
- [in, size_is(argc)] str_t[] argn,
+ [in, size_as=argc] str_t[] argn,
/* An array of argument values. These are the values of the
* arguments listed in the <embed> tag, for example
* <embed id="nacl_module" dimensions="2"> will produce two argument
* values: "nacl_module" and "2." The indices of these values match the
* indices of the corresponding names in argn.
*/
- [in, size_is(argc)] str_t[] argv);
+ [in, size_as=argc] str_t[] argv);
- /* Function that is called when the module instance is destroyed. This
- * function will always be called, even if DidCreate returned failure.
- * The function should deallocate any data associated with the instance.
+ /**
+ * DidDestroy() is an instance destruction handler. This function is called
+ * in many cases (see below) when a module instance is destroyed. It will be
+ * called even if DidCreate() returned failure.
+ *
+ * Generally you will handle this call by deallocating the tracking
+ * information and the <code>PP_Instance</code> mapping you created in the
+ * DidCreate() call. You can also free resources associated with this
+ * instance but this isn't required; all resources associated with the deleted
+ * instance will be automatically freed when this function returns.
+ *
+ * The instance identifier will still be valid during this call so the module
+ * can perform cleanup-related tasks. Once this function returns, the
+ * <code>PP_Instance</code> handle will be invalid. This means that you can't
+ * do any asynchronous operations like network requests or file writes from
+ * this function since they will be immediately canceled.
+ *
+ * <strong>Note:</strong> This function may be skipped in certain
+ * circumstances when Chrome does "fast shutdown". Fast shutdown will happen
+ * in some cases when all module instances are being deleted, and no cleanup
+ * functions will be called. The module will just be unloaded and the process
+ * terminated.
+ *
+ * @param[in] instance A <code>PP_Instance</code> indentifying one instance
+ * of a module.
*/
void DidDestroy(
/* A PP_Instance indentifying one instance of a module. */
[in] PP_Instance instance);
- /* Function that is called when the position, the size, or the clip
- * rectangle of the element in the browser that corresponds to this instance
- * has changed.
+ /**
+ * DidChangeView() is called when the position, the size, of the clip
+ * rectangle of the element in the browser that corresponds to this
+ * instance has changed.
+ *
+ * A typical implementation will check the size of the <code>position</code>
+ * argument and reallocate the graphics context when a different size is
+ * received. Note that this function will be called for scroll events where
+ * the size doesn't change, so you should always check that the size is
+ * actually different before doing any reallocations.
+ *
+ * @param[in] instance A <code>PP_Instance</code> indentifying the instance
+ * that has changed.
+ *
+ * @param[in] position The location on the page of the instance. This is
+ * relative to the top left corner of the viewport, which changes as the
+ * page is scrolled. Generally the size of this value will be used to create
+ * a graphics device, and the position is ignored (most things are relative
+ * to the instance so the absolute position isn't useful in most cases).
+ *
+ * @param[in] clip The visible region of the instance. This is relative to
+ * the top left of the module's coordinate system (not the page). If the
+ * module is invisible, <code>clip</code> will be (0, 0, 0, 0).
+ *
+ * It's recommended to check for invisible instances and to stop
+ * generating graphics updates in this case to save system resources. It's
+ * not usually worthwhile, however, to generate partial updates according to
+ * the clip when the instance is partially visible. Instead, update the entire
+ * region. The time saved doing partial paints is usually not significant and
+ * it can create artifacts when scrolling (this notification is sent
+ * asynchronously from scolling so there can be flashes of old content in the
+ * exposed regions).
*/
void DidChangeView(
/* A PP_Instance indentifying the instance whose view changed. */
@@ -73,16 +155,22 @@ interface PPP_Instance_0_4 {
*/
[in] PP_Rect clip);
- /* Function to handle when your instance has gained or lost focus. Having
- * focus means that keyboard events will be sent to the module. An
- * instance's default condition is that it will not have focus.
- *
- * Note: clicks on modules will give focus only if you handle the
- * click event. Return true from HandleInputEvent to signal that the click
- * event was handled. Otherwise the browser will bubble the event and give
- * focus to the element on the page that actually did end up consuming it.
- * If you're not getting focus, check to make sure you're returning true
- * from the mouse click in HandleInputEvent.
+ /**
+ * DidChangeFocus() is called when an instance has gained or lost focus.
+ * Having focus means that keyboard events will be sent to the instance.
+ * An instance's default condition is that it will not have focus.
+ *
+ * <strong>Note:</strong>Clicks on instances will give focus only if you
+ * handle the click event. Return <code>true</code> from HandleInputEvent to
+ * signal that the click event was handled. Otherwise the browser will bubble
+ * the event and give focus to the element on the page that actually did end
+ * up consuming it. If you're not getting focus, check to make sure you're
+ * returning true from the mouse click in <code>HandleInputEvent</code>.
+ *
+ * @param[in] instance A <code>PP_Instance</code> indentifying the instance
+ * receiving the input event.
+ *
+ * @param[in] has_focus Indicates the new focused state of the instance.
*/
void DidChangeFocus(
/* A PP_Instance indentifying one instance of a module. */
@@ -90,22 +178,30 @@ interface PPP_Instance_0_4 {
/* Indicates whether this NaCl module gained or lost event focus. */
[in] PP_Bool has_focus);
- /* Function to handle input events.
- *
- * Returns true if the event was handled or false if it was not. If the
- * event was handled, it will not be forwarded to the web page or browser.
- * If it was not handled, it will bubble according to the normal rules. So
- * it is important that a module respond accurately with whether event
- * propogation should continue.
- *
- * Event propogation also controls focus. If you handle an event like a
- * mouse event, typically your module will be given focus. Returning false
- * means that the click will be given to a lower part of the page and your
- * module will not receive focus. This allows a module to be partially
- * transparent, where clicks on the transparent areas will behave like
- * clicks to the underlying page.
- *
- * Returns PP_TRUE if event was handled, PP_FALSE otherwise.
+ /**
+ * HandleInputEvent() handles input events, such as keyboard events. This
+ * function returns <code>PP_TRUE</code> if the event was handled or
+ * <code>PP_FALSE</code> if it was not.
+ *
+ * If the event was handled, it will not be forwarded to the web page or
+ * browser. If it was not handled, it will bubble according to the normal
+ * rules. So it is important that a module 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 means
+ * that the click will be given to a lower part of the page and your module
+ * 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.
+ *
+ * @param[in] instance A <code>PP_Instance</code> indentifying one instance
+ * of a module.
+ *
+ * @param[in] event The input event.
+ *
+ * @return <code>PP_TRUE</code> if <code>event</code> was handled,
+ * <code>PP_FALSE</code> otherwise.
*/
PP_Bool HandleInputEvent(
/* A PP_Instance indentifying one instance of a module. */
@@ -113,23 +209,32 @@ interface PPP_Instance_0_4 {
/* The event. */
[in] PP_InputEvent event);
- /* This value represents a pointer to a function that is called after
- * initialize for a full-frame plugin that was instantiated based on the MIME
- * type of a DOMWindow navigation. This only applies to modules that are
- * registered to handle certain MIME types (not current Native Client
- * modules).
- *
- * The given url_loader corresponds to a PPB_URLLoader instance that is
- * already opened. Its response headers may be queried using
- * PPB_URLLoader::GetResponseInfo. The url loader is not addrefed on behalf
- * of the module, if you're going to keep a reference to it, you need to
- * addref it yourself.
- *
- * This method returns PP_FALSE if the module cannot handle the data. In
- * response to this method, the module should call ReadResponseBody to read
- * the incoming data.
- *
- * Returns PP_TRUE if the data was handled, PP_FALSE otherwise.
+ /**
+ * HandleDocumentLoad() is called after initialize for a full-frame
+ * module that was instantiated based on the MIME type of a DOMWindow
+ * navigation. This situation only applies to modules that are pre-registered
+ * to handle certain MIME types. If you haven't specifically registered to
+ * handle a MIME type or aren't positive this applies to you, your
+ * implementation of this function can just return <code>PP_FALSE</code>.
+ *
+ * The given <code>url_loader</code> corresponds to a
+ * <code>PPB_URLLoader</code> instance that is already opened. Its response
+ * headers may be queried using <code>PPB_URLLoader::GetResponseInfo</code>.
+ * The reference count for the URL loader is not incremented automatically on
+ * behalf of the module. You need to increment the reference count yourself
+ * if you are going to keep a reference to it.
+ *
+ * This method returns <code>PP_FALSE</code> if the module cannot handle the
+ * data. In response to this method, the module should call
+ * ReadResponseBody() to read the incoming data.
+ *
+ * @param[in] instance A <code>PP_Instance</code> indentifying the instance
+ * that should do the load.
+ *
+ * @param[in] url_loader An open <code>PPB_URLLoader</code> instance.
+ *
+ * @return <code>PP_TRUE</code> if the data was handled,
+ * <code>PP_FALSE</code> otherwise.
*/
PP_Bool HandleDocumentLoad(
/* A PP_Instance indentifying one instance of a module. */
@@ -138,3 +243,10 @@ interface PPP_Instance_0_4 {
[in] PP_Resource url_loader);
};
+
+#inline c
+
+typedef struct PPP_Instance PPP_Instance_0_5;
+
+#endinl
+
diff --git a/ppapi/api/ppp_messaging.idl b/ppapi/api/ppp_messaging.idl
new file mode 100644
index 0000000..09643e9
--- /dev/null
+++ b/ppapi/api/ppp_messaging.idl
@@ -0,0 +1,59 @@
+/* Copyright (c) 2011 The Chromium Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/**
+ * This file defines the PPP_Messaging interface containing pointers to
+ * functions that you must implement to handle postMessage messages
+ * on the associated DOM element.
+ *
+ */
+
+label Chrome {
+ M13 = 0.1,
+ M14 = 1.0
+};
+
+/**
+ * The <code>PPP_Messaging</code> interface contains pointers to functions
+ * that you must implement to handle postMessage events on the associated
+ * DOM element.
+ */
+[version=0.1]
+interface PPP_Messaging {
+ /**
+ * HandleMessage() is a function that the browser calls when PostMessage()
+ * is invoked on the DOM element for the module instance in JavaScript. Note
+ * that PostMessage() in the JavaScript interface is asynchronous, meaning
+ * JavaScript execution will not be blocked while HandleMessage() is
+ * processing the message.
+ *
+ * @param[in] instance A <code>PP_Instance</code> indentifying one instance
+ * of a module.
+ * @param[in] message A <code>PP_Var</code> containing the data to be sent
+ * to JavaScript. Message can have an int32_t, double, bool, or string value
+ * (objects are not supported).
+ *
+ * <strong>Example:</strong>
+ *
+ * The following JavaScript code invokes <code>HandleMessage</code>, passing
+ * the module instance on which it was invoked, with <code>message</code>
+ * being a string <code>PP_Var</code> containing "Hello world!"
+ *
+ * @code
+ *
+ * <body>
+ * <object id="plugin"
+ * type="application/x-ppapi-postMessage-example"/>
+ * <script type="text/javascript">
+ * document.getElementById('plugin').postMessage("Hello world!");
+ * </script>
+ * </body>
+ *
+ * @endcode
+ *
+ */
+ void HandleMessage([in] PP_Instance instance, [in] PP_Var message);
+};
+
diff --git a/ppapi/api/trusted/ppb_audio_trusted.idl b/ppapi/api/trusted/ppb_audio_trusted.idl
index 775ef15..6cd27f6 100644
--- a/ppapi/api/trusted/ppb_audio_trusted.idl
+++ b/ppapi/api/trusted/ppb_audio_trusted.idl
@@ -3,19 +3,28 @@
* found in the LICENSE file.
*/
-/* This file defines the trusted audio interface. */
+/**
+ * This file defines the trusted audio interface.
+ */
+
+label Chrome {
+ M14 = 0.6
+};
-/* This interface is to be used by proxy implementations. All
+/**
+ * This interface is to be used by proxy implementations. All
* functions should be called from the main thread only. The
* resource returned is an Audio resource; most of the PPB_Audio
* interface is also usable on this resource.
*/
-[mainthread] interface PPB_AudioTrusted_0_5 {
- /* Returns an audio resource. */
+[mainthread, macro="PPB_AUDIO_TRUSTED_INTERFACE"]
+interface PPB_AudioTrusted {
+ /** Returns an audio resource. */
PP_Resource CreateTrusted(
[in] PP_Instance instance);
- /* Opens a paused audio interface, used by trusted side of proxy.
+ /**
+ * Opens a paused audio interface, used by trusted side of proxy.
* Returns PP_ERROR_WOULD_BLOCK on success, and invokes
* the |create_callback| asynchronously to complete.
* As this function should always be invoked from the main thread,
@@ -26,14 +35,16 @@
[in] PP_Resource config,
[in] PP_CompletionCallback create_callback);
- /* Get the sync socket. Use once Open has completed.
+ /**
+ * Get the sync socket. Use once Open has completed.
* Returns PP_OK on success.
*/
int32_t GetSyncSocket(
[in] PP_Resource audio,
[out] handle_t sync_socket);
- /* Get the shared memory interface. Use once Open has completed.
+ /**
+ * Get the shared memory interface. Use once Open has completed.
* Returns PP_OK on success.
*/
int32_t GetSharedMemory(
@@ -41,3 +52,4 @@
[out] handle_t shm_handle,
[out] uint32_t shm_size);
};
+
diff --git a/ppapi/api/trusted/ppb_broker_trusted.idl b/ppapi/api/trusted/ppb_broker_trusted.idl
new file mode 100644
index 0000000..4771cbb
--- /dev/null
+++ b/ppapi/api/trusted/ppb_broker_trusted.idl
@@ -0,0 +1,65 @@
+/* Copyright (c) 2011 The Chromium Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/**
+ * This file defines the PPB_BrokerTrusted interface, which provides
+ * access to a trusted broker with greater privileges than the plugin.
+ */
+
+label Chrome {
+ M14 = 0.2
+};
+
+/**
+ * The PPB_BrokerTrusted interface provides access to a trusted broker
+ * with greater privileges than the plugin. The interface only supports
+ * out-of-process plugins and is to be used by proxy implementations. All
+ * functions should be called from the main thread only.
+ *
+ * A PPB_BrokerTrusted resource represents a connection to the broker. Its
+ * lifetime controls the lifetime of the broker, regardless of whether the
+ * handle is closed. The handle should be closed before the resource is
+ * released.
+ */
+[macro="PPB_BROKER_TRUSTED_INTERFACE"]
+interface PPB_BrokerTrusted {
+ /**
+ * Returns a trusted broker resource.
+ */
+ PP_Resource CreateTrusted([in] PP_Instance instance);
+
+ /**
+ * Returns true if the resource is a trusted broker.
+ */
+ PP_Bool IsBrokerTrusted([in] PP_Resource resource);
+
+ /**
+ * Connects to the trusted broker. It may have already
+ * been launched by another instance.
+ * The plugin takes ownership of the handle once the callback has been called
+ * with a result of PP_OK. The plugin should immediately call GetHandle and
+ * begin managing it. If the result is not PP_OK, the browser still owns the
+ * handle.
+ *
+ * Returns PP_ERROR_WOULD_BLOCK on success, and invokes
+ * the |connect_callback| asynchronously to complete.
+ * As this function should always be invoked from the main thread,
+ * do not use the blocking variant of PP_CompletionCallback.
+ * Returns PP_ERROR_FAILED if called from an in-process plugin.
+ */
+ int32_t Connect([in] PP_Resource broker,
+ [in] PP_CompletionCallback connect_callback);
+
+ /**
+ * Gets the handle to the pipe. Use once Connect has completed. Each instance
+ * of this interface has its own pipe.
+ *
+ * Returns PP_OK on success, and places the result into the given output
+ * parameter. The handle is only set when returning PP_OK. Calling this
+ * before connect has completed will return PP_ERROR_FAILED.
+ */
+ int32_t GetHandle([in] PP_Resource broker, [out] int32_t handle);
+};
+
diff --git a/ppapi/api/trusted/ppb_buffer_trusted.idl b/ppapi/api/trusted/ppb_buffer_trusted.idl
new file mode 100644
index 0000000..1606928
--- /dev/null
+++ b/ppapi/api/trusted/ppb_buffer_trusted.idl
@@ -0,0 +1,25 @@
+/* Copyright (c) 2011 The Chromium Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/**
+ * This file defines the trusted buffer interface.
+ */
+
+label Chrome {
+ M14 = 0.1
+};
+
+[macro="PPB_BUFFER_TRUSTED_INTERFACE"]
+interface PPB_BufferTrusted {
+ /**
+ * Returns the internal shared memory pointer associated with the given
+ * Buffer resource. Used for proxying. Returns PP_OK on success, or
+ * PP_ERROR_* on failure. On success, the size in bytes of the shared
+ * memory region will be placed into |*byte_count|, and the handle for
+ * the shared memory in |*handle|.
+ */
+ int32_t GetSharedMemory([in] PP_Resource buffer, [out] handle_t handle);
+};
+
diff --git a/ppapi/api/trusted/ppb_file_io_trusted.idl b/ppapi/api/trusted/ppb_file_io_trusted.idl
new file mode 100644
index 0000000..12f167a
--- /dev/null
+++ b/ppapi/api/trusted/ppb_file_io_trusted.idl
@@ -0,0 +1,49 @@
+/* Copyright (c) 2011 The Chromium Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/*
+ * This file defines the trusted file IO interface
+ */
+
+label Chrome {
+ M14= 0.4
+};
+
+// Available only to trusted implementations.
+interface PPB_FileIOTrusted {
+ /**
+ * Returns a file descriptor corresponding to the given FileIO object. On
+ * Windows, returns a HANDLE; on all other platforms, returns a POSIX file
+ * descriptor. The FileIO object must have been opened with a successful
+ * call to FileIO::Open. The file descriptor will be closed automatically
+ * when the FileIO object is closed or destroyed.
+ */
+ int32_t GetOSFileDescriptor([in] PP_Resource file_io);
+
+ // Notifies the browser that underlying file will be modified. This gives
+ // the browser the opportunity to apply quota restrictions and possibly
+ // return an error to indicate that the write is not allowed.
+ int32_t WillWrite([in] PP_Resource file_io,
+ [in] int64_t offset,
+ [in] int32_t bytes_to_write,
+ [in] PP_CompletionCallback callback);
+
+ /**
+ * Notifies the browser that underlying file will be modified. This gives
+ * the browser the opportunity to apply quota restrictions and possibly
+ * return an error to indicate that the write is not allowed.
+ *
+ * TODO(darin): Maybe unify the above into a single WillChangeFileSize
+ * method? The above methods have the advantage of mapping to PPB_FileIO
+ * Write and SetLength calls. WillChangeFileSize would require the caller to
+ * compute the file size resulting from a Write call, which may be
+ * undesirable.
+ */
+ int32_t WillSetLength([in] PP_Resource file_io,
+ [in] int64_t length,
+ [in] PP_CompletionCallback callback);
+
+};
+
diff --git a/ppapi/api/trusted/ppb_image_data_trusted.idl b/ppapi/api/trusted/ppb_image_data_trusted.idl
index d9339c4..da942df 100644
--- a/ppapi/api/trusted/ppb_image_data_trusted.idl
+++ b/ppapi/api/trusted/ppb_image_data_trusted.idl
@@ -3,11 +3,19 @@
* found in the LICENSE file.
*/
-/* This file defines the trusted ImageData interface. */
+/**
+ * This file defines the trusted ImageData interface.
+ */
+
+label Chrome {
+ M14 = 0.4
+};
-/* Trusted interface */
-interface PPB_ImageDataTrusted_0_4 {
- /* Returns the internal shared memory pointer associated with the given
+/** Trusted interface */
+[macro="PPB_IMAGEDATA_TRUSTED_INTERFACE"]
+interface PPB_ImageDataTrusted {
+ /**
+ * Returns the internal shared memory pointer associated with the given
* ImageData resource. Used for proxying. Returns PP_OK on success, or
* PP_ERROR_* on failure. On success, the size in bytes of the shared
* memory region will be placed into |*byte_count|, and the handle for
@@ -18,3 +26,4 @@ interface PPB_ImageDataTrusted_0_4 {
[out] handle_t handle,
[out] uint32_t byte_count);
};
+
diff --git a/ppapi/api/trusted/ppb_url_loader_trusted.idl b/ppapi/api/trusted/ppb_url_loader_trusted.idl
index 1deafa8..89ca4f4 100644
--- a/ppapi/api/trusted/ppb_url_loader_trusted.idl
+++ b/ppapi/api/trusted/ppb_url_loader_trusted.idl
@@ -5,24 +5,32 @@
/* URL loader trusted interfaces. */
-/* Callback that indicates the status of the download and upload for the
+label Chrome {
+ M14 = 0.3
+};
+
+/**
+ * Callback that indicates the status of the download and upload for the
* given URLLoader resource.
*/
typedef void PP_URLLoaderTrusted_StatusCallback(
- PP_Instance pp_instance,
- PP_Resource pp_resource,
- int64_t bytes_sent,
- int64_t total_bytes_to_be_sent,
- int64_t bytes_received,
- int64_t total_bytes_to_be_received);
+ [in] PP_Instance pp_instance,
+ [in] PP_Resource pp_resource,
+ [in] int64_t bytes_sent,
+ [in] int64_t total_bytes_to_be_sent,
+ [in] int64_t bytes_received,
+ [in] int64_t total_bytes_to_be_received);
/* Available only to trusted implementations. */
-interface PPB_URLLoaderTrusted_0_3 {
- /* Grant this URLLoader the capability to make unrestricted cross-origin
- * requests. */
- void GrantUniversalAccess(PP_Resource loader);
+interface PPB_URLLoaderTrusted {
+ /**
+ * Grant this URLLoader the capability to make unrestricted cross-origin
+ * requests.
+ */
+ void GrantUniversalAccess([in] PP_Resource loader);
- /* Registers that the given function will be called when the upload or
+ /**
+ * Registers that the given function will be called when the upload or
* downloaded byte count has changed. This is not exposed on the untrusted
* interface because it can be quite chatty and encourages people to write
* feedback UIs that update as frequently as the progress updates.
@@ -38,3 +46,4 @@ interface PPB_URLLoaderTrusted_0_3 {
[in] PP_Resource loader,
[in] PP_URLLoaderTrusted_StatusCallback cb);
};
+
diff --git a/ppapi/api/trusted/ppp_broker.idl b/ppapi/api/trusted/ppp_broker.idl
new file mode 100644
index 0000000..5fac4ad
--- /dev/null
+++ b/ppapi/api/trusted/ppp_broker.idl
@@ -0,0 +1,94 @@
+/* Copyright (c) 2011 The Chromium Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/**
+ * This file defines functions that your module must implement to support a
+ * broker.
+ */
+
+#inline c
+// {PENDING: undefine PP_EXPORT?}
+
+#include "ppapi/c/pp_instance.h"
+#include "ppapi/c/pp_stdint.h"
+
+
+#if __GNUC__ >= 4
+
+#define PP_EXPORT __attribute__ ((visibility("default")))
+#elif defined(_MSC_VER)
+#define PP_EXPORT __declspec(dllexport)
+#endif
+
+
+
+/* We don't want name mangling for these external functions. We only need
+ * 'extern "C"' if we're compiling with a C++ compiler.
+ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @addtogroup Typedefs
+ * @{
+ */
+
+/**
+ * PP_ConnectInstance_Func defines the signature that you implement to
+ * receive notifications when a plugin instance connects to the broker.
+ * The broker should listen on the socket before returning.
+ *
+ * @param[in] instance The plugin instance connecting to the broker.
+ * @param[in] handle Handle to a socket the broker can use to communicate with
+ * the plugin.
+ * @return PP_OK on success. Any other value on failure.
+ */
+typedef int32_t (*PP_ConnectInstance_Func)(PP_Instance instance,
+ int32_t handle);
+/**
+ * @}
+ */
+
+/**
+ * @addtogroup Functions
+ * @{
+ */
+
+/**
+ * PPP_InitializeBroker() is the entry point for a broker and is
+ * called by the browser when your module loads. Your code must implement this
+ * function.
+ *
+ * Failure indicates to the browser that this broker can not be used. In this
+ * case, the broker will be unloaded.
+ *
+ * @param[out] connect_instance_func A pointer to a connect instance function.
+ * @return PP_OK on success. Any other value on failure.
+*/
+PP_EXPORT int32_t PPP_InitializeBroker(
+ PP_ConnectInstance_Func* connect_instance_func);
+/**
+ * @}
+ */
+
+/**
+ * @addtogroup Functions
+ * @{
+ */
+
+/** PPP_ShutdownBroker() is called before the broker is unloaded.
+ */
+PP_EXPORT void PPP_ShutdownBroker();
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endinl
+