summaryrefslogtreecommitdiffstats
path: root/webkit/plugins
diff options
context:
space:
mode:
authorvandebo@chromium.org <vandebo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-11 21:54:06 +0000
committervandebo@chromium.org <vandebo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-11 21:54:06 +0000
commit7d748990b39550c77aa914ba6846885dd7352e10 (patch)
tree3777582ee9816b3488f218b594db1918e5ebe752 /webkit/plugins
parent03e204f307255e8f39aeb002f94b8eb04137e7f9 (diff)
downloadchromium_src-7d748990b39550c77aa914ba6846885dd7352e10.zip
chromium_src-7d748990b39550c77aa914ba6846885dd7352e10.tar.gz
chromium_src-7d748990b39550c77aa914ba6846885dd7352e10.tar.bz2
Connect the right metafiles for print preview on Linux and Windows.
+ Remove the NativeMetafileFactory since we can't just use preview flag. + Update each Metafile constructor site to use PreviewMetafile or NativeMetafileImpl. + Fix misc. problems blocking pdf generation on Windows. + Rename the metafile interface. BUG=NONE TEST=NONE Review URL: http://codereview.chromium.org/6826027 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@81161 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/plugins')
-rw-r--r--webkit/plugins/ppapi/ppapi_plugin_instance.cc25
1 files changed, 11 insertions, 14 deletions
diff --git a/webkit/plugins/ppapi/ppapi_plugin_instance.cc b/webkit/plugins/ppapi/ppapi_plugin_instance.cc
index fa5b9aa..cd2d59f 100644
--- a/webkit/plugins/ppapi/ppapi_plugin_instance.cc
+++ b/webkit/plugins/ppapi/ppapi_plugin_instance.cc
@@ -59,18 +59,15 @@
#include "webkit/plugins/ppapi/var.h"
#include "webkit/plugins/sad_plugin.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"
+#include "printing/metafile_impl.h"
#endif
#if defined(OS_LINUX)
-#include "printing/native_metafile_skia_wrapper.h"
+#include "printing/metafile.h"
+#include "printing/metafile_skia_wrapper.h"
#endif
#if defined(OS_WIN)
@@ -1202,18 +1199,18 @@ bool PluginInstance::PrintPDFOutput(PP_Resource print_output,
bool ret = false;
#if defined(OS_LINUX)
- // On Linux we just set the final bits in the native metafile.
- printing::NativeMetafile* metafile =
- printing::NativeMetafileSkiaWrapper::GetMetafileFromCanvas(canvas);
+ // On Linux we just set the final bits in the native metafile
+ // (NativeMetafile and PreviewMetafile must have compatible formats,
+ // i.e. both PDF for this to work).
+ printing::Metafile* metafile =
+ printing::MetafileSkiaWrapper::GetMetafileFromCanvas(canvas);
DCHECK(metafile != NULL);
if (metafile)
ret = metafile->InitFromData(buffer->mapped_buffer(), buffer->size());
#elif defined(OS_MACOSX)
+ printing::NativeMetafile metafile;
// Create a PDF metafile and render from there into the passed in context.
- scoped_ptr<printing::NativeMetafile> metafile(
- printing::NativeMetafileFactory::CreateFromData(buffer->mapped_buffer(),
- buffer->size()));
- if (metafile.get() != NULL) {
+ if (metafile.InitFromData(buffer->mapped_buffer(), buffer->size())) {
// Flip the transform.
CGContextSaveGState(canvas);
CGContextTranslateCTM(canvas, 0,
@@ -1225,7 +1222,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)