| OLD | NEW |
| 1 // Copyright (c) 2011 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_PDF_METAFILE_CG_MAC_H_ | 5 #ifndef PRINTING_PDF_METAFILE_CG_MAC_H_ |
| 6 #define PRINTING_PDF_METAFILE_CG_MAC_H_ | 6 #define PRINTING_PDF_METAFILE_CG_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" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 // Note: The returned context *must not be retained* past Close(). If it is, | 56 // Note: The returned context *must not be retained* past Close(). If it is, |
| 57 // the data returned from GetData will not be valid PDF data. | 57 // the data returned from GetData will not be valid PDF data. |
| 58 virtual CGContextRef context() const OVERRIDE; | 58 virtual CGContextRef context() const OVERRIDE; |
| 59 | 59 |
| 60 virtual bool RenderPage(unsigned int page_number, | 60 virtual bool RenderPage(unsigned int page_number, |
| 61 CGContextRef context, | 61 CGContextRef context, |
| 62 const CGRect rect, | 62 const CGRect rect, |
| 63 bool shrink_to_fit, | 63 bool shrink_to_fit, |
| 64 bool stretch_to_fit, | 64 bool stretch_to_fit, |
| 65 bool center_horizontally, | 65 bool center_horizontally, |
| 66 bool center_vertically) const OVERRIDE; | 66 bool center_vertically, |
| 67 bool autorotate) const OVERRIDE; |
| 67 | 68 |
| 68 private: | 69 private: |
| 69 // Returns a CGPDFDocumentRef version of pdf_data_. | 70 // Returns a CGPDFDocumentRef version of pdf_data_. |
| 70 CGPDFDocumentRef GetPDFDocument() const; | 71 CGPDFDocumentRef GetPDFDocument() const; |
| 71 | 72 |
| 72 base::ThreadChecker thread_checker_; | 73 base::ThreadChecker thread_checker_; |
| 73 | 74 |
| 74 // Context for rendering to the pdf. | 75 // Context for rendering to the pdf. |
| 75 base::mac::ScopedCFTypeRef<CGContextRef> context_; | 76 base::mac::ScopedCFTypeRef<CGContextRef> context_; |
| 76 | 77 |
| 77 // PDF backing store. | 78 // PDF backing store. |
| 78 base::mac::ScopedCFTypeRef<CFMutableDataRef> pdf_data_; | 79 base::mac::ScopedCFTypeRef<CFMutableDataRef> pdf_data_; |
| 79 | 80 |
| 80 // Lazily-created CGPDFDocument representation of pdf_data_. | 81 // Lazily-created CGPDFDocument representation of pdf_data_. |
| 81 mutable base::mac::ScopedCFTypeRef<CGPDFDocumentRef> pdf_doc_; | 82 mutable base::mac::ScopedCFTypeRef<CGPDFDocumentRef> pdf_doc_; |
| 82 | 83 |
| 83 // Whether or not a page is currently open. | 84 // Whether or not a page is currently open. |
| 84 bool page_is_open_; | 85 bool page_is_open_; |
| 85 | 86 |
| 86 // Whether this instantiation of the PdfMetafileCg owns the thread_pdf_docs. | 87 // Whether this instantiation of the PdfMetafileCg owns the thread_pdf_docs. |
| 87 bool thread_pdf_docs_owned_; | 88 bool thread_pdf_docs_owned_; |
| 88 | 89 |
| 89 DISALLOW_COPY_AND_ASSIGN(PdfMetafileCg); | 90 DISALLOW_COPY_AND_ASSIGN(PdfMetafileCg); |
| 90 }; | 91 }; |
| 91 | 92 |
| 92 } // namespace printing | 93 } // namespace printing |
| 93 | 94 |
| 94 #endif // PRINTING_PDF_METAFILE_CG_MAC_H_ | 95 #endif // PRINTING_PDF_METAFILE_CG_MAC_H_ |
| OLD | NEW |