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