Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3302)

Unified Diff: chrome/renderer/webplugin_delegate_pepper.cc

Issue 6544028: Create a Factory for NativeMetafile. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ARM compile failure fix Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/renderer/print_web_view_helper_win.cc ('k') | chrome/renderer/webplugin_delegate_proxy.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/webplugin_delegate_pepper.cc
diff --git a/chrome/renderer/webplugin_delegate_pepper.cc b/chrome/renderer/webplugin_delegate_pepper.cc
index 921138f5f633f625fc9ca0fcfa83bb8b30f90185..43709f83ea7d24b2b5f0b2d3fbd523a2b62baefe 100644
--- a/chrome/renderer/webplugin_delegate_pepper.cc
+++ b/chrome/renderer/webplugin_delegate_pepper.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
@@ -15,18 +15,12 @@
#include "base/file_path.h"
#include "base/file_util.h"
-#if defined(OS_MACOSX)
-#include "base/mac/mac_util.h"
-#endif
#include "base/md5.h"
#include "base/message_loop.h"
#include "base/metrics/histogram.h"
#include "base/metrics/stats_counters.h"
#include "base/path_service.h"
#include "base/process_util.h"
-#if defined(OS_MACOSX)
-#include "base/mac/scoped_cftyperef.h"
-#endif
#include "base/scoped_ptr.h"
#include "base/string_number_conversions.h"
#include "base/string_util.h"
@@ -39,17 +33,9 @@
#include "chrome/renderer/pepper_widget.h"
#include "chrome/renderer/render_thread.h"
#include "chrome/renderer/render_view.h"
-#if defined(OS_LINUX)
-#include "chrome/renderer/renderer_sandbox_support_linux.h"
-#endif
#include "chrome/renderer/webplugin_delegate_proxy.h"
#include "ui/gfx/blit.h"
-#if defined(OS_WIN)
-#include "printing/units.h"
-#include "skia/ext/vector_platform_device.h"
-#include "ui/gfx/codec/jpeg_codec.h"
-#include "ui/gfx/gdi_util.h"
-#endif
+#include "printing/native_metafile_factory.h"
#include "printing/native_metafile.h"
#include "third_party/npapi/bindings/npapi_extensions.h"
#include "third_party/npapi/bindings/npapi_extensions_private.h"
@@ -64,6 +50,19 @@
#include "webkit/plugins/npapi/plugin_host.h"
#include "webkit/plugins/npapi/plugin_stream_url.h"
+#if defined(OS_MACOSX)
+#include "base/mac/mac_util.h"
+#include "base/mac/scoped_cftyperef.h"
+#elif defined(OS_LINUX)
+#include "chrome/renderer/renderer_sandbox_support_linux.h"
+#include "printing/pdf_ps_metafile_cairo.h"
+#elif defined(OS_WIN)
+#include "printing/units.h"
+#include "skia/ext/vector_platform_device.h"
+#include "ui/gfx/codec/jpeg_codec.h"
+#include "ui/gfx/gdi_util.h"
+#endif
+
#if defined(ENABLE_GPU)
#include "webkit/plugins/npapi/plugin_constants_win.h"
#endif
@@ -1222,7 +1221,7 @@ bool WebPluginDelegatePepper::VectorPrintPage(int page_number,
// directly.
cairo_t* context = canvas->beginPlatformPaint();
printing::NativeMetafile* metafile =
- printing::NativeMetafile::FromCairoContext(context);
+ printing::PdfPsMetafile::FromCairoContext(context);
DCHECK(metafile);
if (metafile) {
ret = metafile->SetRawData(pdf_output, output_size);
@@ -1231,14 +1230,15 @@ bool WebPluginDelegatePepper::VectorPrintPage(int page_number,
}
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(pdf_output, output_size)) {
+ if (metafile->Init(pdf_output, output_size)) {
// Flip the transform.
CGContextSaveGState(canvas);
CGContextTranslateCTM(canvas, 0, current_printable_area_.height());
CGContextScaleCTM(canvas, 1.0, -1.0);
- ret = metafile.RenderPage(1, canvas, current_printable_area_.ToCGRect(),
+ ret = metafile->RenderPage(1, canvas, current_printable_area_.ToCGRect(),
true, false, true, true);
CGContextRestoreGState(canvas);
}
« no previous file with comments | « chrome/renderer/print_web_view_helper_win.cc ('k') | chrome/renderer/webplugin_delegate_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698