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

Unified Diff: printing/native_metafile_factory.cc

Issue 6696076: Adding CreateFromData to NativeMetafileFactory (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebasing Created 9 years, 9 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 | « printing/native_metafile_factory.h ('k') | webkit/plugins/ppapi/ppapi_plugin_instance.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: printing/native_metafile_factory.cc
diff --git a/printing/native_metafile_factory.cc b/printing/native_metafile_factory.cc
index f97145252702b7c834b805bf5bd0663d3e184ad6..f31994b48ec9ba3028a0f6f2faa0f9b5669a34b7 100644
--- a/printing/native_metafile_factory.cc
+++ b/printing/native_metafile_factory.cc
@@ -4,6 +4,8 @@
#include "printing/native_metafile_factory.h"
+#include "base/scoped_ptr.h"
+
#if defined(OS_WIN)
#include "printing/emf_win.h"
#elif defined(OS_MACOSX)
@@ -15,7 +17,24 @@
namespace printing {
// static
-printing::NativeMetafile* NativeMetafileFactory::Create() {
+NativeMetafile* NativeMetafileFactory::Create() {
+ scoped_ptr<NativeMetafile> metafile(CreateNewMetafile());
+ if (!metafile->Init())
+ return NULL;
+ return metafile.release();
+}
+
+// static
+NativeMetafile* NativeMetafileFactory::CreateFromData(
+ const void* src_buffer, uint32 src_buffer_size) {
+ scoped_ptr<NativeMetafile> metafile(CreateNewMetafile());
+ if (!metafile->InitFromData(src_buffer, src_buffer_size))
+ return NULL;
+ return metafile.release();
+}
+
+// static
+NativeMetafile* NativeMetafileFactory::CreateNewMetafile(){
#if defined(OS_WIN)
return new printing::Emf;
#elif defined(OS_MACOSX)
« no previous file with comments | « printing/native_metafile_factory.h ('k') | webkit/plugins/ppapi/ppapi_plugin_instance.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698