OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef PRINTING_NATIVE_METAFILE_H_ | 5 #ifndef PRINTING_METAFILE_H_ |
6 #define PRINTING_NATIVE_METAFILE_H_ | 6 #define PRINTING_METAFILE_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
10 #include "ui/gfx/native_widget_types.h" | 10 #include "ui/gfx/native_widget_types.h" |
11 | 11 |
12 #if defined(OS_WIN) | 12 #if defined(OS_WIN) |
13 #include <windows.h> | 13 #include <windows.h> |
14 #include <vector> | |
15 #elif defined(OS_MACOSX) | 14 #elif defined(OS_MACOSX) |
16 #include <ApplicationServices/ApplicationServices.h> | 15 #include <ApplicationServices/ApplicationServices.h> |
17 #include <CoreFoundation/CoreFoundation.h> | 16 #include <CoreFoundation/CoreFoundation.h> |
18 #include "base/mac/scoped_cftyperef.h" | 17 #include "base/mac/scoped_cftyperef.h" |
19 #endif | 18 #endif |
20 | 19 |
21 class FilePath; | 20 class FilePath; |
22 | 21 |
23 namespace gfx { | 22 namespace gfx { |
24 class Point; | 23 class Point; |
25 class Rect; | 24 class Rect; |
26 class Size; | 25 class Size; |
27 } | 26 } |
28 | 27 |
29 namespace skia { | 28 namespace skia { |
30 class PlatformDevice; | 29 class PlatformDevice; |
31 } | 30 } |
32 | 31 |
33 #if defined(OS_CHROMEOS) | 32 #if defined(OS_CHROMEOS) |
34 namespace base { | 33 namespace base { |
35 class FileDescriptor; | 34 class FileDescriptor; |
36 } | 35 } |
37 #endif | 36 #endif |
38 | 37 |
39 namespace printing { | 38 namespace printing { |
40 | 39 |
41 // This class creates a graphics context that renders into a data stream | 40 // This class creates a graphics context that renders into a data stream |
42 // (usually PDF or EMF). | 41 // (usually PDF or EMF). |
43 class NativeMetafile { | 42 class Metafile { |
44 public: | 43 public: |
45 virtual ~NativeMetafile() {} | 44 virtual ~Metafile() {} |
46 | 45 |
47 // Initializes a fresh new metafile for rendering. Returns false on failure. | 46 // Initializes a fresh new metafile for rendering. Returns false on failure. |
48 // Note: It should only be called from within the renderer process to allocate | 47 // Note: It should only be called from within the renderer process to allocate |
49 // rendering resources. | 48 // rendering resources. |
50 virtual bool Init() = 0; | 49 virtual bool Init() = 0; |
51 | 50 |
52 // Initializes the metafile with the data in |src_buffer|. Returns true | 51 // Initializes the metafile with the data in |src_buffer|. Returns true |
53 // on success. | 52 // on success. |
54 // Note: It should only be called from within the browser process. | 53 // Note: It should only be called from within the browser process. |
55 virtual bool InitFromData(const void* src_buffer, uint32 src_buffer_size) = 0; | 54 virtual bool InitFromData(const void* src_buffer, uint32 src_buffer_size) = 0; |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 #elif defined(OS_CHROMEOS) | 141 #elif defined(OS_CHROMEOS) |
143 // Saves the underlying data to the file associated with fd. This function | 142 // Saves the underlying data to the file associated with fd. This function |
144 // should ONLY be called after the metafile is closed. | 143 // should ONLY be called after the metafile is closed. |
145 // Returns true if writing succeeded. | 144 // Returns true if writing succeeded. |
146 virtual bool SaveToFD(const base::FileDescriptor& fd) const = 0; | 145 virtual bool SaveToFD(const base::FileDescriptor& fd) const = 0; |
147 #endif // if defined(OS_CHROMEOS) | 146 #endif // if defined(OS_CHROMEOS) |
148 }; | 147 }; |
149 | 148 |
150 } // namespace printing | 149 } // namespace printing |
151 | 150 |
152 #endif // PRINTING_NATIVE_METAFILE_H_ | 151 #endif // PRINTING_METAFILE_H_ |
OLD | NEW |