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

Side by Side Diff: core/fpdfapi/edit/fpdf_edit_create.cpp

Issue 2386263003: Move core/fpdfapi/fpdf_edit to core/fpdfapi/edit (Closed)
Patch Set: Created 4 years, 2 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
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_edit/editint.h" 7 #include "core/fpdfapi/edit/editint.h"
8 8
9 #include <vector> 9 #include <vector>
10 10
11 #include "core/fpdfapi/fpdf_edit/cpdf_creator.h" 11 #include "core/fpdfapi/edit/cpdf_creator.h"
12 #include "core/fpdfapi/fpdf_parser/cpdf_array.h" 12 #include "core/fpdfapi/fpdf_parser/cpdf_array.h"
13 #include "core/fpdfapi/fpdf_parser/cpdf_crypto_handler.h" 13 #include "core/fpdfapi/fpdf_parser/cpdf_crypto_handler.h"
14 #include "core/fpdfapi/fpdf_parser/cpdf_dictionary.h" 14 #include "core/fpdfapi/fpdf_parser/cpdf_dictionary.h"
15 #include "core/fpdfapi/fpdf_parser/cpdf_document.h" 15 #include "core/fpdfapi/fpdf_parser/cpdf_document.h"
16 #include "core/fpdfapi/fpdf_parser/cpdf_parser.h" 16 #include "core/fpdfapi/fpdf_parser/cpdf_parser.h"
17 #include "core/fpdfapi/fpdf_parser/cpdf_reference.h" 17 #include "core/fpdfapi/fpdf_parser/cpdf_reference.h"
18 #include "core/fpdfapi/fpdf_parser/cpdf_security_handler.h" 18 #include "core/fpdfapi/fpdf_parser/cpdf_security_handler.h"
19 #include "core/fpdfapi/fpdf_parser/cpdf_stream.h" 19 #include "core/fpdfapi/fpdf_parser/cpdf_stream.h"
20 #include "core/fpdfapi/fpdf_parser/cpdf_stream_acc.h" 20 #include "core/fpdfapi/fpdf_parser/cpdf_stream_acc.h"
21 #include "core/fpdfapi/fpdf_parser/cpdf_string.h" 21 #include "core/fpdfapi/fpdf_parser/cpdf_string.h"
(...skipping 1906 matching lines...) Expand 10 before | Expand all | Expand 10 after
1928 void CPDF_Creator::InitID(FX_BOOL bDefault) { 1928 void CPDF_Creator::InitID(FX_BOOL bDefault) {
1929 CPDF_Array* pOldIDArray = m_pParser ? m_pParser->GetIDArray() : nullptr; 1929 CPDF_Array* pOldIDArray = m_pParser ? m_pParser->GetIDArray() : nullptr;
1930 FX_BOOL bNewId = !m_pIDArray; 1930 FX_BOOL bNewId = !m_pIDArray;
1931 if (bNewId) { 1931 if (bNewId) {
1932 m_pIDArray.reset(new CPDF_Array); 1932 m_pIDArray.reset(new CPDF_Array);
1933 CPDF_Object* pID1 = pOldIDArray ? pOldIDArray->GetObjectAt(0) : nullptr; 1933 CPDF_Object* pID1 = pOldIDArray ? pOldIDArray->GetObjectAt(0) : nullptr;
1934 if (pID1) { 1934 if (pID1) {
1935 m_pIDArray->Add(pID1->Clone()); 1935 m_pIDArray->Add(pID1->Clone());
1936 } else { 1936 } else {
1937 std::vector<uint8_t> buffer = 1937 std::vector<uint8_t> buffer =
1938 PDF_GenerateFileID((uint32_t)(uintptr_t) this, m_dwLastObjNum); 1938 PDF_GenerateFileID((uint32_t)(uintptr_t)this, m_dwLastObjNum);
1939 CFX_ByteString bsBuffer(buffer.data(), buffer.size()); 1939 CFX_ByteString bsBuffer(buffer.data(), buffer.size());
1940 m_pIDArray->Add(new CPDF_String(bsBuffer, TRUE)); 1940 m_pIDArray->Add(new CPDF_String(bsBuffer, TRUE));
1941 } 1941 }
1942 } 1942 }
1943 if (!bDefault) { 1943 if (!bDefault) {
1944 return; 1944 return;
1945 } 1945 }
1946 if (pOldIDArray) { 1946 if (pOldIDArray) {
1947 CPDF_Object* pID2 = pOldIDArray->GetObjectAt(1); 1947 CPDF_Object* pID2 = pOldIDArray->GetObjectAt(1);
1948 if ((m_dwFlags & FPDFCREATE_INCREMENTAL) && m_pEncryptDict && pID2) { 1948 if ((m_dwFlags & FPDFCREATE_INCREMENTAL) && m_pEncryptDict && pID2) {
1949 m_pIDArray->Add(pID2->Clone()); 1949 m_pIDArray->Add(pID2->Clone());
1950 return; 1950 return;
1951 } 1951 }
1952 std::vector<uint8_t> buffer = 1952 std::vector<uint8_t> buffer =
1953 PDF_GenerateFileID((uint32_t)(uintptr_t) this, m_dwLastObjNum); 1953 PDF_GenerateFileID((uint32_t)(uintptr_t)this, m_dwLastObjNum);
1954 CFX_ByteString bsBuffer(buffer.data(), buffer.size()); 1954 CFX_ByteString bsBuffer(buffer.data(), buffer.size());
1955 m_pIDArray->Add(new CPDF_String(bsBuffer, TRUE)); 1955 m_pIDArray->Add(new CPDF_String(bsBuffer, TRUE));
1956 return; 1956 return;
1957 } 1957 }
1958 m_pIDArray->Add(m_pIDArray->GetObjectAt(0)->Clone()); 1958 m_pIDArray->Add(m_pIDArray->GetObjectAt(0)->Clone());
1959 if (m_pEncryptDict && !pOldIDArray && m_pParser && bNewId) { 1959 if (m_pEncryptDict && !pOldIDArray && m_pParser && bNewId) {
1960 if (m_pEncryptDict->GetStringFor("Filter") == "Standard") { 1960 if (m_pEncryptDict->GetStringFor("Filter") == "Standard") {
1961 CFX_ByteString user_pass = m_pParser->GetPassword(); 1961 CFX_ByteString user_pass = m_pParser->GetPassword();
1962 uint32_t flag = PDF_ENCRYPT_CONTENT; 1962 uint32_t flag = PDF_ENCRYPT_CONTENT;
1963 1963
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
2013 m_pCryptoHandler = nullptr; 2013 m_pCryptoHandler = nullptr;
2014 } 2014 }
2015 void CPDF_Creator::ResetStandardSecurity() { 2015 void CPDF_Creator::ResetStandardSecurity() {
2016 if (!m_bLocalCryptoHandler) 2016 if (!m_bLocalCryptoHandler)
2017 return; 2017 return;
2018 2018
2019 delete m_pCryptoHandler; 2019 delete m_pCryptoHandler;
2020 m_pCryptoHandler = nullptr; 2020 m_pCryptoHandler = nullptr;
2021 m_bLocalCryptoHandler = FALSE; 2021 m_bLocalCryptoHandler = FALSE;
2022 } 2022 }
OLDNEW
« no previous file with comments | « core/fpdfapi/edit/editint.h ('k') | core/fpdfapi/fpdf_edit/cpdf_creator.h » ('j') | fpdfsdk/DEPS » ('J')

Powered by Google App Engine
This is Rietveld 408576698