Index: printing/metafile_factory.h |
diff --git a/printing/metafile_factory.h b/printing/metafile_factory.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..c751848f5aaed2226c4c7b2b3a4a44a8fa4c6d9b |
--- /dev/null |
+++ b/printing/metafile_factory.h |
@@ -0,0 +1,43 @@ |
+// Copyright (c) 2010 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. |
+ |
+#ifndef METAFILE_FACTORY_H_ |
+#define METAFILE_FACTORY_H_ |
+ |
+#include "base/basictypes.h" |
+#include "printing/native_metafile.h" |
+ |
+#if defined(OS_WIN) |
+ #include "printing/emf_win.h" |
+#elif defined(OS_MACOSX) |
+ #include "printing/pdf_metafile_mac.h" |
+#elif defined(OS_POSIX) |
+ #include "printing/pdf_ps_metafile_cairo.h" |
+#endif |
+ |
+namespace printing { |
+ |
+// This class is used to obtain pointers to NativeMetafile objects. It is the |
+// only way to initialize such objects since their constructors are private. |
+class MetafileFactory { |
+ public: |
+ virtual ~MetafileFactory(); |
+ |
+ // This method takes care of returning a pointer to the appropriate |
+ // NativeMetafile object according to the platform. |
+ static printing::NativeMetafile* GetMetafile(); |
+ |
+#if defined(OS_LINUX) |
+ static printing::NativeMetafile* |
+ GetMetafileFrom(cairo_t* context); |
+#endif |
+ |
+ private: |
+ MetafileFactory(); |
+ DISALLOW_COPY_AND_ASSIGN(MetafileFactory); |
+}; |
+ |
+} // namespace printing |
+ |
+#endif /* METAFILE_FACTORY_H_ */ |