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 #include "pdf/pdfium/pdfium_engine.h" | 5 #include "pdf/pdfium/pdfium_engine.h" |
6 | 6 |
7 #include <math.h> | 7 #include <math.h> |
8 | 8 |
9 #include "base/json/json_writer.h" | 9 #include "base/json/json_writer.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
648 PDFiumEngine::~PDFiumEngine() { | 648 PDFiumEngine::~PDFiumEngine() { |
649 for (size_t i = 0; i < pages_.size(); ++i) | 649 for (size_t i = 0; i < pages_.size(); ++i) |
650 pages_[i]->Unload(); | 650 pages_[i]->Unload(); |
651 | 651 |
652 if (doc_) { | 652 if (doc_) { |
653 if (form_) { | 653 if (form_) { |
654 FORM_DoDocumentAAction(form_, FPDFDOC_AACTION_WC); | 654 FORM_DoDocumentAAction(form_, FPDFDOC_AACTION_WC); |
655 } | 655 } |
656 FPDF_CloseDocument(doc_); | 656 FPDF_CloseDocument(doc_); |
657 if (form_) { | 657 if (form_) { |
658 FPDFDOC_ExitFormFillEnviroument(form_); | 658 FPDFDOC_ExitFormFillEnvironment(form_); |
659 } | 659 } |
660 } | 660 } |
661 | 661 |
662 if (fpdf_availability_) | 662 if (fpdf_availability_) |
663 FPDFAvail_Destroy(fpdf_availability_); | 663 FPDFAvail_Destroy(fpdf_availability_); |
664 | 664 |
665 STLDeleteElements(&pages_); | 665 STLDeleteElements(&pages_); |
666 } | 666 } |
667 | 667 |
668 #ifdef PDF_USE_XFA | 668 #ifdef PDF_USE_XFA |
(...skipping 1864 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2533 permissions_ = FPDF_GetDocPermissions(doc_); | 2533 permissions_ = FPDF_GetDocPermissions(doc_); |
2534 | 2534 |
2535 if (!form_) { | 2535 if (!form_) { |
2536 // Only returns 0 when data isn't available. If form data is downloaded, or | 2536 // Only returns 0 when data isn't available. If form data is downloaded, or |
2537 // if this isn't a form, returns positive values. | 2537 // if this isn't a form, returns positive values. |
2538 if (!doc_loader_.IsDocumentComplete() && | 2538 if (!doc_loader_.IsDocumentComplete() && |
2539 !FPDFAvail_IsFormAvail(fpdf_availability_, &download_hints_)) { | 2539 !FPDFAvail_IsFormAvail(fpdf_availability_, &download_hints_)) { |
2540 return; | 2540 return; |
2541 } | 2541 } |
2542 | 2542 |
2543 form_ = FPDFDOC_InitFormFillEnviroument( | 2543 form_ = FPDFDOC_InitFormFillEnvironment( |
2544 doc_, static_cast<FPDF_FORMFILLINFO*>(this)); | 2544 doc_, static_cast<FPDF_FORMFILLINFO*>(this)); |
2545 #ifdef PDF_USE_XFA | 2545 #ifdef PDF_USE_XFA |
2546 FPDF_LoadXFA(doc_); | 2546 FPDF_LoadXFA(doc_); |
2547 #endif | 2547 #endif |
2548 | 2548 |
2549 FPDF_SetFormFieldHighlightColor(form_, 0, kFormHighlightColor); | 2549 FPDF_SetFormFieldHighlightColor(form_, 0, kFormHighlightColor); |
2550 FPDF_SetFormFieldHighlightAlpha(form_, kFormHighlightAlpha); | 2550 FPDF_SetFormFieldHighlightAlpha(form_, kFormHighlightAlpha); |
2551 } | 2551 } |
2552 | 2552 |
2553 if (!doc_loader_.IsDocumentComplete()) { | 2553 if (!doc_loader_.IsDocumentComplete()) { |
(...skipping 1338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3892 double* height) { | 3892 double* height) { |
3893 FPDF_DOCUMENT doc = FPDF_LoadMemDocument(pdf_buffer, pdf_buffer_size, NULL); | 3893 FPDF_DOCUMENT doc = FPDF_LoadMemDocument(pdf_buffer, pdf_buffer_size, NULL); |
3894 if (!doc) | 3894 if (!doc) |
3895 return false; | 3895 return false; |
3896 bool success = FPDF_GetPageSizeByIndex(doc, page_number, width, height) != 0; | 3896 bool success = FPDF_GetPageSizeByIndex(doc, page_number, width, height) != 0; |
3897 FPDF_CloseDocument(doc); | 3897 FPDF_CloseDocument(doc); |
3898 return success; | 3898 return success; |
3899 } | 3899 } |
3900 | 3900 |
3901 } // namespace chrome_pdf | 3901 } // namespace chrome_pdf |
OLD | NEW |