| 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 virtual bool SaveTo(const FilePath& file_path) const OVERRIDE; | 51 virtual bool SaveTo(const FilePath& file_path) const OVERRIDE; |
| 52 | 52 |
| 53 virtual gfx::Rect GetPageBounds(unsigned int page_number) const OVERRIDE; | 53 virtual gfx::Rect GetPageBounds(unsigned int page_number) const OVERRIDE; |
| 54 virtual unsigned int GetPageCount() const OVERRIDE; | 54 virtual unsigned int GetPageCount() const OVERRIDE; |
| 55 | 55 |
| 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 gfx::NativeDrawingContext context, |
| 62 const CGRect rect, | 62 const CGRect rect, |
| 63 bool shrink_to_fit, | 63 const MacRenderPageParams& params) const OVERRIDE; |
| 64 bool stretch_to_fit, | |
| 65 bool center_horizontally, | |
| 66 bool center_vertically) const OVERRIDE; | |
| 67 | 64 |
| 68 private: | 65 private: |
| 69 // Returns a CGPDFDocumentRef version of pdf_data_. | 66 // Returns a CGPDFDocumentRef version of pdf_data_. |
| 70 CGPDFDocumentRef GetPDFDocument() const; | 67 CGPDFDocumentRef GetPDFDocument() const; |
| 71 | 68 |
| 72 base::ThreadChecker thread_checker_; | 69 base::ThreadChecker thread_checker_; |
| 73 | 70 |
| 74 // Context for rendering to the pdf. | 71 // Context for rendering to the pdf. |
| 75 base::mac::ScopedCFTypeRef<CGContextRef> context_; | 72 base::mac::ScopedCFTypeRef<CGContextRef> context_; |
| 76 | 73 |
| 77 // PDF backing store. | 74 // PDF backing store. |
| 78 base::mac::ScopedCFTypeRef<CFMutableDataRef> pdf_data_; | 75 base::mac::ScopedCFTypeRef<CFMutableDataRef> pdf_data_; |
| 79 | 76 |
| 80 // Lazily-created CGPDFDocument representation of pdf_data_. | 77 // Lazily-created CGPDFDocument representation of pdf_data_. |
| 81 mutable base::mac::ScopedCFTypeRef<CGPDFDocumentRef> pdf_doc_; | 78 mutable base::mac::ScopedCFTypeRef<CGPDFDocumentRef> pdf_doc_; |
| 82 | 79 |
| 83 // Whether or not a page is currently open. | 80 // Whether or not a page is currently open. |
| 84 bool page_is_open_; | 81 bool page_is_open_; |
| 85 | 82 |
| 86 // Whether this instantiation of the PdfMetafileCg owns the thread_pdf_docs. | 83 // Whether this instantiation of the PdfMetafileCg owns the thread_pdf_docs. |
| 87 bool thread_pdf_docs_owned_; | 84 bool thread_pdf_docs_owned_; |
| 88 | 85 |
| 89 DISALLOW_COPY_AND_ASSIGN(PdfMetafileCg); | 86 DISALLOW_COPY_AND_ASSIGN(PdfMetafileCg); |
| 90 }; | 87 }; |
| 91 | 88 |
| 92 } // namespace printing | 89 } // namespace printing |
| 93 | 90 |
| 94 #endif // PRINTING_PDF_METAFILE_CG_MAC_H_ | 91 #endif // PRINTING_PDF_METAFILE_CG_MAC_H_ |
| OLD | NEW |