summaryrefslogtreecommitdiffstats
path: root/ppapi/api
diff options
context:
space:
mode:
authorneb@chromium.org <neb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-30 17:37:54 +0000
committerneb@chromium.org <neb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-30 17:37:54 +0000
commit2272ed3505a36c7d1543f24b770ea85dcfee8640 (patch)
tree91bc7c2235c7d07b65f16e2b78f49382d863fb0b /ppapi/api
parentf917b80b0878fe92ca856696af2dc47a0f5e1c55 (diff)
downloadchromium_src-2272ed3505a36c7d1543f24b770ea85dcfee8640.zip
chromium_src-2272ed3505a36c7d1543f24b770ea85dcfee8640.tar.gz
chromium_src-2272ed3505a36c7d1543f24b770ea85dcfee8640.tar.bz2
IDL version of PPAPI interfaces.
BUG=none TEST=none yet... soon. Review URL: http://codereview.chromium.org/6726041 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@79857 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/api')
-rw-r--r--ppapi/api/pp_bool.idl16
-rw-r--r--ppapi/api/pp_completion_callback.idl29
-rw-r--r--ppapi/api/pp_errors.idl57
-rw-r--r--ppapi/api/pp_input_event.idl227
-rw-r--r--ppapi/api/pp_instance.idl18
-rw-r--r--ppapi/api/pp_module.idl16
-rw-r--r--ppapi/api/pp_point.idl20
-rw-r--r--ppapi/api/pp_rect.idl14
-rw-r--r--ppapi/api/pp_resource.idl21
-rw-r--r--ppapi/api/pp_size.idl14
-rw-r--r--ppapi/api/pp_time.idl23
-rw-r--r--ppapi/api/pp_var.idl56
-rw-r--r--ppapi/api/ppb.idl19
-rw-r--r--ppapi/api/ppb_audio.idl72
-rw-r--r--ppapi/api/ppb_audio_config.idl96
-rw-r--r--ppapi/api/ppb_core.idl69
-rw-r--r--ppapi/api/ppb_graphics_2d.idl196
-rw-r--r--ppapi/api/ppb_image_data.idl86
-rw-r--r--ppapi/api/ppb_instance.idl55
-rw-r--r--ppapi/api/ppb_url_loader.idl117
-rw-r--r--ppapi/api/ppb_url_request_info.idl92
-rw-r--r--ppapi/api/ppb_url_response_info.idl49
-rw-r--r--ppapi/api/ppb_var.idl69
-rw-r--r--ppapi/api/ppp_instance.idl155
-rw-r--r--ppapi/api/private/ppb_flash.idl60
-rw-r--r--ppapi/api/private/ppb_flash_file.idl81
-rw-r--r--ppapi/api/private/ppb_flash_menu.idl52
-rw-r--r--ppapi/api/private/ppb_flash_net_connector.idl41
-rw-r--r--ppapi/api/private/ppb_nacl_private.idl28
-rw-r--r--ppapi/api/private/ppb_pdf.idl141
-rw-r--r--ppapi/api/private/ppb_proxy_private.idl17
-rw-r--r--ppapi/api/trusted/ppb_audio_trusted.idl43
-rw-r--r--ppapi/api/trusted/ppb_image_data_trusted.idl20
-rw-r--r--ppapi/api/trusted/ppb_url_loader_trusted.idl40
34 files changed, 2109 insertions, 0 deletions
diff --git a/ppapi/api/pp_bool.idl b/ppapi/api/pp_bool.idl
new file mode 100644
index 0000000..61d0b5c
--- /dev/null
+++ b/ppapi/api/pp_bool.idl
@@ -0,0 +1,16 @@
+/* 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 PP_Bool 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.
+ */
+enum PP_Bool {
+ PP_FALSE = 0,
+ PP_TRUE = 1
+};
diff --git a/ppapi/api/pp_completion_callback.idl b/ppapi/api/pp_completion_callback.idl
new file mode 100644
index 0000000..b1fb8b3
--- /dev/null
+++ b/ppapi/api/pp_completion_callback.idl
@@ -0,0 +1,29 @@
+/* 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 completion callback type. */
+
+/* The callback function. */
+typedef void PP_CompletionCallback_Func([in] 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.
+ *
+ * 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.
+ */
+[passByValue] struct PP_CompletionCallback {
+ /* Function to call during callback. */
+ PP_CompletionCallback_Func func;
+
+ /* Data to pass into callback. */
+ mem_t user_data;
+};
diff --git a/ppapi/api/pp_errors.idl b/ppapi/api/pp_errors.idl
new file mode 100644
index 0000000..59db3455
--- /dev/null
+++ b/ppapi/api/pp_errors.idl
@@ -0,0 +1,57 @@
+/* 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 an enumeration of all PPAPI errors. */
+
+/* This enumeration contains enumerators of all PPAPI errors.
+ * Errors are negative valued.
+ */
+enum PP_Error {
+ PP_OK = 0,
+ /* This value is returned by a function that accepts a PP_CompletionCallback
+ * and cannot complete synchronously. This error indicates that the given
+ * callback will be asynchronously notified of the final result once it is
+ * available.
+ */
+ PP_ERROR_WOULDBLOCK = -1,
+ /* 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. */
+ PP_ERROR_ABORTED = -3,
+ /* This value indicates failure due to an invalid argument. */
+ PP_ERROR_BADARGUMENT = -4,
+ /* This value indicates failure due to an invalid PP_Resource. */
+ PP_ERROR_BADRESOURCE = -5,
+ /* This value indicates failure due to an unavailable PPAPI interface. */
+ PP_ERROR_NOINTERFACE = -6,
+ /* This value indicates failure due to insufficient privileges. */
+ PP_ERROR_NOACCESS = -7,
+ /* This value indicates failure due to insufficient memory. */
+ PP_ERROR_NOMEMORY = -8,
+ /* This value indicates failure due to insufficient storage space. */
+ PP_ERROR_NOSPACE = -9,
+ /* 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. */
+ PP_ERROR_INPROGRESS = -11,
+ /* This value indicates failure due to a file that does not exist. */
+ PP_ERROR_FILENOTFOUND = -20,
+ /* 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. */
+ PP_ERROR_FILETOOBIG = -22,
+ /* 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. */
+ PP_ERROR_TIMEDOUT = -30,
+ /* This value indicates that the user cancelled rather than providing expected
+ * input.
+ */
+ PP_ERROR_USERCANCEL = -40
+};
+
diff --git a/ppapi/api/pp_input_event.idl b/ppapi/api/pp_input_event.idl
new file mode 100644
index 0000000..fdb53a7
--- /dev/null
+++ b/ppapi/api/pp_input_event.idl
@@ -0,0 +1,227 @@
+/* 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 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
+};
+
+/* The PP_InputEvent_Key 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
+ * "character" event.
+ *
+ * If the user loses focus on the module while a key is down, a key up
+ * event might not occur. For example, if the module has focus and the user
+ * presses and holds the shift key, the module will see a "shift down" message.
+ * Then if the user clicks elsewhere on the web page, the module's focus will
+ * be lost and no more input events will be delivered.
+ *
+ * If your module depends on receiving key up events, it should also handle
+ * "lost focus" as the equivalent of "all keys up."
+ */
+struct PP_InputEvent_Key {
+ /* 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.
+ */
+ uint32_t key_code;
+};
+
+/* The PP_InputEvent_Character 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
+ * modifier keys applied. Obvious examples are symbols, where Shift-5 gives you
+ * a '%'. The key down and up events will give you the scan code for the "5"
+ * key, and the character event will give you the '%' character.
+ *
+ * You may not get a character event for all key down events if the key doesn't
+ * generate a character. Likewise, you may actually get multiple character
+ * events in a row. For example, some locales have an accent key that modifies
+ * the next character typed. You might get this stream of events: accent down,
+ * accent up (it didn't generate a character), letter key down, letter with
+ * accent character event (it was modified by the previous accent key), letter
+ * key up. If the letter can't be combined with the accent, like an umlaut and
+ * an 'R', the system might send unlaut down, umlaut up, 'R' key down, umlaut
+ * character (can't combine it with 'R', so just send the raw unlaut so it
+ * isn't lost"), 'R' character event, 'R' key up.
+ */
+struct PP_InputEvent_Character {
+ /* A combination of the EVENT_MODIFIER flags. */
+ uint32_t modifier;
+ /* This value represents the typed character as a single null-terminated UTF-8
+ * character. Any unused bytes will be filled with null bytes. Since the
+ * maximum UTF-8 character is 4 bytes, there will always be at least one null
+ * at the end so you can treat this as a null-termianted UTF-8 string.
+ */
+ uint8_t[5] text;
+};
+
+/* The PP_InputEvent_Mouse struct represents all mouse events except
+ * mouse wheel events.
+ */
+struct PP_InputEvent_Mouse {
+ /* This value is a bit field combination of the EVENT_MODIFIER 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.
+ */
+ PP_InputEvent_MouseButton button;
+ /* 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.
+ * For example, the plugin element might be arbitrarily scaled or transformed
+ * in the DOM, and translating a mouse event into the coordinate space of the
+ * plugin will give non-integer values.
+ */
+ float_t x;
+ /* 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.
+ * For example, the plugin element might be arbitrarily scaled or transformed
+ * in the DOM, and translating a mouse event into the coordinate space of the
+ * plugin will give non-integer values.
+ */
+ float_t y;
+ /* 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. */
+ uint32_t modifier;
+ /* 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, delta_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".
+ */
+ float_t delta_x;
+ /* See delta_x. */
+ float_t delta_y;
+ /* 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|.
+ *
+ * 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
+ * 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.
+ */
+ float_t wheel_ticks_x;
+ /* See wheel_ticks_x. */
+ 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.
+ */
+ PP_Bool scroll_by_page;
+};
+
+/* Event's data.
+ *
+ * Padding allows new events to be added without changing the size of this
+ * struct.
+ */
+[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;
+};
+
+/* The PP_InputEvent struct represents all input events. */
+struct PP_InputEvent {
+ /* This value represents the type of the event. */
+ PP_InputEvent_Type type;
+ /* This value represents the time that this event was generated. This value
+ * is not relative to any particular epoch; the most you can do is compare
+ * time stamps.
+ */
+ PP_TimeTicks time_stamp;
+ /* This value represents the event's specific data. */
+ PP_InputEventData u;
+};
diff --git a/ppapi/api/pp_instance.idl b/ppapi/api/pp_instance.idl
new file mode 100644
index 0000000..5e861ce
--- /dev/null
+++ b/ppapi/api/pp_instance.idl
@@ -0,0 +1,18 @@
+/* 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 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
+ * \<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.
+ */
+typedef int32_t PP_Instance;
diff --git a/ppapi/api/pp_module.idl b/ppapi/api/pp_module.idl
new file mode 100644
index 0000000..657bb5c
--- /dev/null
+++ b/ppapi/api/pp_module.idl
@@ -0,0 +1,16 @@
+/* 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 PP_Module type which 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."
+ */
+typedef int32_t PP_Module;
diff --git a/ppapi/api/pp_point.idl b/ppapi/api/pp_point.idl
new file mode 100644
index 0000000..37aeca7
--- /dev/null
+++ b/ppapi/api/pp_point.idl
@@ -0,0 +1,20 @@
+/* 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 2 dimensional point.
+ * 0,0 is the upper-left starting coordinate.
+ */
+
+/* The PP_Point structure defines the x and y coordinates of a point. */
+struct PP_Point {
+ /* 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.
+ */
+ int32_t y;
+};
diff --git a/ppapi/api/pp_rect.idl b/ppapi/api/pp_rect.idl
new file mode 100644
index 0000000..1e82998
--- /dev/null
+++ b/ppapi/api/pp_rect.idl
@@ -0,0 +1,14 @@
+/* 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 APIs for creating a 2-dimensional rectangle. */
+
+/* The PP_Rect struct contains the size and location of a 2D rectangle. */
+struct PP_Rect {
+ /* The x and y coordinates of the upper-left corner of the rectangle. */
+ PP_Point point;
+ /* The width and height of the rectangle. */
+ PP_Size size;
+};
diff --git a/ppapi/api/pp_resource.idl b/ppapi/api/pp_resource.idl
new file mode 100644
index 0000000..eeed9a3
--- /dev/null
+++ b/ppapi/api/pp_resource.idl
@@ -0,0 +1,21 @@
+/* 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 PP_Resource type. */
+
+/* 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.
+ *
+ * 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.
+ *
+ * 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.
+ */
+typedef int32_t PP_Resource;
diff --git a/ppapi/api/pp_size.idl b/ppapi/api/pp_size.idl
new file mode 100644
index 0000000..2f86724
--- /dev/null
+++ b/ppapi/api/pp_size.idl
@@ -0,0 +1,14 @@
+/* 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 width and height of a 2 dimenstional rectangle. */
+
+/* The PP_Size struct contains the size of a 2D rectangle. */
+struct PP_Size {
+ /* This value represents the width of the rectangle. */
+ int32_t width;
+ /* This value represents the height of the rectangle. */
+ int32_t height;
+};
diff --git a/ppapi/api/pp_time.idl b/ppapi/api/pp_time.idl
new file mode 100644
index 0000000..1b86368
--- /dev/null
+++ b/ppapi/api/pp_time.idl
@@ -0,0 +1,23 @@
+/* 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 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).
+ */
+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.
+ *
+ * The units are in seconds, but are not measured relative to any particular
+ * epoch, so the most you can do is compare two values.
+ */
+typedef double_t PP_TimeTicks;
diff --git a/ppapi/api/pp_var.idl b/ppapi/api/pp_var.idl
new file mode 100644
index 0000000..b3139e2
--- /dev/null
+++ b/ppapi/api/pp_var.idl
@@ -0,0 +1,56 @@
+/* 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 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.
+ */
+enum PP_VarType {
+ PP_VARTYPE_UNDEFINED = 0,
+ PP_VARTYPE_NULL = 1,
+ PP_VARTYPE_BOOL = 2,
+ PP_VARTYPE_INT32 = 3,
+ PP_VARTYPE_DOUBLE = 4,
+ PP_VARTYPE_STRING = 5,
+ PP_VARTYPE_OBJECT = 6
+};
+
+/* The value of a Var. */
+[union] struct PP_VarValue {
+ /* Value if type is PP_VARTYPE_BOOL. */
+ PP_Bool as_bool;
+ /* Value if type is PP_VARTYPE_INT32. */
+ int32_t as_int;
+ /* Value if type is PP_VARTYPE_DOUBLE. */
+ 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."
+ */
+ 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.
+ *
+ * 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.
+ */
+[passByValue] struct PP_Var {
+ /* Type. */
+ PP_VarType type;
+ /* Type-dependent value. */
+ PP_VarValue value;
+};
diff --git a/ppapi/api/ppb.idl b/ppapi/api/ppb.idl
new file mode 100644
index 0000000..f580dcc
--- /dev/null
+++ b/ppapi/api/ppb.idl
@@ -0,0 +1,19 @@
+/* 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 a function pointer type for the PPB_GetInterface 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 value will be NULL if the interface is not supported on the browser.
+ */
+typedef mem_t PPB_GetInterface([in] str_t interface_name);
diff --git a/ppapi/api/ppb_audio.idl b/ppapi/api/ppb_audio.idl
new file mode 100644
index 0000000..71abad6
--- /dev/null
+++ b/ppapi/api/ppb_audio.idl
@@ -0,0 +1,72 @@
+/* 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 audio API.
+ */
+
+/* Callback function type for SetCallback. */
+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:
+ *
+ * void audio_callback(void* sample_buffer,
+ * size_t buffer_size_in_bytes,
+ * void* user_data) {
+ * ... fill in the buffer with samples ...
+ * }
+ *
+ * uint32_t obtained;
+ * AudioConfig config(PP_AUDIOSAMPLERATE_44100, 4096, &obtained);
+ * Audio audio(config, audio_callback, NULL);
+ * audio.StartPlayback();
+ */
+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.
+ */
+ 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.
+ */
+ PP_Bool IsAudio(
+ [in] PP_Resource resource);
+
+ /* Get the current configuration. */
+ 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.
+ */
+ 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.
+ */
+ PP_Bool StopPlayback(
+ [in] PP_Resource audio);
+};
diff --git a/ppapi/api/ppb_audio_config.idl b/ppapi/api/ppb_audio_config.idl
new file mode 100644
index 0000000..2c73e03
--- /dev/null
+++ b/ppapi/api/ppb_audio_config.idl
@@ -0,0 +1,96 @@
+/* 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 AudioConfig interface. */
+
+
+/**
+ * This enumeration contains audio frame count constants.
+ * PP_AUDIOMINSAMPLEFRAMECOUNT is the minimum possible frame count.
+ * PP_AUDIOMAXSAMPLEFRAMECOUNT is the maximum possible frame count.
+ */
+enum PP_AudioFrameSize {
+ PP_AUDIOMINSAMPLEFRAMECOUNT = 64,
+ PP_AUDIOMAXSAMPLEFRAMECOUNT = 32768
+};
+
+
+/**
+ * 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.
+ */
+enum PP_AudioSampleRate {
+ PP_AUDIOSAMPLERATE_NONE = 0,
+ PP_AUDIOSAMPLERATE_44100 = 44100,
+ PP_AUDIOSAMPLERATE_48000 = 48000
+} ;
+
+
+/* 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.
+ *
+ * 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
+ * ...
+ * 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
+ * Data will always be in the native endian format of the platform.
+ */
+ 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.
+ *
+ * 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
+ * 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.
+ */
+ 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. */
+ 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.
+ */
+ 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.
+ */
+ uint32_t GetSampleFrameCount(
+ [in] PP_Resource config);
+};
diff --git a/ppapi/api/ppb_core.idl b/ppapi/api/ppb_core.idl
new file mode 100644
index 0000000..50ca87a
--- /dev/null
+++ b/ppapi/api/ppb_core.idl
@@ -0,0 +1,69 @@
+/* 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 core API. */
+
+/* {PENDING: describe PPB_CORE} */
+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);
+
+ /* Allocate memory.
+ *
+ * Returns NULL If the allocation fails.
+ */
+ mem_t MemAlloc(
+ [in] uint32_t num_bytes);
+
+ /* Free memory; it's safe to pass NULL. */
+ void MemFree(
+ [inout] mem_t ptr);
+
+ /* Returns the "wall clock time" according to the browser.
+ *
+ * See the definition of PP_Time.
+ */
+ 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * NOTE: If the browser is shutting down or if the plugin has no instances,
+ * then the callback function may not be called.
+ */
+ 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.
+ *
+ * This is useful for implementing sanity checks, and deciding if dispatching
+ * via CallOnMainThread() is required.
+ */
+ PP_Bool IsMainThread();
+};
diff --git a/ppapi/api/ppb_graphics_2d.idl b/ppapi/api/ppb_graphics_2d.idl
new file mode 100644
index 0000000..1a013b1
--- /dev/null
+++ b/ppapi/api/ppb_graphics_2d.idl
@@ -0,0 +1,196 @@
+/* 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 PPB_Graphics2D struct. */
+
+/* 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.
+ */
+ 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.
+ */
+ 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.
+ */
+ 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.
+ *
+ * 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 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 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.
+ */
+ void PaintImageData(
+ [in] PP_Resource graphics_2d,
+ [in] PP_Resource image_data,
+ [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.
+ *
+ * This will result in some exposed region which will have undefined
+ * contents. The plugin 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.
+ */
+ 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.
+ *
+ * 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.
+ *
+ * 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
+ * possibility of significant painting artifacts because the page might use
+ * partially-rendered data when copying out of the backing store.
+ *
+ * In the case of an animation, you will want to allocate a new image for the
+ * next frame. It is best if you wait until the flush callback has executed
+ * before allocating this bitmap. This gives the browser the option of
+ * caching the previous backing store and handing it back to you (assuming
+ * 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.
+ */
+ 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.
+ *
+ * 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.
+ * 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.
+ */
+ 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
new file mode 100644
index 0000000..aa3cbd0
--- /dev/null
+++ b/ppapi/api/ppb_image_data.idl
@@ -0,0 +1,86 @@
+/* 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 image data API. */
+
+/* Bitmap formats. */
+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
+};
+
+/* Description of a bitmap. */
+struct PP_ImageDataDesc {
+ /* Byte format. */
+ PP_ImageDataFormat format;
+
+ /* 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.
+ */
+ 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.
+ */
+ PP_ImageDataFormat GetNativeImageDataFormat();
+
+ /* Returns PP_TRUE 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.
+ *
+ * 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.
+ */
+ PP_Resource Create(
+ [in] PP_Instance instance,
+ [in] PP_ImageDataFormat format,
+ [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.
+ */
+ 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.
+ */
+ 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.
+ */
+ mem_t Map(
+ [in] PP_Resource image_data);
+
+ /* Unmaps this bitmaps from the plugin address space */
+ void Unmap(
+ [in] PP_Resource image_data);
+};
diff --git a/ppapi/api/ppb_instance.idl b/ppapi/api/ppb_instance.idl
new file mode 100644
index 0000000..f237edb
--- /dev/null
+++ b/ppapi/api/ppb_instance.idl
@@ -0,0 +1,55 @@
+/* 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_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
+ * 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.
+ *
+ * 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.
+ *
+ * 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
+ * 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.
+ */
+ 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.
+ *
+ * Returns a PP_Bool containing PP_TRUE if the instance is full-frame.
+ */
+ PP_Bool IsFullFrame(
+ /* A PP_Instance indentifying one instance of a module. */
+ [in] PP_Instance instance);
+};
diff --git a/ppapi/api/ppb_url_loader.idl b/ppapi/api/ppb_url_loader.idl
new file mode 100644
index 0000000..6513881
--- /dev/null
+++ b/ppapi/api/ppb_url_loader.idl
@@ -0,0 +1,117 @@
+/* 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 URL loader API. */
+
+/* The interface for loading URLs.
+ *
+ * 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.
+ *
+ * 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.
+ */
+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.
+ */
+ 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.
+ */
+ 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.
+ */
+ 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.
+ */
+ 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.
+ *
+ * This data is only available if the URLRequestInfo passed to Open() had the
+ * PP_URLREQUESTPROPERTY_REPORTUPLOADPROGRESS flag set to PP_TRUE.
+ *
+ * This method returns PP_FALSE if upload progress 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.
+ *
+ * This data is only available if the URLRequestInfo passed to Open() had the
+ * PP_URLREQUESTPROPERTY_REPORTDOWNLOADPROGRESS flag set to PP_TRUE.
+ *
+ * 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.
+ */
+ 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. */
+ 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.
+ */
+ int32_t ReadResponseBody(
+ [in] PP_Resource loader,
+ [out] mem_t buffer,
+ [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.
+ */
+ 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.
+ */
+ void Close(
+ [in] PP_Resource loader);
+};
diff --git a/ppapi/api/ppb_url_request_info.idl b/ppapi/api/ppb_url_request_info.idl
new file mode 100644
index 0000000..451caa8
--- /dev/null
+++ b/ppapi/api/ppb_url_request_info.idl
@@ -0,0 +1,92 @@
+/* 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 URL request info API. */
+
+/* Request properties. */
+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.
+ *
+ * Boolean (default = PP_FALSE).
+ */
+ PP_URLREQUESTPROPERTY_RECORDDOWNLOADPROGRESS = 5,
+
+ /* Set to true if you want to be able to pull the upload progress via the
+ * URLLoader.GetUploadProgress function.
+ *
+ * Boolean (default = PP_FALSE).
+ */
+ PP_URLREQUESTPROPERTY_RECORDUPLOADPROGRESS = 6
+};
+
+/* 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. */
+ 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.
+ */
+ 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.
+ */
+ PP_Bool SetProperty(
+ [in] PP_Resource request,
+ [in] PP_URLRequestProperty property,
+ [in] PP_Var value);
+
+ /* Append data to the request body.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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 AppendFileToBody(
+ [in] PP_Resource request,
+ [in] PP_Resource file_ref,
+ [in] int64_t start_offset,
+ [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
new file mode 100644
index 0000000..46f8d6a
--- /dev/null
+++ b/ppapi/api/ppb_url_response_info.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.
+ */
+
+/* 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
+};
+
+/* 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.
+ */
+ PP_Bool IsURLResponseInfo(
+ [in] PP_Resource resource);
+
+ /* Gets a response property. Return PP_VarType_Void 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.
+ */
+ PP_Resource GetBodyAsFileRef(
+ [in] PP_Resource response);
+};
diff --git a/ppapi/api/ppb_var.idl b/ppapi/api/ppb_var.idl
new file mode 100644
index 0000000..17a39e2
--- /dev/null
+++ b/ppapi/api/ppb_var.idl
@@ -0,0 +1,69 @@
+/* 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_Var API. */
+
+/* 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.
+ */
+ 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.
+ */
+ 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ */
+ 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.
+ *
+ * If the var is not a string, this function will return NULL and |*len| 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.
+ */
+ str_t VarToUtf8(
+ [in] PP_Var var,
+ [out] uint32_t len);
+
+ /* Convert a variable to a different type using rules from ECMAScript
+ * specification, section [9].
+ * TODO(neb): Document what happens on failure.
+ */
+ PP_Var ConvertType(
+ [in] PP_Instance instance,
+ [in] PP_Var var,
+ [in] PP_VarType new_type);
+};
diff --git a/ppapi/api/ppp_instance.idl b/ppapi/api/ppp_instance.idl
new file mode 100644
index 0000000..4bc0ef1
--- /dev/null
+++ b/ppapi/api/ppp_instance.idl
@@ -0,0 +1,155 @@
+/* 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_Instance structure - a series of points to methods
+ * that you must implement in your model.
+ */
+
+/* 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.
+ */
+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.
+ *
+ * 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).
+ *
+ * If this function reports a failure (by returning @a PP_FALSE), the NaCl
+ * module will be deleted and DidDestroy will be called.
+ *
+ * Returns PP_TRUE on success.
+ */
+ PP_Bool DidCreate(
+ /* A PP_Instance indentifying one instance of a module. */
+ [in] PP_Instance instance,
+ /* The number of arguments contained in argn and argv. */
+ [in] uint32_t argc,
+ /* An array of argument names. These argument names are
+ * supplied in the <embed> tag, for example:
+ * <embed id="nacl_module" dimensions="2"> will produce two argument
+ * names: "id" and "dimensions."
+ */
+ [in, size_is(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);
+
+ /* 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.
+ */
+ 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.
+ */
+ void DidChangeView(
+ /* A PP_Instance indentifying the instance whose view changed. */
+ [in] PP_Instance instance,
+ /* The new location on the page of this instance. This is relative to
+ * the top left corner of the viewport, which changes as the
+ * page is scrolled.
+ */
+ [in] PP_Rect position,
+ /* The visible region of the NaCl module. This is relative to the top
+ * left of the plugin's coordinate system (not the page) If the plugin
+ * is invisible, clip will be (0, 0, 0, 0).
+ */
+ [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.
+ */
+ void DidChangeFocus(
+ /* A PP_Instance indentifying one instance of a module. */
+ [in] PP_Instance instance,
+ /* 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.
+ */
+ PP_Bool HandleInputEvent(
+ /* A PP_Instance indentifying one instance of a module. */
+ [in] PP_Instance instance,
+ /* 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.
+ */
+ PP_Bool HandleDocumentLoad(
+ /* A PP_Instance indentifying one instance of a module. */
+ [in] PP_Instance instance,
+ /* A PP_Resource an open PPB_URLLoader instance. */
+ [in] PP_Resource url_loader);
+
+ /* This value represents a pointer to a function that returns a Var
+ * representing the scriptable object for the given instance. Normally
+ * this will be a PPP_Class object that exposes certain methods the page
+ * may want to call.
+ *
+ * On Failure, the returned var should be a "void" var.
+ *
+ * The returned PP_Var should have a reference added for the caller, which
+ * will be responsible for Release()ing that reference.
+ *
+ * Returns a PP_Var containing scriptable object.
+ */
+ PP_Var GetInstanceObject(
+ /* A PP_Instance indentifying one instance of a module. */
+ [in] PP_Instance instance);
+};
diff --git a/ppapi/api/private/ppb_flash.idl b/ppapi/api/private/ppb_flash.idl
new file mode 100644
index 0000000..55a3862
--- /dev/null
+++ b/ppapi/api/private/ppb_flash.idl
@@ -0,0 +1,60 @@
+/* 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 contains PPB_Flash interface. */
+
+/* PPB_Flash interface. */
+interface PPB_Flash_0_7 {
+ /* Sets or clears the rendering hint that the given plugin instance is always
+ * on top of page content. Somewhat more optimized painting can be used in
+ * this case.
+ */
+ void SetInstanceAlwaysOnTop(
+ [in] PP_Instance instance,
+ [in] PP_Bool on_top);
+
+ PP_Bool DrawGlyphs(
+ [in] PP_Instance instance,
+ [in] PP_Resource pp_image_data,
+ [in] PP_FontDescription_Dev font_desc,
+ [in] uint32_t color,
+ [in] PP_Point position,
+ [in] PP_Rect clip,
+ [in] float_t[3][3] transformation,
+ [in] uint32_t glyph_count,
+ [in, size_is(glyph_count)] uint16_t[] glyph_indices,
+ [in, size_is(glyph_count)] PP_Point[] glyph_advances);
+
+ /* Retrieves the proxy that will be used for the given URL. The result will
+ * be a string in PAC format, or an undefined var on error.
+ */
+ PP_Var GetProxyForURL(
+ [in] PP_Instance instance,
+ [in] str_t url);
+
+ /* Navigate to URL. May open a new tab if target is not "_self". Return true
+ * if success. This differs from javascript:window.open() in that it bypasses
+ * the popup blocker, even when this is not called from an event handler.
+ */
+ PP_Bool NavigateToURL(
+ [in] PP_Instance instance,
+ [in] str_t url,
+ [in] str_t target);
+
+ /* Runs a nested message loop. The plugin will be reentered from this call.
+ * This function is used in places where Flash would normally enter a nested
+ * message loop (e.g., when displaying context menus), but Pepper provides
+ * only an asynchronous call. After performing that asynchronous call, call
+ * |RunMessageLoop()|. In the callback, call |QuitMessageLoop()|.
+ */
+ void RunMessageLoop(
+ [in] PP_Instance instance);
+
+ /* Posts a quit message for the outermost nested message loop. Use this to
+ * exit and return back to the caller after you call RunMessageLoop.
+ */
+ void QuitMessageLoop(
+ [in] PP_Instance instance);
+};
diff --git a/ppapi/api/private/ppb_flash_file.idl b/ppapi/api/private/ppb_flash_file.idl
new file mode 100644
index 0000000..6ad1a8a
--- /dev/null
+++ b/ppapi/api/private/ppb_flash_file.idl
@@ -0,0 +1,81 @@
+/* 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 contains PPB_Flash_File interface. */
+
+/* A directory entry. */
+struct PP_DirEntry_Dev {
+ str_t name;
+ PP_Bool is_dir;
+};
+
+/* Directory. */
+struct PP_DirContents_Dev {
+ int32_t count;
+ [size_is(count)] PP_DirEntry_Dev[] entries;
+};
+
+/* PPB_Flash_File_ModuleLocal */
+interface PPB_Flash_File_ModuleLocal_0_1 {
+ /* Opens a module-local file, returning a file descriptor (posix) or a HANDLE
+ * (win32) into file. Module-local file paths (here and below) are
+ * '/'-separated UTF-8 strings, relative to a module-specific root. The return
+ * value is the ppapi error, PP_OK if success, one of the PP_ERROR_* in case
+ * of failure
+ */
+ int32_t OpenFile(
+ [in] PP_Instance instance,
+ [in] str_t path,
+ [in] int32_t mode,
+ [out] PP_FileHandle file);
+
+ /* Renames a module-local file. The return value is the ppapi error, PP_OK if
+ * success, one of the PP_ERROR_* in case of failure.
+ */
+ int32_t RenameFile(
+ [in] PP_Instance instance,
+ [in] str_t path_from,
+ [in] str_t path_to);
+
+ /* Deletes a module-local file or directory. If recursive is set and the path
+ * points to a directory, deletes all the contents of the directory. The
+ * return value is the ppapi error, PP_OK if success, one of the PP_ERROR_* in
+ * case of failure.
+ */
+ int32_t DeleteFileOrDir(
+ [in] PP_Instance instance,
+ [in] str_t path,
+ [in] PP_Bool recursive);
+
+ /* Creates a module-local directory. The return value is the ppapi error,
+ * PP_OK if success, one of the PP_ERROR_* in case of failure.
+ */
+ int32_t CreateDir(
+ [in] PP_Instance instance,
+ [in] str_t path);
+
+ /* Queries information about a module-local file. The return value is the
+ * ppapi error, PP_OK if success, one of the PP_ERROR_* in case of failure.
+ */
+ int32_t QueryFile(
+ [in] PP_Instance instance,
+ [in] str_t path,
+ [out] PP_FileInfo_Dev info);
+
+ /* Gets the list of files contained in a module-local directory. The return
+ * value is the ppapi error, PP_OK if success, one of the PP_ERROR_* in case
+ * of failure. If non-NULL, the returned contents should be freed with
+ * FreeDirContents.
+ */
+ int32_t GetDirContents(
+ [in] PP_Instance instance,
+ [in] str_t path,
+ [out] PP_DirContents_Dev contents);
+
+ /* Frees the data allocated by GetDirContents. */
+ void FreeDirContents(
+ [in] PP_Instance instance,
+ [in] PP_DirContents_Dev contents);
+};
diff --git a/ppapi/api/private/ppb_flash_menu.idl b/ppapi/api/private/ppb_flash_menu.idl
new file mode 100644
index 0000000..df6aa44
--- /dev/null
+++ b/ppapi/api/private/ppb_flash_menu.idl
@@ -0,0 +1,52 @@
+/* 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.
+ */
+
+/* PPB_Flash */
+
+/* Menu item type.
+ *
+ * TODO(viettrungluu): Radio items not supported yet. Will also probably want
+ * special menu items tied to clipboard access.
+ */
+enum PP_Flash_MenuItem_Type {
+ PP_FLASH_MENUITEM_TYPE_NORMAL = 0,
+ PP_FLASH_MENUITEM_TYPE_CHECKBOX = 1,
+ PP_FLASH_MENUITEM_TYPE_SEPARATOR = 2,
+ PP_FLASH_MENUITEM_TYPE_SUBMENU = 3
+};
+
+struct PP_Flash_MenuItem {
+ PP_Flash_MenuItem_Type type;
+ str_t name;
+ int32_t id;
+ PP_Bool enabled;
+ PP_Bool checked;
+ PP_Flash_Menu submenu;
+};
+
+struct PP_Flash_Menu {
+ uint32_t count;
+ [size_is(count)] PP_Flash_MenuItem[] items;
+};
+
+interface PPB_Flash_Menu_0_1 {
+ PP_Resource Create(
+ [in] PP_Instance instance_id,
+ [in] PP_Flash_Menu menu_data);
+
+ PP_Bool IsFlashMenu(
+ [in] PP_Resource resource_id);
+
+ /* Display a context menu at the given location. If the user selects an item,
+ * |selected_id| will be set to its |id| and the callback called with |PP_OK|.
+ * If the user dismisses the menu without selecting an item,
+ * |PP_ERROR_USERCANCEL| will be indicated.
+ */
+ int32_t Show(
+ [in] PP_Resource menu_id,
+ [in] PP_Point location,
+ [out] int32_t selected_id,
+ [in] PP_CompletionCallback callback);
+};
diff --git a/ppapi/api/private/ppb_flash_net_connector.idl b/ppapi/api/private/ppb_flash_net_connector.idl
new file mode 100644
index 0000000..3886dad
--- /dev/null
+++ b/ppapi/api/private/ppb_flash_net_connector.idl
@@ -0,0 +1,41 @@
+/* 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 is an opaque type holding a network address. */
+struct PP_Flash_NetAddress {
+ uint32_t size;
+ [fixed=128] uint8_t data;
+};
+
+interface PPB_Flash_NetConnector_0_1 {
+ PP_Resource Create(
+ [in] PP_Instance instance_id);
+ PP_Bool IsFlashNetConnector(
+ [in] PP_Resource resource_id);
+
+ /* Connect to a TCP port given as a host-port pair. The local and remote
+ * addresses of the connection (if successful) are returned in
+ * |local_addr_out| and |remote_addr_out|, respectively, if non-null.
+ */
+ int32_t ConnectTcp(
+ [in] PP_Resource connector_id,
+ [in] str_t host,
+ [in] uint16_t port,
+ [out] PP_FileHandle socket_out,
+ [out] PP_Flash_NetAddress local_addr_out,
+ [out] PP_Flash_NetAddress remote_addr_out,
+ [in] PP_CompletionCallback callback);
+
+ /* Same as |ConnectTcp()|, but connecting to the address given by |addr|. A
+ * typical use-case would be for reconnections.
+ */
+ int32_t ConnectTcpAddress(
+ [in] PP_Resource connector_id,
+ [in] PP_Flash_NetAddress addr,
+ [out] PP_FileHandle socket_out,
+ [out] PP_Flash_NetAddress local_addr_out,
+ [out] PP_Flash_NetAddress remote_addr_out,
+ [in] PP_CompletionCallback callback);
+};
diff --git a/ppapi/api/private/ppb_nacl_private.idl b/ppapi/api/private/ppb_nacl_private.idl
new file mode 100644
index 0000000..fc31dbb
--- /dev/null
+++ b/ppapi/api/private/ppb_nacl_private.idl
@@ -0,0 +1,28 @@
+/* Copyright (c) 2010 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 contains NaCl private interfaces. */
+
+/* PPB_NaCl_Private */
+interface PPB_NaCl_Private_0_1 {
+ /* This function launches NaCl's sel_ldr process. On success, the function
+ * returns true, otherwise it returns false. When it returns true, it will
+ * write |socket_count| nacl::Handles to imc_handles and will write the
+ * nacl::Handle of the created process to |nacl_process_handle|. Finally,
+ * the function will write the process ID of the created process to
+ * |nacl_process_id|.
+ */
+ bool LaunchSelLdr(
+ [in] str_t alleged_url,
+ [in] int32_t socket_count,
+ [out] mem_t imc_handles,
+ [out] mem_t nacl_process_handle,
+ [out] int32_t nacl_process_id);
+
+ /* On POSIX systems, this function returns the file descriptor of
+ * /dev/urandom. On non-POSIX systems, this function returns 0.
+ */
+ int32_t UrandomFD();
+};
diff --git a/ppapi/api/private/ppb_pdf.idl b/ppapi/api/private/ppb_pdf.idl
new file mode 100644
index 0000000..3a6094f
--- /dev/null
+++ b/ppapi/api/private/ppb_pdf.idl
@@ -0,0 +1,141 @@
+/* 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 contains PPB_PDF interface. */
+
+enum PP_ResourceString{
+ PP_RESOURCESTRING_PDFGETPASSWORD = 0,
+ PP_RESOURCESTRING_PDFLOADING = 1,
+ PP_RESOURCESTRING_PDFLOAD_FAILED = 2
+};
+
+enum PP_ResourceImage{
+ PP_RESOURCEIMAGE_PDF_BUTTON_FTH = 0,
+ PP_RESOURCEIMAGE_PDF_BUTTON_FTH_HOVER = 1,
+ PP_RESOURCEIMAGE_PDF_BUTTON_FTH_PRESSED = 2,
+ PP_RESOURCEIMAGE_PDF_BUTTON_FTW = 3,
+ PP_RESOURCEIMAGE_PDF_BUTTON_FTW_HOVER = 4,
+ PP_RESOURCEIMAGE_PDF_BUTTON_FTW_PRESSED = 5,
+ PP_RESOURCEIMAGE_PDF_BUTTON_ZOOMIN = 6,
+ PP_RESOURCEIMAGE_PDF_BUTTON_ZOOMIN_HOVER = 7,
+ PP_RESOURCEIMAGE_PDF_BUTTON_ZOOMIN_PRESSED = 8,
+ PP_RESOURCEIMAGE_PDF_BUTTON_ZOOMOUT = 9,
+ PP_RESOURCEIMAGE_PDF_BUTTON_ZOOMOUT_HOVER = 10,
+ PP_RESOURCEIMAGE_PDF_BUTTON_ZOOMOUT_PRESSED = 11,
+ PP_RESOURCEIMAGE_PDF_BUTTON_THUMBNAIL_0 = 12,
+ PP_RESOURCEIMAGE_PDF_BUTTON_THUMBNAIL_1 = 13,
+ PP_RESOURCEIMAGE_PDF_BUTTON_THUMBNAIL_2 = 14,
+ PP_RESOURCEIMAGE_PDF_BUTTON_THUMBNAIL_3 = 15,
+ PP_RESOURCEIMAGE_PDF_BUTTON_THUMBNAIL_4 = 16,
+ PP_RESOURCEIMAGE_PDF_BUTTON_THUMBNAIL_5 = 17,
+ PP_RESOURCEIMAGE_PDF_BUTTON_THUMBNAIL_6 = 18,
+ PP_RESOURCEIMAGE_PDF_BUTTON_THUMBNAIL_7 = 19,
+ PP_RESOURCEIMAGE_PDF_BUTTON_THUMBNAIL_8 = 20,
+ PP_RESOURCEIMAGE_PDF_BUTTON_THUMBNAIL_9 = 21,
+ PP_RESOURCEIMAGE_PDF_BUTTON_THUMBNAIL_NUM_BACKGROUND = 22
+};
+
+enum PP_PrivateFontCharset {
+ PP_PRIVATEFONTCHARSET_ANSI = 0,
+ PP_PRIVATEFONTCHARSET_DEFAULT = 1,
+ PP_PRIVATEFONTCHARSET_SYMBOL = 2,
+ PP_PRIVATEFONTCHARSET_MAC = 77,
+ PP_PRIVATEFONTCHARSET_SHIFTJIS = 128,
+ PP_PRIVATEFONTCHARSET_HANGUL = 129,
+ PP_PRIVATEFONTCHARSET_JOHAB = 130,
+ PP_PRIVATEFONTCHARSET_GB2312 = 134,
+ PP_PRIVATEFONTCHARSET_CHINESEBIG5 = 136,
+ PP_PRIVATEFONTCHARSET_GREEK = 161,
+ PP_PRIVATEFONTCHARSET_TURKISH = 162,
+ PP_PRIVATEFONTCHARSET_VIETNAMESE = 163,
+ PP_PRIVATEFONTCHARSET_HEBREW = 177,
+ PP_PRIVATEFONTCHARSET_ARABIC = 178,
+ PP_PRIVATEFONTCHARSET_BALTIC = 186,
+ PP_PRIVATEFONTCHARSET_RUSSIAN = 204,
+ PP_PRIVATEFONTCHARSET_THAI = 222,
+ PP_PRIVATEFONTCHARSET_EASTEUROPE = 238,
+ PP_PRIVATEFONTCHARSET_OEM = 255
+};
+
+struct PP_PrivateFontFileDescription {
+ str_t face;
+ uint32_t weight;
+ PP_Bool italic;
+};
+
+struct PP_PrivateFindResult {
+ int32_t start_index;
+ int32_t length;
+};
+
+interface PPB_PDF_0_1 {
+ /* Returns a localized string. */
+ PP_Var GetLocalizedString(
+ [in] PP_Instance instance,
+ [in] PP_ResourceString string_id);
+
+ /* Returns a resource image. */
+ PP_Resource GetResourceImage(
+ [in] PP_Instance instance,
+ [in] PP_ResourceImage image_id);
+
+ /* Returns a resource identifying a font file corresponding to the given font
+ * request after applying the browser-specific fallback.
+ *
+ * Currently Linux-only.
+ */
+ PP_Resource GetFontFileWithFallback(
+ [in] PP_Instance instance,
+ [in] PP_FontDescription_Dev description,
+ [in] PP_PrivateFontCharset charset);
+
+ /* Given a resource previously returned by GetFontFileWithFallback, returns
+ * a pointer to the requested font table. Linux only.
+ */
+ PP_Bool GetFontTableForPrivateFontFile(
+ [in] PP_Resource font_file,
+ [in] uint32_t table,
+ [out] mem_t output,
+ [out] uint32_t output_length);
+
+ /* Search the given string using ICU. Use PPB_Core's MemFree on results when
+ * done.
+ */
+ void SearchString(
+ [in] PP_Instance instance,
+ [in] mem_t string,
+ [in] mem_t term,
+ [in] PP_Bool case_sensitive,
+ [out, size_is(count)] PP_PrivateFindResult[] results,
+ [out] int32_t count);
+
+ /* Since WebFrame doesn't know about PPAPI requests, it'll think the page has
+ * finished loading even if there are outstanding requests by the plugin.
+ * Take this out once WebFrame knows about requests by PPAPI plugins.
+ */
+ void DidStartLoading(
+ [in] PP_Instance instance);
+ void DidStopLoading(
+ [in] PP_Instance instance);
+
+ /* Sets content restriction for a full-page plugin (i.e. can't copy/print).
+ * The value is a bitfield of ContentRestriction enums.
+ */
+ void SetContentRestriction(
+ [in] PP_Instance instance,
+ [in] int32_t restrictions);
+
+ /* Use UMA so we know average pdf page count. */
+ void HistogramPDFPageCount(
+ [in] int32_t count);
+
+ /* Notifies the browser that the given action has been performed. */
+ void UserMetricsRecordAction(
+ [in] PP_Var action);
+
+ /* Notifies the browser that the PDF has an unsupported feature. */
+ void HasUnsupportedFeature(
+ [in] PP_Instance instance);
+};
diff --git a/ppapi/api/private/ppb_proxy_private.idl b/ppapi/api/private/ppb_proxy_private.idl
new file mode 100644
index 0000000..b455636
--- /dev/null
+++ b/ppapi/api/private/ppb_proxy_private.idl
@@ -0,0 +1,17 @@
+/* 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.
+ */
+
+/* Exposes functions needed by the out-of-process proxy to call into the
+ * renderer PPAPI implementation.
+ */
+interface PPB_Proxy_Private_0_2 {
+ /* Called when the given plugin process has crashed. */
+ void PluginCrashed(
+ [in] PP_Module module);
+
+ /* Returns the instance for the given resource, or 0 on failure. */
+ PP_Instance GetInstanceForResource(
+ [in] PP_Resource resource);
+};
diff --git a/ppapi/api/trusted/ppb_audio_trusted.idl b/ppapi/api/trusted/ppb_audio_trusted.idl
new file mode 100644
index 0000000..775ef15
--- /dev/null
+++ b/ppapi/api/trusted/ppb_audio_trusted.idl
@@ -0,0 +1,43 @@
+/* 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 audio interface. */
+
+/* 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. */
+ PP_Resource CreateTrusted(
+ [in] PP_Instance instance);
+
+ /* 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,
+ * do not use the blocking variant of PP_CompletionCallback.
+ */
+ int32_t Open(
+ [in] PP_Resource audio,
+ [in] PP_Resource config,
+ [in] PP_CompletionCallback create_callback);
+
+ /* 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.
+ * Returns PP_OK on success.
+ */
+ int32_t GetSharedMemory(
+ [in] PP_Resource audio,
+ [out] handle_t shm_handle,
+ [out] uint32_t shm_size);
+};
diff --git a/ppapi/api/trusted/ppb_image_data_trusted.idl b/ppapi/api/trusted/ppb_image_data_trusted.idl
new file mode 100644
index 0000000..d9339c4
--- /dev/null
+++ b/ppapi/api/trusted/ppb_image_data_trusted.idl
@@ -0,0 +1,20 @@
+/* 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 ImageData interface. */
+
+/* Trusted interface */
+interface PPB_ImageDataTrusted_0_4 {
+ /* 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
+ * the shared memory in |*handle|.
+ */
+ int32_t GetSharedMemory(
+ [in] PP_Resource image_data,
+ [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
new file mode 100644
index 0000000..1deafa8
--- /dev/null
+++ b/ppapi/api/trusted/ppb_url_loader_trusted.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.
+ */
+
+/* URL loader trusted interfaces. */
+
+/* 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);
+
+/* 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);
+
+ /* 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.
+ *
+ * The other serious gotcha with this callback is that the callback must not
+ * mutate the URL loader or cause it to be destroyed.
+ *
+ * However, the proxy layer needs this information to push to the other
+ * process, so we expose it here. Only one callback can be set per URL
+ * Loader. Setting to a NULL callback will disable it.
+ */
+ void RegisterStatusCallback(
+ [in] PP_Resource loader,
+ [in] PP_URLLoaderTrusted_StatusCallback cb);
+};