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

Side by Side Diff: fpdfsdk/javascript/Document.cpp

Issue 2242593002: Make FXJS_GetObjectElement return std::vector<CFX_WideString>. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 4 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 | « no previous file | fpdfsdk/javascript/JS_Value.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/javascript/Document.h" 7 #include "fpdfsdk/javascript/Document.h"
8 8
9 #include <vector> 9 #include <vector>
10 10
(...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after
608 strURL = params[0].ToCFXWideString(pIsolate); 608 strURL = params[0].ToCFXWideString(pIsolate);
609 if (nSize > 1) 609 if (nSize > 1)
610 bFDF = params[1].ToBool(pIsolate); 610 bFDF = params[1].ToBool(pIsolate);
611 if (nSize > 2) 611 if (nSize > 2)
612 bEmpty = params[2].ToBool(pIsolate); 612 bEmpty = params[2].ToBool(pIsolate);
613 if (nSize > 3) 613 if (nSize > 3)
614 aFields.Attach(params[3].ToV8Array(pIsolate)); 614 aFields.Attach(params[3].ToV8Array(pIsolate));
615 } else if (v.GetType() == CJS_Value::VT_object) { 615 } else if (v.GetType() == CJS_Value::VT_object) {
616 v8::Local<v8::Object> pObj = params[0].ToV8Object(pIsolate); 616 v8::Local<v8::Object> pObj = params[0].ToV8Object(pIsolate);
617 v8::Local<v8::Value> pValue = 617 v8::Local<v8::Value> pValue =
618 FXJS_GetObjectElement(pIsolate, pObj, L"cURL"); 618 FXJS_GetObjectProperty(pIsolate, pObj, L"cURL");
619 if (!pValue.IsEmpty()) 619 if (!pValue.IsEmpty())
620 strURL = CJS_Value(pRuntime, pValue).ToCFXWideString(pIsolate); 620 strURL = CJS_Value(pRuntime, pValue).ToCFXWideString(pIsolate);
621 621
622 pValue = FXJS_GetObjectElement(pIsolate, pObj, L"bFDF"); 622 pValue = FXJS_GetObjectProperty(pIsolate, pObj, L"bFDF");
623 bFDF = CJS_Value(pRuntime, pValue).ToBool(pIsolate); 623 bFDF = CJS_Value(pRuntime, pValue).ToBool(pIsolate);
624 624
625 pValue = FXJS_GetObjectElement(pIsolate, pObj, L"bEmpty"); 625 pValue = FXJS_GetObjectProperty(pIsolate, pObj, L"bEmpty");
626 bEmpty = CJS_Value(pRuntime, pValue).ToBool(pIsolate); 626 bEmpty = CJS_Value(pRuntime, pValue).ToBool(pIsolate);
627 627
628 pValue = FXJS_GetObjectElement(pIsolate, pObj, L"aFields"); 628 pValue = FXJS_GetObjectProperty(pIsolate, pObj, L"aFields");
629 aFields.Attach(CJS_Value(pRuntime, pValue).ToV8Array(pIsolate)); 629 aFields.Attach(CJS_Value(pRuntime, pValue).ToV8Array(pIsolate));
630 } 630 }
631 631
632 CPDFSDK_InterForm* pInterForm = m_pDocument->GetInterForm(); 632 CPDFSDK_InterForm* pInterForm = m_pDocument->GetInterForm();
633 CPDF_InterForm* pPDFInterForm = pInterForm->GetInterForm(); 633 CPDF_InterForm* pPDFInterForm = pInterForm->GetInterForm();
634 if (aFields.GetLength() == 0 && bEmpty) { 634 if (aFields.GetLength() == 0 && bEmpty) {
635 if (pPDFInterForm->CheckRequiredFields(nullptr, true)) { 635 if (pPDFInterForm->CheckRequiredFields(nullptr, true)) {
636 pRuntime->BeginBlock(); 636 pRuntime->BeginBlock();
637 pInterForm->SubmitForm(strURL, FALSE); 637 pInterForm->SubmitForm(strURL, FALSE);
638 pRuntime->EndBlock(); 638 pRuntime->EndBlock();
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
705 if (params.size() >= 4) 705 if (params.size() >= 4)
706 cBcc = params[3].ToCFXWideString(pIsolate); 706 cBcc = params[3].ToCFXWideString(pIsolate);
707 if (params.size() >= 5) 707 if (params.size() >= 5)
708 cSubject = params[4].ToCFXWideString(pIsolate); 708 cSubject = params[4].ToCFXWideString(pIsolate);
709 if (params.size() >= 6) 709 if (params.size() >= 6)
710 cMsg = params[5].ToCFXWideString(pIsolate); 710 cMsg = params[5].ToCFXWideString(pIsolate);
711 711
712 if (params.size() >= 1 && params[0].GetType() == CJS_Value::VT_object) { 712 if (params.size() >= 1 && params[0].GetType() == CJS_Value::VT_object) {
713 v8::Local<v8::Object> pObj = params[0].ToV8Object(pIsolate); 713 v8::Local<v8::Object> pObj = params[0].ToV8Object(pIsolate);
714 714
715 v8::Local<v8::Value> pValue = FXJS_GetObjectElement(pIsolate, pObj, L"bUI"); 715 v8::Local<v8::Value> pValue =
716 FXJS_GetObjectProperty(pIsolate, pObj, L"bUI");
716 bUI = CJS_Value(pRuntime, pValue).ToInt(pIsolate); 717 bUI = CJS_Value(pRuntime, pValue).ToInt(pIsolate);
717 718
718 pValue = FXJS_GetObjectElement(pIsolate, pObj, L"cTo"); 719 pValue = FXJS_GetObjectProperty(pIsolate, pObj, L"cTo");
719 cTo = CJS_Value(pRuntime, pValue).ToCFXWideString(pIsolate); 720 cTo = CJS_Value(pRuntime, pValue).ToCFXWideString(pIsolate);
720 721
721 pValue = FXJS_GetObjectElement(pIsolate, pObj, L"cCc"); 722 pValue = FXJS_GetObjectProperty(pIsolate, pObj, L"cCc");
722 cCc = CJS_Value(pRuntime, pValue).ToCFXWideString(pIsolate); 723 cCc = CJS_Value(pRuntime, pValue).ToCFXWideString(pIsolate);
723 724
724 pValue = FXJS_GetObjectElement(pIsolate, pObj, L"cBcc"); 725 pValue = FXJS_GetObjectProperty(pIsolate, pObj, L"cBcc");
725 cBcc = CJS_Value(pRuntime, pValue).ToCFXWideString(pIsolate); 726 cBcc = CJS_Value(pRuntime, pValue).ToCFXWideString(pIsolate);
726 727
727 pValue = FXJS_GetObjectElement(pIsolate, pObj, L"cSubject"); 728 pValue = FXJS_GetObjectProperty(pIsolate, pObj, L"cSubject");
728 cSubject = CJS_Value(pRuntime, pValue).ToCFXWideString(pIsolate); 729 cSubject = CJS_Value(pRuntime, pValue).ToCFXWideString(pIsolate);
729 730
730 pValue = FXJS_GetObjectElement(pIsolate, pObj, L"cMsg"); 731 pValue = FXJS_GetObjectProperty(pIsolate, pObj, L"cMsg");
731 cMsg = CJS_Value(pRuntime, pValue).ToCFXWideString(pIsolate); 732 cMsg = CJS_Value(pRuntime, pValue).ToCFXWideString(pIsolate);
732 } 733 }
733 734
734 pRuntime->BeginBlock(); 735 pRuntime->BeginBlock();
735 CPDFDoc_Environment* pEnv = pRuntime->GetReaderApp(); 736 CPDFDoc_Environment* pEnv = pRuntime->GetReaderApp();
736 pEnv->JS_docmailForm(nullptr, 0, bUI, cTo.c_str(), cSubject.c_str(), 737 pEnv->JS_docmailForm(nullptr, 0, bUI, cTo.c_str(), cSubject.c_str(),
737 cCc.c_str(), cBcc.c_str(), cMsg.c_str()); 738 cCc.c_str(), cBcc.c_str(), cMsg.c_str());
738 pRuntime->EndBlock(); 739 pRuntime->EndBlock();
739 740
740 return TRUE; 741 return TRUE;
(...skipping 837 matching lines...) Expand 10 before | Expand all | Expand 10 after
1578 } 1579 }
1579 } 1580 }
1580 1581
1581 for (const auto& pData : DelayDataForFieldAndControlIndex) 1582 for (const auto& pData : DelayDataForFieldAndControlIndex)
1582 Field::DoDelay(m_pDocument, pData.get()); 1583 Field::DoDelay(m_pDocument, pData.get());
1583 } 1584 }
1584 1585
1585 CJS_Document* Document::GetCJSDoc() const { 1586 CJS_Document* Document::GetCJSDoc() const {
1586 return static_cast<CJS_Document*>(m_pJSObject); 1587 return static_cast<CJS_Document*>(m_pJSObject);
1587 } 1588 }
OLDNEW
« no previous file with comments | « no previous file | fpdfsdk/javascript/JS_Value.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698