Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(13)

Side by Side Diff: core/fpdfapi/fpdf_parser/cpdf_document.cpp

Issue 2005653002: Distinguish between user and owner passwords. (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: rebase Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « BUILD.gn ('k') | core/fpdfapi/fpdf_parser/cpdf_parser.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "core/fpdfapi/fpdf_parser/include/cpdf_document.h" 7 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h"
8 8
9 #include <set> 9 #include <set>
10 10
(...skipping 701 matching lines...) Expand 10 before | Expand all | Expand 10 after
712 return 0; 712 return 0;
713 713
714 if (!pPages->KeyExist("Kids")) 714 if (!pPages->KeyExist("Kids"))
715 return 1; 715 return 1;
716 716
717 std::set<CPDF_Dictionary*> visited_pages; 717 std::set<CPDF_Dictionary*> visited_pages;
718 visited_pages.insert(pPages); 718 visited_pages.insert(pPages);
719 return CountPages(pPages, &visited_pages); 719 return CountPages(pPages, &visited_pages);
720 } 720 }
721 721
722 uint32_t CPDF_Document::GetUserPermissions(FX_BOOL bCheckRevision) const { 722 uint32_t CPDF_Document::GetUserPermissions() const {
723 return m_pParser ? m_pParser->GetPermissions(bCheckRevision) 723 // https://bugs.chromium.org/p/pdfium/issues/detail?id=499
724 : static_cast<uint32_t>(-1); 724 if (!m_pParser) {
725 #ifndef PDF_ENABLE_XFA
726 return 0;
727 #else // PDF_ENABLE_XFA
728 return 0xFFFFFFFF;
729 #endif
730 }
731 return m_pParser->GetPermissions();
725 } 732 }
726 733
727 FX_BOOL CPDF_Document::IsFormStream(uint32_t objnum, FX_BOOL& bForm) const { 734 FX_BOOL CPDF_Document::IsFormStream(uint32_t objnum, FX_BOOL& bForm) const {
728 auto it = m_IndirectObjs.find(objnum); 735 auto it = m_IndirectObjs.find(objnum);
729 if (it != m_IndirectObjs.end()) { 736 if (it != m_IndirectObjs.end()) {
730 CPDF_Stream* pStream = it->second->AsStream(); 737 CPDF_Stream* pStream = it->second->AsStream();
731 bForm = pStream && pStream->GetDict()->GetStringBy("Subtype") == "Form"; 738 bForm = pStream && pStream->GetDict()->GetStringBy("Subtype") == "Form";
732 return TRUE; 739 return TRUE;
733 } 740 }
734 if (!m_pParser) { 741 if (!m_pParser) {
(...skipping 705 matching lines...) Expand 10 before | Expand all | Expand 10 after
1440 } 1447 }
1441 } 1448 }
1442 pFontDesc->SetAtInteger("StemV", fStemV); 1449 pFontDesc->SetAtInteger("StemV", fStemV);
1443 AddIndirectObject(pFontDesc); 1450 AddIndirectObject(pFontDesc);
1444 pFontDict->SetAtReference("FontDescriptor", this, pFontDesc); 1451 pFontDict->SetAtReference("FontDescriptor", this, pFontDesc);
1445 CFRelease(traits); 1452 CFRelease(traits);
1446 CFRelease(languages); 1453 CFRelease(languages);
1447 return LoadFont(pBaseDict); 1454 return LoadFont(pBaseDict);
1448 } 1455 }
1449 #endif // _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ 1456 #endif // _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
OLDNEW
« no previous file with comments | « BUILD.gn ('k') | core/fpdfapi/fpdf_parser/cpdf_parser.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698