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: fpdfsdk/fpdfxfa/fpdfxfa_app.cpp

Issue 1857713003: Rename GetCStr and GetPtr to match CFX_ByteString (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Rebase to master Created 4 years, 8 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/android/fpf_skiafontmgr.cpp ('k') | fpdfsdk/fpdfxfa/fpdfxfa_doc.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 "fpdfsdk/include/fpdfxfa/fpdfxfa_app.h" 7 #include "fpdfsdk/include/fpdfxfa/fpdfxfa_app.h"
8 #include "fpdfsdk/include/fpdfxfa/fpdfxfa_doc.h" 8 #include "fpdfsdk/include/fpdfxfa/fpdfxfa_doc.h"
9 #include "fpdfsdk/include/fpdfxfa/fpdfxfa_util.h" 9 #include "fpdfsdk/include/fpdfxfa/fpdfxfa_util.h"
10 #include "fpdfsdk/include/fsdk_define.h" 10 #include "fpdfsdk/include/fsdk_define.h"
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 case XFA_MB_OKCancel: 162 case XFA_MB_OKCancel:
163 iButtonType |= 1; 163 iButtonType |= 1;
164 break; 164 break;
165 case XFA_MB_YesNo: 165 case XFA_MB_YesNo:
166 iButtonType |= 2; 166 iButtonType |= 2;
167 break; 167 break;
168 case XFA_MB_YesNoCancel: 168 case XFA_MB_YesNoCancel:
169 iButtonType |= 3; 169 iButtonType |= 3;
170 break; 170 break;
171 } 171 }
172 int32_t iRet = pEnv->JS_appAlert(wsMessage.GetPtr(), wsTitle.GetPtr(), 172 int32_t iRet = pEnv->JS_appAlert(wsMessage.raw_str(), wsTitle.raw_str(),
173 iButtonType, iconType); 173 iButtonType, iconType);
174 switch (iRet) { 174 switch (iRet) {
175 case 1: 175 case 1:
176 return XFA_IDOK; 176 return XFA_IDOK;
177 case 2: 177 case 2:
178 return XFA_IDCancel; 178 return XFA_IDCancel;
179 case 3: 179 case 3:
180 return XFA_IDNo; 180 return XFA_IDNo;
181 case 4: 181 case 4:
182 return XFA_IDYes; 182 return XFA_IDYes;
183 } 183 }
184 return XFA_IDYes; 184 return XFA_IDYes;
185 } 185 }
186 186
187 void CPDFXFA_App::Response(CFX_WideString& wsAnswer, 187 void CPDFXFA_App::Response(CFX_WideString& wsAnswer,
188 const CFX_WideStringC& wsQuestion, 188 const CFX_WideStringC& wsQuestion,
189 const CFX_WideStringC& wsTitle, 189 const CFX_WideStringC& wsTitle,
190 const CFX_WideStringC& wsDefaultAnswer, 190 const CFX_WideStringC& wsDefaultAnswer,
191 FX_BOOL bMark) { 191 FX_BOOL bMark) {
192 CPDFDoc_Environment* pEnv = m_pEnvList.GetAt(0); 192 CPDFDoc_Environment* pEnv = m_pEnvList.GetAt(0);
193 if (pEnv) { 193 if (pEnv) {
194 int nLength = 2048; 194 int nLength = 2048;
195 char* pBuff = new char[nLength]; 195 char* pBuff = new char[nLength];
196 nLength = pEnv->JS_appResponse(wsQuestion.GetPtr(), wsTitle.GetPtr(), 196 nLength = pEnv->JS_appResponse(wsQuestion.raw_str(), wsTitle.raw_str(),
197 wsDefaultAnswer.GetPtr(), NULL, bMark, pBuff, 197 wsDefaultAnswer.raw_str(), NULL, bMark,
198 nLength); 198 pBuff, nLength);
199 if (nLength > 0) { 199 if (nLength > 0) {
200 nLength = nLength > 2046 ? 2046 : nLength; 200 nLength = nLength > 2046 ? 2046 : nLength;
201 pBuff[nLength] = 0; 201 pBuff[nLength] = 0;
202 pBuff[nLength + 1] = 0; 202 pBuff[nLength + 1] = 0;
203 wsAnswer = CFX_WideString::FromUTF16LE( 203 wsAnswer = CFX_WideString::FromUTF16LE(
204 reinterpret_cast<const unsigned short*>(pBuff), 204 reinterpret_cast<const unsigned short*>(pBuff),
205 nLength / sizeof(unsigned short)); 205 nLength / sizeof(unsigned short));
206 } 206 }
207 delete[] pBuff; 207 delete[] pBuff;
208 } 208 }
(...skipping 12 matching lines...) Expand all
221 if (pEnv) { 221 if (pEnv) {
222 return pEnv->FFI_GetDocumentCount(); 222 return pEnv->FFI_GetDocumentCount();
223 } 223 }
224 224
225 return 0; 225 return 0;
226 } 226 }
227 227
228 IFX_FileRead* CPDFXFA_App::DownloadURL(const CFX_WideStringC& wsURL) { 228 IFX_FileRead* CPDFXFA_App::DownloadURL(const CFX_WideStringC& wsURL) {
229 CPDFDoc_Environment* pEnv = m_pEnvList.GetAt(0); 229 CPDFDoc_Environment* pEnv = m_pEnvList.GetAt(0);
230 if (pEnv) { 230 if (pEnv) {
231 return pEnv->FFI_DownloadFromURL(wsURL.GetPtr()); 231 return pEnv->FFI_DownloadFromURL(wsURL.raw_str());
232 } 232 }
233 return NULL; 233 return NULL;
234 } 234 }
235 235
236 FX_BOOL CPDFXFA_App::PostRequestURL(const CFX_WideStringC& wsURL, 236 FX_BOOL CPDFXFA_App::PostRequestURL(const CFX_WideStringC& wsURL,
237 const CFX_WideStringC& wsData, 237 const CFX_WideStringC& wsData,
238 const CFX_WideStringC& wsContentType, 238 const CFX_WideStringC& wsContentType,
239 const CFX_WideStringC& wsEncode, 239 const CFX_WideStringC& wsEncode,
240 const CFX_WideStringC& wsHeader, 240 const CFX_WideStringC& wsHeader,
241 CFX_WideString& wsResponse) { 241 CFX_WideString& wsResponse) {
242 CPDFDoc_Environment* pEnv = m_pEnvList.GetAt(0); 242 CPDFDoc_Environment* pEnv = m_pEnvList.GetAt(0);
243 if (pEnv) { 243 if (pEnv) {
244 wsResponse = pEnv->FFI_PostRequestURL(wsURL.GetPtr(), wsData.GetPtr(), 244 wsResponse = pEnv->FFI_PostRequestURL(
245 wsContentType.GetPtr(), 245 wsURL.raw_str(), wsData.raw_str(), wsContentType.raw_str(),
246 wsEncode.GetPtr(), wsHeader.GetPtr()); 246 wsEncode.raw_str(), wsHeader.raw_str());
247 return TRUE; 247 return TRUE;
248 } 248 }
249 return FALSE; 249 return FALSE;
250 } 250 }
251 251
252 FX_BOOL CPDFXFA_App::PutRequestURL(const CFX_WideStringC& wsURL, 252 FX_BOOL CPDFXFA_App::PutRequestURL(const CFX_WideStringC& wsURL,
253 const CFX_WideStringC& wsData, 253 const CFX_WideStringC& wsData,
254 const CFX_WideStringC& wsEncode) { 254 const CFX_WideStringC& wsEncode) {
255 CPDFDoc_Environment* pEnv = m_pEnvList.GetAt(0); 255 CPDFDoc_Environment* pEnv = m_pEnvList.GetAt(0);
256 if (pEnv) { 256 if (pEnv) {
257 return pEnv->FFI_PutRequestURL(wsURL.GetPtr(), wsData.GetPtr(), 257 return pEnv->FFI_PutRequestURL(wsURL.raw_str(), wsData.raw_str(),
258 wsEncode.GetPtr()); 258 wsEncode.raw_str());
259 } 259 }
260 return FALSE; 260 return FALSE;
261 } 261 }
262 262
263 void CPDFXFA_App::LoadString(int32_t iStringID, CFX_WideString& wsString) { 263 void CPDFXFA_App::LoadString(int32_t iStringID, CFX_WideString& wsString) {
264 switch (iStringID) { 264 switch (iStringID) {
265 case XFA_IDS_ValidateFailed: 265 case XFA_IDS_ValidateFailed:
266 wsString = L"%s validate failed"; 266 wsString = L"%s validate failed";
267 return; 267 return;
268 case XFA_IDS_CalcOverride: 268 case XFA_IDS_CalcOverride:
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
521 return FALSE; 521 return FALSE;
522 } 522 }
523 523
524 IFWL_AdapterTimerMgr* CPDFXFA_App::GetTimerMgr() { 524 IFWL_AdapterTimerMgr* CPDFXFA_App::GetTimerMgr() {
525 CXFA_FWLAdapterTimerMgr* pAdapter = NULL; 525 CXFA_FWLAdapterTimerMgr* pAdapter = NULL;
526 CPDFDoc_Environment* pEnv = m_pEnvList.GetAt(0); 526 CPDFDoc_Environment* pEnv = m_pEnvList.GetAt(0);
527 if (pEnv) 527 if (pEnv)
528 pAdapter = new CXFA_FWLAdapterTimerMgr(pEnv); 528 pAdapter = new CXFA_FWLAdapterTimerMgr(pEnv);
529 return pAdapter; 529 return pAdapter;
530 } 530 }
OLDNEW
« no previous file with comments | « core/fxge/android/fpf_skiafontmgr.cpp ('k') | fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698