| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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_PDF_METAFILE_MAC_H_ | 5 #ifndef PRINTING_PDF_METAFILE_MAC_H_ |
| 6 #define PRINTING_PDF_METAFILE_MAC_H_ | 6 #define PRINTING_PDF_METAFILE_MAC_H_ |
| 7 | 7 |
| 8 #include <ApplicationServices/ApplicationServices.h> | 8 #include <ApplicationServices/ApplicationServices.h> |
| 9 #include <CoreFoundation/CoreFoundation.h> | 9 #include <CoreFoundation/CoreFoundation.h> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/scoped_cftyperef.h" | 12 #include "base/mac/scoped_cftyperef.h" |
| 13 | 13 |
| 14 namespace gfx { | 14 namespace gfx { |
| 15 class Rect; | 15 class Rect; |
| 16 } | 16 } |
| 17 class FilePath; | 17 class FilePath; |
| 18 | 18 |
| 19 namespace printing { | 19 namespace printing { |
| 20 | 20 |
| 21 // This class creates a graphics context that renders into a PDF data stream. | 21 // This class creates a graphics context that renders into a PDF data stream. |
| 22 class PdfMetafile { | 22 class PdfMetafile { |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 | 83 |
| 84 // Saves the raw PDF data to the given file. For testing only. | 84 // Saves the raw PDF data to the given file. For testing only. |
| 85 // Returns true if writing succeeded. | 85 // Returns true if writing succeeded. |
| 86 bool SaveTo(const FilePath& file_path) const; | 86 bool SaveTo(const FilePath& file_path) const; |
| 87 | 87 |
| 88 private: | 88 private: |
| 89 // Returns a CGPDFDocumentRef version of pdf_data_. | 89 // Returns a CGPDFDocumentRef version of pdf_data_. |
| 90 CGPDFDocumentRef GetPDFDocument() const; | 90 CGPDFDocumentRef GetPDFDocument() const; |
| 91 | 91 |
| 92 // Context for rendering to the pdf. | 92 // Context for rendering to the pdf. |
| 93 scoped_cftyperef<CGContextRef> context_; | 93 base::mac::ScopedCFTypeRef<CGContextRef> context_; |
| 94 | 94 |
| 95 // PDF backing store. | 95 // PDF backing store. |
| 96 scoped_cftyperef<CFMutableDataRef> pdf_data_; | 96 base::mac::ScopedCFTypeRef<CFMutableDataRef> pdf_data_; |
| 97 | 97 |
| 98 // Lazily-created CGPDFDocument representation of pdf_data_. | 98 // Lazily-created CGPDFDocument representation of pdf_data_. |
| 99 mutable scoped_cftyperef<CGPDFDocumentRef> pdf_doc_; | 99 mutable base::mac::ScopedCFTypeRef<CGPDFDocumentRef> pdf_doc_; |
| 100 | 100 |
| 101 // Whether or not a page is currently open. | 101 // Whether or not a page is currently open. |
| 102 bool page_is_open_; | 102 bool page_is_open_; |
| 103 | 103 |
| 104 DISALLOW_COPY_AND_ASSIGN(PdfMetafile); | 104 DISALLOW_COPY_AND_ASSIGN(PdfMetafile); |
| 105 }; | 105 }; |
| 106 | 106 |
| 107 } // namespace printing | 107 } // namespace printing |
| 108 | 108 |
| 109 #endif // PRINTING_PDF_METAFILE_MAC_H_ | 109 #endif // PRINTING_PDF_METAFILE_MAC_H_ |
| OLD | NEW |