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

Side by Side Diff: fpdfsdk/src/fsdk_actionhandler.cpp

Issue 1386173002: Rename IFXJS_Runtime and IFXJS_Context to IJS_. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Comment in fxjs_v8.h Created 5 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 | « fpdfsdk/include/jsapi/fxjs_v8.h ('k') | fpdfsdk/src/fsdk_baseform.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 "../include/fsdk_define.h" 7 #include "../include/fsdk_define.h"
8 #include "../include/fsdk_mgr.h" 8 #include "../include/fsdk_mgr.h"
9 #include "../include/fsdk_actionhandler.h" 9 #include "../include/fsdk_actionhandler.h"
10 #include "../include/javascript/IJavaScript.h" 10 #include "../include/javascript/IJavaScript.h"
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 return FALSE; 141 return FALSE;
142 142
143 list.AddTail(pDict); 143 list.AddTail(pDict);
144 144
145 CPDFDoc_Environment* pEnv = pDocument->GetEnv(); 145 CPDFDoc_Environment* pEnv = pDocument->GetEnv();
146 ASSERT(pEnv); 146 ASSERT(pEnv);
147 if (action.GetType() == CPDF_Action::JavaScript) { 147 if (action.GetType() == CPDF_Action::JavaScript) {
148 if (pEnv->IsJSInitiated()) { 148 if (pEnv->IsJSInitiated()) {
149 CFX_WideString swJS = action.GetJavaScript(); 149 CFX_WideString swJS = action.GetJavaScript();
150 if (!swJS.IsEmpty()) { 150 if (!swJS.IsEmpty()) {
151 IFXJS_Runtime* pRuntime = pDocument->GetJsRuntime(); //???? 151 IJS_Runtime* pRuntime = pDocument->GetJsRuntime(); //????
152 ASSERT(pRuntime != NULL); 152 ASSERT(pRuntime != NULL);
153 153
154 pRuntime->SetReaderDocument(pDocument); 154 pRuntime->SetReaderDocument(pDocument);
155 155
156 IFXJS_Context* pContext = pRuntime->NewContext(); 156 IJS_Context* pContext = pRuntime->NewContext();
157 ASSERT(pContext != NULL); 157 ASSERT(pContext != NULL);
158 158
159 pContext->OnLink_MouseUp(pDocument); 159 pContext->OnLink_MouseUp(pDocument);
160 160
161 CFX_WideString csInfo; 161 CFX_WideString csInfo;
162 FX_BOOL bRet = pContext->RunScript(swJS, csInfo); 162 FX_BOOL bRet = pContext->RunScript(swJS, csInfo);
163 if (!bRet) { 163 if (!bRet) {
164 // FIXME: return error. 164 // FIXME: return error.
165 } 165 }
166 166
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 return FALSE; 284 return FALSE;
285 285
286 list.AddTail(pDict); 286 list.AddTail(pDict);
287 287
288 CPDFDoc_Environment* pEnv = pDocument->GetEnv(); 288 CPDFDoc_Environment* pEnv = pDocument->GetEnv();
289 ASSERT(pEnv); 289 ASSERT(pEnv);
290 if (action.GetType() == CPDF_Action::JavaScript) { 290 if (action.GetType() == CPDF_Action::JavaScript) {
291 if (pEnv->IsJSInitiated()) { 291 if (pEnv->IsJSInitiated()) {
292 CFX_WideString swJS = action.GetJavaScript(); 292 CFX_WideString swJS = action.GetJavaScript();
293 if (!swJS.IsEmpty()) { 293 if (!swJS.IsEmpty()) {
294 IFXJS_Runtime* pRuntime = pDocument->GetJsRuntime(); 294 IJS_Runtime* pRuntime = pDocument->GetJsRuntime();
295 ASSERT(pRuntime != NULL); 295 ASSERT(pRuntime != NULL);
296 296
297 pRuntime->SetReaderDocument(pDocument); 297 pRuntime->SetReaderDocument(pDocument);
298 298
299 IFXJS_Context* pContext = pRuntime->NewContext(); 299 IJS_Context* pContext = pRuntime->NewContext();
300 ASSERT(pContext != NULL); 300 ASSERT(pContext != NULL);
301 301
302 // switch (type) 302 // switch (type)
303 // { 303 // {
304 // case CPDF_AAction::CursorEnter: 304 // case CPDF_AAction::CursorEnter:
305 // pContext->OnScreen_MouseEnter(IsCTRLpres sed(), 305 // pContext->OnScreen_MouseEnter(IsCTRLpres sed(),
306 // IsSHIFTpressed(), pScreen); 306 // IsSHIFTpressed(), pScreen);
307 // break; 307 // break;
308 // case CPDF_AAction::CursorExit: 308 // case CPDF_AAction::CursorExit:
309 // pContext->OnScreen_MouseExit(IsCTRLpress ed(), 309 // pContext->OnScreen_MouseExit(IsCTRLpress ed(),
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 return FALSE; 380 return FALSE;
381 381
382 list.AddTail(pDict); 382 list.AddTail(pDict);
383 383
384 CPDFDoc_Environment* pEnv = pDocument->GetEnv(); 384 CPDFDoc_Environment* pEnv = pDocument->GetEnv();
385 ASSERT(pEnv); 385 ASSERT(pEnv);
386 if (action.GetType() == CPDF_Action::JavaScript) { 386 if (action.GetType() == CPDF_Action::JavaScript) {
387 if (pEnv->IsJSInitiated()) { 387 if (pEnv->IsJSInitiated()) {
388 CFX_WideString swJS = action.GetJavaScript(); 388 CFX_WideString swJS = action.GetJavaScript();
389 if (!swJS.IsEmpty()) { 389 if (!swJS.IsEmpty()) {
390 IFXJS_Runtime* pRuntime = pDocument->GetJsRuntime(); 390 IJS_Runtime* pRuntime = pDocument->GetJsRuntime();
391 ASSERT(pRuntime != NULL); 391 ASSERT(pRuntime != NULL);
392 392
393 pRuntime->SetReaderDocument(pDocument); 393 pRuntime->SetReaderDocument(pDocument);
394 394
395 IFXJS_Context* pContext = pRuntime->NewContext(); 395 IJS_Context* pContext = pRuntime->NewContext();
396 ASSERT(pContext != NULL); 396 ASSERT(pContext != NULL);
397 397
398 pContext->OnBookmark_MouseUp(pBookmark); 398 pContext->OnBookmark_MouseUp(pBookmark);
399 399
400 CFX_WideString csInfo; 400 CFX_WideString csInfo;
401 FX_BOOL bRet = pContext->RunScript(swJS, csInfo); 401 FX_BOOL bRet = pContext->RunScript(swJS, csInfo);
402 if (!bRet) { 402 if (!bRet) {
403 // CBCL_FormNotify::MsgBoxJSError(pPageView->GetPageViewWnd(), 403 // CBCL_FormNotify::MsgBoxJSError(pPageView->GetPageViewWnd(),
404 // csInfo); 404 // csInfo);
405 } 405 }
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
548 void CPDFSDK_ActionHandler::RunFieldJavaScript(CPDFSDK_Document* pDocument, 548 void CPDFSDK_ActionHandler::RunFieldJavaScript(CPDFSDK_Document* pDocument,
549 CPDF_FormField* pFormField, 549 CPDF_FormField* pFormField,
550 CPDF_AAction::AActionType type, 550 CPDF_AAction::AActionType type,
551 PDFSDK_FieldAction& data, 551 PDFSDK_FieldAction& data,
552 const CFX_WideString& script) { 552 const CFX_WideString& script) {
553 ASSERT(type != CPDF_AAction::Calculate); 553 ASSERT(type != CPDF_AAction::Calculate);
554 ASSERT(type != CPDF_AAction::Format); 554 ASSERT(type != CPDF_AAction::Format);
555 555
556 ASSERT(pDocument != NULL); 556 ASSERT(pDocument != NULL);
557 557
558 IFXJS_Runtime* pRuntime = pDocument->GetJsRuntime(); 558 IJS_Runtime* pRuntime = pDocument->GetJsRuntime();
559 ASSERT(pRuntime != NULL); 559 ASSERT(pRuntime != NULL);
560 560
561 pRuntime->SetReaderDocument(pDocument); 561 pRuntime->SetReaderDocument(pDocument);
562 562
563 IFXJS_Context* pContext = pRuntime->NewContext(); 563 IJS_Context* pContext = pRuntime->NewContext();
564 ASSERT(pContext != NULL); 564 ASSERT(pContext != NULL);
565 565
566 switch (type) { 566 switch (type) {
567 case CPDF_AAction::CursorEnter: 567 case CPDF_AAction::CursorEnter:
568 pContext->OnField_MouseEnter(data.bModifier, data.bShift, pFormField); 568 pContext->OnField_MouseEnter(data.bModifier, data.bShift, pFormField);
569 break; 569 break;
570 case CPDF_AAction::CursorExit: 570 case CPDF_AAction::CursorExit:
571 pContext->OnField_MouseExit(data.bModifier, data.bShift, pFormField); 571 pContext->OnField_MouseExit(data.bModifier, data.bShift, pFormField);
572 break; 572 break;
573 case CPDF_AAction::ButtonDown: 573 case CPDF_AAction::ButtonDown:
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
608 608
609 pRuntime->ReleaseContext(pContext); 609 pRuntime->ReleaseContext(pContext);
610 } 610 }
611 611
612 void CPDFSDK_ActionHandler::RunDocumentOpenJavaScript( 612 void CPDFSDK_ActionHandler::RunDocumentOpenJavaScript(
613 CPDFSDK_Document* pDocument, 613 CPDFSDK_Document* pDocument,
614 const CFX_WideString& sScriptName, 614 const CFX_WideString& sScriptName,
615 const CFX_WideString& script) { 615 const CFX_WideString& script) {
616 ASSERT(pDocument != NULL); 616 ASSERT(pDocument != NULL);
617 617
618 IFXJS_Runtime* pRuntime = pDocument->GetJsRuntime(); 618 IJS_Runtime* pRuntime = pDocument->GetJsRuntime();
619 ASSERT(pRuntime != NULL); 619 ASSERT(pRuntime != NULL);
620 620
621 pRuntime->SetReaderDocument(pDocument); 621 pRuntime->SetReaderDocument(pDocument);
622 622
623 IFXJS_Context* pContext = pRuntime->NewContext(); 623 IJS_Context* pContext = pRuntime->NewContext();
624 ASSERT(pContext != NULL); 624 ASSERT(pContext != NULL);
625 625
626 pContext->OnDoc_Open(pDocument, sScriptName); 626 pContext->OnDoc_Open(pDocument, sScriptName);
627 627
628 CFX_WideString csInfo; 628 CFX_WideString csInfo;
629 FX_BOOL bRet = pContext->RunScript(script, csInfo); 629 FX_BOOL bRet = pContext->RunScript(script, csInfo);
630 if (!bRet) { 630 if (!bRet) {
631 // CBCL_FormNotify::MsgBoxJSError(pPageView->GetPageViewWnd(), csInfo); 631 // CBCL_FormNotify::MsgBoxJSError(pPageView->GetPageViewWnd(), csInfo);
632 } 632 }
633 633
634 pRuntime->ReleaseContext(pContext); 634 pRuntime->ReleaseContext(pContext);
635 } 635 }
636 636
637 void CPDFSDK_ActionHandler::RunDocumentPageJavaScript( 637 void CPDFSDK_ActionHandler::RunDocumentPageJavaScript(
638 CPDFSDK_Document* pDocument, 638 CPDFSDK_Document* pDocument,
639 CPDF_AAction::AActionType type, 639 CPDF_AAction::AActionType type,
640 const CFX_WideString& script) { 640 const CFX_WideString& script) {
641 ASSERT(pDocument != NULL); 641 ASSERT(pDocument != NULL);
642 642
643 IFXJS_Runtime* pRuntime = pDocument->GetJsRuntime(); 643 IJS_Runtime* pRuntime = pDocument->GetJsRuntime();
644 ASSERT(pRuntime != NULL); 644 ASSERT(pRuntime != NULL);
645 645
646 pRuntime->SetReaderDocument(pDocument); 646 pRuntime->SetReaderDocument(pDocument);
647 647
648 IFXJS_Context* pContext = pRuntime->NewContext(); 648 IJS_Context* pContext = pRuntime->NewContext();
649 ASSERT(pContext != NULL); 649 ASSERT(pContext != NULL);
650 650
651 switch (type) { 651 switch (type) {
652 case CPDF_AAction::OpenPage: 652 case CPDF_AAction::OpenPage:
653 pContext->OnPage_Open(pDocument); 653 pContext->OnPage_Open(pDocument);
654 break; 654 break;
655 case CPDF_AAction::ClosePage: 655 case CPDF_AAction::ClosePage:
656 pContext->OnPage_Close(pDocument); 656 pContext->OnPage_Close(pDocument);
657 break; 657 break;
658 case CPDF_AAction::CloseDocument: 658 case CPDF_AAction::CloseDocument:
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
739 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->GetInterForm(); 739 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->GetInterForm();
740 ASSERT(pInterForm != NULL); 740 ASSERT(pInterForm != NULL);
741 741
742 if (pInterForm->DoAction_ImportData(action)) { 742 if (pInterForm->DoAction_ImportData(action)) {
743 pDocument->SetChangeMark(); 743 pDocument->SetChangeMark();
744 return TRUE; 744 return TRUE;
745 } 745 }
746 746
747 return FALSE; 747 return FALSE;
748 } 748 }
OLDNEW
« no previous file with comments | « fpdfsdk/include/jsapi/fxjs_v8.h ('k') | fpdfsdk/src/fsdk_baseform.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698