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

Side by Side Diff: samples/pdfium_test.cc

Issue 1416663008: Merge to XFA: Make JS app.setTimeOut() work again. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Created 5 years, 1 month 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/src/javascript/JS_Object.cpp ('k') | testing/embedder_test_timer_handling_delegate.h » ('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 (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 #include <wchar.h> 9 #include <wchar.h>
10 10
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 189
190 FPDF_RenderPage(dc, page, 0, 0, width, height, 0, 190 FPDF_RenderPage(dc, page, 0, 0, width, height, 0,
191 FPDF_ANNOT | FPDF_PRINTING | FPDF_NO_CATCH); 191 FPDF_ANNOT | FPDF_PRINTING | FPDF_NO_CATCH);
192 192
193 DeleteEnhMetaFile(CloseEnhMetaFile(dc)); 193 DeleteEnhMetaFile(CloseEnhMetaFile(dc));
194 } 194 }
195 #endif 195 #endif
196 196
197 int ExampleAppAlert(IPDF_JSPLATFORM*, FPDF_WIDESTRING msg, FPDF_WIDESTRING, 197 int ExampleAppAlert(IPDF_JSPLATFORM*, FPDF_WIDESTRING msg, FPDF_WIDESTRING,
198 int, int) { 198 int, int) {
199 // Deal with differences between UTF16LE and wchar_t on this platform. 199 std::wstring platform_string = GetWideString(msg);
200 size_t characters = 0; 200 printf("Alert: %ls\n", platform_string.c_str());
201 while (msg[characters]) {
202 ++characters;
203 }
204 wchar_t* platform_string =
205 static_cast<wchar_t*>(malloc((characters + 1) * sizeof(wchar_t)));
206 for (size_t i = 0; i < characters + 1; ++i) {
207 unsigned char* ptr = (unsigned char*)&msg[i];
208 platform_string[i] = ptr[0] + 256 * ptr[1];
209 }
210 printf("Alert: %ls\n", platform_string);
211 free(platform_string);
212 return 0; 201 return 0;
213 } 202 }
214 203
215 void ExampleDocGotoPage(IPDF_JSPLATFORM*, int pageNumber) { 204 void ExampleDocGotoPage(IPDF_JSPLATFORM*, int pageNumber) {
216 printf("Goto Page: %d\n", pageNumber); 205 printf("Goto Page: %d\n", pageNumber);
217 } 206 }
218 207
219 void ExampleUnsupportedHandler(UNSUPPORT_INFO*, int type) { 208 void ExampleUnsupportedHandler(UNSUPPORT_INFO*, int type) {
220 std::string feature = "Unknown"; 209 std::string feature = "Unknown";
221 switch (type) { 210 switch (type) {
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
587 } 576 }
588 577
589 FPDF_DestroyLibrary(); 578 FPDF_DestroyLibrary();
590 #ifdef PDF_ENABLE_V8 579 #ifdef PDF_ENABLE_V8
591 v8::V8::ShutdownPlatform(); 580 v8::V8::ShutdownPlatform();
592 delete platform; 581 delete platform;
593 #endif // PDF_ENABLE_V8 582 #endif // PDF_ENABLE_V8
594 583
595 return 0; 584 return 0;
596 } 585 }
OLDNEW
« no previous file with comments | « fpdfsdk/src/javascript/JS_Object.cpp ('k') | testing/embedder_test_timer_handling_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698