diff options
author | sanjeevr@chromium.org <sanjeevr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-11 21:38:30 +0000 |
---|---|---|
committer | sanjeevr@chromium.org <sanjeevr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-11 21:38:30 +0000 |
commit | d1192bcc5436ea4c57b3317a1951060bdd9d4215 (patch) | |
tree | d7736733e1af4adc3840ecadc125eb6ab4bb68de /webkit/glue | |
parent | 34bffb27918ff7ab2bf6d9a2cfd958a075a2deaa (diff) | |
download | chromium_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 'webkit/glue')
-rw-r--r-- | webkit/glue/plugins/webplugin_print_delegate.h | 51 | ||||
-rw-r--r-- | webkit/glue/webplugin_delegate.h | 5 |
2 files changed, 55 insertions, 1 deletions
diff --git a/webkit/glue/plugins/webplugin_print_delegate.h b/webkit/glue/plugins/webplugin_print_delegate.h new file mode 100644 index 0000000..1cd5b6d --- /dev/null +++ b/webkit/glue/plugins/webplugin_print_delegate.h @@ -0,0 +1,51 @@ +// 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 WEBKIT_GLUE_PLUGINS_WEBPLUGIN_PRINT_DELEGATE_H_ +#define WEBKIT_GLUE_PLUGINS_WEBPLUGIN_PRINT_DELEGATE_H_ + +#include "base/basictypes.h" +#include "third_party/npapi/bindings/npapi_extensions.h" + +namespace gfx { +class Rect; +} + +namespace webkit_glue { + +// Interface for the NPAPI print extension. This class implements "NOP" +// versions of all these functions so it can be used seamlessly by the +// "regular" plugin delegate while being overridden by the "pepper" one. +class WebPluginPrintDelegate { + public: + // If a plugin supports print extensions, then it gets to participate fully + // in the browser's print workflow by specifying the number of pages to be + // printed and providing a print output for specified pages. + virtual bool PrintSupportsPrintExtension() { + return false; + } + + // Note: printable_area is in points (a point is 1/72 of an inch). + virtual int PrintBegin(const gfx::Rect& printable_area, int printer_dpi) { + return 0; + } + + // Note: printable_area is in points (a point is 1/72 of an inch). + virtual bool PrintPage(int page_number, const gfx::Rect& printable_area, + int printer_dpi, WebKit::WebCanvas* canvas) { + return false; + } + + virtual void PrintEnd() { + } + + protected: + WebPluginPrintDelegate() {} + virtual ~WebPluginPrintDelegate() {} +}; + +} // namespace webkit_glue + +#endif // WEBKIT_GLUE_PLUGINS_WEBPLUGIN_PRINT_DELEGATE_H_ + diff --git a/webkit/glue/webplugin_delegate.h b/webkit/glue/webplugin_delegate.h index 52c7186..8285d6c 100644 --- a/webkit/glue/webplugin_delegate.h +++ b/webkit/glue/webplugin_delegate.h @@ -17,6 +17,8 @@ #include "webkit/glue/plugins/webplugin_2d_device_delegate.h" #include "webkit/glue/plugins/webplugin_3d_device_delegate.h" #include "webkit/glue/plugins/webplugin_audio_device_delegate.h" +#include "webkit/glue/plugins/webplugin_print_delegate.h" + class FilePath; class GURL; @@ -39,7 +41,8 @@ class WebPluginResourceClient; // This is the interface that a plugin implementation needs to provide. class WebPluginDelegate : public WebPlugin2DDeviceDelegate, public WebPlugin3DDeviceDelegate, - public WebPluginAudioDeviceDelegate { + public WebPluginAudioDeviceDelegate, + public WebPluginPrintDelegate { public: virtual ~WebPluginDelegate() {} |