| OLD | NEW |
| 1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium 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 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | 6 |
| 7 #include "public/fpdfview.h" | 7 #include "public/fpdfview.h" |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <utility> | 10 #include <utility> |
| 11 | 11 |
| 12 #include "core/fpdfapi/cpdf_modulemgr.h" | 12 #include "core/fpdfapi/cpdf_modulemgr.h" |
| 13 #include "core/fpdfapi/cpdf_pagerendercontext.h" | 13 #include "core/fpdfapi/cpdf_pagerendercontext.h" |
| 14 #include "core/fpdfapi/page/cpdf_page.h" | 14 #include "core/fpdfapi/page/cpdf_page.h" |
| 15 #include "core/fpdfapi/parser/cpdf_array.h" | 15 #include "core/fpdfapi/parser/cpdf_array.h" |
| 16 #include "core/fpdfapi/parser/cpdf_document.h" | 16 #include "core/fpdfapi/parser/cpdf_document.h" |
| 17 #include "core/fpdfapi/parser/fpdf_parser_decode.h" | 17 #include "core/fpdfapi/parser/fpdf_parser_decode.h" |
| 18 #include "core/fpdfapi/render/cpdf_progressiverenderer.h" | 18 #include "core/fpdfapi/render/cpdf_progressiverenderer.h" |
| 19 #include "core/fpdfapi/render/cpdf_renderoptions.h" | 19 #include "core/fpdfapi/render/cpdf_renderoptions.h" |
| 20 #include "core/fpdfdoc/cpdf_annotlist.h" | 20 #include "core/fpdfdoc/cpdf_annotlist.h" |
| 21 #include "core/fpdfdoc/cpdf_nametree.h" | 21 #include "core/fpdfdoc/cpdf_nametree.h" |
| 22 #include "core/fpdfdoc/cpdf_occontext.h" | 22 #include "core/fpdfdoc/cpdf_occontext.h" |
| 23 #include "core/fpdfdoc/cpdf_viewerpreferences.h" | 23 #include "core/fpdfdoc/cpdf_viewerpreferences.h" |
| 24 #include "core/fxcodec/fx_codec.h" | 24 #include "core/fxcodec/fx_codec.h" |
| 25 #include "core/fxcrt/fx_memory.h" | 25 #include "core/fxcrt/fx_memory.h" |
| 26 #include "core/fxcrt/fx_safe_types.h" | 26 #include "core/fxcrt/fx_safe_types.h" |
| 27 #include "core/fxge/cfx_fxgedevice.h" | 27 #include "core/fxge/cfx_fxgedevice.h" |
| 28 #include "core/fxge/cfx_gemodule.h" | 28 #include "core/fxge/cfx_gemodule.h" |
| 29 #include "fpdfsdk/cpdfsdk_formfillenvironment.h" |
| 29 #include "fpdfsdk/cpdfsdk_pageview.h" | 30 #include "fpdfsdk/cpdfsdk_pageview.h" |
| 30 #include "fpdfsdk/fsdk_define.h" | 31 #include "fpdfsdk/fsdk_define.h" |
| 31 #include "fpdfsdk/fsdk_pauseadapter.h" | 32 #include "fpdfsdk/fsdk_pauseadapter.h" |
| 32 #include "fpdfsdk/javascript/ijs_runtime.h" | 33 #include "fpdfsdk/javascript/ijs_runtime.h" |
| 33 #include "public/fpdf_ext.h" | 34 #include "public/fpdf_ext.h" |
| 34 #include "public/fpdf_progressive.h" | 35 #include "public/fpdf_progressive.h" |
| 35 #include "third_party/base/numerics/safe_conversions_impl.h" | 36 #include "third_party/base/numerics/safe_conversions_impl.h" |
| 36 #include "third_party/base/ptr_util.h" | 37 #include "third_party/base/ptr_util.h" |
| 37 | 38 |
| 38 #ifdef PDF_ENABLE_XFA | 39 #ifdef PDF_ENABLE_XFA |
| (...skipping 638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 677 | 678 |
| 678 if (pPageView->IsLocked()) { | 679 if (pPageView->IsLocked()) { |
| 679 pPageView->TakePageOwnership(); | 680 pPageView->TakePageOwnership(); |
| 680 return; | 681 return; |
| 681 } | 682 } |
| 682 | 683 |
| 683 bool owned = pPageView->OwnsPage(); | 684 bool owned = pPageView->OwnsPage(); |
| 684 // This will delete the |pPageView| object. We must cleanup the PageView | 685 // This will delete the |pPageView| object. We must cleanup the PageView |
| 685 // first because it will attempt to reset the View on the |pPage| during | 686 // first because it will attempt to reset the View on the |pPage| during |
| 686 // destruction. | 687 // destruction. |
| 687 pPageView->GetSDKDocument()->RemovePageView(pPage); | 688 pPageView->GetFormFillEnv()->GetSDKDocument()->RemovePageView(pPage); |
| 688 // If the page was owned then the pageview will have deleted the page. | 689 // If the page was owned then the pageview will have deleted the page. |
| 689 if (owned) | 690 if (owned) |
| 690 return; | 691 return; |
| 691 } | 692 } |
| 692 delete pPage; | 693 delete pPage; |
| 693 #endif // PDF_ENABLE_XFA | 694 #endif // PDF_ENABLE_XFA |
| 694 } | 695 } |
| 695 | 696 |
| 696 DLLEXPORT void STDCALL FPDF_CloseDocument(FPDF_DOCUMENT document) { | 697 DLLEXPORT void STDCALL FPDF_CloseDocument(FPDF_DOCUMENT document) { |
| 697 delete UnderlyingFromFPDFDocument(document); | 698 delete UnderlyingFromFPDFDocument(document); |
| (...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1129 if (!buffer) { | 1130 if (!buffer) { |
| 1130 *buflen = len; | 1131 *buflen = len; |
| 1131 } else if (*buflen >= len) { | 1132 } else if (*buflen >= len) { |
| 1132 memcpy(buffer, utf16Name.c_str(), len); | 1133 memcpy(buffer, utf16Name.c_str(), len); |
| 1133 *buflen = len; | 1134 *buflen = len; |
| 1134 } else { | 1135 } else { |
| 1135 *buflen = -1; | 1136 *buflen = -1; |
| 1136 } | 1137 } |
| 1137 return (FPDF_DEST)pDestObj; | 1138 return (FPDF_DEST)pDestObj; |
| 1138 } | 1139 } |
| OLD | NEW |