OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <math.h> | 5 #include <math.h> |
6 #include <stdio.h> // FIXME(brettw) erase me. | 6 #include <stdio.h> // FIXME(brettw) erase me. |
7 #ifndef _WIN32 | 7 #ifndef _WIN32 |
8 #include <sys/time.h> | 8 #include <sys/time.h> |
9 #else | 9 #else |
10 #include <windows.h> | 10 #include <windows.h> |
11 #endif | 11 #endif |
12 #include <time.h> | 12 #include <time.h> |
13 | 13 |
14 #include <algorithm> | 14 #include <algorithm> |
15 | 15 |
16 #include "ppapi/c/dev/ppb_console_dev.h" | 16 #include "ppapi/c/dev/ppb_console_dev.h" |
17 #include "ppapi/c/dev/ppb_cursor_control_dev.h" | 17 #include "ppapi/c/dev/ppb_cursor_control_dev.h" |
18 #include "ppapi/c/dev/ppp_printing_dev.h" | 18 #include "ppapi/c/dev/ppp_printing_dev.h" |
19 #include "ppapi/c/pp_errors.h" | 19 #include "ppapi/c/pp_errors.h" |
20 #include "ppapi/c/pp_rect.h" | 20 #include "ppapi/c/pp_rect.h" |
21 #include "ppapi/cpp/completion_callback.h" | 21 #include "ppapi/cpp/completion_callback.h" |
| 22 #include "ppapi/cpp/dev/memory_dev.h" |
22 #include "ppapi/cpp/dev/scriptable_object_deprecated.h" | 23 #include "ppapi/cpp/dev/scriptable_object_deprecated.h" |
23 #include "ppapi/cpp/graphics_2d.h" | 24 #include "ppapi/cpp/graphics_2d.h" |
24 #include "ppapi/cpp/image_data.h" | 25 #include "ppapi/cpp/image_data.h" |
25 #include "ppapi/cpp/input_event.h" | 26 #include "ppapi/cpp/input_event.h" |
26 #include "ppapi/cpp/private/instance_private.h" | 27 #include "ppapi/cpp/private/instance_private.h" |
27 #include "ppapi/cpp/module.h" | 28 #include "ppapi/cpp/module.h" |
28 #include "ppapi/cpp/private/var_private.h" | 29 #include "ppapi/cpp/private/var_private.h" |
29 #include "ppapi/cpp/rect.h" | 30 #include "ppapi/cpp/rect.h" |
30 #include "ppapi/cpp/url_loader.h" | 31 #include "ppapi/cpp/url_loader.h" |
31 #include "ppapi/cpp/url_request_info.h" | 32 #include "ppapi/cpp/url_request_info.h" |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
320 char fps_text[64]; | 321 char fps_text[64]; |
321 sprintf(fps_text, "%g fps", | 322 sprintf(fps_text, "%g fps", |
322 kStepsPerCircle / (time_now - time_at_last_check_)); | 323 kStepsPerCircle / (time_now - time_at_last_check_)); |
323 fps.SetProperty("innerHTML", fps_text); | 324 fps.SetProperty("innerHTML", fps_text); |
324 } | 325 } |
325 | 326 |
326 time_at_last_check_ = time_now; | 327 time_at_last_check_ = time_now; |
327 } | 328 } |
328 | 329 |
329 // Print interfaces. | 330 // Print interfaces. |
| 331 // TODO(mball,dmichael) Replace this with the PPP_PRINTING_DEV_USE_0_4 version |
330 virtual PP_PrintOutputFormat_Dev* QuerySupportedPrintOutputFormats( | 332 virtual PP_PrintOutputFormat_Dev* QuerySupportedPrintOutputFormats( |
331 uint32_t* format_count) { | 333 uint32_t* format_count) { |
| 334 pp::Memory_Dev memory; |
332 PP_PrintOutputFormat_Dev* format = | 335 PP_PrintOutputFormat_Dev* format = |
333 reinterpret_cast<PP_PrintOutputFormat_Dev*>( | 336 static_cast<PP_PrintOutputFormat_Dev*>( |
334 pp::Module::Get()->core()->MemAlloc( | 337 memory.MemAlloc(sizeof(PP_PrintOutputFormat_Dev))); |
335 sizeof(PP_PrintOutputFormat_Dev))); | |
336 *format = PP_PRINTOUTPUTFORMAT_RASTER; | 338 *format = PP_PRINTOUTPUTFORMAT_RASTER; |
337 *format_count = 1; | 339 *format_count = 1; |
338 return format; | 340 return format; |
339 } | 341 } |
340 | 342 |
341 virtual int32_t PrintBegin(const PP_PrintSettings_Dev& print_settings) { | 343 virtual int32_t PrintBegin(const PP_PrintSettings_Dev& print_settings) { |
342 if (print_settings_.format != PP_PRINTOUTPUTFORMAT_RASTER) | 344 if (print_settings_.format != PP_PRINTOUTPUTFORMAT_RASTER) |
343 return 0; | 345 return 0; |
344 | 346 |
345 print_settings_ = print_settings; | 347 print_settings_ = print_settings; |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
484 }; | 486 }; |
485 | 487 |
486 namespace pp { | 488 namespace pp { |
487 | 489 |
488 // Factory function for your specialization of the Module object. | 490 // Factory function for your specialization of the Module object. |
489 Module* CreateModule() { | 491 Module* CreateModule() { |
490 return new MyModule(); | 492 return new MyModule(); |
491 } | 493 } |
492 | 494 |
493 } // namespace pp | 495 } // namespace pp |
OLD | NEW |