| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 PDF_PDFIUM_PDFIUM_PAGE_H_ | 5 #ifndef PDF_PDFIUM_PDFIUM_PAGE_H_ |
| 6 #define PDF_PDFIUM_PDFIUM_PAGE_H_ | 6 #define PDF_PDFIUM_PDFIUM_PAGE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/strings/string16.h" | 11 #include "base/strings/string16.h" |
| 12 #include "ppapi/cpp/rect.h" | 12 #include "ppapi/cpp/rect.h" |
| 13 #include "third_party/pdfium/public/fpdf_doc.h" | 13 #include "third_party/pdfium/public/fpdf_doc.h" |
| 14 #include "third_party/pdfium/public/fpdf_formfill.h" | 14 #include "third_party/pdfium/public/fpdf_formfill.h" |
| 15 #include "third_party/pdfium/public/fpdf_text.h" | 15 #include "third_party/pdfium/public/fpdf_text.h" |
| 16 | 16 |
| 17 namespace chrome_pdf { | 17 namespace chrome_pdf { |
| 18 | 18 |
| 19 class PDFiumEngine; | 19 class PDFiumEngine; |
| 20 | 20 |
| 21 // Wrapper around a page from the document. | 21 // Wrapper around a page from the document. |
| 22 class PDFiumPage { | 22 class PDFiumPage { |
| 23 public: | 23 public: |
| 24 PDFiumPage(PDFiumEngine* engine, | 24 PDFiumPage(PDFiumEngine* engine, |
| 25 int i, | 25 int i, |
| 26 const pp::Rect& r, | 26 const pp::Rect& r, |
| 27 bool available); | 27 bool available); |
| 28 PDFiumPage(const PDFiumPage& that); |
| 28 ~PDFiumPage(); | 29 ~PDFiumPage(); |
| 29 | 30 |
| 30 // Unloads the PDFium data for this page from memory. | 31 // Unloads the PDFium data for this page from memory. |
| 31 void Unload(); | 32 void Unload(); |
| 32 // Gets the FPDF_PAGE for this page, loading and parsing it if necessary. | 33 // Gets the FPDF_PAGE for this page, loading and parsing it if necessary. |
| 33 FPDF_PAGE GetPage(); | 34 FPDF_PAGE GetPage(); |
| 34 // Get the FPDF_PAGE for printing. | 35 // Get the FPDF_PAGE for printing. |
| 35 FPDF_PAGE GetPrintPage(); | 36 FPDF_PAGE GetPrintPage(); |
| 36 // Close the printing page. | 37 // Close the printing page. |
| 37 void ClosePrintPage(); | 38 void ClosePrintPage(); |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 public: | 117 public: |
| 117 explicit ScopedLoadCounter(PDFiumPage* page); | 118 explicit ScopedLoadCounter(PDFiumPage* page); |
| 118 ~ScopedLoadCounter(); | 119 ~ScopedLoadCounter(); |
| 119 | 120 |
| 120 private: | 121 private: |
| 121 PDFiumPage* const page_; | 122 PDFiumPage* const page_; |
| 122 }; | 123 }; |
| 123 | 124 |
| 124 struct Link { | 125 struct Link { |
| 125 Link(); | 126 Link(); |
| 127 Link(const Link& that); |
| 126 ~Link(); | 128 ~Link(); |
| 127 | 129 |
| 128 std::string url; | 130 std::string url; |
| 129 // Bounding rectangles of characters. | 131 // Bounding rectangles of characters. |
| 130 std::vector<pp::Rect> rects; | 132 std::vector<pp::Rect> rects; |
| 131 }; | 133 }; |
| 132 | 134 |
| 133 PDFiumEngine* engine_; | 135 PDFiumEngine* engine_; |
| 134 FPDF_PAGE page_; | 136 FPDF_PAGE page_; |
| 135 FPDF_TEXTPAGE text_page_; | 137 FPDF_TEXTPAGE text_page_; |
| 136 int index_; | 138 int index_; |
| 137 int loading_count_; | 139 int loading_count_; |
| 138 pp::Rect rect_; | 140 pp::Rect rect_; |
| 139 bool calculated_links_; | 141 bool calculated_links_; |
| 140 std::vector<Link> links_; | 142 std::vector<Link> links_; |
| 141 bool available_; | 143 bool available_; |
| 142 }; | 144 }; |
| 143 | 145 |
| 144 } // namespace chrome_pdf | 146 } // namespace chrome_pdf |
| 145 | 147 |
| 146 #endif // PDF_PDFIUM_PDFIUM_PAGE_H_ | 148 #endif // PDF_PDFIUM_PDFIUM_PAGE_H_ |
| OLD | NEW |