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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
726 // The timeout to use for the current progressive paint. | 726 // The timeout to use for the current progressive paint. |
727 int progressive_paint_timeout_; | 727 int progressive_paint_timeout_; |
728 | 728 |
729 // Shadow matrix for generating the page shadow bitmap. | 729 // Shadow matrix for generating the page shadow bitmap. |
730 std::unique_ptr<ShadowMatrix> page_shadow_; | 730 std::unique_ptr<ShadowMatrix> page_shadow_; |
731 | 731 |
732 // Set to true if the user is being prompted for their password. Will be set | 732 // Set to true if the user is being prompted for their password. Will be set |
733 // to false after the user finishes getting their password. | 733 // to false after the user finishes getting their password. |
734 bool getting_password_; | 734 bool getting_password_; |
735 | 735 |
| 736 // While true, the document try to be opened and parsed after download each |
| 737 // part. Else the document will be opened and parsed only on finish of |
| 738 // downloading. |
| 739 bool process_when_pending_request_complete_ = true; |
| 740 |
736 DISALLOW_COPY_AND_ASSIGN(PDFiumEngine); | 741 DISALLOW_COPY_AND_ASSIGN(PDFiumEngine); |
737 }; | 742 }; |
738 | 743 |
739 // Create a local variable of this when calling PDFium functions which can call | 744 // Create a local variable of this when calling PDFium functions which can call |
740 // our global callback when an unsupported feature is reached. | 745 // our global callback when an unsupported feature is reached. |
741 class ScopedUnsupportedFeature { | 746 class ScopedUnsupportedFeature { |
742 public: | 747 public: |
743 explicit ScopedUnsupportedFeature(PDFiumEngine* engine); | 748 explicit ScopedUnsupportedFeature(PDFiumEngine* engine); |
744 ~ScopedUnsupportedFeature(); | 749 ~ScopedUnsupportedFeature(); |
745 | 750 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
790 bool GetPDFPageSizeByIndex(const void* pdf_buffer, | 795 bool GetPDFPageSizeByIndex(const void* pdf_buffer, |
791 int pdf_buffer_size, | 796 int pdf_buffer_size, |
792 int page_number, | 797 int page_number, |
793 double* width, | 798 double* width, |
794 double* height) override; | 799 double* height) override; |
795 }; | 800 }; |
796 | 801 |
797 } // namespace chrome_pdf | 802 } // namespace chrome_pdf |
798 | 803 |
799 #endif // PDF_PDFIUM_PDFIUM_ENGINE_H_ | 804 #endif // PDF_PDFIUM_PDFIUM_ENGINE_H_ |
OLD | NEW |