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

Side by Side Diff: fpdfsdk/src/javascript/app.cpp

Issue 1545183002: Merge to XFA: Switch from nonstd::unique_ptr to std::unique_ptr. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: xfa Created 4 years, 12 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 "app.h" 7 #include "app.h"
8 8
9 #include <memory>
10
9 #include "Document.h" 11 #include "Document.h"
10 #include "JS_Context.h" 12 #include "JS_Context.h"
11 #include "JS_Define.h" 13 #include "JS_Define.h"
12 #include "JS_EventHandler.h" 14 #include "JS_EventHandler.h"
13 #include "JS_Object.h" 15 #include "JS_Object.h"
14 #include "JS_Runtime.h" 16 #include "JS_Runtime.h"
15 #include "JS_Value.h" 17 #include "JS_Value.h"
16 #include "fpdfsdk/include/fsdk_mgr.h" // For CPDFDoc_Environment. 18 #include "fpdfsdk/include/fsdk_mgr.h" // For CPDFDoc_Environment.
17 #include "fpdfsdk/include/javascript/IJavaScript.h" 19 #include "fpdfsdk/include/javascript/IJavaScript.h"
18 #include "resource.h" 20 #include "resource.h"
19 #include "third_party/base/nonstd_unique_ptr.h"
20 21
21 BEGIN_JS_STATIC_CONST(CJS_TimerObj) 22 BEGIN_JS_STATIC_CONST(CJS_TimerObj)
22 END_JS_STATIC_CONST() 23 END_JS_STATIC_CONST()
23 24
24 BEGIN_JS_STATIC_PROP(CJS_TimerObj) 25 BEGIN_JS_STATIC_PROP(CJS_TimerObj)
25 END_JS_STATIC_PROP() 26 END_JS_STATIC_PROP()
26 27
27 BEGIN_JS_STATIC_METHOD(CJS_TimerObj) 28 BEGIN_JS_STATIC_METHOD(CJS_TimerObj)
28 END_JS_STATIC_METHOD() 29 END_JS_STATIC_METHOD()
29 30
(...skipping 766 matching lines...) Expand 10 before | Expand all | Expand 10 after
796 // FALLTHROUGH 797 // FALLTHROUGH
797 default: 798 default:
798 break; 799 break;
799 } 800 }
800 } 801 }
801 802
802 CJS_Context* pContext = (CJS_Context*)cc; 803 CJS_Context* pContext = (CJS_Context*)cc;
803 CPDFDoc_Environment* pApp = pContext->GetReaderApp(); 804 CPDFDoc_Environment* pApp = pContext->GetReaderApp();
804 805
805 const int MAX_INPUT_BYTES = 2048; 806 const int MAX_INPUT_BYTES = 2048;
806 nonstd::unique_ptr<char[]> pBuff(new char[MAX_INPUT_BYTES + 2]); 807 std::unique_ptr<char[]> pBuff(new char[MAX_INPUT_BYTES + 2]);
807 memset(pBuff.get(), 0, MAX_INPUT_BYTES + 2); 808 memset(pBuff.get(), 0, MAX_INPUT_BYTES + 2);
808 int nLengthBytes = pApp->JS_appResponse( 809 int nLengthBytes = pApp->JS_appResponse(
809 swQuestion.c_str(), swTitle.c_str(), swDefault.c_str(), swLabel.c_str(), 810 swQuestion.c_str(), swTitle.c_str(), swDefault.c_str(), swLabel.c_str(),
810 bPassWord, pBuff.get(), MAX_INPUT_BYTES); 811 bPassWord, pBuff.get(), MAX_INPUT_BYTES);
811 if (nLengthBytes <= 0) { 812 if (nLengthBytes <= 0) {
812 vRet.SetNull(); 813 vRet.SetNull();
813 return FALSE; 814 return FALSE;
814 } 815 }
815 nLengthBytes = std::min(nLengthBytes, MAX_INPUT_BYTES); 816 nLengthBytes = std::min(nLengthBytes, MAX_INPUT_BYTES);
816 817
817 CFX_WideString ret_string = CFX_WideString::FromUTF16LE( 818 CFX_WideString ret_string = CFX_WideString::FromUTF16LE(
818 (unsigned short*)pBuff.get(), nLengthBytes / sizeof(unsigned short)); 819 (unsigned short*)pBuff.get(), nLengthBytes / sizeof(unsigned short));
819 vRet = ret_string.c_str(); 820 vRet = ret_string.c_str();
820 return TRUE; 821 return TRUE;
821 } 822 }
822 823
823 FX_BOOL app::media(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { 824 FX_BOOL app::media(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) {
824 return FALSE; 825 return FALSE;
825 } 826 }
826 827
827 FX_BOOL app::execDialog(IJS_Context* cc, 828 FX_BOOL app::execDialog(IJS_Context* cc,
828 const std::vector<CJS_Value>& params, 829 const std::vector<CJS_Value>& params,
829 CJS_Value& vRet, 830 CJS_Value& vRet,
830 CFX_WideString& sError) { 831 CFX_WideString& sError) {
831 return TRUE; 832 return TRUE;
832 } 833 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698