Chromium Code Reviews| 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 client_->DocumentLoadFailed(); |
|
Lei Zhang
2016/11/08 01:28:10
I defer to spelchat / art-snake on this.
raymes
2016/11/08 06:00:01
Sure. Without this the client was never notified t
snake
2016/11/08 15:11:25
Loading of the document may be canceled (by user o
spelchat
2016/11/08 17:53:33
Yeah thinking about it, maybe the noisy failure (D
| |
| 1110 } | 1110 } |
| 1111 | 1111 |
| 1112 void PDFiumEngine::CancelBrowserDownload() { | 1112 void PDFiumEngine::CancelBrowserDownload() { |
| 1113 client_->CancelBrowserDownload(); | 1113 client_->CancelBrowserDownload(); |
| 1114 } | 1114 } |
| 1115 | 1115 |
| 1116 void PDFiumEngine::FinishLoadingDocument() { | 1116 void PDFiumEngine::FinishLoadingDocument() { |
| 1117 DCHECK(doc_loader_->IsDocumentComplete() && doc_); | 1117 DCHECK(doc_loader_->IsDocumentComplete() && doc_); |
| 1118 | 1118 |
| 1119 if (!form_) { | 1119 if (!form_) { |
| (...skipping 2905 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4025 FPDF_DOCUMENT doc = | 4025 FPDF_DOCUMENT doc = |
| 4026 FPDF_LoadMemDocument(pdf_buffer, pdf_buffer_size, nullptr); | 4026 FPDF_LoadMemDocument(pdf_buffer, pdf_buffer_size, nullptr); |
| 4027 if (!doc) | 4027 if (!doc) |
| 4028 return false; | 4028 return false; |
| 4029 bool success = FPDF_GetPageSizeByIndex(doc, page_number, width, height) != 0; | 4029 bool success = FPDF_GetPageSizeByIndex(doc, page_number, width, height) != 0; |
| 4030 FPDF_CloseDocument(doc); | 4030 FPDF_CloseDocument(doc); |
| 4031 return success; | 4031 return success; |
| 4032 } | 4032 } |
| 4033 | 4033 |
| 4034 } // namespace chrome_pdf | 4034 } // namespace chrome_pdf |
| OLD | NEW |