Chromium Code Reviews| Index: printing/native_metafile_factory.cc |
| diff --git a/printing/native_metafile_factory.cc b/printing/native_metafile_factory.cc |
| index f97145252702b7c834b805bf5bd0663d3e184ad6..a2f1ec41122cc246260ce512088cc7c4a1b8cadb 100644 |
| --- a/printing/native_metafile_factory.cc |
| +++ b/printing/native_metafile_factory.cc |
| @@ -15,7 +15,28 @@ |
| namespace printing { |
| // static |
| -printing::NativeMetafile* NativeMetafileFactory::Create() { |
| +NativeMetafile* NativeMetafileFactory::Create() { |
| + NativeMetafile* metafile = CreateNewMetafile(); |
| + if (!metafile->Init()) { |
| + delete metafile; |
| + return NULL; |
| + } |
| + return metafile; |
| +} |
| + |
| +// static |
| +NativeMetafile* NativeMetafileFactory::CreateFromData( |
| + const void* src_buffer, uint32 src_buffer_size) { |
| + NativeMetafile* metafile = CreateNewMetafile(); |
| + if (!metafile->InitFromData(src_buffer, src_buffer_size)) { |
| + delete metafile; |
| + return NULL; |
| + } |
| + return metafile; |
| +} |
| + |
| +// static |
| +NativeMetafile* NativeMetafileFactory::CreateNewMetafile(){ |
|
vandebo (ex-Chrome)
2011/03/24 21:21:58
This doesn't need to be a class member. We prefer
dpapad
2011/03/24 22:02:37
I left it as a class member because this class is
|
| #if defined(OS_WIN) |
| return new printing::Emf; |
| #elif defined(OS_MACOSX) |