diff options
author | dpapad@chromium.org <dpapad@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-02 19:25:17 +0000 |
---|---|---|
committer | dpapad@chromium.org <dpapad@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-02 19:25:17 +0000 |
commit | 5ad7617cd93b48a67395f532b8483b8ace445ca2 (patch) | |
tree | ef6ec65870ccdea737de7e0fdcf1d89e2d887511 /webkit | |
parent | f83773f72845ed180a23dcbbfa9afbc3c295f758 (diff) | |
download | chromium_src-5ad7617cd93b48a67395f532b8483b8ace445ca2.zip chromium_src-5ad7617cd93b48a67395f532b8483b8ace445ca2.tar.gz chromium_src-5ad7617cd93b48a67395f532b8483b8ace445ca2.tar.bz2 |
Applying factory pattern (through NativeMetafileFactory class). It is used to retrieve different printing contexts (based on the platform and user preferences).
BUG=NONE
TEST=NONE
Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=76553
Reverted: http://src.chromium.org/viewvc/chrome?view=rev&revision=76555
Review URL: http://codereview.chromium.org/6544028
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@76581 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r-- | webkit/plugins/ppapi/ppapi_plugin_instance.cc | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/webkit/plugins/ppapi/ppapi_plugin_instance.cc b/webkit/plugins/ppapi/ppapi_plugin_instance.cc index bd4264c..3c24dfb 100644 --- a/webkit/plugins/ppapi/ppapi_plugin_instance.cc +++ b/webkit/plugins/ppapi/ppapi_plugin_instance.cc @@ -22,7 +22,6 @@ #include "ppapi/c/ppb_core.h" #include "ppapi/c/ppb_instance.h" #include "ppapi/c/ppp_instance.h" -#include "printing/native_metafile.h" #include "printing/units.h" #include "skia/ext/vector_platform_device.h" #include "skia/ext/platform_canvas.h" @@ -54,9 +53,18 @@ #include "webkit/plugins/ppapi/string.h" #include "webkit/plugins/ppapi/var.h" +#if defined(OS_POSIX) +#include "printing/native_metafile.h" +#endif + #if defined(OS_MACOSX) #include "base/mac/mac_util.h" #include "base/mac/scoped_cftyperef.h" +#include "printing/native_metafile_factory.h" +#endif + +#if defined(OS_LINUX) +#include "printing/pdf_ps_metafile_cairo.h" #endif #if defined(OS_WIN) @@ -1035,15 +1043,16 @@ bool PluginInstance::PrintPDFOutput(PP_Resource print_output, // directly. cairo_t* context = canvas->beginPlatformPaint(); printing::NativeMetafile* metafile = - printing::NativeMetafile::FromCairoContext(context); + printing::PdfPsMetafile::FromCairoContext(context); DCHECK(metafile); if (metafile) ret = metafile->SetRawData(buffer->mapped_buffer(), buffer->size()); canvas->endPlatformPaint(); #elif defined(OS_MACOSX) - printing::NativeMetafile metafile; + scoped_ptr<printing::NativeMetafile> metafile( + printing::NativeMetafileFactory::CreateMetafile()); // Create a PDF metafile and render from there into the passed in context. - if (metafile.Init(buffer->mapped_buffer(), buffer->size())) { + if (metafile->Init(buffer->mapped_buffer(), buffer->size())) { // Flip the transform. CGContextSaveGState(canvas); CGContextTranslateCTM(canvas, 0, @@ -1055,7 +1064,7 @@ bool PluginInstance::PrintPDFOutput(PP_Resource print_output, page_rect.size.width = current_print_settings_.printable_area.size.width; page_rect.size.height = current_print_settings_.printable_area.size.height; - ret = metafile.RenderPage(1, canvas, page_rect, true, false, true, true); + ret = metafile->RenderPage(1, canvas, page_rect, true, false, true, true); CGContextRestoreGState(canvas); } #elif defined(OS_WIN) |