OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium 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 #include <limits.h> | 5 #include <limits.h> |
6 #include <stdio.h> | 6 #include <stdio.h> |
7 #include <stdlib.h> | 7 #include <stdlib.h> |
8 #include <string.h> | 8 #include <string.h> |
9 | 9 |
10 #include <list> | 10 #include <list> |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 if (nIcon || nType) | 204 if (nIcon || nType) |
205 printf("[icon=%d,type=%d]", nIcon, nType); | 205 printf("[icon=%d,type=%d]", nIcon, nType); |
206 printf(": %ls\n", GetPlatformWString(msg).c_str()); | 206 printf(": %ls\n", GetPlatformWString(msg).c_str()); |
207 return 0; | 207 return 0; |
208 } | 208 } |
209 | 209 |
210 void ExampleDocGotoPage(IPDF_JSPLATFORM*, int pageNumber) { | 210 void ExampleDocGotoPage(IPDF_JSPLATFORM*, int pageNumber) { |
211 printf("Goto Page: %d\n", pageNumber); | 211 printf("Goto Page: %d\n", pageNumber); |
212 } | 212 } |
213 | 213 |
| 214 void ExampleDocMail(IPDF_JSPLATFORM*, |
| 215 void* mailData, |
| 216 int length, |
| 217 FPDF_BOOL bUI, |
| 218 FPDF_WIDESTRING To, |
| 219 FPDF_WIDESTRING Subject, |
| 220 FPDF_WIDESTRING CC, |
| 221 FPDF_WIDESTRING BCC, |
| 222 FPDF_WIDESTRING Msg) { |
| 223 printf("Mail Msg: %d, to=%ls, cc=%ls, bcc=%ls, subject=%ls, body=%ls\n", bUI, |
| 224 GetPlatformWString(To).c_str(), GetPlatformWString(CC).c_str(), |
| 225 GetPlatformWString(BCC).c_str(), GetPlatformWString(Subject).c_str(), |
| 226 GetPlatformWString(Msg).c_str()); |
| 227 } |
| 228 |
214 void ExampleUnsupportedHandler(UNSUPPORT_INFO*, int type) { | 229 void ExampleUnsupportedHandler(UNSUPPORT_INFO*, int type) { |
215 std::string feature = "Unknown"; | 230 std::string feature = "Unknown"; |
216 switch (type) { | 231 switch (type) { |
217 case FPDF_UNSP_DOC_XFAFORM: | 232 case FPDF_UNSP_DOC_XFAFORM: |
218 feature = "XFA"; | 233 feature = "XFA"; |
219 break; | 234 break; |
220 case FPDF_UNSP_DOC_PORTABLECOLLECTION: | 235 case FPDF_UNSP_DOC_PORTABLECOLLECTION: |
221 feature = "Portfolios_Packages"; | 236 feature = "Portfolios_Packages"; |
222 break; | 237 break; |
223 case FPDF_UNSP_DOC_ATTACHMENT: | 238 case FPDF_UNSP_DOC_ATTACHMENT: |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
404 | 419 |
405 void RenderPdf(const std::string& name, const char* pBuf, size_t len, | 420 void RenderPdf(const std::string& name, const char* pBuf, size_t len, |
406 const Options& options) { | 421 const Options& options) { |
407 fprintf(stderr, "Rendering PDF file %s.\n", name.c_str()); | 422 fprintf(stderr, "Rendering PDF file %s.\n", name.c_str()); |
408 | 423 |
409 IPDF_JSPLATFORM platform_callbacks; | 424 IPDF_JSPLATFORM platform_callbacks; |
410 memset(&platform_callbacks, '\0', sizeof(platform_callbacks)); | 425 memset(&platform_callbacks, '\0', sizeof(platform_callbacks)); |
411 platform_callbacks.version = 3; | 426 platform_callbacks.version = 3; |
412 platform_callbacks.app_alert = ExampleAppAlert; | 427 platform_callbacks.app_alert = ExampleAppAlert; |
413 platform_callbacks.Doc_gotoPage = ExampleDocGotoPage; | 428 platform_callbacks.Doc_gotoPage = ExampleDocGotoPage; |
| 429 platform_callbacks.Doc_mail = ExampleDocMail; |
414 | 430 |
415 FPDF_FORMFILLINFO form_callbacks; | 431 FPDF_FORMFILLINFO form_callbacks; |
416 memset(&form_callbacks, '\0', sizeof(form_callbacks)); | 432 memset(&form_callbacks, '\0', sizeof(form_callbacks)); |
417 form_callbacks.version = 1; | 433 form_callbacks.version = 1; |
418 form_callbacks.m_pJsPlatform = &platform_callbacks; | 434 form_callbacks.m_pJsPlatform = &platform_callbacks; |
419 | 435 |
420 TestLoader loader(pBuf, len); | 436 TestLoader loader(pBuf, len); |
421 FPDF_FILEACCESS file_access; | 437 FPDF_FILEACCESS file_access; |
422 memset(&file_access, '\0', sizeof(file_access)); | 438 memset(&file_access, '\0', sizeof(file_access)); |
423 file_access.m_FileLen = static_cast<unsigned long>(len); | 439 file_access.m_FileLen = static_cast<unsigned long>(len); |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
630 } | 646 } |
631 | 647 |
632 FPDF_DestroyLibrary(); | 648 FPDF_DestroyLibrary(); |
633 #ifdef PDF_ENABLE_V8 | 649 #ifdef PDF_ENABLE_V8 |
634 v8::V8::ShutdownPlatform(); | 650 v8::V8::ShutdownPlatform(); |
635 delete platform; | 651 delete platform; |
636 #endif // PDF_ENABLE_V8 | 652 #endif // PDF_ENABLE_V8 |
637 | 653 |
638 return 0; | 654 return 0; |
639 } | 655 } |
OLD | NEW |