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

Side by Side Diff: fpdfsdk/cpdfsdk_document.cpp

Issue 2386273004: Add ptr_util.h from base until std::make_unique<> available (Closed)
Patch Set: 2016 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
« no previous file with comments | « core/fxge/win32/fx_win32_device.cpp ('k') | fpdfsdk/cpdfsdk_environment.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/cpdfsdk_document.h" 7 #include "fpdfsdk/cpdfsdk_document.h"
8 8
9 #include "core/fpdfapi/fpdf_parser/cpdf_array.h" 9 #include "core/fpdfapi/fpdf_parser/cpdf_array.h"
10 #include "core/fpdfapi/fpdf_parser/cpdf_dictionary.h" 10 #include "core/fpdfapi/fpdf_parser/cpdf_dictionary.h"
11 #include "core/fpdfapi/fpdf_parser/cpdf_document.h" 11 #include "core/fpdfapi/fpdf_parser/cpdf_document.h"
12 #include "core/fpdfapi/fpdf_parser/cpdf_object.h" 12 #include "core/fpdfapi/fpdf_parser/cpdf_object.h"
13 #include "core/fpdfdoc/cpdf_action.h" 13 #include "core/fpdfdoc/cpdf_action.h"
14 #include "core/fpdfdoc/cpdf_docjsactions.h" 14 #include "core/fpdfdoc/cpdf_docjsactions.h"
15 #include "core/fpdfdoc/cpdf_occontext.h" 15 #include "core/fpdfdoc/cpdf_occontext.h"
16 #include "fpdfsdk/cpdfsdk_annot.h" 16 #include "fpdfsdk/cpdfsdk_annot.h"
17 #include "fpdfsdk/cpdfsdk_annothandlermgr.h" 17 #include "fpdfsdk/cpdfsdk_annothandlermgr.h"
18 #include "fpdfsdk/cpdfsdk_environment.h" 18 #include "fpdfsdk/cpdfsdk_environment.h"
19 #include "fpdfsdk/cpdfsdk_interform.h" 19 #include "fpdfsdk/cpdfsdk_interform.h"
20 #include "fpdfsdk/cpdfsdk_pageview.h" 20 #include "fpdfsdk/cpdfsdk_pageview.h"
21 #include "fpdfsdk/cpdfsdk_widget.h" 21 #include "fpdfsdk/cpdfsdk_widget.h"
22 #include "fpdfsdk/fsdk_actionhandler.h" 22 #include "fpdfsdk/fsdk_actionhandler.h"
23 #include "third_party/base/ptr_util.h"
23 24
24 // static 25 // static
25 CPDFSDK_Document* CPDFSDK_Document::FromFPDFFormHandle( 26 CPDFSDK_Document* CPDFSDK_Document::FromFPDFFormHandle(
26 FPDF_FORMHANDLE hHandle) { 27 FPDF_FORMHANDLE hHandle) {
27 CPDFSDK_Environment* pEnv = static_cast<CPDFSDK_Environment*>(hHandle); 28 CPDFSDK_Environment* pEnv = static_cast<CPDFSDK_Environment*>(hHandle);
28 return pEnv ? pEnv->GetSDKDocument() : nullptr; 29 return pEnv ? pEnv->GetSDKDocument() : nullptr;
29 } 30 }
30 31
31 CPDFSDK_Document::CPDFSDK_Document(UnderlyingDocumentType* pDoc, 32 CPDFSDK_Document::CPDFSDK_Document(UnderlyingDocumentType* pDoc,
32 CPDFSDK_Environment* pEnv) 33 CPDFSDK_Environment* pEnv)
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 152
152 delete pPageView; 153 delete pPageView;
153 } 154 }
154 155
155 UnderlyingPageType* CPDFSDK_Document::GetPage(int nIndex) { 156 UnderlyingPageType* CPDFSDK_Document::GetPage(int nIndex) {
156 return UnderlyingFromFPDFPage(m_pEnv->GetPage(m_pDoc, nIndex)); 157 return UnderlyingFromFPDFPage(m_pEnv->GetPage(m_pDoc, nIndex));
157 } 158 }
158 159
159 CPDFSDK_InterForm* CPDFSDK_Document::GetInterForm() { 160 CPDFSDK_InterForm* CPDFSDK_Document::GetInterForm() {
160 if (!m_pInterForm) 161 if (!m_pInterForm)
161 m_pInterForm = WrapUnique(new CPDFSDK_InterForm(this)); 162 m_pInterForm = pdfium::MakeUnique<CPDFSDK_InterForm>(this);
162 return m_pInterForm.get(); 163 return m_pInterForm.get();
163 } 164 }
164 165
165 void CPDFSDK_Document::UpdateAllViews(CPDFSDK_PageView* pSender, 166 void CPDFSDK_Document::UpdateAllViews(CPDFSDK_PageView* pSender,
166 CPDFSDK_Annot* pAnnot) { 167 CPDFSDK_Annot* pAnnot) {
167 for (const auto& it : m_pageMap) { 168 for (const auto& it : m_pageMap) {
168 CPDFSDK_PageView* pPageView = it.second; 169 CPDFSDK_PageView* pPageView = it.second;
169 if (pPageView != pSender) { 170 if (pPageView != pSender) {
170 pPageView->UpdateView(pAnnot); 171 pPageView->UpdateView(pAnnot);
171 } 172 }
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 return GetPDFDocument()->GetUserPermissions() & nFlag; 254 return GetPDFDocument()->GetUserPermissions() & nFlag;
254 } 255 }
255 256
256 IJS_Runtime* CPDFSDK_Document::GetJsRuntime() { 257 IJS_Runtime* CPDFSDK_Document::GetJsRuntime() {
257 return m_pEnv->GetJSRuntime(); 258 return m_pEnv->GetJSRuntime();
258 } 259 }
259 260
260 CFX_WideString CPDFSDK_Document::GetPath() { 261 CFX_WideString CPDFSDK_Document::GetPath() {
261 return m_pEnv->JS_docGetFilePath(); 262 return m_pEnv->JS_docGetFilePath();
262 } 263 }
OLDNEW
« no previous file with comments | « core/fxge/win32/fx_win32_device.cpp ('k') | fpdfsdk/cpdfsdk_environment.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698