| OLD | NEW |
| 1 // Copyright 2016 PDFium Authors. All rights reserved. | 1 // Copyright 2016 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 "fpdfsdk/cpdfsdk_formfillenvironment.h" | 7 #include "fpdfsdk/cpdfsdk_formfillenvironment.h" |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 | 10 |
| (...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 455 } | 455 } |
| 456 | 456 |
| 457 FPDF_FILEHANDLER* CPDFSDK_FormFillEnvironment::OpenFile(int fileType, | 457 FPDF_FILEHANDLER* CPDFSDK_FormFillEnvironment::OpenFile(int fileType, |
| 458 FPDF_WIDESTRING wsURL, | 458 FPDF_WIDESTRING wsURL, |
| 459 const char* mode) { | 459 const char* mode) { |
| 460 if (m_pInfo && m_pInfo->FFI_OpenFile) | 460 if (m_pInfo && m_pInfo->FFI_OpenFile) |
| 461 return m_pInfo->FFI_OpenFile(m_pInfo, fileType, wsURL, mode); | 461 return m_pInfo->FFI_OpenFile(m_pInfo, fileType, wsURL, mode); |
| 462 return nullptr; | 462 return nullptr; |
| 463 } | 463 } |
| 464 | 464 |
| 465 IFX_SeekableReadStream* CPDFSDK_FormFillEnvironment::DownloadFromURL( | 465 CFX_RetainPtr<IFX_SeekableReadStream> |
| 466 const FX_WCHAR* url) { | 466 CPDFSDK_FormFillEnvironment::DownloadFromURL(const FX_WCHAR* url) { |
| 467 if (!m_pInfo || !m_pInfo->FFI_DownloadFromURL) | 467 if (!m_pInfo || !m_pInfo->FFI_DownloadFromURL) |
| 468 return nullptr; | 468 return nullptr; |
| 469 | 469 |
| 470 CFX_ByteString bstrURL = CFX_WideString(url).UTF16LE_Encode(); | 470 CFX_ByteString bstrURL = CFX_WideString(url).UTF16LE_Encode(); |
| 471 FPDF_WIDESTRING wsURL = | 471 FPDF_WIDESTRING wsURL = |
| 472 (FPDF_WIDESTRING)bstrURL.GetBuffer(bstrURL.GetLength()); | 472 (FPDF_WIDESTRING)bstrURL.GetBuffer(bstrURL.GetLength()); |
| 473 | 473 |
| 474 FPDF_LPFILEHANDLER fileHandler = m_pInfo->FFI_DownloadFromURL(m_pInfo, wsURL); | 474 FPDF_LPFILEHANDLER fileHandler = m_pInfo->FFI_DownloadFromURL(m_pInfo, wsURL); |
| 475 | |
| 476 return MakeSeekableStream(fileHandler); | 475 return MakeSeekableStream(fileHandler); |
| 477 } | 476 } |
| 478 | 477 |
| 479 CFX_WideString CPDFSDK_FormFillEnvironment::PostRequestURL( | 478 CFX_WideString CPDFSDK_FormFillEnvironment::PostRequestURL( |
| 480 const FX_WCHAR* wsURL, | 479 const FX_WCHAR* wsURL, |
| 481 const FX_WCHAR* wsData, | 480 const FX_WCHAR* wsData, |
| 482 const FX_WCHAR* wsContentType, | 481 const FX_WCHAR* wsContentType, |
| 483 const FX_WCHAR* wsEncode, | 482 const FX_WCHAR* wsEncode, |
| 484 const FX_WCHAR* wsHeader) { | 483 const FX_WCHAR* wsHeader) { |
| 485 if (!m_pInfo || !m_pInfo->FFI_PostRequestURL) | 484 if (!m_pInfo || !m_pInfo->FFI_PostRequestURL) |
| (...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 753 } else { | 752 } else { |
| 754 m_pFocusAnnot.Reset(pFocusAnnot.Get()); | 753 m_pFocusAnnot.Reset(pFocusAnnot.Get()); |
| 755 } | 754 } |
| 756 } | 755 } |
| 757 return false; | 756 return false; |
| 758 } | 757 } |
| 759 | 758 |
| 760 bool CPDFSDK_FormFillEnvironment::GetPermissions(int nFlag) { | 759 bool CPDFSDK_FormFillEnvironment::GetPermissions(int nFlag) { |
| 761 return !!(GetPDFDocument()->GetUserPermissions() & nFlag); | 760 return !!(GetPDFDocument()->GetUserPermissions() & nFlag); |
| 762 } | 761 } |
| OLD | NEW |