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

Unified Diff: printing/metafile_factory.h

Issue 6544028: Create a Factory for NativeMetafile. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 10 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
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_ */

Powered by Google App Engine
This is Rietveld 408576698