| 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 PDF_PDFIUM_PDFIUM_ENGINE_H_ | 5 #ifndef PDF_PDFIUM_PDFIUM_ENGINE_H_ |
| 6 #define PDF_PDFIUM_PDFIUM_ENGINE_H_ | 6 #define PDF_PDFIUM_PDFIUM_ENGINE_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 pp::FloatRect* out_bounds) override; | 101 pp::FloatRect* out_bounds) override; |
| 102 bool GetPrintScaling() override; | 102 bool GetPrintScaling() override; |
| 103 int GetCopiesToPrint() override; | 103 int GetCopiesToPrint() override; |
| 104 int GetDuplexType() override; | 104 int GetDuplexType() override; |
| 105 bool GetPageSizeAndUniformity(pp::Size* size) override; | 105 bool GetPageSizeAndUniformity(pp::Size* size) override; |
| 106 void AppendBlankPages(int num_pages) override; | 106 void AppendBlankPages(int num_pages) override; |
| 107 void AppendPage(PDFEngine* engine, int index) override; | 107 void AppendPage(PDFEngine* engine, int index) override; |
| 108 #if defined(PDF_ENABLE_XFA) | 108 #if defined(PDF_ENABLE_XFA) |
| 109 void SetScrollPosition(const pp::Point& position) override; | 109 void SetScrollPosition(const pp::Point& position) override; |
| 110 #endif | 110 #endif |
| 111 bool IsProgressiveLoad() override; | |
| 112 std::string GetMetadata(const std::string& key) override; | 111 std::string GetMetadata(const std::string& key) override; |
| 113 | 112 |
| 114 // DocumentLoader::Client implementation. | 113 // DocumentLoader::Client implementation. |
| 115 pp::Instance* GetPluginInstance() override; | 114 pp::Instance* GetPluginInstance() override; |
| 116 pp::URLLoader CreateURLLoader() override; | 115 std::unique_ptr<URLLoaderWrapper> CreateURLLoader() override; |
| 117 void OnPartialDocumentLoaded() override; | |
| 118 void OnPendingRequestComplete() override; | 116 void OnPendingRequestComplete() override; |
| 119 void OnNewDataAvailable() override; | 117 void OnNewDataAvailable() override; |
| 120 void OnDocumentComplete() override; | 118 void OnDocumentComplete() override; |
| 119 void OnDocumentCanceled() override; |
| 120 void CancelBrowserDownload() override; |
| 121 | 121 |
| 122 void UnsupportedFeature(int type); | 122 void UnsupportedFeature(int type); |
| 123 void FontSubstituted(); | 123 void FontSubstituted(); |
| 124 | 124 |
| 125 std::string current_find_text() const { return current_find_text_; } | 125 std::string current_find_text() const { return current_find_text_; } |
| 126 | 126 |
| 127 FPDF_DOCUMENT doc() { return doc_; } | 127 FPDF_DOCUMENT doc() { return doc_; } |
| 128 FPDF_FORMHANDLE form() { return form_; } | 128 FPDF_FORMHANDLE form() { return form_; } |
| 129 | 129 |
| 130 private: | 130 private: |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 private: | 184 private: |
| 185 bool valid_; // Whether |index_| is valid or not. | 185 bool valid_; // Whether |index_| is valid or not. |
| 186 size_t index_; // The current search result, 0-based. | 186 size_t index_; // The current search result, 0-based. |
| 187 | 187 |
| 188 DISALLOW_COPY_AND_ASSIGN(FindTextIndex); | 188 DISALLOW_COPY_AND_ASSIGN(FindTextIndex); |
| 189 }; | 189 }; |
| 190 | 190 |
| 191 friend class SelectionChangeInvalidator; | 191 friend class SelectionChangeInvalidator; |
| 192 | 192 |
| 193 struct FileAvail : public FX_FILEAVAIL { | 193 struct FileAvail : public FX_FILEAVAIL { |
| 194 DocumentLoader* loader; | 194 PDFiumEngine* engine; |
| 195 }; | 195 }; |
| 196 | 196 |
| 197 struct DownloadHints : public FX_DOWNLOADHINTS { | 197 struct DownloadHints : public FX_DOWNLOADHINTS { |
| 198 DocumentLoader* loader; | 198 PDFiumEngine* engine; |
| 199 }; | 199 }; |
| 200 | 200 |
| 201 // PDFium interface to get block of data. | 201 // PDFium interface to get block of data. |
| 202 static int GetBlock(void* param, unsigned long position, | 202 static int GetBlock(void* param, unsigned long position, |
| 203 unsigned char* buffer, unsigned long size); | 203 unsigned char* buffer, unsigned long size); |
| 204 | 204 |
| 205 // PDFium interface to check is block of data is available. | 205 // PDFium interface to check is block of data is available. |
| 206 static FPDF_BOOL IsDataAvail(FX_FILEAVAIL* param, | 206 static FPDF_BOOL IsDataAvail(FX_FILEAVAIL* param, |
| 207 size_t offset, size_t size); | 207 size_t offset, size_t size); |
| 208 | 208 |
| (...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 595 | 595 |
| 596 // The scroll position in screen coordinates. | 596 // The scroll position in screen coordinates. |
| 597 pp::Point position_; | 597 pp::Point position_; |
| 598 // The offset of the page into the viewport. | 598 // The offset of the page into the viewport. |
| 599 pp::Point page_offset_; | 599 pp::Point page_offset_; |
| 600 // The plugin size in screen coordinates. | 600 // The plugin size in screen coordinates. |
| 601 pp::Size plugin_size_; | 601 pp::Size plugin_size_; |
| 602 double current_zoom_; | 602 double current_zoom_; |
| 603 unsigned int current_rotation_; | 603 unsigned int current_rotation_; |
| 604 | 604 |
| 605 DocumentLoader doc_loader_; // Main document's loader. | 605 std::unique_ptr<DocumentLoader> doc_loader_; // Main document's loader. |
| 606 std::string url_; | 606 std::string url_; |
| 607 std::string headers_; | 607 std::string headers_; |
| 608 pp::CompletionCallbackFactory<PDFiumEngine> find_factory_; | 608 pp::CompletionCallbackFactory<PDFiumEngine> find_factory_; |
| 609 | 609 |
| 610 pp::CompletionCallbackFactory<PDFiumEngine> password_factory_; | 610 pp::CompletionCallbackFactory<PDFiumEngine> password_factory_; |
| 611 int32_t password_tries_remaining_; | 611 int32_t password_tries_remaining_; |
| 612 | 612 |
| 613 // The current text used for searching. | 613 // The current text used for searching. |
| 614 std::string current_find_text_; | 614 std::string current_find_text_; |
| 615 | 615 |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 724 // The timeout to use for the current progressive paint. | 724 // The timeout to use for the current progressive paint. |
| 725 int progressive_paint_timeout_; | 725 int progressive_paint_timeout_; |
| 726 | 726 |
| 727 // Shadow matrix for generating the page shadow bitmap. | 727 // Shadow matrix for generating the page shadow bitmap. |
| 728 std::unique_ptr<ShadowMatrix> page_shadow_; | 728 std::unique_ptr<ShadowMatrix> page_shadow_; |
| 729 | 729 |
| 730 // Set to true if the user is being prompted for their password. Will be set | 730 // Set to true if the user is being prompted for their password. Will be set |
| 731 // to false after the user finishes getting their password. | 731 // to false after the user finishes getting their password. |
| 732 bool getting_password_; | 732 bool getting_password_; |
| 733 | 733 |
| 734 // While true, the document try to be opened and parsed after download each |
| 735 // part. Else the document will be opened and parsed only on finish of |
| 736 // downloading. |
| 737 bool process_when_pending_request_complete_ = true; |
| 738 |
| 734 DISALLOW_COPY_AND_ASSIGN(PDFiumEngine); | 739 DISALLOW_COPY_AND_ASSIGN(PDFiumEngine); |
| 735 }; | 740 }; |
| 736 | 741 |
| 737 // Create a local variable of this when calling PDFium functions which can call | 742 // Create a local variable of this when calling PDFium functions which can call |
| 738 // our global callback when an unsupported feature is reached. | 743 // our global callback when an unsupported feature is reached. |
| 739 class ScopedUnsupportedFeature { | 744 class ScopedUnsupportedFeature { |
| 740 public: | 745 public: |
| 741 explicit ScopedUnsupportedFeature(PDFiumEngine* engine); | 746 explicit ScopedUnsupportedFeature(PDFiumEngine* engine); |
| 742 ~ScopedUnsupportedFeature(); | 747 ~ScopedUnsupportedFeature(); |
| 743 | 748 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 788 bool GetPDFPageSizeByIndex(const void* pdf_buffer, | 793 bool GetPDFPageSizeByIndex(const void* pdf_buffer, |
| 789 int pdf_buffer_size, | 794 int pdf_buffer_size, |
| 790 int page_number, | 795 int page_number, |
| 791 double* width, | 796 double* width, |
| 792 double* height) override; | 797 double* height) override; |
| 793 }; | 798 }; |
| 794 | 799 |
| 795 } // namespace chrome_pdf | 800 } // namespace chrome_pdf |
| 796 | 801 |
| 797 #endif // PDF_PDFIUM_PDFIUM_ENGINE_H_ | 802 #endif // PDF_PDFIUM_PDFIUM_ENGINE_H_ |
| OLD | NEW |