diff options
Diffstat (limited to 'ppapi/c/dev')
41 files changed, 2998 insertions, 0 deletions
diff --git a/ppapi/c/dev/pp_cursor_type_dev.h b/ppapi/c/dev/pp_cursor_type_dev.h new file mode 100644 index 0000000..b7a113a --- /dev/null +++ b/ppapi/c/dev/pp_cursor_type_dev.h @@ -0,0 +1,53 @@ +// 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. + +#ifndef PPAPI_C_DEV_PP_CURSORTYPE_DEV_H_ +#define PPAPI_C_DEV_PP_CURSORTYPE_DEV_H_ + +enum PP_CursorType_Dev { + PP_CURSORTYPE_POINTER = 0, + PP_CURSORTYPE_CROSS = 1, + PP_CURSORTYPE_HAND = 2, + PP_CURSORTYPE_IBEAM = 3, + PP_CURSORTYPE_WAIT = 4, + PP_CURSORTYPE_HELP = 5, + PP_CURSORTYPE_EASTRESIZE = 6, + PP_CURSORTYPE_NORTHRESIZE = 7, + PP_CURSORTYPE_NORTHEASTRESIZE = 8, + PP_CURSORTYPE_NORTHWESTRESIZE = 9, + PP_CURSORTYPE_SOUTHRESIZE = 10, + PP_CURSORTYPE_SOUTHEASTRESIZE = 11, + PP_CURSORTYPE_SOUTHWESTRESIZE = 12, + PP_CURSORTYPE_WESTRESIZE = 13, + PP_CURSORTYPE_NORTHSOUTHRESIZE = 14, + PP_CURSORTYPE_EASTWESTRESIZE = 15, + PP_CURSORTYPE_NORTHEASTSOUTHWESTRESIZE = 16, + PP_CURSORTYPE_NORTHWESTSOUTHEASTRESIZE = 17, + PP_CURSORTYPE_COLUMNRESIZE = 18, + PP_CURSORTYPE_ROWRESIZE = 19, + PP_CURSORTYPE_MIDDLEPANNING = 20, + PP_CURSORTYPE_EASTPANNING = 21, + PP_CURSORTYPE_NORTHPANNING = 22, + PP_CURSORTYPE_NORTHEASTPANNING = 23, + PP_CURSORTYPE_NORTHWESTPANNING = 24, + PP_CURSORTYPE_SOUTHPANNING = 25, + PP_CURSORTYPE_SOUTHEASTPANNING = 26, + PP_CURSORTYPE_SOUTHWESTPANNING = 27, + PP_CURSORTYPE_WESTPANNING = 28, + PP_CURSORTYPE_MOVE = 29, + PP_CURSORTYPE_VERTICALTEXT = 30, + PP_CURSORTYPE_CELL = 31, + PP_CURSORTYPE_CONTEXTMENU = 32, + PP_CURSORTYPE_ALIAS = 33, + PP_CURSORTYPE_PROGRESS = 34, + PP_CURSORTYPE_NODROP = 35, + PP_CURSORTYPE_COPY = 36, + PP_CURSORTYPE_NONE = 37, + PP_CURSORTYPE_NOTALLOWED = 38, + PP_CURSORTYPE_ZOOMIN = 39, + PP_CURSORTYPE_ZOOMOUT = 40, + PP_CURSORTYPE_CUSTOM = 41 +}; + +#endif // PPAPI_C_DEV_PP_CURSORTYPE_DEV_H_ diff --git a/ppapi/c/dev/pp_file_info_dev.h b/ppapi/c/dev/pp_file_info_dev.h new file mode 100644 index 0000000..c1e1a07 --- /dev/null +++ b/ppapi/c/dev/pp_file_info_dev.h @@ -0,0 +1,32 @@ +// 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. + +#ifndef PPAPI_C_DEV_PP_FILE_INFO_DEV_H_ +#define PPAPI_C_DEV_PP_FILE_INFO_DEV_H_ + +#include "ppapi/c/pp_stdint.h" +#include "ppapi/c/pp_time.h" + +typedef enum { + PP_FILETYPE_REGULAR, + PP_FILETYPE_DIRECTORY, + PP_FILETYPE_OTHER // A catch-all for unidentified types. +} PP_FileType_Dev; + +typedef enum { + PP_FILESYSTEMTYPE_EXTERNAL, + PP_FILESYSTEMTYPE_LOCALPERSISTENT, + PP_FILESYSTEMTYPE_LOCALTEMPORARY +} PP_FileSystemType_Dev; + +struct PP_FileInfo_Dev { + int64_t size; // Measured in bytes + PP_FileType_Dev type; + PP_FileSystemType_Dev system_type; + PP_Time creation_time; + PP_Time last_access_time; + PP_Time last_modified_time; +}; + +#endif // PPAPI_C_DEV_PP_FILE_INFO_DEV_H_ diff --git a/ppapi/c/dev/pp_video_dev.h b/ppapi/c/dev/pp_video_dev.h new file mode 100644 index 0000000..92b9f37 --- /dev/null +++ b/ppapi/c/dev/pp_video_dev.h @@ -0,0 +1,290 @@ +// 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. + +#ifndef PPAPI_C_DEV_PP_VIDEO_DEV_H_ +#define PPAPI_C_DEV_PP_VIDEO_DEV_H_ + +#include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_resource.h" +#include "ppapi/c/pp_stdint.h" + +enum PP_VideoKey_Dev { + PP_VIDEOKEY_NONE = 0, + // Value is type of PP_VideoCodecId. + PP_VIDEOKEY_CODECID, + // Value is type of PP_VideoOperation. + PP_VIDEOKEY_OPERATION, + // Value is type of PP_VideoCodecProfile. + PP_VIDEOKEY_CODECPROFILE, + // Value is type of PP_VideoCodecLevel. + PP_VIDEOKEY_CODECLEVEL, + // Value is 0 or 1. + PP_VIDEOKEY_ACCELERATION, + // Value is type of PP_VideoPayloadFormat. + PP_VIDEOKEY_PAYLOADFORMAT, + // Value is type of PP_VideoFrameColorType. + PP_VIDEOKEY_COLORTYPE, + // Value is type of PP_VideoFrameSurfaceType. + PP_VIDEOKEY_SURFACETYPE, + // Value is type of PP_VideoFrameInfoFlag. + PP_VIDEOKEY_FRAMEINFOFLAG, + + // Subset for H.264 features, value of 1 means supported. This is needed in + // case decoder has partial support for certain profile. + PP_VIDEOKEY_H264FEATURE_FMO = 0x100, + PP_VIDEOKEY_H264FEATURE_ASO, + PP_VIDEOKEY_H264FEATURE_INTERLACE, + PP_VIDEOKEY_H264FEATURE_CABAC, + PP_VIDEOKEY_H264FEATURE_WEIGHTEDPREDICTION +}; + +enum PP_VideoDecoderEvent_Dev { + PP_VIDEODECODEREVENT_NONE = 0, + // Signaling that an error has been hit. + PP_VIDEODECODEREVENT_ERROR, + // Signaling new width/height of video frame + PP_VIDEODECODEREVENT_NEWDIMENSION, + // Signaling new cropping rectangle + PP_VIDEODECODEREVENT_NEWCROP +}; + +enum PP_VideoDecodeError_Dev { + PP_VIDEODECODEERROR_NONE = 0, + PP_VIDEODECODEERROR_NOTSUPPORTED, + PP_VIDEODECODEERROR_INSUFFICIENTRESOURCES, + PP_VIDEODECODEERROR_UNDEFINED, + PP_VIDEODECODEERROR_BADINPUT, + PP_VIDEODECODEERROR_HARDWARE +}; + +enum PP_VideoCodecId_Dev { + PP_VIDEODECODECID_NONE = 0, + PP_VIDEODECODECID_H264, + PP_VIDEODECODECID_VC1, + PP_VIDEODECODECID_MPEG2, + PP_VIDEODECODECID_VP8 +}; + +enum PP_VideoOperation_Dev { + PP_VIDEOOPERATION_NONE = 0, + PP_VIDEOOPERATION_DECODE, + PP_VIDEOOPERATION_ENCODE +}; + +enum PP_VideoCodecProfile_Dev { + PP_VIDEOCODECPROFILE_NONE = 0, + PP_VIDEOCODECPROFILE_H264_BASELINE, + PP_VIDEOCODECPROFILE_H264_MAIN, + PP_VIDEOCODECPROFILE_H264_EXTENDED, + PP_VIDEOCODECPROFILE_H264_HIGH, + PP_VIDEOCODECPROFILE_H264_SCALABLEBASELINE, + PP_VIDEOCODECPROFILE_H264_SCALABLEHIGH, + PP_VIDEOCODECPROFILE_H264_STEREOHIGH, + PP_VIDEOCODECPROFILE_H264_MULTIVIEWHIGH, + + PP_VIDEOCODECPROFILE_VC1_SIMPLE = 0x40, + PP_VIDEOCODECPROFILE_VC1_MAIN, + PP_VIDEOCODECPROFILE_VC1_ADVANCED, + + PP_VIDEOCODECPROFILE_MPEG2_SIMPLE = 0x80, + PP_VIDEOCODECPROFILE_MPEG2_MAIN, + PP_VIDEOCODECPROFILE_MPEG2_SNR, + PP_VIDEOCODECPROFILE_MPEG2_SPATIAL, + PP_VIDEOCODECPROFILE_MPEG2_HIGH +}; + +enum PP_VideoCodecLevel_Dev { + PP_VIDEOCODECLEVEL_NONE = 0, + PP_VIDEOCODECLEVEL_H264_10, + PP_VIDEOCODECLEVEL_H264_1B, + PP_VIDEOCODECLEVEL_H264_11, + PP_VIDEOCODECLEVEL_H264_12, + PP_VIDEOCODECLEVEL_H264_13, + PP_VIDEOCODECLEVEL_H264_20, + PP_VIDEOCODECLEVEL_H264_21, + PP_VIDEOCODECLEVEL_H264_22, + PP_VIDEOCODECLEVEL_H264_30, + PP_VIDEOCODECLEVEL_H264_31, + PP_VIDEOCODECLEVEL_H264_32, + PP_VIDEOCODECLEVEL_H264_40, + PP_VIDEOCODECLEVEL_H264_41, + PP_VIDEOCODECLEVEL_H264_42, + PP_VIDEOCODECLEVEL_H264_50, + PP_VIDEOCODECLEVEL_H264_51, + + PP_VIDEOCODECLEVEL_VC1_LOW = 0x40, + PP_VIDEOCODECLEVEL_VC1_MEDIUM, + PP_VIDEOCODECLEVEL_VC1_HIGH, + PP_VIDEOCODECLEVEL_VC1_L0, + PP_VIDEOCODECLEVEL_VC1_L1, + PP_VIDEOCODECLEVEL_VC1_L2, + PP_VIDEOCODECLEVEL_VC1_L3, + PP_VIDEOCODECLEVEL_VC1_L4, + + PP_VIDEOCODECLEVEL_MPEG2_LOW = 0x80, + PP_VIDEOCODECLEVEL_MPEG2_MAIN, + PP_VIDEOCODECLEVEL_MPEG2_HIGH1440, + PP_VIDEOCODECLEVEL_MPEG2_HIGH +}; + +enum PP_VideoPayloadFormat_Dev { + PP_VIDEOPAYLOADFORMAT_NONE = 0, + PP_VIDEOPAYLOADFORMAT_BYTESTREAM, + PP_VIDEOPAYLOADFORMAT_RTPPAYLOAD +}; + +enum PP_VideoFrameColorType_Dev { + PP_VIDEOFRAMECOLORTYPE_NONE = 0, + PP_VIDEOFRAMECOLORTYPE_RGB565, + PP_VIDEOFRAMECOLORTYPE_ARGB8888, + PP_VIDEOFRAMECOLORTYPE_YUV, + PP_VIDEOFRAMECOLORTYPE_Monochrome, + PP_VIDEOFRAMECOLORTYPE_YUV420PLANAR, + PP_VIDEOFRAMECOLORTYPE_YUV422PLANAR, + PP_VIDEOFRAMECOLORTYPE_YUV444PLANAR +}; + +enum PP_VideoFrameSurfaceType_Dev { + PP_VIDEOFRAMESURFACETYPE_NONE = 0, + PP_VIDEOFRAMESURFACETYPE_SYSTEMMEMORY, + PP_VIDEOFRAMESURFACETYPE_GLTEXTURE, + PP_VIDEOFRAMESURFACETYPE_PIXMAP +}; + +enum PP_VideoFrameInfoFlag_Dev { + PP_VIDEOFRAMEINFOFLAG_NONE = 0, + // Indicate this is the end of stream. Used by both plugin and browser. + PP_VIDEOFRAMEINFOFLAG_EOS = 1 << 0, + // Decode the frame only, don't return decoded frame. Used by plugin. + PP_VIDEOFRAMEINFOFLAG_NOEMIT = 1 << 1, + // Indicate this is an anchor frame. Used by plugin. + PP_VIDEOFRAMEINFOFLAG_SYNCFRAME = 1 << 2, + // Indicate the decoded frame has data corruption. Used by browser. + PP_VIDEOFRAMEINFOFLAG_DATACORRUPT = 1 << 3 +}; + +enum PP_VideoFrameBufferConst_Dev { + // YUV formats + PP_VIDEOFRAMEBUFFER_YPLANE = 0, + PP_VIDEOFRAMEBUFFER_UPLANE = 1, + PP_VIDEOFRAMEBUFFER_VPLANE = 2, + PP_VIDEOFRAMEBUFFER_NUMBERYUVPLANES = 3, + + // RGBA formats + PP_VIDEOFRAMEBUFFER_RGBAPLANE = 0, + PP_VIDEOFRAMEBUFFER_NUMBERRGBAPLANES = 1, + + PP_VIDEOFRAMEBUFFER_MAXNUMBERPLANES = 4 +}; + +typedef int64_t PP_VideoDecodeData_Dev; + +// Array of key/value pairs describing video configuration. +// It could include any keys from PP_VideoKey. Its last element shall be +// PP_VIDEOKEY_NONE with no corresponding value. +// An example: +// { +// PP_VIDEOKEY_CODECID, PP_VIDEODECODECID_H264, +// PP_VIDEOKEY_OPERATION, PP_VIDEOOPERATION_DECODE, +// PP_VIDEOKEY_CODECPROFILE, PP_VIDEOCODECPROFILE_H264_HIGH, +// PP_VIDEOKEY_CODECLEVEL, PP_VIDEOCODECLEVEL_H264_41, +// PP_VIDEOKEY_ACCELERATION, 1 +// PP_VIDEOKEY_NONE, +// }; +typedef int32_t* PP_VideoConfig_Dev; +typedef int32_t PP_VideoConfigElement_Dev; + +// The data structure for compressed data buffer. +struct PP_VideoCompressedDataBuffer_Dev { + // The buffer is created through PPB_Buffer API. + // TODO(wjia): would uint8_t* be good, too? + PP_Resource buffer; + // number of bytes with real data in the buffer. + int32_t filled_size; + + // Time stamp of the frame in microsecond. + uint64_t time_stamp_us; + + // Bit mask of PP_VideoFrameInfoFlag. + uint32_t flags; +}; + +struct PP_VideoFrameBuffer_Dev { + union { + struct { + int32_t planes; + struct { + int32_t width; + int32_t height; + int32_t stride; + + // TODO(wjia): uint8* would be better for some cases. + PP_Resource buffer; + } data_plane[PP_VIDEOFRAMEBUFFER_MAXNUMBERPLANES]; + } sys_mem; + + // Handle for pixmap, gl texture, etc. + void* handle; + } buffer; + + // Storage for decoder to save some private data. It could be useful when + // plugin returns frame buffer to decoder. + void* private_handle; +}; + +struct PP_VideoUncompressedDataBuffer_Dev { + PP_VideoConfig_Dev format; + struct PP_VideoFrameBuffer_Dev buffer; + + // Time stamp of the frame in microsecond. + uint64_t time_stamp_us; + + // Bit mask of PP_VideoFrameInfoFlag. + uint32_t flags; + + // Output from decoder, indicating the decoded frame has error pixels. This + // could be resulted from corrupted input bit stream and error concealment + // in decoding. + // TODO(wjia): add more info about error pixels, such as error MB map, etc. + bool has_error; +}; + +// Plugin callback for decoder to deliver decoded frame buffers. +// |format| in |buffer| specifies the format of decoded frame, with +// PP_VIDEOKEY_COLORTYPE and PP_VIDEOKEY_SURFACETYPE required. +typedef void (*PP_VideoDecodeOutputCallback_Func_Dev)( + PP_Instance instance, + struct PP_VideoUncompressedDataBuffer_Dev* buffer); + +// Plugin callback for decoder to return input data buffers. +// Plugin can optionally provide this callback only when it wants to recycle +// input data buffers. +typedef void (*PP_VideoDecodeInputCallback_Func_Dev)( + PP_Instance instance, + struct PP_VideoCompressedDataBuffer_Dev* buffer); + +// Event handling Function for decoder to deliver events to plugin. +// The correspondence between event and data1, data2: +// When event == PP_VIDEODECODEREVENT_ERROR, +// data1 is type of PP_VideoDecodeError id and data2 is ignored; +// When event == PP_VIDEODECODEREVENT_NEWDIMENSION, +// data1 is type of PP_Size*, data2 is ignored; +// When event == PP_VIDEODECODEREVENT_NEWCROP, +// data1 is type of PP_Rect*, data2 is ignored; +typedef void (*PP_VideoDecodeEventHandler_Func_Dev)( + PP_Instance instance, + PP_VideoDecoderEvent_Dev event, + PP_VideoDecodeData_Dev data1, + PP_VideoDecodeData_Dev data2); + +// Requested decoder configuration and callback from plugin. +struct PP_VideoDecoderConfig_Dev { + PP_VideoConfig_Dev input_format; + PP_VideoConfig_Dev output_format; + PP_VideoDecodeOutputCallback_Func_Dev output_callback; + PP_VideoDecodeInputCallback_Func_Dev input_callback; + PP_VideoDecodeEventHandler_Func_Dev event_handler; +}; + +#endif // PPAPI_C_DEV_PP_VIDEO_DEV_H_ diff --git a/ppapi/c/dev/ppb_audio_config_dev.h b/ppapi/c/dev/ppb_audio_config_dev.h new file mode 100644 index 0000000..01079a9 --- /dev/null +++ b/ppapi/c/dev/ppb_audio_config_dev.h @@ -0,0 +1,94 @@ +// 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. + +#ifndef PPAPI_C_DEV_PPB_AUDIO_CONFIG_DEV_H_ +#define PPAPI_C_DEV_PPB_AUDIO_CONFIG_DEV_H_ + +#include "ppapi/c/pp_module.h" +#include "ppapi/c/pp_resource.h" +#include "ppapi/c/pp_stdint.h" + +#define PPB_AUDIO_CONFIG_DEV_INTERFACE "PPB_AudioConfig(Dev);0.2" + +enum { + PP_AUDIOMINSAMPLEFRAMECOUNT = 64, + PP_AUDIOMAXSAMPLEFRAMECOUNT = 32768 +}; + +typedef enum { + PP_AUDIOSAMPLERATE_NONE = 0, + PP_AUDIOSAMPLERATE_44100 = 44100, + PP_AUDIOSAMPLERATE_48000 = 48000 +} PP_AudioSampleRate_Dev; + +/** + * Audio configuration. This base configuration interface supports only stereo + * 16bit output. This class is not mutable, therefore it is okay to access + * instances from different threads. + */ +struct PPB_AudioConfig_Dev { + /** + * 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)(PP_Module module, + PP_AudioSampleRate_Dev sample_rate, + 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 0 as the requested sample count, the recommended sample for + * the local system is returned. + */ + uint32_t (*RecommendSampleFrameCount)(uint32_t requested_sample_frame_count); + + /** + * Returns true if the given resource is an AudioConfig object. + */ + bool (*IsAudioConfig)(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_Dev (*GetSampleRate)(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)(PP_Resource config); +}; + +#endif // PPAPI_C_DEV_PPB_AUDIO_CONFIG_DEV_H_ + diff --git a/ppapi/c/dev/ppb_audio_dev.h b/ppapi/c/dev/ppb_audio_dev.h new file mode 100644 index 0000000..cc567414 --- /dev/null +++ b/ppapi/c/dev/ppb_audio_dev.h @@ -0,0 +1,71 @@ +// 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. + +#ifndef PPAPI_C_DEV_PPB_AUDIO_DEV_H_ +#define PPAPI_C_DEV_PPB_AUDIO_DEV_H_ + +#include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_module.h" +#include "ppapi/c/pp_resource.h" +#include "ppapi/c/pp_stdint.h" + +#define PPB_AUDIO_DEV_INTERFACE "PPB_Audio(Dev);0.2" + +// Callback function type for SetCallback. +typedef void (*PPB_Audio_Callback)(void* sample_buffer, + size_t buffer_size_in_bytes, + void* 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(); +// +struct PPB_Audio_Dev { + // 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)(PP_Instance instance, PP_Resource config, + PPB_Audio_Callback audio_callback, void* user_data); + + /** + * Returns true if the given resource is an Audio resource. + */ + bool (*IsAudio)(PP_Resource resource); + + // Get the current configuration. + PP_Resource (*GetCurrentConfig)(PP_Resource audio); + + // Start the playback. Begin periodically calling the callback. If called + // while playback is already in progress, will return true and be a no-op. + // On error, return false. + bool (*StartPlayback)(PP_Resource audio); + + // Stop the playback. If playback is already stopped, this is a no-op and + // returns true. On error, returns false. If a callback is in progress, + // StopPlayback will block until callback completes. + bool (*StopPlayback)(PP_Resource audio); +}; + +#endif // PPAPI_C_DEV_PPB_DEVICE_CONTEXT_AUDIO_DEV_H_ + diff --git a/ppapi/c/dev/ppb_audio_trusted_dev.h b/ppapi/c/dev/ppb_audio_trusted_dev.h new file mode 100644 index 0000000..acb883f --- /dev/null +++ b/ppapi/c/dev/ppb_audio_trusted_dev.h @@ -0,0 +1,27 @@ +// 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. + +#ifndef PPAPI_C_DEV_PPB_AUDIO_TRUSTED_DEV_H_ +#define PPAPI_C_DEV_PPB_AUDIO_TRUSTED_DEV_H_ + +#include "ppapi/c/pp_resource.h" + +#define PPB_AUDIO_TRUSTED_DEV_INTERFACE "PPB_AudioTrusted(Dev);0.1" + +// This interface is used to get access to the audio buffer and a socket on +// which the client can block until the audio is ready to accept more data. +// This interface should be used by NaCl to implement the Audio interface. +struct PPB_AudioTrusted_Dev { + // Returns a Buffer object that has the audio buffer. + PP_Resource (*GetBuffer)(PP_Resource audio); + + // Returns a select()-able/Wait()-able OS-specific descriptor. The browser + // will put a byte on the socket each time the buffer is ready to be filled. + // The plugin can then implement its own audio thread using select()/poll() to + // block until the browser is ready to receive data. + int (*GetOSDescriptor)(PP_Resource audio); +}; + +#endif // PPAPI_C_DEV_PPB_AUDIO_TRUSTED_DEV_H_ + diff --git a/ppapi/c/dev/ppb_buffer_dev.h b/ppapi/c/dev/ppb_buffer_dev.h new file mode 100644 index 0000000..416ab0b --- /dev/null +++ b/ppapi/c/dev/ppb_buffer_dev.h @@ -0,0 +1,36 @@ +// 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. + +#ifndef PPAPI_C_DEV_PPB_BUFFER_DEV_H_ +#define PPAPI_C_DEV_PPB_BUFFER_DEV_H_ + +#include "ppapi/c/pp_module.h" +#include "ppapi/c/pp_resource.h" +#include "ppapi/c/pp_stdint.h" + +#define PPB_BUFFER_DEV_INTERFACE "PPB_Buffer(Dev);0.1" + +struct PPB_Buffer_Dev { + // Allocates a buffer of the given size in bytes. The return value will have + // a non-zero ID on success, or zero on failure. Failure means the module + // handle was invalid. The buffer will be initialized to contain zeroes. + PP_Resource (*Create)(PP_Module module, int32_t size_in_bytes); + + // Returns true if the given resource is a Buffer. Returns false if the + // resource is invalid or some type other than a Buffer. + bool (*IsBuffer)(PP_Resource resource); + + // Gets the size of the buffer. Returns true on success, false + // if the resource is not a buffer. On failure, |*size_in_bytes| is not set. + bool (*Describe)(PP_Resource resource, int32_t* size_in_bytes); + + // Maps this buffer into the plugin address space and returns a pointer to the + // beginning of the data. + void* (*Map)(PP_Resource resource); + + void (*Unmap)(PP_Resource resource); +}; + +#endif // PPAPI_C_DEV_PPB_BUFFER_DEV_H_ + diff --git a/ppapi/c/dev/ppb_char_set_dev.h b/ppapi/c/dev/ppb_char_set_dev.h new file mode 100644 index 0000000..382e1a8 --- /dev/null +++ b/ppapi/c/dev/ppb_char_set_dev.h @@ -0,0 +1,78 @@ +// 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. + +#ifndef PPAPI_C_DEV_PPB_CHAR_SET_DEV_H_ +#define PPAPI_C_DEV_PPB_CHAR_SET_DEV_H_ + +#include "ppapi/c/pp_module.h" +#include "ppapi/c/pp_stdint.h" +#include "ppapi/c/pp_var.h" + +#define PPB_CHAR_SET_DEV_INTERFACE "PPB_CharSet(Dev);0.1" + +// Specifies the error behavior for the character set conversion functions. +// This will affect two cases: where the input is not encoded correctly, and +// when the requested character can not be converted to the destination +// character set. +enum PP_CharSet_ConversionError { + // Causes the entire conversion to fail if an error is encountered. The + // conversion function will return NULL. + PP_CHARSET_CONVERSIONERROR_FAIL, + + // Silently skips over errors. Unrepresentable characters and input encoding + // errors will be removed from the output. + PP_CHARSET_CONVERSIONERROR_SKIP, + + // Replaces the error or unrepresentable character with a substitution + // character. When converting to a Unicode character set (UTF-8 or UTF-16) + // it will use the unicode "substitution character" U+FFFD. When converting + // to another character set, the character will be charset-specific. For + // many languages this will be the representation of the '?' character. + PP_CHARSET_CONVERSIONERROR_SUBSTITUTE, +}; + +struct PPB_CharSet_Dev { + // Converts the UTF-16 string pointed to in |*utf16| to an 8-bit string in the + // specified code page. |utf16_len| is measured in UTF-16 units, not bytes. + // This value may not be NULL. + // + // The return value is a NULL-terminated 8-bit string corresponding to the + // new character set, or NULL on failure. THIS STRING MUST BE FREED USING + // PPB_Core::MemFree(). The length of the returned string, not including the + // terminating NULL, will be placed into *output_length. When there is no + // error, the result will always be non-NULL, even if the output is 0-length. + // In this case, it will only contain the terminator. You must still call + // MemFree any time the return value is non-NULL. + // + // This function will return NULL if there was an error converting the string + // and you requested PP_CHARSET_CONVERSIONERROR_FAIL, or the output character + // set was unknown. + char* (*UTF16ToCharSet)(const uint16_t* utf16, uint32_t utf16_len, + const char* output_char_set, + PP_CharSet_ConversionError on_error, + uint32_t* output_length); + + // Same as UTF16ToCharSet except converts in the other direction. The input + // is in the given charset, and the |input_len| is the number of bytes in + // the |input| string. |*output_length| is the number of 16-bit values in + // the output not counting the terminating NULL. + // + // Since UTF16 can represent every Unicode character, the only time the + // replacement character will be used is if the encoding in the input string + // is incorrect. + uint16_t* (*CharSetToUTF16)(const char* input, uint32_t input_len, + const char* input_char_set, + PP_CharSet_ConversionError on_error, + uint32_t* output_length); + + // Returns a string var representing the current multi-byte character set of + // the current system. + // + // WARNING: You really shouldn't be using this function unless you're dealing + // with legacy data. You should be using UTF-8 or UTF-16 and you don't have + // to worry about the character sets. + PP_Var (*GetDefaultCharSet)(PP_Module module); +}; + +#endif // PPAPI_C_DEV_PPB_CHAR_SET_DEV_H_ diff --git a/ppapi/c/dev/ppb_cursor_control_dev.h b/ppapi/c/dev/ppb_cursor_control_dev.h new file mode 100644 index 0000000..7a38767 --- /dev/null +++ b/ppapi/c/dev/ppb_cursor_control_dev.h @@ -0,0 +1,56 @@ +// 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. + +#ifndef PPAPI_C_DEV_PPB_CURSOR_CONTROL_DEV_H_ +#define PPAPI_C_DEV_PPB_CURSOR_CONTROL_DEV_H_ + +#include "ppapi/c/dev/pp_cursor_type_dev.h" +#include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_point.h" +#include "ppapi/c/pp_resource.h" + +#define PPB_CURSOR_CONTROL_DEV_INTERFACE "PPB_CursorControl(Dev);0.1" + +struct PPB_CursorControl_Dev { + // Set a cursor. If "type" is PP_CURSOR_TYPE_CUSTOM, then "custom_image" + // must be an ImageData resource containing the cursor and "hot_spot" must + // contain the offset within that image that refers to the cursor's position. + bool (*SetCursor)(PP_Instance instance, + enum PP_CursorType_Dev type, + PP_Resource custom_image, + const struct PP_Point* hot_spot); + + // This method causes the cursor to be moved to the center of the + // instance and be locked, preventing the user from moving it. + // The cursor is implicitly hidden from the user while locked. + // Cursor lock may only be requested in response to a + // PP_InputEvent_MouseDown, and then only if the event was generated via + // user gesture. + // + // While the cursor is locked, any movement of the mouse will + // generate a PP_InputEvent_Type_MouseMove, whose x and y values + // indicate the position the cursor would have been moved to had + // the cursor not been locked, and had the screen been infinite in size. + // + // The browser may revoke cursor lock for reasons including but not + // limited to the user pressing the ESC key, the user activating + // another program via a reserved keystroke (e.g., ALT+TAB), or + // some other system event. + // + // Returns true if the cursor could be locked. + bool (*LockCursor)(PP_Instance); + + // Causes the cursor to be unlocked, allowing it to track user + // movement again. + bool (*UnlockCursor)(PP_Instance); + + // Returns true if the cursor is locked. + bool (*HasCursorLock)(PP_Instance); + + // Returns true if the cursor can be locked. + bool (*CanLockCursor)(PP_Instance); +}; + +#endif // PPAPI_C_DEV_PPB_CURSOR_CONTROL_DEV_H_ + diff --git a/ppapi/c/dev/ppb_directory_reader_dev.h b/ppapi/c/dev/ppb_directory_reader_dev.h new file mode 100644 index 0000000..84983f5 --- /dev/null +++ b/ppapi/c/dev/ppb_directory_reader_dev.h @@ -0,0 +1,52 @@ +// 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. + +#ifndef PPAPI_C_DEV_PPB_DIRECTORY_READER_DEV_H_ +#define PPAPI_C_DEV_PPB_DIRECTORY_READER_DEV_H_ + +#include "ppapi/c/dev/pp_file_info_dev.h" +#include "ppapi/c/pp_module.h" +#include "ppapi/c/pp_resource.h" + +struct PP_CompletionCallback; + +struct PP_DirectoryEntry_Dev { + PP_Resource file_ref; + PP_FileType_Dev file_type; +}; + +#define PPB_DIRECTORYREADER_DEV_INTERFACE "PPB_DirectoryReader(Dev);0.1" + +struct PPB_DirectoryReader_Dev { + // Creates a DirectoryReader for the given directory. Upon success, the + // corresponding directory is classified as "in use" by the resulting + // DirectoryReader object until such time as the DirectoryReader object is + // destroyed. + PP_Resource (*Create)(PP_Resource directory_ref); + + // Returns true if the given resource is a DirectoryReader. Returns false if + // the resource is invalid or some type other than a DirectoryReader. + bool (*IsDirectoryReader)(PP_Resource resource); + + // Reads the next entry in the directory. Return PP_OK and sets + // entry->file_ref to 0 to indicate reaching the end of the directory. If + // entry->file_ref is non-zero when passed to GetNextEntry, it will be + // released before the next file_ref is stored. + // + // EXAMPLE USAGE: + // + // PP_Resource reader = reader_funcs->Create(dir_ref); + // PP_DirectoryEntry entry = {0}; + // while (reader_funcs->GetNextEntry(reader, &entry, + // PP_BlockUntilComplete()) == PP_OK) { + // ProcessDirectoryEntry(entry); + // } + // core_funcs->ReleaseResource(reader); + // + int32_t (*GetNextEntry)(PP_Resource directory_reader, + struct PP_DirectoryEntry_Dev* entry, + struct PP_CompletionCallback callback); +}; + +#endif // PPAPI_C_DEV_PPB_DIRECTORY_READER_DEV_H_ diff --git a/ppapi/c/dev/ppb_file_chooser_dev.h b/ppapi/c/dev/ppb_file_chooser_dev.h new file mode 100644 index 0000000..d5b06faa --- /dev/null +++ b/ppapi/c/dev/ppb_file_chooser_dev.h @@ -0,0 +1,57 @@ +// 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. + +#ifndef PPAPI_C_DEV_PPB_FILE_CHOOSER_DEV_H_ +#define PPAPI_C_DEV_PPB_FILE_CHOOSER_DEV_H_ + +#include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_resource.h" + +struct PP_CompletionCallback; + +typedef enum { + PP_FILECHOOSERMODE_OPEN, + PP_FILECHOOSERMODE_OPENMULTIPLE + // TODO(darin): Should there be a way to choose a directory? +} PP_FileChooserMode_Dev; + +struct PP_FileChooserOptions_Dev { + PP_FileChooserMode_Dev mode; + + // A comma-separated list of MIME types such as audio/*,text/plain. The + // dialog may restrict selectable files to the specified MIME types. + // TODO(darin): What if the mime type is unknown to the system? The plugin + // may wish to describe the mime type and provide a matching file extension. + // It is more webby to use mime types here instead of file extensions. + const char* accept_mime_types; +}; + +#define PPB_FILECHOOSER_DEV_INTERFACE "PPB_FileChooser(Dev);0.1" + +struct PPB_FileChooser_Dev { + // Creates a file chooser dialog with the specified options. The chooser is + // associated with a particular instance, so that it may be positioned on the + // screen relative to the tab containing the instance. Returns 0 if passed + // an invalid instance. + PP_Resource (*Create)(PP_Instance instance, + const struct PP_FileChooserOptions_Dev* options); + + // Returns true if the given resource is a FileChooser. Returns false if the + // resource is invalid or some type other than a FileChooser. + bool (*IsFileChooser)(PP_Resource resource); + + // Prompts the user to choose a file or files. + int32_t (*Show)(PP_Resource chooser, struct PP_CompletionCallback callback); + + // After a successful call to Show, this method may be used to query the + // chosen files. It should be called in a loop until it returns 0. + // Depending on the PP_ChooseFileMode requested when the FileChooser was + // created, the file refs will either be readable or writable. Their file + // system type will be PP_FileSystemType_External. If the user chose no + // files or cancelled the dialog, then this method will simply return 0 + // the first time it is called. + PP_Resource (*GetNextChosenFile)(PP_Resource chooser); +}; + +#endif // PPAPI_C_DEV_PPB_FILE_CHOOSER_DEV_H_ diff --git a/ppapi/c/dev/ppb_file_io_dev.h b/ppapi/c/dev/ppb_file_io_dev.h new file mode 100644 index 0000000..1dfefd1 --- /dev/null +++ b/ppapi/c/dev/ppb_file_io_dev.h @@ -0,0 +1,115 @@ +// 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. + +#ifndef PPAPI_C_DEV_PPB_FILE_IO_DEV_H_ +#define PPAPI_C_DEV_PPB_FILE_IO_DEV_H_ + +#include "ppapi/c/pp_module.h" +#include "ppapi/c/pp_resource.h" +#include "ppapi/c/pp_stdint.h" +#include "ppapi/c/pp_time.h" + +struct PP_CompletionCallback; +struct PP_FileInfo_Dev; + +typedef enum { + // Requests read access to a file. + PP_FILEOPENFLAG_READ = 1 << 0, + + // Requests write access to a file. May be combined with + // PP_FILEOPENFLAG_READ 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 PP_FILEOPENFLAG_EXCLUSIVE + // 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. PP_FILEOPENFLAG_WRITE must also be specified. + PP_FILEOPENFLAG_TRUNCATE = 1 << 3, + + // Requests that the file is created when this flag is combined with + // PP_FILEOPENFLAG_CREATE. If this flag is specified, and the file already + // exists, then the FileIO::Open call will fail. + PP_FILEOPENFLAG_EXCLUSIVE = 1 << 4 +} PP_FileOpenFlags_Dev; + +#define PPB_FILEIO_DEV_INTERFACE "PPB_FileIO(Dev);0.1" + +// Use this interface to operate on a regular file (PP_FileType_Regular). +struct PPB_FileIO_Dev { + // Creates a new FileIO object. Returns 0 if the module is invalid. + PP_Resource (*Create)(PP_Module module); + + // Returns true if the given resource is a FileIO. Returns false if the + // resource is invalid or some type other than a FileIO. + bool (*IsFileIO)(PP_Resource resource); + + // Open the specified regular file for I/O according to the given open flags, + // which is a bit-mask of the PP_FileOpenFlags 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. + int32_t (*Open)(PP_Resource file_io, + PP_Resource file_ref, + int32_t open_flags, + struct PP_CompletionCallback callback); + + // Queries info about the file opened by this FileIO object. Fails if the + // FileIO object has not been opened. + int32_t (*Query)(PP_Resource file_io, + PP_FileInfo_Dev* info, + struct PP_CompletionCallback callback); + + // Updates timestamps for the file opened by this FileIO object. Fails if + // the FileIO object has not been opened. + int32_t (*Touch)(PP_Resource file_io, + PP_Time last_access_time, + PP_Time last_modified_time, + struct PP_CompletionCallback callback); + + // Read from an offset in the file. 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. If the + // return value is 0, then it indicates that 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)(PP_Resource file_io, + int64_t offset, + char* buffer, + int32_t bytes_to_read, + struct PP_CompletionCallback callback); + + // Write to an offset in the file. May perform a partial write. Returns the + // number of bytes written or an error code. It is valid to call Write + // multiple times with a completion callback to queue up parallel writes to + // the file at different offsets. The FileIO object must have been opened + // with write access. + int32_t (*Write)(PP_Resource file_io, + int64_t offset, + const char* buffer, + int32_t bytes_to_write, + struct PP_CompletionCallback callback); + + // 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. + int32_t (*SetLength)(PP_Resource file_io, + int64_t length, + struct PP_CompletionCallback callback); + + // Flush changes to disk. This call can be very expensive! + int32_t (*Flush)(PP_Resource file_io, + struct PP_CompletionCallback callback); + + // Cancels any IO that may be pending, and closes the FileIO 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 FileIO 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)(PP_Resource file_io); +}; + +#endif // PPAPI_C_DEV_PPB_FILE_IO_DEV_H_ diff --git a/ppapi/c/dev/ppb_file_io_trusted_dev.h b/ppapi/c/dev/ppb_file_io_trusted_dev.h new file mode 100644 index 0000000..f4915fa --- /dev/null +++ b/ppapi/c/dev/ppb_file_io_trusted_dev.h @@ -0,0 +1,45 @@ +// 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. + +#ifndef PPAPI_C_DEV_PPB_FILE_IO_TRUSTED_DEV_H_ +#define PPAPI_C_DEV_PPB_FILE_IO_TRUSTED_DEV_H_ + +#include "ppapi/c/pp_resource.h" +#include "ppapi/c/pp_stdint.h" + +struct PP_CompletionCallback; + +#define PPB_FILEIOTRUSTED_DEV_INTERFACE "PPB_FileIOTrusted(Dev);0.1" + +// Available only to trusted implementations. +struct PPB_FileIOTrusted_Dev { + // Returns a POSIX file descriptor corresponding to the given FileIO object. + // 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)(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)(PP_Resource file_io, + int64_t offset, + int32_t bytes_to_write, + struct 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. + int32_t (*WillSetLength)(PP_Resource file_io, + int64_t length, + struct PP_CompletionCallback callback); + + // 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. +}; + +#endif // PPAPI_C_DEV_PPB_FILE_IO_TRUSTED_DEV_H_ diff --git a/ppapi/c/dev/ppb_file_ref_dev.h b/ppapi/c/dev/ppb_file_ref_dev.h new file mode 100644 index 0000000..fd3a602 --- /dev/null +++ b/ppapi/c/dev/ppb_file_ref_dev.h @@ -0,0 +1,88 @@ +// 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. + +#ifndef PPAPI_C_DEV_PPB_FILE_REF_DEV_H_ +#define PPAPI_C_DEV_PPB_FILE_REF_DEV_H_ + +#include "ppapi/c/dev/pp_file_info_dev.h" +#include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_resource.h" +#include "ppapi/c/pp_var.h" + +#define PPB_FILEREF_DEV_INTERFACE "PPB_FileRef(Dev);0.2" + +// A FileRef is a "weak pointer" to a file in a file system. It contains a +// PP_FileSystemType identifier and a file path string. +struct PPB_FileRef_Dev { + // Creates a weak pointer to a file in the given filesystem. File paths are + // POSIX style. Returns 0 if the path is malformed. + PP_Resource (*Create)(PP_Resource file_system, const char* path); + + // Returns true if the given resource is a FileRef. Returns false if the + // resource is invalid or some type other than a FileRef. + bool (*IsFileRef)(PP_Resource resource); + + // Returns the file system identifier of this file. + PP_FileSystemType_Dev (*GetFileSystemType)(PP_Resource file_ref); + + // Returns the name of the file. + struct PP_Var (*GetName)(PP_Resource file_ref); + + // Returns the absolute path of the file. This method fails if the file + // system type is PP_FileSystemType_External. + struct PP_Var (*GetPath)(PP_Resource file_ref); + + // Returns the parent directory of this file. If file_ref points to the root + // of the filesystem, then the root is returned. This method fails if the + // file system type is PP_FileSystemType_External. + PP_Resource (*GetParent)(PP_Resource file_ref); + + // Makes a new directory in the filesystem as well as any parent directories + // if the make_ancestors parameter is true. It is not valid to make a + // directory in the external filesystem. Fails if the directory already + // exists or if ancestor directories do not exist and make_ancestors was not + // passed as true. + int32_t (*MakeDirectory)(PP_Resource directory_ref, + bool make_ancestors, + struct PP_CompletionCallback callback); + + // Queries info about the file. You must have read access to this file if it + // exists in the external filesystem. + int32_t (*Query)(PP_Resource file_ref, + struct PP_FileInfo_Dev* info, + struct PP_CompletionCallback callback); + + // Updates timestamps for a file. You must have write access to the file if + // it exists in the external filesystem. + int32_t (*Touch)(PP_Resource file_ref, + PP_Time last_access_time, + PP_Time last_modified_time, + struct PP_CompletionCallback callback); + + // Delete a file or directory. If file_ref 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 + // filesystem. + int32_t (*Delete)(PP_Resource file_ref, + struct PP_CompletionCallback callback); + + // Rename a file or directory. file_ref and new_file_ref must both refer to + // files in the same filesystem. 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 filesystem. + int32_t (*Rename)(PP_Resource file_ref, + PP_Resource new_file_ref, + struct PP_CompletionCallback callback); + + // TODO(darin): Add these conversion routines. +#if 0 + // Convert a DOM File object to a FileRef object. + PP_Resource (*FromFileObject)(PP_Var file_object); + + // Convert a FileRef object to a DOM File object. + PP_Var (*ToFileObject)(PP_Resource file_ref); +#endif +}; + +#endif // PPAPI_C_DEV_PPB_FILE_REF_DEV_H_ diff --git a/ppapi/c/dev/ppb_file_system_dev.h b/ppapi/c/dev/ppb_file_system_dev.h new file mode 100644 index 0000000..9f93a1a --- /dev/null +++ b/ppapi/c/dev/ppb_file_system_dev.h @@ -0,0 +1,29 @@ +// 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. + +#ifndef PPAPI_C_DEV_PPB_FILE_SYSTEM_DEV_H_ +#define PPAPI_C_DEV_PPB_FILE_SYSTEM_DEV_H_ + +#include "ppapi/c/dev/pp_file_info_dev.h" +#include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_resource.h" +#include "ppapi/c/pp_stdint.h" +#include "ppapi/c/pp_time.h" + +struct PP_CompletionCallback; + +#define PPB_FILESYSTEM_DEV_INTERFACE "PPB_FileSystem(Dev);0.2" + +struct PPB_FileSystem_Dev { + // Creates a weak pointer to the filesystem of the given type. + PP_Resource (*Create)(PP_Instance instance, PP_FileSystemType_Dev type); + + // Opens the file system. A file system must be opened before running any + // other operation on it. + int32_t (*Open)(PP_Resource file_system, + int64_t expected_size, + struct PP_CompletionCallback callback); +}; + +#endif // PPAPI_C_DEV_PPB_FILE_SYSTEM_DEV_H_ diff --git a/ppapi/c/dev/ppb_find_dev.h b/ppapi/c/dev/ppb_find_dev.h new file mode 100644 index 0000000..ffd7ca8 --- /dev/null +++ b/ppapi/c/dev/ppb_find_dev.h @@ -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. + +#ifndef PPAPI_C_DEV_PPB_FIND_DEV_H_ +#define PPAPI_C_DEV_PPB_FIND_DEV_H_ + +#include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_stdint.h" + +#define PPB_FIND_DEV_INTERFACE "PPB_Find(Dev);0.1" + +struct PPB_Find_Dev { + // Updates the number of find results for the current search term. If + // there are no matches 0 should be passed in. Only when the plugin has + // finished searching should it pass in the final count with finalResult set + // to true. + void (*NumberOfFindResultsChanged)(PP_Instance instance, + int32_t total, + bool final_result); + + // Updates the index of the currently selected search item. + void (*SelectedFindResultChanged)(PP_Instance instance, + int32_t index); + +}; + +#endif // PPAPI_C_DEV_PPB_FIND_DEV_H_ diff --git a/ppapi/c/dev/ppb_font_dev.h b/ppapi/c/dev/ppb_font_dev.h new file mode 100644 index 0000000..48dc91f --- /dev/null +++ b/ppapi/c/dev/ppb_font_dev.h @@ -0,0 +1,161 @@ +// 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. + +#ifndef PPAPI_C_DEV_PPB_FONT_DEV_H_ +#define PPAPI_C_DEV_PPB_FONT_DEV_H_ + +#include "ppapi/c/pp_module.h" +#include "ppapi/c/pp_resource.h" +#include "ppapi/c/pp_stdint.h" +#include "ppapi/c/pp_var.h" + +#define PPB_FONT_DEV_INTERFACE "PPB_Font(Dev);0.1" + +struct PP_Point; +struct PP_Rect; + +typedef enum { + // Uses the user's default web page font (normally either the default serif + // or sans serif font). + PP_FONTFAMILY_DEFAULT = 0, + + // These families will use the default web page font corresponding to the + // given family. + PP_FONTFAMILY_SERIF = 1, + PP_FONTFAMILY_SANSSERIF = 2, + PP_FONTFAMILY_MONOSPACE = 3 +} PP_FontFamily_Dev; + +typedef enum { + PP_FONTWEIGHT_100 = 0, + PP_FONTWEIGHT_200, + PP_FONTWEIGHT_300, + PP_FONTWEIGHT_400, + PP_FONTWEIGHT_500, + PP_FONTWEIGHT_600, + PP_FONTWEIGHT_700, + PP_FONTWEIGHT_800, + PP_FONTWEIGHT_900, + PP_FONTWEIGHT_NORMAL = PP_FONTWEIGHT_400, + PP_FONTWEIGHT_BOLD = PP_FONTWEIGHT_700 +} PP_FontWeight_Dev; + +struct PP_FontDescription_Dev { + // Font face name as a string. This can also be a Null var, in which case the + // generic family will be obeyed. + struct PP_Var face; + + // When face is a Null string, this specifies the generic font family type + // to use. If the face is specified, this will be ignored. + PP_FontFamily_Dev family; + + uint32_t size; + + // Normally you will use either PP_FONTWEIGHT_NORMAL or PP_FONTWEIGHT_BOLD. + PP_FontWeight_Dev weight; + + bool italic; + bool small_caps; + + // Adjustment to apply to letter and word spacing, respectively. Initialize + // to 0 to get normal spacing. Negative values bring letters/words closer + // together, positive values separate them. + int letter_spacing; + int word_spacing; +}; + +struct PP_FontMetrics_Dev { + int32_t height; + int32_t ascent; + int32_t descent; + int32_t line_spacing; + int32_t x_height; +}; + +struct PP_TextRun_Dev { + // This var must either be a string or a null var (which will be treated as + // a 0-length string). + struct PP_Var text; + + // Set to true if the text is right-to-left. + bool rtl; + + // Set to true to force the directionality of the text regardless of content + bool override_direction; +}; + +struct PPB_Font_Dev { + // Returns a font which best matches the given description. The return value + // will have a non-zero ID on success, or zero on failure. + PP_Resource (*Create)(PP_Module module, + const struct PP_FontDescription_Dev* description); + + // Returns true if the given resource is a Font. Returns false if the + // resource is invalid or some type other than a Font. + bool (*IsFont)(PP_Resource resource); + + // Loads the description and metrics of the font into the given structures. + // The description will be different than the description the font was + // created with since it will be filled with the real values from the font + // that was actually selected. + // + // The PP_Var in the description should be of type Void on input. On output, + // this will contain the string and will have a reference count of 1. The + // plugin is responsible for calling Release on this var. + // + // Returns true on success, false if the font is invalid or if the Var in + // the description isn't Null (to prevent leaks). + bool (*Describe)(PP_Resource font, + struct PP_FontDescription_Dev* description, + struct PP_FontMetrics_Dev* metrics); + + // Draws the text to the image buffer. + // + // The given point represents the baseline of the left edge of the font, + // regardless of whether it is left-to-right or right-to-left (in the case of + // RTL text, this will actually represent the logical end of the text). + // + // The clip is optional and may be NULL. In this case, the text will be + // clipped to the image. + // + // The image_data_is_opaque flag indicates whether subpixel antialiasing can + // be performend, if it is supported. When the image below the text is + // opaque, subpixel antialiasing is supported and you should set this to true + // to pick up the user's default preferences. If your plugin is partially + // transparent, then subpixel antialiasing is not possible and grayscale + // antialiasing will be used instead (assuming the user has antialiasing + // enabled at all). + bool (*DrawTextAt)(PP_Resource font, + PP_Resource image_data, + const struct PP_TextRun_Dev* text, + const struct PP_Point* position, + uint32_t color, + const struct PP_Rect* clip, + bool image_data_is_opaque); + + // Returns the width of the given string. If the font is invalid or the var + // isn't a valid string, this will return -1. + // + // Note that this function handles complex scripts such as Arabic, combining + // accents, etc. so that adding the width of substrings won't necessarily + // produce the correct width of the entire string. + int32_t (*MeasureText)(PP_Resource font, + const struct PP_TextRun_Dev* text); + + // Returns the character at the given pixel X position from the beginning of + // the string. This handles complex scripts such as Arabic, where characters + // may be combined or replaced depending on the context. + uint32_t (*CharacterOffsetForPixel)(PP_Resource font, + const struct PP_TextRun_Dev* text, + int32_t pixel_position); + + // Returns the horizontal advance to the given character if the string was + // placed at the given position. This handles complex scripts such as Arabic, + // where characters may be combined or replaced depending on context. + int32_t (*PixelOffsetForCharacter)(PP_Resource font, + const struct PP_TextRun_Dev* text, + uint32_t char_offset); +}; + +#endif // PPAPI_C_DEV_PPB_FONT_DEV_H_ diff --git a/ppapi/c/dev/ppb_fullscreen_dev.h b/ppapi/c/dev/ppb_fullscreen_dev.h new file mode 100644 index 0000000..9730b3e --- /dev/null +++ b/ppapi/c/dev/ppb_fullscreen_dev.h @@ -0,0 +1,27 @@ +// 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. + +#ifndef PPAPI_C_DEV_PPB_FULLSCREEN_DEV_H_ +#define PPAPI_C_DEV_PPB_FULLSCREEN_DEV_H_ + +#include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_stdint.h" + +#define PPB_FULLSCREEN_DEV_INTERFACE "PPB_Fullscreen(Dev);0.1" + +// Use this interface to change a plugin instance to fullscreen mode. +struct PPB_Fullscreen_Dev { + // Checks whether the plugin instance is currently in fullscreen mode. + bool (*IsFullscreen)(PP_Instance instance); + + // Switches the plugin instance to/from fullscreen mode. Returns true on + // success, false on failure. + // When in fullscreen mode, the plugin will be transparently scaled to the + // size of the screen. It will not receive a ViewChanged event, and doesn't + // need to rebind the graphics context. The pending flushes will execute + // normally, to the new fullscreen window. + bool (*SetFullscreen)(PP_Instance instance, bool fullscreen); +}; + +#endif // PPAPI_C_DEV_PPB_FULLSCREEN_DEV_H_ diff --git a/ppapi/c/dev/ppb_graphics_3d_dev.h b/ppapi/c/dev/ppb_graphics_3d_dev.h new file mode 100644 index 0000000..142c2f2 --- /dev/null +++ b/ppapi/c/dev/ppb_graphics_3d_dev.h @@ -0,0 +1,103 @@ +// 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. + +#ifndef PPAPI_C_DEV_PPB_GRAPHICS_3D_DEV_H_ +#define PPAPI_C_DEV_PPB_GRAPHICS_3D_DEV_H_ + +#include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_module.h" +#include "ppapi/c/pp_resource.h" +#include "ppapi/c/pp_stdint.h" + +// Example usage from plugin code: +// +// PP_Resource context = device->Create(module, config, contextAttribList); +// CHECK(context); +// +// // Present one frame. +// CHECK(device->MakeCurrent(context)); +// glClear(GL_COLOR_BUFFER); +// CHECK(device->MakeCurrent(NULL)); +// CHECK(device->SwapBuffers(context)); +// +// // Shutdown. +// core->ReleaseResource(context); + +#define PPB_GRAPHICS_3D_DEV_INTERFACE "PPB_Graphics3D(Dev);0.1" + +// These are the same error codes as used by EGL. +enum { + PP_GRAPHICS_3D_ERROR_SUCCESS = 0x3000, + PP_GRAPHICS_3D_ERROR_NOT_INITIALIZED = 0x3001, + PP_GRAOHICS_3D_ERROR_BAD_CONTEXT = 0x3006, + PP_GRAPHICS_3D_ERROR_BAD_PARAMETER = 0x300C, + PP_GRAPHICS_3D_ERROR_CONTEXT_LOST = 0x300E +}; + +// QueryString targets, matching EGL ones. +enum { + EGL_VENDOR = 0x3053, + EGL_VERSION = 0x3054, + EGL_EXTENSIONS = 0x3055, + EGL_CLIENT_APIS = 0x308D +}; + +struct PPB_Graphics3D_Dev { + bool (*IsGraphics3D)(PP_Resource resource); + + // EGL-like configuration ---------------------------------------------------- + bool (*GetConfigs)(int32_t* configs, + int32_t config_size, + int32_t* num_config); + + bool (*ChooseConfig)(const int32_t* attrib_list, + int32_t* configs, + int32_t config_size, + int32_t* num_config); + + // TODO(apatrick): What to do if the browser window is moved to + // another display? Do the configs potentially change? + bool (*GetConfigAttrib)(int32_t config, int32_t attribute, int32_t* value); + + const char* (*QueryString)(int32_t name); + // --------------------------------------------------------------------------- + + + // Create a reference counted 3D context. Releasing a context while it is + // current automatically sets the current context to NULL. This is only true + // for the releasing thread. Releasing a context while it is current on + // another thread leads to undefined behavior. + PP_Resource (*CreateContext)(PP_Instance instance, + int32_t config, + int32_t share_context, + const int32_t* attrib_list); + + // Get the address of any GL functions, whether core or part of an extension. + // Any thread. + void* (*GetProcAddress)(const char* name); + + // Make a particular context current of the calling thread. + bool (*MakeCurent)(PP_Resource context); + + // Returns the calling thread's current context or NULL if no context is + // current. + PP_Resource (*GetCurrentContext)(); + + // Snapshots the rendered frame and makes it available for composition with + // the rest of the page. The alpha channel is used for translucency effects. + // One means fully opaque. Zero means fully transparent. Any thread. + // TODO(apatrick): premultiplied alpha or linear alpha? Premultiplied alpha is + // better for correct alpha blending effect. Most existing OpenGL code assumes + // linear. I could convert from linear to premultiplied during the copy from + // back-buffer to offscreen "front-buffer". + bool (*SwapBuffers)(PP_Resource context); + + // Returns the current error for this thread. This is not associated with a + // particular context. It is distinct from the GL error returned by + // glGetError. + uint32_t (*GetError)(); +}; + +#endif // PPAPI_C_DEV_PPB_GRAPHICS_3D_DEV_H_ + diff --git a/ppapi/c/dev/ppb_opengles_dev.h b/ppapi/c/dev/ppb_opengles_dev.h new file mode 100644 index 0000000..c397beb --- /dev/null +++ b/ppapi/c/dev/ppb_opengles_dev.h @@ -0,0 +1,248 @@ +// 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 is auto-generated. DO NOT EDIT! + +// This interface is used to access common and lite profile OpenGL ES 2.0 +// functions. +#ifndef PPAPI_C_DEV_PPB_OPENGLES_DEV_H_ +#define PPAPI_C_DEV_PPB_OPENGLES_DEV_H_ + +#include "../../GLES2/khrplatform.h" + +#define PPB_OPENGLES_DEV_INTERFACE "PPB_OpenGLES(Dev);2.0" + +typedef unsigned int GLenum; +typedef void GLvoid; +typedef khronos_intptr_t GLintptr; +typedef int GLsizei; +typedef khronos_ssize_t GLsizeiptr; +typedef int GLint; +typedef unsigned char GLboolean; +typedef unsigned int GLuint; +typedef unsigned int GLbitfield; +typedef short GLshort; +typedef float GLfloat; +typedef float GLclampf; +typedef signed char GLbyte; +typedef unsigned char GLubyte; +typedef int GLfixed; +typedef unsigned short GLushort; +typedef int GLclampx; + +struct PPB_OpenGLES_Dev { + void (*ActiveTexture)(GLenum texture); + void (*AttachShader)(GLuint program, GLuint shader); + void (*BindAttribLocation)(GLuint program, GLuint index, const char* name); + void (*BindBuffer)(GLenum target, GLuint buffer); + void (*BindFramebuffer)(GLenum target, GLuint framebuffer); + void (*BindRenderbuffer)(GLenum target, GLuint renderbuffer); + void (*BindTexture)(GLenum target, GLuint texture); + void (*BlendColor)( + GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); + void (*BlendEquation)(GLenum mode); + void (*BlendEquationSeparate)(GLenum modeRGB, GLenum modeAlpha); + void (*BlendFunc)(GLenum sfactor, GLenum dfactor); + void (*BlendFuncSeparate)( + GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); + void (*BufferData)( + GLenum target, GLsizeiptr size, const void* data, GLenum usage); + void (*BufferSubData)( + GLenum target, GLintptr offset, GLsizeiptr size, const void* data); + GLenum (*CheckFramebufferStatus)(GLenum target); + void (*Clear)(GLbitfield mask); + void (*ClearColor)( + GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); + void (*ClearDepthf)(GLclampf depth); + void (*ClearStencil)(GLint s); + void (*ColorMask)( + GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); + void (*CompileShader)(GLuint shader); + void (*CompressedTexImage2D)( + GLenum target, GLint level, GLenum internalformat, GLsizei width, + GLsizei height, GLint border, GLsizei imageSize, const void* data); + void (*CompressedTexSubImage2D)( + GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, + GLsizei height, GLenum format, GLsizei imageSize, const void* data); + void (*CopyTexImage2D)( + GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, + GLsizei width, GLsizei height, GLint border); + void (*CopyTexSubImage2D)( + GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, + GLint y, GLsizei width, GLsizei height); + GLuint (*CreateProgram)(); + GLuint (*CreateShader)(GLenum type); + void (*CullFace)(GLenum mode); + void (*DeleteBuffers)(GLsizei n, const GLuint* buffers); + void (*DeleteFramebuffers)(GLsizei n, const GLuint* framebuffers); + void (*DeleteProgram)(GLuint program); + void (*DeleteRenderbuffers)(GLsizei n, const GLuint* renderbuffers); + void (*DeleteShader)(GLuint shader); + void (*DeleteTextures)(GLsizei n, const GLuint* textures); + void (*DepthFunc)(GLenum func); + void (*DepthMask)(GLboolean flag); + void (*DepthRangef)(GLclampf zNear, GLclampf zFar); + void (*DetachShader)(GLuint program, GLuint shader); + void (*Disable)(GLenum cap); + void (*DisableVertexAttribArray)(GLuint index); + void (*DrawArrays)(GLenum mode, GLint first, GLsizei count); + void (*DrawElements)( + GLenum mode, GLsizei count, GLenum type, const void* indices); + void (*Enable)(GLenum cap); + void (*EnableVertexAttribArray)(GLuint index); + void (*Finish)(); + void (*Flush)(); + void (*FramebufferRenderbuffer)( + GLenum target, GLenum attachment, GLenum renderbuffertarget, + GLuint renderbuffer); + void (*FramebufferTexture2D)( + GLenum target, GLenum attachment, GLenum textarget, GLuint texture, + GLint level); + void (*FrontFace)(GLenum mode); + void (*GenBuffers)(GLsizei n, GLuint* buffers); + void (*GenerateMipmap)(GLenum target); + void (*GenFramebuffers)(GLsizei n, GLuint* framebuffers); + void (*GenRenderbuffers)(GLsizei n, GLuint* renderbuffers); + void (*GenTextures)(GLsizei n, GLuint* textures); + void (*GetActiveAttrib)( + GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, + GLint* size, GLenum* type, char* name); + void (*GetActiveUniform)( + GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, + GLint* size, GLenum* type, char* name); + void (*GetAttachedShaders)( + GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders); + GLint (*GetAttribLocation)(GLuint program, const char* name); + void (*GetBooleanv)(GLenum pname, GLboolean* params); + void (*GetBufferParameteriv)(GLenum target, GLenum pname, GLint* params); + GLenum (*GetError)(); + void (*GetFloatv)(GLenum pname, GLfloat* params); + void (*GetFramebufferAttachmentParameteriv)( + GLenum target, GLenum attachment, GLenum pname, GLint* params); + void (*GetIntegerv)(GLenum pname, GLint* params); + void (*GetProgramiv)(GLuint program, GLenum pname, GLint* params); + void (*GetProgramInfoLog)( + GLuint program, GLsizei bufsize, GLsizei* length, char* infolog); + void (*GetRenderbufferParameteriv)( + GLenum target, GLenum pname, GLint* params); + void (*GetShaderiv)(GLuint shader, GLenum pname, GLint* params); + void (*GetShaderInfoLog)( + GLuint shader, GLsizei bufsize, GLsizei* length, char* infolog); + void (*GetShaderPrecisionFormat)( + GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision); + void (*GetShaderSource)( + GLuint shader, GLsizei bufsize, GLsizei* length, char* source); + const GLubyte* (*GetString)(GLenum name); + void (*GetTexParameterfv)(GLenum target, GLenum pname, GLfloat* params); + void (*GetTexParameteriv)(GLenum target, GLenum pname, GLint* params); + void (*GetUniformfv)(GLuint program, GLint location, GLfloat* params); + void (*GetUniformiv)(GLuint program, GLint location, GLint* params); + GLint (*GetUniformLocation)(GLuint program, const char* name); + void (*GetVertexAttribfv)(GLuint index, GLenum pname, GLfloat* params); + void (*GetVertexAttribiv)(GLuint index, GLenum pname, GLint* params); + void (*GetVertexAttribPointerv)(GLuint index, GLenum pname, void** pointer); + void (*Hint)(GLenum target, GLenum mode); + GLboolean (*IsBuffer)(GLuint buffer); + GLboolean (*IsEnabled)(GLenum cap); + GLboolean (*IsFramebuffer)(GLuint framebuffer); + GLboolean (*IsProgram)(GLuint program); + GLboolean (*IsRenderbuffer)(GLuint renderbuffer); + GLboolean (*IsShader)(GLuint shader); + GLboolean (*IsTexture)(GLuint texture); + void (*LineWidth)(GLfloat width); + void (*LinkProgram)(GLuint program); + void (*PixelStorei)(GLenum pname, GLint param); + void (*PolygonOffset)(GLfloat factor, GLfloat units); + void (*ReadPixels)( + GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, + GLenum type, void* pixels); + void (*ReleaseShaderCompiler)(); + void (*RenderbufferStorage)( + GLenum target, GLenum internalformat, GLsizei width, GLsizei height); + void (*SampleCoverage)(GLclampf value, GLboolean invert); + void (*Scissor)(GLint x, GLint y, GLsizei width, GLsizei height); + void (*ShaderBinary)( + GLsizei n, const GLuint* shaders, GLenum binaryformat, const void* binary, + GLsizei length); + void (*ShaderSource)( + GLuint shader, GLsizei count, const char** str, const GLint* length); + void (*StencilFunc)(GLenum func, GLint ref, GLuint mask); + void (*StencilFuncSeparate)( + GLenum face, GLenum func, GLint ref, GLuint mask); + void (*StencilMask)(GLuint mask); + void (*StencilMaskSeparate)(GLenum face, GLuint mask); + void (*StencilOp)(GLenum fail, GLenum zfail, GLenum zpass); + void (*StencilOpSeparate)( + GLenum face, GLenum fail, GLenum zfail, GLenum zpass); + void (*TexImage2D)( + GLenum target, GLint level, GLint internalformat, GLsizei width, + GLsizei height, GLint border, GLenum format, GLenum type, + const void* pixels); + void (*TexParameterf)(GLenum target, GLenum pname, GLfloat param); + void (*TexParameterfv)(GLenum target, GLenum pname, const GLfloat* params); + void (*TexParameteri)(GLenum target, GLenum pname, GLint param); + void (*TexParameteriv)(GLenum target, GLenum pname, const GLint* params); + void (*TexSubImage2D)( + GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, + GLsizei height, GLenum format, GLenum type, const void* pixels); + void (*Uniform1f)(GLint location, GLfloat x); + void (*Uniform1fv)(GLint location, GLsizei count, const GLfloat* v); + void (*Uniform1i)(GLint location, GLint x); + void (*Uniform1iv)(GLint location, GLsizei count, const GLint* v); + void (*Uniform2f)(GLint location, GLfloat x, GLfloat y); + void (*Uniform2fv)(GLint location, GLsizei count, const GLfloat* v); + void (*Uniform2i)(GLint location, GLint x, GLint y); + void (*Uniform2iv)(GLint location, GLsizei count, const GLint* v); + void (*Uniform3f)(GLint location, GLfloat x, GLfloat y, GLfloat z); + void (*Uniform3fv)(GLint location, GLsizei count, const GLfloat* v); + void (*Uniform3i)(GLint location, GLint x, GLint y, GLint z); + void (*Uniform3iv)(GLint location, GLsizei count, const GLint* v); + void (*Uniform4f)( + GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w); + void (*Uniform4fv)(GLint location, GLsizei count, const GLfloat* v); + void (*Uniform4i)(GLint location, GLint x, GLint y, GLint z, GLint w); + void (*Uniform4iv)(GLint location, GLsizei count, const GLint* v); + void (*UniformMatrix2fv)( + GLint location, GLsizei count, GLboolean transpose, + const GLfloat* value); + void (*UniformMatrix3fv)( + GLint location, GLsizei count, GLboolean transpose, + const GLfloat* value); + void (*UniformMatrix4fv)( + GLint location, GLsizei count, GLboolean transpose, + const GLfloat* value); + void (*UseProgram)(GLuint program); + void (*ValidateProgram)(GLuint program); + void (*VertexAttrib1f)(GLuint indx, GLfloat x); + void (*VertexAttrib1fv)(GLuint indx, const GLfloat* values); + void (*VertexAttrib2f)(GLuint indx, GLfloat x, GLfloat y); + void (*VertexAttrib2fv)(GLuint indx, const GLfloat* values); + void (*VertexAttrib3f)(GLuint indx, GLfloat x, GLfloat y, GLfloat z); + void (*VertexAttrib3fv)(GLuint indx, const GLfloat* values); + void (*VertexAttrib4f)( + GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w); + void (*VertexAttrib4fv)(GLuint indx, const GLfloat* values); + void (*VertexAttribPointer)( + GLuint indx, GLint size, GLenum type, GLboolean normalized, + GLsizei stride, const void* ptr); + void (*Viewport)(GLint x, GLint y, GLsizei width, GLsizei height); + void (*SwapBuffers)(); + GLuint (*GetMaxValueInBuffer)( + GLuint buffer_id, GLsizei count, GLenum type, GLuint offset); + void (*GenSharedIds)( + GLuint namespace_id, GLuint id_offset, GLsizei n, GLuint* ids); + void (*DeleteSharedIds)(GLuint namespace_id, GLsizei n, const GLuint* ids); + void (*RegisterSharedIds)(GLuint namespace_id, GLsizei n, const GLuint* ids); + GLboolean (*CommandBufferEnable)(const char* feature); + void* (*MapBufferSubData)( + GLuint target, GLintptr offset, GLsizeiptr size, GLenum access); + void (*UnmapBufferSubData)(const void* mem); + void* (*MapTexSubImage2D)( + GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, + GLsizei height, GLenum format, GLenum type, GLenum access); + void (*UnmapTexSubImage2D)(const void* mem); +}; + +#endif // PPAPI_C_DEV_PPB_OPENGLES_DEV_H_ + diff --git a/ppapi/c/dev/ppb_scrollbar_dev.h b/ppapi/c/dev/ppb_scrollbar_dev.h new file mode 100644 index 0000000..4b365bb --- /dev/null +++ b/ppapi/c/dev/ppb_scrollbar_dev.h @@ -0,0 +1,62 @@ +// 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. + +#ifndef PPAPI_C_DEV_PPB_SCROLLBAR_DEV_H_ +#define PPAPI_C_DEV_PPB_SCROLLBAR_DEV_H_ + +#include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_resource.h" +#include "ppapi/c/pp_stdint.h" + +struct PP_Rect; + +typedef enum { + PP_SCROLLBY_PIXEL = 0, + PP_SCROLLBY_LINE = 1, + PP_SCROLLBY_PAGE = 2, + PP_SCROLLBY_DOCUMENT = 3 +} PP_ScrollBy_Dev; + +#define PPB_SCROLLBAR_DEV_INTERFACE "PPB_Scrollbar(Dev);0.1" + +// The interface for a scrollbar. A scrollbar is a widget, so the functions +// in PPB_Widget can also be used with scrollbar objects. +struct PPB_Scrollbar_Dev { + // Create a new scrollbar. Returns 0 if the instance is invalid. + PP_Resource (*Create)(PP_Instance instance, + bool vertical); + + // Returns true if the given resource is a Scrollbar. Returns false if the + // resource is invalid or some type other than a scrollbar. + bool (*IsScrollbar)(PP_Resource resource); + + // Gets the thickness of a scrollbar. + uint32_t (*GetThickness)(); + + // Get/set the value of the scrollbar. + uint32_t (*GetValue)(PP_Resource scrollbar); + + void (*SetValue)(PP_Resource scrollbar, + uint32_t value); + + // Set the document size (i.e. total length of the region that's being + // scrolled). + void (*SetDocumentSize)(PP_Resource scrollbar, + uint32_t size); + + // Updates the tickmarks. Only valid for vertical scrollbars. "tick_marks" + // contains "count" PP_Rect objects. + void (*SetTickMarks)(PP_Resource scrollbar, + const struct PP_Rect* tick_marks, + uint32_t count); + + // Scroll by "multiplier" pixels/lines/pages units. Positive values are + // forward and negative are backward. If "unit" is document then any positive + // value goes to the end while any negative value goes to the beginning. + void (*ScrollBy)(PP_Resource scrollbar, + PP_ScrollBy_Dev unit, + int32_t multiplier); +}; + +#endif // PPAPI_C_DEV_PPB_SCROLLBAR_DEV_H_ diff --git a/ppapi/c/dev/ppb_testing_dev.h b/ppapi/c/dev/ppb_testing_dev.h new file mode 100644 index 0000000..16c2bd4 --- /dev/null +++ b/ppapi/c/dev/ppb_testing_dev.h @@ -0,0 +1,70 @@ +// 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. + +#ifndef PPAPI_C_DEV_PPB_TESTING_DEV_H_ +#define PPAPI_C_DEV_PPB_TESTING_DEV_H_ + +#include "ppapi/c/pp_module.h" +#include "ppapi/c/pp_resource.h" +#include "ppapi/c/pp_stdint.h" + +struct PP_Point; + +#define PPB_TESTING_DEV_INTERFACE "PPB_Testing(Dev);0.2" + +// This interface contains functions used for unit testing. Do not use in +// production code. They are not guaranteed to be available in normal plugin +// environments so you should not depend on them. +struct PPB_Testing_Dev { + // Reads the bitmap data out of the backing store for the given + // DeviceContext2D and into the given image. If the data was successfully + // read, it will return true. + // + // This function should not generally be necessary for normal plugin + // operation. If you want to update portions of a device, the expectation is + // that you will either regenerate the data, or maintain a backing store + // pushing updates to the device from your backing store via PaintImageData. + // Using this function will introduce an extra copy which will make your + // plugin slower. In some cases, this may be a very expensive operation (it + // may require slow cross-process transitions or graphics card readbacks). + // + // Data will be read into the image starting at |top_left| in the device + // context, and proceeding down and to the right for as many pixels as the + // image is large. If any part of the image bound would fall outside of the + // backing store of the device if positioned at |top_left|, this function + // will fail and return false. + // + // The image format must be of the format + // PPB_ImageData.GetNativeImageDataFormat() or this function will fail and + // return false. + // + // The returned image data will represent the current status of the backing + // store. This will not include any paint, scroll, or replace operations + // that have not yet been flushed; these operations are only reflected in + // the backing store (and hence ReadImageData) until after a Flush() + // operation has completed. + bool (*ReadImageData)(PP_Resource device_context_2d, + PP_Resource image, + const struct PP_Point* top_left); + + // Runs a nested message loop. The plugin will be reentered from this call. + // This function is used for unit testing the API. The normal pattern is to + // issue some asynchronous call that has a callback. Then you call + // RunMessageLoop which will suspend the plugin and go back to processing + // messages, giving the asynchronous operation time to complete. In your + // callback, you save the data and call QuitMessageLoop, which will then + // pop back up and continue with the test. This avoids having to write a + // complicated state machine for simple tests for asynchronous APIs. + void (*RunMessageLoop)(); + + // 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)(); + + // Returns the number of live objects (resources + strings + objects) + // associated with this plugin module. Used for detecting leaks. + uint32_t (*GetLiveObjectCount)(PP_Module module); +}; + +#endif // PPAPI_C_DEV_PPB_TESTING_DEV_H_ diff --git a/ppapi/c/dev/ppb_transport_dev.h b/ppapi/c/dev/ppb_transport_dev.h new file mode 100644 index 0000000..821557d --- /dev/null +++ b/ppapi/c/dev/ppb_transport_dev.h @@ -0,0 +1,70 @@ +// 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. + +#ifndef PPAPI_C_PPB_TRANSPORT_DEV_H_ +#define PPAPI_C_PPB_TRANSPORT_DEV_H_ + +#include "ppapi/c/pp_completion_callback.h" +#include "ppapi/c/pp_module.h" +#include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_resource.h" +#include "ppapi/c/pp_stdint.h" +#include "ppapi/c/pp_var.h" + +#define PPB_TRANSPORT_DEV_INTERFACE "PPB_Transport;0.1" + +struct PPB_Transport_Dev { + // Creates a new transport object with the specified name + // using the specified protocol. + PP_Resource (*CreateTransport)(PP_Module module, + const char* name, + const char* proto); + + // Returns whether or not resource is a Transport + bool (*IsTransport)(PP_Resource resource); + + // Returns whether the transport is currently writable + // (i.e. can send data to the remote peer) + bool (*IsWritable)(PP_Resource transport); + // TODO(juberti): other getters/setters + // connect state + // connect type, protocol + // RTT + + // Establishes a connection to the remote peer. + // Returns PP_ERROR_WOULDBLOCK and notifies on |cb| + // when connectivity is established (or timeout occurs). + int32_t (*Connect)(PP_Resource transport, + PP_CompletionCallback cb); + + // Obtains another ICE candidate address to be provided + // to the remote peer. Returns PP_ERROR_WOULDBLOCK + // if there are no more addresses to be sent. + int32_t (*GetNextAddress)(PP_Resource transport, + PP_Var* address, + PP_CompletionCallback cb); + // Provides an ICE candidate address that was received + // from the remote peer. + int32_t (*ReceiveRemoteAddress)(PP_Resource transport, + PP_Var address); + + // Like recv(), receives data. Returns PP_ERROR_WOULDBLOCK + // if there is currently no data to receive. + int32_t (*Recv)(PP_Resource transport, + void* data, + uint32_t len, + PP_CompletionCallback cb); + // Like send(), sends data. Returns PP_ERROR_WOULDBLOCK + // if the socket is currently flow-controlled. + int32_t (*Send)(PP_Resource transport, + const void* data, + uint32_t len, + PP_CompletionCallback cb); + + // Disconnects from the remote peer. + int32_t (*Close)(PP_Resource transport); +}; + +#endif // PPAPI_C_PPB_TRANSPORT_DEV_H_ + diff --git a/ppapi/c/dev/ppb_url_loader_dev.h b/ppapi/c/dev/ppb_url_loader_dev.h new file mode 100644 index 0000000..44f4dc90 --- /dev/null +++ b/ppapi/c/dev/ppb_url_loader_dev.h @@ -0,0 +1,101 @@ +// 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. + +#ifndef PPAPI_C_DEV_PPB_URL_LOADER_DEV_H_ +#define PPAPI_C_DEV_PPB_URL_LOADER_DEV_H_ + +#include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_resource.h" +#include "ppapi/c/pp_stdint.h" + +struct PP_CompletionCallback; + +#define PPB_URLLOADER_DEV_INTERFACE "PPB_URLLoader(Dev);0.1" + +// 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. +// +struct PPB_URLLoader_Dev { + // 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)(PP_Instance instance); + + // Returns true if the given resource is an URLLoader. Returns false if the + // resource is invalid or some type other than an URLLoader. + bool (*IsURLLoader)(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)(PP_Resource loader, + PP_Resource request_info, + struct PP_CompletionCallback callback); + + // If the current URLResponseInfo object corresponds to a redirect, then call + // this method to follow the redirect. + int32_t (*FollowRedirect)(PP_Resource loader, + struct PP_CompletionCallback callback); + + // Returns the current upload progress, which is meaningful after Open has + // been called, and the request given to Open must have been configured with + // PP_URLREQUESTPROPERTY_REPORTUPLOADPROGRESS set to true. Progress only + // refers to the request body. This data is only available if the + // PP_URLREQUESTPROPERTY_REPORTUPLOADPROGRESS was set to true on the + // URLRequestInfo. This method returns false if upload progress is not + // available. + bool (*GetUploadProgress)(PP_Resource loader, + int64_t* bytes_sent, + 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. The total bytes + // to be received may be unknown, in which case -1 is returned. This method + // returns false if download progress is not available. + bool (*GetDownloadProgress)(PP_Resource loader, + int64_t* bytes_received, + int64_t* total_bytes_to_be_received); + + // Returns the current URLResponseInfo object. + PP_Resource (*GetResponseInfo)(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)(PP_Resource loader, + char* buffer, + int32_t bytes_to_read, + struct 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)(PP_Resource loader, + struct 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)(PP_Resource loader); +}; + +#endif // PPAPI_C_DEV_PPB_URL_LOADER_DEV_H_ diff --git a/ppapi/c/dev/ppb_url_loader_trusted_dev.h b/ppapi/c/dev/ppb_url_loader_trusted_dev.h new file mode 100644 index 0000000..4eabe14 --- /dev/null +++ b/ppapi/c/dev/ppb_url_loader_trusted_dev.h @@ -0,0 +1,19 @@ +// 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. + +#ifndef PPAPI_C_DEV_PPB_URL_LOADER_TRUSTED_DEV_H_ +#define PPAPI_C_DEV_PPB_URL_LOADER_TRUSTED_DEV_H_ + +#include "ppapi/c/pp_resource.h" + +#define PPB_URLLOADERTRUSTED_DEV_INTERFACE "PPB_URLLoaderTrusted(Dev);0.1" + +// Available only to trusted implementations. +struct PPB_URLLoaderTrusted_Dev { + // Grant this URLLoader the capability to make unrestricted cross-origin + // requests. + void (*GrantUniversalAccess)(PP_Resource loader); +}; + +#endif // PPAPI_C_DEV_PPB_URL_LOADER_DEV_H_ diff --git a/ppapi/c/dev/ppb_url_request_info_dev.h b/ppapi/c/dev/ppb_url_request_info_dev.h new file mode 100644 index 0000000..2503a0c --- /dev/null +++ b/ppapi/c/dev/ppb_url_request_info_dev.h @@ -0,0 +1,71 @@ +// 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. + +#ifndef PPAPI_C_DEV_PPB_URL_REQUEST_INFO_DEV_H_ +#define PPAPI_C_DEV_PPB_URL_REQUEST_INFO_DEV_H_ + +#include "ppapi/c/pp_module.h" +#include "ppapi/c/pp_resource.h" +#include "ppapi/c/pp_stdint.h" +#include "ppapi/c/pp_time.h" + +struct PP_Var; + +typedef enum { + PP_URLREQUESTPROPERTY_URL, // string + PP_URLREQUESTPROPERTY_METHOD, // string + PP_URLREQUESTPROPERTY_HEADERS, // string, \n-delim + PP_URLREQUESTPROPERTY_STREAMTOFILE, // bool (default=false) + PP_URLREQUESTPROPERTY_FOLLOWREDIRECTS, // bool (default=true) + PP_URLREQUESTPROPERTY_RECORDUPLOADPROGRESS // bool (default=false) + // TODO(darin): Add security/privacy options? +} PP_URLRequestProperty_Dev; + +#define PPB_URLREQUESTINFO_DEV_INTERFACE "PPB_URLRequestInfo(Dev);0.1" + +struct PPB_URLRequestInfo_Dev { + // Create a new URLRequestInfo object. Returns 0 if the module is invalid. + PP_Resource (*Create)(PP_Module module); + + // Returns true if the given resource is an URLRequestInfo. Returns false if + // the resource is invalid or some type other than an URLRequestInfo. + bool (*IsURLRequestInfo)(PP_Resource resource); + + // Sets a request property. Returns false if any of the parameters are + // invalid. The value property must be the correct type according to the + // property being set. + bool (*SetProperty)(PP_Resource request, + PP_URLRequestProperty_Dev property, + struct PP_Var value); + + // Append data to the request body. + // + // A Content-Length request header will be automatically generated. + // + // Returns false if any of the parameters are invalid. + bool (*AppendDataToBody)(PP_Resource request, const char* data, 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 false if any of the parameters are invalid. + bool (*AppendFileToBody)(PP_Resource request, + PP_Resource file_ref, + int64_t start_offset, + int64_t number_of_bytes, + PP_Time expected_last_modified_time); +}; + +#endif // PPAPI_C_DEV_PPB_URL_REQUEST_INFO_DEV_H_ diff --git a/ppapi/c/dev/ppb_url_response_info_dev.h b/ppapi/c/dev/ppb_url_response_info_dev.h new file mode 100644 index 0000000..8e3a9e4 --- /dev/null +++ b/ppapi/c/dev/ppb_url_response_info_dev.h @@ -0,0 +1,41 @@ +// 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. + +#ifndef PPAPI_C_DEV_PPB_URL_RESPONSE_INFO_DEV_H_ +#define PPAPI_C_DEV_PPB_URL_RESPONSE_INFO_DEV_H_ + +#include "ppapi/c/pp_resource.h" +#include "ppapi/c/pp_var.h" + +typedef enum { + PP_URLRESPONSEPROPERTY_URL, // string + PP_URLRESPONSEPROPERTY_REDIRECTURL, // string + PP_URLRESPONSEPROPERTY_REDIRECTMETHOD, // string + PP_URLRESPONSEPROPERTY_STATUSCODE, // int32 + PP_URLRESPONSEPROPERTY_STATUSLINE, // string + PP_URLRESPONSEPROPERTY_HEADERS // string, \n-delim +} PP_URLResponseProperty_Dev; + +#define PPB_URLRESPONSEINFO_DEV_INTERFACE "PPB_URLResponseInfo(Dev);0.1" + +struct PPB_URLResponseInfo_Dev { + // Returns true if the given resource is an URLResponseInfo. Returns false if + // the resource is invalid or some type other than an URLResponseInfo. + bool (*IsURLResponseInfo)(PP_Resource resource); + + // Gets a response property. Return PP_VarType_Void if an input parameter is + // invalid. + PP_Var (*GetProperty)(PP_Resource response, + PP_URLResponseProperty_Dev 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 (*GetBody)(PP_Resource response); +}; + +#endif // PPAPI_C_DEV_PPB_URL_RESPONSE_INFO_DEV_H_ diff --git a/ppapi/c/dev/ppb_url_util_dev.h b/ppapi/c/dev/ppb_url_util_dev.h new file mode 100644 index 0000000..c16e59d --- /dev/null +++ b/ppapi/c/dev/ppb_url_util_dev.h @@ -0,0 +1,111 @@ +// 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. + +#ifndef PPAPI_C_DEV_PPB_URL_UTIL_DEV_H_ +#define PPAPI_C_DEV_PPB_URL_UTIL_DEV_H_ + +#include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_stdint.h" +#include "ppapi/c/pp_var.h" + +#define PPB_URLUTIL_DEV_INTERFACE "PPB_UrlUtil(Dev);0.1" + +// A component specifies the range of the part of the URL. The begin specifies +// the index into the string of the first character of that component. The len +// specifies the length of that component. +// +// This range does not include any special delimiter for that component, so +// the scheme doesn't include the trailing colon, the username and password +// don't include the @ and :, the port doesn't include the colon, the query +// doesn't include the ?, and the ref doesn't include the #. +// +// The exception is that the path *does* include the first /, since that's an +// integral part of the path. +// +// If the component is not present at all, begin will be 0 and len will be -1. +// If the component is present but empty, the length will be 0 instead. Example: +// http://foo/search -> query = (0, -1) +// http://foo/search? -> query = (18, 0) +struct PP_UrlComponent_Dev { + int32_t begin; + int32_t len; +}; + +struct PP_UrlComponents_Dev { + PP_UrlComponent_Dev scheme; + PP_UrlComponent_Dev username; + PP_UrlComponent_Dev password; + PP_UrlComponent_Dev host; + PP_UrlComponent_Dev port; + PP_UrlComponent_Dev path; + PP_UrlComponent_Dev query; + PP_UrlComponent_Dev ref; +}; + +// URL encoding: URLs are supplied to this interface as NULL-terminated 8-bit +// strings. You can pass non-ASCII characters which will be interpreted as +// UTF-8. Canonicalized URL strings returned by these functions will be ASCII +// except for the reference fragment (stuff after the '#') which will be +// encoded as UTF-8. +struct PPB_UrlUtil_Dev { + // Canonicalizes the given URL string according to the rules of the host + // browser. If the URL is invalid or the var is not a string, this will + // return a Null var and the components structure will be unchanged. + // + // The components pointer, if non-NULL and the canonicalized URL is valid, + // will identify the components of the resulting URL. Components may be NULL + // to specify that no component information is necessary. + struct PP_Var (*Canonicalize)(struct PP_Var url, + struct PP_UrlComponents_Dev* components); + + // Resolves the given URL relative to the given base URL. The resulting URL + // is returned as a string. If the resolution is invalid or either of the + // inputs are not strings, a Null var will be returned. The resulting URL + // will also be canonicalized according to the rules of the browser. + // + // Note that the "relative" URL bay in fact be absolute, in which case it + // will be returned. This function is identical to resolving the full URL + // for an <a href="..."> on a web page. Attempting to resolve a relative URL + // on a base URL that doesn't support this (e.g. "data") will fail and will + // return a Null var, unless the relative URL is itself absolute. + // + // The components pointer, if non-NULL and the canonicalized URL is valid, + // will identify the components of the resulting URL. Components may be NULL + // to specify that no component information is necessary. + struct PP_Var (*ResolveRelativeToUrl)( + struct PP_Var base_url, + struct PP_Var relative_string, + struct PP_UrlComponents_Dev* components); + + // Identical to ResolveRelativeToUrl except that the base URL is the base + // URL of the document containing the given plugin instance. + // + // Danger: This will be identical to resolving a relative URL on the page, + // and might be overridden by the page to something different than its actual + // URL via the <base> tag. Therefore, resolving a relative URL of "" won't + // necessarily give you the URL of the page! + struct PP_Var (*ResolveRelativeToDocument)( + PP_Instance instance, + struct PP_Var relative_string, + struct PP_UrlComponents_Dev* components); + + // Checks whether the given two URLs are in the same security origin. Returns + // false if either of the URLs are invalid. + bool (*IsSameSecurityOrigin)(struct PP_Var url_a, struct PP_Var url_b); + + // Checks whether the document hosting the given plugin instance can access + // the given URL according to the same origin policy of the browser. Returns + // false if the instance or the URL is invalid. + bool (*DocumentCanRequest)(PP_Instance instance, struct PP_Var url); + + // Checks whether the document containing the |active| plugin instance can + // access the document containing the |target| plugin instance according to + // the security policy of the browser. This includes the same origin policy + // and any cross-origin capabilities enabled by the document. If either of + // the plugin instances are invalid, returns false. + bool (*DocumentCanAccessDocument)(PP_Instance active, PP_Instance target); +}; + +#endif // PPAPI_C_DEV_PPB_URL_UTIL_DEV_H_ + diff --git a/ppapi/c/dev/ppb_var_deprecated.h b/ppapi/c/dev/ppb_var_deprecated.h new file mode 100644 index 0000000..51194b2 --- /dev/null +++ b/ppapi/c/dev/ppb_var_deprecated.h @@ -0,0 +1,243 @@ +// 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. + +#ifndef PPAPI_C_PPB_VAR_DEPRECATED_H_ +#define PPAPI_C_PPB_VAR_DEPRECATED_H_ + +#include "ppapi/c/pp_module.h" +#include "ppapi/c/pp_stdint.h" +#include "ppapi/c/pp_var.h" + +struct PPP_Class_Deprecated; + +#define PPB_VAR_DEPRECATED_INTERFACE "PPB_Var(Deprecated);0.1" + +/** + * @file + * Defines the PPB_Var_Deprecated struct. + * See http://code.google.com/p/ppapi/wiki/InterfacingWithJavaScript + * for general information on using this interface. + * {PENDING: Should the generated doc really be pointing to methods?} + * + * @addtogroup PPB + * @{ + */ + +struct PPB_Var_Deprecated { + /** + * 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)(struct 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)(struct 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. + */ + struct PP_Var (*VarFromUtf8)(PP_Module module, + const char* data, 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. + */ + const char* (*VarToUtf8)(struct PP_Var var, uint32_t* len); + + /** + * Returns true if the property with the given name exists on the given + * object, false if it does not. Methods are also counted as properties. + * + * The name can either be a string or an integer var. It is an error to pass + * another type of var as the name. + * + * If you pass an invalid name or object, the exception will be set (if it is + * non-NULL, and the return value will be false). + */ + bool (*HasProperty)(struct PP_Var object, + struct PP_Var name, + struct PP_Var* exception); + + /** + * Identical to HasProperty, except that HasMethod additionally checks if the + * property is a function. + */ + bool (*HasMethod)(struct PP_Var object, + struct PP_Var name, + struct PP_Var* exception); + + /** + * Returns the value of the given property. If the property doesn't exist, the + * exception (if non-NULL) will be set and a "Void" var will be returned. + */ + struct PP_Var (*GetProperty)(struct PP_Var object, + struct PP_Var name, + struct PP_Var* exception); + + /** + * Retrieves all property names on the given object. Property names include + * methods. + * + * If there is a failure, the given exception will be set (if it is non-NULL). + * On failure, |*properties| will be set to NULL and |*property_count| will be + * set to 0. + * + * A pointer to the array of property names will be placesd in |*properties|. + * The caller is responsible for calling Release() on each of these properties + * (as per normal refcounted memory management) as well as freeing the array + * pointer with PPB_Core.MemFree(). + * + * This function returns all "enumerable" properties. Some JavaScript + * properties are "hidden" and these properties won't be retrieved by this + * function, yet you can still set and get them. + * + * Example: + * <pre> uint32_t count; + * PP_Var* properties; + * ppb_var.GetAllPropertyNames(object, &count, &properties); + * + * ...use the properties here... + * + * for (uint32_t i = 0; i < count; i++) + * ppb_var.Release(properties[i]); + * ppb_core.MemFree(properties); </pre> + */ + void (*GetAllPropertyNames)(struct PP_Var object, + uint32_t* property_count, + struct PP_Var** properties, + struct PP_Var* exception); + + /** + * Sets the property with the given name on the given object. The exception + * will be set, if it is non-NULL, on failure. + */ + void (*SetProperty)(struct PP_Var object, + struct PP_Var name, + struct PP_Var value, + struct PP_Var* exception); + + /** + * Removes the given property from the given object. The property name must + * be an string or integer var, using other types will throw an exception + * (assuming the exception pointer is non-NULL). + */ + void (*RemoveProperty)(struct PP_Var object, + struct PP_Var name, + struct PP_Var* exception); + + // TODO(brettw) need native array access here. + + /** + * Invoke the function |method_name| on the given object. If |method_name| + * is a Null var, the default method will be invoked, which is how you can + * invoke function objects. + * + * Unless it is type Null, |method_name| must be a string. Unlike other + * Var functions, integer lookup is not supported since you can't call + * functions on integers in JavaScript. + * + * Pass the arguments to the function in order in the |argv| array, and the + * number of arguments in the |argc| parameter. |argv| can be NULL if |argc| + * is zero. + * + * Example: + * Call(obj, VarFromUtf8("DoIt"), 0, NULL, NULL) = obj.DoIt() in JavaScript. + * Call(obj, PP_MakeNull(), 0, NULL, NULL) = obj() in JavaScript. + */ + struct PP_Var (*Call)(struct PP_Var object, + struct PP_Var method_name, + uint32_t argc, + struct PP_Var* argv, + struct PP_Var* exception); + + /** + * Invoke the object as a constructor. + * + * For example, if |object| is |String|, this is like saying |new String| in + * JavaScript. + */ + struct PP_Var (*Construct)(struct PP_Var object, + uint32_t argc, + struct PP_Var* argv, + struct PP_Var* exception); + + /** + * If the object is an instance of the given class, then this method returns + * true and sets *object_data to the value passed to CreateObject provided + * object_data is non-NULL. Otherwise, this method returns false. + */ + bool (*IsInstanceOf)(struct PP_Var var, + const struct PPP_Class_Deprecated* object_class, + void** object_data); + + /** + * Creates an object that the plugin implements. The plugin supplies a + * pointer to the class interface it implements for that object, and its + * associated internal data that represents that object. + * + * The returned object will have a reference count of 1. When the reference + * count reached 0, the class' Destruct function wlil be called. + * + * On failure, this will return a null var. This probably means the module + * was invalid. + * + * Example: Say we're implementing a "Point" object. + * <pre> void PointDestruct(void* object) { + * delete (Point*)object; + * } + * + * const PPP_Class_Deprecated point_class = { + * ... all the other class functions go here ... + * &PointDestruct + * }; + * + * * The plugin's internal object associated with the point. + * class Point { + * ... + * }; + * + * PP_Var MakePoint(int x, int y) { + * return CreateObject(&point_class, new Point(x, y)); + * }</pre> + */ + struct PP_Var (*CreateObject)(PP_Module module, + const struct PPP_Class_Deprecated* object_class, + void* object_data); +}; + +/** + * @} + * End addtogroup PPB + */ +#endif // PPAPI_C_PPB_VAR_DEPRECATED_H_ + diff --git a/ppapi/c/dev/ppb_video_decoder_dev.h b/ppapi/c/dev/ppb_video_decoder_dev.h new file mode 100644 index 0000000..33274de --- /dev/null +++ b/ppapi/c/dev/ppb_video_decoder_dev.h @@ -0,0 +1,86 @@ +// 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. + +#ifndef PPAPI_C_DEV_PPB_VIDEO_DECODER_DEV_H_ +#define PPAPI_C_DEV_PPB_VIDEO_DECODER_DEV_H_ + +#include "ppapi/c/dev/pp_video_dev.h" +#include "ppapi/c/pp_module.h" +#include "ppapi/c/pp_resource.h" +#include "ppapi/c/pp_stdint.h" +#include "ppapi/c/pp_completion_callback.h" + +#define PPB_VIDEODECODER_DEV_INTERFACE "PPB_VideoDecoder(Dev);0.1" + +struct PPB_VideoDecoder_Dev { + // Queries capability of the decoder for |codec|. + // |codec| is the requested codec id. + // |configs| is a pointer to a buffer containing |config_size| elements. + // The number of configurations is returned in |num_config|. Element 0 through + // |num_config| - 1 of |configs| are filled in with valid PP_VideoConfig's. + // No more than |config_size| PP_VideoConfig's will be returned even if more + // are available on the device. + // When this function is called with |configs| = NULL, then no configurations + // are returned, but the total number of configurations available will be + // returned in |num_config|. + // + // Returns true on success, false otherwise. + // NOTE: browser owns the memory of all PP_VideoConfig's. + bool (*GetConfig)(PP_Instance instance, + PP_VideoCodecId_Dev codec, + PP_VideoConfig_Dev* configs, + int32_t config_size, + int32_t* num_config); + + // Creates a video decoder with requested |decoder_config|. + // |input_format| in |decoder_config| specifies the format of input access + // unit, with PP_VIDEOKEY_CODECID and PP_VIDEOKEY_PAYLOADFORMAT required. + // Plugin has the option to specify codec profile/level and other + // information such as PP_VIDEOKEY_ACCELERATION, to let browser choose + // the most appropriate decoder. + // + // |output_format| in |decoder_config| specifies desired decoded frame buffer + // format, with PP_VIDEOKEY_COLORTYPE and PP_VIDEOKEY_SURFACETYPE required. + // + // |output_callback| in |decoder_config| specifies the callback function + // for decoder to deliver decoded frame buffers. Decoder shall retain it. + // + // |input_callback| in |decoder_config| specifies the callback function + // for decoder to return compressed data buffers to plugin. Decoder shall + // retain it. When plugin doesn't expect buffer recycling, it shall set + // |input_callback| to NULL. In this case, plugin shall allocate buffer via + // |MemAlloc| in PPB_Core interface, and decoder will free buffer via + // |MemFree| in the same API. + // + // |event_handler| in |decoder_config| specifies the function for decoder + // to deliver events to plugin. Decoder shall retain it. + // + // The created decoder is returned as PP_Resource. NULL means failure. + PP_Resource (*Create)(PP_Instance instance, + const struct PP_VideoDecoderConfig_Dev* decoder_config); + + // Sends bit stream in |input_buffer| to the decoder. + // This is a non-blocking call. + // The decoded frame will be returned by decoder calling |output_callback| + // provided by plugin during creation of decoder. + // The input data buffer is returned to plugin by decoder only when plugin + // provides |input_callback|. + // Returns true on decoder successfully accepting buffer, false otherwise. + // + bool (*Decode)(PP_Resource decoder, + struct PP_VideoCompressedDataBuffer_Dev* input_buffer); + + // Requests the decoder to flush its input and output buffers. Once done with + // flushing, the decode will call the |callback|. + int32_t (*Flush)(PP_Resource decoder, + PP_CompletionCallback callback); + + // Plugin sends uncompressed data buffers to the decoder. + // Returns true on decoder successfully accepting the buffer, false otherwise. + bool (*ReturnUncompressedDataBuffer)( + PP_Resource decoder, + struct PP_VideoUncompressedDataBuffer_Dev* buffer); +}; + +#endif // PPAPI_C_DEV_PPB_VIDEO_DECODER_DEV_H_ diff --git a/ppapi/c/dev/ppb_widget_dev.h b/ppapi/c/dev/ppb_widget_dev.h new file mode 100644 index 0000000..0319b22 --- /dev/null +++ b/ppapi/c/dev/ppb_widget_dev.h @@ -0,0 +1,39 @@ +// 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. + +#ifndef PPAPI_C_DEV_PPB_WIDGET_DEV_H_ +#define PPAPI_C_DEV_PPB_WIDGET_DEV_H_ + +#include "ppapi/c/pp_resource.h" + +struct PP_Rect; +struct PP_InputEvent; + +#define PPB_WIDGET_DEV_INTERFACE "PPB_Widget(Dev);0.1" + +// The interface for reusing browser widgets. +struct PPB_Widget_Dev { + // Returns true if the given resource is a Widget. Returns false if the + // resource is invalid or some type other than an Widget. + bool (*IsWidget)(PP_Resource resource); + + // Paint the given rectangle of the widget into the given image. + // Returns true on success, false on failure + bool (*Paint)(PP_Resource widget, + const struct PP_Rect* rect, + PP_Resource image); + + // Pass in an event to a widget. It'll return true if the event was consumed. + bool (*HandleEvent)(PP_Resource widget, + const struct PP_InputEvent* event); + + // Get/set the location of the widget. + bool (*GetLocation)(PP_Resource widget, + struct PP_Rect* location); + + void (*SetLocation)(PP_Resource widget, + const struct PP_Rect* location); +}; + +#endif // PPAPI_C_DEV_PPB_WIDGET_DEV_H_ diff --git a/ppapi/c/dev/ppb_zoom_dev.h b/ppapi/c/dev/ppb_zoom_dev.h new file mode 100644 index 0000000..e6046e1 --- /dev/null +++ b/ppapi/c/dev/ppb_zoom_dev.h @@ -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. + +#ifndef PPAPI_C_DEV_PPB_ZOOM_DEV_H_ +#define PPAPI_C_DEV_PPB_ZOOM_DEV_H_ + +#include "ppapi/c/pp_instance.h" + +// Zoom interface should only apply to those full-page "plugin-document". +#define PPB_ZOOM_DEV_INTERFACE "PPB_Zoom(Dev);0.1" + +struct PPB_Zoom_Dev { + // Informs the browser about the new zoom factor for the plugin (see + // ppp_zoom_dev.h for a description of zoom factor). The plugin should only + // call this function if the zoom change was triggered by the browser, it's + // only needed in case a plugin can update its own zoom, say because of its + // own UI. + void (*ZoomChanged)(PP_Instance instance, + double factor); + + // Sets the mininum and maximium zoom factors. + void (*ZoomLimitsChanged)(PP_Instance instance, + double minimum_factor, + double maximium_factor); +}; + +#endif // PPAPI_C_DEV_PPB_ZOOM_DEV_H_ diff --git a/ppapi/c/dev/ppp_class_deprecated.h b/ppapi/c/dev/ppp_class_deprecated.h new file mode 100644 index 0000000..d8a1349 --- /dev/null +++ b/ppapi/c/dev/ppp_class_deprecated.h @@ -0,0 +1,134 @@ +// 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. + +#ifndef PPAPI_C_PPP_CLASS_DEPRECATED_H_ +#define PPAPI_C_PPP_CLASS_DEPRECATED_H_ + +#include "ppapi/c/pp_stdint.h" +#include "ppapi/c/pp_var.h" + +/** + * @file + * Defines the PPP_Class_Deprecated struct. + * + * @addtogroup PPP + * @{ + */ + +struct PP_Var; + +/** + * Interface for the plugin to implement JavaScript-accessible objects. + * + * This interface has no interface name. Instead, the plugin passes a pointer + * to this interface to PPB_Var_Deprecated.CreateObject that corresponds to the + * object being implemented. + * + * See the PPB_Var_Deprecated interface for more information on these functions. + * This interface just allows you to implement the "back end" of those + * functions, so most of the contract is specified in that interface. + * + * See + * http://code.google.com/p/ppapi/wiki/InterfacingWithJavaScript + * for general information on using and implementing vars. + */ +struct PPP_Class_Deprecated { + /** + * |name| is guaranteed to be an integer or string type var. Exception is + * guaranteed non-NULL. An integer is used for |name| when implementing + * array access into the object. This test should only return true for + * properties that are not methods. Use HasMethod() to handle methods. + */ + bool (*HasProperty)(void* object, + struct PP_Var name, + struct PP_Var* exception); + + /** + * |name| is guaranteed to be a string-type. Exception is guaranteed non-NULL. + * If the method does not exist, return false and don't set the exception. + * Errors in this function will probably not occur in general usage, but + * if you need to throw an exception, still return false. + */ + bool (*HasMethod)(void* object, + struct PP_Var name, + struct PP_Var* exception); + + /** + * |name| is guaranteed to be a string-type or an integer-type var. Exception + * is guaranteed non-NULL. An integer is used for |name| when implementing + * array access into the object. If the property does not exist, set the + * exception and return a var of type Void. A property does not exist if + * a call HasProperty() for the same |name| would return false. + */ + struct PP_Var (*GetProperty)(void* object, + struct PP_Var name, + struct PP_Var* exception); + + /** + * Exception is guaranteed non-NULL. + * + * This should include all enumerable properties, including methods. Be sure + * to set |*property_count| to 0 and |properties| to NULL in all failure + * cases, these should never be unset when calling this function. The + * pointers passed in are guaranteed not to be NULL, so you don't have to + * NULL check them. + * + * If you have any properties, allocate the property array with + * PPB_Core.MemAlloc(sizeof(PP_Var) * property_count) and add a reference + * to each property on behalf of the caller. The caller is responsible for + * Release()ing each var and calling PPB_Core.MemFree on the property pointer. + */ + void (*GetAllPropertyNames)(void* object, + uint32_t* property_count, + struct PP_Var** properties, + struct PP_Var* exception); + + /** + * |name| is guaranteed to be an integer or string type var. Exception is + * guaranteed non-NULL. + */ + void (*SetProperty)(void* object, + struct PP_Var name, + struct PP_Var value, + struct PP_Var* exception); + + /** + * |name| is guaranteed to be an integer or string type var. Exception is + * guaranteed non-NULL. + */ + void (*RemoveProperty)(void* object, + struct PP_Var name, + struct PP_Var* exception); + + // TODO(brettw) need native array access here. + + /** + * |name| is guaranteed to be a string type var. Exception is guaranteed + * non-NULL + */ + struct PP_Var (*Call)(void* object, + struct PP_Var method_name, + uint32_t argc, + struct PP_Var* argv, + struct PP_Var* exception); + + /** Exception is guaranteed non-NULL. */ + struct PP_Var (*Construct)(void* object, + uint32_t argc, + struct PP_Var* argv, + struct PP_Var* exception); + + /** + * Called when the reference count of the object reaches 0. Normally, plugins + * would free their internal data pointed to by the |object| pointer. + */ + void (*Deallocate)(void* object); +}; + +/** + * @} + * End addtogroup PPP + */ +#endif // PPAPI_C_PPP_CLASS_DEPRECATED_H_ + diff --git a/ppapi/c/dev/ppp_cursor_control_dev.h b/ppapi/c/dev/ppp_cursor_control_dev.h new file mode 100644 index 0000000..b9403f4 --- /dev/null +++ b/ppapi/c/dev/ppp_cursor_control_dev.h @@ -0,0 +1,19 @@ +// 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. + +#ifndef PPAPI_C_DEV_PPP_CURSOR_CONTROL_DEV_H_ +#define PPAPI_C_DEV_PPP_CURSOR_CONTROL_DEV_H_ + +#include "ppapi/c/pp_instance.h" + +#define PPP_CURSOR_CONTROL_DEV_INTERFACE "PPP_CursorControl(Dev);0.1" + +struct PPP_CursorControl_Dev { + // Called when the instance looses the cursor lock, e.g. because the user + // pressed the ESC key. + void (*CursorLockLost)(PP_Instance instance); +}; + +#endif // PPAPI_C_DEV_PPP_CURSOR_CONTROL_DEV_H_ + diff --git a/ppapi/c/dev/ppp_find_dev.h b/ppapi/c/dev/ppp_find_dev.h new file mode 100644 index 0000000..98586a3 --- /dev/null +++ b/ppapi/c/dev/ppp_find_dev.h @@ -0,0 +1,33 @@ +// 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. + +#ifndef PPAPI_C_DEV_PPP_FIND_DEV_H_ +#define PPAPI_C_DEV_PPP_FIND_DEV_H_ + +#include "ppapi/c/pp_instance.h" + +#define PPP_FIND_DEV_INTERFACE "PPP_Find(Dev);0.1" + +struct PPP_Find_Dev { + // Finds the given UTF-8 text starting at the current selection. The number of + // results will be updated asynchronously via NumberOfFindResultsChanged in + // PPB_Find. Note that multiple StartFind calls can happen before StopFind is + // called in the case of the search term changing. + // + // Return false if plugin doesn't support find in page. Consequently, it won't + // call any callbacks. + bool (*StartFind)(PP_Instance instance, + const char* text, + bool case_sensitive); + + // Go to the next/previous result. + void (*SelectFindResult)(PP_Instance instance, + bool forward); + + // Tells the plugin that the find operation has stopped, so it should clear + // any highlighting. + void (*StopFind)(PP_Instance instance); +}; + +#endif // PPAPI_C_DEV_PPP_FIND_DEV_H_ diff --git a/ppapi/c/dev/ppp_graphics_3d_dev.h b/ppapi/c/dev/ppp_graphics_3d_dev.h new file mode 100644 index 0000000..2dc4402 --- /dev/null +++ b/ppapi/c/dev/ppp_graphics_3d_dev.h @@ -0,0 +1,18 @@ +// 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. + +#ifndef PPAPI_C_DEV_PPP_GRAPHICS_3D_DEV_H_ +#define PPAPI_C_DEV_PPP_GRAPHICS_3D_DEV_H_ + +#include "ppapi/c/pp_instance.h" + +#define PPP_GRAPHICS_3D_DEV_INTERFACE "PPP_Graphics_3D(Dev);0.1" + +struct PPP_Graphics3D_Dev { + // Called when the OpenGL ES window is invalidated and needs to be repainted. + void (*Graphics3DContextLost)(PP_Instance instance); +}; + +#endif // PPAPI_C_DEV_PPP_GRAPHICS_3D_DEV_H_ + diff --git a/ppapi/c/dev/ppp_printing_dev.h b/ppapi/c/dev/ppp_printing_dev.h new file mode 100644 index 0000000..0a4316e --- /dev/null +++ b/ppapi/c/dev/ppp_printing_dev.h @@ -0,0 +1,74 @@ +// 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. + +#ifndef PPAPI_C_DEV_PPP_PRINTING_DEV_H_ +#define PPAPI_C_DEV_PPP_PRINTING_DEV_H_ + +#include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_rect.h" +#include "ppapi/c/pp_resource.h" +#include "ppapi/c/pp_stdint.h" + +typedef enum { + PP_PRINTORIENTATION_NORMAL = 0, + PP_PRINTORIENTATION_ROTATED_90_CW = 1, + PP_PRINTORIENTATION_ROTATED_180 = 2, + PP_PRINTORIENTATION_ROTATED_90_CCW = 3 +} PP_PrintOrientation_Dev; + +typedef enum { + PP_PRINTOUTPUTFORMAT_RASTER = 0, + PP_PRINTOUTPUTFORMAT_PDF = 1, + PP_PRINTOUTPUTFORMAT_POSTSCRIPT = 2 +} PP_PrintOutputFormat_Dev; + +struct PP_PrintSettings_Dev { + // This is the size of the printable area in points (1/72 of an inch) + struct PP_Rect printable_area; + int32_t dpi; + PP_PrintOrientation_Dev orientation; + bool grayscale; + PP_PrintOutputFormat_Dev format; +}; + +// Specifies a contiguous range of page numbers to be printed. +// The page numbers use a zero-based index. +struct PP_PrintPageNumberRange_Dev { + uint32_t first_page_number; + uint32_t last_page_number; +}; + +// Interface for the plugin to implement printing. +#define PPP_PRINTING_DEV_INTERFACE "PPP_Printing(Dev);0.1" + +struct PPP_Printing_Dev { + // Returns array of supported print output formats. The array is allocated + // using PPB_Core.MemAlloc. The caller is responsible for freeing the array + // using PPB_Core.MemFree. + // Sets |*format_count| to 0 returns NULL if printing is not supported at all. + PP_PrintOutputFormat_Dev* (*QuerySupportedFormats)(PP_Instance instance, + uint32_t* format_count); + + // Begins a print session with the given print settings. Calls to PrintPage + // can only be made after a successful call to Begin. Returns the number of + // pages required for the print output at the given page size (0 indicates + // a failure). + int32_t (*Begin)(PP_Instance instance, + const struct PP_PrintSettings_Dev* print_settings); + + // Prints the specified pages using the format specified in Begin. + // Returns a resource that represents the printed output. + // This is a PPB_ImageData resource if the output format is + // PP_PrintOutputFormat_Raster and a PPB_Blob otherwise. Returns 0 on failure. + PP_Resource (*PrintPages)( + PP_Instance instance, + const struct PP_PrintPageNumberRange_Dev* page_ranges, + uint32_t page_range_count); + + // Ends the print session. Further calls to PrintPage will fail. + void (*End)(PP_Instance instance); +}; + +#endif // PPAPI_C_DEV_PPP_PRINTING_DEV_H_ + diff --git a/ppapi/c/dev/ppp_scrollbar_dev.h b/ppapi/c/dev/ppp_scrollbar_dev.h new file mode 100644 index 0000000..73688f42 --- /dev/null +++ b/ppapi/c/dev/ppp_scrollbar_dev.h @@ -0,0 +1,22 @@ +// 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. + +#ifndef PPAPI_C_DEV_PPP_SCROLLBAR_DEV_H_ +#define PPAPI_C_DEv_PPP_SCROLLBAR_DEV_H_ + +#include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_resource.h" +#include "ppapi/c/pp_stdint.h" + +// Interface for the plugin to implement when using a scrollbar widget. +#define PPP_SCROLLBAR_DEV_INTERFACE "PPP_Scrollbar(Dev);0.1" + +struct PPP_Scrollbar_Dev { + // Informs the instance that the scrollbar's value has changed. + void (*ValueChanged)(PP_Instance instance, + PP_Resource scrollbar, + uint32_t value); +}; + +#endif // PPAPI_C_DEV_PPP_SCROLLBAR_DEV_H_ diff --git a/ppapi/c/dev/ppp_selection_dev.h b/ppapi/c/dev/ppp_selection_dev.h new file mode 100644 index 0000000..bcdc97d --- /dev/null +++ b/ppapi/c/dev/ppp_selection_dev.h @@ -0,0 +1,23 @@ +// 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. + +#ifndef PPAPI_C_DEV_PPP_SELECTION_DEV_H_ +#define PPAPI_C_DEV_PPP_SELECTION_DEV_H_ + +#include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_var.h" + +#define PPP_SELECTION_DEV_INTERFACE "PPP_Selection(Dev);0.1" + +struct PPP_Selection_Dev { + /** + * Returns the selection, either as plain text or as html depending on "html". + * If nothing is selected, or if the given format is unavailable, return a + * void string. + */ + struct PP_Var (*GetSelectedText)(PP_Instance instance, + bool html); +}; + +#endif // PPAPI_C_DEV_PPP_SELECTION_DEV_H_ diff --git a/ppapi/c/dev/ppp_widget_dev.h b/ppapi/c/dev/ppp_widget_dev.h new file mode 100644 index 0000000..26a4847 --- /dev/null +++ b/ppapi/c/dev/ppp_widget_dev.h @@ -0,0 +1,22 @@ +// 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. + +#ifndef PPAPI_C_DEV_PPP_WIDGET_DEV_H_ +#define PPAPI_C_DEV_PPP_WIDGET_DEV_H_ + +#include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_resource.h" +#include "ppapi/c/pp_rect.h" + +// Interface for the plugin to implement when using a widget. +#define PPP_WIDGET_DEV_INTERFACE "PPP_Widget(Dev);0.1" + +struct PPP_Widget_Dev { + // Informs the instance that the given rectangle needs to be repainted. + void (*Invalidate)(PP_Instance instance, + PP_Resource widget, + const struct PP_Rect* dirty_rect); +}; + +#endif // PPAPI_C_DEV_PPP_WIDGET_DEV_H_ diff --git a/ppapi/c/dev/ppp_zoom_dev.h b/ppapi/c/dev/ppp_zoom_dev.h new file mode 100644 index 0000000..725ff69 --- /dev/null +++ b/ppapi/c/dev/ppp_zoom_dev.h @@ -0,0 +1,22 @@ +// 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. + +#ifndef PPAPI_C_DEV_PPP_ZOOM_DEV_H_ +#define PPAPI_C_DEV_PPP_ZOOM_DEV_H_ + +#include "ppapi/c/pp_instance.h" + +// Zoom interface should only apply to those full-page "plugin-document". +#define PPP_ZOOM_DEV_INTERFACE "PPP_Zoom(Dev);0.1" + +struct PPP_Zoom_Dev { + // Instruct plug-in to zoom according to the given factor and whether the zoom + // only applies to text only. The scale factor is the percentage divided by + // 100, i.e. 150% zoom is 1.5. + void (*Zoom)(PP_Instance instance, + double factor, + bool text_only); +}; + +#endif // PPAPI_C_DEV_PPP_ZOOM_DEV_H_ |