summaryrefslogtreecommitdiffstats
path: root/printing/native_metafile_factory.h
blob: 610970f2a3104cc636b94994861f9ca88d3d13b0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// Copyright (c) 2011 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 PRINTING_NATIVE_METAFILE_FACTORY_H_
#define PRINTING_NATIVE_METAFILE_FACTORY_H_

#include "base/basictypes.h"
#include "printing/native_metafile.h"

namespace printing {

// Various printing contexts will be supported in the future (cairo, skia, emf).
// So this class returns the appropriate context depending on the platform and
// user preferences.
// (Note: For the moment there is only one option per platform.)
class NativeMetafileFactory {
 public:
  // This method returns a pointer to the appropriate NativeMetafile object
  // according to the platform. The metafile is already initialized by invoking
  // Init() on it. NULL is returned if Init() fails.
  static printing::NativeMetafile* Create();

  // This method returns a pointer to the appropriate NativeMetafile object
  // according to the platform. The metafile is already initialized by invoking
  // InitFromData(src_buffer,_buffer_size) on it. NULL is returned if
  // InitiFromData() fails.
  static printing::NativeMetafile* CreateFromData(const void* src_buffer,
                                                  uint32 src_buffer_size);

 private:
  NativeMetafileFactory();

  // Retrieves a new uninitialized metafile.
  static NativeMetafile* CreateNewMetafile();

  DISALLOW_COPY_AND_ASSIGN(NativeMetafileFactory);
};

}  // namespace printing

#endif  // PRINTING_NATIVE_METAFILE_FACTORY_H_