summaryrefslogtreecommitdiff
path: root/core/fpdfapi/parser/cpdf_parser.cpp
diff options
context:
space:
mode:
authorArtem Strygin <art-snake@yandex-team.ru>2017-10-03 19:10:04 +0300
committerChromium commit bot <commit-bot@chromium.org>2017-10-03 18:16:55 +0000
commitb7fe3c6e8c9d332fc6d3ca55ec9f852ce162c5a1 (patch)
treeab4bd11602c77223192796230e785873061d8b6b /core/fpdfapi/parser/cpdf_parser.cpp
parente4289f69a28d26d14c94bcc0c0b8368dbc2f7e1c (diff)
downloadpdfium-b7fe3c6e8c9d332fc6d3ca55ec9f852ce162c5a1.tar.xz
Move the CryptoHandler into the SecurityHandler
Change-Id: Idb5928e65833641d0443d955e4f2866d0f94cf5f Reviewed-on: https://pdfium-review.googlesource.com/15291 Commit-Queue: Art Snake <art-snake@yandex-team.ru> Reviewed-by: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'core/fpdfapi/parser/cpdf_parser.cpp')
-rw-r--r--core/fpdfapi/parser/cpdf_parser.cpp19
1 files changed, 8 insertions, 11 deletions
diff --git a/core/fpdfapi/parser/cpdf_parser.cpp b/core/fpdfapi/parser/cpdf_parser.cpp
index 17f49c6324..a1b8a2deba 100644
--- a/core/fpdfapi/parser/cpdf_parser.cpp
+++ b/core/fpdfapi/parser/cpdf_parser.cpp
@@ -155,10 +155,6 @@ void CPDF_Parser::SetEncryptDictionary(CPDF_Dictionary* pDict) {
m_pEncryptDict = pDict;
}
-CPDF_CryptoHandler* CPDF_Parser::GetCryptoHandler() const {
- return m_pCryptoHandler.get();
-}
-
RetainPtr<IFX_SeekableReadStream> CPDF_Parser::GetFileAccess() const {
return m_pSyntax->GetFileAccess();
}
@@ -315,17 +311,15 @@ CPDF_Parser::Error CPDF_Parser::SetEncryptHandler() {
m_Password))
return PASSWORD_ERROR;
- m_pSecurityHandler = std::move(pSecurityHandler);
- auto pCryptoHandler = pdfium::MakeUnique<CPDF_CryptoHandler>();
- if (!pCryptoHandler->Init(m_pEncryptDict.Get(), m_pSecurityHandler.get()))
+ if (!pSecurityHandler->InitCryptoHandler())
return HANDLER_ERROR;
- m_pCryptoHandler = std::move(pCryptoHandler);
+
+ m_pSecurityHandler = std::move(pSecurityHandler);
}
return SUCCESS;
}
void CPDF_Parser::ReleaseEncryptHandler() {
- m_pCryptoHandler.reset();
m_pSecurityHandler.reset();
SetEncryptDictionary(nullptr);
}
@@ -1276,9 +1270,12 @@ std::unique_ptr<CPDF_Object> CPDF_Parser::ParseIndirectObjectAtInternal(
if (result && objnum && result->GetObjNum() != objnum)
return nullptr;
- const bool should_decrypt = m_pCryptoHandler && objnum != m_MetadataObjnum;
+ const bool should_decrypt = m_pSecurityHandler &&
+ m_pSecurityHandler->GetCryptoHandler() &&
+ objnum != m_MetadataObjnum;
if (should_decrypt)
- result = m_pCryptoHandler->DecryptObjectTree(std::move(result));
+ result = m_pSecurityHandler->GetCryptoHandler()->DecryptObjectTree(
+ std::move(result));
return result;
}