| 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 1088 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1099 } | 1099 } |
| 1100 file_access_.m_FileLen = doc_loader_->GetDocumentSize(); | 1100 file_access_.m_FileLen = doc_loader_->GetDocumentSize(); |
| 1101 if (!fpdf_availability_) { | 1101 if (!fpdf_availability_) { |
| 1102 fpdf_availability_ = FPDFAvail_Create(&file_availability_, &file_access_); | 1102 fpdf_availability_ = FPDFAvail_Create(&file_availability_, &file_access_); |
| 1103 DCHECK(fpdf_availability_); | 1103 DCHECK(fpdf_availability_); |
| 1104 } | 1104 } |
| 1105 LoadDocument(); | 1105 LoadDocument(); |
| 1106 } | 1106 } |
| 1107 | 1107 |
| 1108 void PDFiumEngine::OnDocumentCanceled() { | 1108 void PDFiumEngine::OnDocumentCanceled() { |
| 1109 OnDocumentComplete(); | 1109 if (visible_pages_.empty()) |
| 1110 client_->DocumentLoadFailed(); |
| 1111 else |
| 1112 OnDocumentComplete(); |
| 1110 } | 1113 } |
| 1111 | 1114 |
| 1112 void PDFiumEngine::CancelBrowserDownload() { | 1115 void PDFiumEngine::CancelBrowserDownload() { |
| 1113 client_->CancelBrowserDownload(); | 1116 client_->CancelBrowserDownload(); |
| 1114 } | 1117 } |
| 1115 | 1118 |
| 1116 void PDFiumEngine::FinishLoadingDocument() { | 1119 void PDFiumEngine::FinishLoadingDocument() { |
| 1117 DCHECK(doc_loader_->IsDocumentComplete() && doc_); | 1120 DCHECK(doc_loader_->IsDocumentComplete() && doc_); |
| 1118 | 1121 |
| 1119 if (!form_) { | 1122 if (!form_) { |
| (...skipping 2905 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4025 FPDF_DOCUMENT doc = | 4028 FPDF_DOCUMENT doc = |
| 4026 FPDF_LoadMemDocument(pdf_buffer, pdf_buffer_size, nullptr); | 4029 FPDF_LoadMemDocument(pdf_buffer, pdf_buffer_size, nullptr); |
| 4027 if (!doc) | 4030 if (!doc) |
| 4028 return false; | 4031 return false; |
| 4029 bool success = FPDF_GetPageSizeByIndex(doc, page_number, width, height) != 0; | 4032 bool success = FPDF_GetPageSizeByIndex(doc, page_number, width, height) != 0; |
| 4030 FPDF_CloseDocument(doc); | 4033 FPDF_CloseDocument(doc); |
| 4031 return success; | 4034 return success; |
| 4032 } | 4035 } |
| 4033 | 4036 |
| 4034 } // namespace chrome_pdf | 4037 } // namespace chrome_pdf |
| OLD | NEW |