| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_METAFILE_H_ | 5 #ifndef PRINTING_METAFILE_H_ |
| 6 #define PRINTING_METAFILE_H_ | 6 #define PRINTING_METAFILE_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 | 92 |
| 93 private: | 93 private: |
| 94 DISALLOW_COPY_AND_ASSIGN(MetafilePlayer); | 94 DISALLOW_COPY_AND_ASSIGN(MetafilePlayer); |
| 95 }; | 95 }; |
| 96 | 96 |
| 97 // This class creates a graphics context that renders into a data stream | 97 // This class creates a graphics context that renders into a data stream |
| 98 // (usually PDF or EMF). | 98 // (usually PDF or EMF). |
| 99 class PRINTING_EXPORT Metafile : public MetafilePlayer { | 99 class PRINTING_EXPORT Metafile : public MetafilePlayer { |
| 100 public: | 100 public: |
| 101 Metafile(); | 101 Metafile(); |
| 102 virtual ~Metafile(); | 102 ~Metafile() override; |
| 103 | 103 |
| 104 // Initializes a fresh new metafile for rendering. Returns false on failure. | 104 // Initializes a fresh new metafile for rendering. Returns false on failure. |
| 105 // Note: It should only be called from within the renderer process to allocate | 105 // Note: It should only be called from within the renderer process to allocate |
| 106 // rendering resources. | 106 // rendering resources. |
| 107 virtual bool Init() = 0; | 107 virtual bool Init() = 0; |
| 108 | 108 |
| 109 // Initializes the metafile with the data in |src_buffer|. Returns true | 109 // Initializes the metafile with the data in |src_buffer|. Returns true |
| 110 // on success. | 110 // on success. |
| 111 // Note: It should only be called from within the browser process. | 111 // Note: It should only be called from within the browser process. |
| 112 virtual bool InitFromData(const void* src_buffer, uint32 src_buffer_size) = 0; | 112 virtual bool InitFromData(const void* src_buffer, uint32 src_buffer_size) = 0; |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 // Note: Windows has been known to have stack buffer overflow in its GDI | 156 // Note: Windows has been known to have stack buffer overflow in its GDI |
| 157 // functions, whether used directly or indirectly through precompiled EMF | 157 // functions, whether used directly or indirectly through precompiled EMF |
| 158 // data. We have to accept the risk here. Since it is used only for printing, | 158 // data. We have to accept the risk here. Since it is used only for printing, |
| 159 // it requires user intervention. | 159 // it requires user intervention. |
| 160 virtual bool Playback(gfx::NativeDrawingContext hdc, | 160 virtual bool Playback(gfx::NativeDrawingContext hdc, |
| 161 const RECT* rect) const = 0; | 161 const RECT* rect) const = 0; |
| 162 #endif // OS_WIN | 162 #endif // OS_WIN |
| 163 | 163 |
| 164 bool GetDataAsVector(std::vector<char>* buffer) const; | 164 bool GetDataAsVector(std::vector<char>* buffer) const; |
| 165 | 165 |
| 166 virtual bool SaveTo(base::File* file) const override; | 166 bool SaveTo(base::File* file) const override; |
| 167 | 167 |
| 168 private: | 168 private: |
| 169 DISALLOW_COPY_AND_ASSIGN(Metafile); | 169 DISALLOW_COPY_AND_ASSIGN(Metafile); |
| 170 }; | 170 }; |
| 171 | 171 |
| 172 } // namespace printing | 172 } // namespace printing |
| 173 | 173 |
| 174 #endif // PRINTING_METAFILE_H_ | 174 #endif // PRINTING_METAFILE_H_ |
| OLD | NEW |