| Index: printing/native_metafile_factory.cc
|
| diff --git a/printing/native_metafile_factory.cc b/printing/native_metafile_factory.cc
|
| index f97145252702b7c834b805bf5bd0663d3e184ad6..a579559fb8c2416fa7374efe5b3f61c59bd53836 100644
|
| --- a/printing/native_metafile_factory.cc
|
| +++ b/printing/native_metafile_factory.cc
|
| @@ -16,13 +16,33 @@ namespace printing {
|
|
|
| // static
|
| printing::NativeMetafile* NativeMetafileFactory::Create() {
|
| + NativeMetafile* metafile;
|
| #if defined(OS_WIN)
|
| - return new printing::Emf;
|
| + metafile = new printing::Emf;
|
| #elif defined(OS_MACOSX)
|
| - return new printing::PdfMetafile;
|
| + metafile = new printing::PdfMetafile;
|
| #elif defined(OS_POSIX)
|
| - return new printing::PdfPsMetafile;
|
| + metafile = new printing::PdfPsMetafile;
|
| #endif
|
| + if(!metafile->Init())
|
| + return NULL;
|
| + return metafile;
|
| +}
|
| +
|
| +// static
|
| +printing::NativeMetafile* NativeMetafileFactory::CreateFromData(
|
| + const void* src_buffer, uint32 src_buffer_size) {
|
| + NativeMetafile* metafile;
|
| +#if defined(OS_WIN)
|
| + metafile = new printing::Emf;
|
| +#elif defined(OS_MACOSX)
|
| + metafile = new printing::PdfMetafile;
|
| +#elif defined(OS_POSIX)
|
| + metafile = new printing::PdfPsMetafile;
|
| +#endif
|
| + if(!metafile->InitFromData(src_buffer, src_buffer_size))
|
| + return NULL;
|
| + return metafile;
|
| }
|
|
|
| } // namespace printing
|
|
|