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_NATIVE_METAFILE_H_ |
6 #define PRINTING_NATIVE_METAFILE_H_ | 6 #define PRINTING_NATIVE_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" |
(...skipping 30 matching lines...) Expand all Loading... |
41 virtual ~NativeMetafile() {} | 41 virtual ~NativeMetafile() {} |
42 | 42 |
43 // Initializes a fresh new metafile for rendering. Returns false on failure. | 43 // Initializes a fresh new metafile for rendering. Returns false on failure. |
44 // Note: It should only be called from within the renderer process to allocate | 44 // Note: It should only be called from within the renderer process to allocate |
45 // rendering resources. | 45 // rendering resources. |
46 virtual bool Init() = 0; | 46 virtual bool Init() = 0; |
47 | 47 |
48 // Initializes the metafile with the data in |src_buffer|. Returns true | 48 // Initializes the metafile with the data in |src_buffer|. Returns true |
49 // on success. | 49 // on success. |
50 // Note: It should only be called from within the browser process. | 50 // Note: It should only be called from within the browser process. |
51 virtual bool Init(const void* src_buffer, uint32 src_buffer_size) = 0; | 51 virtual bool InitFromData(const void* src_buffer, uint32 src_buffer_size) = 0; |
52 | 52 |
53 #if defined(OS_WIN) | 53 #if defined(OS_WIN) |
54 // Inserts a custom GDICOMMENT records indicating StartPage/EndPage calls | 54 // Inserts a custom GDICOMMENT records indicating StartPage/EndPage calls |
55 // (since StartPage and EndPage do not work in a metafile DC). Only valid | 55 // (since StartPage and EndPage do not work in a metafile DC). Only valid |
56 // when hdc_ is non-NULL. | 56 // when hdc_ is non-NULL. |
57 virtual bool StartPage() = 0; | 57 virtual bool StartPage() = 0; |
58 #elif defined(OS_MACOSX) | 58 #elif defined(OS_MACOSX) |
59 // Prepares a new pdf page at specified |content_origin| with the given | 59 // Prepares a new pdf page at specified |content_origin| with the given |
60 // |page_size| and a |scale_factor| to use for the drawing. | 60 // |page_size| and a |scale_factor| to use for the drawing. |
61 virtual gfx::NativeDrawingContext StartPage(const gfx::Size& page_size, | 61 virtual gfx::NativeDrawingContext StartPage(const gfx::Size& page_size, |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 // Returns true if writing succeeded. | 180 // Returns true if writing succeeded. |
181 virtual bool SaveToFD(const base::FileDescriptor& fd) const = 0; | 181 virtual bool SaveToFD(const base::FileDescriptor& fd) const = 0; |
182 #endif // if defined(OS_CHROMEOS) | 182 #endif // if defined(OS_CHROMEOS) |
183 | 183 |
184 #endif | 184 #endif |
185 }; | 185 }; |
186 | 186 |
187 } // namespace printing | 187 } // namespace printing |
188 | 188 |
189 #endif // PRINTING_NATIVE_METAFILE_H_ | 189 #endif // PRINTING_NATIVE_METAFILE_H_ |
OLD | NEW |