Index: webkit/plugins/ppapi/ppapi_plugin_instance.cc |
diff --git a/webkit/plugins/ppapi/ppapi_plugin_instance.cc b/webkit/plugins/ppapi/ppapi_plugin_instance.cc |
index bee7a619635fcfe11a1cdfecc0ec0c3114cf6bfe..b56bf80610db9bd3e3e942133f53e7da468f8f3b 100644 |
--- a/webkit/plugins/ppapi/ppapi_plugin_instance.cc |
+++ b/webkit/plugins/ppapi/ppapi_plugin_instance.cc |
@@ -67,7 +67,7 @@ |
#include "printing/metafile_impl.h" |
#endif |
-#if defined(OS_LINUX) |
+#if defined(OS_POSIX) && !defined(OS_MACOSX) |
#include "printing/metafile.h" |
#include "printing/metafile_skia_wrapper.h" |
#endif |
@@ -353,9 +353,9 @@ PluginInstance::PluginInstance(PluginDelegate* delegate, |
plugin_selection_interface_(NULL), |
plugin_zoom_interface_(NULL), |
checked_for_plugin_messaging_interface_(false), |
-#if defined(OS_LINUX) |
+#if defined(OS_POSIX) && !defined(OS_MACOSX) |
canvas_(NULL), |
-#endif // defined(OS_LINUX) |
+#endif // OS_POSIX && !OS_MACOSX |
plugin_print_interface_(NULL), |
plugin_graphics_3d_interface_(NULL), |
always_on_top_(false), |
@@ -388,9 +388,9 @@ PluginInstance::~PluginInstance() { |
module_->InstanceDeleted(this); |
ResourceTracker::Get()->InstanceDeleted(pp_instance_); |
-#if defined(OS_LINUX) |
+#if defined(OS_POSIX) && !defined(OS_MACOSX) |
ranges_.clear(); |
-#endif // defined(OS_LINUX) |
+#endif // OS_POSIX && !OS_MACOSX |
} |
// static |
@@ -1125,10 +1125,10 @@ int PluginInstance::PrintBegin(const gfx::Rect& printable_area, |
if (!num_pages) |
return 0; |
current_print_settings_ = print_settings; |
-#if defined(OS_LINUX) |
+#if defined(OS_POSIX) && !defined(OS_MACOSX) |
canvas_ = NULL; |
ranges_.clear(); |
-#endif // defined(OS_LINUX) |
+#endif // OS_POSIX && !OS_MACOSX |
return num_pages; |
} |
@@ -1136,13 +1136,13 @@ bool PluginInstance::PrintPage(int page_number, WebKit::WebCanvas* canvas) { |
DCHECK(plugin_print_interface_.get()); |
PP_PrintPageNumberRange_Dev page_range; |
page_range.first_page_number = page_range.last_page_number = page_number; |
-#if defined(OS_LINUX) |
+#if defined(OS_POSIX) && !defined(OS_MACOSX) |
ranges_.push_back(page_range); |
canvas_ = canvas; |
return true; |
#else |
return PrintPageHelper(&page_range, 1, canvas); |
-#endif // defined(OS_LINUX) |
+#endif // defined(OS_POSIX) && !defined(OS_MACOSX) |
} |
bool PluginInstance::PrintPageHelper(PP_PrintPageNumberRange_Dev* page_ranges, |
@@ -1171,13 +1171,13 @@ bool PluginInstance::PrintPageHelper(PP_PrintPageNumberRange_Dev* page_ranges, |
void PluginInstance::PrintEnd() { |
// Keep a reference on the stack. See NOTE above. |
scoped_refptr<PluginInstance> ref(this); |
-#if defined(OS_LINUX) |
+#if defined(OS_POSIX) && !defined(OS_MACOSX) |
// This hack is here because all pages need to be written to PDF at once. |
if (!ranges_.empty()) |
PrintPageHelper(&(ranges_.front()), ranges_.size(), canvas_); |
canvas_ = NULL; |
ranges_.clear(); |
-#endif // defined(OS_LINUX) |
+#endif // OS_POSIX && !OS_MACOSX |
DCHECK(plugin_print_interface_.get()); |
if (plugin_print_interface_.get()) |
@@ -1293,16 +1293,7 @@ bool PluginInstance::PrintPDFOutput(PP_Resource print_output, |
#endif // defined(OS_WIN) |
bool ret = false; |
-#if defined(OS_LINUX) |
- // 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) |
+#if defined(OS_MACOSX) |
printing::NativeMetafile metafile; |
// Create a PDF metafile and render from there into the passed in context. |
if (metafile.InitFromData(buffer->mapped_buffer(), buffer->size())) { |
@@ -1320,6 +1311,15 @@ bool PluginInstance::PrintPDFOutput(PP_Resource print_output, |
ret = metafile.RenderPage(1, canvas, page_rect, true, false, true, true); |
CGContextRestoreGState(canvas); |
} |
+#elif defined(OS_POSIX) |
+ // On Unix, 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_WIN) |
// On Windows, we now need to render the PDF to the DC that backs the |
// supplied canvas. |