| 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 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 1076 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1087 fpdf_availability_ = FPDFAvail_Create(&file_availability_, &file_access_); | 1087 fpdf_availability_ = FPDFAvail_Create(&file_availability_, &file_access_); |
| 1088 DCHECK(fpdf_availability_); | 1088 DCHECK(fpdf_availability_); |
| 1089 } | 1089 } |
| 1090 LoadDocument(); | 1090 LoadDocument(); |
| 1091 return; | 1091 return; |
| 1092 } | 1092 } |
| 1093 | 1093 |
| 1094 FinishLoadingDocument(); | 1094 FinishLoadingDocument(); |
| 1095 } | 1095 } |
| 1096 | 1096 |
| 1097 void PDFiumEngine::DocumentLoadFailed() { |
| 1098 client_->DocumentLoadFailed(); |
| 1099 } |
| 1100 |
| 1097 void PDFiumEngine::FinishLoadingDocument() { | 1101 void PDFiumEngine::FinishLoadingDocument() { |
| 1098 DCHECK(doc_loader_.IsDocumentComplete() && doc_); | 1102 DCHECK(doc_loader_.IsDocumentComplete() && doc_); |
| 1099 | 1103 |
| 1100 bool need_update = false; | 1104 bool need_update = false; |
| 1101 for (size_t i = 0; i < pages_.size(); ++i) { | 1105 for (size_t i = 0; i < pages_.size(); ++i) { |
| 1102 if (pages_[i]->available()) | 1106 if (pages_[i]->available()) |
| 1103 continue; | 1107 continue; |
| 1104 | 1108 |
| 1105 pages_[i]->set_available(true); | 1109 pages_[i]->set_available(true); |
| 1106 // We still need to call IsPageAvail() even if the whole document is | 1110 // We still need to call IsPageAvail() even if the whole document is |
| (...skipping 2899 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4006 FPDF_DOCUMENT doc = | 4010 FPDF_DOCUMENT doc = |
| 4007 FPDF_LoadMemDocument(pdf_buffer, pdf_buffer_size, nullptr); | 4011 FPDF_LoadMemDocument(pdf_buffer, pdf_buffer_size, nullptr); |
| 4008 if (!doc) | 4012 if (!doc) |
| 4009 return false; | 4013 return false; |
| 4010 bool success = FPDF_GetPageSizeByIndex(doc, page_number, width, height) != 0; | 4014 bool success = FPDF_GetPageSizeByIndex(doc, page_number, width, height) != 0; |
| 4011 FPDF_CloseDocument(doc); | 4015 FPDF_CloseDocument(doc); |
| 4012 return success; | 4016 return success; |
| 4013 } | 4017 } |
| 4014 | 4018 |
| 4015 } // namespace chrome_pdf | 4019 } // namespace chrome_pdf |
| OLD | NEW |