summaryrefslogtreecommitdiffstats
path: root/third_party
diff options
context:
space:
mode:
authorsanjeevr@chromium.org <sanjeevr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-11 21:38:30 +0000
committersanjeevr@chromium.org <sanjeevr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-11 21:38:30 +0000
commitd1192bcc5436ea4c57b3317a1951060bdd9d4215 (patch)
treed7736733e1af4adc3840ecadc125eb6ab4bb68de /third_party
parent34bffb27918ff7ab2bf6d9a2cfd958a075a2deaa (diff)
downloadchromium_src-d1192bcc5436ea4c57b3317a1951060bdd9d4215.zip
chromium_src-d1192bcc5436ea4c57b3317a1951060bdd9d4215.tar.gz
chromium_src-d1192bcc5436ea4c57b3317a1951060bdd9d4215.tar.bz2
Added functions to the Pepper interface to allow plugins to participate in the browser's print workflow. For now, added an interface for raster print output.
Also modified vector_platform_device_win.cc to allow the caller to set a bitmap compression mode for use in the internalDrawBitmap method. Supported compression modes are JPEG and PNG. BUG=none TEST=Test printing with new plugins that support this interface. Review URL: http://codereview.chromium.org/669280 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@41321 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'third_party')
-rw-r--r--third_party/npapi/bindings/npapi_extensions.h58
1 files changed, 57 insertions, 1 deletions
diff --git a/third_party/npapi/bindings/npapi_extensions.h b/third_party/npapi/bindings/npapi_extensions.h
index 1f18a10..4c22ff0 100644
--- a/third_party/npapi/bindings/npapi_extensions.h
+++ b/third_party/npapi/bindings/npapi_extensions.h
@@ -11,11 +11,17 @@
#include "npapi.h"
/*
- * A fake "enum" value for getting Pepper extensions.
+ * A fake "enum" value for getting browser-implemented Pepper extensions.
* The variable returns a pointer to an NPPepperExtensions structure
*/
#define NPNVPepperExtensions ((NPNVariable) 4000)
+/*
+ * A fake "enum" value for getting plugin-implemented Pepper extensions.
+ * The variable returns a pointer to an NPPPepperExtensions structure
+ */
+#define NPPVPepperExtensions ((NPPVariable) 4001)
+
typedef void NPDeviceConfig;
typedef void NPDeviceContext;
typedef void NPUserData;
@@ -482,4 +488,54 @@ struct _NPDeviceContextAudio {
void *reserved;
};
+/* Printing related APIs ---------------------------------------------------*/
+
+/* Being a print operation. Returns the total number of pages to print at the
+ * given printableArea size and DPI. printableArea is in points (a point is 1/72
+ * of an inch). */
+typedef NPError (*NPPPrintBeginPtr) (
+ NPP instance,
+ NPRect* printableArea,
+ int32 printerDPI,
+ int32* numPages);
+/* Returns the required raster dimensions for the given printableArea
+ * size and DPI. printableArea is in points (a point is 1/72 of an inch). */
+typedef NPError (*NPPGetRasterDimensionsPtr) (
+ NPP instance,
+ NPRect* printableArea,
+ int32 printerDPI,
+ int32* widthInPixels,
+ int32* heightInPixels);
+/* Prints the specified page on the given printableArea size and DPI.
+ * printableArea is in points (a point is 1/72 of an inch). This allows the
+ * plugin to print a raster output*/
+typedef NPError (*NPPPrintPageRasterPtr) (
+ NPP instance,
+ int32 pageNumber,
+ NPRect* printableArea,
+ int32 printerDPI,
+ NPDeviceContext2D* printSurface);
+
+/* Ends the print operation */
+typedef NPError (*NPPPrintEndPtr) (NPP instance);
+
+/* TODO(sanjeevr) : Provide a vector interface for printing. We need to decide
+ * on a vector format that can support embedded fonts. A vector format will
+ * greatly reduce the size of the required output buffer
+*/
+
+typedef struct _NPPPrintExtensions {
+ NPPPrintBeginPtr printBegin;
+ NPPGetRasterDimensionsPtr getRasterDimensions;
+ NPPPrintPageRasterPtr printPageRaster;
+ NPPPrintEndPtr printEnd;
+} NPPPrintExtensions;
+
+/* Returns NULL if the plugin does not support print extensions */
+typedef NPPPrintExtensions* (*NPPGetPrintExtensionsPtr)(NPP instance);
+
+typedef struct _NPPExtensions {
+ NPPGetPrintExtensionsPtr getPrintExtensions;
+} NPPExtensions;
+
#endif /* _NP_EXTENSIONS_H_ */