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

Side by Side Diff: fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp

Issue 2510223002: Make CPDF_Dictionary use unique pointers. (Closed)
Patch Set: rebase Created 4 years, 1 month 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 | « fpdfsdk/fpdfview.cpp ('k') | fpdfsdk/javascript/Document.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 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/fpdfxfa/cpdfxfa_docenvironment.h" 7 #include "fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.h"
8 8
9 #include <memory>
10
9 #include "core/fpdfapi/parser/cpdf_array.h" 11 #include "core/fpdfapi/parser/cpdf_array.h"
10 #include "core/fpdfapi/parser/cpdf_stream_acc.h" 12 #include "core/fpdfapi/parser/cpdf_stream_acc.h"
11 #include "core/fpdfapi/parser/cpdf_string.h" 13 #include "core/fpdfapi/parser/cpdf_string.h"
12 #include "fpdfsdk/cpdfsdk_formfillenvironment.h" 14 #include "fpdfsdk/cpdfsdk_formfillenvironment.h"
13 #include "fpdfsdk/cpdfsdk_interform.h" 15 #include "fpdfsdk/cpdfsdk_interform.h"
14 #include "fpdfsdk/cpdfsdk_pageview.h" 16 #include "fpdfsdk/cpdfsdk_pageview.h"
15 #include "fpdfsdk/fpdfxfa/cpdfxfa_context.h" 17 #include "fpdfsdk/fpdfxfa/cpdfxfa_context.h"
16 #include "fpdfsdk/fpdfxfa/cpdfxfa_page.h" 18 #include "fpdfsdk/fpdfxfa/cpdfxfa_page.h"
17 #include "fpdfsdk/javascript/ijs_runtime.h" 19 #include "fpdfsdk/javascript/ijs_runtime.h"
18 #include "xfa/fxfa/xfa_ffdocview.h" 20 #include "xfa/fxfa/xfa_ffdocview.h"
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 wsTitle = wsTitle.FromLocal(csTitle.GetBuffer(csTitle.GetLength())); 393 wsTitle = wsTitle.FromLocal(csTitle.GetBuffer(csTitle.GetLength()));
392 csTitle.ReleaseBuffer(csTitle.GetLength()); 394 csTitle.ReleaseBuffer(csTitle.GetLength());
393 } 395 }
394 396
395 void CPDFXFA_DocEnvironment::SetTitle(CXFA_FFDoc* hDoc, 397 void CPDFXFA_DocEnvironment::SetTitle(CXFA_FFDoc* hDoc,
396 const CFX_WideString& wsTitle) { 398 const CFX_WideString& wsTitle) {
397 if (hDoc != m_pContext->GetXFADoc() || !m_pContext->GetPDFDoc()) 399 if (hDoc != m_pContext->GetXFADoc() || !m_pContext->GetPDFDoc())
398 return; 400 return;
399 401
400 if (CPDF_Dictionary* pInfoDict = m_pContext->GetPDFDoc()->GetInfo()) 402 if (CPDF_Dictionary* pInfoDict = m_pContext->GetPDFDoc()->GetInfo())
401 pInfoDict->SetFor("Title", new CPDF_String(wsTitle)); 403 pInfoDict->SetNewFor<CPDF_String>("Title", wsTitle);
402 } 404 }
403 405
404 void CPDFXFA_DocEnvironment::ExportData(CXFA_FFDoc* hDoc, 406 void CPDFXFA_DocEnvironment::ExportData(CXFA_FFDoc* hDoc,
405 const CFX_WideString& wsFilePath, 407 const CFX_WideString& wsFilePath,
406 bool bXDP) { 408 bool bXDP) {
407 if (hDoc != m_pContext->GetXFADoc()) 409 if (hDoc != m_pContext->GetXFADoc())
408 return; 410 return;
409 411
410 if (m_pContext->GetDocType() != DOCTYPE_DYNAMIC_XFA && 412 if (m_pContext->GetDocType() != DOCTYPE_DYNAMIC_XFA &&
411 m_pContext->GetDocType() != DOCTYPE_STATIC_XFA) { 413 m_pContext->GetDocType() != DOCTYPE_STATIC_XFA) {
(...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after
1017 !m_pContext->GetFormFillEnv()->GetJSRuntime()) { 1019 !m_pContext->GetFormFillEnv()->GetJSRuntime()) {
1018 return false; 1020 return false;
1019 } 1021 }
1020 1022
1021 CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pContext->GetFormFillEnv(); 1023 CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pContext->GetFormFillEnv();
1022 if (!m_pJSContext) 1024 if (!m_pJSContext)
1023 m_pJSContext = pFormFillEnv->GetJSRuntime()->NewContext(); 1025 m_pJSContext = pFormFillEnv->GetJSRuntime()->NewContext();
1024 1026
1025 return pFormFillEnv->GetJSRuntime()->GetValueByName(szPropName, pValue); 1027 return pFormFillEnv->GetJSRuntime()->GetValueByName(szPropName, pValue);
1026 } 1028 }
OLDNEW
« no previous file with comments | « fpdfsdk/fpdfview.cpp ('k') | fpdfsdk/javascript/Document.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698