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

Side by Side Diff: samples/pdfium_test.cc

Issue 1424743006: Make JS app.setTimeOut() work again. (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: rebase 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
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 9
10 #include <list> 10 #include <list>
(...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 388 matching lines...) Expand 10 before | Expand all | Expand 10 after
610 } 599 }
611 600
612 FPDF_DestroyLibrary(); 601 FPDF_DestroyLibrary();
613 #ifdef PDF_ENABLE_V8 602 #ifdef PDF_ENABLE_V8
614 v8::V8::ShutdownPlatform(); 603 v8::V8::ShutdownPlatform();
615 delete platform; 604 delete platform;
616 #endif // PDF_ENABLE_V8 605 #endif // PDF_ENABLE_V8
617 606
618 return 0; 607 return 0;
619 } 608 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698