From 5d827f498b81d9c2c0cf97aaa08314327b3097f2 Mon Sep 17 00:00:00 2001 From: lochang Date: Mon, 12 Dec 2016 19:30:00 -0500 Subject: [PATCH] Bug 1313295 - Merge mortar into mozilla-central. r=peterv --HG-- extra : rebase_source : 196b777aae3f41d477c35001ba284a6c213ea8d6 --- browser/extensions/mortar/Makefile | 54 + .../mortar/host/common/opengles2-utils.jsm | 70 + .../mortar/host/common/ppapi-instance.js | 33 + .../mortar/host/common/ppapi-runtime.jsm | 5308 ++ .../extensions/mortar/host/flash/bootstrap.js | 74 + .../mortar/host/flash/chrome.manifest | 3 + .../mortar/host/flash/chrome/viewer.html | 35 + .../extensions/mortar/host/flash/install.rdf | 25 + .../host/flash/ppapi-content-sandbox.js | 226 + browser/extensions/mortar/host/interpose.cc | 335 + .../extensions/mortar/host/pdf/bootstrap.js | 69 + .../mortar/host/pdf/chrome.manifest | 3 + .../mortar/host/pdf/chrome/js/l20n.js | 2616 + .../mortar/host/pdf/chrome/js/polyfill.js | 239 + .../mortar/host/pdf/chrome/js/toolbar.js | 279 + .../mortar/host/pdf/chrome/js/viewer.js | 27 + .../mortar/host/pdf/chrome/js/viewport.js | 501 + .../pdf/chrome/locale/viewer.en-US.properties | 173 + .../chrome/style/images/annotation-check.svg | 11 + .../style/images/annotation-comment.svg | 16 + .../chrome/style/images/annotation-help.svg | 26 + .../chrome/style/images/annotation-insert.svg | 10 + .../chrome/style/images/annotation-key.svg | 11 + .../style/images/annotation-newparagraph.svg | 11 + .../chrome/style/images/annotation-noicon.svg | 7 + .../chrome/style/images/annotation-note.svg | 42 + .../style/images/annotation-paragraph.svg | 16 + .../style/images/findbarButton-next-rtl.png | Bin 0 -> 199 bytes .../images/findbarButton-next-rtl@2x.png | Bin 0 -> 304 bytes .../style/images/findbarButton-next.png | Bin 0 -> 193 bytes .../style/images/findbarButton-next@2x.png | Bin 0 -> 296 bytes .../images/findbarButton-previous-rtl.png | Bin 0 -> 193 bytes .../images/findbarButton-previous-rtl@2x.png | Bin 0 -> 296 bytes .../style/images/findbarButton-previous.png | Bin 0 -> 199 bytes .../images/findbarButton-previous@2x.png | Bin 0 -> 304 bytes .../host/pdf/chrome/style/images/grab.cur | Bin 0 -> 326 bytes .../host/pdf/chrome/style/images/grabbing.cur | Bin 0 -> 326 bytes .../pdf/chrome/style/images/loading-icon.gif | Bin 0 -> 2545 bytes .../pdf/chrome/style/images/loading-small.png | Bin 0 -> 7402 bytes .../chrome/style/images/loading-small@2x.png | Bin 0 -> 16131 bytes ...ondaryToolbarButton-documentProperties.png | Bin 0 -> 403 bytes ...aryToolbarButton-documentProperties@2x.png | Bin 0 -> 933 bytes .../secondaryToolbarButton-firstPage.png | Bin 0 -> 179 bytes .../secondaryToolbarButton-firstPage@2x.png | Bin 0 -> 266 bytes .../secondaryToolbarButton-handTool.png | Bin 0 -> 301 bytes .../secondaryToolbarButton-handTool@2x.png | Bin 0 -> 583 bytes .../secondaryToolbarButton-lastPage.png | Bin 0 -> 175 bytes .../secondaryToolbarButton-lastPage@2x.png | Bin 0 -> 276 bytes .../secondaryToolbarButton-rotateCcw.png | Bin 0 -> 360 bytes .../secondaryToolbarButton-rotateCcw@2x.png | Bin 0 -> 731 bytes .../secondaryToolbarButton-rotateCw.png | Bin 0 -> 359 bytes .../secondaryToolbarButton-rotateCw@2x.png | Bin 0 -> 714 bytes .../host/pdf/chrome/style/images/shadow.png | Bin 0 -> 290 bytes .../host/pdf/chrome/style/images/texture.png | Bin 0 -> 2417 bytes .../style/images/toolbarButton-bookmark.png | Bin 0 -> 174 bytes .../images/toolbarButton-bookmark@2x.png | Bin 0 -> 260 bytes .../style/images/toolbarButton-download.png | Bin 0 -> 259 bytes .../images/toolbarButton-download@2x.png | Bin 0 -> 425 bytes .../style/images/toolbarButton-menuArrows.png | Bin 0 -> 107 bytes .../images/toolbarButton-menuArrows@2x.png | Bin 0 -> 152 bytes .../style/images/toolbarButton-openFile.png | Bin 0 -> 295 bytes .../images/toolbarButton-openFile@2x.png | Bin 0 -> 550 bytes .../images/toolbarButton-pageDown-rtl.png | Bin 0 -> 242 bytes .../images/toolbarButton-pageDown-rtl@2x.png | Bin 0 -> 398 bytes .../style/images/toolbarButton-pageDown.png | Bin 0 -> 238 bytes .../images/toolbarButton-pageDown@2x.png | Bin 0 -> 396 bytes .../style/images/toolbarButton-pageUp-rtl.png | Bin 0 -> 245 bytes .../images/toolbarButton-pageUp-rtl@2x.png | Bin 0 -> 405 bytes .../style/images/toolbarButton-pageUp.png | Bin 0 -> 246 bytes .../style/images/toolbarButton-pageUp@2x.png | Bin 0 -> 403 bytes .../images/toolbarButton-presentationMode.png | Bin 0 -> 321 bytes .../toolbarButton-presentationMode@2x.png | Bin 0 -> 586 bytes .../style/images/toolbarButton-print.png | Bin 0 -> 257 bytes .../style/images/toolbarButton-print@2x.png | Bin 0 -> 464 bytes .../style/images/toolbarButton-search.png | Bin 0 -> 309 bytes .../style/images/toolbarButton-search@2x.png | Bin 0 -> 653 bytes ...olbarButton-secondaryToolbarToggle-rtl.png | Bin 0 -> 246 bytes ...arButton-secondaryToolbarToggle-rtl@2x.png | Bin 0 -> 456 bytes .../toolbarButton-secondaryToolbarToggle.png | Bin 0 -> 243 bytes ...oolbarButton-secondaryToolbarToggle@2x.png | Bin 0 -> 458 bytes .../toolbarButton-sidebarToggle-rtl.png | Bin 0 -> 225 bytes .../toolbarButton-sidebarToggle-rtl@2x.png | Bin 0 -> 344 bytes .../images/toolbarButton-sidebarToggle.png | Bin 0 -> 225 bytes .../images/toolbarButton-sidebarToggle@2x.png | Bin 0 -> 331 bytes .../images/toolbarButton-viewAttachments.png | Bin 0 -> 384 bytes .../toolbarButton-viewAttachments@2x.png | Bin 0 -> 859 bytes .../images/toolbarButton-viewOutline-rtl.png | Bin 0 -> 177 bytes .../toolbarButton-viewOutline-rtl@2x.png | Bin 0 -> 394 bytes .../images/toolbarButton-viewOutline.png | Bin 0 -> 178 bytes .../images/toolbarButton-viewOutline@2x.png | Bin 0 -> 331 bytes .../images/toolbarButton-viewThumbnail.png | Bin 0 -> 185 bytes .../images/toolbarButton-viewThumbnail@2x.png | Bin 0 -> 219 bytes .../style/images/toolbarButton-zoomIn.png | Bin 0 -> 136 bytes .../style/images/toolbarButton-zoomIn@2x.png | Bin 0 -> 160 bytes .../style/images/toolbarButton-zoomOut.png | Bin 0 -> 88 bytes .../style/images/toolbarButton-zoomOut@2x.png | Bin 0 -> 109 bytes .../style/images/treeitem-collapsed-rtl.png | Bin 0 -> 143 bytes .../images/treeitem-collapsed-rtl@2x.png | Bin 0 -> 167 bytes .../style/images/treeitem-collapsed.png | Bin 0 -> 128 bytes .../style/images/treeitem-collapsed@2x.png | Bin 0 -> 149 bytes .../chrome/style/images/treeitem-expanded.png | Bin 0 -> 125 bytes .../style/images/treeitem-expanded@2x.png | Bin 0 -> 172 bytes .../mortar/host/pdf/chrome/style/viewer.css | 1857 + .../mortar/host/pdf/chrome/viewer.html | 309 + .../extensions/mortar/host/pdf/install.rdf | 25 + .../mortar/host/pdf/ppapi-content-sandbox.js | 95 + browser/extensions/mortar/host/rpc.cc | 187 + browser/extensions/mortar/host/rpc.h | 606 + browser/extensions/mortar/json/json.cpp | 201 + browser/extensions/mortar/json/json.h | 67 + browser/extensions/mortar/json/test.cpp | 433 + browser/extensions/mortar/ppapi/LICENSE | 51 + .../ppapi/api/dev/pp_cursor_type_dev.idl | 56 + .../ppapi/api/dev/pp_print_settings_dev.idl | 45 + .../ppapi/api/dev/pp_video_capture_dev.idl | 47 + .../mortar/ppapi/api/dev/pp_video_dev.idl | 126 + .../ppapi/api/dev/ppb_audio_input_dev.idl | 198 + .../mortar/ppapi/api/dev/ppb_buffer_dev.idl | 51 + .../mortar/ppapi/api/dev/ppb_char_set_dev.idl | 106 + .../mortar/ppapi/api/dev/ppb_crypto_dev.idl | 20 + .../ppapi/api/dev/ppb_cursor_control_dev.idl | 65 + .../ppapi/api/dev/ppb_device_ref_dev.idl | 76 + .../ppapi/api/dev/ppb_file_chooser_dev.idl | 155 + .../mortar/ppapi/api/dev/ppb_font_dev.idl | 261 + .../ppapi/api/dev/ppb_ime_input_event_dev.idl | 143 + .../mortar/ppapi/api/dev/ppb_memory_dev.idl | 37 + .../ppapi/api/dev/ppb_opengles2ext_dev.idl | 27 + .../mortar/ppapi/api/dev/ppb_printing_dev.idl | 44 + .../ppapi/api/dev/ppb_text_input_dev.idl | 109 + .../ppapi/api/dev/ppb_trace_event_dev.idl | 84 + .../ppapi/api/dev/ppb_truetype_font_dev.idl | 270 + .../mortar/ppapi/api/dev/ppb_url_util_dev.idl | 162 + .../ppapi/api/dev/ppb_var_deprecated.idl | 234 + .../ppapi/api/dev/ppb_video_capture_dev.idl | 158 + .../ppapi/api/dev/ppb_video_decoder_dev.idl | 155 + .../mortar/ppapi/api/dev/ppb_view_dev.idl | 46 + .../ppapi/api/dev/ppp_class_deprecated.idl | 119 + .../ppapi/api/dev/ppp_network_state_dev.idl | 25 + .../mortar/ppapi/api/dev/ppp_printing_dev.idl | 60 + .../ppapi/api/dev/ppp_text_input_dev.idl | 27 + .../ppapi/api/dev/ppp_video_capture_dev.idl | 64 + .../ppapi/api/dev/ppp_video_decoder_dev.idl | 87 + .../mortar/ppapi/api/pp_array_output.idl | 93 + .../extensions/mortar/ppapi/api/pp_bool.idl | 44 + .../extensions/mortar/ppapi/api/pp_codecs.idl | 254 + .../ppapi/api/pp_completion_callback.idl | 262 + .../mortar/ppapi/api/pp_directory_entry.idl | 14 + .../extensions/mortar/ppapi/api/pp_errors.idl | 202 + .../mortar/ppapi/api/pp_file_info.idl | 76 + .../mortar/ppapi/api/pp_graphics_3d.idl | 83 + .../mortar/ppapi/api/pp_input_event.idl | 201 + .../mortar/ppapi/api/pp_instance.idl | 21 + .../extensions/mortar/ppapi/api/pp_macros.idl | 94 + .../extensions/mortar/ppapi/api/pp_module.idl | 20 + .../extensions/mortar/ppapi/api/pp_point.idl | 74 + .../extensions/mortar/ppapi/api/pp_rect.idl | 99 + .../mortar/ppapi/api/pp_resource.idl | 27 + .../extensions/mortar/ppapi/api/pp_size.idl | 72 + .../extensions/mortar/ppapi/api/pp_stdint.idl | 100 + .../extensions/mortar/ppapi/api/pp_time.idl | 37 + .../mortar/ppapi/api/pp_touch_point.idl | 74 + .../extensions/mortar/ppapi/api/pp_var.idl | 254 + browser/extensions/mortar/ppapi/api/ppb.idl | 29 + .../extensions/mortar/ppapi/api/ppb_audio.idl | 153 + .../mortar/ppapi/api/ppb_audio_buffer.idl | 140 + .../mortar/ppapi/api/ppb_audio_config.idl | 216 + .../mortar/ppapi/api/ppb_audio_encoder.idl | 209 + .../mortar/ppapi/api/ppb_compositor.idl | 131 + .../mortar/ppapi/api/ppb_compositor_layer.idl | 251 + .../mortar/ppapi/api/ppb_console.idl | 51 + .../extensions/mortar/ppapi/api/ppb_core.idl | 101 + .../mortar/ppapi/api/ppb_file_io.idl | 293 + .../mortar/ppapi/api/ppb_file_ref.idl | 247 + .../mortar/ppapi/api/ppb_file_system.idl | 82 + .../mortar/ppapi/api/ppb_fullscreen.idl | 78 + .../mortar/ppapi/api/ppb_gamepad.idl | 97 + .../mortar/ppapi/api/ppb_graphics_2d.idl | 308 + .../mortar/ppapi/api/ppb_graphics_3d.idl | 298 + .../mortar/ppapi/api/ppb_host_resolver.idl | 141 + .../mortar/ppapi/api/ppb_image_data.idl | 188 + .../mortar/ppapi/api/ppb_input_event.idl | 1085 + .../mortar/ppapi/api/ppb_instance.idl | 69 + .../api/ppb_media_stream_audio_track.idl | 201 + .../api/ppb_media_stream_video_track.idl | 247 + .../mortar/ppapi/api/ppb_message_loop.idl | 271 + .../mortar/ppapi/api/ppb_messaging.idl | 146 + .../mortar/ppapi/api/ppb_mouse_cursor.idl | 108 + .../mortar/ppapi/api/ppb_mouse_lock.idl | 62 + .../mortar/ppapi/api/ppb_net_address.idl | 169 + .../mortar/ppapi/api/ppb_network_list.idl | 172 + .../mortar/ppapi/api/ppb_network_monitor.idl | 69 + .../mortar/ppapi/api/ppb_network_proxy.idl | 53 + .../mortar/ppapi/api/ppb_opengles2.idl | 741 + .../mortar/ppapi/api/ppb_tcp_socket.idl | 291 + .../ppapi/api/ppb_text_input_controller.idl | 95 + .../mortar/ppapi/api/ppb_udp_socket.idl | 303 + .../mortar/ppapi/api/ppb_url_loader.idl | 225 + .../mortar/ppapi/api/ppb_url_request_info.idl | 260 + .../ppapi/api/ppb_url_response_info.idl | 132 + .../extensions/mortar/ppapi/api/ppb_var.idl | 147 + .../mortar/ppapi/api/ppb_var_array.idl | 77 + .../mortar/ppapi/api/ppb_var_array_buffer.idl | 101 + .../mortar/ppapi/api/ppb_var_dictionary.idl | 90 + .../mortar/ppapi/api/ppb_video_decoder.idl | 312 + .../mortar/ppapi/api/ppb_video_encoder.idl | 249 + .../mortar/ppapi/api/ppb_video_frame.idl | 123 + .../extensions/mortar/ppapi/api/ppb_view.idl | 215 + .../mortar/ppapi/api/ppb_vpn_provider.idl | 159 + .../mortar/ppapi/api/ppb_websocket.idl | 460 + browser/extensions/mortar/ppapi/api/ppp.idl | 139 + .../mortar/ppapi/api/ppp_graphics_3d.idl | 25 + .../mortar/ppapi/api/ppp_input_event.idl | 63 + .../mortar/ppapi/api/ppp_instance.idl | 242 + .../mortar/ppapi/api/ppp_message_handler.idl | 77 + .../mortar/ppapi/api/ppp_messaging.idl | 64 + .../mortar/ppapi/api/ppp_mouse_lock.idl | 30 + .../finish_writing_these/ppb_flash_file.idl | 81 + .../private/finish_writing_these/ppb_pdf.idl | 165 + .../ppb_proxy_private.idl | 17 + .../api/private/pp_content_decryptor.idl | 487 + .../ppapi/api/private/pp_file_handle.idl | 22 + .../api/private/pp_private_font_charset.idl | 27 + .../api/private/pp_video_capture_format.idl | 29 + .../api/private/pp_video_frame_private.idl | 36 + .../ppb_camera_capabilities_private.idl | 55 + .../api/private/ppb_camera_device_private.idl | 96 + .../private/ppb_content_decryptor_private.idl | 315 + .../ppb_display_color_profile_private.idl | 97 + .../ppb_ext_crx_file_system_private.idl | 31 + .../ppapi/api/private/ppb_file_io_private.idl | 26 + .../api/private/ppb_file_ref_private.idl | 24 + .../ppapi/api/private/ppb_find_private.idl | 66 + .../mortar/ppapi/api/private/ppb_flash.idl | 274 + .../ppapi/api/private/ppb_flash_clipboard.idl | 157 + .../ppapi/api/private/ppb_flash_device_id.idl | 29 + .../ppapi/api/private/ppb_flash_drm.idl | 65 + .../ppapi/api/private/ppb_flash_file.idl | 126 + .../ppapi/api/private/ppb_flash_font_file.idl | 50 + .../api/private/ppb_flash_fullscreen.idl | 56 + .../ppapi/api/private/ppb_flash_menu.idl | 54 + .../api/private/ppb_flash_message_loop.idl | 73 + .../ppapi/api/private/ppb_flash_print.idl | 23 + .../api/private/ppb_host_resolver_private.idl | 79 + .../api/private/ppb_instance_private.idl | 80 + .../ppb_isolated_file_system_private.idl | 54 + .../api/private/ppb_net_address_private.idl | 129 + .../private/ppb_output_protection_private.idl | 141 + .../mortar/ppapi/api/private/ppb_pdf.idl | 182 + .../ppb_platform_verification_private.idl | 85 + .../private/ppb_tcp_server_socket_private.idl | 71 + .../api/private/ppb_tcp_socket_private.idl | 162 + .../ppapi/api/private/ppb_testing_private.idl | 153 + .../api/private/ppb_udp_socket_private.idl | 98 + .../ppapi/api/private/ppb_uma_private.idl | 67 + .../private/ppb_video_destination_private.idl | 95 + .../api/private/ppb_video_source_private.idl | 93 + .../private/ppb_x509_certificate_private.idl | 173 + .../private/ppp_content_decryptor_private.idl | 304 + .../ppapi/api/private/ppp_find_private.idl | 35 + .../private/ppp_flash_browser_operations.idl | 168 + .../api/private/ppp_instance_private.idl | 37 + .../api/private/ppp_pexe_stream_handler.idl | 46 + .../ppapi/api/trusted/ppb_broker_trusted.idl | 77 + .../api/trusted/ppb_browser_font_trusted.idl | 261 + .../api/trusted/ppb_char_set_trusted.idl | 95 + .../api/trusted/ppb_file_chooser_trusted.idl | 71 + .../api/trusted/ppb_url_loader_trusted.idl | 51 + .../mortar/ppapi/api/trusted/ppp_broker.idl | 94 + .../mortar/ppapi/c/pp_graphics_3d.h | 3 + .../extensions/mortar/ppapi/c/pp_instance.h | 3 + browser/extensions/mortar/ppapi/c/pp_module.h | 2 + .../extensions/mortar/ppapi/c/pp_resource.h | 3 + browser/extensions/mortar/ppapi/c/pp_stdint.h | 3 + browser/extensions/mortar/ppapi/c/ppb.h | 2 + .../extensions/mortar/ppapi/c/ppb_opengles2.h | 3 + .../mortar/ppapi/c/private/pp_file_handle.h | 4 + .../extensions/mortar/ppapi/generators/OWNERS | 5 + .../mortar/ppapi/generators/generator.py | 57 + .../mortar/ppapi/generators/idl_ast.py | 182 + .../mortar/ppapi/generators/idl_c_header.py | 374 + .../mortar/ppapi/generators/idl_c_proto.py | 822 + .../mortar/ppapi/generators/idl_diff.py | 354 + .../mortar/ppapi/generators/idl_gen_pnacl.py | 284 + .../mortar/ppapi/generators/idl_gen_rpc.py | 669 + .../ppapi/generators/idl_gen_wrapper.py | 438 + .../mortar/ppapi/generators/idl_generator.py | 277 + .../mortar/ppapi/generators/idl_lexer.py | 352 + .../mortar/ppapi/generators/idl_lint.py | 122 + .../mortar/ppapi/generators/idl_log.py | 54 + .../mortar/ppapi/generators/idl_namespace.py | 249 + .../mortar/ppapi/generators/idl_node.py | 447 + .../mortar/ppapi/generators/idl_option.py | 108 + .../mortar/ppapi/generators/idl_outfile.py | 205 + .../mortar/ppapi/generators/idl_parser.py | 1296 + .../ppapi/generators/idl_propertynode.py | 114 + .../mortar/ppapi/generators/idl_release.py | 356 + .../mortar/ppapi/generators/idl_tests.py | 45 + .../mortar/ppapi/generators/idl_thunk.py | 581 + .../mortar/ppapi/generators/idl_visitor.py | 45 + .../ppapi/generators/test_cgen/enum_typedef.h | 69 + .../generators/test_cgen/enum_typedef.idl | 37 + .../ppapi/generators/test_cgen/interface.h | 91 + .../ppapi/generators/test_cgen/interface.idl | 52 + .../ppapi/generators/test_cgen/stdint.h | 21 + .../ppapi/generators/test_cgen/stdint.idl | 54 + .../ppapi/generators/test_cgen/structs.h | 94 + .../ppapi/generators/test_cgen/structs.idl | 50 + .../test_cgen_range/dev_channel_interface.h | 101 + .../test_cgen_range/dev_channel_interface.idl | 67 + .../generators/test_cgen_range/versions.h | 50 + .../generators/test_cgen_range/versions.idl | 32 + .../test_gen_pnacl/test_interfaces.idl | 161 + .../ppapi/generators/test_namespace/bar.idl | 33 + .../ppapi/generators/test_namespace/foo.idl | 26 + .../generators/test_parser/dictionary.idl | 17 + .../ppapi/generators/test_parser/enum.idl | 108 + .../generators/test_parser/interface.idl | 59 + .../ppapi/generators/test_parser/struct.idl | 34 + .../ppapi/generators/test_parser/typedef.idl | 46 + .../test_thunk/basic_test_types.idl | 58 + .../ppapi/generators/test_thunk/simple.idl | 39 + .../generators/test_thunk/simple_thunk.cc | 125 + .../generators/test_version/versions.idl | 66 + browser/extensions/mortar/ppapi/out/rpc.cc | 61332 ++++++++++++++++ 324 files changed, 105157 insertions(+) create mode 100644 browser/extensions/mortar/Makefile create mode 100644 browser/extensions/mortar/host/common/opengles2-utils.jsm create mode 100644 browser/extensions/mortar/host/common/ppapi-instance.js create mode 100644 browser/extensions/mortar/host/common/ppapi-runtime.jsm create mode 100644 browser/extensions/mortar/host/flash/bootstrap.js create mode 100644 browser/extensions/mortar/host/flash/chrome.manifest create mode 100644 browser/extensions/mortar/host/flash/chrome/viewer.html create mode 100644 browser/extensions/mortar/host/flash/install.rdf create mode 100644 browser/extensions/mortar/host/flash/ppapi-content-sandbox.js create mode 100644 browser/extensions/mortar/host/interpose.cc create mode 100644 browser/extensions/mortar/host/pdf/bootstrap.js create mode 100644 browser/extensions/mortar/host/pdf/chrome.manifest create mode 100644 browser/extensions/mortar/host/pdf/chrome/js/l20n.js create mode 100644 browser/extensions/mortar/host/pdf/chrome/js/polyfill.js create mode 100644 browser/extensions/mortar/host/pdf/chrome/js/toolbar.js create mode 100644 browser/extensions/mortar/host/pdf/chrome/js/viewer.js create mode 100644 browser/extensions/mortar/host/pdf/chrome/js/viewport.js create mode 100644 browser/extensions/mortar/host/pdf/chrome/locale/viewer.en-US.properties create mode 100644 browser/extensions/mortar/host/pdf/chrome/style/images/annotation-check.svg create mode 100644 browser/extensions/mortar/host/pdf/chrome/style/images/annotation-comment.svg create mode 100644 browser/extensions/mortar/host/pdf/chrome/style/images/annotation-help.svg create mode 100644 browser/extensions/mortar/host/pdf/chrome/style/images/annotation-insert.svg create mode 100644 browser/extensions/mortar/host/pdf/chrome/style/images/annotation-key.svg create mode 100644 browser/extensions/mortar/host/pdf/chrome/style/images/annotation-newparagraph.svg create mode 100644 browser/extensions/mortar/host/pdf/chrome/style/images/annotation-noicon.svg create mode 100644 browser/extensions/mortar/host/pdf/chrome/style/images/annotation-note.svg create mode 100644 browser/extensions/mortar/host/pdf/chrome/style/images/annotation-paragraph.svg create mode 100644 browser/extensions/mortar/host/pdf/chrome/style/images/findbarButton-next-rtl.png create mode 100644 browser/extensions/mortar/host/pdf/chrome/style/images/findbarButton-next-rtl@2x.png create mode 100644 browser/extensions/mortar/host/pdf/chrome/style/images/findbarButton-next.png create mode 100644 browser/extensions/mortar/host/pdf/chrome/style/images/findbarButton-next@2x.png create mode 100644 browser/extensions/mortar/host/pdf/chrome/style/images/findbarButton-previous-rtl.png create mode 100644 browser/extensions/mortar/host/pdf/chrome/style/images/findbarButton-previous-rtl@2x.png create mode 100644 browser/extensions/mortar/host/pdf/chrome/style/images/findbarButton-previous.png create mode 100644 browser/extensions/mortar/host/pdf/chrome/style/images/findbarButton-previous@2x.png create mode 100644 browser/extensions/mortar/host/pdf/chrome/style/images/grab.cur create mode 100644 browser/extensions/mortar/host/pdf/chrome/style/images/grabbing.cur create mode 100644 browser/extensions/mortar/host/pdf/chrome/style/images/loading-icon.gif create mode 100644 browser/extensions/mortar/host/pdf/chrome/style/images/loading-small.png create mode 100644 browser/extensions/mortar/host/pdf/chrome/style/images/loading-small@2x.png create mode 100644 browser/extensions/mortar/host/pdf/chrome/style/images/secondaryToolbarButton-documentProperties.png create mode 100644 browser/extensions/mortar/host/pdf/chrome/style/images/secondaryToolbarButton-documentProperties@2x.png create mode 100644 browser/extensions/mortar/host/pdf/chrome/style/images/secondaryToolbarButton-firstPage.png create mode 100644 browser/extensions/mortar/host/pdf/chrome/style/images/secondaryToolbarButton-firstPage@2x.png create mode 100644 browser/extensions/mortar/host/pdf/chrome/style/images/secondaryToolbarButton-handTool.png create mode 100644 browser/extensions/mortar/host/pdf/chrome/style/images/secondaryToolbarButton-handTool@2x.png create mode 100644 browser/extensions/mortar/host/pdf/chrome/style/images/secondaryToolbarButton-lastPage.png create mode 100644 browser/extensions/mortar/host/pdf/chrome/style/images/secondaryToolbarButton-lastPage@2x.png create mode 100644 browser/extensions/mortar/host/pdf/chrome/style/images/secondaryToolbarButton-rotateCcw.png create mode 100644 browser/extensions/mortar/host/pdf/chrome/style/images/secondaryToolbarButton-rotateCcw@2x.png create mode 100644 browser/extensions/mortar/host/pdf/chrome/style/images/secondaryToolbarButton-rotateCw.png create mode 100644 browser/extensions/mortar/host/pdf/chrome/style/images/secondaryToolbarButton-rotateCw@2x.png create mode 100644 browser/extensions/mortar/host/pdf/chrome/style/images/shadow.png create mode 100644 browser/extensions/mortar/host/pdf/chrome/style/images/texture.png create mode 100644 browser/extensions/mortar/host/pdf/chrome/style/images/toolbarButton-bookmark.png create mode 100644 browser/extensions/mortar/host/pdf/chrome/style/images/toolbarButton-bookmark@2x.png create mode 100644 browser/extensions/mortar/host/pdf/chrome/style/images/toolbarButton-download.png create mode 100644 browser/extensions/mortar/host/pdf/chrome/style/images/toolbarButton-download@2x.png create mode 100644 browser/extensions/mortar/host/pdf/chrome/style/images/toolbarButton-menuArrows.png create mode 100644 browser/extensions/mortar/host/pdf/chrome/style/images/toolbarButton-menuArrows@2x.png create mode 100644 browser/extensions/mortar/host/pdf/chrome/style/images/toolbarButton-openFile.png create mode 100644 browser/extensions/mortar/host/pdf/chrome/style/images/toolbarButton-openFile@2x.png create mode 100644 browser/extensions/mortar/host/pdf/chrome/style/images/toolbarButton-pageDown-rtl.png create mode 100644 browser/extensions/mortar/host/pdf/chrome/style/images/toolbarButton-pageDown-rtl@2x.png create mode 100644 browser/extensions/mortar/host/pdf/chrome/style/images/toolbarButton-pageDown.png create mode 100644 browser/extensions/mortar/host/pdf/chrome/style/images/toolbarButton-pageDown@2x.png create mode 100644 browser/extensions/mortar/host/pdf/chrome/style/images/toolbarButton-pageUp-rtl.png create mode 100644 browser/extensions/mortar/host/pdf/chrome/style/images/toolbarButton-pageUp-rtl@2x.png create mode 100644 browser/extensions/mortar/host/pdf/chrome/style/images/toolbarButton-pageUp.png create mode 100644 browser/extensions/mortar/host/pdf/chrome/style/images/toolbarButton-pageUp@2x.png create mode 100644 browser/extensions/mortar/host/pdf/chrome/style/images/toolbarButton-presentationMode.png create mode 100644 browser/extensions/mortar/host/pdf/chrome/style/images/toolbarButton-presentationMode@2x.png create mode 100644 browser/extensions/mortar/host/pdf/chrome/style/images/toolbarButton-print.png create mode 100644 browser/extensions/mortar/host/pdf/chrome/style/images/toolbarButton-print@2x.png create mode 100644 browser/extensions/mortar/host/pdf/chrome/style/images/toolbarButton-search.png create mode 100644 browser/extensions/mortar/host/pdf/chrome/style/images/toolbarButton-search@2x.png create mode 100644 browser/extensions/mortar/host/pdf/chrome/style/images/toolbarButton-secondaryToolbarToggle-rtl.png create mode 100644 browser/extensions/mortar/host/pdf/chrome/style/images/toolbarButton-secondaryToolbarToggle-rtl@2x.png create mode 100644 browser/extensions/mortar/host/pdf/chrome/style/images/toolbarButton-secondaryToolbarToggle.png create mode 100644 browser/extensions/mortar/host/pdf/chrome/style/images/toolbarButton-secondaryToolbarToggle@2x.png create mode 100644 browser/extensions/mortar/host/pdf/chrome/style/images/toolbarButton-sidebarToggle-rtl.png create mode 100644 browser/extensions/mortar/host/pdf/chrome/style/images/toolbarButton-sidebarToggle-rtl@2x.png create mode 100644 browser/extensions/mortar/host/pdf/chrome/style/images/toolbarButton-sidebarToggle.png create mode 100644 browser/extensions/mortar/host/pdf/chrome/style/images/toolbarButton-sidebarToggle@2x.png create mode 100644 browser/extensions/mortar/host/pdf/chrome/style/images/toolbarButton-viewAttachments.png create mode 100644 browser/extensions/mortar/host/pdf/chrome/style/images/toolbarButton-viewAttachments@2x.png create mode 100644 browser/extensions/mortar/host/pdf/chrome/style/images/toolbarButton-viewOutline-rtl.png create mode 100644 browser/extensions/mortar/host/pdf/chrome/style/images/toolbarButton-viewOutline-rtl@2x.png create mode 100644 browser/extensions/mortar/host/pdf/chrome/style/images/toolbarButton-viewOutline.png create mode 100644 browser/extensions/mortar/host/pdf/chrome/style/images/toolbarButton-viewOutline@2x.png create mode 100644 browser/extensions/mortar/host/pdf/chrome/style/images/toolbarButton-viewThumbnail.png create mode 100644 browser/extensions/mortar/host/pdf/chrome/style/images/toolbarButton-viewThumbnail@2x.png create mode 100644 browser/extensions/mortar/host/pdf/chrome/style/images/toolbarButton-zoomIn.png create mode 100644 browser/extensions/mortar/host/pdf/chrome/style/images/toolbarButton-zoomIn@2x.png create mode 100644 browser/extensions/mortar/host/pdf/chrome/style/images/toolbarButton-zoomOut.png create mode 100644 browser/extensions/mortar/host/pdf/chrome/style/images/toolbarButton-zoomOut@2x.png create mode 100644 browser/extensions/mortar/host/pdf/chrome/style/images/treeitem-collapsed-rtl.png create mode 100644 browser/extensions/mortar/host/pdf/chrome/style/images/treeitem-collapsed-rtl@2x.png create mode 100644 browser/extensions/mortar/host/pdf/chrome/style/images/treeitem-collapsed.png create mode 100644 browser/extensions/mortar/host/pdf/chrome/style/images/treeitem-collapsed@2x.png create mode 100644 browser/extensions/mortar/host/pdf/chrome/style/images/treeitem-expanded.png create mode 100644 browser/extensions/mortar/host/pdf/chrome/style/images/treeitem-expanded@2x.png create mode 100644 browser/extensions/mortar/host/pdf/chrome/style/viewer.css create mode 100644 browser/extensions/mortar/host/pdf/chrome/viewer.html create mode 100644 browser/extensions/mortar/host/pdf/install.rdf create mode 100644 browser/extensions/mortar/host/pdf/ppapi-content-sandbox.js create mode 100644 browser/extensions/mortar/host/rpc.cc create mode 100644 browser/extensions/mortar/host/rpc.h create mode 100644 browser/extensions/mortar/json/json.cpp create mode 100644 browser/extensions/mortar/json/json.h create mode 100644 browser/extensions/mortar/json/test.cpp create mode 100644 browser/extensions/mortar/ppapi/LICENSE create mode 100644 browser/extensions/mortar/ppapi/api/dev/pp_cursor_type_dev.idl create mode 100644 browser/extensions/mortar/ppapi/api/dev/pp_print_settings_dev.idl create mode 100644 browser/extensions/mortar/ppapi/api/dev/pp_video_capture_dev.idl create mode 100644 browser/extensions/mortar/ppapi/api/dev/pp_video_dev.idl create mode 100644 browser/extensions/mortar/ppapi/api/dev/ppb_audio_input_dev.idl create mode 100644 browser/extensions/mortar/ppapi/api/dev/ppb_buffer_dev.idl create mode 100644 browser/extensions/mortar/ppapi/api/dev/ppb_char_set_dev.idl create mode 100644 browser/extensions/mortar/ppapi/api/dev/ppb_crypto_dev.idl create mode 100644 browser/extensions/mortar/ppapi/api/dev/ppb_cursor_control_dev.idl create mode 100644 browser/extensions/mortar/ppapi/api/dev/ppb_device_ref_dev.idl create mode 100644 browser/extensions/mortar/ppapi/api/dev/ppb_file_chooser_dev.idl create mode 100644 browser/extensions/mortar/ppapi/api/dev/ppb_font_dev.idl create mode 100644 browser/extensions/mortar/ppapi/api/dev/ppb_ime_input_event_dev.idl create mode 100644 browser/extensions/mortar/ppapi/api/dev/ppb_memory_dev.idl create mode 100644 browser/extensions/mortar/ppapi/api/dev/ppb_opengles2ext_dev.idl create mode 100644 browser/extensions/mortar/ppapi/api/dev/ppb_printing_dev.idl create mode 100644 browser/extensions/mortar/ppapi/api/dev/ppb_text_input_dev.idl create mode 100644 browser/extensions/mortar/ppapi/api/dev/ppb_trace_event_dev.idl create mode 100644 browser/extensions/mortar/ppapi/api/dev/ppb_truetype_font_dev.idl create mode 100644 browser/extensions/mortar/ppapi/api/dev/ppb_url_util_dev.idl create mode 100644 browser/extensions/mortar/ppapi/api/dev/ppb_var_deprecated.idl create mode 100644 browser/extensions/mortar/ppapi/api/dev/ppb_video_capture_dev.idl create mode 100644 browser/extensions/mortar/ppapi/api/dev/ppb_video_decoder_dev.idl create mode 100644 browser/extensions/mortar/ppapi/api/dev/ppb_view_dev.idl create mode 100644 browser/extensions/mortar/ppapi/api/dev/ppp_class_deprecated.idl create mode 100644 browser/extensions/mortar/ppapi/api/dev/ppp_network_state_dev.idl create mode 100644 browser/extensions/mortar/ppapi/api/dev/ppp_printing_dev.idl create mode 100644 browser/extensions/mortar/ppapi/api/dev/ppp_text_input_dev.idl create mode 100644 browser/extensions/mortar/ppapi/api/dev/ppp_video_capture_dev.idl create mode 100644 browser/extensions/mortar/ppapi/api/dev/ppp_video_decoder_dev.idl create mode 100644 browser/extensions/mortar/ppapi/api/pp_array_output.idl create mode 100644 browser/extensions/mortar/ppapi/api/pp_bool.idl create mode 100644 browser/extensions/mortar/ppapi/api/pp_codecs.idl create mode 100644 browser/extensions/mortar/ppapi/api/pp_completion_callback.idl create mode 100644 browser/extensions/mortar/ppapi/api/pp_directory_entry.idl create mode 100644 browser/extensions/mortar/ppapi/api/pp_errors.idl create mode 100644 browser/extensions/mortar/ppapi/api/pp_file_info.idl create mode 100644 browser/extensions/mortar/ppapi/api/pp_graphics_3d.idl create mode 100644 browser/extensions/mortar/ppapi/api/pp_input_event.idl create mode 100644 browser/extensions/mortar/ppapi/api/pp_instance.idl create mode 100644 browser/extensions/mortar/ppapi/api/pp_macros.idl create mode 100644 browser/extensions/mortar/ppapi/api/pp_module.idl create mode 100644 browser/extensions/mortar/ppapi/api/pp_point.idl create mode 100644 browser/extensions/mortar/ppapi/api/pp_rect.idl create mode 100644 browser/extensions/mortar/ppapi/api/pp_resource.idl create mode 100644 browser/extensions/mortar/ppapi/api/pp_size.idl create mode 100644 browser/extensions/mortar/ppapi/api/pp_stdint.idl create mode 100644 browser/extensions/mortar/ppapi/api/pp_time.idl create mode 100644 browser/extensions/mortar/ppapi/api/pp_touch_point.idl create mode 100644 browser/extensions/mortar/ppapi/api/pp_var.idl create mode 100644 browser/extensions/mortar/ppapi/api/ppb.idl create mode 100644 browser/extensions/mortar/ppapi/api/ppb_audio.idl create mode 100644 browser/extensions/mortar/ppapi/api/ppb_audio_buffer.idl create mode 100644 browser/extensions/mortar/ppapi/api/ppb_audio_config.idl create mode 100644 browser/extensions/mortar/ppapi/api/ppb_audio_encoder.idl create mode 100644 browser/extensions/mortar/ppapi/api/ppb_compositor.idl create mode 100644 browser/extensions/mortar/ppapi/api/ppb_compositor_layer.idl create mode 100644 browser/extensions/mortar/ppapi/api/ppb_console.idl create mode 100644 browser/extensions/mortar/ppapi/api/ppb_core.idl create mode 100644 browser/extensions/mortar/ppapi/api/ppb_file_io.idl create mode 100644 browser/extensions/mortar/ppapi/api/ppb_file_ref.idl create mode 100644 browser/extensions/mortar/ppapi/api/ppb_file_system.idl create mode 100644 browser/extensions/mortar/ppapi/api/ppb_fullscreen.idl create mode 100644 browser/extensions/mortar/ppapi/api/ppb_gamepad.idl create mode 100644 browser/extensions/mortar/ppapi/api/ppb_graphics_2d.idl create mode 100644 browser/extensions/mortar/ppapi/api/ppb_graphics_3d.idl create mode 100644 browser/extensions/mortar/ppapi/api/ppb_host_resolver.idl create mode 100644 browser/extensions/mortar/ppapi/api/ppb_image_data.idl create mode 100644 browser/extensions/mortar/ppapi/api/ppb_input_event.idl create mode 100644 browser/extensions/mortar/ppapi/api/ppb_instance.idl create mode 100644 browser/extensions/mortar/ppapi/api/ppb_media_stream_audio_track.idl create mode 100644 browser/extensions/mortar/ppapi/api/ppb_media_stream_video_track.idl create mode 100644 browser/extensions/mortar/ppapi/api/ppb_message_loop.idl create mode 100644 browser/extensions/mortar/ppapi/api/ppb_messaging.idl create mode 100644 browser/extensions/mortar/ppapi/api/ppb_mouse_cursor.idl create mode 100644 browser/extensions/mortar/ppapi/api/ppb_mouse_lock.idl create mode 100644 browser/extensions/mortar/ppapi/api/ppb_net_address.idl create mode 100644 browser/extensions/mortar/ppapi/api/ppb_network_list.idl create mode 100644 browser/extensions/mortar/ppapi/api/ppb_network_monitor.idl create mode 100644 browser/extensions/mortar/ppapi/api/ppb_network_proxy.idl create mode 100644 browser/extensions/mortar/ppapi/api/ppb_opengles2.idl create mode 100644 browser/extensions/mortar/ppapi/api/ppb_tcp_socket.idl create mode 100644 browser/extensions/mortar/ppapi/api/ppb_text_input_controller.idl create mode 100644 browser/extensions/mortar/ppapi/api/ppb_udp_socket.idl create mode 100644 browser/extensions/mortar/ppapi/api/ppb_url_loader.idl create mode 100644 browser/extensions/mortar/ppapi/api/ppb_url_request_info.idl create mode 100644 browser/extensions/mortar/ppapi/api/ppb_url_response_info.idl create mode 100644 browser/extensions/mortar/ppapi/api/ppb_var.idl create mode 100644 browser/extensions/mortar/ppapi/api/ppb_var_array.idl create mode 100644 browser/extensions/mortar/ppapi/api/ppb_var_array_buffer.idl create mode 100644 browser/extensions/mortar/ppapi/api/ppb_var_dictionary.idl create mode 100644 browser/extensions/mortar/ppapi/api/ppb_video_decoder.idl create mode 100644 browser/extensions/mortar/ppapi/api/ppb_video_encoder.idl create mode 100644 browser/extensions/mortar/ppapi/api/ppb_video_frame.idl create mode 100644 browser/extensions/mortar/ppapi/api/ppb_view.idl create mode 100644 browser/extensions/mortar/ppapi/api/ppb_vpn_provider.idl create mode 100644 browser/extensions/mortar/ppapi/api/ppb_websocket.idl create mode 100644 browser/extensions/mortar/ppapi/api/ppp.idl create mode 100644 browser/extensions/mortar/ppapi/api/ppp_graphics_3d.idl create mode 100644 browser/extensions/mortar/ppapi/api/ppp_input_event.idl create mode 100644 browser/extensions/mortar/ppapi/api/ppp_instance.idl create mode 100644 browser/extensions/mortar/ppapi/api/ppp_message_handler.idl create mode 100644 browser/extensions/mortar/ppapi/api/ppp_messaging.idl create mode 100644 browser/extensions/mortar/ppapi/api/ppp_mouse_lock.idl create mode 100644 browser/extensions/mortar/ppapi/api/private/finish_writing_these/ppb_flash_file.idl create mode 100644 browser/extensions/mortar/ppapi/api/private/finish_writing_these/ppb_pdf.idl create mode 100644 browser/extensions/mortar/ppapi/api/private/finish_writing_these/ppb_proxy_private.idl create mode 100644 browser/extensions/mortar/ppapi/api/private/pp_content_decryptor.idl create mode 100644 browser/extensions/mortar/ppapi/api/private/pp_file_handle.idl create mode 100644 browser/extensions/mortar/ppapi/api/private/pp_private_font_charset.idl create mode 100644 browser/extensions/mortar/ppapi/api/private/pp_video_capture_format.idl create mode 100644 browser/extensions/mortar/ppapi/api/private/pp_video_frame_private.idl create mode 100644 browser/extensions/mortar/ppapi/api/private/ppb_camera_capabilities_private.idl create mode 100644 browser/extensions/mortar/ppapi/api/private/ppb_camera_device_private.idl create mode 100644 browser/extensions/mortar/ppapi/api/private/ppb_content_decryptor_private.idl create mode 100644 browser/extensions/mortar/ppapi/api/private/ppb_display_color_profile_private.idl create mode 100644 browser/extensions/mortar/ppapi/api/private/ppb_ext_crx_file_system_private.idl create mode 100644 browser/extensions/mortar/ppapi/api/private/ppb_file_io_private.idl create mode 100644 browser/extensions/mortar/ppapi/api/private/ppb_file_ref_private.idl create mode 100644 browser/extensions/mortar/ppapi/api/private/ppb_find_private.idl create mode 100644 browser/extensions/mortar/ppapi/api/private/ppb_flash.idl create mode 100644 browser/extensions/mortar/ppapi/api/private/ppb_flash_clipboard.idl create mode 100644 browser/extensions/mortar/ppapi/api/private/ppb_flash_device_id.idl create mode 100644 browser/extensions/mortar/ppapi/api/private/ppb_flash_drm.idl create mode 100644 browser/extensions/mortar/ppapi/api/private/ppb_flash_file.idl create mode 100644 browser/extensions/mortar/ppapi/api/private/ppb_flash_font_file.idl create mode 100644 browser/extensions/mortar/ppapi/api/private/ppb_flash_fullscreen.idl create mode 100644 browser/extensions/mortar/ppapi/api/private/ppb_flash_menu.idl create mode 100644 browser/extensions/mortar/ppapi/api/private/ppb_flash_message_loop.idl create mode 100644 browser/extensions/mortar/ppapi/api/private/ppb_flash_print.idl create mode 100644 browser/extensions/mortar/ppapi/api/private/ppb_host_resolver_private.idl create mode 100644 browser/extensions/mortar/ppapi/api/private/ppb_instance_private.idl create mode 100644 browser/extensions/mortar/ppapi/api/private/ppb_isolated_file_system_private.idl create mode 100644 browser/extensions/mortar/ppapi/api/private/ppb_net_address_private.idl create mode 100644 browser/extensions/mortar/ppapi/api/private/ppb_output_protection_private.idl create mode 100644 browser/extensions/mortar/ppapi/api/private/ppb_pdf.idl create mode 100644 browser/extensions/mortar/ppapi/api/private/ppb_platform_verification_private.idl create mode 100644 browser/extensions/mortar/ppapi/api/private/ppb_tcp_server_socket_private.idl create mode 100644 browser/extensions/mortar/ppapi/api/private/ppb_tcp_socket_private.idl create mode 100644 browser/extensions/mortar/ppapi/api/private/ppb_testing_private.idl create mode 100644 browser/extensions/mortar/ppapi/api/private/ppb_udp_socket_private.idl create mode 100644 browser/extensions/mortar/ppapi/api/private/ppb_uma_private.idl create mode 100644 browser/extensions/mortar/ppapi/api/private/ppb_video_destination_private.idl create mode 100644 browser/extensions/mortar/ppapi/api/private/ppb_video_source_private.idl create mode 100644 browser/extensions/mortar/ppapi/api/private/ppb_x509_certificate_private.idl create mode 100644 browser/extensions/mortar/ppapi/api/private/ppp_content_decryptor_private.idl create mode 100644 browser/extensions/mortar/ppapi/api/private/ppp_find_private.idl create mode 100644 browser/extensions/mortar/ppapi/api/private/ppp_flash_browser_operations.idl create mode 100644 browser/extensions/mortar/ppapi/api/private/ppp_instance_private.idl create mode 100644 browser/extensions/mortar/ppapi/api/private/ppp_pexe_stream_handler.idl create mode 100644 browser/extensions/mortar/ppapi/api/trusted/ppb_broker_trusted.idl create mode 100644 browser/extensions/mortar/ppapi/api/trusted/ppb_browser_font_trusted.idl create mode 100644 browser/extensions/mortar/ppapi/api/trusted/ppb_char_set_trusted.idl create mode 100644 browser/extensions/mortar/ppapi/api/trusted/ppb_file_chooser_trusted.idl create mode 100644 browser/extensions/mortar/ppapi/api/trusted/ppb_url_loader_trusted.idl create mode 100644 browser/extensions/mortar/ppapi/api/trusted/ppp_broker.idl create mode 100644 browser/extensions/mortar/ppapi/c/pp_graphics_3d.h create mode 100644 browser/extensions/mortar/ppapi/c/pp_instance.h create mode 100644 browser/extensions/mortar/ppapi/c/pp_module.h create mode 100644 browser/extensions/mortar/ppapi/c/pp_resource.h create mode 100644 browser/extensions/mortar/ppapi/c/pp_stdint.h create mode 100644 browser/extensions/mortar/ppapi/c/ppb.h create mode 100644 browser/extensions/mortar/ppapi/c/ppb_opengles2.h create mode 100644 browser/extensions/mortar/ppapi/c/private/pp_file_handle.h create mode 100644 browser/extensions/mortar/ppapi/generators/OWNERS create mode 100755 browser/extensions/mortar/ppapi/generators/generator.py create mode 100644 browser/extensions/mortar/ppapi/generators/idl_ast.py create mode 100755 browser/extensions/mortar/ppapi/generators/idl_c_header.py create mode 100755 browser/extensions/mortar/ppapi/generators/idl_c_proto.py create mode 100755 browser/extensions/mortar/ppapi/generators/idl_diff.py create mode 100755 browser/extensions/mortar/ppapi/generators/idl_gen_pnacl.py create mode 100755 browser/extensions/mortar/ppapi/generators/idl_gen_rpc.py create mode 100644 browser/extensions/mortar/ppapi/generators/idl_gen_wrapper.py create mode 100755 browser/extensions/mortar/ppapi/generators/idl_generator.py create mode 100755 browser/extensions/mortar/ppapi/generators/idl_lexer.py create mode 100644 browser/extensions/mortar/ppapi/generators/idl_lint.py create mode 100644 browser/extensions/mortar/ppapi/generators/idl_log.py create mode 100755 browser/extensions/mortar/ppapi/generators/idl_namespace.py create mode 100755 browser/extensions/mortar/ppapi/generators/idl_node.py create mode 100644 browser/extensions/mortar/ppapi/generators/idl_option.py create mode 100755 browser/extensions/mortar/ppapi/generators/idl_outfile.py create mode 100755 browser/extensions/mortar/ppapi/generators/idl_parser.py create mode 100755 browser/extensions/mortar/ppapi/generators/idl_propertynode.py create mode 100755 browser/extensions/mortar/ppapi/generators/idl_release.py create mode 100755 browser/extensions/mortar/ppapi/generators/idl_tests.py create mode 100755 browser/extensions/mortar/ppapi/generators/idl_thunk.py create mode 100644 browser/extensions/mortar/ppapi/generators/idl_visitor.py create mode 100644 browser/extensions/mortar/ppapi/generators/test_cgen/enum_typedef.h create mode 100644 browser/extensions/mortar/ppapi/generators/test_cgen/enum_typedef.idl create mode 100644 browser/extensions/mortar/ppapi/generators/test_cgen/interface.h create mode 100644 browser/extensions/mortar/ppapi/generators/test_cgen/interface.idl create mode 100644 browser/extensions/mortar/ppapi/generators/test_cgen/stdint.h create mode 100644 browser/extensions/mortar/ppapi/generators/test_cgen/stdint.idl create mode 100644 browser/extensions/mortar/ppapi/generators/test_cgen/structs.h create mode 100644 browser/extensions/mortar/ppapi/generators/test_cgen/structs.idl create mode 100644 browser/extensions/mortar/ppapi/generators/test_cgen_range/dev_channel_interface.h create mode 100644 browser/extensions/mortar/ppapi/generators/test_cgen_range/dev_channel_interface.idl create mode 100644 browser/extensions/mortar/ppapi/generators/test_cgen_range/versions.h create mode 100644 browser/extensions/mortar/ppapi/generators/test_cgen_range/versions.idl create mode 100644 browser/extensions/mortar/ppapi/generators/test_gen_pnacl/test_interfaces.idl create mode 100644 browser/extensions/mortar/ppapi/generators/test_namespace/bar.idl create mode 100644 browser/extensions/mortar/ppapi/generators/test_namespace/foo.idl create mode 100644 browser/extensions/mortar/ppapi/generators/test_parser/dictionary.idl create mode 100644 browser/extensions/mortar/ppapi/generators/test_parser/enum.idl create mode 100644 browser/extensions/mortar/ppapi/generators/test_parser/interface.idl create mode 100644 browser/extensions/mortar/ppapi/generators/test_parser/struct.idl create mode 100644 browser/extensions/mortar/ppapi/generators/test_parser/typedef.idl create mode 100644 browser/extensions/mortar/ppapi/generators/test_thunk/basic_test_types.idl create mode 100644 browser/extensions/mortar/ppapi/generators/test_thunk/simple.idl create mode 100644 browser/extensions/mortar/ppapi/generators/test_thunk/simple_thunk.cc create mode 100644 browser/extensions/mortar/ppapi/generators/test_version/versions.idl create mode 100644 browser/extensions/mortar/ppapi/out/rpc.cc diff --git a/browser/extensions/mortar/Makefile b/browser/extensions/mortar/Makefile new file mode 100644 index 000000000000..368811fc9479 --- /dev/null +++ b/browser/extensions/mortar/Makefile @@ -0,0 +1,54 @@ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +# We keep the Makefile until the mortar is integrated into gecko build system. +ifeq ($(shell uname), Darwin) + DLL_SUFFIX = .dylib + CXX = g++ + CXX_FLAGS = -std=c++11 -g -fPIC + LD_FLAGS = -dynamiclib +ifdef DEBUG + CXX_FLAGS += -DDEBUG +endif +else ifeq ($(shell uname), Linux) + DLL_SUFFIX = .so + CXX = g++ + CXX_FLAGS = -std=c++11 -g -fPIC + LD_FLAGS = -shared +ifdef DEBUG + CXX_FLAGS += -DDEBUG +endif +else + DLL_SUFFIX = .dll + CXX = cl + CXX_FLAGS = -nologo -EHsc -Oy- +ifdef DEBUG + CXX_FLAGS += -LDd -DDEBUG -Od +else + CXX_FLAGS += -LD +endif + LD_FLAGS = -link -dll +endif + +all : ppapi/out/rpc$(DLL_SUFFIX) ppapi/out/interpose$(DLL_SUFFIX) + +ppapi/out/rpc$(DLL_SUFFIX): ppapi/out/rpc.cc host/rpc.h host/rpc.cc + $(CXX) $(CXX_FLAGS) -I. -o $@ host/rpc.cc $(LD_FLAGS) + +ppapi/out/interpose$(DLL_SUFFIX): ppapi/out/rpc.cc host/rpc.h host/interpose.cc + $(CXX) -DINTERPOSE $(CXX_FLAGS) -I. -o $@ host/interpose.cc $(LD_FLAGS) + +ppapi/out/rpc.cc: $(shell find . -name *.idl) $(shell find . -name *.py) + cd ppapi/generators; python idl_gen_rpc.py --out ../out/rpc.cc ; cd ../.. + +json/test: json/json.cpp json/json.h json/test.cpp + $(CXX) -I./json -o $@ json/test.cpp + +test-json: json/test + @./json/test && echo "OK" + +clean: + rm -rf ppapi/generators/*.pyc ppapi/generators/*~ *~ ppapi/out/* json/*~ json/test *.obj + +.PHONY: all test-json test clean diff --git a/browser/extensions/mortar/host/common/opengles2-utils.jsm b/browser/extensions/mortar/host/common/opengles2-utils.jsm new file mode 100644 index 000000000000..aa98efba27fc --- /dev/null +++ b/browser/extensions/mortar/host/common/opengles2-utils.jsm @@ -0,0 +1,70 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +let GLES2Utils = { + bytesPerElement: function(context, type) { + switch (type) { + case context.FLOAT: + case context.INT: + case context.UNSIGNED_INT: + return 4; + case context.SHORT: + case context.UNSIGNED_SHORT: + case context.UNSIGNED_SHORT_5_6_5: + case context.UNSIGNED_SHORT_4_4_4_4: + case context.UNSIGNED_SHORT_5_5_5_1: + return 2; + case context.BYTE: + case context.UNSIGNED_BYTE: + return 1; + default: + throw new Error("Don't know this type."); + } + }, + elementsPerGroup: function(context, format, type) { + switch (type) { + case context.UNSIGNED_SHORT_5_6_5: + case context.UNSIGNED_SHORT_4_4_4_4: + case context.UNSIGNED_SHORT_5_5_5_1: + return 1; + default: + break; + } + + switch (format) { + case context.RGB: + return 3; + case context.LUMINANCE_ALPHA: + return 2; + case context.RGBA: + return 4; + case context.ALPHA: + case context.LUMINANCE: + case context.DEPTH_COMPONENT: + case context.DEPTH_COMPONENT16: + return 1; + default: + throw new Error("Don't know this format."); + } + }, + computeImageGroupSize: function(context, format, type) { + return this.bytesPerElement(context, type) * this.elementsPerGroup(context, format, type); + }, + computeImageDataSize: function(context, width, height, format, type) { + const unpackAlignment = 4; + + let bytesPerGroup = this.computeImageGroupSize(context, format, type); + let rowSize = width * bytesPerGroup; + if (height == 1) { + return rowSize; + } + + let temp = rowSize + unpackAlignment - 1; + let paddedRowSize = Math.floor(temp / unpackAlignment) * unpackAlignment; + let sizeOfAllButLastRow = (height - 1) * paddedRowSize; + return sizeOfAllButLastRow + rowSize; + }, +}; + +var EXPORTED_SYMBOLS = ["GLES2Utils"]; diff --git a/browser/extensions/mortar/host/common/ppapi-instance.js b/browser/extensions/mortar/host/common/ppapi-instance.js new file mode 100644 index 000000000000..51b2aab9de32 --- /dev/null +++ b/browser/extensions/mortar/host/common/ppapi-instance.js @@ -0,0 +1,33 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +const { classes: Cc, interfaces: Ci, utils: Cu } = Components; + +Cu.import("resource://gre/modules/Services.jsm"); + +let rt; +function getRuntime(type) { + if (!rt) { + let process = Cc["@mozilla.org/plugin/ppapi.js-process;1"].getService(Ci.nsIPPAPIJSProcess); + Cu.import("resource://ppapi.js/ppapi-runtime.jsm"); + rt = new PPAPIRuntime(process); + process.launch(rt.callback); + } + return rt; +} + +addMessageListener("ppapi.js:createInstance", ({ target, data: { type, info }, objects: { pluginWindow } }) => { + dump("ppapi.js:createInstance\n"); + let rt = getRuntime(type); + let instance = rt.createInstance(info, content, docShell.chromeEventHandler, pluginWindow, target); + addEventListener("unload", () => { + rt.destroyInstance(instance); + }); +}); + +addEventListener("DOMContentLoaded", () => { + // Passing an object here forces the creation of the CPOW manager in the + // parent. + sendRpcMessage("ppapi.js:frameLoaded", undefined, {}); +}); diff --git a/browser/extensions/mortar/host/common/ppapi-runtime.jsm b/browser/extensions/mortar/host/common/ppapi-runtime.jsm new file mode 100644 index 000000000000..5e329d7f3684 --- /dev/null +++ b/browser/extensions/mortar/host/common/ppapi-runtime.jsm @@ -0,0 +1,5308 @@ +/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +"use strict"; + +const { classes: Cc, interfaces: Ci, results: Cr, utils: Cu } = Components; + +Cu.import("resource://gre/modules/ctypes.jsm"); +Cu.import("resource://gre/modules/Services.jsm"); +Cu.import("resource://ppapi.js/opengles2-utils.jsm"); + +const PP_OK = 0; +const PP_OK_COMPLETIONPENDING = -1; +const PP_ERROR_FAILED = -2; +const PP_ERROR_ABORTED = -3; +const PP_ERROR_BADARGUMENT = -4; +const PP_ERROR_BADRESOURCE = -5; +const PP_ERROR_NOINTERFACE = -6; +const PP_ERROR_NOACCESS = -7; +const PP_ERROR_NOMEMORY = -8; +const PP_ERROR_NOSPACE = -9; +const PP_ERROR_NOQUOTA = -10; +const PP_ERROR_INPROGRESS = -11; +const PP_ERROR_NOTSUPPORTED = -12; +const PP_ERROR_BLOCKS_MAIN_THREAD = -13; +const PP_ERROR_MALFORMED_INPUT = -14; +const PP_ERROR_RESOURCE_FAILED = -15; +const PP_ERROR_FILENOTFOUND = -20; +const PP_ERROR_FILEEXISTS = -21; +const PP_ERROR_FILETOOBIG = -22; +const PP_ERROR_FILECHANGED = -23; +const PP_ERROR_NOTAFILE = -24; +const PP_ERROR_TIMEDOUT = -30; +const PP_ERROR_USERCANCEL = -40; +const PP_ERROR_NO_USER_GESTURE = -41; +const PP_ERROR_CONTEXT_LOST = -50; +const PP_ERROR_NO_MESSAGE_LOOP = -51; +const PP_ERROR_WRONG_THREAD = -52; +const PP_ERROR_WOULD_BLOCK_THREAD = -53; +const PP_ERROR_CONNECTION_CLOSED = -100; +const PP_ERROR_CONNECTION_RESET = -101; +const PP_ERROR_CONNECTION_REFUSED = -102; +const PP_ERROR_CONNECTION_ABORTED = -103; +const PP_ERROR_CONNECTION_FAILED = -104; +const PP_ERROR_CONNECTION_TIMEDOUT = -105; +const PP_ERROR_ADDRESS_INVALID = -106; +const PP_ERROR_ADDRESS_UNREACHABLE = -107; +const PP_ERROR_ADDRESS_IN_USE = -108; +const PP_ERROR_MESSAGE_TOO_BIG = -109; +const PP_ERROR_NAME_NOT_RESOLVED = -110; + + +const PP_Bool = { + PP_FALSE: 0, + PP_TRUE: 1, +}; + +const PP_AudioFrameSize = { + PP_AUDIOMINSAMPLEFRAMECOUNT: 64, + PP_AUDIOMAXSAMPLEFRAMECOUNT: 32768, +}; + +const PP_BrowserFont_Trusted_Family = { + PP_BROWSERFONT_TRUSTED_FAMILY_DEFAULT: 0, + PP_BROWSERFONT_TRUSTED_FAMILY_SERIF: 1, + PP_BROWSERFONT_TRUSTED_FAMILY_SANSSERIF: 2, + PP_BROWSERFONT_TRUSTED_FAMILY_MONOSPACE: 3, +}; + +const PP_BrowserFont_Trusted_Weight = { + PP_BROWSERFONT_TRUSTED_WEIGHT_100: 0, + PP_BROWSERFONT_TRUSTED_WEIGHT_200: 1, + PP_BROWSERFONT_TRUSTED_WEIGHT_300: 2, + PP_BROWSERFONT_TRUSTED_WEIGHT_400: 3, + PP_BROWSERFONT_TRUSTED_WEIGHT_500: 4, + PP_BROWSERFONT_TRUSTED_WEIGHT_600: 5, + PP_BROWSERFONT_TRUSTED_WEIGHT_700: 6, + PP_BROWSERFONT_TRUSTED_WEIGHT_800: 7, + PP_BROWSERFONT_TRUSTED_WEIGHT_900: 8, + PP_BROWSERFONT_TRUSTED_WEIGHT_NORMAL: 3, + PP_BROWSERFONT_TRUSTED_WEIGHT_BOLD: 6, +}; + +const PP_CursorType_Dev = { + PP_CURSORTYPE_CUSTOM: -1, + PP_CURSORTYPE_POINTER: 0, + PP_CURSORTYPE_CROSS: 1, + PP_CURSORTYPE_HAND: 2, + PP_CURSORTYPE_IBEAM: 3, + PP_CURSORTYPE_WAIT: 4, + PP_CURSORTYPE_HELP: 5, + PP_CURSORTYPE_EASTRESIZE: 6, + PP_CURSORTYPE_NORTHRESIZE: 7, + PP_CURSORTYPE_NORTHEASTRESIZE: 8, + PP_CURSORTYPE_NORTHWESTRESIZE: 9, + PP_CURSORTYPE_SOUTHRESIZE: 10, + PP_CURSORTYPE_SOUTHEASTRESIZE: 11, + PP_CURSORTYPE_SOUTHWESTRESIZE: 12, + PP_CURSORTYPE_WESTRESIZE: 13, + PP_CURSORTYPE_NORTHSOUTHRESIZE: 14, + PP_CURSORTYPE_EASTWESTRESIZE: 15, + PP_CURSORTYPE_NORTHEASTSOUTHWESTRESIZE: 16, + PP_CURSORTYPE_NORTHWESTSOUTHEASTRESIZE: 17, + PP_CURSORTYPE_COLUMNRESIZE: 18, + PP_CURSORTYPE_ROWRESIZE: 19, + PP_CURSORTYPE_MIDDLEPANNING: 20, + PP_CURSORTYPE_EASTPANNING: 21, + PP_CURSORTYPE_NORTHPANNING: 22, + PP_CURSORTYPE_NORTHEASTPANNING: 23, + PP_CURSORTYPE_NORTHWESTPANNING: 24, + PP_CURSORTYPE_SOUTHPANNING: 25, + PP_CURSORTYPE_SOUTHEASTPANNING: 26, + PP_CURSORTYPE_SOUTHWESTPANNING: 27, + PP_CURSORTYPE_WESTPANNING: 28, + PP_CURSORTYPE_MOVE: 29, + PP_CURSORTYPE_VERTICALTEXT: 30, + PP_CURSORTYPE_CELL: 31, + PP_CURSORTYPE_CONTEXTMENU: 32, + PP_CURSORTYPE_ALIAS: 33, + PP_CURSORTYPE_PROGRESS: 34, + PP_CURSORTYPE_NODROP: 35, + PP_CURSORTYPE_COPY: 36, + PP_CURSORTYPE_NONE: 37, + PP_CURSORTYPE_NOTALLOWED: 38, + PP_CURSORTYPE_ZOOMIN: 39, + PP_CURSORTYPE_ZOOMOUT: 40, + PP_CURSORTYPE_GRAB: 41, + PP_CURSORTYPE_GRABBING: 42, +}; + +const PP_FileOpenFlags = { + PP_FILEOPENFLAG_READ: 1 << 0, + PP_FILEOPENFLAG_WRITE: 1 << 1, + PP_FILEOPENFLAG_CREATE: 1 << 2, + PP_FILEOPENFLAG_TRUNCATE: 1 << 3, + PP_FILEOPENFLAG_EXCLUSIVE: 1 << 4, + PP_FILEOPENFLAG_APPEND: 1 << 5 +}; + +const PP_FileSystemType = { + PP_FILESYSTEMTYPE_INVALID: 0, + PP_FILESYSTEMTYPE_EXTERNAL: 1, + PP_FILESYSTEMTYPE_LOCALPERSISTENT: 2, + PP_FILESYSTEMTYPE_LOCALTEMPORARY: 3, + PP_FILESYSTEMTYPE_ISOLATED: 4 +}; + +const PP_FileType = { + PP_FILETYPE_REGULAR: 0, + PP_FILETYPE_DIRECTORY: 1, + PP_FILETYPE_OTHER: 2 +}; + +const PP_FlashLSORestrictions = { + PP_FLASHLSORESTRICTIONS_NONE: 1, + PP_FLASHLSORESTRICTIONS_BLOC: 2, + PP_FLASHLSORESTRICTIONS_IN_MEMORY: 3, +}; + +const PP_FlashSetting = { + PP_FLASHSETTING_3DENABLED: 1, + PP_FLASHSETTING_INCOGNITO: 2, + PP_FLASHSETTING_STAGE3DENABLED: 3, + PP_FLASHSETTING_LANGUAGE: 4, + PP_FLASHSETTING_NUMCORES: 5, + PP_FLASHSETTING_LSORESTRICTIONS: 6, + PP_FLASHSETTING_STAGE3DBASELINEENABLED: 7, +}; + +const PP_Graphics3DAttrib = { + PP_GRAPHICS3DATTRIB_ALPHA_SIZE: 0x3021, + PP_GRAPHICS3DATTRIB_BLUE_SIZE: 0x3022, + PP_GRAPHICS3DATTRIB_GREEN_SIZE: 0x3023, + PP_GRAPHICS3DATTRIB_RED_SIZE: 0x3024, + PP_GRAPHICS3DATTRIB_DEPTH_SIZE: 0x3025, + PP_GRAPHICS3DATTRIB_STENCIL_SIZE: 0x3026, + PP_GRAPHICS3DATTRIB_SAMPLES: 0x3031, + PP_GRAPHICS3DATTRIB_SAMPLE_BUFFERS: 0x3032, + PP_GRAPHICS3DATTRIB_NONE: 0x3038, + PP_GRAPHICS3DATTRIB_HEIGHT: 0x3056, + PP_GRAPHICS3DATTRIB_WIDTH: 0x3057, + PP_GRAPHICS3DATTRIB_SWAP_BEHAVIOR: 0x3093, + PP_GRAPHICS3DATTRIB_BUFFER_PRESERVED: 0x3094, + PP_GRAPHICS3DATTRIB_BUFFER_DESTROYED: 0x3095, + PP_GRAPHICS3DATTRIB_GPU_PREFERENCE: 0x11000, + PP_GRAPHICS3DATTRIB_GPU_PREFERENCE_LOW_POWER: 0x11001, + PP_GRAPHICS3DATTRIB_GPU_PREFERENCE_PERFORMANCE: 0x11002 +}; + +const PP_ImageDataFormat = { + PP_IMAGEDATAFORMAT_BGRA_PREMUL: 0, + PP_IMAGEDATAFORMAT_RGBA_PREMUL: 1, +}; + +const PP_InputEvent_Class = { + PP_INPUTEVENT_CLASS_MOUSE: 1 << 0, + PP_INPUTEVENT_CLASS_KEYBOARD: 1 << 1, + PP_INPUTEVENT_CLASS_WHEEL: 1 << 2, + PP_INPUTEVENT_CLASS_TOUCH: 1 << 3, + PP_INPUTEVENT_CLASS_IME: 1 << 4 +}; + +const PP_InputEvent_Modifier = { + PP_INPUTEVENT_MODIFIER_SHIFTKEY: 1 << 0, + PP_INPUTEVENT_MODIFIER_CONTROLKEY: 1 << 1, + PP_INPUTEVENT_MODIFIER_ALTKEY: 1 << 2, + PP_INPUTEVENT_MODIFIER_METAKEY: 1 << 3, + PP_INPUTEVENT_MODIFIER_ISKEYPAD: 1 << 4, + PP_INPUTEVENT_MODIFIER_ISAUTOREPEAT: 1 << 5, + PP_INPUTEVENT_MODIFIER_LEFTBUTTONDOWN: 1 << 6, + PP_INPUTEVENT_MODIFIER_MIDDLEBUTTONDOWN: 1 << 7, + PP_INPUTEVENT_MODIFIER_RIGHTBUTTONDOWN: 1 << 8, + PP_INPUTEVENT_MODIFIER_CAPSLOCKKEY: 1 << 9, + PP_INPUTEVENT_MODIFIER_NUMLOCKKEY: 1 << 10, + PP_INPUTEVENT_MODIFIER_ISLEFT: 1 << 11, + PP_INPUTEVENT_MODIFIER_ISRIGHT: 1 << 12 +}; + +const PP_InputEvent_MouseButton = { + PP_INPUTEVENT_MOUSEBUTTON_NONE: -1, + PP_INPUTEVENT_MOUSEBUTTON_LEFT: 0, + PP_INPUTEVENT_MOUSEBUTTON_MIDDLE: 1, + PP_INPUTEVENT_MOUSEBUTTON_RIGHT: 2, +}; + +const PP_InputEvent_Type = { + PP_INPUTEVENT_TYPE_UNDEFINED: -1, + PP_INPUTEVENT_TYPE_MOUSEDOWN: 0, + PP_INPUTEVENT_TYPE_MOUSEUP: 1, + PP_INPUTEVENT_TYPE_MOUSEMOVE: 2, + PP_INPUTEVENT_TYPE_MOUSEENTER: 3, + PP_INPUTEVENT_TYPE_MOUSELEAVE: 4, + PP_INPUTEVENT_TYPE_WHEEL: 5, + PP_INPUTEVENT_TYPE_RAWKEYDOWN: 6, + PP_INPUTEVENT_TYPE_KEYDOWN: 7, + PP_INPUTEVENT_TYPE_KEYUP: 8, + PP_INPUTEVENT_TYPE_CHAR: 9, + PP_INPUTEVENT_TYPE_CONTEXTMENU: 10, + PP_INPUTEVENT_TYPE_IME_COMPOSITION_START: 11, + PP_INPUTEVENT_TYPE_IME_COMPOSITION_UPDATE: 12, + PP_INPUTEVENT_TYPE_IME_COMPOSITION_END: 13, + PP_INPUTEVENT_TYPE_IME_TEXT: 14, + PP_INPUTEVENT_TYPE_TOUCHSTART: 15, + PP_INPUTEVENT_TYPE_TOUCHMOVE: 16, + PP_INPUTEVENT_TYPE_TOUCHEND: 17, + PP_INPUTEVENT_TYPE_TOUCHCANCEL: 18 +}; + +const PP_NetworkList_State = { + PP_NETWORKLIST_STATE_DOWN: 0, + PP_NETWORKLIST_STATE_UP: 1 +}; + +const PP_NetworkList_Type = { + PP_NETWORKLIST_TYPE_UNKNOWN: 0, + PP_NETWORKLIST_TYPE_ETHERNET: 1, + PP_NETWORKLIST_TYPE_WIFI: 2, + PP_NETWORKLIST_TYPE_CELLULAR: 3 +}; + +const PP_TextInput_Type_Dev = { + PP_TEXTINPUT_TYPE_DEV_NONE: 0, + PP_TEXTINPUT_TYPE_DEV_TEXT: 1, + PP_TEXTINPUT_TYPE_DEV_PASSWORD: 2, + PP_TEXTINPUT_TYPE_DEV_SEARCH: 3, + PP_TEXTINPUT_TYPE_DEV_EMAIL: 4, + PP_TEXTINPUT_TYPE_DEV_NUMBER: 5, + PP_TEXTINPUT_TYPE_DEV_TELEPHONE: 6, + PP_TEXTINPUT_TYPE_DEV_URL: 7 +}; + +const PP_URLRequestProperty = { + PP_URLREQUESTPROPERTY_URL: 0, + PP_URLREQUESTPROPERTY_METHOD: 1, + PP_URLREQUESTPROPERTY_HEADERS: 2, + PP_URLREQUESTPROPERTY_STREAMTOFILE: 3, + PP_URLREQUESTPROPERTY_FOLLOWREDIRECTS: 4, + PP_URLREQUESTPROPERTY_RECORDDOWNLOADPROGRESS: 5, + PP_URLREQUESTPROPERTY_RECORDUPLOADPROGRESS: 6, + PP_URLREQUESTPROPERTY_CUSTOMREFERRERURL: 7, + PP_URLREQUESTPROPERTY_ALLOWCROSSORIGINREQUESTS: 8, + PP_URLREQUESTPROPERTY_ALLOWCREDENTIALS: 9, + PP_URLREQUESTPROPERTY_CUSTOMCONTENTTRANSFERENCODING: 10, + PP_URLREQUESTPROPERTY_PREFETCHBUFFERUPPERTHRESHOLD: 11, + PP_URLREQUESTPROPERTY_PREFETCHBUFFERLOWERTHRESHOLD: 12, + PP_URLREQUESTPROPERTY_CUSTOMUSERAGENT: 13, +}; + +const PP_URLResponseProperty = { + PP_URLRESPONSEPROPERTY_URL: 0, + PP_URLRESPONSEPROPERTY_REDIRECTURL: 1, + PP_URLRESPONSEPROPERTY_REDIRECTMETHOD: 2, + PP_URLRESPONSEPROPERTY_STATUSCODE: 3, + PP_URLRESPONSEPROPERTY_STATUSLINE: 4, + PP_URLRESPONSEPROPERTY_HEADERS: 5 +}; + +const PP_VarType = { + PP_VARTYPE_UNDEFINED: 0, + PP_VARTYPE_NULL: 1, + PP_VARTYPE_BOOL: 2, + PP_VARTYPE_INT32: 3, + PP_VARTYPE_DOUBLE: 4, + PP_VARTYPE_STRING: 5, + PP_VARTYPE_OBJECT: 6, + PP_VARTYPE_ARRAY: 7, + PP_VARTYPE_DICTIONARY: 8, + PP_VARTYPE_ARRAY_BUFFER: 9, + PP_VARTYPE_RESOURCE: 10, +}; + +const PP_Flash_Clipboard_Format = { + PP_FLASH_CLIPBOARD_FORMAT_INVALID: 0, + PP_FLASH_CLIPBOARD_FORMAT_PLAINTEXT: 1, + PP_FLASH_CLIPBOARD_FORMAT_HTML: 2, + PP_FLASH_CLIPBOARD_FORMAT_RTF: 3, +}; + + +const PR_RDONLY = 0x01; +const PR_WRONLY = 0x02; +const PR_RDWR = 0x04; +const PR_CREATE_FILE = 0x08; +const PR_APPEND = 0x10; +const PR_TRUNCATE = 0x20; +const PR_SYNC = 0x40; +const PR_EXCL = 0x80; + + +class InterfaceMemberCall { + constructor(interfaceName, memberName, args) { + this.__interface = interfaceName; + this.__member = memberName; + Object.assign(this, args); + } +} + +class InterfaceInstanceMemberCall { + constructor(interfaceName, instance, memberName, args) { + this.__interface = interfaceName; + this.__instance = instance; + this.__member = memberName; + Object.assign(this, args); + } +} + +class CallbackCall { + constructor(callbackName, callback, args) { + this.__callback = callbackName; + this.__callbackStruct = callback; + Object.assign(this, args); + } +} + + +class OffscreenCanvas { + constructor(instance, width, height) { + this._canvas = instance.window.document.createElement("canvas"); + this._canvas.width = width; + this._canvas.height = height; + } + + set width(width) { + this._canvas.width = width; + } + set heigth(height) { + this._canvas.height = height; + } + + getContext(contextId, contextOptions) { + return this._canvas.getContext(contextId, contextOptions); + } + transferToImageBitmap() { + let window = this._canvas.ownerDocument.defaultView; + return window.createImageBitmap(this._canvas); + } +} + + +class ObjectCache { + constructor(getkeyForLookup=(v) => v) { + this.objects = []; + this.getkeyForLookup = getkeyForLookup; + } + + add(object) { + let i = 1; + while (i < this.objects.length && i in this.objects) { + ++i; + } + this.objects[i] = object; + return i; + } + lookup(i) { + return this.objects[this.getkeyForLookup(i)]; + } + destroy(i) { + delete this.objects[this.getkeyForLookup(i)]; + } +} + + +class PP_Var { + constructor(value, instance) { + if (typeof value == 'undefined' && this.constructor.field == "as_bool") { + value = PP_Bool.PP_FALSE; + } + + this.type = this.constructor.type; + this.padding = 0; + this.value = {}; + this.value[this.constructor.field] = this.constructor.convertValue(value, instance); + } + + static get field() { + return this.fields[this.type]; + } + static convertValue(value) { + return value; + } + static getAsJSValue(value) { + return value.value[this.field]; + } + static normalize({ type, value }) { + let field = this.fields[type]; + return { + type, + padding: 0, + value: { + [field]: value[field], + }, + }; + } +} +// Our JSON parser always needs a field for a union, so we use "as_bool" for +// PP_VARTYPE_UNDEFINED/PP_VARTYPE_NULL. +PP_Var.fields = [ + "as_bool", // PP_VARTYPE_UNDEFINED + "as_bool", // PP_VARTYPE_NULL + "as_bool", // PP_VARTYPE_BOOL + "as_int", // PP_VARTYPE_INT32 + "as_double", // PP_VARTYPE_DOUBLE + "as_id", // PP_VARTYPE_STRING + "as_id", // PP_VARTYPE_OBJECT + "as_id", // PP_VARTYPE_ARRAY + "as_id", // PP_VARTYPE_DICTIONARY + "as_id", // PP_VARTYPE_ARRAY_BUFFER + "as_id", // PP_VARTYPE_RESOURCE +]; +PP_Var.type = PP_VarType.PP_VARTYPE_UNDEFINED; + +class PP_Var_Cached extends PP_Var { + static convertValue(value, instance) { + return this.cache.add({ value, instance, refcnt: 1 }); + } + static getAsJSValue(value) { + return this.cache.lookup(value).value; + } + static getAsJSValueWithInstance(value) { + let r = this.cache.lookup(value); + return [r.value, r.instance]; + } + static addRef(value) { + let cache = this.caches[value.type]; + if (cache) { + ++cache.lookup(value).refcnt; + } + } + static release(value) { + let cache = this.caches[value.type]; + if (cache && --cache.lookup(value).refcnt === 0) { + cache.destroy(value); + } + } + static get cache() { + return this.caches[this.type]; + } + static isCached(type) { + return this.caches[type] !== undefined; + } +} +PP_Var_Cached.caches = PP_Var.fields.map((f) => f == "as_id" ? new ObjectCache((v) => v.value[f]) : undefined); + +class Undefined_PP_Var extends PP_Var { +} +Undefined_PP_Var.type = PP_VarType.PP_VARTYPE_UNDEFINED; + +class Null_PP_Var extends PP_Var { +} +Null_PP_Var.type = PP_VarType.PP_VARTYPE_NULL; + +class Bool_PP_Var extends PP_Var { + static convertValue(value) { + return (typeof value == 'boolean') ? (value ? PP_Bool.PP_TRUE : PP_Bool.PP_FALSE) : value; + } + static getAsJSValue(value) { + return PP_Bool[value.value[this.field]] == PP_Bool.PP_TRUE; + } +} +Bool_PP_Var.type = PP_VarType.PP_VARTYPE_BOOL; + +class Int32_PP_Var extends PP_Var { +} +Int32_PP_Var.type = PP_VarType.PP_VARTYPE_INT32; + +class Double_PP_Var extends PP_Var { +} +Double_PP_Var.type = PP_VarType.PP_VARTYPE_DOUBLE; + +class String_PP_Var extends PP_Var_Cached { +} +String_PP_Var.type = PP_VarType.PP_VARTYPE_STRING; + +class Object_PP_Var extends PP_Var_Cached { +} +Object_PP_Var.type = PP_VarType.PP_VARTYPE_OBJECT; + +class Array_PP_Var extends PP_Var_Cached { + constructor(array = [], instance) { + if (!Array.isArray(array)) { + throw new Error("Array_PP_Var is not constructed from an array."); + } + super(array, instance); + } +} +Array_PP_Var.type = PP_VarType.PP_VARTYPE_ARRAY; + +// Dictionary is a specialized class for the value of Dictionary_PP_Var only. +class Dictionary { + constructor(object) { + Object.assign(this, object); + } +} +class Dictionary_PP_Var extends PP_Var_Cached { + constructor(dict = new Dictionary(), instance) { + if (!(dict instanceof Dictionary)) { + throw new Error("Dictionary_PP_Var is not constructed from a Dictionary."); + } + super(dict, instance); + } +} +Dictionary_PP_Var.type = PP_VarType.PP_VARTYPE_DICTIONARY; + +class ArrayBuffer_PP_Var extends PP_Var_Cached { + constructor(ab, instance) { + super((ab instanceof ArrayBuffer) ? ab : new ArrayBuffer(ab), instance); + } +} +ArrayBuffer_PP_Var.type = PP_VarType.PP_VARTYPE_ARRAYBUFFER + +class Resource_PP_Var extends PP_Var_Cached { +} +Resource_PP_Var.type = PP_VarType.PP_VARTYPE_RESOURCE; + +/* Convert a native JavaScript value to a object-based PP_Var */ +PP_Var.fromJSValue = function(v, instance) { + switch (typeof v) { + case "undefined": + return new PP_Var(undefined, instance); + case "boolean": + return new Bool_PP_Var(v, instance); + case "number": + if (Number.isInteger(v) && v >= (-(1 << 31)) && v <= ((1 << 31) - 1)) { + return new Int32_PP_Var(v, instance); + } + return new Double_PP_Var(v, instance); + case "string": + return new String_PP_Var(v, instance); + case "symbol": + throw new Error("Don't know how to convert Symbol to PP_Var."); + case "function": + /* falls through */ + default: + if (v === null) { + return new Null_PP_Var(null, instance); + } else if (Array.isArray(v)) { + return v.map((value) => PP_Var.fromJSValue(value, instance)); + } else if (v instanceof Dictionary) { + let dict = new Dictionary(); + for (let [key, value] of Object.entries(v)) { + dict[key] = PP_Var.fromJSValue(value, instance); + } + return new Dictionary_PP_Var(dict, instance); + } else if (v instanceof ArrayBuffer) { + return new ArrayBuffer_PP_Var(v, instance); + } + return new Object_PP_Var(v, instance); + } +}; + +/* Convert a json-based PP_Var to a native JavaScript value */ +PP_Var.toJSValue = function(json, instance) { + if (!("type" in json) || !("padding" in json) || !("value" in json)) { + return undefined; + } + let type = json.type; + // Sometimes json.type is a String instead of a Number + if (typeof type === "string") { + type = PP_VarType[json.type]; + } + switch (type) { + case PP_VarType.PP_VARTYPE_UNDEFINED: + return undefined; + case PP_VarType.PP_VARTYPE_NULL: + return null; + case PP_VarType.PP_VARTYPE_BOOL: + return Boolean(Bool_PP_Var.getAsJSValue(json, instance)); + case PP_VarType.PP_VARTYPE_INT32: + return Number.parseInt(String(Int32_PP_Var.getAsJSValue(json, instance)), 10); + case PP_VarType.PP_VARTYPE_DOUBLE: + return Number.parseFloat(String(Double_PP_Var.getAsJSValue(json, instance))); + case PP_VarType.PP_VARTYPE_STRING: + return String(String_PP_Var.getAsJSValue(json, instance)); + case PP_VarType.PP_VARTYPE_OBJECT: + return Object(Object_PP_Var.getAsJSValue(json, instance)); + case PP_VarType.PP_VARTYPE_ARRAY: + return Array_PP_Var.getAsJSValue(json, instance).map((v) => PP_Var.toJSValue(v, instance)); + case PP_VarType.PP_VARTYPE_DICTIONARY: + let dict = new Dictionary(); + for (let [key, value] of Object.entries(Dictionary_PP_Var.getAsJSValue(json, instance))) { + dict[key] = PP_Var.toJSValue(value, instance); + } + return dict; + case PP_VarType.PP_VARTYPE_ARRAY_BUFFER: + return ArrayBuffer_PP_Var.getAsJSValue(json.value, instance); + case PP_VarType.PP_VARTYPE_RESOURCE: + return Resource_PP_Var.getAsJSValue(json.value, instance); + default: + throw new Error("Don't know how to convert PP_Var with type(" + type + ") to a proper JavaScript object."); + } +} + +class PP_Resource { + constructor(instance) { + // XXX Need to check that this is correct! + this.refcnt = 1; + this.id = PP_Resource.cache.add(this); + this.instance = instance; + } + + destroy() { + PP_Resource.cache.destroy(this.id); + } + + addRef() { + ++this.refcnt; + } + release() { + if (--this.refcnt === 0) { + this.destroy(); + } + } + + toJSON() { + return this.id; + } + + static lookup(id) { + return this.cache.lookup(id); + } +} +PP_Resource.cache = new ObjectCache(); + +const INT16_MIN = -Math.pow(2, 15); +const INT16_MAX = Math.pow(2, 15) - 1; +const negDiv = SIMD.Float32x4.splat(-INT16_MIN); +const posDiv = SIMD.Float32x4.splat(INT16_MAX); +const zeroFloat32 = SIMD.Float32x4.splat(0); +const littleEndian = (new Uint8Array(Uint32Array.of(0xdeadbeef).buffer))[0] == 0xef; + +class Audio extends PP_Resource { + constructor(instance, bufferSize, frameCount, callback, data) { + super(instance); + let rt = instance.rt; + let mem = rt.allocateCachedBuffer(bufferSize); + let samples = new Float32Array(frameCount * 2); + let left = new Float32Array(samples.buffer, 0, frameCount); + let right = new Float32Array(samples.buffer, frameCount * 4, frameCount); + + // FIXME Wish we could use MSE, but it doesn't have what we need yet. + this.context = new instance.window.AudioContext(); + this.callbackNode = this.context.createScriptProcessor(frameCount, 0, 2); + this.callbackNode.addEventListener("audioprocess", (e) => { + rt.call(new CallbackCall("PPB_Audio_Callback_1_0", callback, { sample_buffer: mem, buffer_size_in_bytes: bufferSize, user_data: data }), + true); + let buffer = new Int16Array(rt.getCachedBuffer(mem)); + + // FIXME Ideally we'd convert straight into the outputBuffer's channel + // data, but because our AudioContext is from the window we get + // CCWs here, and the SIMD code we use can't deal with those. + //let left = e.outputBuffer.getChannelData(0); + //let right = e.outputBuffer.getChannelData(1); + // Sigh, have to convert between Int16 and Float32 (in a range between + // -1 and 1). + this.constructor.splitAndConvertInt16toFloat32(buffer, left, right); + e.outputBuffer.copyToChannel(left, 0, 0); + e.outputBuffer.copyToChannel(right, 1, 0); + }); + } + + static splitAndConvertInt16toFloat32(buffer, leftResult, rightResult) { + // We'll process groups of 4 frames (8 samples, 4 left and 4 right, + // interleaved as [l1, r1, l2, r2, l3, r3, l4, r4]). We load as Int32x4, to + // make sure the JIT inlines, so our data really looks like + // [r1l1, r2l2, r3l3, r4l4] or [l1r1, l2r2, l3r3, l4r4], depending on + // endianness. + let firstResult, secondResult; + if (littleEndian) { + firstResult = rightResult; + secondResult = leftResult; + } else { + firstResult = leftResult; + secondResult = rightResult; + } + let frameCount = leftResult.length; + for (let i = 0; i < frameCount; i += 4) { + let interleaved = SIMD.Int32x4.load(buffer, i * 2); + + let first = SIMD.Int32x4.shiftRightByScalar(interleaved, 16); + // Convert to float. + first = SIMD.Float32x4.fromInt32x4(first); + // Divide positive numbers by INT16_MAX and negative numbers by -INT16_MIN, + // to have a Float32 in a range between -1 and 1. + let pos = SIMD.Float32x4.greaterThan(first, zeroFloat32); + first = SIMD.Float32x4.div(first, + SIMD.Float32x4.select(pos, posDiv, negDiv)); + + let second = SIMD.Int32x4.shiftLeftByScalar(interleaved, 16); + second = SIMD.Int32x4.shiftRightByScalar(second, 16); + // Convert to float. + second = SIMD.Float32x4.fromInt32x4(second); + // Divide positive numbers by INT16_MAX and negative numbers by -INT16_MIN, + // to have a Float32 in a range between -1 and 1. + pos = SIMD.Float32x4.greaterThan(second, zeroFloat32); + second = SIMD.Float32x4.div(second, + SIMD.Float32x4.select(pos, posDiv, negDiv)); + + SIMD.Float32x4.store(firstResult, i, first); + SIMD.Float32x4.store(secondResult, i, second); + } + } + + start() { + this.callbackNode.connect(this.context.destination); + } + stop() { + this.callbackNode.disconnect(this.context.destination); + } +} +class AudioConfig extends PP_Resource { + constructor(instance, frameCount) { + super(instance); + this.frameCount = frameCount; + this.bufferSize = frameCount * 2 /* channels */ * 2 /* bytes per frame */; + } +} +class BrowserFont_Trusted extends PP_Resource { + constructor(instance, description) { + super(instance); + this.description = description; + this.customFamily = undefined; + if (PP_VarType[this.description.face.type] == PP_VarType.PP_VARTYPE_STRING) { + this.customFamily = String_PP_Var.getAsJSValue(description.face); + } + } + + get fontRule() { + if (!("_fontRule" in this)) { + let fontRule = []; + if (PP_Bool[this.description.italic] == PP_Bool.PP_TRUE) { + fontRule.push("italic"); + } + if (PP_Bool[this.description.small_caps] == PP_Bool.PP_TRUE) { + fontRule.push("small-caps"); + } + let weight; + switch (PP_BrowserFont_Trusted_Weight[this.description.weight]) { + case PP_BrowserFont_Trusted_Weight.PP_BROWSERFONT_TRUSTED_WEIGHT_100: + weight = 100; + break; + case PP_BrowserFont_Trusted_Weight.PP_BROWSERFONT_TRUSTED_WEIGHT_200: + weight = 200; + break; + case PP_BrowserFont_Trusted_Weight.PP_BROWSERFONT_TRUSTED_WEIGHT_300: + weight = 300; + break; + case PP_BrowserFont_Trusted_Weight.PP_BROWSERFONT_TRUSTED_WEIGHT_400: + weight = 400; + break; + case PP_BrowserFont_Trusted_Weight.PP_BROWSERFONT_TRUSTED_WEIGHT_500: + weight = 500; + break; + case PP_BrowserFont_Trusted_Weight.PP_BROWSERFONT_TRUSTED_WEIGHT_600: + weight = 600; + break; + case PP_BrowserFont_Trusted_Weight.PP_BROWSERFONT_TRUSTED_WEIGHT_700: + weight = 700; + break; + case PP_BrowserFont_Trusted_Weight.PP_BROWSERFONT_TRUSTED_WEIGHT_800: + weight = 800; + break; + case PP_BrowserFont_Trusted_Weight.PP_BROWSERFONT_TRUSTED_WEIGHT_900: + weight = 900; + break; + } + fontRule.push(weight); + fontRule.push(this.description.size + "px"); + let family; + if (PP_VarType[this.description.face.type] == PP_VarType.PP_VARTYPE_UNDEFINED) { + switch (PP_BrowserFont_Trusted_Family[this.description.family]) { + case PP_BrowserFont_Trusted_Family.PP_BROWSERFONT_TRUSTED_FAMILY_DEFAULT: + throw new Error("Don't know default font."); + case PP_BrowserFont_Trusted_Family.PP_BROWSERFONT_TRUSTED_FAMILY_SERIF: + family = "serif"; + break; + case PP_BrowserFont_Trusted_Family.PP_BROWSERFONT_TRUSTED_FAMILY_SANSSERIF: + family = "sans-serif"; + break; + case PP_BrowserFont_Trusted_Family.PP_BROWSERFONT_TRUSTED_FAMILY_MONOSPACE: + family = "monospace"; + break; + } + } else { + family = this.customFamily; + } + + // This shouldn't happen, but make sure there is a font family assigned. + family = (family == "") ? "serif" : family; + + fontRule.push(family); + if (this.description.letter_spacing > 0) { + //throw new Error("Need to implement support for letter_spacing."); + } + if (this.description.word_spacing > 0) { + //throw new Error("Need to implement support for word_spacing."); + } + this._fontRule = fontRule.join(" "); + } + return this._fontRule; + } + measureText(text) { + // FIXME Can we avoid creating a context? + if (!("_context" in this)) { + let canvas = this.instance.window.document.createElement("canvas"); + this._context = canvas.getContext("2d"); + this._context.font = this.fontRule; + } + let metrics = this._context.measureText(text); + return Math.round(metrics.width); + } +} +class Buffer extends PP_Resource { + constructor(instance, size) { + super(instance); + this.size = size; + this.mappedCount = 0; + } + + map() { + if (++this.mappedCount == 1) { + this.mem = this.instance.rt.allocateCachedBuffer(this.size); + } + return this.mem; + } + unmap() { + if (--this.mappedCount == 0) { + this.instance.rt.freeCachedBuffer(this.mem); + delete this.mem; + } + } +} +class Flash_MessageLoop extends PP_Resource { + run() { + this._running = true; + let thread = Cc["@mozilla.org/thread-manager;1"].getService().currentThread; + while (this._running) { + thread.processNextEvent(true); + } + } + quit() { + this._running = false; + } +} +class Graphics extends PP_Resource { + constructor(instance) { + super(instance); + this.canvas = instance.window.document.createElement("canvas"); + } + destroy() { + this.canvas.remove(); + super.destroy(); + } + changeSize(width, height) { + this.canvas.width = width; + this.canvas.height = height; + } +} +class Graphics2DPaintOperation { + constructor(imageData, x, y, dirtyRect=[]) { + this.imageData = imageData; + this.imageData.addRef(); + this.x = x; + this.y = y; + this.dirtyRect = dirtyRect; + } + + destroy() { + this.imageData.release(); + } + + execute(context) { + context.putImageData(this.imageData.getDOMImageData(), this.x, this.y, ...this.dirtyRect); + } +} +class Graphics2DScrollOperation { + constructor(clipRect, amountX, amountY) { + this.clipRect = clipRect; + this.amountX = amountX; + this.amountY = amountY; + } + + destroy() { + // Nothing to do here. + } + + execute(context) { + let clip = context.getImageData(...this.clipRect); + context.putImageData(clip, this.clipRect[0] + this.amountX, this.clipRect[1] + this.amountY); + } +} +class Graphics2D extends Graphics { + constructor(instance, width, height) { + super(instance); + + // FIXME We should probably do transferControlToOffscreen instead, once + // that's available. + this.bitmapContext = this.canvas.getContext("bitmaprenderer"); + this.offscreen = new OffscreenCanvas(instance, width, height); + this.context = this.offscreen.getContext("2d"); + this.changeSize(width, height); + this.operations = []; + } + + destroy() { + this.clearOperations(); + super.destroy(); + } + + changeSize(width, height) { + this.offscreen.width = width; + this.offscreen.height = height; + super.changeSize(width, height); + this.bitmapContext.width = width; + this.bitmapContext.height = height; + } + + addOperation(operation) { + this.operations.push(operation); + } + + clearOperations() { + for (let operation of this.operations) { + operation.destroy(); + } + this.operations = []; + } + + flush(callback) { + for (let operation of this.operations) { + operation.execute(this.context); + operation.destroy(); + } + this.operations = []; + //dump(this.canvas.toDataURL()); + + this.offscreen.transferToImageBitmap().then((bitmap) => { + //dump(this.offscreen._canvas.toDataURL()); + this.bitmapContext.transferImageBitmap(bitmap); + this.instance.rt.call(new CallbackCall("PP_CompletionCallback", callback, { result: PP_OK })); + }, () => { + this.instance.rt.call(new CallbackCall("PP_CompletionCallback", callback, { result: PP_ERROR_FAILED })); + }); + return PP_OK_COMPLETIONPENDING; + } +} +class Graphics3D extends Graphics { + constructor(instance, attributes) { + let width = -1, height = -1; + let contextAttributes = {}; + for (let [k, v] of attributes.entries()) { + switch (k) { + case PP_Graphics3DAttrib.PP_GRAPHICS3DATTRIB_DEPTH_SIZE: + contextAttributes.depth = v > 0; + break; + case PP_Graphics3DAttrib.PP_GRAPHICS3DATTRIB_STENCIL_SIZE: + contextAttributes.stencil = v > 0; + break; + case PP_Graphics3DAttrib.PP_GRAPHICS3DATTRIB_HEIGHT: + height = v; + break; + case PP_Graphics3DAttrib.PP_GRAPHICS3DATTRIB_WIDTH: + width = v; + break; + case PP_Graphics3DAttrib.PP_GRAPHICS3DATTRIB_SWAP_BEHAVIOR: + contextAttributes.preserveDrawingBuffer = v == PP_Graphics3DAttrib.PP_GRAPHICS3DATTRIB_BUFFER_PRESERVED; + break; + case PP_Graphics3DAttrib.PP_GRAPHICS3DATTRIB_GPU_PREFERENCE: + contextAttributes.preferLowPowerToHighPerformance = v == PP_Graphics3DAttrib.PP_GRAPHICS3DATTRIB_GPU_PREFERENCE_LOW_POWER; + break; + // FIXME Deal with other attributes! + } + } + // FIXME WORKAROUND LINUX WebGL BUG. + //contextAttributes.antialias = false; + let window = instance.window; + if (width < 0) { + width = window.innerWidth * window.devicePixelRatio; + } + if (height < 0) { + height = window.innerHeight * window.devicePixelRatio; + } + + super(instance); + this.context = this.canvas.getContext("webgl", contextAttributes); + this.changeSize(width, height); + } + + changeSize(width, height) { + super.changeSize(width, height); + this.context.viewport(0, 0, this.context.drawingBufferWidth, this.context.drawingBufferHeight); + } + flush(callback) { + this.context.flush(); + this.instance.window.requestAnimationFrame(() => { + this.instance.rt.call(new CallbackCall("PP_CompletionCallback", callback, { result: PP_OK })); + }); + return PP_OK_COMPLETIONPENDING; + } + get objects() { + if (!("_objects" in this)) { + this._objects = new ObjectCache(); + } + return this._objects; + } + get mappedTextures() { + if (!("_mappedTextures" in this)) { + this._mappedTextures = new Map(); + } + return this._mappedTextures; + } +} +class ImageData extends PP_Resource { + constructor(instance, format, size) { + let cached = instance.cachedImageData; + if (cached && + cached.format == format && + cached.size.width == size.width && + cached.size.height == size.height) { + return cached; + } + + super(instance); + this.format = format; + this.size = size; + this.mapped = null; + } + + destroy() { + if (this.mapped) { + this.instance.rt.freeCachedBuffer(this.mapped); + this.mappedSize = 0; + this.mapped = null; + } + super.destroy(); + } + + map() { + if (!this.mapped) { + this.mappedSize = this.size.height * this.stride; + this.mapped = this.instance.rt.allocateCachedBuffer(this.mappedSize); + } + return this.mapped; + } + + // You should surround any code drawing to the context with + // beginDrawing/endDrawing calls. + get context() { + if (!("_context" in this)) { + let canvas = this.instance.window.document.createElement("canvas"); + canvas.width = this.size.width; + canvas.height = this.size.height; + this._context = canvas.getContext("2d"); + } + return this._context; + } + beginDrawing() { + this.map(); + this.context.save(); + let currentData = new Uint8ClampedArray(this.instance.rt.getCachedBuffer(this.mapped)); + this.context.putImageData(new this.instance.window.ImageData(currentData, this.size.width, this.size.height), 0, 0); + return this.context; + } + endDrawing() { + let data = this.context.getImageData(0, 0, this.size.width, this.size.height).data; + if (this.mappedSize != data.byteLength) { + debugger; + throw new Error("Trying to set too " + (this.mappedSize > data.byteLength ? "little" : "much") + " data, src: " + data.byteLength + " dest: " + this.mappedSize + ".\n"); + } + this.instance.rt.setBuffer(this.mapped, data); + this.context.restore(); + } + get stride() { + return this.size.width * 4; + } + getDOMImageData() { + let dataArray = new Uint8ClampedArray(this.instance.rt.getCachedBuffer(this.mapped)); + this._colorConvert(dataArray); + let imagedata = new this.instance.window.ImageData(dataArray, this.size.width, this.size.height); + return imagedata; + } + _colorConvert(dataArray) { + if (this.format == PP_ImageDataFormat.PP_IMAGEDATAFORMAT_BGRA_PREMUL) { + let tmp; + for (let i = 0; i < dataArray.length; i += 4) { + tmp = dataArray[i]; + dataArray[i] = dataArray[i + 2]; + dataArray[i + 2] = tmp; + } + } + } +} +class InputEvent extends PP_Resource { + constructor(instance, event) { + super(instance); + this.eventType = EventTypes.get(event.type).eventType; + this.domEvent = event; + this.timeStamp = event.timeStamp / 1000; + } +} +class NetworkMonitor extends PP_Resource { +} +class PrintingDev extends PP_Resource { +} +class TCPSocketPrivate extends PP_Resource { + constructor(instance) { + super(instance); + } + + callCallback(callback, result) { + this.instance.rt.call(new CallbackCall("PP_CompletionCallback", callback, { result })); + this.impl.onerror = null; + } + connect(host, port, callback) { + this.impl = new TCPSocket(host, port, { binaryType: "arraybuffer" }); + this.impl.onopen = (e) => { + this.impl.suspend(); + + this.callCallback(callback, PP_OK); + this.impl.onopen = null; + }; + this.impl.onerror = (e) => { + this.callCallback(callback, PP_ERROR_FAILED); + this.impl.onopen = null; + }; + } + read(buffer, bytesToRead, callback) { + this.impl.ondata = (e) => { + e.target.suspend(); + if (e.data) { + if (e.data.byteLength > bytesToRead) { + throw new Error("We need to cache the data."); + } + this.instance.rt.setBuffer(buffer, e.data); + this.callCallback(callback, e.data.byteLength); + } else { + this.callCallback(callback, PP_ERROR_FAILED); + } + this.impl.ondata = null; + }; + this.impl.onerror = (e) => { + this.callCallback(callback, PP_ERROR_FAILED); + this.impl.ondata = null; + }; + this.impl.resume(); + } + write(data) { + return this.impl.send(Uint8ClampedArray.from(data).buffer); + } + close() { + this.impl.close(); + this.impl = null; + } + get localAddress() { + if (this.impl.readyState != "open") { + return null; + } + //let address = socket.wrappedJSObject._transport.getScriptableSelfAddr(); + return "127.0.0.0"; + } + get remoteAddress() { + if (this.impl.readyState != "open") { + return null; + } + //let address = socket.wrappedJSObject._transport.getScriptablePeerAddr(); + return "127.0.0.0"; + } +} +class URLLoader extends PP_Resource { + constructor(instance) { + super(instance); + this.responseReadCallback = null; + this.responseUnreadChunks = []; + } + + openURL(method, url, callback) { + // FIXME Should we use this.instance.info.embed.window if the plugin + // doesn't call PPB_URLLoaderTrusted::GrantUniversalAccess? + this.req = new this.instance.window.XMLHttpRequest({ mozSystem: true }); + + this.req.responseType = "moz-chunked-arraybuffer"; + this.headersReceivedCallback = callback; + this.req.onreadystatechange = this.onreadystatechange.bind(this); + this.req.onprogress = this.onprogress.bind(this); + + url = new this.instance.window.URL(url, this.instance.info.url); + this.req.open(method, url, true); + } + onreadystatechange() { + switch (this.req.readyState) { + case this.req.OPENED: + this.req.send(); + let channel = this.req.channel; + try { + if (channel.QueryInterface(Ci.nsIFileChannel)) { + channel.contentType = "application/x-unknown-content-type"; + channel.loadFlags |= Ci.nsIChannel.LOAD_CALL_CONTENT_SNIFFERS; + } + } catch (e) { + } + //this.req.overrideMimeType("application/x-unknown-content-type"); + break; + case this.req.HEADERS_RECEIVED: + // Send callback. + this.headersReceivedCallback(0); + break; + case this.req.DONE: + if (this.responseReadCallback) { + let callback = this.responseReadCallback; + this.responseReadCallback = null; + callback(); + } + break; + } + } + onprogress(e) { + this.bytes_received = e.loaded; + this.total_bytes_to_be_received = e.lengthComputable ? e.total : -1; + let chunk = this.req.response; + if (chunk.byteLength > 0) { + this.responseUnreadChunks.push(new Uint8Array(chunk)); + if (this.responseReadCallback) { + let callback = this.responseReadCallback; + this.responseReadCallback = null; + callback(); + } + } + } + get responseInfo() { + return new URLResponseInfo(this); + } + readResponseIntoBuffer(buffer, bytesToRead) { + let chunks = this.responseUnreadChunks; + let bytesRead = 0; + let i; + for (i = 0; i < chunks.length; ++i) { + let chunk = chunks[i]; + let readFromChunk = Math.min(chunk.length, bytesToRead - bytesRead); + this.instance.rt.setBuffer(buffer + bytesRead, chunk, readFromChunk); + bytesRead += readFromChunk; + if (bytesRead == bytesToRead) { + // We've read all we need to read. + if (readFromChunk < chunk.length) { + // But we haven't consumed all the data of the last chunk we read + // from, store a new view into the buffer that only contains what we + // haven't read. + chunks[i] = new Uint8Array(chunk.buffer, chunk.byteOffset + readFromChunk); + } else { + ++i; + } + break; + } + } + if (i > 0) { + this.responseUnreadChunks = chunks.slice(i); + } + return bytesRead; + } + readResponse(buffer, bytesToRead, callback) { + if (this.responseUnreadChunks.length > 0 || + this.req.readyState == this.req.DONE) { + callback(this.readResponseIntoBuffer(buffer, bytesToRead)); + return -1; + } + + this.responseReadCallback = () => { + callback(this.readResponseIntoBuffer(buffer, bytesToRead)); + }; + return -1; + } +} +class URLRequestInfo extends PP_Resource { + constructor(instance) { + super(instance); + this.propertyMap = new Map(); + } + + getProperty(property) { + return this.propertyMap.get(property); + } + setProperty(property, value) { + this.propertyMap.set(property, value); + } +} +class URLResponseInfo extends PP_Resource { + constructor(loader) { + super(loader.instance); + this.req = loader.req; + } + + getProperty(property) { + switch (property) { + case PP_URLResponseProperty.PP_URLRESPONSEPROPERTY_URL: + return new String_PP_Var(this.req.responseURL); + case PP_URLResponseProperty.PP_URLRESPONSEPROPERTY_STATUSCODE: + return new Int32_PP_Var(this.req.status); + case PP_URLResponseProperty.PP_URLRESPONSEPROPERTY_STATUSLINE: + return new String_PP_Var(this.req.statusText); + case PP_URLResponseProperty.PP_URLRESPONSEPROPERTY_HEADERS: + return new String_PP_Var(this.req.getAllResponseHeaders().split("\r\n").join("\n")); + } + } +} +class View extends PP_Resource { +} + +class IMEInputEvent extends InputEvent { + constructor (instance, event) { + super(instance, event); + let clauseArray = event.ranges; + if (event.type == "text" && clauseArray) { + for (let i = 0; i < clauseArray.length - 1; ++i) { + if (clauseArray[i].isTargetClause) { + this.targetSegment = i; + break; + } + } + this.segmentOffset = []; + this.segmentOffset[0] = 0; + let data = event.data; + let encoder = new TextEncoder("utf-8"); + for (let i = 0, len = 0; i < clauseArray.length - 1; ++i) { + for (let j = clauseArray[i].startOffset; j < clauseArray[i].endOffset; ++j) { + len += encoder.encode(data[j]).length; + } + this.segmentOffset[i + 1] = len; + } + } + } +} +class KeyboardInputEvent extends InputEvent { +} +class MouseInputEvent extends InputEvent { +} +class TouchInputEvent extends InputEvent { +} +class WheelInputEvent extends InputEvent { +} + +const EventTypeArray = [ + [PP_InputEvent_Class.PP_INPUTEVENT_CLASS_KEYBOARD, + KeyboardInputEvent, + [["keydown", PP_InputEvent_Type.PP_INPUTEVENT_TYPE_KEYDOWN], + ["keyup", PP_InputEvent_Type.PP_INPUTEVENT_TYPE_KEYUP], + ["keypress", PP_InputEvent_Type.PP_INPUTEVENT_TYPE_CHAR]]], + [PP_InputEvent_Class.PP_INPUTEVENT_CLASS_WHEEL, + WheelInputEvent, + [["wheel", PP_InputEvent_Type.PP_INPUTEVENT_TYPE_WHEEL]]], + [PP_InputEvent_Class.PP_INPUTEVENT_CLASS_MOUSE, + MouseInputEvent, + [["mousedown", PP_InputEvent_Type.PP_INPUTEVENT_TYPE_MOUSEDOWN], + ["mouseup", PP_InputEvent_Type.PP_INPUTEVENT_TYPE_MOUSEUP], + ["mousemove", PP_InputEvent_Type.PP_INPUTEVENT_TYPE_MOUSEMOVE], + ["mouseenter", PP_InputEvent_Type.PP_INPUTEVENT_TYPE_MOUSEENTER], + ["mouseleave", PP_InputEvent_Type.PP_INPUTEVENT_TYPE_MOUSELEAVE], + ["contextmenu", PP_InputEvent_Type.PP_INPUTEVENT_TYPE_CONTEXTMENU]]], + [PP_InputEvent_Class.PP_INPUTEVENT_CLASS_IME, + IMEInputEvent, + [["compositionstart", PP_InputEvent_Type.PP_INPUTEVENT_TYPE_IME_COMPOSITION_START], + ["text", PP_InputEvent_Type.PP_INPUTEVENT_TYPE_IME_COMPOSITION_UPDATE], + ["compositionend", PP_InputEvent_Type.PP_INPUTEVENT_TYPE_IME_COMPOSITION_END], + //There is no strict equivalent in Gecko for PP_INPUTEVENT_TYPE_IME_TEXT. + //["text", PP_InputEvent_Type.PP_INPUTEVENT_TYPE_IME_TEXT] + ]], +]; + +// Map from PP_InputEvent_Class to an array of DOM event name strings. +const EventTypesByClass = EventTypeArray.reduce((map, [eventClass, resourceCtor, events]) => { + map.set(eventClass, events.map(([domEvent, ppapiEvent]) => domEvent)); + return map; + }, new Map()); + +// Map from DOM event name to an object with properties resourceCtor (PP_Resource constructor) and eventType (PP_InputEvent_Type value). +const EventTypes = EventTypeArray.reduce((map, [eventClass, resourceCtor, events]) => { + events.forEach(([domEvent, ppapiEvent]) => { + map.set(domEvent, { resourceCtor: resourceCtor, eventType: ppapiEvent, eventClass: eventClass }); + }); + return map; + }, new Map()); + +// Map from PP_InputEvent_Type to DOM event name. +const EventByTypes = EventTypeArray.reduce((map, [eventClass, resourceCtor, events]) => { + events.forEach(([domEvent, ppapiEvent]) => { + map.set(ppapiEvent, domEvent); + }); + return map; + }, new Map()); + +// Special case for PP_INPUTEVENT_TYPE_IME_TEXT, there is no strict equivalent +// in Gecko, use compositionend. +EventByTypes.set(PP_InputEvent_Type.PP_INPUTEVENT_TYPE_IME_TEXT, "compositionend"); + +const ModifierMap = [ + [ "Shift", PP_InputEvent_Modifier.PP_INPUTEVENT_MODIFIER_SHIFTKEY ], + [ "Control", PP_InputEvent_Modifier.PP_INPUTEVENT_MODIFIER_CONTROLKEY ], + [ "Alt", PP_InputEvent_Modifier.PP_INPUTEVENT_MODIFIER_ALTKEY ], + [ "Meta", PP_InputEvent_Modifier.PP_INPUTEVENT_MODIFIER_METAKEY ], + [ "CapsLock", PP_InputEvent_Modifier.PP_INPUTEVENT_MODIFIER_CAPSLOCKKEY ], + [ "NumLock", PP_InputEvent_Modifier.PP_INPUTEVENT_MODIFIER_NUMLOCKKEY ], +]; + +// An abstract object to expose and handle all viewport-related properties and +// operations, so we can seperate the UI logic from other parts in runtime. +// Methods below can be overridden separately in UI layer by creating a +// "createCustomViewport" function in "viewer.html" returning an object with the +// same methods. It is useful if you want to customize your layout in UI layer. +class PPAPIViewport { + constructor(instance) { + this._window = instance.window; + this._defaultEventTarget = instance.eventHandler; + + if (typeof this._window.createCustomViewport === "function") { + let customViewport = this._window.createCustomViewport( + instance.viewportActionHandler.bind(instance)); + Object.setPrototypeOf(customViewport, this); + return customViewport; + } + } + + // Appends a canvas to the viewport + addView(canvas) { + this._window.document.body.appendChild(canvas); + } + + // Removes all canvases from the viewport + clearView() { + Array.from(this._window.document.body.getElementsByTagName("canvas")) + .forEach(canvas => canvas.remove()); + } + + // Returns the size of the viewport and its position relative to the window. + getBoundingClientRect() { + return this._window.document.body.getBoundingClientRect(); + } + + // Returns a Boolean indicating whether an element is considered the viewport. + is(element) { + return element == this._window.document.body; + } + + // Binds the specified listener on the viewport. Note that it will find the + // right DOM element to bind according to the event type. + bindUIEvent(type, listener) { + this._getEventTarget(type).addEventListener(type, listener); + } + + // Removes the specified listener from the viewport. + unbindUIEvent(type, listener) { + this._getEventTarget(type).removeEventListener(type, listener); + } + + // Sets the mouse cursor style of the viewport + setCursor(cursor) { + this._window.document.body.style.cursor = cursor; + } + + // Returns the position that the viewport has already been scrolled. + getScrollOffset() { + return { + x: this._window.scrollX, + y: this._window.scrollY + }; + } + + // PRIVATE: Returns the right DOM element for event binding. + _getEventTarget(type) { + switch(type) { + case 'fullscreenchange': + case 'MozScrolledAreaChanged': + return this._window.document; + case 'resize': + case 'focus': + case 'blur': + return this._window; + default: + return this._defaultEventTarget; + } + } +} + +class PPAPIInstance { + constructor(id, rt, info, window, eventHandler, containerWindow, mm) { + this.id = id; + this.rt = rt; + this.info = info; + this.window = window; + this.eventHandler = eventHandler; + this.containerWindow = containerWindow; + this.mm = mm; + this.eventHandlers = 0; + this.filteringEventHandlers = 0; + this.throttled_ = false; + this.cachedImageData = null; + this.viewport = new PPAPIViewport(this); + this.selectedText = ""; + + this.mm.addMessageListener("ppapi.js:fullscreenchange", (evt) => { + this.viewport.notify({ + type: "fullscreenChange", + fullscreen: evt.data.fullscreen + }); + }); + } + + bindGraphics(graphicsDevice) { + if (graphicsDevice) { + let canvas = graphicsDevice.canvas; + + // FIXME This size should be adjusted according to devicePixelRatio. + canvas.style.width = canvas.width; + canvas.style.height = canvas.height; + + // Attach the canvas of this Graphics object to DOM for displaying. + this.viewport.addView(canvas); + } else { + // Unbind all graphics objects, which means remove all canvas elements from DOM. + this.viewport.clearView(); + } + } + handleEvent(event) { + dump(`EVENT ${event.type}\n`); + if ((event.type == "keydown" || event.type == "keyup") && + event.keyCode == 224) { + return; + } + if (event.type == "keypress" && event.charCode === 0) { + return; + } + + // To avoid cursor misalignment, we regenerate the mouse event which + // position is based on coordinate (0, 0) of viewport + let eventType = EventTypes.get(event.type); + let resource; + if (event instanceof this.window.MouseEvent) { + let rect = this.boundingRect; + let mouseEventInit = { + altkey: event.altkey, + button: event.button, + clientX: event.clientX - rect.left, + clientY: event.clientY - rect.top, + ctrlKey: event.ctrlKey, + detail: event.detail, + metaKey: event.metaKey, + movementX: event.movementX - rect.left, + movementY: event.movementY - rect.top, + shiftKey: event.shiftKey, + }; + let offset_evt = new this.window.MouseEvent(event.type, mouseEventInit); + resource = new eventType.resourceCtor(this, offset_evt); + resource.timeStamp = event.timeStamp; + } else { + resource = new eventType.resourceCtor(this, event); + } + + // We should only use sync call for filtering events + if (this.filteringEventHandlers & eventType.eventClass) { + let handled = this.rt.call(new InterfaceMemberCall("PPP_InputEvent;0.1", "HandleInputEvent", { instance: this, input_event: resource }), true); + if (handled) { + event.stopPropagation(); + } else { + // FIXME Retarget at frameElement! + } + } else { + this.rt.call(new InterfaceMemberCall("PPP_InputEvent;0.1", "HandleInputEvent", { instance: this, input_event: resource })); + } + + if (event.type == "compositionend") { + resource = new eventType.resourceCtor(this, event); + resource.eventType = PP_InputEvent_Type.PP_INPUTEVENT_TYPE_IME_TEXT; + if (this.filteringEventHandlers & eventType.eventClass) { + throw new Error("Add code for filtering for PP_INPUTEVENT_TYPE_IME_TEXT."); + } + this.rt.call(new InterfaceMemberCall("PPP_InputEvent;0.1", "HandleInputEvent", { instance: this, input_event: resource })); + } + } + registerEventHandler(eventClasses, filtering) { + let handler = this.handleEvent.bind(this); + let target = this.eventHandler; + let registeredHandlers = this.eventHandlers | this.filteringEventHandlers; + EventTypesByClass.forEach((domEvents, eventClass) => { + if ((eventClasses & eventClass) && !(registeredHandlers & eventClass)) { + domEvents.forEach((domEvent) => { + if (domEvent == "text") { + Cc["@mozilla.org/eventlistenerservice;1"].getService(Ci.nsIEventListenerService). + addSystemEventListener(target, "text", handler, true); + } else { + this.viewport.bindUIEvent(domEvent, handler); + } + }); + } + }); + + if (filtering) { + this.eventHandlers &= ~eventClasses; + this.filteringEventHandlers |= eventClasses; + } else { + this.eventHandlers |= eventClasses; + this.filteringEventHandlers &= ~eventClasses; + } + return PP_OK; + } + get throttled() { + return this.throttled_; + } + set throttled(on) { + if (this.throttled_ != on) { + this.throttled_ = on; + let view = new View(this); + let call = new InterfaceMemberCall("PPP_Instance;1.1", "DidChangeView", { instance: this, view }); + this.rt.call(call, true); + } + } + get boundingRect() { + if (!this.boundingRect_) { + this.boundingRect_ = this.viewport.getBoundingClientRect(); + } + return this.boundingRect_; + } + + toJSON() { + return this.id; + } + + viewportActionHandler(message) { + switch(message.type) { + case 'setFullscreen': + this.mm.sendAsyncMessage("ppapi.js:setFullscreen", message.fullscreen); + break; + case 'viewport': + case 'rotateClockwise': + case 'rotateCounterclockwise': + case 'selectAll': + case 'getSelectedText': + case 'getNamedDestination': + case 'getPasswordComplete': + let data = PP_Var.fromJSValue(new Dictionary(message), this); + this.rt.call(new InterfaceMemberCall("PPP_Messaging;1.0", "HandleMessage", + { instance: this, var: data })); + break; + default: + throw new Error(`Invalid message type "${message.type}".`); + } + } + selectFindResult(isForward) { + let forward = Bool_PP_Var.convertValue(isForward); + this.rt.call(new InterfaceMemberCall("PPP_Find_Private;0.3", "SelectFindResult", + { instance: this, forward })); + } + startFind(term, isCaseSensitive) { + let case_sensitive = Bool_PP_Var.convertValue(isCaseSensitive); + this.rt.call(new InterfaceMemberCall("PPP_Find_Private;0.3", "StartFind", + { instance: this, text: term, case_sensitive })); + } + stopFind() { + this.rt.call(new InterfaceMemberCall("PPP_Find_Private;0.3", "StopFind", + { instance: this })); + } + didChangeFocus() { + if (this.focusChangeTimeout) { + this.window.clearTimeout(this.focusChangeTimeout); + } + // we use setTimeout to hold a small amount of time to + // make sure the focus state is stable. + this.focusChangeTimeout = this.window.setTimeout(() => { + let focusState = PP_Bool.PP_FALSE; + if (this.window.document.hasFocus() && + (this.viewport.is(this.window.document.activeElement) || + this.window.document.activeElement == this.window.document.getElementById('IMEInput'))) { + focusState = PP_Bool.PP_TRUE; + } + if (this.focusState != focusState) { + this.focusState = focusState; + let call = new InterfaceMemberCall("PPP_Instance;1.1", "DidChangeFocus", { instance: this, has_focus: focusState }); + this.rt.call(call, true); + } + }); + } + copyString() { + // Prevent user from calling copy without selecting any text and rewrite + // an empty string into clipboard. + if (!this.selectedText) { + return; + } + + let clipboardHelper = + Components.classes["@mozilla.org/widget/clipboardhelper;1"]. + getService(Components.interfaces.nsIClipboardHelper); + clipboardHelper.copyString(this.selectedText); + } +} + +function PPAPIRuntime(process) { + this.instances = []; + this.process = process; + this.urlParser = Cc["@mozilla.org/network/url-parser;1?auth=maybe"] + .getService(Ci.nsIURLParser); +} + +PPAPIRuntime.prototype = { + get callback() { + return this.handler.bind(this); + }, + handler: function(json) { + let obj; + try { + obj = JSON.parse(json); + } catch (e) { + dump(e.message + "\n"); + let result = e.message.match(/line (\d+) column (\d+)/); + if (result) { + dump(" " + json + "\n"); + dump(" " + new Array(parseInt(result[2], 10)).join("-") + "^\n"); + } + } + if (!obj || !obj.__interface || !obj.__version || !obj.__method) { + dump("Invalid JSON RPC call: " + json + "\n"); + return null; + } + let fn = obj.__interface + "_" + obj.__method; + let f = this.table[fn]; + if (!f) { + dump( +`Not implemented: ${json} + /** + * + */ + ${obj.__interface}_${obj.__method}: function(json) { + }, + +`); + return null; + } + let result = f.call(this, obj); + if (typeof result == 'undefined') { + return null; + } + return JSON.stringify([result]); + }, + + toPP_Var: function(v, instance) { + return PP_Var.fromJSValue(v, instance); + }, + + parseURL: function(url) { + let schemePos = {}, schemeLen = {}; + let authorityPos = {}, authorityLen = {}; + let pathPos = {}, pathLen = {}; + this.urlParser.parseURL(url, url.length, schemePos, schemeLen, authorityPos, + authorityLen, pathPos, pathLen); + let usernamePos = {}, usernameLen = {}; + let passwordPos = {}, passwordLen = {}; + let hostnamePos = {}, hostnameLen = {}; + let port = {}; + this.urlParser.parseAuthority(url.substr(authorityPos.value, authorityLen.value), + authorityLen.value, usernamePos, usernameLen, + passwordPos, passwordLen, hostnamePos, hostnameLen, + port); + let portPos = port < 0 ? 0 : hostnamePos.value + hostnameLen.value + 1; + let portLen = port < 0 ? -1 : pathPos.value - portPos; + let filepathPos = {}, filepathLen = {}; + let queryPos = {}, queryLen = {}; + let refPos = {}, refLen = {}; + this.urlParser.parsePath(url.substr(pathPos.value, pathLen.value), + pathLen.value, filepathPos, filepathLen, queryPos, + queryLen, refPos, refLen); + return { + scheme: { begin: Math.min(0, schemePos.value), len: schemeLen.value }, + username: { begin: Math.min(0, usernamePos.value), len: usernameLen.value }, + password: { begin: Math.min(0, passwordPos.value), len: passwordLen.value }, + host: { begin: Math.min(0, hostnamePos.value), len: hostnameLen.value }, + port: { begin: portPos, len: portLen }, + path: { begin: Math.min(0, filepathPos.value), len: filepathLen.value }, + query: { begin: Math.min(0, queryPos.value), len: queryLen.value }, + ref: { begin: Math.min(0, refPos.value), len: refLen.value }, + }; + }, + + allocateCachedBuffer: function(size) { + return this.process.allocateCachedBuffer(size); + }, + getCachedBuffer: function(ptr) { + return this.process.getCachedBuffer(ptr); + }, + freeCachedBuffer: function(ptr) { + this.process.freeCachedBuffer(ptr); + }, + setBuffer: function(dest, source, size=source.byteLength) { + return this.process.setBuffer(source, size, dest); + }, + copyBuffer: function(ptr, size) { + return this.process.copyFromBuffer(ptr, size); + }, + + get moduleLocalFiles() { + if (!("_moduleLocalFiles" in this)) { + this._moduleLocalFiles = Cc['@mozilla.org/file/local;1'].createInstance(Ci.nsIFile); + this._moduleLocalFiles.initWithPath(Services.cpmm.sendRpcMessage("ppapiflash.js:getModuleLocalFilesPath")); + } + return this._moduleLocalFiles; + }, + + createInstance: function(instanceInfo, window, eventHandler, containerWindow, mm) { + let i = 0; + for (; i < this.instances.length; ++i) { + if (!(i in this.instances)) { + break; + } + } + + let instance = this.instances[i] = new PPAPIInstance(i, this, instanceInfo, window, eventHandler, containerWindow, mm); + + let didChangeView = this.didChangeView.bind(this, instance); + instance.viewport.bindUIEvent("MozScrolledAreaChanged", didChangeView); + instance.viewport.bindUIEvent("fullscreenchange", didChangeView); + instance.viewport.bindUIEvent("resize", didChangeView); + instance.viewport.bindUIEvent("blur", instance.didChangeFocus.bind(instance)); + instance.viewport.bindUIEvent("focus", instance.didChangeFocus.bind(instance)); + + let argn = instanceInfo.arguments.keys; + let argv = instanceInfo.arguments.values; + + this.call(new InterfaceMemberCall("PPP_Instance;1.1", "DidCreate", { instance: i, argc: argn.length, argn: argn, argv: argv }), true); + if (instanceInfo.setupJSInstanceObject) { + let jsObj = this.call(new InterfaceMemberCall("PPP_Instance_Private;0.1", "GetInstanceObject", { instance: i }), true); + if (PP_VarType[jsObj.type] == PP_VarType.PP_VARTYPE_OBJECT) { + instance.mm.sendRpcMessage("ppapiflash.js:setInstancePrototype", undefined, { proto: Object_PP_Var.getAsJSValue(jsObj) }); + } + } + + if (instanceInfo.isFullFrame) { + let loader = new URLLoader(instance); + loader.openURL("GET", instanceInfo.url, + (result) => { this.call(new InterfaceMemberCall("PPP_Instance;1.1", "HandleDocumentLoad", { instance, url_loader: loader })); }); + } + this.didChangeView(instance); + return i; + }, + destroyInstances: function() { + for (let i of this.instances) { + this.destroyInstance(i, false); + } + this.instances.length = 0; + }, + destroyInstance: function(instance, truncateInstancesArray=true) { + this.call(new InterfaceMemberCall("PPP_Instance;1.1", "DidDestroy", { instance: instance }), true); + delete this.instances[instance]; + if (truncateInstancesArray) { + let i = this.instances.length; + while (--i >= 0) { + if (i in this.instances) { + break; + } + } + this.instances.length = i + 1; + } + }, + hasInstances: function() { + return this.instances.some(() => true); + }, + didChangeView: function(instance) { + // In case of |getBoundingClientRect()| will reflush the layout and cause + // bad performance, we cache the bounding rectangle for frequently + // regenerating the offset mouse event. + instance.boundingRect_ = instance.viewport.getBoundingClientRect(); + + let view = new View(instance); + let call = new InterfaceMemberCall("PPP_Instance;1.1", "DidChangeView", { instance, view }); + this.call(call, true); + }, + + call: function(call, sync=false) { + if (sync) { +dump(`callFromJSON: > ${JSON.stringify(call)}\n`); + let result = this.process.sendMessage(JSON.stringify(call)); +dump(`callFromJSON: < ${JSON.stringify(call)}\n`); + return result ? JSON.parse(result) : result; + } + + let thread = Services.tm.currentThread; + thread.dispatch(() => { +dump(`callFromJSON (async): > ${JSON.stringify(call)}\n`); + let result = this.process.sendMessage(JSON.stringify(call)); +dump(`callFromJSON: < ${JSON.stringify(call)}\n`); + }, Ci.nsIThread.DISPATCH_NORMAL); + }, + + table: { + /** + * PP_Resource Create( + * [in] PP_Instance instance, + * [in] PP_Resource config, + * [in] PPB_Audio_Callback audio_callback, + * [inout] mem_t user_data); + * */ + PPB_Audio_Create: function(json) { + let instance = this.instances[json.instance]; + let config = PP_Resource.lookup(json.config); + return new Audio(instance, config.bufferSize, config.frameCount, + json.audio_callback, json.user_data); + }, + + /** + * PP_Bool StartPlayback( + * [in] PP_Resource audio); + */ + PPB_Audio_StartPlayback: function(json) { + let audio = PP_Resource.lookup(json.audio); + audio.start(); + return PP_Bool.PP_TRUE; + }, + + /** + * PP_Bool StopPlayback( + * [in] PP_Resource audio); + */ + PPB_Audio_StopPlayback: function(json) { + let audio = PP_Resource.lookup(json.audio); + audio.stop(); + return PP_Bool.PP_TRUE; + }, + + /** + * PP_Resource CreateStereo16Bit( + * [in] PP_Instance instance, + * [in] PP_AudioSampleRate sample_rate, + * [in] uint32_t sample_frame_count); + */ + PPB_AudioConfig_CreateStereo16Bit: function(json) { + return new AudioConfig(this.instances[json.instance], + json.sample_frame_count); + }, + + /** + * uint32_t RecommendSampleFrameCount( + * [in] PP_Instance instance, + * [in] PP_AudioSampleRate sample_rate, + * [in] uint32_t requested_sample_frame_count); + */ + PPB_AudioConfig_RecommendSampleFrameCount: function(json) { + let rate = Math.pow(2, Math.ceil(Math.log2(json.sample_rate))); + return Math.max(256, Math.min(rate, 16384)); + }, + + /** + * PP_Resource Create( + * [in] PP_Instance instance); + */ + PPB_AudioInput_Dev_Create: function(json) { + return 0; + }, + + /** + * int32_t EnumerateDevices( + * [in] PP_Resource audio_input, + * [in] PP_ArrayOutput output, + * [in] PP_CompletionCallback callback); + */ + PPB_AudioInput_Dev_EnumerateDevices: function(json) { + return PP_ERROR_BADRESOURCE; + }, + + + /** + * PP_Var GetFontFamilies( + * [in] PP_Instance instance); + */ + PPB_BrowserFont_Trusted_GetFontFamilies: function(json) { + let instance = this.instances[json.instance]; + let enumerator = Cc["@mozilla.org/gfx/fontenumerator;1"].createInstance(Ci.nsIFontEnumerator); + return new String_PP_Var(enumerator.EnumerateAllFonts({}).join('\0'), instance); + }, + + /** + * PP_Resource Create( + * [in] PP_Instance instance, + * [in] PP_BrowserFont_Trusted_Description description); + */ + PPB_BrowserFont_Trusted_Create: function(json) { + return new BrowserFont_Trusted(this.instances[json.instance], + json.description); + }, + + /** + * PP_Bool Describe( + * [in] PP_Resource font, + * [out] PP_BrowserFont_Trusted_Description description, + * [out] PP_BrowserFont_Trusted_Metrics metrics); + */ + PPB_BrowserFont_Trusted_Describe: function(json) { + let font = PP_Resource.lookup(json.font); + let description = Object.assign({}, font.description); + if (font.customFamily) { + description.face = new String_PP_Var(font.customFamily); + } else { + description.face = new Undefined_PP_Var(); + } + description.family = PP_BrowserFont_Trusted_Family[description.family]; + description.weight = PP_BrowserFont_Trusted_Weight[description.weight]; + description.italic = PP_Bool[description.italic]; + description.small_caps = PP_Bool[description.small_caps]; + return [PP_Bool.PP_TRUE, { description: description, metrics: { height: 12, ascent: 12, descent: 12, line_spacing: 12, x_height: 12 } }]; + }, + + /** + * PP_Bool DrawTextAt( + * [in] PP_Resource font, + * [in] PP_Resource image_data, + * [in] PP_BrowserFont_Trusted_TextRun text, + * [in] PP_Point position, + * [in] uint32_t color, + * [in] PP_Rect clip, + * [in] PP_Bool image_data_is_opaque); + */ + PPB_BrowserFont_Trusted_DrawTextAt: function(json) { + let font = PP_Resource.lookup(json.font); + let imageData = PP_Resource.lookup(json.image_data); + let textType = PP_VarType[json.text.text.type]; + let text; + if (textType == PP_VarType.PP_VARTYPE_UNDEFINED || + textType == PP_VarType.PP_VARTYPE_NULL) { + text = ""; + } else { + text = String_PP_Var.getAsJSValue(json.text.text); + } + let context = imageData.beginDrawing(); + context.font = font.fontRule; + let r = ((json.color & (0xff << 0)) >>> 0); + let g = ((json.color & (0xff << 8)) >>> 8); + let b = ((json.color & (0xff << 16)) >>> 16); + let a = ((json.color & (0xff << 24)) >>> 24) / 255; + // It seems the color matches its ImageData format. + context.fillStyle = `rgba(${r}, ${g}, ${b}, ${a})`; + let { x, y } = json.position; + let { point: { x: clipX, y: clipY }, size: { width: clipW, height: clipH } } = json.clip; + context.rect(clipX, clipY, clipW, clipH); + context.clip(); + context.fillText(text, x, y); + //dump(context.canvas.toDataURL() + "\n"); + imageData.endDrawing(); + return PP_Bool.PP_TRUE; + }, + + /** + * int32_t MeasureText( + * [in] PP_Resource font, + * [in] PP_TextRun_Dev text); + */ + PPB_BrowserFont_Trusted_MeasureText: function(json) { + let font = PP_Resource.lookup(json.font); + let textType = PP_VarType[json.text.text.type]; + let text; + if (textType == PP_VarType.PP_VARTYPE_UNDEFINED || + textType == PP_VarType.PP_VARTYPE_NULL) { + text = ""; + } else { + text = String_PP_Var.getAsJSValue(json.text.text); + } + return font.measureText(text); + }, + + + /** + * PP_Resource Create( + * [in] PP_Instance instance, + * [in] uint32_t size_in_bytes); + */ + PPB_Buffer_Dev_Create: function(json) { + return new Buffer(this.instances[json.instance], + json.size_in_bytes); + }, + + /** + * PP_Bool Describe( + * [in] PP_Resource resource, + * [out] uint32_t size_in_bytes); + */ + PPB_Buffer_Dev_Describe: function(json) { + let buffer = PP_Resource.lookup(json.resource); + return [PP_Bool.PP_TRUE, { size_in_bytes: buffer.size }]; + }, + + /** + * mem_t Map( + * [in] PP_Resource resource); + */ + PPB_Buffer_Dev_Map: function(json) { + let buffer = PP_Resource.lookup(json.resource); + return buffer.map(); + }, + + /** + * void Unmap( + * [in] PP_Resource resource); + */ + PPB_Buffer_Dev_Unmap: function(json) { + let buffer = PP_Resource.lookup(json.resource); + buffer.unmap(); + }, + + + /** + * PP_Var GetDefaultCharSet([in] PP_Instance instance); + */ + PPB_CharSet_Dev_GetDefaultCharSet: function(json) { + return new String_PP_Var("utf-8"); + }, + + /** + * str_t UTF16ToCharSet([in] PP_Instance instance, + * [in, size_as=utf16_len] uint16_t[] utf16, + * [in] uint32_t utf16_len, + * [in] str_t output_char_set, + * [in] PP_CharSet_ConversionError on_error, + * [out] uint32_t output_length); + */ + PPB_CharSet_Dev_UTF16ToCharSet: function(json) { + let instance = this.instances[json.instance]; + let utf16 = Uint16Array.from(json.utf16); + let decoded = new TextDecoder("utf-16").decode(utf16); + let converted = new TextEncoder(json.output_char_set).encode(decoded); + return [Array.from(new Uint8Array(converted)), { output_length: converted.buffer.byteLength }]; + }, + + /** + * uint16_ptr_t CharSetToUTF16([in] PP_Instance instance, + * [in] str_t input, + * [in] uint32_t input_len, + * [in] str_t input_char_set, + * [in] PP_CharSet_ConversionError on_error, + * [out] uint32_t output_utf16_length); + */ + PPB_CharSet_Dev_CharSetToUTF16: function(json) { + let instance = this.instances[json.instance]; + let input = Uint8ClampedArray.from(json.input); + let decoded = new TextDecoder(json.input_char_set).decode(input); + let converted = new TextEncoder("utf-16").encode(decoded); + return [Array.from(new Uint16Array(converted.buffer)), { output_utf16_length: converted.byteLength / 2 }]; + }, + + + /** + * void Log( + * [in] PP_Instance instance, + * [in] PP_LogLevel level, + * [in] PP_Var value); + */ + PPB_Console_Log: function(json) { + let instance = this.instances[json.instance]; + dump("FROM FLASH: " + String_PP_Var.getAsJSValue(json.value) + "\n"); + instance.mm.sendRpcMessage("ppapiflash.js:log", String_PP_Var.getAsJSValue(json.value)); + }, + + + /** + * void AddRefResource([in] PP_Resource resource); + */ + PPB_Core_AddRefResource: function(json) { + PP_Resource.lookup(json.resource).addRef(); + }, + + /** + * void ReleaseResource([in] PP_Resource resource); + */ + PPB_Core_ReleaseResource: function(json) { + PP_Resource.lookup(json.resource).release(); + }, + + /** + * PP_Time GetTime(); + */ + PPB_Core_GetTime: function(json) { + return Date.now() / 1000; + }, + + /** + * void CallOnMainThread( + * [in] int32_t delay_in_milliseconds, + * [in] PP_CompletionCallback callback, + * [in] int32_t result); + */ + PPB_Core_CallOnMainThread: function(json) { + let callback = new CallbackCall("PP_CompletionCallback", json.callback, { result: json.result }); + if (json.delay_in_milliseconds > 0) { + // It'd be better if we had the instance so we could use setTimeout on + // the window. + let timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer); + timer.initWithCallback(() => { this.call(callback); }, + json.delay_in_milliseconds, + Ci.nsITimer.TYPE_ONE_SHOT); + } else { + this.call(callback); + } + }, + + /** + * PP_Bool IsMainThread(); + PPB_Core_IsMainThread: function(json, mainThread) { + return mainThread ? PP_Bool.PP_TRUE : PP_Bool.PP_FALSE; + }, + */ + + /** + * void GetRandomBytes([out] str_t buffer, [in] uint32_t num_bytes); + */ + PPB_Crypto_Dev_GetRandomBytes: function(json) { + let bytes = Services.cpmm.sendRpcMessage("ppapi.js:generateRandomBytes", json.num_bytes); + return [{ buffer: bytes }]; + }, + + /** + * PP_Bool SetCursor([in] PP_Instance instance, + * [in] PP_CursorType_Dev type, + * [in] PP_Resource custom_image, + * [in] PP_Point hot_spot); + */ + PPB_CursorControl_Dev_SetCursor: function(json) { + let instance = this.instances[json.instance]; + let cursor; + switch (PP_CursorType_Dev[json.type]) { + case PP_CursorType_Dev.PP_CURSORTYPE_CUSTOM: + throw new Error("Custom cursors not implemented."); + case PP_CursorType_Dev.PP_CURSORTYPE_POINTER: + cursor = "default"; + break; + case PP_CursorType_Dev.PP_CURSORTYPE_CROSS: + cursor = "crosshair"; + break; + case PP_CursorType_Dev.PP_CURSORTYPE_HAND: + cursor = "pointer"; + break; + case PP_CursorType_Dev.PP_CURSORTYPE_IBEAM: + cursor = "text"; + break; + case PP_CursorType_Dev.PP_CURSORTYPE_WAIT: + cursor = "wait"; + break; + case PP_CursorType_Dev.PP_CURSORTYPE_HELP: + cursor = "help"; + break; + case PP_CursorType_Dev.PP_CURSORTYPE_EASTRESIZE: + cursor = "e-resize"; + break; + case PP_CursorType_Dev.PP_CURSORTYPE_NORTHRESIZE: + cursor = "n-resize"; + break; + case PP_CursorType_Dev.PP_CURSORTYPE_NORTHEASTRESIZE: + cursor = "ne-resize"; + break; + case PP_CursorType_Dev.PP_CURSORTYPE_NORTHWESTRESIZE: + cursor = "nw-resize"; + break; + case PP_CursorType_Dev.PP_CURSORTYPE_SOUTHRESIZE: + cursor = "s-resize"; + break; + case PP_CursorType_Dev.PP_CURSORTYPE_SOUTHEASTRESIZE: + cursor = "se-resize"; + break; + case PP_CursorType_Dev.PP_CURSORTYPE_SOUTHWESTRESIZE: + cursor = "sw-resize"; + break; + case PP_CursorType_Dev.PP_CURSORTYPE_WESTRESIZE: + cursor = "w-resize"; + break; + case PP_CursorType_Dev.PP_CURSORTYPE_NORTHSOUTHRESIZE: + cursor = "ns-resize"; + break; + case PP_CursorType_Dev.PP_CURSORTYPE_EASTWESTRESIZE: + cursor = "ew-resize"; + break; + case PP_CursorType_Dev.PP_CURSORTYPE_NORTHEASTSOUTHWESTRESIZE: + cursor = "nesw-resize"; + break; + case PP_CursorType_Dev.PP_CURSORTYPE_NORTHWESTSOUTHEASTRESIZE: + cursor = "nwse-resize"; + break; + case PP_CursorType_Dev.PP_CURSORTYPE_COLUMNRESIZE: + cursor = "col-resize"; + break; + case PP_CursorType_Dev.PP_CURSORTYPE_ROWRESIZE: + cursor = "row-resize"; + break; + case PP_CursorType_Dev.PP_CURSORTYPE_MIDDLEPANNING: + case PP_CursorType_Dev.PP_CURSORTYPE_EASTPANNING: + case PP_CursorType_Dev.PP_CURSORTYPE_NORTHPANNING: + case PP_CursorType_Dev.PP_CURSORTYPE_NORTHEASTPANNING: + case PP_CursorType_Dev.PP_CURSORTYPE_NORTHWESTPANNING: + case PP_CursorType_Dev.PP_CURSORTYPE_SOUTHPANNING: + case PP_CursorType_Dev.PP_CURSORTYPE_SOUTHEASTPANNING: + case PP_CursorType_Dev.PP_CURSORTYPE_SOUTHWESTPANNING: + case PP_CursorType_Dev.PP_CURSORTYPE_WESTPANNING: + throw new Error("Panning cursors not implemented."); + case PP_CursorType_Dev.PP_CURSORTYPE_MOVE: + cursor = "move"; + break; + case PP_CursorType_Dev.PP_CURSORTYPE_VERTICALTEXT: + cursor = "vertical-text"; + break; + case PP_CursorType_Dev.PP_CURSORTYPE_CELL: + cursor = "cell"; + break; + case PP_CursorType_Dev.PP_CURSORTYPE_CONTEXTMENU: + cursor = "context-menu"; + break; + case PP_CursorType_Dev.PP_CURSORTYPE_ALIAS: + cursor = "alias"; + break; + case PP_CursorType_Dev.PP_CURSORTYPE_PROGRESS: + cursor = "progress"; + break; + case PP_CursorType_Dev.PP_CURSORTYPE_NODROP: + cursor = "no-drop"; + break; + case PP_CursorType_Dev.PP_CURSORTYPE_COPY: + cursor = "copy"; + break; + case PP_CursorType_Dev.PP_CURSORTYPE_NONE: + cursor = "none"; + break; + case PP_CursorType_Dev.PP_CURSORTYPE_NOTALLOWED: + cursor = "not-allowed"; + break; + case PP_CursorType_Dev.PP_CURSORTYPE_ZOOMIN: + cursor = "zoom-in"; + break; + case PP_CursorType_Dev.PP_CURSORTYPE_ZOOMOUT: + cursor = "zoom-out"; + break; + case PP_CursorType_Dev.PP_CURSORTYPE_GRAB: + cursor = "grab"; + break; + case PP_CursorType_Dev.PP_CURSORTYPE_GRABBING: + cursor = "grabbing"; + break; + } + instance.viewport.setCursor(cursor); + return PP_Bool.PP_TRUE; + }, + + + /** + * void NumberOfFindResultsChanged( + * [in] PP_Instance instance, + * [in] int32_t total, + * [in] PP_Bool final_result); + */ + PPB_Find_Private_NumberOfFindResultsChanged: function(json) { + let instance = this.instances[json.instance]; + instance.viewport.notify({ + type: "numberOfFindResultsChanged", + total: json.total, + finalResult: (PP_Bool[json.final_result] == PP_Bool.PP_TRUE), + }); + }, + + /** + * void SelectedFindResultChanged( + * [in] PP_Instance instance, + * [in] int32_t index); + */ + PPB_Find_Private_SelectedFindResultChanged: function(json) { + let instance = this.instances[json.instance]; + instance.viewport.notify({ + type: "selectedFindResultChanged", + index: json.index, + }); + }, + + /** + * void SetTickmarks( + * [in] PP_Instance instance, + * [in, size_as=count] PP_Rect[] tickmarks, + * [in] uint32_t count); + */ + PPB_Find_Private_SetTickmarks: function(json) { + let instance = this.instances[json.instance]; + instance.viewport.notify({ + type: "setTickmarks", + tickmarks: json.tickmarks, + count: json.count, + }); + }, + + + /** + * PP_Bool IsFormatAvailable( + * [in] PP_Instance instance_id, + * [in] PP_Flash_Clipboard_Type clipboard_type, + * [in] uint32_t format); + */ + PPB_Flash_Clipboard_IsFormatAvailable: function(json) { + //FIXME We only support standard clipboard w/ plaintext format + if (PP_Flash_Clipboard_Format[json.clipboard_type] == + PP_Flash_Clipboard_Format.PP_FLASH_CLIPBOARD_TYPE_STANDARD) { + if (json.format == + PP_Flash_Clipboard_Format.PP_FLASH_CLIPBOARD_FORMAT_PLAINTEXT) { + return PP_Bool.PP_TRUE; + } + } + return PP_Bool.PP_FALSE; + }, + + /** + * PP_Var ReadData([in] PP_Instance instance_id, + * [in] PP_Flash_Clipboard_Type clipboard_type, + * [in] uint32_t format); + */ + PPB_Flash_Clipboard_ReadData: function(json) { + //FIXME We only support standard clipboard w/ plaintext format + if (PP_Flash_Clipboard_Format[json.clipboard_type] == + PP_Flash_Clipboard_Format.PP_FLASH_CLIPBOARD_TYPE_STANDARD) { + if (json.format == + PP_Flash_Clipboard_Format.PP_FLASH_CLIPBOARD_FORMAT_PLAINTEXT) { + let trans = Cc["@mozilla.org/widget/transferable;1"] + .createInstance(Ci.nsITransferable); + trans.init(null) + trans.addDataFlavor("text/unicode"); + Services.clipboard.getData( + trans, Services.clipboard.kGlobalClipboard); + let str = {}; + let strLength = {}; + trans.getTransferData("text/unicode", str, strLength); + let pasteText = str.value.QueryInterface(Ci.nsISupportsString).data; + return new String_PP_Var(pasteText); + } + } + return new PP_Var(); + }, + + /** + * int32_t WriteData( + * [in] PP_Instance instance_id, + * [in] PP_Flash_Clipboard_Type clipboard_type, + * [in] uint32_t data_item_count, + * [in, size_is(data_item_count)] uint32_t[] formats, + * [in, size_is(data_item_count)] PP_Var[] data_items); + */ + PPB_Flash_Clipboard_WriteData: function(json) { + //FIXME We only support standard clipboard w/ plaintext format + let clipboardHelper = + Components.classes["@mozilla.org/widget/clipboardhelper;1"]. + getService(Components.interfaces.nsIClipboardHelper); + for (let i = 0; i < json.data_item_count; ++i) { + if (json.formats[i] == + PP_Flash_Clipboard_Format.PP_FLASH_CLIPBOARD_FORMAT_PLAINTEXT) { + clipboardHelper.copyString( + String_PP_Var.getAsJSValue(json.data_items[i])); + } else { + clipboardHelper.copyString(""); + return PP_ERROR_BADARGUMENT; + } + } + return PP_OK; + }, + + + /** + * void SetInstanceAlwaysOnTop( + * [in] PP_Instance instance, + * [in] PP_Bool on_top); + */ + PPB_Flash_SetInstanceAlwaysOnTop: function(json) { + }, + + /** + * double_t GetLocalTimeZoneOffset( + * [in] PP_Instance instance, + * [in] PP_Time t); + */ + PPB_Flash_GetLocalTimeZoneOffset: function(json) { + return (new Date(json.t)).getTimezoneOffset() * 60; + }, + + /** + * PP_Var GetCommandLineArgs( + * [in] PP_Module module); + */ + PPB_Flash_GetCommandLineArgs: function(json) { + // "enable_trace_to_console=1 log_level=5" + return new String_PP_Var("enable_trace_to_console=1 log_level=5"); + }, + + /** + * PP_Var GetSetting(PP_Instance instance, PP_FlashSetting setting); + */ + PPB_Flash_GetSetting: function(json) { + switch (PP_FlashSetting[json.setting]) { + case PP_FlashSetting.PP_FLASHSETTING_3DENABLED: + return new Bool_PP_Var(true); + case PP_FlashSetting.PP_FLASHSETTING_INCOGNITO: + return new Bool_PP_Var(false); + case PP_FlashSetting.PP_FLASHSETTING_STAGE3DENABLED: + return new Bool_PP_Var(true); + case PP_FlashSetting.PP_FLASHSETTING_LANGUAGE: + return new String_PP_Var("en-US"); + case PP_FlashSetting.PP_FLASHSETTING_NUMCORES: + return new Int32_PP_Var(4); + case PP_FlashSetting.PP_FLASHSETTING_LSORESTRICTIONS: + return new Int32_PP_Var(PP_FlashLSORestrictions.PP_FLASHLSORESTRICTIONS_IN_MEMORY); + } + return 0; + }, + + /** + * PP_Bool SetCrashData([in] PP_Instance instance, + * [in] PP_FlashCrashKey key, + * [in] PP_Var value); + */ + PPB_Flash_SetCrashData: function(json) { + return PP_Bool.PP_TRUE; + }, + + + /** + * int32_t OpenFile( + * [in] PP_Instance instance, + * [in] str_t path, + * [in] int32_t mode, + * [out] PP_FileHandle file); + */ + PPB_Flash_File_ModuleLocal_OpenFile: function(json) { + let file = this.moduleLocalFiles.clone(); + json.path.split("/").forEach((pathItem) => file.appendRelativePath(pathItem)); + + let flags; + if (!(json.mode & PP_FileOpenFlags.PP_FILEOPENFLAG_WRITE)) { + flags = PR_RDONLY; + if (json.mode & PP_FileOpenFlags.PP_FILEOPENFLAG_APPEND) { + flags |= PR_APPEND; + } + } else if (json.mode & PP_FileOpenFlags.PP_FILEOPENFLAG_READ) { + flags = PR_RDWR; + } else { + flags = PR_WRONLY; + } + if (json.mode & PP_FileOpenFlags.PP_FILEOPENFLAG_TRUNCATE) { + flags |= PR_TRUNCATE; + } + if (json.mode & PP_FileOpenFlags.PP_FILEOPENFLAG_CREATE) { + flags |= PR_CREATE_FILE; + if ((json.mode & PP_FileOpenFlags.PP_FILEOPENFLAG_EXCLUSIVE) && file.exists()) { + flags |= PR_EXCL; + } + } + + try { + let handle = this.process.openAndSend(file, flags, 0o600); + return [PP_OK, { file: handle }]; + } catch (e) { + return [PP_ERROR_FAILED, { file: null }]; + } + }, + + /** + * int32_t RenameFile( + * [in] PP_Instance instance, + * [in] str_t path_from, + * [in] str_t path_to); + */ + PPB_Flash_File_ModuleLocal_RenameFile: function(json) { + let fromFile = this.moduleLocalFiles.clone(); + json.path_from.split("/").forEach((pathItem) => fromFile.appendRelativePath(pathItem)); + let toItems = json.path_to.split("/"); + let newName = toItems.pop(); + let toDir = this.moduleLocalFiles.clone(); + toItems.forEach((pathItem) => toDir.appendRelativePath(pathItem)); + try { + fromFile.renameTo(toDir, newName); + return PP_OK; + } catch (e) { + return PP_ERROR_FAILED; + } + }, + + /** + * int32_t DeleteFileOrDir( + * [in] PP_Instance instance, + * [in] str_t path, + * [in] PP_Bool recursive); + */ + PPB_Flash_File_ModuleLocal_DeleteFileOrDir: function(json) { + let file = this.moduleLocalFiles.clone(); + json.path.split("/").forEach((pathItem) => file.appendRelativePath(pathItem)); + if (file.exists()) { + try { + file.remove(PP_Bool[json.recursive] == PP_Bool.PP_TRUE); + } catch (e) { + dump(e.toSource() + "\n"); + return PP_ERROR_FAILED; + } + } + return PP_OK; + }, + + /** + * int32_t CreateDir( + * [in] PP_Instance instance, + * [in] str_t path); + */ + PPB_Flash_File_ModuleLocal_CreateDir: function(json) { + let directory = this.moduleLocalFiles.clone(); + json.path.split("/").forEach((pathItem) => directory.appendRelativePath(pathItem)); + try { + directory.create(Ci.nsIFile.DIRECTORY_TYPE, 0o700); + } catch (e) { + if (e.result != Cr.NS_ERROR_FILE_ALREADY_EXISTS) { + return PP_ERROR_FAILED; + } + } + return PP_OK; + }, + + /** + * int32_t QueryFile( + * [in] PP_Instance instance, + * [in] str_t path, + * [out] PP_FileInfo info); + */ + PPB_Flash_File_ModuleLocal_QueryFile: function(json) { + let file = this.moduleLocalFiles.clone(); + json.path.split("/").forEach((pathItem) => file.appendRelativePath(pathItem)); + if (!file.exists()) { + return [PP_ERROR_FILENOTFOUND, { info: null }]; + } + + return [PP_OK, { info: { + size: file.fileSize, + type: file.isDirectory() ? PP_FileType.PP_FILETYPE_DIRECTORY : PP_FileType.PP_FILETYPE_REGULAR, + system_type: PP_FileSystemType.PP_FILESYSTEMTYPE_LOCALPERSISTENT, + creation_time: file.lastModifiedTime, + last_access_time: file.lastModifiedTime, + last_modified_time: file.lastModifiedTime + } }]; + }, + + /** + * int32_t GetDirContents( + * [in] PP_Instance instance, + * [in] str_t path, + * [out] PP_DirContents_Dev contents); + */ + PPB_Flash_File_ModuleLocal_GetDirContents: function(json) { + let directory = this.moduleLocalFiles.clone(); + json.path.split("/").forEach((pathItem) => directory.appendRelativePath(pathItem)); + if (!directory.exists() || !directory.isDirectory()) { + return [PP_ERROR_FILENOTFOUND, { contents: null }]; + } + + let entries = []; + let enumerator = directory.directoryEntries; + while (enumerator.hasMoreElements()) { + let file = enumerator.getNext().QueryInterface(Ci.nsIFile); + entries.push({ name: file.leafName, is_dir: file.isDirectory() }); + } + return [PP_OK, { contents: { count: entries.length, entries } }]; + }, + + /** + * int32_t CreateTemporaryFile( + * [in] PP_Instance instance, + * [out] PP_FileHandle file); + */ + PPB_Flash_File_ModuleLocal_CreateTemporaryFile: function(json) { + let handle = this.process.openAndSend(null, PR_RDWR, 0o600); + return [PP_OK, { file: handle }]; + }, + + + /** + * PP_Bool IsFullscreen( + * [in] PP_Instance instance); + */ + PPB_FlashFullscreen_IsFullscreen: function(json) { + let instance = this.instances[json.instance]; + return instance.mm.sendRpcMessage("ppapi.js:isFullscreen")[0] ? PP_Bool.PP_TRUE : PP_Bool.PP_FALSE; + }, + + /** + * PP_Bool SetFullscreen( + * [in] PP_Instance instance, + * [in] PP_Bool fullscreen); + */ + PPB_FlashFullscreen_SetFullscreen: function(json) { + let instance = this.instances[json.instance]; + instance.mm.sendRpcMessage("ppapi.js:setFullscreen", json.fullScreen == PP_Bool.PP_TRUE); + }, + + /** + * PP_Bool GetScreenSize( + * [in] PP_Instance instance, + * [out] PP_Size size); + */ + PPB_FlashFullscreen_GetScreenSize: function(json) { + let screen = this.instances[json.instance].window.screen; + return [PP_Bool.PP_FALSE, { size: { width: screen.width, height: screen.height } }]; + }, + + + /** + * PP_Resource Create([in] PP_Instance instance); + */ + PPB_Flash_MessageLoop_Create: function(json) { + return new Flash_MessageLoop(this.instances[json.instance]); + }, + + /** + * int32_t Run([in] PP_Resource flash_message_loop); + */ + PPB_Flash_MessageLoop_Run: function(json) { + let messageLoop = PP_Resource.lookup(json.flash_message_loop); + messageLoop.run(); + return PP_OK; + }, + + /** + * void Quit([in] PP_Resource flash_message_loop); + */ + PPB_Flash_MessageLoop_Quit: function(json) { + let messageLoop = PP_Resource.lookup(json.flash_message_loop); + messageLoop.quit(); + }, + + + /** + * PP_Var GetFontFamilies( + * [in] PP_Instance instance); + */ + PPB_Font_Dev_GetFontFamilies: function(json) { + let enumerator = Cc["@mozilla.org/gfx/fontenumerator;1"].createInstance(Ci.nsIFontEnumerator); + return new String_PP_Var(enumerator.EnumerateAllFonts({}).join('\0')); + }, + + + /** + * PP_Resource Create( + * [in] PP_Instance instance, + * [in] PP_Size size, + * [in] PP_Bool is_always_opaque); + */ + PPB_Graphics2D_Create: function(json) { + return new Graphics2D(this.instances[json.instance], json.size.width, json.size.height); + }, + + /** + * void PaintImageData( + * [in] PP_Resource graphics_2d, + * [in] PP_Resource image_data, + * [in] PP_Point top_left, + * [in] PP_Rect src_rect); + */ + PPB_Graphics2D_PaintImageData: function(json) { + let graphics = PP_Resource.lookup(json.graphics_2d); + let imageData = PP_Resource.lookup(json.image_data); + let operation = new Graphics2DPaintOperation(imageData, json.top_left.x, json.top_left.y, + [ json.src_rect.point.x, json.src_rect.point.y, json.src_rect.size.width, json.src_rect.size.height ]); + graphics.addOperation(operation); + }, + + /** + * void ReplaceContents( + * [in] PP_Resource graphics_2d, + * [in] PP_Resource image_data); + */ + PPB_Graphics2D_ReplaceContents: function(json) { + let graphics = PP_Resource.lookup(json.graphics_2d); + let imageData = PP_Resource.lookup(json.image_data); + let operation = new Graphics2DPaintOperation(imageData, 0, 0); + graphics.clearOperations(); + graphics.addOperation(operation); + }, + + /** + * void Scroll( + * [in] PP_Resource graphics_2d, + * [in] PP_Rect clip_rect, + * [in] PP_Point amount); + */ + PPB_Graphics2D_Scroll: function(json) { + let graphics = PP_Resource.lookup(json.graphics_2d); + let operation = new Graphics2DScrollOperation([json.clip_rect.point.x, json.clip_rect.point.y, + json.clip_rect.size.width, json.clip_rect.size.height], json.amount.x, json.amount.y); + graphics.addOperation(operation); + }, + + /** + * int32_t Flush( + * [in] PP_Resource graphics_2d, + * [in] PP_CompletionCallback callback); + */ + PPB_Graphics2D_Flush: function(json) { + let graphics = PP_Resource.lookup(json.graphics_2d); + return graphics.flush(json.callback); + }, + + /** + * PP_Bool SetScale( + * [in] PP_Resource resource, + * [in] float_t scale); + */ + PPB_Graphics2D_SetScale: function(json) { + let graphics = PP_Resource.lookup(json.resource); + let context = graphics.context; + context.scale(json.scale, json.scale); + return PP_Bool.PP_TRUE; + }, + + + /** + * PP_Resource Create( + * [in] PP_Instance instance, + * [in] PP_Resource share_context, + * [in] int32_t[] attrib_list); + */ + PPB_Graphics3D_Create: function(json) { + let instance = this.instances[json.instance]; + let attributes = new Map(); + for (let i = 0; i < json.attrib_list.length; i += 2) { + attributes.set(json.attrib_list[i], json.attrib_list[i + 1]); + } + return new Graphics3D(instance, attributes); + }, + + /** + * int32_t ResizeBuffers( + * [in] PP_Resource context, + * [in] int32_t width, + * [in] int32_t height); + */ + PPB_Graphics3D_ResizeBuffers: function(json) { + let graphics = PP_Resource.lookup(json.context); + graphics.changeSize(json.width, json.height); + return PP_OK; + }, + + /** + * int32_t SwapBuffers( + * [in] PP_Resource context, + * [in] PP_CompletionCallback callback); + */ + PPB_Graphics3D_SwapBuffers: function(json) { + let graphics = PP_Resource.lookup(json.context); + return graphics.flush(json.callback); + }, + + + /** + * PP_Resource Create( + * [in] PP_Instance instance, + * [in] PP_ImageDataFormat format, + * [in] PP_Size size, + * [in] PP_Bool init_to_zero); + */ + PPB_ImageData_Create: function(json) { + return new ImageData(this.instances[json.instance], + PP_ImageDataFormat[json.format], + json.size); + }, + + /** + * PP_Bool Describe( + * [in] PP_Resource image_data, + * [out] PP_ImageDataDesc desc); + */ + PPB_ImageData_Describe: function(json) { + let imageData = PP_Resource.lookup(json.image_data); + return [PP_Bool.PP_TRUE, { desc: { format: imageData.format, size: imageData.size, stride: imageData.stride } }]; + }, + + /** + * mem_t Map( + * [in] PP_Resource image_data); + */ + PPB_ImageData_Map: function(json) { + let imageData = PP_Resource.lookup(json.image_data); + return imageData.map(); + }, + + + /** + * int32_t RequestInputEvents([in] PP_Instance instance, + * [in] uint32_t event_classes); + */ + PPB_InputEvent_RequestInputEvents: function(json) { + let instance = this.instances[json.instance]; + return instance.registerEventHandler(json.event_classes, false); + }, + + /** + * int32_t RequestFilteringInputEvents([in] PP_Instance instance, + * [in] uint32_t event_classes); + */ + PPB_InputEvent_RequestFilteringInputEvents: function(json) { + let instance = this.instances[json.instance]; + return instance.registerEventHandler(json.event_classes, true); + }, + + /** + * PP_Bool IsInputEvent([in] PP_Resource resource); + */ + PPB_InputEvent_IsInputEvent: function(json) { + let event = PP_Resource.lookup(json.resource); + return event instanceof InputEvent ? PP_Bool.PP_TRUE : PP_Bool.PP_FALSE; + }, + + /** + * PP_InputEvent_Type GetType([in] PP_Resource event); + */ + PPB_InputEvent_GetType: function(json) { + let event = PP_Resource.lookup(json.event); + return event.eventType; + }, + + /** + * PP_TimeTicks GetTimeStamp([in] PP_Resource event); + */ + PPB_InputEvent_GetTimeStamp: function(json) { + let event = PP_Resource.lookup(json.event); + return event.timeStamp; + }, + + /** + * uint32_t GetModifiers([in] PP_Resource event); + */ + PPB_InputEvent_GetModifiers: function(json) { + let event = PP_Resource.lookup(json.event); + let modifiers = 0; + for (let [gecko, ppapi] of ModifierMap) { + if (event.domEvent.getModifierState(gecko)) { + modifiers |= ppapi; + } + } + + if (event instanceof KeyboardInputEvent) { + if (event.domEvent.location == event.domEvent.DOM_KEY_LOCATION_NUMPAD) { + modifiers &= PP_InputEvent_Modifier.PP_INPUTEVENT_MODIFIER_ISKEYPAD; + } else if (event.domEvent.location & event.domEvent.DOM_KEY_LOCATION_LEFT) { + modifiers &= PP_InputEvent_Modifier.PP_INPUTEVENT_MODIFIER_ISLEFT; + } else if (event.domEvent.location & event.domEvent.DOM_KEY_LOCATION_RIGHT) { + modifiers &= PP_InputEvent_Modifier.PP_INPUTEVENT_MODIFIER_ISRIGHT; + } + + if (event.domEvent.repeat) { + modifiers &= PP_InputEvent_Modifier.PP_INPUTEVENT_MODIFIER_ISAUTOREPEAT; + } + } else if (event instanceof MouseInputEvent) { + if (event.domEvent.buttons && 0x01) { + modifiers &= PP_InputEvent_Modifier.PP_INPUTEVENT_MODIFIER_LEFTBUTTONDOWN; + } + if (event.domEvent.buttons && 0x04) { + modifiers &= PP_InputEvent_Modifier.PP_INPUTEVENT_MODIFIER_MIDDLEBUTTONDOWN; + } + if (event.domEvent.buttons && 0x02) { + modifiers &= PP_InputEvent_Modifier.PP_INPUTEVENT_MODIFIER_RIGHTBUTTONDOWN; + } + } + + dump("MODIFIERS " + modifiers + "\n"); + return modifiers; + }, + + + /** + * PP_Bool BindGraphics( + * [in] PP_Instance instance, + * [in] PP_Resource device); + */ + PPB_Instance_BindGraphics: function(json) { + let instance = this.instances[json.instance]; + if (json.device === 0) { + instance.bindGraphics(undefined); + } else { + instance.bindGraphics(PP_Resource.lookup(json.device)); + } + return PP_Bool.PP_TRUE; + }, + + /** + * PP_Bool IsFullFrame( + * [in] PP_Instance instance); + */ + PPB_Instance_IsFullFrame: function(json) { + let instance = this.instances[json.instance]; + return instance.info.isFullFrame ? PP_Bool.PP_TRUE : PP_Bool.PP_FALSE; + }, + + + /** + * PP_Var GetWindowObject([in] PP_Instance instance); + */ + PPB_Instance_Private_GetWindowObject: function(json) { + let instance = this.instances[json.instance]; + return new Object_PP_Var(instance.containerWindow, instance); + }, + + /** + * PP_Var ExecuteScript([in] PP_Instance instance, + * [in] PP_Var script, + * [out] PP_Var exception); + */ + PPB_Instance_Private_ExecuteScript: function(json) { + let instance = this.instances[json.instance]; + let script = String_PP_Var.getAsJSValue(json.script); + let result = instance.mm.sendRpcMessage("ppapiflash.js:executeScript", script, { instance })[0]; + return [result, { exception: null }]; + //return [new PP_Var(), { exception: PP_Var.fromJSValue(e) }]; + }, + + + /** + * PP_Bool IsKeyboardInputEvent([in] PP_Resource resource); + */ + PPB_KeyboardInputEvent_IsKeyboardInputEvent: function(json) { + let resource = PP_Resource.lookup(json.resource); + return resource instanceof KeyboardInputEvent ? PP_Bool.PP_TRUE : PP_Bool.PP_FALSE; + }, + + /** + * uint32_t GetKeyCode([in] PP_Resource key_event); + */ + PPB_KeyboardInputEvent_GetKeyCode: function(json) { + let event = PP_Resource.lookup(json.key_event); + return event.domEvent.keyCode; + }, + + /** + * PP_Var GetCharacterText([in] PP_Resource character_event); + */ + PPB_KeyboardInputEvent_GetCharacterText: function(json) { + let event = PP_Resource.lookup(json.character_event); + let charCode = event.domEvent.charCode; + if (charCode === 0) { + return new PP_Var(); + } + return new String_PP_Var(String.fromCharCode(charCode)); + }, + + + /** + * void PostMessage([in] PP_Instance instance, [in] PP_Var message); + */ + PPB_Messaging_PostMessage: function(json) { + if (PP_VarType[json.message.type] != PP_VarType.PP_VARTYPE_DICTIONARY) { + return; + } + let instance = this.instances[json.instance]; + let message = PP_Var.toJSValue(json.message, instance); + instance.viewport.notify(message); + }, + + /** + * void SetTextInputType([in] PP_Instance instance, + * [in] PP_TextInput_Type_Dev type); + */ + PPB_TextInput_Dev_SetTextInputType: function(json) { + let instance = this.instances[json.instance]; + let inputBox = instance.window.document.getElementById("IMEInput"); + switch (PP_TextInput_Type_Dev[json.type]) { + case PP_TextInput_Type_Dev.PP_TEXTINPUT_TYPE_DEV_TEXT: + if (inputBox) { + inputBox.value = ""; + // we use setTimeout here to hold a small amount of time + // to make sure that the focus state is stable when we + // try to transfer focus. Same reason as the one later. + instance.window.setTimeout(function() { inputBox.focus(); }); + return; + } + inputBox = instance.window.document.createElement("input"); + inputBox.type = "text"; + inputBox.id = "IMEInput"; + inputBox.style.bottom = "10px"; + inputBox.style.opacity = 0; + inputBox.style.position = "fixed"; + inputBox.style.tabindex = -1; + inputBox.style.zIndex = -1; + instance.window.document.body.appendChild(inputBox); + inputBox.addEventListener("blur", () => { + instance.window.setTimeout(function() { + // in PP_TEXTINPUT_TYPE_DEV_TEXT state, we only release the focus of inputBox + // when the plugin(viewport) doesn't have focus. + if (instance.viewport.is(instance.window.document.activeElement)) { + inputBox.focus(); + } else { + // if both inputBox and viewport don't have focus, + // we might need to inform the plugin that it has lost focus. + instance.didChangeFocus(); + } + }); + }); + // when plugins accept text input but doesn't register text input related APIs, + // the characters are delievered to plugins via PP_INPUTEVENT_TYPE_CHAR. + if (!(instance.eventHandlers & PP_InputEvent_Class.PP_INPUTEVENT_CLASS_IME)) { + inputBox.addEventListener("compositionstart", () => { + inputBox.value = ""; + inputBox.style.opacity = 1; + inputBox.style.zIndex = 1; + }); + inputBox.addEventListener("compositionupdate", (e) => { + if (!e.data) { + inputBox.style.opacity = 0; + inputBox.style.zIndex = -1; + } + }); + inputBox.addEventListener("compositionend", (e) => { + inputBox.style.opacity = 0; + inputBox.style.zIndex = -1; + for (let i = 0; i < e.data.length; i++) { + let keyboardEventInit = { + charCode: e.data.charCodeAt(i) + }; + let event = new instance.window.KeyboardEvent("keypress", keyboardEventInit); + instance.handleEvent(event); + } + }); + } + instance.window.setTimeout(function() { inputBox.focus(); }); + break; + default: + if (inputBox) { + instance.window.document.body.removeChild(inputBox); + } + } + }, + + /** + * void UpdateCaretPosition([in] PP_Instance instance, + * [in] PP_Rect caret, + * [in] PP_Rect bounding_box); + */ + PPB_TextInput_Dev_UpdateCaretPosition: function(json) { + let instance = this.instances[json.instance]; + let inputBox = instance.window.document.getElementById("IMEInput"); + if (inputBox) { + inputBox.style.left = json.bounding_box.point.x + 'px'; + inputBox.style.top = json.bounding_box.point.y + 'px'; + } + }, + + /** + * PP_Bool IsIMEInputEvent([in] PP_Resource resource); + */ + PPB_IMEInputEvent_Dev_IsIMEInputEvent: function(json) { + let resource = PP_Resource.lookup(json.resource); + return resource instanceof IMEInputEvent ? PP_Bool.PP_TRUE : PP_Bool.PP_FALSE; + }, + + /** + * PP_Var GetText([in] PP_Resource ime_event); + */ + PPB_IMEInputEvent_Dev_GetText: function(json) { + let event = PP_Resource.lookup(json.ime_event); + return new String_PP_Var(event.domEvent.data); + }, + + + /** + * uint32_t GetSegmentNumber([in] PP_Resource ime_event) + */ + PPB_IMEInputEvent_Dev_GetSegmentNumber: function(json) { + let resource = PP_Resource.lookup(json.ime_event); + if (resource.eventType == PP_InputEvent_Type.PP_INPUTEVENT_TYPE_IME_COMPOSITION_UPDATE) { + let clauseArray = resource.domEvent.ranges; + if (clauseArray && clauseArray.length) { + return clauseArray.length - 1; + } + } + return 0; + }, + + /** + * int32_t GetTargetSegment([in] PP_Resource ime_event); + */ + PPB_IMEInputEvent_Dev_GetTargetSegment: function(json) { + let resource = PP_Resource.lookup(json.ime_event); + if (resource.eventType == PP_InputEvent_Type.PP_INPUTEVENT_TYPE_IME_COMPOSITION_UPDATE) { + if (resource.targetSegment != undefined) { + return resource.targetSegment; + } + } + return -1; + }, + + /** + * uint32_t GetSegmentOffset([in] PP_Resource ime_event,[in] uint32_t index) + */ + PPB_IMEInputEvent_Dev_GetSegmentOffset: function(json) { + let resource = PP_Resource.lookup(json.ime_event); + if (resource.eventType == PP_InputEvent_Type.PP_INPUTEVENT_TYPE_IME_COMPOSITION_UPDATE) { + let index = json.index; + if (resource.segmentOffset && resource.segmentOffset[index]) { + return resource.segmentOffset[index]; + } + } + return 0; + }, + + /** + * void GetSelection([in] PP_Resource ime_event, + * [out] uint32_t start, + * [out] uint32_t end); + */ + PPB_IMEInputEvent_Dev_GetSelection: function(json) { + let resource = PP_Resource.lookup(json.ime_event); + let startOffset, endOffset; + // Note: vaild targetSegment or segmentOffset could be zero. + if (resource.targetSegment != undefined && + resource.segmentOffset[resource.targetSegment] != undefined && + resource.segmentOffset[resource.targetSegment + 1] != undefined) { + startOffset = resource.segmentOffset[resource.targetSegment]; + endOffset = resource.segmentOffset[resource.targetSegment + 1]; + } else { + // Spec doesn't define what values to return if there's no selected text. + // In this case, startOffset and endOffset should be the same. + // Here we set them to the end offset of the text. + let encoder = new TextEncoder("utf-8"); + let data = resource.domEvent.data; + startOffset = endOffset = encoder.encode(data).length; + } + return [{ start: startOffset, end: endOffset }]; + }, + + /** + * PP_Resource Create([in] PP_Instance instance, + * [in] PP_InputEvent_Type type, + * [in] PP_TimeTicks time_stamp, + * [in] uint32_t modifiers, + * [in] PP_InputEvent_MouseButton mouse_button, + * [in] PP_Point mouse_position, + * [in] int32_t click_count, + * [in] PP_Point mouse_movement); + */ + PPB_MouseInputEvent_Create: function(json) { + let instance = this.instances[json.instance]; + let mouseEventInit = { + altkey: PP_InputEvent_Modifier.PP_INPUTEVENT_MODIFIER_ALTKEY & + json.modifiers, + button: PP_InputEvent_MouseButton[json.mouse_button], + clientX: json.mouse_position.x, + clientY: json.mouse_position.y, + ctrlKey: PP_InputEvent_Modifier.PP_INPUTEVENT_MODIFIER_CONTROLKEY & + json.modifiers, + detail: json.click_count, + metaKey: PP_InputEvent_Modifier.PP_INPUTEVENT_MODIFIER_METAKEY & + json.modifiers, + movementX: json.mouse_movement.x, + movementY: json.mouse_movement.y, + shiftKey: PP_InputEvent_Modifier.PP_INPUTEVENT_MODIFIER_SHIFTKEY & + json.modifiers + }; + let eventName = EventByTypes.get(PP_InputEvent_Type[json.type]); + let event = new instance.window.MouseEvent(eventName, mouseEventInit); + let resource = new MouseInputEvent(instance, event); + resource.timeStamp = json.time_stamp; + return resource; + }, + + /** + * PP_Bool IsMouseInputEvent([in] PP_Resource resource); + */ + PPB_MouseInputEvent_IsMouseInputEvent: function(json) { + let resource = PP_Resource.lookup(json.resource); + return resource instanceof MouseInputEvent ? PP_Bool.PP_TRUE : PP_Bool.PP_FALSE; + }, + + /** + * PP_InputEvent_MouseButton GetButton([in] PP_Resource mouse_event); + */ + PPB_MouseInputEvent_GetButton: function(json) { + let event = PP_Resource.lookup(json.mouse_event); + let button = event.domEvent.button; + switch (button) { + case -1: + return PP_InputEvent_MouseButton.PP_INPUTEVENT_MOUSEBUTTON_NONE; + case 0: + return PP_InputEvent_MouseButton.PP_INPUTEVENT_MOUSEBUTTON_LEFT; + case 1: + return PP_InputEvent_MouseButton.PP_INPUTEVENT_MOUSEBUTTON_MIDDLE; + case 2: + return PP_InputEvent_MouseButton.PP_INPUTEVENT_MOUSEBUTTON_RIGHT; + default: + return PP_InputEvent_MouseButton.PP_INPUTEVENT_MOUSEBUTTON_LEFT; + } + }, + + /** + * PP_Point GetPosition([in] PP_Resource mouse_event) + */ + PPB_MouseInputEvent_GetPosition: function(json) { + let event = PP_Resource.lookup(json.mouse_event); + return { x: event.domEvent.clientX, y: event.domEvent.clientY }; + }, + + /** + * int32_t GetClickCount([in] PP_Resource mouse_event); + */ + PPB_MouseInputEvent_GetClickCount: function(json) { + let event = PP_Resource.lookup(json.mouse_event); + return event.domEvent.detail; + }, + + /** + * PP_Point GetMovement([in] PP_Resource mouse_event); + */ + PPB_MouseInputEvent_GetMovement: function(json) { + let event = PP_Resource.lookup(json.mouse_event); + return { x: event.domEvent.movementX, y: event.domEvent.movementY }; + }, + + + /** + * PP_Resource Create([in] PP_Instance instance); + */ + PPB_NetworkMonitor_Create: function(json) { + return new NetworkMonitor(this.instances[json.instance]); + }, + + /** + * int32_t UpdateNetworkList([in] PP_Resource network_monitor, + * [out] PP_Resource network_list, + * [in] PP_CompletionCallback callback); + */ + PPB_NetworkMonitor_UpdateNetworkList: function(json) { + return [ PP_ERROR_NOACCESS, { network_list: null } ]; + }, + + + /** + * void ActiveTexture([in] PP_Resource context, + * [in] GLenum texture); + */ + PPB_OpenGLES2_ActiveTexture: function(json) { + let graphics = PP_Resource.lookup(json.context); + let context = graphics.context; + context.activeTexture(json.texture); + }, + + /** + * void AttachShader([in] PP_Resource context, + * [in] GLuint program, + * [in] GLuint shader); + */ + PPB_OpenGLES2_AttachShader: function(json) { + let graphics = PP_Resource.lookup(json.context); + let context = graphics.context; + let program = graphics.objects.lookup(json.program); + let shader = graphics.objects.lookup(json.shader); + context.attachShader(program, shader); + }, + + /** + * void BindAttribLocation([in] PP_Resource context, + * [in] GLuint program, + * [in] GLuint index, + * [in] cstr_t name); + */ + PPB_OpenGLES2_BindAttribLocation: function(json) { + let graphics = PP_Resource.lookup(json.context); + let context = graphics.context; + let program = graphics.objects.lookup(json.program); + context.bindAttribLocation(program, json.index, json.name); + }, + + /** + * void BindBuffer([in] PP_Resource context, + * [in] GLenum target, + * [in] GLuint buffer); + */ + PPB_OpenGLES2_BindBuffer: function(json) { + let graphics = PP_Resource.lookup(json.context); + let context = graphics.context; + let buffer = graphics.objects.lookup(json.buffer); + context.bindBuffer(json.target, buffer); + }, + + /** + * void BindFramebuffer([in] PP_Resource context, + * [in] GLenum target, + * [in] GLuint framebuffer); + */ + PPB_OpenGLES2_BindFramebuffer: function(json) { + let graphics = PP_Resource.lookup(json.context); + let context = graphics.context; + let frameBuffer = PP_Resource.lookup(json.framebuffer); + context.bindFramebuffer(json.target, frameBuffer); + }, + + /** + * void BindRenderbuffer([in] PP_Resource context, + * [in] GLenum target, + * [in] GLuint renderbuffer); + */ + PPB_OpenGLES2_BindRenderbuffer: function(json) { + let graphics = PP_Resource.lookup(json.context); + let context = graphics.context; + let renderBuffer = PP_Resource.lookup(json.renderbuffer); + context.bindRenderbuffer(json.target, renderBuffer); + }, + + /** + * void BindTexture([in] PP_Resource context, + * [in] GLenum target, + * [in] GLuint texture); + */ + PPB_OpenGLES2_BindTexture: function(json) { + let graphics = PP_Resource.lookup(json.context); + let context = graphics.context; + let texture = graphics.objects.lookup(json.texture); + context.bindTexture(json.target, texture); + }, + + /** + * void BlendColor([in] PP_Resource context, + * [in] GLclampf red, + * [in] GLclampf green, + * [in] GLclampf blue, + * [in] GLclampf alpha); + */ + PPB_OpenGLES2_BlendColor: function(json) { + let graphics = PP_Resource.lookup(json.context); + let context = graphics.context; + context.blendColor(json.red, json.green, json.blue, json.alpha); + }, + + /** + * void BlendEquation([in] PP_Resource context, + * [in] GLenum mode); + */ + PPB_OpenGLES2_BlendEquation: function(json) { + let graphics = PP_Resource.lookup(json.context); + let context = graphics.context; + context.blendEquation(json.mode); + }, + + /** + * void BlendEquationSeparate([in] PP_Resource context, + * [in] GLenum modeRGB, + * [in] GLenum modeAlpha); + */ + PPB_OpenGLES2_BlendEquationSeparate: function(json) { + let graphics = PP_Resource.lookup(json.context); + let context = graphics.context; + context.blendEquationSeparate(json.modeRGB, json.modeAlpha); + }, + + /** + * void BlendFunc([in] PP_Resource context, + * [in] GLenum sfactor, + * [in] GLenum dfactor); + */ + PPB_OpenGLES2_BlendFunc: function(json) { + let graphics = PP_Resource.lookup(json.context); + let context = graphics.context; + context.blendFunc(json.sfactor, json.dfactor); + }, + + /** + * void BlendFuncSeparate([in] PP_Resource context, + * [in] GLenum srcRGB, + * [in] GLenum dstRGB, + * [in] GLenum srcAlpha, + * [in] GLenum dstAlpha); + */ + PPB_OpenGLES2_BlendFuncSeparate: function(json) { + let graphics = PP_Resource.lookup(json.context); + let context = graphics.context; + context.blendFuncSeparate(json.srcRGB, json.dstRGB, json.srcAlpha, json.dstAlpha); + }, + + /** + * void BufferData([in] PP_Resource context, + * [in] GLenum target, + * [in] GLsizeiptr size, + * [in] mem_t data, + * [in] GLenum usage); + */ + PPB_OpenGLES2_BufferData: function(json) { + let graphics = PP_Resource.lookup(json.context); + let context = graphics.context; + let data = this.copyBuffer(json.data, json.size); + context.bufferData(json.target, data, json.usage); + }, + + /** + * void BufferSubData([in] PP_Resource context, + * [in] GLenum target, + * [in] GLintptr offset, + * [in] GLsizeiptr size, + * [in] mem_t data); + */ + PPB_OpenGLES2_BufferSubData: function(json) { + let graphics = PP_Resource.lookup(json.context); + let context = graphics.context; + let data = this.copyBuffer(json.data, json.size); + context.bufferSubData(json.target, json.offset, data); + }, + + /** + * GLenum CheckFramebufferStatus([in] PP_Resource context, + * [in] GLenum target); + */ + PPB_OpenGLES2_CheckFramebufferStatus: function(json) { + let graphics = PP_Resource.lookup(json.context); + let context = graphics.context; + return context.checkFramebufferStatus(json.target); + }, + + /** + * void Clear([in] PP_Resource context, + * [in] GLbitfield mask); + */ + PPB_OpenGLES2_Clear: function(json) { + let graphics = PP_Resource.lookup(json.context); + let context = graphics.context; + context.clear(json.mask); + }, + + /** + * void ClearColor([in] PP_Resource context, + * [in] GLclampf red, + * [in] GLclampf green, + * [in] GLclampf blue, + * [in] GLclampf alpha); + */ + PPB_OpenGLES2_ClearColor: function(json) { + let graphics = PP_Resource.lookup(json.context); + let context = graphics.context; + context.clearColor(json.red, json.green, json.blue, json.alpha); + }, + + /** + * void ClearDepthf([in] PP_Resource context, + * [in] GLclampf depth); + */ + PPB_OpenGLES2_ClearDepthf: function(json) { + let graphics = PP_Resource.lookup(json.context); + let context = graphics.context; + context.clearDepthf(json.depth); + }, + + /** + * void ColorMask([in] PP_Resource context, + * [in] GLboolean red, + * [in] GLboolean green, + * [in] GLboolean blue, + * [in] GLboolean alpha); + */ + PPB_OpenGLES2_ColorMask: function(json) { + let graphics = PP_Resource.lookup(json.context); + let context = graphics.context; + context.colorMask(json.red, json.green, json.blue, json.alpha); + }, + + /** + * void CompileShader([in] PP_Resource context, + * [in] GLuint shader); + */ + PPB_OpenGLES2_CompileShader: function(json) { + let graphics = PP_Resource.lookup(json.context); + let context = graphics.context; + let shader = graphics.objects.lookup(json.shader); + context.compileShader(shader); + }, + + /** + * void CopyTexImage2D([in] PP_Resource context, + * [in] GLenum target, + * [in] GLint level, + * [in] GLenum internalformat, + * [in] GLint x, + * [in] GLint y, + * [in] GLsizei width, + * [in] GLsizei height, + * [in] GLint border); + */ + PPB_OpenGLES2_CopyTexImage2D: function(json) { + let graphics = PP_Resource.lookup(json.context); + let context = graphics.context; + context.copyTexImage2D(json.target, json.level, json.internalformat, + json.x, json.y, json.width, json.height, + json.border); + }, + + /** + * void CopyTexSubImage2D([in] PP_Resource context, + * [in] GLenum target, + * [in] GLint level, + * [in] GLint xoffset, + * [in] GLint yoffset, + * [in] GLint x, + * [in] GLint y, + * [in] GLsizei width, + * [in] GLsizei height); + */ + PPB_OpenGLES2_CopyTexSubImage2D: function(json) { + let graphics = PP_Resource.lookup(json.context); + let context = graphics.context; + context.copyTexSubImage2D(json.target, json.level, json.xoffset, + json.yoffset, json.x, json.y, json.width, + json.height); + }, + + /** + * GLuint CreateProgram([in] PP_Resource context); + */ + PPB_OpenGLES2_CreateProgram: function(json) { + let graphics = PP_Resource.lookup(json.context); + return graphics.objects.add(graphics.context.createProgram()); + }, + + /** + * GLuint CreateShader([in] PP_Resource context, + * [in] GLenum type); + */ + PPB_OpenGLES2_CreateShader: function(json) { + let graphics = PP_Resource.lookup(json.context); + return graphics.objects.add(graphics.context.createShader(json.type)); + }, + + /** + * void CullFace([in] PP_Resource context, + * [in] GLenum mode); + */ + PPB_OpenGLES2_CullFace: function(json) { + let graphics = PP_Resource.lookup(json.context); + let context = graphics.context; + context.cullFace(json.mode); + }, + + /** + * void DeleteBuffers([in] PP_Resource context, + * [in] GLsizei n, + * [in, size_is(n)] GLuint[] buffers); + */ + PPB_OpenGLES2_DeleteBuffers: function(json) { + let graphics = PP_Resource.lookup(json.context); + let context = graphics.context; + for (let i = 0; i < json.n; ++i) { + context.deleteBuffer(graphics.objects.lookup(json.buffers[i])); + graphics.objects.destroy(json.buffers[i]); + } + }, + + /** + * void DeleteFramebuffers([in] PP_Resource context, + * [in] GLsizei n, + * [in, size_is(n)] GLuint[] buffers); + */ + PPB_OpenGLES2_DeleteFramebuffers: function(json) { + let graphics = PP_Resource.lookup(json.context); + let context = graphics.context; + for (let i = 0; i < json.n; ++i) { + context.deleteFramebuffer(graphics.objects.lookup(json.buffers[i])); + graphics.objects.destroy(json.buffers[i]); + } + }, + + /** + * void DeleteProgram([in] PP_Resource context, + * [in] GLuint program); + */ + PPB_OpenGLES2_DeleteProgram: function(json) { + let graphics = PP_Resource.lookup(json.context); + let context = graphics.context; + context.deleteProgram(graphics.objects.lookup(json.program)); + graphics.objects.destroy(json.program); + }, + + /** + * void DeleteRenderbuffers([in] PP_Resource context, + * [in] GLsizei n, + * [in, size_is(n)] GLuint[] renderbuffers); + */ + PPB_OpenGLES2_DeleteRenderbuffers: function(json) { + let graphics = PP_Resource.lookup(json.context); + let context = graphics.context; + for (let i = 0; i < json.n; ++i) { + context.deleteRenderbuffer(graphics.objects.lookup(json.renderbuffers[i])); + graphics.objects.destroy(json.renderbuffers[i]); + } + }, + + /** + * void DeleteShader([in] PP_Resource context, + * [in] GLuint shader); + */ + PPB_OpenGLES2_DeleteShader: function(json) { + let graphics = PP_Resource.lookup(json.context); + let context = graphics.context; + context.deleteShader(graphics.objects.lookup(json.shader)); + graphics.objects.destroy(json.shader); + }, + + /** + * void DeleteTextures([in] PP_Resource context, + * [in] GLsizei n, + * [in, size_is(n)] GLuint[] textures); + */ + PPB_OpenGLES2_DeleteTextures: function(json) { + let graphics = PP_Resource.lookup(json.context); + let context = graphics.context; + for (let i = 0; i < json.n; ++i) { + context.deleteTexture(graphics.objects.lookup(json.textures[i])); + graphics.objects.destroy(json.textures[i]); + } + }, + + /** + * void DepthFunc([in] PP_Resource context, + * [in] GLenum func); + */ + PPB_OpenGLES2_DepthFunc: function(json) { + let graphics = PP_Resource.lookup(json.context); + let context = graphics.context; + context.depthFunc(json.func); + }, + + /** + * void DepthMask([in] PP_Resource context, + * [in] GLboolean flag); + */ + PPB_OpenGLES2_DepthMask: function(json) { + let graphics = PP_Resource.lookup(json.context); + let context = graphics.context; + context.depthMask(json.flag); + }, + + /** + * void DepthRangef([in] PP_Resource context, + * [in] GLclampf zNear, + * [in] GLclampf zFar); + */ + PPB_OpenGLES2_DepthRangef: function(json) { + let graphics = PP_Resource.lookup(json.context); + let context = graphics.context; + context.depthRangef(json.zNear, json.zFar); + }, + + /** + * void DetachShader([in] PP_Resource context, + * [in] GLuint program, + * [in] GLuint shader); + */ + PPB_OpenGLES2_DetachShader: function(json) { + let graphics = PP_Resource.lookup(json.context); + let context = graphics.context; + context.detachShader(json.program, graphics.objects.lookup(json.shader)); + }, + + /** + * void Disable([in] PP_Resource context, + * [in] GLenum cap); + */ + PPB_OpenGLES2_Disable: function(json) { + let graphics = PP_Resource.lookup(json.context); + let context = graphics.context; + context.disable(json.cap); + }, + + /** + * void DisableVertexAttribArray([in] PP_Resource context, + * [in] GLuint index); + */ + PPB_OpenGLES2_DisableVertexAttribArray: function(json) { + let graphics = PP_Resource.lookup(json.context); + let context = graphics.context; + context.disableVertexAttribArray(json.index); + }, + + /** + * void DrawArrays([in] PP_Resource context, + * [in] GLenum mode, + * [in] GLint first, + * [in] GLsizei count); + */ + PPB_OpenGLES2_DrawArrays: function(json) { + let graphics = PP_Resource.lookup(json.context); + let context = graphics.context; + context.drawArrays(json.mode, json.first, json.count); + }, + + /** + * void DrawElements([in] PP_Resource context, + * [in] GLenum mode, + * [in] GLsizei count, + * [in] GLenum type, + * [in] mem_t indices); + */ + PPB_OpenGLES2_DrawElements: function(json) { + let graphics = PP_Resource.lookup(json.context); + let context = graphics.context; + context.drawElements(json.mode, json.count, json.type, json.indices); + }, + + /** + * void Enable([in] PP_Resource context, + * [in] GLenum cap); + */ + PPB_OpenGLES2_Enable: function(json) { + let graphics = PP_Resource.lookup(json.context); + let context = graphics.context; + context.enable(json.cap); + }, + + /** + * void EnableVertexAttribArray([in] PP_Resource context, + * [in] GLuint index); + */ + PPB_OpenGLES2_EnableVertexAttribArray: function(json) { + let graphics = PP_Resource.lookup(json.context); + let context = graphics.context; + context.enableVertexAttribArray(json.index); + }, + + /** + * void Finish([in] PP_Resource context); + */ + PPB_OpenGLES2_Finish: function(json) { + let graphics = PP_Resource.lookup(json.context); + let context = graphics.context; + context.finish(); + }, + + /** + * void Flush([in] PP_Resource context); + */ + PPB_OpenGLES2_Flush: function(json) { + let graphics = PP_Resource.lookup(json.context); + let context = graphics.context; + context.flush(); + }, + + /** + * void FramebufferTexture2D([in] PP_Resource context, + * [in] GLenum target, + * [in] GLenum attachment, + * [in] GLenum textarget, + * [in] GLuint texture, + * [in] GLint level); + */ + PPB_OpenGLES2_FramebufferTexture2D: function(json) { + let graphics = PP_Resource.lookup(json.context); + let context = graphics.context; + context.framebufferTexture2D(json.target, json.attachment, json.textarget, json.texture, json.level); + }, + + /** + * void FrontFace([in] PP_Resource context, + * [in] GLenum mode); + */ + PPB_OpenGLES2_FrontFace: function(json) { + let graphics = PP_Resource.lookup(json.context); + let context = graphics.context; + context.frontFace(json.mode); + }, + + /** + * void GenBuffers([in] PP_Resource context, + * [in] GLsizei n, + * [inout, size_is(n)] GLuint[] buffers); + */ + PPB_OpenGLES2_GenBuffers: function(json) { + let graphics = PP_Resource.lookup(json.context); + let context = graphics.context; + let buffers = []; + for (let i = 0; i < json.n; ++i) { + buffers.push(graphics.objects.add(context.createBuffer())); + } + return [{ buffers: buffers }]; + }, + + /** + * void GenerateMipmap([in] PP_Resource context, + * [in] GLenum target); + */ + PPB_OpenGLES2_GenerateMipmap: function(json) { + let graphics = PP_Resource.lookup(json.context); + let context = graphics.context; + context.generateMipmap(json.target); + }, + + /** + * void GenFramebuffers([in] PP_Resource context, + * [in] GLsizei n, + * [inout, size_is(n)] GLuint[] framebuffers); + */ + PPB_OpenGLES2_GenFramebuffers: function(json) { + let graphics = PP_Resource.lookup(json.context); + let context = graphics.context; + let framebuffers = []; + for (let i = 0; i < json.n; ++i) { + framebuffers.push(graphics.objects.add(context.createFramebuffer())); + } + return [{ framebuffers: framebuffers }]; + }, + + /** + * void GenRenderbuffers([in] PP_Resource context, + * [in] GLsizei n, + * [inout, size_is(n)] GLuint[] renderbuffers); + */ + PPB_OpenGLES2_GenRenderbuffers: function(json) { + let graphics = PP_Resource.lookup(json.context); + let context = graphics.context; + let renderbuffers = []; + for (let i = 0; i < json.n; ++i) { + renderbuffers.push(graphics.objects.add(context.createRenderbuffer())); + } + return [{ renderbuffers: renderbuffers }]; + }, + + /** + * void GenTextures([in] PP_Resource context, + * [in] GLsizei n, + * [inout, size_is(n)] GLuint[] textures); + */ + PPB_OpenGLES2_GenTextures: function(json) { + let graphics = PP_Resource.lookup(json.context); + let context = graphics.context; + let textures = []; + for (let i = 0; i < json.n; ++i) { + textures.push(graphics.objects.add(context.createTexture())); + } + return [{ textures: textures }]; + }, + + /** + * GLint GetAttribLocation([in] PP_Resource context, + * [in] GLuint program, + * [in] cstr_t name); + */ + PPB_OpenGLES2_GetAttribLocation: function(json) { + let graphics = PP_Resource.lookup(json.context); + let context = graphics.context; + return context.getAttribLocation(json.program, json.name); + }, + + /** + * GLenum GetError([in] PP_Resource context); + */ + PPB_OpenGLES2_GetError: function(json) { + let graphics = PP_Resource.lookup(json.context); + let context = graphics.context; + return context.getError(); + }, + + /** + * void GetFloatv([in] PP_Resource context, + * [in] GLenum pname, + * [out] GLint_ptr_t params); + */ + PPB_OpenGLES2_GetFloatv: function(json) { + let graphics = PP_Resource.lookup(json.context); + let context = graphics.context; + return [{ params: context.getParameter(json.pname) }]; + }, + + /** + * void GetIntegerv([in] PP_Resource context, + * [in] GLenum pname, + * [out] GLint_ptr_t params); + */ + PPB_OpenGLES2_GetIntegerv: function(json) { + let graphics = PP_Resource.lookup(json.context); + let context = graphics.context; + return [{ params: context.getParameter(json.pname) }]; + }, + + /** + * void GetProgramiv([in] PP_Resource context, + * [in] GLuint program, + * [in] GLenum pname, + * [out] GLint_ptr_t params); + */ + PPB_OpenGLES2_GetProgramiv: function(json) { + let graphics = PP_Resource.lookup(json.context); + let context = graphics.context; + let program = graphics.objects.lookup(json.program); + let param = context.getProgramParameter(program, json.pname); + if (param === null) { + param = context.getError(); + } else if (typeof param == "boolean") { + param = param ? 1 : 0; + } + return [{ params: param }]; + }, + + /** + * void GetShaderiv([in] PP_Resource context, + * [in] GLuint shader, + * [in] GLenum pname, + * [out] GLint_ptr_t params); + */ + PPB_OpenGLES2_GetShaderiv: function(json) { + let graphics = PP_Resource.lookup(json.context); + let context = graphics.context; + let shader = graphics.objects.lookup(json.shader); + let param; + if (json.pname == 0x8b84) { // GL_INFO_LOG_LENGTH + let infoLog = context.getShaderInfoLog(shader); + if (infoLog) { + param = infoLog.length; + if (param > 0) { + param += 1; + } + } else { + param = context.getError(); + } + } else { + param = context.getShaderParameter(shader, json.pname); + if (param === null) { + param = context.getError(); + } else if (typeof param == "boolean") { + param = param ? 1 : 0; + } + } + return [{ params: param }]; + }, + + /** + * void GetShaderInfoLog([in] PP_Resource context, + * [in] GLuint shader, + * [in] GLsizei bufsize, + * [out] GLsizei_ptr_t length, + * [out] str_t infolog); + */ + PPB_OpenGLES2_GetShaderInfoLog: function(json) { + let graphics = PP_Resource.lookup(json.context); + let context = graphics.context; + let shader = graphics.objects.lookup(json.shader); + let log = context.getShaderInfoLog(shader) + " "; + return [{ length: log.length, infolog: log }]; + }, + + /** + * GLubyte_ptr_t GetString([in] PP_Resource context, + * [in] GLenum name); + */ + PPB_OpenGLES2_GetString: function(json) { + let context = PP_Resource.lookup(json.context).context; + if (json.name == 0x1f03) { // GL_EXTENSIONS + let extensions = context.getSupportedExtensions(); + extensions = extensions.map((v) => { + if (v.startsWith("EXT_") || v.startsWith("OES_")) { + return "GL_" + v; + } + if (v == "WEBGL_compressed_texture_s3tc") { + return "GL_EXT_texture_compression_s3tc"; + } + if (v == "WEBGL_draw_buffers") { + return "GL_EXT_draw_buffers"; + } + return v; + }); + return extensions.join(" "); + } + return PP_Resource.lookup(json.context).context.getParameter(json.name); + }, + + /** + * GLint GetUniformLocation([in] PP_Resource context, + * [in] GLuint program, + * [in] cstr_t name); + */ + PPB_OpenGLES2_GetUniformLocation: function(json) { + let graphics = PP_Resource.lookup(json.context); + let context = graphics.context; + let program = graphics.objects.lookup(json.program); + let location = context.getUniformLocation(program, json.name); + return graphics.objects.add(location); + }, + + /** + * void Hint([in] PP_Resource context, + * [in] GLenum target, + * [in] GLenum mode); + */ + PPB_OpenGLES2_Hint: function(json) { + let graphics = PP_Resource.lookup(json.context); + let context = graphics.context; + context.hint(json.target, json.mode); + }, + + /** + * GLboolean IsEnabled([in] PP_Resource context, + * [in] GLenum cap); + */ + PPB_OpenGLES2_IsEnabled: function(json) { + let graphics = PP_Resource.lookup(json.context); + let context = graphics.context; + return context.isEnabled(json.cap); + }, + + /** + * void LineWidth([in] PP_Resource context, + * [in] GLfloat width); + */ + PPB_OpenGLES2_LineWidth: function(json) { + let graphics = PP_Resource.lookup(json.context); + let context = graphics.context; + context.lineWidth(json.width); + }, + + /** + * void LinkProgram([in] PP_Resource context, + * [in] GLuint program); + */ + PPB_OpenGLES2_LinkProgram: function(json) { + let graphics = PP_Resource.lookup(json.context); + let context = graphics.context; + let program = graphics.objects.lookup(json.program); + context.linkProgram(program); + }, + + /** + * void PixelStorei([in] PP_Resource context, + * [in] GLenum pname, + * [in] GLint param); + */ + PPB_OpenGLES2_PixelStorei: function(json) { + let graphics = PP_Resource.lookup(json.context); + let context = graphics.context; + context.pixelStorei(json.pname, json.param); + }, + + /** + * void PolygonOffset([in] PP_Resource context, + * [in] GLfloat factor, + * [in] GLfloat units); + */ + PPB_OpenGLES2_PolygonOffset: function(json) { + let graphics = PP_Resource.lookup(json.context); + let context = graphics.context; + context.polygonOffset(json.factor, json.units); + }, + + /** + * void ReadPixels([in] PP_Resource context, + * [in] GLint x, + * [in] GLint y, + * [in] GLsizei width, + * [in] GLsizei height, + * [in] GLenum format, + * [in] GLenum type, + * [out] mem_t pixels); + */ + PPB_OpenGLES2_ReadPixels: function(json) { + let graphics = PP_Resource.lookup(json.context); + let context = graphics.context; + let size = GLES2Utils.computeImageDataSize(context, json.width, json.height, json.format, json.type); + let bytes = GLES2Utils.bytesPerElement(context, json.type); + let source; + switch (bytes) { + case 4: + source = new Float32Array(size / 4); + break; + case 2: + source = new Uint16Array(size / 2); + break; + case 1: + source = new Uint8Array(size); + break; + } + context.readPixels(json.x, json.y, json.width, json.height, json.format, json.type, source); + this.setBuffer(json.pixels, source); + return [{ pixels: json.pixels }]; + }, + + /** + * void ReleaseShaderCompiler([in] PP_Resource context); + */ + PPB_OpenGLES2_ReleaseShaderCompiler: function(json) { + let graphics = PP_Resource.lookup(json.context); + let context = graphics.context; + context.releaseShaderCompiler(); + }, + + /** + * void RenderbufferStorage([in] PP_Resource context, + * [in] GLenum target, + * [in] GLenum internalformat, + * [in] GLsizei width, + * [in] GLsizei height); + */ + PPB_OpenGLES2_RenderbufferStorage: function(json) { + let graphics = PP_Resource.lookup(json.context); + let context = graphics.context; + context.renderbufferStorage(json.target, json.internalformat, + json.width, json.height); + }, + + /** + * void SampleCoverage([in] PP_Resource context, + * [in] GLclampf value, + * [in] GLboolean invert); + */ + PPB_OpenGLES2_SampleCoverage: function(json) { + let graphics = PP_Resource.lookup(json.context); + let context = graphics.context; + context.sampleCoverage(json.value, json.invert); + }, + + /** + * void Scissor([in] PP_Resource context, + * [in] GLint x, + * [in] GLint y, + * [in] GLsizei width, + * [in] GLsizei height); + */ + PPB_OpenGLES2_Scissor: function(json) { + let graphics = PP_Resource.lookup(json.context); + let context = graphics.context; + context.scissor(json.x, json.y, json.width, json.height); + }, + + /** + * void ShaderSource([in] PP_Resource context, + * [in] GLuint shader, + * [in] GLsizei count, + * [in, size_is(count)] str_t[] str, + * [in] GLint_ptr_t length); + */ + PPB_OpenGLES2_ShaderSource: function(json) { + let graphics = PP_Resource.lookup(json.context); + let context = graphics.context; + let shader = graphics.objects.lookup(json.shader); + for (let i = 0; i < json.count; ++i) { + context.shaderSource(shader, json.str[i]); + } + }, + + /** + * void StencilFunc([in] PP_Resource context, + * [in] GLenum func, + * [in] GLint ref, + * [in] GLuint mask); + */ + PPB_OpenGLES2_StencilFunc: function(json) { + let graphics = PP_Resource.lookup(json.context); + let context = graphics.context; + context.stencilFunc(json.func, json.ref, json.mask); + }, + + /** + * void StencilFuncSeparate([in] PP_Resource context, + * [in] GLenum face, + * [in] GLenum func, + * [in] GLint ref, + * [in] GLuint mask); + */ + PPB_OpenGLES2_StencilFuncSeparate: function(json) { + let graphics = PP_Resource.lookup(json.context); + let context = graphics.context; + context.stencilFuncSeparate(json.face, json.func, json.ref, json.mask); + }, + + /** + * void StencilMask([in] PP_Resource context, + * [in] GLuint mask); + */ + PPB_OpenGLES2_StencilMask: function(json) { + let graphics = PP_Resource.lookup(json.context); + let context = graphics.context; + context.stencilMask(json.mask); + }, + + /** + * void StencilMaskSeparate([in] PP_Resource context, + * [in] GLenum face, + * [in] GLuint mask); + */ + PPB_OpenGLES2_StencilMaskSeparate: function(json) { + let graphics = PP_Resource.lookup(json.context); + let context = graphics.context; + context.stencilMaskSeparate(json.face, json.mask); + }, + + /** + * void StencilOp([in] PP_Resource context, + * [in] GLenum fail, + * [in] GLenum zfail, + * [in] GLenum zpass); + */ + PPB_OpenGLES2_StencilOp: function(json) { + let graphics = PP_Resource.lookup(json.context); + let context = graphics.context; + context.stencilOp(json.fail, json.zfail, json.zpass); + }, + + /** + * void StencilOpSeparate([in] PP_Resource context, + * [in] GLenum face, + * [in] GLenum fail, + * [in] GLenum zfail, + * [in] GLenum zpass); + */ + PPB_OpenGLES2_StencilOpSeparate: function(json) { + let graphics = PP_Resource.lookup(json.context); + let context = graphics.context; + context.stencilOpSeparate(json.face, json.fail, json.zfail, json.zpass); + }, + + /** + * void TexImage2D([in] PP_Resource context, + * [in] GLenum target, + * [in] GLint level, + * [in] GLint internalformat, + * [in] GLsizei width, + * [in] GLsizei height, + * [in] GLint border, + * [in] GLenum format, + * [in] GLenum type, + * [in] mem_t pixels); + */ + PPB_OpenGLES2_TexImage2D: function(json) { + let graphics = PP_Resource.lookup(json.context); + let context = graphics.context; + context.texImage2D(json.target, json.level, json.internalformat, + json.width, json.height, json.border, json.format, + json.type, json.pixels); + }, + + /** + * void TexParameterf([in] PP_Resource context, + * [in] GLenum target, + * [in] GLenum pname, + * [in] GLfloat param); + */ + PPB_OpenGLES2_TexParameterf: function(json) { + let graphics = PP_Resource.lookup(json.context); + let context = graphics.context; + context.texParameterf(json.target, json.pname, json.param); + }, + + /** + * void TexParameteri([in] PP_Resource context, + * [in] GLenum target, + * [in] GLenum pname, + * [in] GLint param); + */ + PPB_OpenGLES2_TexParameteri: function(json) { + let graphics = PP_Resource.lookup(json.context); + let context = graphics.context; + context.texParameteri(json.target, json.pname, json.param); + }, + + /** + * void TexSubImage2D([in] PP_Resource context, + * [in] GLenum target, + * [in] GLint level, + * [in] GLint xoffset, + * [in] GLint yoffset, + * [in] GLsizei width, + * [in] GLsizei height, + * [in] GLenum format, + * [in] GLenum type, + * [in] mem_t pixels); + */ + PPB_OpenGLES2_TexSubImage2D: function(json) { + let graphics = PP_Resource.lookup(json.context); + let context = graphics.context; + let size = GLES2Utils.computeImageDataSize(context, json.width, json.height, + json.format, json.type); + let data = this.copyBuffer(json.pixels, size); + let bytes = GLES2Utils.bytesPerElement(context, json.type); + let view; + switch (bytes) { + case 4: + view = new Float32Array(data); + break; + case 2: + view = new Uint16Array(data); + break; + case 1: + view = new Uint8Array(data); + break; + } + context.texSubImage2D(json.target, json.level, json.xoffset, json.yoffset, + json.width, json.height, json.format, json.type, view); + }, + + /** + * void Uniform1f([in] PP_Resource context, + * [in] GLint location, + * [in] GLfloat x); + */ + PPB_OpenGLES2_Uniform1f: function(json) { + let graphics = PP_Resource.lookup(json.context); + let context = graphics.context; + let location = graphics.objects.lookup(json.location); + context.uniform1f(location, json.x); + }, + + /** + * void Uniform1i([in] PP_Resource context, + * [in] GLint location, + * [in] GLint x); + */ + PPB_OpenGLES2_Uniform1i: function(json) { + let graphics = PP_Resource.lookup(json.context); + let context = graphics.context; + let location = graphics.objects.lookup(json.location); + context.uniform1i(location, json.x); + }, + + /** + * void Uniform2f([in] PP_Resource context, + * [in] GLint location, + * [in] GLfloat x, + * [in] GLfloat y); + */ + PPB_OpenGLES2_Uniform2f: function(json) { + let graphics = PP_Resource.lookup(json.context); + let context = graphics.context; + let location = graphics.objects.lookup(json.location); + context.uniform2f(location, json.x, json.y); + }, + + /** + * void Uniform2i([in] PP_Resource context, + * [in] GLint location, + * [in] GLint x, + * [in] GLint y); + */ + PPB_OpenGLES2_Uniform2i: function(json) { + let graphics = PP_Resource.lookup(json.context); + let context = graphics.context; + let location = graphics.objects.lookup(json.location); + context.uniform2i(location, json.x, json.y); + }, + + /** + * void Uniform3f([in] PP_Resource context, + * [in] GLint location, + * [in] GLfloat x, + * [in] GLfloat y, + * [in] GLfloat z); + */ + PPB_OpenGLES2_Uniform3f: function(json) { + let graphics = PP_Resource.lookup(json.context); + let context = graphics.context; + let location = graphics.objects.lookup(json.location); + context.uniform3f(location, json.x, json.y, json.z); + }, + + /** + * void Uniform3i([in] PP_Resource context, + * [in] GLint location, + * [in] GLint x, + * [in] GLint y, + * [in] GLint z); + */ + PPB_OpenGLES2_Uniform3i: function(json) { + let graphics = PP_Resource.lookup(json.context); + let context = graphics.context; + let location = graphics.objects.lookup(json.location); + context.uniform3i(location, json.x, json.y, json.z); + }, + + /** + * void Uniform4fv([in] PP_Resource context, + * [in] GLint location, + * [in] GLsizei count, + * [in] GLfloat_ptr_t v); + */ + PPB_OpenGLES2_Uniform4fv: function(json) { + let graphics = PP_Resource.lookup(json.context); + let context = graphics.context; + let location = graphics.objects.lookup(json.location); + let data = this.copyBuffer(json.v, json.count * 4); + context.uniform4fv(location, new Float32Array(data)); + }, + + /** + * void Uniform4f([in] PP_Resource context, + * [in] GLint location, + * [in] GLfloat x, + * [in] GLfloat y, + * [in] GLfloat z, + * [in] GLfloat w); + */ + PPB_OpenGLES2_Uniform4f: function(json) { + let graphics = PP_Resource.lookup(json.context); + let context = graphics.context; + let location = graphics.objects.lookup(json.location); + context.uniform4f(location, json.x, json.y, json.z, json.w); + }, + + /** + * void Uniform4i([in] PP_Resource context, + * [in] GLint location, + * [in] GLint x, + * [in] GLint y, + * [in] GLint z, + * [in] GLint w); + */ + PPB_OpenGLES2_Uniform4i: function(json) { + let graphics = PP_Resource.lookup(json.context); + let context = graphics.context; + let location = graphics.objects.lookup(json.location); + context.uniform4i(location, json.x, json.y, json.z, json.w); + }, + + /** + * void UniformMatrix3fv([in] PP_Resource context, + * [in] GLint location, + * [in] GLsizei count, + * [in] GLboolean transpose, + * [in] GLfloat_ptr_t value); + */ + PPB_OpenGLES2_UniformMatrix3fv: function(json) { + let graphics = PP_Resource.lookup(json.context); + let context = graphics.context; + let location = graphics.objects.lookup(json.location); + context.uniformMatrix3fv(location, json.transpose, json.value); + }, + + /** + * void UseProgram([in] PP_Resource context, + * [in] GLuint program); + */ + PPB_OpenGLES2_UseProgram: function(json) { + let graphics = PP_Resource.lookup(json.context); + let context = graphics.context; + let program = graphics.objects.lookup(json.program); + context.useProgram(program); + }, + + /** + * void ValidateProgram([in] PP_Resource context, + * [in] GLuint program); + */ + PPB_OpenGLES2_ValidateProgram: function(json) { + let graphics = PP_Resource.lookup(json.context); + let context = graphics.context; + let program = graphics.objects.lookup(json.program); + context.validateProgram(program); + }, + + /** + * void VertexAttrib1f([in] PP_Resource context, + * [in] GLuint indx, + * [in] GLfloat x); + */ + PPB_OpenGLES2_VertexAttrib1f: function(json) { + let graphics = PP_Resource.lookup(json.context); + let context = graphics.context; + context.vertexAttrib1f(json.indx, json.x); + }, + + /** + * void VertexAttrib2f([in] PP_Resource context, + * [in] GLuint indx, + * [in] GLfloat x, + * [in] GLfloat y); + */ + PPB_OpenGLES2_VertexAttrib2f: function(json) { + let graphics = PP_Resource.lookup(json.context); + let context = graphics.context; + context.vertexAttrib2f(json.indx, json.x, json.y); + }, + + /** + * void VertexAttrib3f([in] PP_Resource context, + * [in] GLuint indx, + * [in] GLfloat x, + * [in] GLfloat y, + * [in] GLfloat z); + */ + PPB_OpenGLES2_VertexAttrib3f: function(json) { + let graphics = PP_Resource.lookup(json.context); + let context = graphics.context; + context.vertexAttrib3f(json.indx, json.x, json.y, json.z); + }, + + /** + * void VertexAttrib4f([in] PP_Resource context, + * [in] GLuint indx, + * [in] GLfloat x, + * [in] GLfloat y, + * [in] GLfloat z, + * [in] GLfloat w); + */ + PPB_OpenGLES2_VertexAttrib4f: function(json) { + let graphics = PP_Resource.lookup(json.context); + let context = graphics.context; + context.vertexAttrib4f(json.indx, json.x, json.y, json.z, json.w); + }, + + /** + * void VertexAttribPointer([in] PP_Resource context, + * [in] GLuint indx, + * [in] GLint size, + * [in] GLenum type, + * [in] GLboolean normalized, + * [in] GLsizei stride, + * [in] mem_t ptr); + */ + PPB_OpenGLES2_VertexAttribPointer: function(json) { + let graphics = PP_Resource.lookup(json.context); + let context = graphics.context; + if (json.ptr !== null) + throw Error("Need to convert ptr to an offset!"); + context.vertexAttribPointer(json.indx, json.size, json.type, + json.normalized, json.stride, json.ptr); + }, + + /** + * void Viewport([in] PP_Resource context, + * [in] GLint x, + * [in] GLint y, + * [in] GLsizei width, + * [in] GLsizei height); + */ + PPB_OpenGLES2_Viewport: function(json) { + let graphics = PP_Resource.lookup(json.context); + let context = graphics.context; + context.viewport(json.x, json.y, json.width, json.height); + }, + + + /** + * mem_t MapTexSubImage2DCHROMIUM([in] PP_Resource context, + * [in] GLenum target, + * [in] GLint level, + * [in] GLint xoffset, + * [in] GLint yoffset, + * [in] GLsizei width, + * [in] GLsizei height, + * [in] GLenum format, + * [in] GLenum type, + * [in] GLenum access); + */ + PPB_OpenGLES2ChromiumMapSub_MapTexSubImage2DCHROMIUM: function(json) { + let graphics = PP_Resource.lookup(json.context); + let context = graphics.context; + let size = GLES2Utils.computeImageDataSize(context, json.width, json.height, + json.format, json.type); + let mem = this.allocateCachedBuffer(size); + graphics.mappedTextures.set(mem, () => { + let source = this.getCachedBuffer(mem); + let bytes = GLES2Utils.bytesPerElement(context, json.type); + let view; + switch (bytes) { + case 4: + view = new Float32Array(source); + break; + case 2: + view = new Uint16Array(source); + break; + case 1: + view = new Uint8Array(source); + break; + } + context.texSubImage2D(json.target, json.level, json.xoffset, + json.yoffset, json.width, json.height, + json.format, json.type, view); + this.freeCachedBuffer(mem); + }); + return mem; + }, + + /** + * void UnmapTexSubImage2DCHROMIUM([in] PP_Resource context, + * [in] mem_t mem); + */ + PPB_OpenGLES2ChromiumMapSub_UnmapTexSubImage2DCHROMIUM: function(json) { + let graphics = PP_Resource.lookup(json.context); + let context = graphics.context; + let mappedTexture = graphics.mappedTextures.get(json.mem); + graphics.mappedTextures.delete(json.mem); + mappedTexture(); + }, + + + /** + * PP_Resource GetFontFileWithFallback([in] PP_Instance instance, + * [in] PP_BrowserFont_Trusted_Description description, + * [in] PP_PrivateFontCharset charset); + */ + PPB_PDF_GetFontFileWithFallback: function(json) { + return 0; + }, + + /** + * void SearchString( + * [in] PP_Instance instance, + * [in] mem_t str, + * [in] mem_t term, + * [in] PP_Bool case_sensitive, + * [out, size_is(count)] PP_PrivateFindResult[] results, + * [out] int32_t count); + */ + PPB_PDF_SearchString: function(json) { + // Retrieve data from buffer + let tmp = ""; + let data = ""; + let term = ""; + let i = 0; + while (1) { + tmp = this.copyBuffer(json.str + i * 2, 2); + if ((new Uint16Array(tmp))[0] == 0) { + tmp = this.copyBuffer(json.str, i * 2); + data = new TextDecoder("utf-16").decode(tmp); + break; + } + ++i; + } + + // Retrieve term from buffer + i = 0; + while (1) { + tmp = this.copyBuffer(json.term + i * 2, 2); + if ((new Uint16Array(tmp))[0] == 0) { + tmp = this.copyBuffer(json.term, i * 2); + term = new TextDecoder("utf-16").decode(tmp); + break; + } + ++i; + } + + // FIXME Should use ICU to search string + let results = []; + let n = -1; + if (PP_Bool[json.case_sensitive] == PP_Bool.PP_FALSE) { + // case-insensitive + data = data.toLowerCase(); + term = term.toLowerCase(); + } + while ((n = data.indexOf(term, n + 1)) != -1) { + results.push({start_index: n, length: term.length}); + } + return [{results, count: results.length}]; + }, + + /* + * void SetSelectedText( + * [in] PP_Instance instance, + * [in] str_t selected_text); + */ + PPB_PDF_SetSelectedText: function(json) { + let instance = this.instances[json.instance]; + instance.selectedText = json.selected_text; + }, + + + /** + * PP_Resource Create([in] PP_Instance instance); + */ + PPB_Printing_Dev_Create: function(json) { + return new PrintingDev(this.instances[json.instance]); + }, + + + /** + * PP_Resource Create([in] PP_Instance instance); + */ + PPB_TCPSocket_Private_Create: function(json) { + return new TCPSocketPrivate(this.instances[json.instance]); + }, + + /** + * int32_t Connect([in] PP_Resource tcp_socket, + * [in] str_t host, + * [in] uint16_t port, + * [in] PP_CompletionCallback callback); + */ + PPB_TCPSocket_Private_Connect: function(json) { + let socket = PP_Resource.lookup(json.tcp_socket); + socket.connect(json.host, json.port, json.callback); + return PP_OK_COMPLETIONPENDING; + }, + + /** + * PP_Bool GetLocalAddress([in] PP_Resource tcp_socket, + * [out] PP_NetAddress_Private local_addr); + */ + PPB_TCPSocket_Private_GetLocalAddress: function(json) { + let socket = PP_Resource.lookup(json.tcp_socket); + let localAddr = socket.localAddress; + if (!localAddr) { + return [PP_Bool.PP_FALSE, { local_addr: null }]; + } + return [PP_Bool.PP_FALSE, { local_addr: { size: localAddr.length, data: localAddr } }]; + }, + + /** + * PP_Bool GetRemoteAddress([in] PP_Resource tcp_socket, + * [out] PP_NetAddress_Private remote_addr); + */ + PPB_TCPSocket_Private_GetRemoteAddress: function(json) { + let socket = PP_Resource.lookup(json.tcp_socket); + let remoteAddr = socket.remoteAddress; + if (!remoteAddr) { + return [PP_Bool.PP_FALSE, { remote_addr: null }]; + } + return [PP_Bool.PP_FALSE, { remote_addr: { size: remoteAddr.length, data: remoteAddr } }]; + }, + + /** + * int32_t Read([in] PP_Resource tcp_socket, + * [out] str_t buffer, + * [in] int32_t bytes_to_read, + * [in] PP_CompletionCallback callback); + */ + PPB_TCPSocket_Private_Read: function(json) { + let socket = PP_Resource.lookup(json.tcp_socket); + socket.read(json.buffer, json.bytes_to_read, json.callback); + return [PP_OK_COMPLETIONPENDING, { buffer: "" }]; + }, + + /** + * int32_t Write([in] PP_Resource tcp_socket, + * [in] str_t buffer, + * [in] int32_t bytes_to_write, + * [in] PP_CompletionCallback callback); + */ + PPB_TCPSocket_Private_Write: function(json) { + let socket = PP_Resource.lookup(json.tcp_socket); + if (!socket.write(json.buffer)) { + return PP_ERROR_FAILED; + } + socket.instance.rt.call(new CallbackCall("PP_CompletionCallback", json.callback, { result: json.bytes_to_write })); + return PP_OK_COMPLETIONPENDING; + }, + + /** + * void Disconnect([in] PP_Resource tcp_socket); + */ + PPB_TCPSocket_Private_Disconnect: function(json) { + let socket = PP_Resource.lookup(json.tcp_socket).impl; + socket.close(); + }, + + + /** + * PP_Resource Create( + * [in] PP_Instance instance); + */ + PPB_URLLoader_Create: function(json) { + return new URLLoader(this.instances[json.instance]); + }, + + /** + * int32_t Open( + * [in] PP_Resource loader, + * [in] PP_Resource request_info, + * [in] PP_CompletionCallback callback); + */ + PPB_URLLoader_Open: function(json) { + let loader = PP_Resource.lookup(json.loader); + let requestInfo = PP_Resource.lookup(json.request_info); + loader.openURL(requestInfo.getProperty(PP_URLRequestProperty.PP_URLREQUESTPROPERTY_METHOD), + requestInfo.getProperty(PP_URLRequestProperty.PP_URLREQUESTPROPERTY_URL), + (result) => { loader.instance.rt.call(new CallbackCall("PP_CompletionCallback", json.callback, { result: result })); }); + return PP_OK_COMPLETIONPENDING; + }, + + /** + * [always_set_output_parameters] + * PP_Bool GetDownloadProgress( + * [in] PP_Resource loader, + * [out] int64_t bytes_received, + * [out] int64_t total_bytes_to_be_received); + */ + PPB_URLLoader_GetDownloadProgress: function(json) { + let loader = PP_Resource.lookup(json.loader); + return [PP_Bool.PP_TRUE, { bytes_received: loader.bytes_received, total_bytes_to_be_received: loader.total_bytes_to_be_received }]; + }, + + /** + * PP_Resource GetResponseInfo( + * [in] PP_Resource loader); + */ + PPB_URLLoader_GetResponseInfo: function(json) { + return PP_Resource.lookup(json.loader).responseInfo; + }, + + /** + * int32_t ReadResponseBody( + * [in] PP_Resource loader, + * [out] mem_t buffer, + * [in] int32_t bytes_to_read, + * [in] PP_CompletionCallback callback); + */ + PPB_URLLoader_ReadResponseBody: function(json) { + let loader = PP_Resource.lookup(json.loader); + let bytesRead = loader.readResponse(json.buffer, + json.bytes_to_read, + (bytesRead) => loader.instance.rt.call(new CallbackCall("PP_CompletionCallback", json.callback, { result: bytesRead }))); + // FIXME Why is buffer an out param? + return [bytesRead < 0 ? PP_OK_COMPLETIONPENDING : bytesRead, { buffer: json.buffer }]; + }, + + + /** + * void GrantUniversalAccess([in] PP_Resource loader); + */ + PPB_URLLoaderTrusted_GrantUniversalAccess: function(json) { + PP_Resource.lookup(json.loader).grantedUniversalAccess = true; + }, + + + /** + * PP_Resource Create( + * [in] PP_Instance instance); + */ + PPB_URLRequestInfo_Create: function(json) { + return new URLRequestInfo(this.instances[json.instance]); + }, + + /** + * PP_Bool SetProperty( + * [in] PP_Resource request, + * [in] PP_URLRequestProperty property, + * [in] PP_Var value); + */ + PPB_URLRequestInfo_SetProperty: function(json) { + let request = PP_Resource.lookup(json.request); + let value; + let type = PP_VarType[json.value.type]; + let property = PP_URLRequestProperty[json.property]; + switch (property) { + case PP_URLRequestProperty.PP_URLREQUESTPROPERTY_CUSTOMREFERRERURL: + case PP_URLRequestProperty.PP_URLREQUESTPROPERTY_CUSTOMCONTENTTRANSFERENCODING: + case PP_URLRequestProperty.PP_URLREQUESTPROPERTY_CUSTOMUSERAGENT: + if (type == PP_VarType.PP_VARTYPE_UNDEFINED) { + value = undefined; + break; + } + /* falls through */ + + case PP_URLRequestProperty.PP_URLREQUESTPROPERTY_URL: + case PP_URLRequestProperty.PP_URLREQUESTPROPERTY_METHOD: + case PP_URLRequestProperty.PP_URLREQUESTPROPERTY_HEADERS: + if (type != PP_VarType.PP_VARTYPE_STRING) { + throw Error("Expected string resource property"); + } + value = String_PP_Var.getAsJSValue(json.value); + break; + + case PP_URLRequestProperty.PP_URLREQUESTPROPERTY_STREAMTOFILE: + case PP_URLRequestProperty.PP_URLREQUESTPROPERTY_FOLLOWREDIRECTS: + case PP_URLRequestProperty.PP_URLREQUESTPROPERTY_RECORDDOWNLOADPROGRESS: + case PP_URLRequestProperty.PP_URLREQUESTPROPERTY_RECORDUPLOADPROGRESS: + case PP_URLRequestProperty.PP_URLREQUESTPROPERTY_ALLOWCROSSORIGINREQUESTS: + case PP_URLRequestProperty.PP_URLREQUESTPROPERTY_ALLOWCREDENTIALS: + if (type != PP_VarType.PP_VARTYPE_BOOL) { + throw Error("Expected boolean resource property"); + } + value = Bool_PP_Var.getAsJSValue(json.value); + break; + + case PP_URLRequestProperty.PP_URLREQUESTPROPERTY_PREFETCHBUFFERUPPERTHRESHOLD: + case PP_URLRequestProperty.PP_URLREQUESTPROPERTY_PREFETCHBUFFERLOWERTHRESHOLD: + if (type != PP_VarType.PP_VARTYPE_INT32) { + throw Error("Expected integer resource property"); + } + value = Int32_PP_Var.getAsJSValue(json.value); + break; + } + + request.setProperty(property, value); + return PP_Bool.PP_TRUE; + }, + + + /** + * PP_Var GetProperty( + * [in] PP_Resource response, + * [in] PP_URLResponseProperty property); + */ + PPB_URLResponseInfo_GetProperty: function(json) { + let response = PP_Resource.lookup(json.response); + return response.getProperty(PP_URLResponseProperty[json.property]); + }, + + + /** + * PP_Var GetDocumentURL([in] PP_Instance instance, + * [out] PP_URLComponents_Dev components); + */ + PPB_URLUtil_Dev_GetDocumentURL: function(json) { + var url = this.instances[json.instance].info.documentURL; + return [new String_PP_Var(url), { components: this.parseURL(url) }]; + }, + + /** + * PP_Var GetPluginInstanceURL([in] PP_Instance instance, + * [out] PP_URLComponents_Dev components); + */ + PPB_URLUtil_Dev_GetPluginInstanceURL: function(json) { + var url = this.instances[json.instance].info.url; + return [new String_PP_Var(url), { components: this.parseURL(url) }]; + }, + + + /** + * void AddRef([in] PP_Var var); + */ + PPB_Var_AddRef: function(json) { + json.var.type = PP_VarType[json.var.type]; + PP_Var_Cached.addRef(json.var); + }, + + /** + * void Release([in] PP_Var var); + */ + PPB_Var_Release: function(json) { + json.var.type = PP_VarType[json.var.type]; + PP_Var_Cached.release(json.var); + }, + + /** + * PP_Var VarFromUtf8([in] str_t data, [in] uint32_t len); + */ + PPB_Var_VarFromUtf8: function(json) { + return new String_PP_Var(json.data); + }, + + /** + * str_t VarToUtf8([in] PP_Var var, [out] uint32_t len); + */ + PPB_Var_VarToUtf8: function(json) { + if (PP_VarType[json.var.type] != PP_VarType.PP_VARTYPE_STRING) { + return [null, { len: 0 }]; + } + let data = String_PP_Var.getAsJSValue(json.var); + let converted = new TextEncoder().encode(data); + return [data, { len: converted.length }]; + }, + + + /** + * PP_Bool IsInstanceOf([in] PP_Var var, + * [in, ref] PPP_Class_Deprecated object_class, + * [out] mem_t object_data); + */ + PPB_Var_Deprecated_IsInstanceOf: function(json) { + let [object, instance] = Object_PP_Var.getAsJSValueWithInstance(json.var); + let [isInstanceOf, object_data] = instance.mm.sendRpcMessage("ppapiflash.js:isInstanceOf", { objectClass: json.object_class }, { object, instance })[0]; + if (!isInstanceOf) { + return PP_Bool.PP_FALSE; + } + return [PP_Bool.PP_TRUE, { object_data }]; + }, + + /** + * PP_Var CreateObject([in] PP_Instance instance, + * [in, ref] PPP_Class_Deprecated object_class, + * [inout] mem_t object_data); + */ + PPB_Var_Deprecated_CreateObject: function(json) { + let instance = this.instances[json.instance]; + let call = (name, args) => { + let callObj = { __interface: "PPP_Class_Deprecated;1.0", __instance: json.object_class, __member: name, object: json.object_data }; + args = JSON.parse(args); + if (args) { + args.entries().map((name, value) => { + callObj[name] = PP_Var.fromJSValue(value, instance); + }); + } + return this.call(callObj, true); + }; + return instance.mm.sendRpcMessage("ppapiflash.js:createObject", { objectClass: json.object_class, objectData: json.object_data }, { instance, call })[0]; + }, + + /** + * PP_Var GetProperty([in] PP_Var object, + * [in] PP_Var name, + * [out] PP_Var exception); + */ + PPB_Var_Deprecated_GetProperty: function(json) { + let [object, instance] = Object_PP_Var.getAsJSValueWithInstance(json.object); + let name = String_PP_Var.getAsJSValue(json.name); + return instance.mm.sendRpcMessage("ppapiflash.js:getProperty", { name }, { object, instance })[0]; + }, + + + /** + * PP_Var Create(); + */ + PPB_VarArray_Create: function(json) { + return new Array_PP_Var(); + }, + + /** + * PP_Var Get([in] PP_Var array, [in] uint32_t index); + */ + PPB_VarArray_Get: function(json) { + let array = Array_PP_Var.getAsJSValue(json.dict); + if (json.index >= array.length) { + return new PP_Var(); + } + let value = array[json.index]; + PP_Var_Cached.addRef(value); + return PP_Var.normalize(value); + }, + + /** + * PP_Bool Set([in] PP_Var array, [in] uint32_t index, [in] PP_Var value); + */ + PPB_VarArray_Set: function(json) { + json.value.type = PP_VarType[json.value.type]; + Array_PP_Var.getAsJSValue(json.array)[json.index] = json.value; + PP_Var_Cached.addRef(json.value); + return PP_Bool.PP_TRUE; + }, + + /** + * uint32_t GetLength([in] PP_Var array); + */ + PPB_VarArray_GetLength: function(json) { + return Array_PP_Var.getAsJSValue(json.array).length; + }, + + /** + * PP_Var Create(); + */ + PPB_VarDictionary_Create: function(json) { + return new Dictionary_PP_Var(); + }, + + /** + * PP_Var Get([in] PP_Var dict, [in] PP_Var key); + */ + PPB_VarDictionary_Get: function(json) { + let value = Dictionary_PP_Var.getAsJSValue(json.dict)[String_PP_Var.getAsJSValue(json.key)]; + if (value === undefined) { + return new PP_Var(); + } + PP_Var_Cached.addRef(value); + return PP_Var.normalize(value); + }, + + /** + * PP_Bool Set([in] PP_Var dict, [in] PP_Var key, [in] PP_Var value); + */ + PPB_VarDictionary_Set: function(json) { + json.value.type = PP_VarType[json.value.type]; + Dictionary_PP_Var.getAsJSValue(json.dict)[String_PP_Var.getAsJSValue(json.key)] = json.value; + PP_Var_Cached.addRef(json.value); + return PP_Bool.PP_TRUE; + }, + + + /** + * PP_Resource Create( + * [in] PP_Instance instance); + */ + PPB_VideoCapture_Dev_Create: function(json) { + return 0; + }, + + /** + * int32_t EnumerateDevices( + * [in] PP_Resource video_capture, + * [in] PP_ArrayOutput output, + * [in] PP_CompletionCallback callback); + */ + PPB_VideoCapture_Dev_EnumerateDevices: function(json) { + return PP_ERROR_BADRESOURCE; + }, + + + /** + * PP_Resource Create( + * [in] PP_Instance instance, + * [in] PP_Resource context, + * [in] PP_VideoDecoder_Profile profile); + */ + PPB_VideoDecoder_Dev_Create: function(json) { + return 0; + }, + + + /** + * PP_Bool GetRect([in] PP_Resource resource, + * [out] PP_Rect rect); + */ + PPB_View_GetRect: function(json) { + let view = PP_Resource.lookup(json.resource); + let rect = view.instance.boundingRect; + return [PP_Bool.PP_TRUE, { rect: { point: { x: rect.left, y: rect.top }, size: { width: rect.width, height: rect.height } } }]; + }, + + /** + * PP_Bool GetClipRect([in] PP_Resource resource, + * [out] PP_Rect clip); + */ + PPB_View_GetClipRect: function(json) { + let view = PP_Resource.lookup(json.resource); + let point = { x: 0, y: 0 }; + let size; + if (view.instance.throttled) { + size = { width: 0, height: 0 }; + } else { + let rect = view.instance.boundingRect; + size = { width: rect.width, height: rect.height }; + } + return [PP_Bool.PP_TRUE, { rect: { point, size } }]; + }, + + /** + * float_t GetDeviceScale([in] PP_Resource resource); + */ + PPB_View_GetDeviceScale: function(json) { + // FIXME Need to figure out how to get the ratio between device pixels + // and DIPs. + let view = PP_Resource.lookup(json.resource); + return 1; //view.instance.window.devicePixelRatio; + }, + + /** + * float_t GetCSSScale([in] PP_Resource resource); + */ + PPB_View_GetCSSScale: function(json) { + // FIXME Need to figure out how to get the ratio between CSS pixels + // and DIPs. + let view = PP_Resource.lookup(json.resource); + return view.instance.window.devicePixelRatio; + }, + + /** + * PP_Bool GetScrollOffset([in] PP_Resource resource, + * [out] PP_Point offset); + */ + PPB_View_GetScrollOffset: function(json) { + let view = PP_Resource.lookup(json.resource); + let position = view.instance.viewport.getScrollOffset(); + return [ PP_Bool.PP_TRUE, { offset: position }]; + }, + + /** + * float_t GetDeviceScale([in] PP_Resource resource); + */ + PPB_View_Dev_GetDeviceScale: function(json) { + let view = PP_Resource.lookup(json.resource); + return view.instance.window.devicePixelRatio; + }, + + /** + * PP_Bool IsWheelInputEvent([in] PP_Resource resource); + */ + PPB_WheelInputEvent_IsWheelInputEvent: function(json) { + let resource = PP_Resource.lookup(json.resource); + return resource instanceof WheelInputEvent ? PP_Bool.PP_TRUE : PP_Bool.PP_FALSE; + }, + + /** + * PP_FloatPoint GetTicks([in] PP_Resource wheel_event); + */ + PPB_WheelInputEvent_GetTicks: function(json) { + let event = PP_Resource.lookup(json.wheel_event); + return { x: event.domEvent.deltaX, y: event.domEvent.deltaY }; + }, + + /** + * PP_Bool GetScrollByPage([in] PP_Resource wheel_event); + */ + PPB_WheelInputEvent_GetScrollByPage: function(json) { + let event = PP_Resource.lookup(json.wheel_event); + return event.domEvent.deltaMode == event.domEvent.DOM_DELTA_PAGE + ? PP_Bool.PP_TRUE : PP_Bool.PP_FALSE; + }, + }, +}; + +var EXPORTED_SYMBOLS = ["PPAPIRuntime"]; diff --git a/browser/extensions/mortar/host/flash/bootstrap.js b/browser/extensions/mortar/host/flash/bootstrap.js new file mode 100644 index 000000000000..f8225653ce07 --- /dev/null +++ b/browser/extensions/mortar/host/flash/bootstrap.js @@ -0,0 +1,74 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +const { classes: Cc, interfaces: Ci, utils: Cu, results: Cr } = Components; + +Cu.import("resource://gre/modules/Services.jsm"); + +function sandboxScript(sandbox) +{ + dump("sandboxScript " + sandbox.pluginElement + "\n"); + Components.classes["@mozilla.org/moz/jssubscript-loader;1"].getService(Components.interfaces.mozIJSSubScriptLoader).loadSubScript("resource://ppapiflash.js/ppapi-content-sandbox.js", sandbox); +} + +let plugins; +function startup(data) { + dump(">>>STARTED!!!\n"); + + let root = data.installPath.parent.parent; + let rpclib = root.clone(); + let pluginlib = root.clone(); + let os = Cc["@mozilla.org/xre/app-info;1"].getService(Ci.nsIXULRuntime).OS; + if (os == "Darwin") { + rpclib.appendRelativePath("ppapi/out/rpc.dylib"); + pluginlib.appendRelativePath("plugin/PepperFlashPlayer-debug"); + } else if (os == "Linux") { + rpclib.appendRelativePath("ppapi/out/rpc.so"); + pluginlib.appendRelativePath("plugin/libpepflashplayer.so"); + } else if (os == "WINNT") { + rpclib.appendRelativePath("ppapi\\out\\rpc.dll"); + pluginlib.appendRelativePath("plugin\\pepflashplayer.dll"); + } else { + throw("Don't know the path to the libraries for this OS!"); + } + rpclib = rpclib.path; + pluginlib = pluginlib.path; + + let pluginHost = Cc["@mozilla.org/plugin/host;1"].getService(Ci.nsIPluginHost); + let plugin = pluginHost.registerFakePlugin({ + handlerURI: "chrome://ppapiflash.js/content/viewer.html", + mimeEntries: [{ type: "application/x-shockwave-flash", extension: "swf" }], + name: "Shockwave Flash", + niceName: "PPAPI Flash plugin", + description: "10", + version: "1.0", + sandboxScript : `(${sandboxScript.toSource()})(this);`, + ppapiProcessArgs: [ rpclib, pluginlib ], + }); + plugin.enabledState = Ci.nsIPluginTag.STATE_ENABLED; + + let rng = Cc["@mozilla.org/security/random-generator;1"].createInstance(Ci.nsIRandomGenerator); + Services.ppmm.addMessageListener("ppapi.js:generateRandomBytes", ({ data }) => { + return rng.generateRandomBytes(data); + }); + + let moduleLocalFiles = Services.dirsvc.get("ProfD", Ci.nsILocalFile); + moduleLocalFiles.append("Flash PPAPI Data"); + try { + moduleLocalFiles.create(Ci.nsIFile.DIRECTORY_TYPE, 0o755); + } catch (e) { + if (e.result != Cr.NS_ERROR_FILE_ALREADY_EXISTS) { + throw e; + } + } + Services.ppmm.addMessageListener("ppapiflash.js:getModuleLocalFilesPath", () => { + return moduleLocalFiles.path; + }); + + dump("<< + + + + + + + + + + + + diff --git a/browser/extensions/mortar/host/flash/install.rdf b/browser/extensions/mortar/host/flash/install.rdf new file mode 100644 index 000000000000..c6f3105e32d5 --- /dev/null +++ b/browser/extensions/mortar/host/flash/install.rdf @@ -0,0 +1,25 @@ + + + + + + ppapiflash.js@mozilla.org + ppapiflash.js + ppapiflash.js + 0.1 + 2 + true + true + + + {ec8030f7-c20a-464f-9b0e-13a3a9e97384} + 37.0 + 45.* + + + false + + diff --git a/browser/extensions/mortar/host/flash/ppapi-content-sandbox.js b/browser/extensions/mortar/host/flash/ppapi-content-sandbox.js new file mode 100644 index 000000000000..b668ae107bd2 --- /dev/null +++ b/browser/extensions/mortar/host/flash/ppapi-content-sandbox.js @@ -0,0 +1,226 @@ +/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +/** + * This code runs in the sandbox in the content process where the page that + * loaded the plugin lives. It communicates with the process where the PPAPI + * implementation lives. + */ +const { utils: Cu } = Components; + +let mm = pluginElement.frameLoader.messageManager; +let containerWindow = pluginElement.ownerDocument.defaultView; + +function mapValue(v, instance) { + return instance.rt.toPP_Var(v, instance); +} + +dump("<>>>>>>>>>>>>>>>>>>>> AHA <<<<<<<<<<<<<<<<<<<<<>\n"); +dump(`pluginElement: ${pluginElement.toSource()}\n`); +dump(`pluginElement.frameLoader: ${pluginElement.frameLoader.toSource()}\n`); +dump(`pluginElement.frameLoader.messageManager: ${pluginElement.frameLoader.messageManager.toSource()}\n`); +dump("<>>>>>>>>>>>>>>>>>>>> AHA2 <<<<<<<<<<<<<<<<<<<<<>\n"); + +mm.addMessageListener("ppapi.js:frameLoaded", ({ target }) => { + let tagName = pluginElement.nodeName; + + // Getting absolute URL from the EMBED tag + let url = pluginElement.srcURI.spec; + let objectParams = new Map(); + for (let i = 0; i < pluginElement.attributes.length; ++i) { + let paramName = pluginElement.attributes[i].localName; + objectParams.set(paramName, pluginElement.attributes[i].value); + } + if (tagName == "OBJECT") { + let params = pluginElement.getElementsByTagName("param"); + Array.prototype.forEach.call(params, (p) => { + var paramName = p.getAttribute("name").toLowerCase(); + objectParams.set(paramName, p.getAttribute("value")); + }); + } + + let documentURL = pluginElement.ownerDocument.location.href; + let baseUrl = documentURL; + if (objectParams.base) { + try { + let parsedDocumentUrl = Services.io.newURI(documentURL); + baseUrl = Services.io.newURI(objectParams.base, null, parsedDocumentUrl).spec; + } catch (e) { /* ignore */ } + } + + let info = { + url, + documentURL, + isFullFrame: pluginElement.ownerDocument.mozSyntheticDocument, + setupJSInstanceObject: true, + arguments: { + keys: Array.from(objectParams.keys()), + values: Array.from(objectParams.values()), + }, + }; + + mm.sendAsyncMessage("ppapi.js:createInstance", { type: "flash", info }, + { pluginWindow: containerWindow }); +}); + +mm.addMessageListener("ppapiflash.js:executeScript", ({ data, objects: { instance } }) => { + return mapValue(containerWindow.eval(data), instance); +}); + +let jsInterfaceObjects = new WeakMap(); + +mm.addMessageListener("ppapiflash.js:createObject", ({ data: { objectClass, objectData }, objects: { instance, call: callRemote } }) => { + dump("ppapiflash.js:createObject\n"); + let call = (name, args) => { +/* + let metaData = target[Symbol.for("metaData")]; + let callObj = { __interface: "PPP_Class_Deprecated;1.0", __instance: metaData.objectClass, __member: name, object: metaData.objectData }; +*/ +dump("ppapiflash.js:createObject -> call\n"); +try { + let result = callRemote(name, JSON.stringify(args)); +} catch (e) { + dump("FIXME: we rely on CPOWs!\n"); + return undefined; +} +dump("RESULT: " + result[0] + "\n"); +dump("EXCEPTION: " + result[1] + "\n"); + return result[0]; + }; + + const handler = { + // getPrototypeOf -> target (see bug 888969) + // setPrototypeOf -> target (see bug 888969) + // isExtensible -> target + // preventExtensions -> target + getOwnPropertyDescriptor: function(target, name) { + let value = this.get(target, name); + if (this._hasProperty(target, name)) { + return { + "writable": true, + "enumerable": true, + "configurable": true, + "get": this.get.bind(this, target, name), + "set": this.set.bind(this, target, name), + }; + } + + if (this._hasMethod(target, name)) { + return { + "value": (...args) => { + //call("Call", { name, argc, argv, exception }); + }, + "writable": true, + "enumerable": true, + "configurable": true, + }; + } + + return undefined; + }, + // defineProperty -> target + has: function(target, name) { + return this._hasProperty(target, name) || this._hasMethod(target, name); + }, + get: function(target, name, receiver) { + dump(`Calling GetProperty for ${name.toSource()}\n`); + let prop = call("GetProperty", { name }); + if (!prop || PP_VarType[prop.type] == PP_VarType.PP_VARTYPE_UNDEFINED) { + // FIXME Need to get the exception! + return undefined; + } + return prop; + }, + set: function(target, name, value, receiver) { + call("SetProperty", { name, value }); + // FIXME Need to get the exception! + return true; + }, + deleteProperty: function(target, name) { + call("RemoveProperty", { name }); + // FIXME Need to get the exception! + return true; + }, + enumerate: function(target) { + let keys = this.ownKeys(target); + return keys[Symbol.iterator]; + }, + ownKeys: function(target) { + let result = call("GetAllPropertyNames"); + dump(result.toSource() + "\n"); + dump(typeof result.properties + "\n"); + return result.properties; + }, + apply: function(target, thisArg, args) { + }, + construct: function(target, args) { + //call("Construct", { argc, argv, exception }); + }, + + _hasProperty: function(target, name) { + return call("HasProperty", { name }) == 1 /* PP_Bool.PP_TRUE */; + }, + _hasMethod: function(target, name) { + return call("HasMethod", { name }) == 1 /* PP_Bool.PP_TRUE */; + }, + }; + + let metaData = { + objectClass, + objectData, + }; + + let clonedHandler = Cu.cloneInto(handler, containerWindow, { cloneFunctions: true }); + let clonedMetaData = Cu.cloneInto(metaData, containerWindow, { cloneFunctions: true }); + let target = Cu.createObjectIn(containerWindow); + target[Symbol.for("metaData")] = clonedMetaData; + +dump("IN CREATEOBJECT\n"); + let proxy = new containerWindow.Proxy(target, clonedHandler); + jsInterfaceObjects.set(proxy, metaData); + let foo = mapValue(proxy.wrappedJSObject, instance); +dump("CREATEDOBJECT: " + foo.toSource() + "\n"); + return foo; +}); + +mm.addMessageListener("ppapiflash.js:isInstanceOf", ({ data: { objectClass }, objects: { object, instance } }) => { + let metaData = jsInterfaceObjects.get(object); + if (!metaData || metaData.objectClass != objectClass) { + return [false]; + } + return [true, metaData.objectData]; +}); + +mm.addMessageListener("ppapiflash.js:getProperty", ({ data: { name }, objects: { object, instance } }) => { + try { + return [mapValue(object[name], instance), { exception: null }]; + } catch (e) { + return [mapValue(null, instance), { exception: mapValue(e, instance) }]; + } +}); + +mm.addMessageListener("ppapiflash.js:log", ({ data }) => { + containerWindow.console.log(data); +}); + +mm.addMessageListener("ppapiflash.js:setInstancePrototype", ({ objects: { proto } }) => { + Object.setPrototypeOf(proto.wrappedJSObject, Object.getPrototypeOf(pluginElement.wrappedJSObject)); + Object.setPrototypeOf(pluginElement.wrappedJSObject, proto.wrappedJSObject); +}); + +mm.addMessageListener("ppapi.js:isFullscreen", () => { + return containerWindow.document.fullscreenElement == pluginElement; +}); + +mm.addMessageListener("ppapi.js:setFullscreen", ({ data }) => { + if (data) { + pluginElement.requestFullscreen(); + } else { + containerWindow.document.exitFullscreen(); + } +}); + +mm.loadFrameScript("resource://ppapi.js/ppapi-instance.js", true); diff --git a/browser/extensions/mortar/host/interpose.cc b/browser/extensions/mortar/host/interpose.cc new file mode 100644 index 000000000000..8188515f44d2 --- /dev/null +++ b/browser/extensions/mortar/host/interpose.cc @@ -0,0 +1,335 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "../ppapi/out/rpc.cc" +#include + +#define REAL_PLUGIN_PATH "/Applications/Google Chrome.app/Contents/Versions/42.0.2311.135/Google Chrome Framework.framework/Internet Plug-Ins/PepperFlash/PepperFlashPlayer.plugin/Contents/MacOS/PepperFlashPlayer" +//#define REAL_PLUGIN_PATH "/usr/lib/pepperflashplugin-nonfree/libpepflashplayer.so" + +static PPB_GetInterface _real_PPB_GetInterface; + +const void* RealGetInterface(const char* interfaceName) { + if (!strcmp(interfaceName, "PPB_Flash_File_FileRef;2.0")) { + interfaceName = "PPB_Flash_File_FileRef;2"; + } else if (!strcmp(interfaceName, "PPB_Flash_File_ModuleLocal;3.0")) { + interfaceName = "PPB_Flash_File_ModuleLocal;3"; + } + return _real_PPB_GetInterface(interfaceName); +} +const void* GetInterfaceForRPC(const char* interfaceName) { + const void* interface = gInterfaces[interfaceName]; + //printf("GetInterfaceForRPC %s\n", interfaceName); + if (!interface) { + printf("MISSING INTERFACE %s\n", interfaceName); + } + return interface; +} + +void +Fail(const char *reason, const char *data) +{ + fprintf(stdout, reason, data); + fflush(stdout); + exit(-1); +} + +void Logging_PP_CompletionCallback(void* user_data, int32_t result) +{ + PP_CompletionCallback* _real_PP_CompletionCallback = static_cast(user_data); + printf("callFromJSON: > {\"__callback\":\"PP_CompletionCallback\",\"__callbackStruct\":{\"func\":%lu,\"user_data\":%lu,\"flags\":%i},\"result\":%i}\n", + uintptr_t(_real_PP_CompletionCallback->func), uintptr_t(_real_PP_CompletionCallback->user_data), _real_PP_CompletionCallback->flags, result); + _real_PP_CompletionCallback->func(_real_PP_CompletionCallback->user_data, result); + printf("callFromJSON: < {\"__callback\":\"PP_CompletionCallback\",\"__callbackStruct\":{\"func\":%lu,\"user_data\":%lu,\"flags\":%i},\"result\":%i}\n", + uintptr_t(_real_PP_CompletionCallback->func), uintptr_t(_real_PP_CompletionCallback->user_data), _real_PP_CompletionCallback->flags, result); + delete _real_PP_CompletionCallback; +} + +void Logging_PPB_Audio_Callback_1_0(void* sample_buffer, + uint32_t buffer_size_in_bytes, + void* user_data) +{ + Logging_PPB_Audio_Callback_1_0_holder* holder = static_cast(user_data); + printf("callFromJSON: > {\"__callback\":\"PPB_Audio_Callback_1_0\",\"__callbackStruct\":{\"func\":%lu,\"sample_buffer\":%lu,\"buffer_size_in_bytes\":%i},\"user_data\":%lu}\n", + uintptr_t(holder->func), uintptr_t(sample_buffer), buffer_size_in_bytes, uintptr_t(holder->user_data)); + holder->func(sample_buffer, buffer_size_in_bytes, holder->user_data); + printf("callFromJSON: < {\"__callback\":\"PPB_Audio_Callback_1_0\",\"__callbackStruct\":{\"func\":%lu,\"sample_buffer\":%lu,\"buffer_size_in_bytes\":%i},\"user_data\":%lu}\n", + uintptr_t(holder->func), uintptr_t(sample_buffer), buffer_size_in_bytes, uintptr_t(holder->user_data)); +} + +static void *_real_PepperFlash = nullptr; + +typedef int32_t (*PPP_InitializeBroker_Func)(PP_ConnectInstance_Func* connect_instance_func); +typedef void (*PPP_ShutdownBroker_Func)(void); + +static PP_InitializeModule_Func _real_PPP_InitializeModule; +static PP_GetInterface_Func _real_PPP_GetInterface; +static PPP_InitializeBroker_Func _real_PPP_InitializeBroker; +static PPP_ShutdownBroker_Func _real_PPP_ShutdownBroker; + +static void +LoadRealPepperFlash() +{ + if (!_real_PepperFlash) { + _real_PepperFlash = dlopen(REAL_PLUGIN_PATH, RTLD_LAZY); + _real_PPP_InitializeModule = (PP_InitializeModule_Func)dlsym(_real_PepperFlash, "PPP_InitializeModule"); + _real_PPP_GetInterface = (PP_GetInterface_Func)dlsym(_real_PepperFlash, "PPP_GetInterface"); + _real_PPP_InitializeBroker = (PPP_InitializeBroker_Func)dlsym(_real_PepperFlash, "PPP_InitializeBroker"); + _real_PPP_ShutdownBroker = (PPP_ShutdownBroker_Func)dlsym(_real_PepperFlash, "PPP_ShutdownBroker"); + InitializeInterfaceList(); + } +} + +struct Logging_PPP_Class_Deprecated_holder; + +PP_Bool +Logging_HasProperty(const void* object, + PP_Var name, + PP_Var* exception) +{ + uint32_t varNameLength; + const char* varName = ((PPB_Var_Deprecated_0_3*)RealGetInterface("PPB_Var(Deprecated);0.3"))->VarToUtf8(name, &varNameLength); + printf("Logging_HasProperty for "); + for (uint32_t i = 0; i < varNameLength; ++i) { + printf("%c", varName[i]); + } + printf("\n"); + const Logging_PPP_Class_Deprecated_holder* holder = static_cast(object); + PP_Bool result = holder->_real_PPP_Class_Deprecated->HasProperty(holder->object, name, exception); + printf("Logging_HasProperty for "); + for (uint32_t i = 0; i < varNameLength; ++i) { + printf("%c", varName[i]); + } + printf(" returns %s\n", result == PP_TRUE ? "true" : "false"); + return result; +} + +PP_Bool +Logging_HasMethod(const void* object, + PP_Var name, + PP_Var* exception) +{ + uint32_t varNameLength; + const char* varName = ((PPB_Var_Deprecated_0_3*)RealGetInterface("PPB_Var(Deprecated);0.3"))->VarToUtf8(name, &varNameLength); + printf("Logging_HasMethod for "); + for (uint32_t i = 0; i < varNameLength; ++i) { + printf("%c", varName[i]); + } + printf("\n"); + const Logging_PPP_Class_Deprecated_holder* holder = static_cast(object); + PP_Bool result = holder->_real_PPP_Class_Deprecated->HasMethod(holder->object, name, exception); + printf("Logging_HasMethod for "); + for (uint32_t i = 0; i < varNameLength; ++i) { + printf("%c", varName[i]); + } + printf(" returns %s\n", result == PP_TRUE ? "true" : "false"); + return result; +} + +PP_Var +Logging_GetProperty(const void* object, + PP_Var name, + PP_Var* exception) +{ + printf("Logging_GetProperty\n"); + const Logging_PPP_Class_Deprecated_holder* holder = static_cast(object); + return holder->_real_PPP_Class_Deprecated->GetProperty(holder->object, name, exception); +} + +void +Logging_GetAllPropertyNames(const void* object, + uint32_t* property_count, + PP_Var** properties, + PP_Var* exception) +{ + printf("Logging_GetAllPropertyNames\n"); + const Logging_PPP_Class_Deprecated_holder* holder = static_cast(object); + holder->_real_PPP_Class_Deprecated->GetAllPropertyNames(holder->object, property_count, properties, exception); +} + +void +Logging_SetProperty(const void* object, + PP_Var name, + PP_Var value, + PP_Var* exception) +{ + printf("Logging_SetProperty\n"); + const Logging_PPP_Class_Deprecated_holder* holder = static_cast(object); + holder->_real_PPP_Class_Deprecated->SetProperty(holder->object, name, value, exception); +} + +void +Logging_RemoveProperty(const void* object, + PP_Var name, + PP_Var* exception) +{ + printf("Logging_RemoveProperty\n"); + const Logging_PPP_Class_Deprecated_holder* holder = static_cast(object); + holder->_real_PPP_Class_Deprecated->RemoveProperty(holder->object, name, exception); +} + +PP_Var +Logging_Call(const void* object, + PP_Var method_name, + uint32_t argc, + const PP_Var argv[], + PP_Var* exception) +{ + printf("Logging_Call\n"); + const Logging_PPP_Class_Deprecated_holder* holder = static_cast(object); + return holder->_real_PPP_Class_Deprecated->Call(holder->object, method_name, argc, argv, exception); +} + +PP_Var +Logging_Construct(const void* object, + uint32_t argc, + const PP_Var argv[], + PP_Var* exception) +{ + printf("Logging_Construct\n"); + const Logging_PPP_Class_Deprecated_holder* holder = static_cast(object); + return holder->_real_PPP_Class_Deprecated->Construct(holder->object, argc, argv, exception); +} + +void +Logging_Deallocate(const void* object) +{ + printf("Logging_Deallocate\n"); + const Logging_PPP_Class_Deprecated_holder* holder = static_cast(object); + holder->_real_PPP_Class_Deprecated->Deallocate(holder->object); + delete holder; +} + +const PPP_Class_Deprecated _interpose_PPP_Class_Deprecated_1_0 = { + Logging_HasProperty, + Logging_HasMethod, + Logging_GetProperty, + Logging_GetAllPropertyNames, + Logging_SetProperty, + Logging_RemoveProperty, + Logging_Call, + Logging_Construct, + Logging_Deallocate, +}; + +#ifdef __cplusplus +extern "C" { +#endif + +static PP_Bool +Logging_HandleInputEvent(PP_Instance instance, PP_Resource input_event) +{ + const PPP_InputEvent_0_1* _real_PPP_InputEvent = static_cast(_real_PPP_GetInterface("PPP_InputEvent;0.1")); + printf("callFromJSON: > {\"__interface\":\"PPP_InputEvent;0.1\",\"__member\":\"HandleInputEvent\",\"instance\":%i,\"input_event\":%i}\n", instance, input_event); + PP_Bool result = _real_PPP_InputEvent->HandleInputEvent(instance, input_event); + printf("callFromJSON: < \"%s\"\n", ToString_PP_Bool(result).c_str()); + return result; +} + +static const PPP_InputEvent_0_1 _interpose_PPP_InputEvent_0_1 = { + Logging_HandleInputEvent +}; + +static PP_Bool +Logging_DidCreate(PP_Instance instance, + uint32_t argc, + const char* argn[], + const char* argv[]) +{ + const PPP_Instance_1_1* _real_PPP_Instance = static_cast(_real_PPP_GetInterface("PPP_Instance;1.1")); + printf("callFromJSON: > {\"__interface\":\"PPP_Instance;1.1\",\"__member\":\"DidCreate\",\"instance\":%i,\"argc\":%i,\"argn\":[", instance, argc); + for (uint32_t i = 0; i < argc; ++i) { + if (i > 0) { + printf(","); + } + printf("\"%s\"", argn[i]); + } + printf("],\"argv\":["); + for (uint32_t i = 0; i < argc; ++i) { + if (i > 0) { + printf(","); + } + printf("\"%s\"", argv[i]); + } + printf("]}\n"); + PP_Bool result = _real_PPP_Instance->DidCreate(instance, argc, argn, argv); + printf("callFromJSON: < \"%s\"\n", ToString_PP_Bool(result).c_str()); + return result; +} +static void +Logging_DidDestroy(PP_Instance instance) +{ + const PPP_Instance_1_1* _real_PPP_Instance = static_cast(_real_PPP_GetInterface("PPP_Instance;1.1")); + printf("callFromJSON: > {\"__interface\":\"PPP_Instance;1.1\",\"__member\":\"DidDestroy\",\"instance\":%i}\n", instance); + _real_PPP_Instance->DidDestroy(instance); +} +static void +Logging_DidChangeView(PP_Instance instance, PP_Resource view) +{ + const PPP_Instance_1_1* _real_PPP_Instance = static_cast(_real_PPP_GetInterface("PPP_Instance;1.1")); + printf("callFromJSON: > {\"__interface\":\"PPP_Instance;1.1\",\"__member\":\"DidChangeView\",\"instance\":%i,\"view\":%i}\n", instance, view); + _real_PPP_Instance->DidChangeView(instance, view); +} +static void +Logging_DidChangeFocus(PP_Instance instance, PP_Bool has_focus) +{ + const PPP_Instance_1_1* _real_PPP_Instance = static_cast(_real_PPP_GetInterface("PPP_Instance;1.1")); + printf("callFromJSON: > {\"__interface\":\"PPP_Instance;1.1\",\"__member\":\"DidChangeFocus\",\"instance\":%i,\"has_focus\":%s}\n", instance, has_focus ? "PP_TRUE" : "PP_FALSE"); + _real_PPP_Instance->DidChangeFocus(instance, has_focus); +} +static PP_Bool +Logging_HandleDocumentLoad(PP_Instance instance, PP_Resource url_loader) +{ + const PPP_Instance_1_1* _real_PPP_Instance = static_cast(_real_PPP_GetInterface("PPP_Instance;1.1")); + printf("callFromJSON: > {\"__interface\":\"PPP_Instance;1.1\",\"__member\":\"HandleDocumentLoad\",\"instance\":%i,\"url_loader\":%i}\n", instance, url_loader); + PP_Bool result = _real_PPP_Instance->HandleDocumentLoad(instance, url_loader); + printf("callFromJSON: < \"%s\"\n", ToString_PP_Bool(result).c_str()); + return result; +} + +static const PPP_Instance_1_1 _interpose_PPP_Instance_1_1 = { + Logging_DidCreate, + Logging_DidDestroy, + Logging_DidChangeView, + Logging_DidChangeFocus, + Logging_HandleDocumentLoad +}; + +const void * +PPP_GetInterface(const char *interface_name) +{ +//printf("PPP_GetInterface %s\n", interface_name); + LoadRealPepperFlash(); + if (!strcmp(interface_name, "PPP_InputEvent;0.1")) { + return &_interpose_PPP_InputEvent_0_1; + } + if (!strcmp(interface_name, "PPP_Instance;1.1")) { + return &_interpose_PPP_Instance_1_1; + } + return _real_PPP_GetInterface(interface_name); +} + +int32_t +PPP_InitializeModule(PP_Module module, PPB_GetInterface get_browser_interface) +{ + LoadRealPepperFlash(); + _real_PPB_GetInterface = get_browser_interface; + return _real_PPP_InitializeModule(module, GetInterfaceForRPC); +} + +int32_t +PPP_InitializeBroker(PP_ConnectInstance_Func *connect_instance_func) +{ + return _real_PPP_InitializeBroker(connect_instance_func); +} + +void +PPP_ShutdownBroker() +{ + return _real_PPP_ShutdownBroker(); +} + +#ifdef __cplusplus +} /* extern "C" */ +#endif diff --git a/browser/extensions/mortar/host/pdf/bootstrap.js b/browser/extensions/mortar/host/pdf/bootstrap.js new file mode 100644 index 000000000000..ea364ec973cc --- /dev/null +++ b/browser/extensions/mortar/host/pdf/bootstrap.js @@ -0,0 +1,69 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +const { classes: Cc, interfaces: Ci, utils: Cu, results: Cr } = Components; + +Cu.import("resource://gre/modules/Services.jsm"); + +function sandboxScript(sandbox) +{ + dump("sandboxScript " + sandbox.pluginElement + "\n"); + Components.classes["@mozilla.org/moz/jssubscript-loader;1"].getService(Components.interfaces.mozIJSSubScriptLoader).loadSubScript("resource://ppapipdf.js/ppapi-content-sandbox.js", sandbox); +} + +let plugins; +function startup(data) { + dump(">>>STARTED!!!\n"); + + let root = data.installPath.parent.parent; + let rpclib = root.clone(); + let pluginlib = root.clone(); + let os = Cc["@mozilla.org/xre/app-info;1"].getService(Ci.nsIXULRuntime).OS; + if (os == "Darwin") { + rpclib.appendRelativePath("ppapi/out/rpc.dylib"); + pluginlib.appendRelativePath("plugin/libpepperpdfium.dylib"); + } else if (os == "Linux") { + rpclib.appendRelativePath("ppapi/out/rpc.so"); + pluginlib.appendRelativePath("plugin/libpepperpdfium.so"); + } else if (os == "WINNT") { + rpclib.appendRelativePath("ppapi\\out\\rpc.dll"); + pluginlib.appendRelativePath("plugin\\pepperpdfium.dll"); + } else { + throw("Don't know the path to the libraries for this OS!"); + } + rpclib = rpclib.path; + pluginlib = pluginlib.path; + + let pluginHost = Cc["@mozilla.org/plugin/host;1"].getService(Ci.nsIPluginHost); + let plugin = pluginHost.registerFakePlugin({ + handlerURI: "chrome://ppapipdf.js/content/viewer.html", + mimeEntries: [ + { type: "application/pdf", extension: "pdf" }, + { type: "application/vnd.adobe.pdf", extension: "pdf" }, + { type: "application/vnd.adobe.pdfxml", extension: "pdfxml" }, + { type: "application/vnd.adobe.x-mars", extension: "mars" }, + { type: "application/vnd.adobe.xdp+xml", extension: "xdp" }, + { type: "application/vnd.adobe.xfdf", extension: "xfdf" }, + { type: "application/vnd.adobe.xfd+xml", extension: "xfd" }, + { type: "application/vnd.fdf", extension: "fdf" }, + ], + name: "PPAPI PDF plugin", + niceName: "PPAPI PDF plugin", + version: "1.0", + sandboxScript : `(${sandboxScript.toSource()})(this);`, + ppapiProcessArgs: [ rpclib, pluginlib ], + }); + plugin.enabledState = Ci.nsIPluginTag.STATE_ENABLED; + + let rng = Cc["@mozilla.org/security/random-generator;1"].createInstance(Ci.nsIRandomGenerator); + Services.ppmm.addMessageListener("ppapi.js:generateRandomBytes", ({ data }) => { + return rng.generateRandomBytes(data); + }); + + dump("<< listener.apply(this, args)); + } + + if (listeners[type]) { + listeners[type].slice().forEach( + listener => listener.apply(this, args)); + } + } + + function addEventListener(listeners, type, listener) { + if (!(type in listeners)) { + listeners[type] = []; + } + listeners[type].push(listener); + } + + function removeEventListener(listeners, type, listener) { + const typeListeners = listeners[type]; + const pos = typeListeners.indexOf(listener); + if (pos === -1) { + return; + } + + typeListeners.splice(pos, 1); + } + + class Client { + constructor(remote) { + this.id = this; + this.remote = remote; + + const listeners = {}; + this.on = (...args) => addEventListener(listeners, ...args); + this.emit = (...args) => emit(listeners, ...args); + } + + method(name, ...args) { + return this.remote[name](...args); + } + } + + function broadcast(type, data) { + Array.from(this.ctxs.keys()).forEach( + client => client.emit(type, data)); + } + + function L10nError(message, id, lang) { + this.name = 'L10nError'; + this.message = message; + this.id = id; + this.lang = lang; + } + L10nError.prototype = Object.create(Error.prototype); + L10nError.prototype.constructor = L10nError; + + const HTTP_STATUS_CODE_OK = 200; + + function load(type, url) { + return new Promise((resolve, reject) => { + const xhr = new XMLHttpRequest(); + + if (xhr.overrideMimeType) { + xhr.overrideMimeType(type); + } + + xhr.open('GET', url, true); + + if (type === 'application/json') { + xhr.responseType = 'json'; + } + + xhr.addEventListener('load', e => { + if (e.target.status === HTTP_STATUS_CODE_OK || + e.target.status === 0) { + resolve(e.target.response); + } else { + reject(new L10nError('Not found: ' + url)); + } + }); + xhr.addEventListener('error', reject); + xhr.addEventListener('timeout', reject); + + // the app: protocol throws on 404, see https://bugzil.la/827243 + try { + xhr.send(null); + } catch (e) { + if (e.name === 'NS_ERROR_FILE_NOT_FOUND') { + // the app: protocol throws on 404, see https://bugzil.la/827243 + reject(new L10nError('Not found: ' + url)); + } else { + throw e; + } + } + }); + } + + const io = { + extra: function(code, ver, path, type) { + return navigator.mozApps.getLocalizationResource( + code, ver, path, type); + }, + app: function(code, ver, path, type) { + switch (type) { + case 'text': + return load('text/plain', path); + case 'json': + return load('application/json', path); + default: + throw new L10nError('Unknown file type: ' + type); + } + }, + }; + + function fetchResource(res, { code, src, ver }) { + const url = res.replace('{locale}', code); + const type = res.endsWith('.json') ? 'json' : 'text'; + return io[src](code, ver, url, type); + } + + const KNOWN_MACROS = ['plural']; + const MAX_PLACEABLE_LENGTH = 2500; + + // Unicode bidi isolation characters + const FSI = '\u2068'; + const PDI = '\u2069'; + + const resolutionChain = new WeakSet(); + + function format(ctx, lang, args, entity) { + if (typeof entity === 'string') { + return [{}, entity]; + } + + if (resolutionChain.has(entity)) { + throw new L10nError('Cyclic reference detected'); + } + + resolutionChain.add(entity); + + let rv; + // if format fails, we want the exception to bubble up and stop the whole + // resolving process; however, we still need to remove the entity from the + // resolution chain + try { + rv = resolveValue( + {}, ctx, lang, args, entity.value, entity.index); + } finally { + resolutionChain.delete(entity); + } + return rv; + } + + function resolveIdentifier(ctx, lang, args, id) { + if (KNOWN_MACROS.indexOf(id) > -1) { + return [{}, ctx._getMacro(lang, id)]; + } + + if (args && args.hasOwnProperty(id)) { + if (typeof args[id] === 'string' || (typeof args[id] === 'number' && + !isNaN(args[id]))) { + return [{}, args[id]]; + } else { + throw new L10nError('Arg must be a string or a number: ' + id); + } + } + + // XXX: special case for Node.js where still: + // '__proto__' in Object.create(null) => true + if (id === '__proto__') { + throw new L10nError('Illegal id: ' + id); + } + + const entity = ctx._getEntity(lang, id); + + if (entity) { + return format(ctx, lang, args, entity); + } + + throw new L10nError('Unknown reference: ' + id); + } + + function subPlaceable(locals, ctx, lang, args, id) { + let newLocals, value; + + try { + [newLocals, value] = resolveIdentifier(ctx, lang, args, id); + } catch (err) { + return [{ error: err }, FSI + '{{ ' + id + ' }}' + PDI]; + } + + if (typeof value === 'number') { + const formatter = ctx._getNumberFormatter(lang); + return [newLocals, formatter.format(value)]; + } + + if (typeof value === 'string') { + // prevent Billion Laughs attacks + if (value.length >= MAX_PLACEABLE_LENGTH) { + throw new L10nError('Too many characters in placeable (' + + value.length + ', max allowed is ' + + MAX_PLACEABLE_LENGTH + ')'); + } + return [newLocals, FSI + value + PDI]; + } + + return [{}, FSI + '{{ ' + id + ' }}' + PDI]; + } + + function interpolate(locals, ctx, lang, args, arr) { + return arr.reduce(([localsSeq, valueSeq], cur) => { + if (typeof cur === 'string') { + return [localsSeq, valueSeq + cur]; + } else { + const [, value] = subPlaceable(locals, ctx, lang, args, cur.name); + // wrap the substitution in bidi isolate characters + return [localsSeq, valueSeq + value]; + } + }, [locals, '']); + } + + function resolveSelector(ctx, lang, args, expr, index) { + //XXX: Dehardcode!!! + let selectorName; + if (index[0].type === 'call' && index[0].expr.type === 'prop' && + index[0].expr.expr.name === 'cldr') { + selectorName = 'plural'; + } else { + selectorName = index[0].name; + } + const selector = resolveIdentifier(ctx, lang, args, selectorName)[1]; + + if (typeof selector !== 'function') { + // selector is a simple reference to an entity or args + return selector; + } + + const argValue = index[0].args ? + resolveIdentifier(ctx, lang, args, index[0].args[0].name)[1] : undefined; + + if (selectorName === 'plural') { + // special cases for zero, one, two if they are defined on the hash + if (argValue === 0 && 'zero' in expr) { + return 'zero'; + } + if (argValue === 1 && 'one' in expr) { + return 'one'; + } + if (argValue === 2 && 'two' in expr) { + return 'two'; + } + } + + return selector(argValue); + } + + function resolveValue(locals, ctx, lang, args, expr, index) { + if (!expr) { + return [locals, expr]; + } + + if (typeof expr === 'string' || + typeof expr === 'boolean' || + typeof expr === 'number') { + return [locals, expr]; + } + + if (Array.isArray(expr)) { + return interpolate(locals, ctx, lang, args, expr); + } + + // otherwise, it's a dict + if (index) { + // try to use the index in order to select the right dict member + const selector = resolveSelector(ctx, lang, args, expr, index); + if (selector in expr) { + return resolveValue(locals, ctx, lang, args, expr[selector]); + } + } + + // if there was no index or no selector was found, try the default + // XXX 'other' is an artifact from Gaia + const defaultKey = expr.__default || 'other'; + if (defaultKey in expr) { + return resolveValue(locals, ctx, lang, args, expr[defaultKey]); + } + + throw new L10nError('Unresolvable value'); + } + + /*eslint no-magic-numbers: [0]*/ + + const locales2rules = { + 'af': 3, + 'ak': 4, + 'am': 4, + 'ar': 1, + 'asa': 3, + 'az': 0, + 'be': 11, + 'bem': 3, + 'bez': 3, + 'bg': 3, + 'bh': 4, + 'bm': 0, + 'bn': 3, + 'bo': 0, + 'br': 20, + 'brx': 3, + 'bs': 11, + 'ca': 3, + 'cgg': 3, + 'chr': 3, + 'cs': 12, + 'cy': 17, + 'da': 3, + 'de': 3, + 'dv': 3, + 'dz': 0, + 'ee': 3, + 'el': 3, + 'en': 3, + 'eo': 3, + 'es': 3, + 'et': 3, + 'eu': 3, + 'fa': 0, + 'ff': 5, + 'fi': 3, + 'fil': 4, + 'fo': 3, + 'fr': 5, + 'fur': 3, + 'fy': 3, + 'ga': 8, + 'gd': 24, + 'gl': 3, + 'gsw': 3, + 'gu': 3, + 'guw': 4, + 'gv': 23, + 'ha': 3, + 'haw': 3, + 'he': 2, + 'hi': 4, + 'hr': 11, + 'hu': 0, + 'id': 0, + 'ig': 0, + 'ii': 0, + 'is': 3, + 'it': 3, + 'iu': 7, + 'ja': 0, + 'jmc': 3, + 'jv': 0, + 'ka': 0, + 'kab': 5, + 'kaj': 3, + 'kcg': 3, + 'kde': 0, + 'kea': 0, + 'kk': 3, + 'kl': 3, + 'km': 0, + 'kn': 0, + 'ko': 0, + 'ksb': 3, + 'ksh': 21, + 'ku': 3, + 'kw': 7, + 'lag': 18, + 'lb': 3, + 'lg': 3, + 'ln': 4, + 'lo': 0, + 'lt': 10, + 'lv': 6, + 'mas': 3, + 'mg': 4, + 'mk': 16, + 'ml': 3, + 'mn': 3, + 'mo': 9, + 'mr': 3, + 'ms': 0, + 'mt': 15, + 'my': 0, + 'nah': 3, + 'naq': 7, + 'nb': 3, + 'nd': 3, + 'ne': 3, + 'nl': 3, + 'nn': 3, + 'no': 3, + 'nr': 3, + 'nso': 4, + 'ny': 3, + 'nyn': 3, + 'om': 3, + 'or': 3, + 'pa': 3, + 'pap': 3, + 'pl': 13, + 'ps': 3, + 'pt': 3, + 'rm': 3, + 'ro': 9, + 'rof': 3, + 'ru': 11, + 'rwk': 3, + 'sah': 0, + 'saq': 3, + 'se': 7, + 'seh': 3, + 'ses': 0, + 'sg': 0, + 'sh': 11, + 'shi': 19, + 'sk': 12, + 'sl': 14, + 'sma': 7, + 'smi': 7, + 'smj': 7, + 'smn': 7, + 'sms': 7, + 'sn': 3, + 'so': 3, + 'sq': 3, + 'sr': 11, + 'ss': 3, + 'ssy': 3, + 'st': 3, + 'sv': 3, + 'sw': 3, + 'syr': 3, + 'ta': 3, + 'te': 3, + 'teo': 3, + 'th': 0, + 'ti': 4, + 'tig': 3, + 'tk': 3, + 'tl': 4, + 'tn': 3, + 'to': 0, + 'tr': 0, + 'ts': 3, + 'tzm': 22, + 'uk': 11, + 'ur': 3, + 've': 3, + 'vi': 0, + 'vun': 3, + 'wa': 4, + 'wae': 3, + 'wo': 0, + 'xh': 3, + 'xog': 3, + 'yo': 0, + 'zh': 0, + 'zu': 3 + }; + + // utility functions for plural rules methods + function isIn(n, list) { + return list.indexOf(n) !== -1; + } + function isBetween(n, start, end) { + return typeof n === typeof start && start <= n && n <= end; + } + + // list of all plural rules methods: + // map an integer to the plural form name to use + const pluralRules = { + '0': function() { + return 'other'; + }, + '1': function(n) { + if ((isBetween((n % 100), 3, 10))) { + return 'few'; + } + if (n === 0) { + return 'zero'; + } + if ((isBetween((n % 100), 11, 99))) { + return 'many'; + } + if (n === 2) { + return 'two'; + } + if (n === 1) { + return 'one'; + } + return 'other'; + }, + '2': function(n) { + if (n !== 0 && (n % 10) === 0) { + return 'many'; + } + if (n === 2) { + return 'two'; + } + if (n === 1) { + return 'one'; + } + return 'other'; + }, + '3': function(n) { + if (n === 1) { + return 'one'; + } + return 'other'; + }, + '4': function(n) { + if ((isBetween(n, 0, 1))) { + return 'one'; + } + return 'other'; + }, + '5': function(n) { + if ((isBetween(n, 0, 2)) && n !== 2) { + return 'one'; + } + return 'other'; + }, + '6': function(n) { + if (n === 0) { + return 'zero'; + } + if ((n % 10) === 1 && (n % 100) !== 11) { + return 'one'; + } + return 'other'; + }, + '7': function(n) { + if (n === 2) { + return 'two'; + } + if (n === 1) { + return 'one'; + } + return 'other'; + }, + '8': function(n) { + if ((isBetween(n, 3, 6))) { + return 'few'; + } + if ((isBetween(n, 7, 10))) { + return 'many'; + } + if (n === 2) { + return 'two'; + } + if (n === 1) { + return 'one'; + } + return 'other'; + }, + '9': function(n) { + if (n === 0 || n !== 1 && (isBetween((n % 100), 1, 19))) { + return 'few'; + } + if (n === 1) { + return 'one'; + } + return 'other'; + }, + '10': function(n) { + if ((isBetween((n % 10), 2, 9)) && !(isBetween((n % 100), 11, 19))) { + return 'few'; + } + if ((n % 10) === 1 && !(isBetween((n % 100), 11, 19))) { + return 'one'; + } + return 'other'; + }, + '11': function(n) { + if ((isBetween((n % 10), 2, 4)) && !(isBetween((n % 100), 12, 14))) { + return 'few'; + } + if ((n % 10) === 0 || + (isBetween((n % 10), 5, 9)) || + (isBetween((n % 100), 11, 14))) { + return 'many'; + } + if ((n % 10) === 1 && (n % 100) !== 11) { + return 'one'; + } + return 'other'; + }, + '12': function(n) { + if ((isBetween(n, 2, 4))) { + return 'few'; + } + if (n === 1) { + return 'one'; + } + return 'other'; + }, + '13': function(n) { + if ((isBetween((n % 10), 2, 4)) && !(isBetween((n % 100), 12, 14))) { + return 'few'; + } + if (n !== 1 && (isBetween((n % 10), 0, 1)) || + (isBetween((n % 10), 5, 9)) || + (isBetween((n % 100), 12, 14))) { + return 'many'; + } + if (n === 1) { + return 'one'; + } + return 'other'; + }, + '14': function(n) { + if ((isBetween((n % 100), 3, 4))) { + return 'few'; + } + if ((n % 100) === 2) { + return 'two'; + } + if ((n % 100) === 1) { + return 'one'; + } + return 'other'; + }, + '15': function(n) { + if (n === 0 || (isBetween((n % 100), 2, 10))) { + return 'few'; + } + if ((isBetween((n % 100), 11, 19))) { + return 'many'; + } + if (n === 1) { + return 'one'; + } + return 'other'; + }, + '16': function(n) { + if ((n % 10) === 1 && n !== 11) { + return 'one'; + } + return 'other'; + }, + '17': function(n) { + if (n === 3) { + return 'few'; + } + if (n === 0) { + return 'zero'; + } + if (n === 6) { + return 'many'; + } + if (n === 2) { + return 'two'; + } + if (n === 1) { + return 'one'; + } + return 'other'; + }, + '18': function(n) { + if (n === 0) { + return 'zero'; + } + if ((isBetween(n, 0, 2)) && n !== 0 && n !== 2) { + return 'one'; + } + return 'other'; + }, + '19': function(n) { + if ((isBetween(n, 2, 10))) { + return 'few'; + } + if ((isBetween(n, 0, 1))) { + return 'one'; + } + return 'other'; + }, + '20': function(n) { + if ((isBetween((n % 10), 3, 4) || ((n % 10) === 9)) && !( + isBetween((n % 100), 10, 19) || + isBetween((n % 100), 70, 79) || + isBetween((n % 100), 90, 99) + )) { + return 'few'; + } + if ((n % 1000000) === 0 && n !== 0) { + return 'many'; + } + if ((n % 10) === 2 && !isIn((n % 100), [12, 72, 92])) { + return 'two'; + } + if ((n % 10) === 1 && !isIn((n % 100), [11, 71, 91])) { + return 'one'; + } + return 'other'; + }, + '21': function(n) { + if (n === 0) { + return 'zero'; + } + if (n === 1) { + return 'one'; + } + return 'other'; + }, + '22': function(n) { + if ((isBetween(n, 0, 1)) || (isBetween(n, 11, 99))) { + return 'one'; + } + return 'other'; + }, + '23': function(n) { + if ((isBetween((n % 10), 1, 2)) || (n % 20) === 0) { + return 'one'; + } + return 'other'; + }, + '24': function(n) { + if ((isBetween(n, 3, 10) || isBetween(n, 13, 19))) { + return 'few'; + } + if (isIn(n, [2, 12])) { + return 'two'; + } + if (isIn(n, [1, 11])) { + return 'one'; + } + return 'other'; + } + }; + + function getPluralRule(code) { + // return a function that gives the plural form name for a given integer + const index = locales2rules[code.replace(/-.*$/, '')]; + if (!(index in pluralRules)) { + return () => 'other'; + } + return pluralRules[index]; + } + + // Safari 9 and iOS 9 does not support Intl + const L20nIntl = typeof Intl !== 'undefined' ? + Intl : { + NumberFormat: function() { + return { + format: function(v) { + return v; + } + }; + } + }; + + class Context { + constructor(env, langs, resIds) { + this.langs = langs; + this.resIds = resIds; + this.env = env; + this.emit = (type, evt) => env.emit(type, evt, this); + } + + _formatTuple(lang, args, entity, id, key) { + try { + return format(this, lang, args, entity); + } catch (err) { + err.id = key ? id + '::' + key : id; + err.lang = lang; + this.emit('resolveerror', err); + return [{ error: err }, err.id]; + } + } + + _formatEntity(lang, args, entity, id) { + const [, value] = this._formatTuple(lang, args, entity, id); + + const formatted = { + value, + attrs: null, + }; + + if (entity.attrs) { + formatted.attrs = Object.create(null); + for (let key in entity.attrs) { + /* jshint -W089 */ + const [, attrValue] = this._formatTuple( + lang, args, entity.attrs[key], id, key); + formatted.attrs[key] = attrValue; + } + } + + return formatted; + } + + _formatValue(lang, args, entity, id) { + return this._formatTuple(lang, args, entity, id)[1]; + } + + fetch(langs = this.langs) { + if (langs.length === 0) { + return Promise.resolve(langs); + } + + return Promise.all( + this.resIds.map( + resId => this.env._getResource(langs[0], resId)) + ).then(() => langs); + } + + _resolve(langs, keys, formatter, prevResolved) { + const lang = langs[0]; + + if (!lang) { + return reportMissing.call(this, keys, formatter, prevResolved); + } + + let hasUnresolved = false; + + const resolved = keys.map((key, i) => { + if (prevResolved && prevResolved[i] !== undefined) { + return prevResolved[i]; + } + const [id, args] = Array.isArray(key) ? + key : [key, undefined]; + const entity = this._getEntity(lang, id); + + if (entity) { + return formatter.call(this, lang, args, entity, id); + } + + this.emit('notfounderror', + new L10nError('"' + id + '" not found in ' + lang.code, id, lang)); + hasUnresolved = true; + }); + + if (!hasUnresolved) { + return resolved; + } + + return this.fetch(langs.slice(1)).then( + nextLangs => this._resolve(nextLangs, keys, formatter, resolved)); + } + + formatEntities(...keys) { + return this.fetch().then( + langs => this._resolve(langs, keys, this._formatEntity)); + } + + formatValues(...keys) { + return this.fetch().then( + langs => this._resolve(langs, keys, this._formatValue)); + } + + _getEntity(lang, id) { + const cache = this.env.resCache; + + // Look for `id` in every resource in order. + for (let i = 0, resId; resId = this.resIds[i]; i++) { + const resource = cache.get(resId + lang.code + lang.src); + if (resource instanceof L10nError) { + continue; + } + if (id in resource) { + return resource[id]; + } + } + return undefined; + } + + _getNumberFormatter(lang) { + if (!this.env.numberFormatters) { + this.env.numberFormatters = new Map(); + } + if (!this.env.numberFormatters.has(lang)) { + const formatter = L20nIntl.NumberFormat(lang); + this.env.numberFormatters.set(lang, formatter); + return formatter; + } + return this.env.numberFormatters.get(lang); + } + + // XXX in the future macros will be stored in localization resources together + // with regular entities and this method will not be needed anymore + _getMacro(lang, id) { + switch(id) { + case 'plural': + return getPluralRule(lang.code); + default: + return undefined; + } + } + + } + + function reportMissing(keys, formatter, resolved) { + const missingIds = new Set(); + + keys.forEach((key, i) => { + if (resolved && resolved[i] !== undefined) { + return; + } + const id = Array.isArray(key) ? key[0] : key; + missingIds.add(id); + resolved[i] = formatter === this._formatValue ? + id : {value: id, attrs: null}; + }); + + this.emit('notfounderror', new L10nError( + '"' + Array.from(missingIds).join(', ') + '"' + + ' not found in any language', missingIds)); + + return resolved; + } + + const MAX_PLACEABLES = 100; + + var PropertiesParser = { + patterns: null, + entryIds: null, + emit: null, + + init: function() { + this.patterns = { + comment: /^\s*#|^\s*$/, + entity: /^([^=\s]+)\s*=\s*(.*)$/, + multiline: /[^\\]\\$/, + index: /\{\[\s*(\w+)(?:\(([^\)]*)\))?\s*\]\}/i, + unicode: /\\u([0-9a-fA-F]{1,4})/g, + entries: /[^\r\n]+/g, + controlChars: /\\([\\\n\r\t\b\f\{\}\"\'])/g, + placeables: /\{\{\s*([^\s]*?)\s*\}\}/, + }; + }, + + parse: function(emit, source) { + if (!this.patterns) { + this.init(); + } + this.emit = emit; + + const entries = {}; + + const lines = source.match(this.patterns.entries); + if (!lines) { + return entries; + } + for (let i = 0; i < lines.length; i++) { + let line = lines[i]; + + if (this.patterns.comment.test(line)) { + continue; + } + + while (this.patterns.multiline.test(line) && i < lines.length) { + line = line.slice(0, -1) + lines[++i].trim(); + } + + const entityMatch = line.match(this.patterns.entity); + if (entityMatch) { + try { + this.parseEntity(entityMatch[1], entityMatch[2], entries); + } catch (e) { + if (!this.emit) { + throw e; + } + } + } + } + return entries; + }, + + parseEntity: function(id, value, entries) { + let name, key; + + const pos = id.indexOf('['); + if (pos !== -1) { + name = id.substr(0, pos); + key = id.substring(pos + 1, id.length - 1); + } else { + name = id; + key = null; + } + + const nameElements = name.split('.'); + + if (nameElements.length > 2) { + throw this.error('Error in ID: "' + name + '".' + + ' Nested attributes are not supported.'); + } + + let attr; + if (nameElements.length > 1) { + name = nameElements[0]; + attr = nameElements[1]; + + if (attr[0] === '$') { + throw this.error('Attribute can\'t start with "$"'); + } + } else { + attr = null; + } + + this.setEntityValue(name, attr, key, this.unescapeString(value), entries); + }, + + setEntityValue: function(id, attr, key, rawValue, entries) { + const value = rawValue.indexOf('{{') > -1 ? + this.parseString(rawValue) : rawValue; + + let isSimpleValue = typeof value === 'string'; + let root = entries; + + let isSimpleNode = typeof entries[id] === 'string'; + + if (!entries[id] && (attr || key || !isSimpleValue)) { + entries[id] = Object.create(null); + isSimpleNode = false; + } + + if (attr) { + if (isSimpleNode) { + const val = entries[id]; + entries[id] = Object.create(null); + entries[id].value = val; + } + if (!entries[id].attrs) { + entries[id].attrs = Object.create(null); + } + if (!entries[id].attrs && !isSimpleValue) { + entries[id].attrs[attr] = Object.create(null); + } + root = entries[id].attrs; + id = attr; + } + + if (key) { + isSimpleNode = false; + if (typeof root[id] === 'string') { + const val = root[id]; + root[id] = Object.create(null); + root[id].index = this.parseIndex(val); + root[id].value = Object.create(null); + } + root = root[id].value; + id = key; + isSimpleValue = true; + } + + if (isSimpleValue) { + if (id in root) { + throw this.error('Duplicated id: ' + id); + } + root[id] = value; + } else { + if (!root[id]) { + root[id] = Object.create(null); + } + root[id].value = value; + } + }, + + parseString: function(str) { + const chunks = str.split(this.patterns.placeables); + const complexStr = []; + + const len = chunks.length; + const placeablesCount = (len - 1) / 2; + + if (placeablesCount >= MAX_PLACEABLES) { + throw this.error('Too many placeables (' + placeablesCount + + ', max allowed is ' + MAX_PLACEABLES + ')'); + } + + for (let i = 0; i < chunks.length; i++) { + if (chunks[i].length === 0) { + continue; + } + if (i % 2 === 1) { + complexStr.push({type: 'idOrVar', name: chunks[i]}); + } else { + complexStr.push(chunks[i]); + } + } + return complexStr; + }, + + unescapeString: function(str) { + if (str.lastIndexOf('\\') !== -1) { + str = str.replace(this.patterns.controlChars, '$1'); + } + return str.replace(this.patterns.unicode, + (match, token) => String.fromCodePoint(parseInt(token, 16)) + ); + }, + + parseIndex: function(str) { + const match = str.match(this.patterns.index); + if (!match) { + throw new L10nError('Malformed index'); + } + if (match[2]) { + return [{ + type: 'call', + expr: { + type: 'prop', + expr: { + type: 'glob', + name: 'cldr' + }, + prop: 'plural', + cmpt: false + }, args: [{ + type: 'idOrVar', + name: match[2] + }] + }]; + } else { + return [{type: 'idOrVar', name: match[1]}]; + } + }, + + error: function(msg, type = 'parsererror') { + const err = new L10nError(msg); + if (this.emit) { + this.emit(type, err); + } + return err; + } + }; + + const MAX_PLACEABLES$1 = 100; + + var L20nParser = { + parse: function(emit, string) { + this._source = string; + this._index = 0; + this._length = string.length; + this.entries = Object.create(null); + this.emit = emit; + + return this.getResource(); + }, + + getResource: function() { + this.getWS(); + while (this._index < this._length) { + try { + this.getEntry(); + } catch (e) { + if (e instanceof L10nError) { + // we want to recover, but we don't need it in entries + this.getJunkEntry(); + if (!this.emit) { + throw e; + } + } else { + throw e; + } + } + + if (this._index < this._length) { + this.getWS(); + } + } + + return this.entries; + }, + + getEntry: function() { + if (this._source[this._index] === '<') { + ++this._index; + const id = this.getIdentifier(); + if (this._source[this._index] === '[') { + ++this._index; + return this.getEntity(id, this.getItemList(this.getExpression, ']')); + } + return this.getEntity(id); + } + + if (this._source.startsWith('/*', this._index)) { + return this.getComment(); + } + + throw this.error('Invalid entry'); + }, + + getEntity: function(id, index) { + if (!this.getRequiredWS()) { + throw this.error('Expected white space'); + } + + const ch = this._source[this._index]; + const hasIndex = index !== undefined; + const value = this.getValue(ch, hasIndex, hasIndex); + let attrs; + + if (value === undefined) { + if (ch === '>') { + throw this.error('Expected ">"'); + } + attrs = this.getAttributes(); + } else { + const ws1 = this.getRequiredWS(); + if (this._source[this._index] !== '>') { + if (!ws1) { + throw this.error('Expected ">"'); + } + attrs = this.getAttributes(); + } + } + + // skip '>' + ++this._index; + + if (id in this.entries) { + throw this.error('Duplicate entry ID "' + id, 'duplicateerror'); + } + if (!attrs && !index && typeof value === 'string') { + this.entries[id] = value; + } else { + this.entries[id] = { + value, + attrs, + index + }; + } + }, + + getValue: function( + ch = this._source[this._index], index = false, required = true) { + switch (ch) { + case '\'': + case '"': + return this.getString(ch, 1); + case '{': + return this.getHash(index); + } + + if (required) { + throw this.error('Unknown value type'); + } + + return undefined; + }, + + getWS: function() { + let cc = this._source.charCodeAt(this._index); + // space, \n, \t, \r + while (cc === 32 || cc === 10 || cc === 9 || cc === 13) { + cc = this._source.charCodeAt(++this._index); + } + }, + + getRequiredWS: function() { + const pos = this._index; + let cc = this._source.charCodeAt(pos); + // space, \n, \t, \r + while (cc === 32 || cc === 10 || cc === 9 || cc === 13) { + cc = this._source.charCodeAt(++this._index); + } + return this._index !== pos; + }, + + getIdentifier: function() { + const start = this._index; + let cc = this._source.charCodeAt(this._index); + + if ((cc >= 97 && cc <= 122) || // a-z + (cc >= 65 && cc <= 90) || // A-Z + cc === 95) { // _ + cc = this._source.charCodeAt(++this._index); + } else { + throw this.error('Identifier has to start with [a-zA-Z_]'); + } + + while ((cc >= 97 && cc <= 122) || // a-z + (cc >= 65 && cc <= 90) || // A-Z + (cc >= 48 && cc <= 57) || // 0-9 + cc === 95) { // _ + cc = this._source.charCodeAt(++this._index); + } + + return this._source.slice(start, this._index); + }, + + getUnicodeChar: function() { + for (let i = 0; i < 4; i++) { + const cc = this._source.charCodeAt(++this._index); + if ((cc > 96 && cc < 103) || // a-f + (cc > 64 && cc < 71) || // A-F + (cc > 47 && cc < 58)) { // 0-9 + continue; + } + throw this.error('Illegal unicode escape sequence'); + } + this._index++; + return String.fromCharCode( + parseInt(this._source.slice(this._index - 4, this._index), 16)); + }, + + stringRe: /"|'|{{|\\/g, + getString: function(opchar, opcharLen) { + const body = []; + let placeables = 0; + + this._index += opcharLen; + const start = this._index; + + let bufStart = start; + let buf = ''; + + while (true) { + this.stringRe.lastIndex = this._index; + const match = this.stringRe.exec(this._source); + + if (!match) { + throw this.error('Unclosed string literal'); + } + + if (match[0] === '"' || match[0] === '\'') { + if (match[0] !== opchar) { + this._index += opcharLen; + continue; + } + this._index = match.index + opcharLen; + break; + } + + if (match[0] === '{{') { + if (placeables > MAX_PLACEABLES$1 - 1) { + throw this.error('Too many placeables, maximum allowed is ' + + MAX_PLACEABLES$1); + } + placeables++; + if (match.index > bufStart || buf.length > 0) { + body.push(buf + this._source.slice(bufStart, match.index)); + buf = ''; + } + this._index = match.index + 2; + this.getWS(); + body.push(this.getExpression()); + this.getWS(); + this._index += 2; + bufStart = this._index; + continue; + } + + if (match[0] === '\\') { + this._index = match.index + 1; + const ch2 = this._source[this._index]; + if (ch2 === 'u') { + buf += this._source.slice(bufStart, match.index) + + this.getUnicodeChar(); + } else if (ch2 === opchar || ch2 === '\\') { + buf += this._source.slice(bufStart, match.index) + ch2; + this._index++; + } else if (this._source.startsWith('{{', this._index)) { + buf += this._source.slice(bufStart, match.index) + '{{'; + this._index += 2; + } else { + throw this.error('Illegal escape sequence'); + } + bufStart = this._index; + } + } + + if (body.length === 0) { + return buf + this._source.slice(bufStart, this._index - opcharLen); + } + + if (this._index - opcharLen > bufStart || buf.length > 0) { + body.push(buf + this._source.slice(bufStart, this._index - opcharLen)); + } + + return body; + }, + + getAttributes: function() { + const attrs = Object.create(null); + + while (true) { + this.getAttribute(attrs); + const ws1 = this.getRequiredWS(); + const ch = this._source.charAt(this._index); + if (ch === '>') { + break; + } else if (!ws1) { + throw this.error('Expected ">"'); + } + } + return attrs; + }, + + getAttribute: function(attrs) { + const key = this.getIdentifier(); + let index; + + if (this._source[this._index]=== '[') { + ++this._index; + this.getWS(); + index = this.getItemList(this.getExpression, ']'); + } + this.getWS(); + if (this._source[this._index] !== ':') { + throw this.error('Expected ":"'); + } + ++this._index; + this.getWS(); + const hasIndex = index !== undefined; + const value = this.getValue(undefined, hasIndex); + + if (key in attrs) { + throw this.error('Duplicate attribute "' + key, 'duplicateerror'); + } + + if (!index && typeof value === 'string') { + attrs[key] = value; + } else { + attrs[key] = { + value, + index + }; + } + }, + + getHash: function(index) { + const items = Object.create(null); + + ++this._index; + this.getWS(); + + let defKey; + + while (true) { + const [key, value, def] = this.getHashItem(); + items[key] = value; + + if (def) { + if (defKey) { + throw this.error('Default item redefinition forbidden'); + } + defKey = key; + } + this.getWS(); + + const comma = this._source[this._index] === ','; + if (comma) { + ++this._index; + this.getWS(); + } + if (this._source[this._index] === '}') { + ++this._index; + break; + } + if (!comma) { + throw this.error('Expected "}"'); + } + } + + if (defKey) { + items.__default = defKey; + } else if (!index) { + throw this.error('Unresolvable Hash Value'); + } + + return items; + }, + + getHashItem: function() { + let defItem = false; + if (this._source[this._index] === '*') { + ++this._index; + defItem = true; + } + + const key = this.getIdentifier(); + this.getWS(); + if (this._source[this._index] !== ':') { + throw this.error('Expected ":"'); + } + ++this._index; + this.getWS(); + + return [key, this.getValue(), defItem]; + }, + + getComment: function() { + this._index += 2; + const start = this._index; + const end = this._source.indexOf('*/', start); + + if (end === -1) { + throw this.error('Comment without a closing tag'); + } + + this._index = end + 2; + }, + + getExpression: function () { + let exp = this.getPrimaryExpression(); + + while (true) { + const ch = this._source[this._index]; + if (ch === '.' || ch === '[') { + ++this._index; + exp = this.getPropertyExpression(exp, ch === '['); + } else if (ch === '(') { + ++this._index; + exp = this.getCallExpression(exp); + } else { + break; + } + } + + return exp; + }, + + getPropertyExpression: function(idref, computed) { + let exp; + + if (computed) { + this.getWS(); + exp = this.getExpression(); + this.getWS(); + if (this._source[this._index] !== ']') { + throw this.error('Expected "]"'); + } + ++this._index; + } else { + exp = this.getIdentifier(); + } + + return { + type: 'prop', + expr: idref, + prop: exp, + cmpt: computed + }; + }, + + getCallExpression: function(callee) { + this.getWS(); + + return { + type: 'call', + expr: callee, + args: this.getItemList(this.getExpression, ')') + }; + }, + + getPrimaryExpression: function() { + const ch = this._source[this._index]; + + switch (ch) { + case '$': + ++this._index; + return { + type: 'var', + name: this.getIdentifier() + }; + case '@': + ++this._index; + return { + type: 'glob', + name: this.getIdentifier() + }; + default: + return { + type: 'id', + name: this.getIdentifier() + }; + } + }, + + getItemList: function(callback, closeChar) { + const items = []; + let closed = false; + + this.getWS(); + + if (this._source[this._index] === closeChar) { + ++this._index; + closed = true; + } + + while (!closed) { + items.push(callback.call(this)); + this.getWS(); + const ch = this._source.charAt(this._index); + switch (ch) { + case ',': + ++this._index; + this.getWS(); + break; + case closeChar: + ++this._index; + closed = true; + break; + default: + throw this.error('Expected "," or "' + closeChar + '"'); + } + } + + return items; + }, + + + getJunkEntry: function() { + const pos = this._index; + let nextEntity = this._source.indexOf('<', pos); + let nextComment = this._source.indexOf('/*', pos); + + if (nextEntity === -1) { + nextEntity = this._length; + } + if (nextComment === -1) { + nextComment = this._length; + } + + const nextEntry = Math.min(nextEntity, nextComment); + + this._index = nextEntry; + }, + + error: function(message, type = 'parsererror') { + const pos = this._index; + + let start = this._source.lastIndexOf('<', pos - 1); + const lastClose = this._source.lastIndexOf('>', pos - 1); + start = lastClose > start ? lastClose + 1 : start; + const context = this._source.slice(start, pos + 10); + + const msg = message + ' at pos ' + pos + ': `' + context + '`'; + const err = new L10nError(msg); + if (this.emit) { + this.emit(type, err); + } + return err; + }, + }; + + // Walk an entry node searching for content leaves + function walkEntry(entry, fn) { + if (typeof entry === 'string') { + return fn(entry); + } + + const newEntry = Object.create(null); + + if (entry.value) { + newEntry.value = walkValue(entry.value, fn); + } + + if (entry.index) { + newEntry.index = entry.index; + } + + if (entry.attrs) { + newEntry.attrs = Object.create(null); + for (let key in entry.attrs) { + newEntry.attrs[key] = walkEntry(entry.attrs[key], fn); + } + } + + return newEntry; + } + + function walkValue(value, fn) { + if (typeof value === 'string') { + return fn(value); + } + + // skip expressions in placeables + if (value.type) { + return value; + } + + const newValue = Array.isArray(value) ? [] : Object.create(null); + const keys = Object.keys(value); + + for (let i = 0, key; (key = keys[i]); i++) { + newValue[key] = walkValue(value[key], fn); + } + + return newValue; + } + + /* Pseudolocalizations + * + * pseudo is a dict of strategies to be used to modify the English + * context in order to create pseudolocalizations. These can be used by + * developers to test the localizability of their code without having to + * actually speak a foreign language. + * + * Currently, the following pseudolocales are supported: + * + * fr-x-psaccent - Ȧȧƈƈḗḗƞŧḗḗḓ Ḗḗƞɠŀīīşħ + * + * In Accented English all English letters are replaced by accented + * Unicode counterparts which don't impair the readability of the content. + * This allows developers to quickly test if any given string is being + * correctly displayed in its 'translated' form. Additionally, simple + * heuristics are used to make certain words longer to better simulate the + * experience of international users. + * + * ar-x-psbidi - ɥsıʅƃuƎ ıpıԐ + * + * Bidi English is a fake RTL locale. All words are surrounded by + * Unicode formatting marks forcing the RTL directionality of characters. + * In addition, to make the reversed text easier to read, individual + * letters are flipped. + * + * Note: The name above is hardcoded to be RTL in case code editors have + * trouble with the RLO and PDF Unicode marks. In reality, it should be + * surrounded by those marks as well. + * + * See https://bugzil.la/900182 for more information. + * + */ + + function createGetter(id, name) { + let _pseudo = null; + + return function getPseudo() { + if (_pseudo) { + return _pseudo; + } + + const reAlphas = /[a-zA-Z]/g; + const reVowels = /[aeiouAEIOU]/g; + const reWords = /[^\W0-9_]+/g; + // strftime tokens (%a, %Eb), template {vars}, HTML entities (‪) + // and HTML tags. + const reExcluded = /(%[EO]?\w|\{\s*.+?\s*\}|&[#\w]+;|<\s*.+?\s*>)/; + + const charMaps = { + 'fr-x-psaccent': + 'ȦƁƇḒḖƑƓĦĪĴĶĿḾȠǾƤɊŘŞŦŬṼẆẊẎẐ[\\]^_`ȧƀƈḓḗƒɠħīĵķŀḿƞǿƥɋřşŧŭṽẇẋẏẑ', + 'ar-x-psbidi': + // XXX Use pɟפ˥ʎ as replacements for ᗡℲ⅁⅂⅄. https://bugzil.la/1007340 + '∀ԐↃpƎɟפHIſӼ˥WNOԀÒᴚS⊥∩ɅMXʎZ[\\]ᵥ_,ɐqɔpǝɟƃɥıɾʞʅɯuodbɹsʇnʌʍxʎz', + }; + + const mods = { + 'fr-x-psaccent': val => + val.replace(reVowels, match => match + match.toLowerCase()), + + // Surround each word with Unicode formatting codes, RLO and PDF: + // U+202E: RIGHT-TO-LEFT OVERRIDE (RLO) + // U+202C: POP DIRECTIONAL FORMATTING (PDF) + // See http://www.w3.org/International/questions/qa-bidi-controls + 'ar-x-psbidi': val => + val.replace(reWords, match => '\u202e' + match + '\u202c'), + }; + + // Replace each Latin letter with a Unicode character from map + const ASCII_LETTER_A = 65; + const replaceChars = + (map, val) => val.replace( + reAlphas, match => map.charAt(match.charCodeAt(0) - ASCII_LETTER_A)); + + const transform = + val => replaceChars(charMaps[id], mods[id](val)); + + // apply fn to translatable parts of val + const apply = (fn, val) => { + if (!val) { + return val; + } + + const parts = val.split(reExcluded); + const modified = parts.map((part) => { + if (reExcluded.test(part)) { + return part; + } + return fn(part); + }); + return modified.join(''); + }; + + return _pseudo = { + name: transform(name), + process: str => apply(transform, str) + }; + }; + } + + const pseudo = Object.defineProperties(Object.create(null), { + 'fr-x-psaccent': { + enumerable: true, + get: createGetter('fr-x-psaccent', 'Runtime Accented') + }, + 'ar-x-psbidi': { + enumerable: true, + get: createGetter('ar-x-psbidi', 'Runtime Bidi') + } + }); + + class Env { + constructor(fetchResource) { + this.fetchResource = fetchResource; + + this.resCache = new Map(); + this.resRefs = new Map(); + this.numberFormatters = null; + this.parsers = { + properties: PropertiesParser, + l20n: L20nParser, + }; + + const listeners = {}; + this.emit = emit.bind(this, listeners); + this.addEventListener = addEventListener.bind(this, listeners); + this.removeEventListener = removeEventListener.bind(this, listeners); + } + + createContext(langs, resIds) { + const ctx = new Context(this, langs, resIds); + resIds.forEach(resId => { + const usedBy = this.resRefs.get(resId) || 0; + this.resRefs.set(resId, usedBy + 1); + }); + + return ctx; + } + + destroyContext(ctx) { + ctx.resIds.forEach(resId => { + const usedBy = this.resRefs.get(resId) || 0; + + if (usedBy > 1) { + return this.resRefs.set(resId, usedBy - 1); + } + + this.resRefs.delete(resId); + this.resCache.forEach((val, key) => + key.startsWith(resId) ? this.resCache.delete(key) : null); + }); + } + + _parse(syntax, lang, data) { + const parser = this.parsers[syntax]; + if (!parser) { + return data; + } + + const emitAndAmend = (type, err) => this.emit(type, amendError(lang, err)); + return parser.parse(emitAndAmend, data); + } + + _create(lang, entries) { + if (lang.src !== 'pseudo') { + return entries; + } + + const pseudoentries = Object.create(null); + for (let key in entries) { + pseudoentries[key] = walkEntry( + entries[key], pseudo[lang.code].process); + } + return pseudoentries; + } + + _getResource(lang, res) { + const cache = this.resCache; + const id = res + lang.code + lang.src; + + if (cache.has(id)) { + return cache.get(id); + } + + const syntax = res.substr(res.lastIndexOf('.') + 1); + + const saveEntries = data => { + const entries = this._parse(syntax, lang, data); + cache.set(id, this._create(lang, entries)); + }; + + const recover = err => { + err.lang = lang; + this.emit('fetcherror', err); + cache.set(id, err); + }; + + const langToFetch = lang.src === 'pseudo' ? + { code: 'en-US', src: 'app', ver: lang.ver } : + lang; + + const resource = this.fetchResource(res, langToFetch) + .then(saveEntries, recover); + + cache.set(id, resource); + + return resource; + } + } + + function amendError(lang, err) { + err.lang = lang; + return err; + } + + function prioritizeLocales(def, availableLangs, requested) { + let supportedLocale; + // Find the first locale in the requested list that is supported. + for (let i = 0; i < requested.length; i++) { + const locale = requested[i]; + if (availableLangs.indexOf(locale) !== -1) { + supportedLocale = locale; + break; + } + } + if (!supportedLocale || + supportedLocale === def) { + return [def]; + } + + return [supportedLocale, def]; + } + + function negotiateLanguages( + { appVersion, defaultLang, availableLangs }, additionalLangs, prevLangs, + requestedLangs) { + + const allAvailableLangs = Object.keys(availableLangs) + .concat(Object.keys(additionalLangs)) + .concat(Object.keys(pseudo)); + const newLangs = prioritizeLocales( + defaultLang, allAvailableLangs, requestedLangs); + + const langs = newLangs.map(code => ({ + code: code, + src: getLangSource(appVersion, availableLangs, additionalLangs, code), + ver: appVersion, + })); + + return { langs, haveChanged: !arrEqual(prevLangs, newLangs) }; + } + + function arrEqual(arr1, arr2) { + return arr1.length === arr2.length && + arr1.every((elem, i) => elem === arr2[i]); + } + + function getMatchingLangpack(appVersion, langpacks) { + for (let i = 0, langpack; (langpack = langpacks[i]); i++) { + if (langpack.target === appVersion) { + return langpack; + } + } + return null; + } + + function getLangSource(appVersion, availableLangs, additionalLangs, code) { + if (additionalLangs && additionalLangs[code]) { + const lp = getMatchingLangpack(appVersion, additionalLangs[code]); + if (lp && + (!(code in availableLangs) || + parseInt(lp.revision) > availableLangs[code])) { + return 'extra'; + } + } + + if ((code in pseudo) && !(code in availableLangs)) { + return 'pseudo'; + } + + return 'app'; + } + + class Remote { + constructor(fetchResource, broadcast) { + this.broadcast = broadcast; + this.env = new Env(fetchResource); + this.ctxs = new Map(); + } + + registerView(view, resources, meta, additionalLangs, requestedLangs) { + const { langs } = negotiateLanguages( + meta, additionalLangs, [], requestedLangs); + this.ctxs.set(view, this.env.createContext(langs, resources)); + return langs; + } + + unregisterView(view) { + this.ctxs.delete(view); + return true; + } + + formatEntities(view, keys) { + return this.ctxs.get(view).formatEntities(...keys); + } + + formatValues(view, keys) { + return this.ctxs.get(view).formatValues(...keys); + } + + changeLanguages(view, meta, additionalLangs, requestedLangs) { + const oldCtx = this.ctxs.get(view); + const prevLangs = oldCtx.langs; + const newLangs = negotiateLanguages( + meta, additionalLangs, prevLangs, requestedLangs); + this.ctxs.set(view, this.env.createContext( + newLangs.langs, oldCtx.resIds)); + return newLangs; + } + + requestLanguages(requestedLangs) { + this.broadcast('languageschangerequest', requestedLangs); + } + + getName(code) { + return pseudo[code].name; + } + + processString(code, str) { + return pseudo[code].process(str); + } + } + + const observerConfig = { + attributes: true, + characterData: false, + childList: true, + subtree: true, + attributeFilter: ['data-l10n-id', 'data-l10n-args'] + }; + + const observers = new WeakMap(); + + function initMutationObserver(view) { + observers.set(view, { + roots: new Set(), + observer: new MutationObserver( + mutations => translateMutations(view, mutations)), + }); + } + + function translateRoots(view) { + const roots = Array.from(observers.get(view).roots); + return Promise.all(roots.map( + root => translateFragment(view, root))); + } + + function observe(view, root) { + const obs = observers.get(view); + if (obs) { + obs.roots.add(root); + obs.observer.observe(root, observerConfig); + } + } + + function disconnect(view, root, allRoots) { + const obs = observers.get(view); + if (obs) { + obs.observer.disconnect(); + if (allRoots) { + return; + } + obs.roots.delete(root); + obs.roots.forEach( + other => obs.observer.observe(other, observerConfig)); + } + } + + function reconnect(view) { + const obs = observers.get(view); + if (obs) { + obs.roots.forEach( + root => obs.observer.observe(root, observerConfig)); + } + } + + // match the opening angle bracket (<) in HTML tags, and HTML entities like + // &, &, &. + const reOverlay = /<|&#?\w+;/; + + const allowed = { + elements: [ + 'a', 'em', 'strong', 'small', 's', 'cite', 'q', 'dfn', 'abbr', 'data', + 'time', 'code', 'var', 'samp', 'kbd', 'sub', 'sup', 'i', 'b', 'u', + 'mark', 'ruby', 'rt', 'rp', 'bdi', 'bdo', 'span', 'br', 'wbr' + ], + attributes: { + global: ['title', 'aria-label', 'aria-valuetext', 'aria-moz-hint'], + a: ['download'], + area: ['download', 'alt'], + // value is special-cased in isAttrAllowed + input: ['alt', 'placeholder'], + menuitem: ['label'], + menu: ['label'], + optgroup: ['label'], + option: ['label'], + track: ['label'], + img: ['alt'], + textarea: ['placeholder'], + th: ['abbr'] + } + }; + + function overlayElement(element, translation) { + const value = translation.value; + + if (typeof value === 'string') { + if (!reOverlay.test(value)) { + element.textContent = value; + } else { + // start with an inert template element and move its children into + // `element` but such that `element`'s own children are not replaced + const tmpl = element.ownerDocument.createElement('template'); + tmpl.innerHTML = value; + // overlay the node with the DocumentFragment + overlay(element, tmpl.content); + } + } + + for (let key in translation.attrs) { + const attrName = camelCaseToDashed(key); + if (isAttrAllowed({ name: attrName }, element)) { + element.setAttribute(attrName, translation.attrs[key]); + } + } + } + + // The goal of overlay is to move the children of `translationElement` + // into `sourceElement` such that `sourceElement`'s own children are not + // replaced, but onle have their text nodes and their attributes modified. + // + // We want to make it possible for localizers to apply text-level semantics to + // the translations and make use of HTML entities. At the same time, we + // don't trust translations so we need to filter unsafe elements and + // attribtues out and we don't want to break the Web by replacing elements to + // which third-party code might have created references (e.g. two-way + // bindings in MVC frameworks). + function overlay(sourceElement, translationElement) { + const result = translationElement.ownerDocument.createDocumentFragment(); + let k, attr; + + // take one node from translationElement at a time and check it against + // the allowed list or try to match it with a corresponding element + // in the source + let childElement; + while ((childElement = translationElement.childNodes[0])) { + translationElement.removeChild(childElement); + + if (childElement.nodeType === childElement.TEXT_NODE) { + result.appendChild(childElement); + continue; + } + + const index = getIndexOfType(childElement); + const sourceChild = getNthElementOfType(sourceElement, childElement, index); + if (sourceChild) { + // there is a corresponding element in the source, let's use it + overlay(sourceChild, childElement); + result.appendChild(sourceChild); + continue; + } + + if (isElementAllowed(childElement)) { + const sanitizedChild = childElement.ownerDocument.createElement( + childElement.nodeName); + overlay(sanitizedChild, childElement); + result.appendChild(sanitizedChild); + continue; + } + + // otherwise just take this child's textContent + result.appendChild( + translationElement.ownerDocument.createTextNode( + childElement.textContent)); + } + + // clear `sourceElement` and append `result` which by this time contains + // `sourceElement`'s original children, overlayed with translation + sourceElement.textContent = ''; + sourceElement.appendChild(result); + + // if we're overlaying a nested element, translate the allowed + // attributes; top-level attributes are handled in `translateElement` + // XXX attributes previously set here for another language should be + // cleared if a new language doesn't use them; https://bugzil.la/922577 + if (translationElement.attributes) { + for (k = 0, attr; (attr = translationElement.attributes[k]); k++) { + if (isAttrAllowed(attr, sourceElement)) { + sourceElement.setAttribute(attr.name, attr.value); + } + } + } + } + + // XXX the allowed list should be amendable; https://bugzil.la/922573 + function isElementAllowed(element) { + return allowed.elements.indexOf(element.tagName.toLowerCase()) !== -1; + } + + function isAttrAllowed(attr, element) { + const attrName = attr.name.toLowerCase(); + const tagName = element.tagName.toLowerCase(); + // is it a globally safe attribute? + if (allowed.attributes.global.indexOf(attrName) !== -1) { + return true; + } + // are there no allowed attributes for this element? + if (!allowed.attributes[tagName]) { + return false; + } + // is it allowed on this element? + // XXX the allowed list should be amendable; https://bugzil.la/922573 + if (allowed.attributes[tagName].indexOf(attrName) !== -1) { + return true; + } + // special case for value on inputs with type button, reset, submit + if (tagName === 'input' && attrName === 'value') { + const type = element.type.toLowerCase(); + if (type === 'submit' || type === 'button' || type === 'reset') { + return true; + } + } + return false; + } + + // Get n-th immediate child of context that is of the same type as element. + // XXX Use querySelector(':scope > ELEMENT:nth-of-type(index)'), when: + // 1) :scope is widely supported in more browsers and 2) it works with + // DocumentFragments. + function getNthElementOfType(context, element, index) { + /* jshint boss:true */ + let nthOfType = 0; + for (let i = 0, child; child = context.children[i]; i++) { + if (child.nodeType === child.ELEMENT_NODE && + child.tagName === element.tagName) { + if (nthOfType === index) { + return child; + } + nthOfType++; + } + } + return null; + } + + // Get the index of the element among siblings of the same type. + function getIndexOfType(element) { + let index = 0; + let child; + while ((child = element.previousElementSibling)) { + if (child.tagName === element.tagName) { + index++; + } + } + return index; + } + + function camelCaseToDashed(string) { + // XXX workaround for https://bugzil.la/1141934 + if (string === 'ariaValueText') { + return 'aria-valuetext'; + } + + return string + .replace(/[A-Z]/g, match => '-' + match.toLowerCase()) + .replace(/^-/, ''); + } + + const reHtml = /[&<>]/g; + const htmlEntities = { + '&': '&', + '<': '<', + '>': '>', + }; + + function setAttributes(element, id, args) { + element.setAttribute('data-l10n-id', id); + if (args) { + element.setAttribute('data-l10n-args', JSON.stringify(args)); + } + } + + function getAttributes(element) { + return { + id: element.getAttribute('data-l10n-id'), + args: JSON.parse(element.getAttribute('data-l10n-args')) + }; + } + + function getTranslatables(element) { + const nodes = Array.from(element.querySelectorAll('[data-l10n-id]')); + + if (typeof element.hasAttribute === 'function' && + element.hasAttribute('data-l10n-id')) { + nodes.push(element); + } + + return nodes; + } + + function translateMutations(view, mutations) { + const targets = new Set(); + + for (let mutation of mutations) { + switch (mutation.type) { + case 'attributes': + targets.add(mutation.target); + break; + case 'childList': + for (let addedNode of mutation.addedNodes) { + if (addedNode.nodeType === addedNode.ELEMENT_NODE) { + if (addedNode.childElementCount) { + getTranslatables(addedNode).forEach(targets.add.bind(targets)); + } else { + if (addedNode.hasAttribute('data-l10n-id')) { + targets.add(addedNode); + } + } + } + } + break; + } + } + + if (targets.size === 0) { + return; + } + + translateElements(view, Array.from(targets)); + } + + function translateFragment(view, frag) { + return translateElements(view, getTranslatables(frag)); + } + + function getElementsTranslation(view, elems) { + const keys = elems.map(elem => { + const id = elem.getAttribute('data-l10n-id'); + const args = elem.getAttribute('data-l10n-args'); + return args ? [ + id, + JSON.parse(args.replace(reHtml, match => htmlEntities[match])) + ] : id; + }); + + return view.formatEntities(...keys); + } + + function translateElements(view, elements) { + return getElementsTranslation(view, elements).then( + translations => applyTranslations(view, elements, translations)); + } + + function applyTranslations(view, elems, translations) { + disconnect(view, null, true); + for (let i = 0; i < elems.length; i++) { + overlayElement(elems[i], translations[i]); + } + reconnect(view); + } + + // Polyfill NodeList.prototype[Symbol.iterator] for Chrome. + // See https://code.google.com/p/chromium/issues/detail?id=401699 + if (typeof NodeList === 'function' && !NodeList.prototype[Symbol.iterator]) { + NodeList.prototype[Symbol.iterator] = Array.prototype[Symbol.iterator]; + } + + // A document.ready shim + // https://github.com/whatwg/html/issues/127 + function documentReady() { + if (document.readyState !== 'loading') { + return Promise.resolve(); + } + + return new Promise(resolve => { + document.addEventListener('readystatechange', function onrsc() { + document.removeEventListener('readystatechange', onrsc); + resolve(); + }); + }); + } + + // Intl.Locale + function getDirection(code) { + const tag = code.split('-')[0]; + return ['ar', 'he', 'fa', 'ps', 'ur'].indexOf(tag) >= 0 ? + 'rtl' : 'ltr'; + } + + // Opera and Safari don't support it yet + if (navigator.languages === undefined) { + navigator.languages = [navigator.language]; + } + + function getResourceLinks(head) { + return Array.prototype.map.call( + head.querySelectorAll('link[rel="localization"]'), + el => el.getAttribute('href')); + } + + function getMeta(head) { + let availableLangs = Object.create(null); + let defaultLang = null; + let appVersion = null; + + // XXX take last found instead of first? + const metas = Array.from(head.querySelectorAll( + 'meta[name="availableLanguages"],' + + 'meta[name="defaultLanguage"],' + + 'meta[name="appVersion"]')); + for (let meta of metas) { + const name = meta.getAttribute('name'); + const content = meta.getAttribute('content').trim(); + switch (name) { + case 'availableLanguages': + availableLangs = getLangRevisionMap( + availableLangs, content); + break; + case 'defaultLanguage': + const [lang, rev] = getLangRevisionTuple(content); + defaultLang = lang; + if (!(lang in availableLangs)) { + availableLangs[lang] = rev; + } + break; + case 'appVersion': + appVersion = content; + } + } + + return { + defaultLang, + availableLangs, + appVersion + }; + } + + function getLangRevisionMap(seq, str) { + return str.split(',').reduce((prevSeq, cur) => { + const [lang, rev] = getLangRevisionTuple(cur); + prevSeq[lang] = rev; + return prevSeq; + }, seq); + } + + function getLangRevisionTuple(str) { + const [lang, rev] = str.trim().split(':'); + // if revision is missing, use NaN + return [lang, parseInt(rev)]; + } + + const viewProps = new WeakMap(); + + class View { + constructor(client, doc) { + this.pseudo = { + 'fr-x-psaccent': createPseudo(this, 'fr-x-psaccent'), + 'ar-x-psbidi': createPseudo(this, 'ar-x-psbidi') + }; + + const initialized = documentReady().then(() => init(this, client)); + this._interactive = initialized.then(() => client); + this.ready = initialized.then(langs => translateView(this, langs)); + initMutationObserver(this); + + viewProps.set(this, { + doc: doc, + ready: false + }); + + client.on('languageschangerequest', + requestedLangs => this.requestLanguages(requestedLangs)); + } + + requestLanguages(requestedLangs, isGlobal) { + const method = isGlobal ? + client => client.method('requestLanguages', requestedLangs) : + client => changeLanguages(this, client, requestedLangs); + return this._interactive.then(method); + } + + handleEvent() { + return this.requestLanguages(navigator.languages); + } + + formatEntities(...keys) { + return this._interactive.then( + client => client.method('formatEntities', client.id, keys)); + } + + formatValue(id, args) { + return this._interactive.then( + client => client.method('formatValues', client.id, [[id, args]])).then( + values => values[0]); + } + + formatValues(...keys) { + return this._interactive.then( + client => client.method('formatValues', client.id, keys)); + } + + translateFragment(frag) { + return translateFragment(this, frag); + } + + observeRoot(root) { + observe(this, root); + } + + disconnectRoot(root) { + disconnect(this, root); + } + } + + View.prototype.setAttributes = setAttributes; + View.prototype.getAttributes = getAttributes; + + function createPseudo(view, code) { + return { + getName: () => view._interactive.then( + client => client.method('getName', code)), + processString: str => view._interactive.then( + client => client.method('processString', code, str)), + }; + } + + function init(view, client) { + const doc = viewProps.get(view).doc; + const resources = getResourceLinks(doc.head); + const meta = getMeta(doc.head); + view.observeRoot(doc.documentElement); + return getAdditionalLanguages().then( + additionalLangs => client.method( + 'registerView', client.id, resources, meta, additionalLangs, + navigator.languages)); + } + + function changeLanguages(view, client, requestedLangs) { + const doc = viewProps.get(view).doc; + const meta = getMeta(doc.head); + return getAdditionalLanguages() + .then(additionalLangs => client.method( + 'changeLanguages', client.id, meta, additionalLangs, requestedLangs + )) + .then(({langs, haveChanged}) => haveChanged ? + translateView(view, langs) : undefined + ); + } + + function getAdditionalLanguages() { + if (navigator.mozApps && navigator.mozApps.getAdditionalLanguages) { + return navigator.mozApps.getAdditionalLanguages() + .catch(() => Object.create(null)); + } + + return Promise.resolve(Object.create(null)); + } + + function translateView(view, langs) { + const props = viewProps.get(view); + const html = props.doc.documentElement; + + if (props.ready) { + return translateRoots(view).then( + () => setAllAndEmit(html, langs)); + } + + const translated = + // has the document been already pre-translated? + langs[0].code === html.getAttribute('lang') ? + Promise.resolve() : + translateRoots(view).then( + () => setLangDir(html, langs)); + + return translated.then(() => { + setLangs(html, langs); + props.ready = true; + }); + } + + function setLangs(html, langs) { + const codes = langs.map(lang => lang.code); + html.setAttribute('langs', codes.join(' ')); + } + + function setLangDir(html, langs) { + const code = langs[0].code; + html.setAttribute('lang', code); + html.setAttribute('dir', getDirection(code)); + } + + function setAllAndEmit(html, langs) { + setLangDir(html, langs); + setLangs(html, langs); + html.parentNode.dispatchEvent(new CustomEvent('DOMRetranslated', { + bubbles: false, + cancelable: false, + })); + } + + const remote = new Remote(fetchResource, broadcast); + const client = new Client(remote); + document.l10n = new View(client, document); + + window.addEventListener('languagechange', document.l10n); + document.addEventListener('additionallanguageschange', document.l10n); + +})(); diff --git a/browser/extensions/mortar/host/pdf/chrome/js/polyfill.js b/browser/extensions/mortar/host/pdf/chrome/js/polyfill.js new file mode 100644 index 000000000000..abd308105800 --- /dev/null +++ b/browser/extensions/mortar/host/pdf/chrome/js/polyfill.js @@ -0,0 +1,239 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +'use strict'; + +class PolyfillDropdown { + constructor(select) { + this._select = select; + this._currentValue = select.value; + + this._visible = false; + this._scrollbarWidth = 0; + + this._options = []; + this._onChangedHandler = []; + + this._polyfill = document.createElement('div'); + this._polyfill.classList.add('polyfillDropdown'); + this._polyfill.classList.add('hidden'); + + for (let elem of this._select.getElementsByTagName('option')) { + this._options.push(elem.value); + + if (!elem.hidden) { + let option = document.createElement('div'); + option.classList.add('polyfillOption'); + option.tabIndex = -1; + option.dataset.value = elem.value; + document.l10n.setAttributes(option, + elem.dataset.l10nId, JSON.parse(elem.dataset.l10nArgs || '{}')); + option.addEventListener('click', + this._onOptionClicked.bind(this, elem.value)); + this._polyfill.appendChild(option); + } + } + + document.body.appendChild(this._polyfill); + + let dropdownStyle = getComputedStyle(this._polyfill); + this._defaultDropdownBorderWidth = + parseInt(dropdownStyle.getPropertyValue('border-left-width'), 10) + + parseInt(dropdownStyle.getPropertyValue('border-right-width'), 10); + + let optionStyle = getComputedStyle(this._polyfill.childNodes[0]); + this._defaultOptionPaddingRight = + parseInt(optionStyle.getPropertyValue('padding-right'), 10); + + this._select.addEventListener('click', this); + this._select.addEventListener('change', this); + this._select.addEventListener('blur', this); + this._select.addEventListener('keydown', this); + } + + get value() { + return this._select.value; + } + + set value(value) { + this._currentValue = value; + this._select.value = value; + } + + _show() { + if (this._visible) { + return; + } + this._visible = true; + this._updateOptionStatus(); + this._polyfill.classList.remove('hidden'); + this._resize(); + + window.addEventListener('resize', this); + } + + _hide() { + if (!this._visible) { + return; + } + window.removeEventListener('resize', this); + this._polyfill.classList.add('hidden'); + this._visible = false; + + if (this._select.value !== this._currentValue) { + this._triggerChangeEvent(); + } + } + + _updateOptionStatus() { + let currentValue = this._select.value; + for (let elem of this._polyfill.childNodes) { + elem.classList.toggle('toggled', elem.dataset.value === currentValue); + }; + } + + _resize() { + let rect = this._select.getBoundingClientRect(); + this._polyfill.style.left = rect.left + 'px'; + this._polyfill.style.top = rect.bottom + 'px'; + + let scrollbarWidth = this._polyfill.offsetWidth - + this._polyfill.clientWidth - this._defaultDropdownBorderWidth; + + if (scrollbarWidth != this._scrollbarWidth) { + this._scrollbarWidth = scrollbarWidth; + Array.from(this._polyfill.getElementsByClassName('polyfillOption')) + .forEach(option => { + if (scrollbarWidth > 0) { + option.style.paddingRight = + (scrollbarWidth + this._defaultOptionPaddingRight) + 'px'; + } else { + option.style.paddingRight = ''; + } + }); + } + } + + _onOptionClicked(value) { + this._select.value = value; + this._hide(); + } + + _triggerChangeEvent() { + this._currentValue = this._select.value; + + let event = { + type: 'change', + target: this._select + }; + + this._onChangedHandler.forEach(handler => { + if (typeof handler === 'function') { + handler.call(this._select, event); + } else if (typeof handler === 'object' && + typeof handler.handleEvent === 'function') { + handler.handleEvent(event); + } + }); + } + + addEventListener(type, listener, useCapture) { + if (type == 'change') { + this._onChangedHandler.push(listener); + } else { + this._select.addEventListener(type, listener, useCapture); + } + } + + querySelectorAll(selectors) { + return this._select.querySelectorAll(selectors); + } + + handleEvent(evt) { + let handled = false; + + switch(evt.type) { + case 'click': + if (this._visible) { + this._hide(); + } else { + this._show(); + } + handled = true; + break; + case 'change': + if (this._visible) { + this._updateOptionStatus(); + } else if (this._select.value !== this._currentValue) { + this._triggerChangeEvent(); + } + break; + case 'blur': + setTimeout(() => { + if (!this._polyfill.contains(document.activeElement)) { + this._hide(); + } + }); + break; + case 'resize': + this._resize(); + break; + case 'keydown': + let isMac = navigator.platform.startsWith('Mac'); + + if (this._visible) { + let index; + + switch(evt.keyCode) { + case KeyEvent.DOM_VK_ESCAPE: + case KeyEvent.DOM_VK_RETURN: + this._hide(); + handled = true; + break; + case KeyEvent.DOM_VK_DOWN: + if (isMac) { + index = this._options.indexOf(this._select.value); + if (index < this._options.length - 1) { + this._select.value = this._options[index + 1]; + this._updateOptionStatus(); + } + handled = true; + } + break; + case KeyEvent.DOM_VK_UP: + if (isMac) { + index = this._options.indexOf(this._select.value); + if (index > 0) { + this._select.value = this._options[index - 1]; + this._updateOptionStatus(); + } + handled = true; + } + break; + } + } else if (document.activeElement == this._select) { + switch(evt.keyCode) { + case KeyEvent.DOM_VK_SPACE: + this._show(); + handled = true; + break; + case KeyEvent.DOM_VK_DOWN: + case KeyEvent.DOM_VK_UP: + if (isMac) { + this._show(); + handled = true; + } + break; + } + } + + break; + } + + if (handled) { + evt.stopPropagation(); + evt.preventDefault(); + } + } +} diff --git a/browser/extensions/mortar/host/pdf/chrome/js/toolbar.js b/browser/extensions/mortar/host/pdf/chrome/js/toolbar.js new file mode 100644 index 000000000000..b1082eb5946b --- /dev/null +++ b/browser/extensions/mortar/host/pdf/chrome/js/toolbar.js @@ -0,0 +1,279 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +'use strict'; + +class ProgressBar { + constructor() { + this._container = document.getElementById('loadingBar'); + this._percentage = this._container.querySelector('.progress'); + } + + show() { + this._container.classList.remove('hidden'); + } + + hide(waitForTransition) { + let percentage = this._percentage; + let doHide = () => { + this._container.classList.add('hidden'); + percentage.style.width = ''; + }; + if (!waitForTransition) { + doHide(); + } else { + percentage.addEventListener('transitionend', function handler() { + percentage.removeEventListener('transitionend', handler); + doHide(); + }); + } + } + + setProgress(progress) { + if (isNaN(progress) || progress < 0 || progress > 100) { + this._percentage.classList.add('indeterminate'); + return; + } + this._percentage.classList.remove('indeterminate'); + this._percentage.style.width = Math.round(progress) + '%'; + } +} + +class SecondaryToolbar { + constructor() { + this._container = document.getElementById('secondaryToolbar'); + this._toggleButton = document.getElementById('secondaryToolbarToggle'); + } + + toggle() { + this._toggleButton.classList.toggle('toggled'); + this._container.classList.toggle('hidden'); + if (this._container.classList.contains('hidden')) { + window.removeEventListener('click', this); + } else { + window.addEventListener('click', this); + } + } + + handleEvent(evt) { + // Hide the secondary toolbar automatically when a user is not clicking the + // toggle button. (The handler of the toggle button will take care of hiding + // it instead.) + if (evt.target != this._toggleButton) { + this.toggle(); + } + } +} + +class ScaleSelect { + constructor(viewport) { + this._viewport = viewport; + + this._select = new PolyfillDropdown(document.getElementById('scaleSelect')); + this._select.addEventListener('change', this); + + this._customScaleOption = document.getElementById('customScaleOption'); + this._customScale = 0; + + this._predefinedOption = + Array.from(this._select.querySelectorAll('option:not([hidden])')) + .map(elem => elem.value); + } + + setScale(scale) { + if (this._predefinedOption.includes(String(scale))) { + this._customScale = 0; + this._select.value = scale; + } else if (!isNaN(scale)) { + let customScale = Math.round(scale * 10000) / 100; + if (customScale != this._customScale) { + this._customScale = customScale; + document.l10n.formatValue('page_scale_percent', {scale: customScale}) + .then(result => { + this._select.value = ''; + this._customScaleOption.textContent = result; + this._select.value = 'custom'; + }); + } + } + } + + handleEvent(evt) { + switch(evt.type) { + case 'change': + let scale = this._select.value; + if (!isNaN(scale)) { + // "viewport.fitting" will be set to "none" automatically once + // assigning a new "zoom". + this._viewport.zoom = scale; + } else if (scale != 'custom') { + this._viewport.fitting = scale; + } + break; + } + } +} + +class Toolbar { + constructor(viewport) { + let elements = [ + 'zoomIn', 'zoomOut', 'previous', 'next', 'pageNumber', 'numPages', + 'firstPage', 'lastPage', 'pageRotateCw', 'pageRotateCcw' + ]; + + this.ZOOM_FACTORS = [ + 0.25, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1, 1.1, 1.3, 1.5, 1.7, 1.9, 2.1, + 2.4, 2.7, 3, 3.3, 3.7, 4.1, 4.6, 5.1, 5.7, 6.3, 7, 7.7, 8.5, 9.4, 10 + ]; + + this._viewport = viewport; + this._secondaryToolbar = new SecondaryToolbar(); + this._loadingBar = new ProgressBar(); + this._scaleSelect = new ScaleSelect(viewport); + + this._elements = {}; + elements.forEach(id => { + this._elements[id] = document.getElementById(id); + }); + + let toolbarButtons = + document.querySelectorAll('.toolbarButton, .secondaryToolbarButton'); + for (let button of toolbarButtons) { + button.addEventListener('click', this); + } + + this._elements.pageNumber.addEventListener('focus', this); + this._elements.pageNumber.addEventListener('change', this); + + this._viewport.onDimensionChanged = this._updateDimensions.bind(this); + this._viewport.onProgressChanged = this._updateProgress.bind(this); + this._viewport.onZoomChanged = this._updateToolbar.bind(this); + this._viewport.onPageChanged = this._updateToolbar.bind(this); + + this._updateToolbar(); + } + + _zoomIn() { + let zoom = this._viewport.zoom; + let newZoom = this.ZOOM_FACTORS.find(factor => (factor - zoom) > 0.049); + if (!newZoom) { + newZoom = this.ZOOM_FACTORS[this.ZOOM_FACTORS.length - 1]; + } + this._viewport.zoom = newZoom; + } + + _zoomOut() { + let reversedFactors = Array.from(this.ZOOM_FACTORS); + reversedFactors.reverse(); + let zoom = this._viewport.zoom; + let newZoom = reversedFactors.find(factor => (zoom - factor) > 0.049); + if (!newZoom) { + newZoom = this.ZOOM_FACTORS[0]; + } + this._viewport.zoom = newZoom; + } + + _buttonClicked(id) { + switch(id) { + case 'firstPage': + this._viewport.page = 0; + break; + case 'lastPage': + this._viewport.page = this._viewport.pageCount - 1; + break; + case 'previous': + this._viewport.page--; + break; + case 'next': + this._viewport.page++; + break; + case 'zoomIn': + this._zoomIn(); + break; + case 'zoomOut': + this._zoomOut(); + break; + case 'pageRotateCw': + this._viewport.rotateClockwise(); + break; + case 'pageRotateCcw': + this._viewport.rotateCounterClockwise(); + break; + case 'secondaryToolbarToggle': + this._secondaryToolbar.toggle(); + break; + } + } + + _pageNumberChanged() { + let newPage = parseFloat(this._elements.pageNumber.value); + if (!Number.isInteger(newPage) || + newPage < 1 || newPage > this._viewport.pageCount) { + this._elements.pageNumber.value = this._viewport.page + 1; + return; + } + this._elements.pageNumber.value = newPage; + this._viewport.page = newPage - 1; + } + + _updateDimensions() { + let pageCount = this._viewport.pageCount; + document.l10n.formatValue('page_of', { pageCount }) + .then(page_of => this._elements.numPages.textContent = page_of); + this._elements.pageNumber.max = pageCount; + this._updateToolbar(); + } + + _updateToolbar() { + let page = this._viewport.page + 1; + let pageCount = this._viewport.pageCount; + + this._elements.pageNumber.disabled = + this._elements.pageRotateCw.disabled = + this._elements.pageRotateCcw.disabled = (pageCount == 0); + + this._elements.pageNumber.value = pageCount ? page : ''; + this._elements.previous.disabled = + this._elements.firstPage.disabled = (!pageCount || page == 1); + this._elements.next.disabled = + this._elements.lastPage.disabled = (!pageCount || page == pageCount); + + let zoom = this._viewport.zoom; + this._elements.zoomIn.disabled = + (zoom >= this.ZOOM_FACTORS[this.ZOOM_FACTORS.length - 1]); + this._elements.zoomOut.disabled = (zoom <= this.ZOOM_FACTORS[0]); + + let fitting = this._viewport.fitting; + this._scaleSelect.setScale(fitting == 'none' ? zoom : fitting); + } + + _updateProgress(progress) { + this._loadingBar.show(); + this._loadingBar.setProgress(progress); + + if (progress == 100) { + this._loadingBar.hide(true); + } + } + + handleEvent(evt) { + let target = evt.target; + + switch(evt.type) { + case 'change': + if (target === this._elements.pageNumber) { + this._pageNumberChanged(); + } + break; + case 'focus': + if (target === this._elements.pageNumber) { + target.select(); + } + break; + case 'click': + this._buttonClicked(target.id); + break; + } + } +} diff --git a/browser/extensions/mortar/host/pdf/chrome/js/viewer.js b/browser/extensions/mortar/host/pdf/chrome/js/viewer.js new file mode 100644 index 000000000000..e107a20a4357 --- /dev/null +++ b/browser/extensions/mortar/host/pdf/chrome/js/viewer.js @@ -0,0 +1,27 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +'use strict'; + +window.addEventListener('DOMContentLoaded', function() { + let viewport = new Viewport(); + let toolbar = new Toolbar(viewport); + + // Expose the custom viewport object to runtime + window.createCustomViewport = function(actionHandler) { + viewport.registerActionHandler(actionHandler); + + return { + addView: viewport.addView.bind(viewport), + clearView: viewport.clearView.bind(viewport), + getBoundingClientRect: viewport.getBoundingClientRect.bind(viewport), + is: viewport.is.bind(viewport), + bindUIEvent: viewport.bindUIEvent.bind(viewport), + unbindUIEvent: viewport.unbindUIEvent.bind(viewport), + setCursor: viewport.setCursor.bind(viewport), + getScrollOffset: viewport.getScrollOffset.bind(viewport), + notify: viewport.notify.bind(viewport) + }; + }; +}); diff --git a/browser/extensions/mortar/host/pdf/chrome/js/viewport.js b/browser/extensions/mortar/host/pdf/chrome/js/viewport.js new file mode 100644 index 000000000000..54aa04ee8dfb --- /dev/null +++ b/browser/extensions/mortar/host/pdf/chrome/js/viewport.js @@ -0,0 +1,501 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +'use strict'; + +class Viewport { + constructor() { + this._canvasContainer = document.getElementById('canvasContainer'); + this._viewportController = document.getElementById('viewportController'); + this._sizer = document.getElementById('sizer'); + + this._scrollbarWidth = this._getScrollbarWidth(); + this._hasVisibleScrollbars = { + horizontal: false, + vertical: false + }; + + this._page = 0; + this._zoom = 1; + this._fitting = 'auto'; + + // Caches the next position set during a series of actions and will be set + // to scrollbar's position until calling "_refresh". + this._nextPosition = null; + + // Indicates the last position that runtime knows. Will update runtime only + // if "scroll" event gives us a different value. + this._runtimePosition = this.getScrollOffset(); + + // Similar to above. Will notify runtime only if "_notifyRuntimeOfResized()" + // gets a different value. + this._runtimeSize = this.getBoundingClientRect(); + this._runtimeOnResizedListener = []; + + this.onProgressChanged = null; + this.onZoomChanged = null; + this.onDimensionChanged = null; + this.onPageChanged = null; + + this._viewportController.addEventListener('scroll', this); + window.addEventListener('resize', this); + } + + get zoom() { + return this._zoom; + } + + set zoom(newZoom) { + newZoom = parseFloat(newZoom); + if (!isNaN(newZoom) && + (newZoom != this._zoom || this._fitting != 'none')) { + this._fitting = 'none'; + this._setZoom(newZoom); + this._refresh(); + } + } + + get fitting() { + return this._fitting; + } + + set fitting(newFitting) { + let VALID_VALUE = ['none', 'auto', 'page-actual', 'page-width', 'page-fit']; + if (!VALID_VALUE.includes(newFitting)) { + return; + } + + if (newFitting != this._fitting) { + this._fitting = newFitting; + this._setZoom(this._computeFittingZoom()); + this._refresh(); + } + } + + get pageCount() { + if (!this._pageDimensions) { + return 0; + } + return this._pageDimensions.length; + } + + get page() { + return this._page; + } + + set page(newPage) { + newPage = parseFloat(newPage); + + let pageCount = this.pageCount; + if (!pageCount || !Number.isInteger(newPage)) { + return; + } + + newPage = Math.max(0, Math.min(pageCount - 1, newPage)); + this._setPage(newPage); + this._refresh(); + } + + _getScrollbarWidth() { + var div = document.createElement('div'); + div.style.visibility = 'hidden'; + div.style.overflow = 'scroll'; + div.style.width = '50px'; + div.style.height = '50px'; + div.style.position = 'absolute'; + document.body.appendChild(div); + var result = div.offsetWidth - div.clientWidth; + div.remove(); + return result; + } + + _documentHasVisibleScrollbars(zoom) { + let zoomedDimensions = this._getZoomedDocumentDimensions(zoom); + if (!zoomedDimensions || !this._scrollbarWidth) { + return { + horizontal: false, + vertical: false + }; + } + + let outerRect = this._viewportController.getBoundingClientRect(); + if (zoomedDimensions.width > outerRect.width) { + zoomedDimensions.height += this._scrollbarWidth; + } else if (zoomedDimensions.height > outerRect.height) { + zoomedDimensions.width += this._scrollbarWidth; + } + + return { + horizontal: zoomedDimensions.width > outerRect.width, + vertical: zoomedDimensions.height > outerRect.height + }; + } + + _updateProgress(progress) { + if (typeof this.onProgressChanged === 'function') { + this.onProgressChanged(progress); + } + } + + _setDocumentDimensions(documentDimensions) { + this._documentDimensions = documentDimensions; + this._pageDimensions = documentDimensions.pageDimensions; + this._setZoom(this._computeFittingZoom()); + this._setPage(this._page); + if (typeof this.onDimensionChanged === 'function') { + this.onDimensionChanged(); + } + this._refresh(); + } + + _computeFittingZoom() { + let newZoom = this._zoom; + let fitting = this._fitting; + + if (fitting == 'none') { + return newZoom; + } + + let FITTING_PADDING = 40; + let MAX_AUTO_ZOOM = 1.25; + + let page = this._pageDimensions[this._page]; + let viewportRect = this.getBoundingClientRect(); + + let pageWidthZoom = (viewportRect.width - FITTING_PADDING) / page.width; + let pageHeightZoom = viewportRect.height / page.height; + + switch (fitting) { + case 'auto': + let isLandscape = (page.width > page.height); + // For pages in landscape mode, fit the page height to the viewer + // *unless* the page would thus become too wide to fit horizontally. + let horizontalZoom = isLandscape ? + Math.min(pageWidthZoom, pageHeightZoom) : pageWidthZoom; + newZoom = Math.min(MAX_AUTO_ZOOM, horizontalZoom); + break; + case 'page-actual': + newZoom = 1; + break; + case 'page-width': + newZoom = pageWidthZoom; + break; + case 'page-fit': + newZoom = Math.min(pageWidthZoom, pageHeightZoom); + break; + } + + return newZoom; + } + + _getMostVisiblePage() { + let firstVisiblePage = 0; + + let pageCount = this.pageCount; + if (!pageCount) { + return firstVisiblePage; + } + + let position = this.getScrollOffset(); + + let min = 0; + let max = pageCount - 1; + let y = position.y / this._zoom; + + while (max >= min) { + let page = Math.floor(min + ((max - min) / 2)); + // There might be a gap between the pages, in which case use the bottom + // of the previous page as the top for finding the page. + let top = 0; + if (page > 0) { + top = this._pageDimensions[page - 1].y + + this._pageDimensions[page - 1].height; + } + let bottom = this._pageDimensions[page].y + + this._pageDimensions[page].height; + + if (top <= y && bottom > y) { + firstVisiblePage = page; + break; + } else if (top > y) { + max = page - 1; + } else { + min = page + 1; + } + } + + if (firstVisiblePage == pageCount - 1) { + return firstVisiblePage; + } + + let rect = this.getBoundingClientRect(); + let viewportRect = { + x: position.x / this._zoom, + y: position.y / this._zoom, + width: rect.width / this._zoom, + height: rect.height / this._zoom + }; + + let getVisibleHeightRatio = rect => { + let intersectionHeight = + Math.min(rect.y + rect.height, viewportRect.y + viewportRect.height) - + Math.max(rect.y, viewportRect.y); + return Math.max(0, intersectionHeight) / rect.height; + }; + + let firstVisiblePageVisibility = + getVisibleHeightRatio(this._pageDimensions[firstVisiblePage]); + let nextPageVisibility = + getVisibleHeightRatio(this._pageDimensions[firstVisiblePage + 1]); + + if (nextPageVisibility > firstVisiblePageVisibility) { + return firstVisiblePage + 1; + } + + return firstVisiblePage; + } + + _getZoomedDocumentDimensions(zoom) { + if (!this._documentDimensions) { + return null; + } + return { + width: Math.round(this._documentDimensions.width * zoom), + height: Math.round(this._documentDimensions.height * zoom) + }; + } + + _setPosition(x, y) { + this._nextPosition = {x, y}; + } + + _setZoom(newZoom) { + let currentPos = this._nextPosition || this.getScrollOffset(); + currentPos.x /= this._zoom; + currentPos.y /= this._zoom; + this._zoom = newZoom; + this._contentSizeChanged(); + this._setPosition( + currentPos.x * newZoom, + currentPos.y * newZoom + ); + if (typeof this.onZoomChanged === 'function') { + this.onZoomChanged(this._zoom); + } + } + + _setPage(newPage) { + if (newPage < 0 || newPage >= this.pageCount) { + return; + } + this._setPosition( + this._pageDimensions[newPage].x * this._zoom, + this._pageDimensions[newPage].y * this._zoom + ); + } + + _updateCanvasSize() { + let hasScrollbars = this._documentHasVisibleScrollbars(this._zoom); + if (hasScrollbars.horizontal == this._hasVisibleScrollbars.horizontal && + hasScrollbars.vertical == this._hasVisibleScrollbars.vertical) { + return; + } + this._hasVisibleScrollbars = hasScrollbars; + this._canvasContainer.style.bottom = + hasScrollbars.horizontal ? this._scrollbarWidth + 'px' : 0; + this._canvasContainer.style.right = + hasScrollbars.vertical ? this._scrollbarWidth + 'px' : 0; + this._notifyRuntimeOfResized(); + } + + _contentSizeChanged() { + let zoomedDimensions = this._getZoomedDocumentDimensions(this._zoom); + if (zoomedDimensions) { + this._sizer.style.width = zoomedDimensions.width + 'px'; + this._sizer.style.height = zoomedDimensions.height + 'px'; + this._updateCanvasSize(); + } + } + + _resize() { + let newZoom = this._computeFittingZoom(); + if (newZoom != this._zoom) { + this._setZoom(newZoom); + } else { + this._updateCanvasSize(); + } + } + + _notifyRuntimeOfResized() { + let rect = this.getBoundingClientRect(); + + if (rect.width == this._runtimeSize.width && + rect.height == this._runtimeSize.height) { + return; + } + + this._runtimeSize = rect; + this._runtimeOnResizedListener.forEach(listener => { + let evt = { + type: 'resize', + target: this._viewportController + }; + if (typeof listener === 'function') { + listener(evt); + } else if (typeof listener.handleEvent === 'function') { + listener.handleEvent(evt); + } + }); + } + + _getEventTarget(type) { + switch(type) { + case 'keydown': + case 'keyup': + case 'keypress': + return window; + } + return this._viewportController; + } + + _doAction(message) { + if (this._actionHandler) { + this._actionHandler(message); + } + } + + _refresh() { + if (this._nextPosition) { + this._viewportController.scrollTo( + this._nextPosition.x, this._nextPosition.y); + this._nextPosition = null; + } + + this._runtimePosition = this.getScrollOffset(); + this._doAction({ + type: 'viewport', + xOffset: this._runtimePosition.x, + yOffset: this._runtimePosition.y, + zoom: this._zoom + }); + + let newPage = this._getMostVisiblePage(); + if (newPage != this._page) { + this._page = newPage; + if (typeof this.onPageChanged === 'function') { + this.onPageChanged(newPage); + } + } + } + + handleEvent(evt) { + switch(evt.type) { + case 'resize': + this._resize(); + this._notifyRuntimeOfResized(); + this._refresh(); + break; + case 'scroll': + this._nextPosition = null; + let position = this.getScrollOffset(); + if (this._runtimePosition.x != position.x || + this._runtimePosition.y != position.y) { + this._refresh(); + } + break; + } + } + + rotateClockwise() { + this._doAction({ + type: 'rotateClockwise' + }); + } + + rotateCounterClockwise() { + this._doAction({ + type: 'rotateCounterclockwise' + }); + } + + // A handler for delivering messages to runtime. + registerActionHandler(handler) { + if (typeof handler === 'function') { + this._actionHandler = handler; + } + } + + /***************************/ + /* PPAPIViewport Interface */ + /***************************/ + + addView(canvas) { + this._canvasContainer.appendChild(canvas); + } + + clearView() { + this._canvasContainer.innerHTML = ''; + } + + getBoundingClientRect() { + return this._canvasContainer.getBoundingClientRect(); + } + + is(element) { + return element == this._viewportController; + } + + bindUIEvent(type, listener) { + if (type == 'fullscreenchange' || type == 'MozScrolledAreaChanged') { + // These two events won't be bound on a target because they should be + // fully controlled by UI layer, and we'll manually trigger the resize + // event once needed. + return; + } + switch(type) { + case 'resize': + this._runtimeOnResizedListener.push(listener); + break; + default: + this._getEventTarget(type).addEventListener(type, listener); + } + } + + unbindUIEvent(type, listener) { + if (type == 'fullscreenchange' || type == 'MozScrolledAreaChanged') { + return; + } + switch(type) { + case 'resize': + this._runtimeOnResizedListener = + this._runtimeOnResizedListener.filter(item => item != listener); + break; + default: + this._getEventTarget(type).removeEventListener(type, listener); + } + } + + setCursor(cursor) { + this._viewportController.style.cursor = cursor; + } + + getScrollOffset() { + return { + x: this._viewportController.scrollLeft, + y: this._viewportController.scrollTop + }; + } + + // Notified by runtime. + notify(message) { + switch (message.type) { + case 'loadProgress': + this._updateProgress(message.progress); + break; + case 'documentDimensions': + this._setDocumentDimensions(message); + break; + } + } +} diff --git a/browser/extensions/mortar/host/pdf/chrome/locale/viewer.en-US.properties b/browser/extensions/mortar/host/pdf/chrome/locale/viewer.en-US.properties new file mode 100644 index 000000000000..20c91956604f --- /dev/null +++ b/browser/extensions/mortar/host/pdf/chrome/locale/viewer.en-US.properties @@ -0,0 +1,173 @@ +# Copyright 2012 Mozilla Foundation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Main toolbar buttons (tooltips and alt text for images) +previous.title=Previous Page +previous_label=Previous +next.title=Next Page +next_label=Next + +# LOCALIZATION NOTE (page_label, page_of): +# These strings are concatenated to form the "Page: X of Y" string. +# Do not translate "{{pageCount}}", it will be substituted with a number +# representing the total number of pages. +page_label=Page: +page_of=of {{pageCount}} + +zoom_out.title=Zoom Out +zoom_out_label=Zoom Out +zoom_in.title=Zoom In +zoom_in_label=Zoom In +zoom.title=Zoom +presentation_mode.title=Switch to Presentation Mode +presentation_mode_label=Presentation Mode +open_file.title=Open File +open_file_label=Open +print.title=Print +print_label=Print +download.title=Download +download_label=Download +bookmark.title=Current view (copy or open in new window) +bookmark_label=Current View + +# Secondary toolbar and context menu +tools.title=Tools +tools_label=Tools +first_page.title=Go to First Page +first_page.label=Go to First Page +first_page_label=Go to First Page +last_page.title=Go to Last Page +last_page.label=Go to Last Page +last_page_label=Go to Last Page +page_rotate_cw.title=Rotate Clockwise +page_rotate_cw.label=Rotate Clockwise +page_rotate_cw_label=Rotate Clockwise +page_rotate_ccw.title=Rotate Counterclockwise +page_rotate_ccw.label=Rotate Counterclockwise +page_rotate_ccw_label=Rotate Counterclockwise + +hand_tool_enable.title=Enable hand tool +hand_tool_enable_label=Enable hand tool +hand_tool_disable.title=Disable hand tool +hand_tool_disable_label=Disable hand tool + +# Document properties dialog box +document_properties.title=Document Properties… +document_properties_label=Document Properties… +document_properties_file_name=File name: +document_properties_file_size=File size: +# LOCALIZATION NOTE (document_properties_kb): "{{size_kb}}" and "{{size_b}}" +# will be replaced by the PDF file size in kilobytes, respectively in bytes. +document_properties_kb={{size_kb}} KB ({{size_b}} bytes) +# LOCALIZATION NOTE (document_properties_mb): "{{size_mb}}" and "{{size_b}}" +# will be replaced by the PDF file size in megabytes, respectively in bytes. +document_properties_mb={{size_mb}} MB ({{size_b}} bytes) +document_properties_title=Title: +document_properties_author=Author: +document_properties_subject=Subject: +document_properties_keywords=Keywords: +document_properties_creation_date=Creation Date: +document_properties_modification_date=Modification Date: +# LOCALIZATION NOTE (document_properties_date_string): "{{date}}" and "{{time}}" +# will be replaced by the creation/modification date, and time, of the PDF file. +document_properties_date_string={{date}}, {{time}} +document_properties_creator=Creator: +document_properties_producer=PDF Producer: +document_properties_version=PDF Version: +document_properties_page_count=Page Count: +document_properties_close=Close + +# Tooltips and alt text for side panel toolbar buttons +# (the _label strings are alt text for the buttons, the .title strings are +# tooltips) +toggle_sidebar.title=Toggle Sidebar +toggle_sidebar_label=Toggle Sidebar +outline.title=Show Document Outline +outline_label=Document Outline +attachments.title=Show Attachments +attachments_label=Attachments +thumbs.title=Show Thumbnails +thumbs_label=Thumbnails +findbar.title=Find in Document +findbar_label=Find + +# Thumbnails panel item (tooltip and alt text for images) +# LOCALIZATION NOTE (thumb_page_title): "{{page}}" will be replaced by the page +# number. +thumb_page_title=Page {{page}} +# LOCALIZATION NOTE (thumb_page_canvas): "{{page}}" will be replaced by the page +# number. +thumb_page_canvas=Thumbnail of Page {{page}} + +# Find panel button title and messages +find_label=Find: +find_previous.title=Find the previous occurrence of the phrase +find_previous_label=Previous +find_next.title=Find the next occurrence of the phrase +find_next_label=Next +find_highlight=Highlight all +find_match_case_label=Match case +find_reached_top=Reached top of document, continued from bottom +find_reached_bottom=Reached end of document, continued from top +find_not_found=Phrase not found + +# Error panel labels +error_more_info=More Information +error_less_info=Less Information +error_close=Close +# LOCALIZATION NOTE (error_version_info): "{{version}}" and "{{build}}" will be +# replaced by the PDF.JS version and build ID. +error_version_info=PDF.js v{{version}} (build: {{build}}) +# LOCALIZATION NOTE (error_message): "{{message}}" will be replaced by an +# english string describing the error. +error_message=Message: {{message}} +# LOCALIZATION NOTE (error_stack): "{{stack}}" will be replaced with a stack +# trace. +error_stack=Stack: {{stack}} +# LOCALIZATION NOTE (error_file): "{{file}}" will be replaced with a filename +error_file=File: {{file}} +# LOCALIZATION NOTE (error_line): "{{line}}" will be replaced with a line number +error_line=Line: {{line}} +rendering_error=An error occurred while rendering the page. + +# Predefined zoom values +page_scale_width=Page Width +page_scale_fit=Page Fit +page_scale_auto=Automatic Zoom +page_scale_actual=Actual Size +# LOCALIZATION NOTE (page_scale_percent): "{{scale}}" will be replaced by a +# numerical scale value. +page_scale_percent={{scale}}% + +# Loading indicator messages +loading_error_indicator=Error +loading_error=An error occurred while loading the PDF. +invalid_file_error=Invalid or corrupted PDF file. +missing_file_error=Missing PDF file. +unexpected_response_error=Unexpected server response. + +# LOCALIZATION NOTE (text_annotation_type.alt): This is used as a tooltip. +# "{{type}}" will be replaced with an annotation type from a list defined in +# the PDF spec (32000-1:2008 Table 169 – Annotation types). +# Some common types are e.g.: "Check", "Text", "Comment", "Note" +text_annotation_type.alt=[{{type}} Annotation] +password_label=Enter the password to open this PDF file. +password_invalid=Invalid password. Please try again. +password_ok=OK +password_cancel=Cancel + +printing_not_supported=Warning: Printing is not fully supported by this browser. +printing_not_ready=Warning: The PDF is not fully loaded for printing. +web_fonts_disabled=Web fonts are disabled: unable to use embedded PDF fonts. +document_colors_not_allowed=PDF documents are not allowed to use their own colors: 'Allow pages to choose their own colors' is deactivated in the browser. diff --git a/browser/extensions/mortar/host/pdf/chrome/style/images/annotation-check.svg b/browser/extensions/mortar/host/pdf/chrome/style/images/annotation-check.svg new file mode 100644 index 000000000000..71cd16df576f --- /dev/null +++ b/browser/extensions/mortar/host/pdf/chrome/style/images/annotation-check.svg @@ -0,0 +1,11 @@ + + + + diff --git a/browser/extensions/mortar/host/pdf/chrome/style/images/annotation-comment.svg b/browser/extensions/mortar/host/pdf/chrome/style/images/annotation-comment.svg new file mode 100644 index 000000000000..86f1f17249f0 --- /dev/null +++ b/browser/extensions/mortar/host/pdf/chrome/style/images/annotation-comment.svg @@ -0,0 +1,16 @@ + + + + + diff --git a/browser/extensions/mortar/host/pdf/chrome/style/images/annotation-help.svg b/browser/extensions/mortar/host/pdf/chrome/style/images/annotation-help.svg new file mode 100644 index 000000000000..00938fefe048 --- /dev/null +++ b/browser/extensions/mortar/host/pdf/chrome/style/images/annotation-help.svg @@ -0,0 +1,26 @@ + + + + + + + + + + diff --git a/browser/extensions/mortar/host/pdf/chrome/style/images/annotation-insert.svg b/browser/extensions/mortar/host/pdf/chrome/style/images/annotation-insert.svg new file mode 100644 index 000000000000..519ef6826e56 --- /dev/null +++ b/browser/extensions/mortar/host/pdf/chrome/style/images/annotation-insert.svg @@ -0,0 +1,10 @@ + + + + diff --git a/browser/extensions/mortar/host/pdf/chrome/style/images/annotation-key.svg b/browser/extensions/mortar/host/pdf/chrome/style/images/annotation-key.svg new file mode 100644 index 000000000000..8d09d5378d5b --- /dev/null +++ b/browser/extensions/mortar/host/pdf/chrome/style/images/annotation-key.svg @@ -0,0 +1,11 @@ + + + + diff --git a/browser/extensions/mortar/host/pdf/chrome/style/images/annotation-newparagraph.svg b/browser/extensions/mortar/host/pdf/chrome/style/images/annotation-newparagraph.svg new file mode 100644 index 000000000000..38d2497da911 --- /dev/null +++ b/browser/extensions/mortar/host/pdf/chrome/style/images/annotation-newparagraph.svg @@ -0,0 +1,11 @@ + + + + diff --git a/browser/extensions/mortar/host/pdf/chrome/style/images/annotation-noicon.svg b/browser/extensions/mortar/host/pdf/chrome/style/images/annotation-noicon.svg new file mode 100644 index 000000000000..c07d1080832b --- /dev/null +++ b/browser/extensions/mortar/host/pdf/chrome/style/images/annotation-noicon.svg @@ -0,0 +1,7 @@ + + + diff --git a/browser/extensions/mortar/host/pdf/chrome/style/images/annotation-note.svg b/browser/extensions/mortar/host/pdf/chrome/style/images/annotation-note.svg new file mode 100644 index 000000000000..70173651c7e2 --- /dev/null +++ b/browser/extensions/mortar/host/pdf/chrome/style/images/annotation-note.svg @@ -0,0 +1,42 @@ + + + + + + + + diff --git a/browser/extensions/mortar/host/pdf/chrome/style/images/annotation-paragraph.svg b/browser/extensions/mortar/host/pdf/chrome/style/images/annotation-paragraph.svg new file mode 100644 index 000000000000..6ae5212b75d6 --- /dev/null +++ b/browser/extensions/mortar/host/pdf/chrome/style/images/annotation-paragraph.svg @@ -0,0 +1,16 @@ + + + + + diff --git a/browser/extensions/mortar/host/pdf/chrome/style/images/findbarButton-next-rtl.png b/browser/extensions/mortar/host/pdf/chrome/style/images/findbarButton-next-rtl.png new file mode 100644 index 0000000000000000000000000000000000000000..bef02743fc108697e14e0e5daab8181f7ef91dd8 GIT binary patch literal 199 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!60wlNoGJgf6`aE46Ln;`jUU1|(WFXM`uzZfwf<{~}+$G0pUl&6i=kdI{(<22WQ%mvv4FO#q)8O6mXr literal 0 HcmV?d00001 diff --git a/browser/extensions/mortar/host/pdf/chrome/style/images/findbarButton-next-rtl@2x.png b/browser/extensions/mortar/host/pdf/chrome/style/images/findbarButton-next-rtl@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..1da6dc949cd6451c2d8ea39e1618d0323d2e1ec1 GIT binary patch literal 304 zcmV-00nh%4P)kdg0002@NklJ%mRW)o*bZ%{dl2K@N_?~eFJnrG5D`)>eWA=I9=*xrZ>GuI z4!;9U26Pv$_Z4XH%%iCpph2GpV-c{*6Zhs6SfR_EJq5;V+?sh4&K}p+ z6sU+@u52lw#15CH6i}kr=3>#xgHlS7GA$J0E366+j!0VQ&&@3-ef{(7H#?13Ev59AjB0000QONN1jjx$vyv5uZYI@G&FX~xujj12+YK~w v*fr|J-NDGo&9wKH*qTY?mdrSMOX2+jbf@g_m202_00000NkvXXu0mjfGEh>( literal 0 HcmV?d00001 diff --git a/browser/extensions/mortar/host/pdf/chrome/style/images/findbarButton-next@2x.png b/browser/extensions/mortar/host/pdf/chrome/style/images/findbarButton-next@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..0250307c0d10b0c0a38a8381361ec265ef3080c8 GIT binary patch literal 296 zcmV+@0oVSCP)kdg0002*NklD^w4Rl6cnRtQcFE3nm0&QVWiRnO%{h3-*x?K4w z&|kYa uWt-+4V4d~Up94HjH;lQ?oa>Bv?A`$+U7<=?MIved0000QONN1jjx$vyv5uZYI@G&FX~xujj12+YK~w v*fr|J-NDGo&9wKH*qTY?mdrSMOX2+jbf@g_m202_00000NkvXXu0mjfGEh>( literal 0 HcmV?d00001 diff --git a/browser/extensions/mortar/host/pdf/chrome/style/images/findbarButton-previous-rtl@2x.png b/browser/extensions/mortar/host/pdf/chrome/style/images/findbarButton-previous-rtl@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..0250307c0d10b0c0a38a8381361ec265ef3080c8 GIT binary patch literal 296 zcmV+@0oVSCP)kdg0002*NklD^w4Rl6cnRtQcFE3nm0&QVWiRnO%{h3-*x?K4w z&|kYa uWt-+4V4d~Up94HjH;lQ?oa>Bv?A`$+U7<=?MIved0000fwf<{~}+$G0pUl&6i=kdI{(<22WQ%mvv4FO#q)8O6mXr literal 0 HcmV?d00001 diff --git a/browser/extensions/mortar/host/pdf/chrome/style/images/findbarButton-previous@2x.png b/browser/extensions/mortar/host/pdf/chrome/style/images/findbarButton-previous@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..1da6dc949cd6451c2d8ea39e1618d0323d2e1ec1 GIT binary patch literal 304 zcmV-00nh%4P)kdg0002@NklJ%mRW)o*bZ%{dl2K@N_?~eFJnrG5D`)>eWA=I9=*xrZ>GuI z4!;9U26Pv$_Z4XH%%iCpph2GpV-c{*6Zhs6SfR_EJq5;V+?sh4&K}p+ z6sU+@u52lw#15CH6i}kr=3>#xgHlS7GA$J0E366+j!0VQ&&@3-ef{(7H#?13Ev59AjB0000G{p)>hLyxD99 z76ej)=-vic0UL9~!GgO~9_MsOnufoUx`QHG)5E@a!o?nT8@#*2`fMlI9X~2&%Qwtd fAElzRww7{H`T9z)QIL|gUwP@h-(DMO`2YPI1=f8x literal 0 HcmV?d00001 diff --git a/browser/extensions/mortar/host/pdf/chrome/style/images/grabbing.cur b/browser/extensions/mortar/host/pdf/chrome/style/images/grabbing.cur new file mode 100644 index 0000000000000000000000000000000000000000..e0dfd04e4d3fcbaa6588c8cbb9e9065609bcb862 GIT binary patch literal 326 zcmZQzU}9ioP*7lC;0HnjMg|5k1_lNVAO;FCH~=vt5Q0Dhn8YOh|NoCEh)sn30RsaF z^8>N`2L=Xv5dHz=L$Uk|1_tQ_266z<4TQl5{{R0$_yG_fVE_NW0fd=>Y#@FBr9t9P K<`XsxO$7j30D*Y` literal 0 HcmV?d00001 diff --git a/browser/extensions/mortar/host/pdf/chrome/style/images/loading-icon.gif b/browser/extensions/mortar/host/pdf/chrome/style/images/loading-icon.gif new file mode 100644 index 0000000000000000000000000000000000000000..1c72ebb554be018511ae972c3f2361dff02dce02 GIT binary patch literal 2545 zcma*pX;2es8VB%~zPr=ibVMCx-JQ^BhLDAsK)^**h(ZDp9YGuzZ%~j!}+w%FI;|aC7){7CdVvG)P{bng1y9Te*f}~*`1kQl$jwb z$tlW~rRS!X?#xfm_&6tTdp_`cjgYwbRFLNdoJCN$S-yhg`ZnC-yvedRSmOh%;Y`Gl6bY$Z-}#C=#F4%9!I1b zWQ~f+9P?;vhCxWwlwl=lrWG|7IYo;{jjmzJ5R9?f>n%-d@>kLINUc z4wM5dAO;kq<$}Dk{2-u0$I6@2N}&cUx9nmV1dYc8jfC}%=F9WCg^OQK9C6poh#2!A z3^EU*UFZvS^)?bu3T?J;@Ahb~%I?+@4!l5!*TjC}GIslNan-RCrrd~PdHYnNLJk+m&`$Y+NV(e>CCu%R#_8GqY4cv#j`#uRWdsg9DxWy(?oOvgCU}&@jy%c!H&-Q zqXJxajAtmQRoRa9V-RFXXh-bK*;Fum{BjpkYQGX~i@OZ^Dx0n&H}kvGKqQ?w(6iGXu_g08T|_hp#ZvFzIwKF*a=oMJ~3UGAjZ?g}GOxm44td zXoyYrU*I=y*vHv89hkYH(v5R#wc)BC3dZJKb3K)f>zaM3%JP(mpecViP0eKKYf3zy z->jx_mc?mCtPEvCQ?uppk?eLJt}_IR7giW%Jr)RyI!+E-voIs*lXI*z`GQc_&D#X( z{6G};HPYj6O|$lXxBJeDaweqa{4L=tOZCjTI^&UOxXg})LRG_cr^B9Rqt(i5ORbQX zq`_xCRsH>xEYY%&*Nyi#{S_JZNlTm#K56`RI%7^amom;*h90Si&g1CfaFV3D|a!`3Y-GKKbL*KSbl z>I96`TR@CqPJl(>QqB~RvK~-U)`e`l4LIqj+IU^~yyIe*|BRVB>4Bup%j{tLdKz4j zY^<8P8m~GRGz*yv0&-RJE+-keJ+%m3wNeopzsltWd->eWmBVwUr)pX` zK~CD<;~Z*Uy3W`3+MrEYxm5qYQ!z%YI;y7DTG`UVH0;@{M{!B&id_}3DBQ?zsotuR zEGLdRx25nLm%-wjlnEi;-aN_1S7???rO~WgA67jjr&(vRa3y$u#kqJbeKnw z{!T!1li9>M+sJ6AUe+*9d}2uGjhzd z|L1Rtp8uTGYyZoQ*`DS^m2dw-X{a)l+3m?ncvn^+O>)hdd3(hMtlhkRGns{<8c0I! zDDjpmwtj?@!6kA|iu3q+Ai;@JR+ zfk+ln&YFC{4bhK6IxVgLs4W%^8Lk`qzWU*L>yq0A3;l}{!wKZ!ue)C)SKI)9dl1hl zhIRLV@8E}rwvE{gX(}$f6x*k)_`*Ijt1=EU-Ls6-(phomeQBgtUs z5Xz~Cd*nE)Ac!0i4ep}Z1AugMB(&F?)#CU{Qc{Sp^vKsdL}vRB30H+Bbzrn`M##H3 z{W8dc_mDroEE+p8_}mnJtzZ4!RNe)zhB)Ds;S57nYSJxtek>^~&(7B+N5MPf2+2xx z5Dl&4X|c@f{Kd|z1r+N|$DmsoVp*3yOdxT^J^-VAk)Z@$4^XrPrFP-Co+MXZ+KJ(W z{JNYvraLLWA;&tRhIKOvhW|HC|L-dLvAUF(MG0(Nl?4tB{RzN7I(}Cb%hwN{crFC8 zji#aJElKvDFV+&VI1V?oUMA>*kto0^;3W8FQBSZ|{ z$v~TqE=(8DZa^i$^oht&h};P1N&wMXorKh*Z68gPV&ouy>%f36Oqkwemyeas$Qbz# zV?7Jy%o7KY6^I=P@eCji%W`o5sf(5hySYo9$l4e2`(hIV_?=H-#R6}0$WVA|*(K@3 z=5?@RlcLh(meW%A4)hGzcvEpm(_w?>zhL*i&s9$2>r zAtk{8Cia|+Y+V!uX9BtpXoF%lswuRKsM!pSs!?yhlCy!269K0|b M?FSZn2B>%I-}ej|s{jB1 literal 0 HcmV?d00001 diff --git a/browser/extensions/mortar/host/pdf/chrome/style/images/loading-small.png b/browser/extensions/mortar/host/pdf/chrome/style/images/loading-small.png new file mode 100644 index 0000000000000000000000000000000000000000..8831a80588dcaffe9a0e075f3d00066faed3d482 GIT binary patch literal 7402 zcmZwMbyO7p_b~9KyAf7cLM2wDyGua21f;vWC02Ur4v~_Q2I-P+krbqBrI7|4h>zR>${lPZ$UtTNf7kw8`rjA+ocwRIMB4=bc-mi00syG23Nlh!K8sLIl}J)E zAZ;uz<`X(Vji`R!AG2ce8ZE_9cxX=3{9mdB{At%!Q z+^Sg?1aw$Lx_%*As-20SI@^sD$^CCF6HP<;v|F9azh>!1dAM|;KbY(sN~`1xnz zsa)GuC`%)InB&YdAm8#0PhvR<4VSDc`AWgx-nG2Cc1VdIFc07*+IDYM>LnkIEbz&q zQ>fKVRrL3#zMCHfGO0z373@T9aJ>jXQ=7>so05d8BNhFBT`0)&f9NWms6t2TdSPuT zrG@+i>K|cJwq#P|Mg_9E>gYrZ6pZUq31vDmm9<6KEQ|7v6=J$$zpNR3>?s&pQ`MtQ z+sWPKKWnNJ1@DSsohH7N;wLvKePT&up2uI~Y>TJhJp^~dqOe$x7;2YzKs?yo$DTBE z4Tg)}5uB`U(2-z1MknhwpuZb>D;`?iR{LQ?5L2hsCHTzmnhD*Z$*I~*Y#g*h_6VQ~ zpzenIb{sko?}-m{(Oxg@$ADF73OVg>PtUUSwj z;Lg5@U5Ht5yzH5so!jyhe)ssNn>2fR)-s~?HeZXSBgmObJs1cpr0P^=A`_cmGUy!~ zv95pIw+g05U5-pxzY+j1)Uh%q$&YHVQ)c6$qc)#k-%ZOixNGlPxaOwGFGuijWi$NbD*pV8N4+XDMhBq0m z_zWKO?YvB%5&|zJX0I zzK2B=h|`J&5HjBv=WV&)6p z8ZSM-5dG}JucH}uz!}5Gpx`Iln(Zn_K9JSA)2iLI7C7uAhZO5wrQ=V7jV{fpcK(7D zz=eO{*0y5&Gsj5gsPmM(gBIYRtc5)ihrn`>CsY zzsTb?R!7VzC85+2wAT$3<>mWd)~W#J0+AlwgtOqG*1=cgiCx2Hj+TTsNLL5SoyhmY z==~O_+hKO?PpXa6D@_K{{9)rG@3t73NnWS$aGA*liaoAql8Bb?w!E8$8w~Uzp6{E? zcIAHToaaz`ho}fAN0=yp)=|kKj&xbl*fU3C8B-Mel!vYw6ozIfG(>e+DL7&mrx;dm zXzu09XY4m`FTFoV@JFAHe_n5=e4sQme|b%Co1ED^$$nGtmoAKd>ncsbPe( zlX+KKQe@^D3bKN29`pDU-e>w$%w)o1tJX!o3rO)&(S+Kzwzl13_rB}qQ3M>!@m^A_ z5k(gm-oDu?>?ToHVyb5f_J5J~t<{hnzBzPxIqlaW4sDw;uf0+wA22&nFx^(0=tekq zO%rvjjtpD6y9Jm9F9Mm-QGE0GDa_KoS2kQv@XC6+WlsoF2FngR1xD#8dCAy9n1G#wshXv&`FP28AuTl~h8 z4(MY^>sT=`Ij+FPw|B~pP5N|8*%gu3gb-5x=B6Wc)ZXpEL8G4%v$njG{{C1uIo91+ znd`kTjR4IWd=^$;@SxJ(tjRGAE5O$_v9t*`#>tm{x4ZUWPe~Pz!t9;46k@i@tH$yN)B(Thdm2-L8;%SoLm|)5~ak?>I`CLM` z2L6~$cTrjiM*JF*gPYV&h74u7o2JgAsr0J-ms>s7+$V0*2@|GWfU1)Zc`3hSgZ{#X z^>1vl7;DIchsysSHf$uemqiA{muQbdsP}k}Nnf8CVh8Lwo+CI0_ADbld(% zLh$8QIOxb^+G~Zkzy%c^85ophEiZ_|P;)Xg2boNWsFhWjHiqqg(50t{(U|IsFOQbb zhF;o(0q<&%%?k8EIDNz@+w;s#UOacgKTofIp&?z7u~xH;Q&!`B&86Y{EgOm$XoNW0 zIHH5n2LRMPb#^pVEt%dAq0g4_$w*|_`*E3m$c+45tL$!=&Q?RrY$TkdLnx< z7%kstR~k;gcE65J>uk}U(ef`3gx9&c+jrq4#a*XE@&12TVi~ zwfK+d8GEBRxxxx;&_{0O^DX!5xamE^La~N9Y}TOLpho>Fr4-!Xeqw&txrl(S=<2tX zaZpGP89pY5dP2_=i)VKFNMbwM+6Y_(9t5jCl>Y|ODN+Dl4L3$M52%m&CRwM@$m;Gw zc?*GCmfRWX$X9E|mU;)EHZ8xRt{-h#zp#y!fS1e5Pjo-^LD$vtAihlNTmBx^`7NRu zHV#~Q5?6r(9#0Zj8xmF8@s(DlXLz@WIZBe$lI4mM^QBuPN5OI;-s+0~%{%ww#9<@4 zJHf8w?BfZcH8@S5omp%g{)tc!weU0<&=5X+)J z4D(XP4A{DU&gNpaXf-^_8M8K^r<-|0P1=O-Ba$=zvICIJ;MBX_TmY7+VaIQDtFGB0 zjOZikK1NH&;$BP5xD(47yTOo}hu&jdVHh4Xe?NwI!F)eH9dFQQqr|Atsd%kr8Ul{i zCI4 z7uYNPh`M{AMM{`g2J|L1TF5Zf5ZFo3g7CS@h z$7ij?tQlD1XF2{|9;&M2IOo+Q(t{ufA*Y1(WDNJc1mz4c2y2w@AhcWAPM8JcGE207FI~q+_i4<3q zW)zDk13TnBU|(4h_wo!eGrwpk+34%j-jUB54t1SS! zm0SCYvjEXOJHuk|&PL)6QIP&C6&_YV7iI zHUc7^>mL8z#${emwXphwPxp{8>!>iO*S;NUE@_*Dje}1*)hmVGa6fP)165wI6ph^PGPQ>=Al9y31C;O<9kE|29%;-N*rf8#YM0GfgbogyG)0TyB?H z%^aSebV|jGD@mOag-MWLw6nypvgIxWu;^NYYdOqFHtOI>T2yP6p~IeZgn*JDP+*;~ zQ)iT%K=i(bm6B`y5PC}cZteOa9Gh6n;SZYwwu|CGaS0>7+SQ} zvC4i&@u)1oyNQGUS4j!hRN$m7FX1pXW3i1lPUN zkc+`^zyu#NbjTY+uJF6k8ED$g;`habtT26i1E4tFlP5tZ%_4wF>9; zignAfS=`?EZ34m^cjh9{q=Dbm^bru|l9aYt22 zxf;(_J?9;t_=J&&Gck~eAJKPwbAA1W%TcxDHAxO-4_Dz_&-FaxJ?doRhjCYxp5?zx z5&hegYg&c>G8;?d(v=_6%=tRA}M%uWM8KQSXZx6E_U%7nJibuLwqe4pRc2x24cqaqn-r>&40y zIuH}mCsveyNeTwqJ32*A^rww%nHT$}_DfdJ`Qy3-baMw$y9bs`>%EGz%N%y(za{l( zg?*XW@z(*9uOp`r!PBuJJun1BobDA{%iI-*ObrX+C}-@O_WDq^ha{Us?+B8blx%DPX# zpOQ_=hb7JV=!#x*cbmSp)@7be@ay=9^009*5cjwZ_1;78J)J{lcZYmRYC6ex=@gU6)k>yo7x+HUQ(l@2Td}z- zcE%L=P~KImo0<@Z@r?*4^>6^33n^T^j_BG}*p25V6pQKzj$~mbV2j(YF$3nLIvoZT zGqh}rQ@F~4y$P0_K*%pTT9&(cQQCxV5f1J-e4_aeF>bebBHkIZeD6T*f64kYaQ(*^ ztgPdOJW>|hf3isbRKtlFQa5r+p6Fou6Ig@e?~OVsnooI>Nev^;SVsL$JoAhZgTG*! zQN&ZU{e(yPeVX6PvKoh!pWczNd}Zh{Ju$76J_st?=<)KryYwAV#vh&!C4#KBPxv3- zB02?{0^_)>1x|@;L?6|2V~?Xgt;xH6iz94e>IhsHfs z9L6wlK3Bis$V-fESgZG8Vy7*8*s|agRHWL(>t7OM%qEAdK>EcxOR7N1Ec>Zl3P;vU4~3MAee&DR$*J5}wum za4~N|(CRy{hl{XUB4mXw9-JqOZN^m2DaX}dwApLx+ z;e9{xU>q5PO?Lqgt;h*6b^xm2OMO`X51P|R4eZs!_JxHYf8d>vYOSnj`p8Oe*D0W+ zgV#aPL$$8};U8deooLt4MM& zggqJt!V+(ymrX*tfAP$&{?U`)%^E|Yxdr>N*7v#8EtRt&o zCr0RJ5b>@@P@wJIU{&vLwe9$X!1g&W1SO~eS(BIrJy3uEzRl0p^{wHscYN=qO=o-mfY9{@CmJ?Cq+HROx%$vRz zF;_^Ak5v5zOJ%UT8aShK;HAoHknGS{s{_()y=`0R(JcFoi5kOm+3)S@LyTMsqm1?# zQemT>h3%T8C7t={2M2To5{XpEtPBnm4DZARUM)K}OIX+I-3%(FlfTWhm zSLB;Dwq2t1G}>H?JWy`8jtl=h()**;ZzIosfJf{iUAtLULxpwa-^3pMn^@V;=%v4i zQ3#G$m`b8OJUrOEGQUNsl_1THLZJh&M53(^NoM11l>~F9R^2~51M()y~Hw00OXyw)RY( zQJZ&gfeJ`X_-78MZ%A%SOADPmkrsz;FJa`;{r$rdTI`^%AtvPNqzA|HJoh1RT?z-U zIO9>Ih$QB6t4B#?Ma2Z#*GqJBamy^J_gXqSi=k7fa=c9q4gKk9X#;gNHM%H;VA>Cn zXLRBaTYOvw;(!xa28sOiQnO2F@UJRTGP0MNnwrvyg&MfYy#b|YXbrIQh>6EHH#hdC zSwX{(`!VfRp^KFOO}zeOV8C*dQx?YLW%ksRW}-@^d`47bLBUfXIK9bwjOrz%mSJFE zU<*x&fs)-&9(@Z#*F5x_0%^4Url<=+0*kT`Cjc;9oVk|x!u8MpLu8(^x}L9HtUceF hxmy7g&0L*r=-s)vgqU~h&5*YN3bLv)pQTMh{vVrSZ<+uA literal 0 HcmV?d00001 diff --git a/browser/extensions/mortar/host/pdf/chrome/style/images/loading-small@2x.png b/browser/extensions/mortar/host/pdf/chrome/style/images/loading-small@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..b25b4452aa1a52181c324020c39175e0f8f425a2 GIT binary patch literal 16131 zcmZvj1x#FBzx4+g+})*ki#rr|cP}obK!M^egG+HJ?ouf3P~6>$YjJmX_|ALpbCV}u z-boH;7)Zzf`?uFx|Fy$al%!FSh>$=a5UQ+B-1+J9c604~b^Jo%r8Im|u?w4Bpr0Rn-qWFLT zGf=C4K^8ZYl?l}Uj`xx58NoNC z=ML51f*aF#HW0hfj%h9(4+AOKlWk@V+6TuMN|_FE@)Z;EEQF-APubku9G!v}o0_Uy zT~~Mgey+kLX1 zOeporcOTDj%X~SYVj#rF=K;001{v9qxfe8X#oz^VvwfDn`3n#2k4?W6a|W$qivuTM z9ID#cmQf3e0);$LhFo);!=l~|4-d=h>gq;!b#>kP`};>nMxwN^GGI{JY^KMz)zs9? z*)@`jw)9+G`H`_!ghuHr+Wg6sofhQebS4tN$0P!)J|H&HOHl>=ogwnnL*kY%^lWKp zXeheQkur_gJUKYvlVVE%L*z>)PDc?7jmg~?MTuk`ix zapB10iTpxX@Xv2)X|Xaf*0~sHmtY%|DhiRPZqplw^&|229zO z>5DMK2e#Z+LUeI5*f3Kr)Cc*E zXUGu1#Ey=RSkesDV0*qt07J0A`d4QzSD8}=e@-DGioHxAA* zR7s&vAfq-fB|j=!T8?Rr-sziD_8?v=)NCf-9-d(2{Uz_vJ*&QWe0=QiSRRv9 za!GV4+D^T8J7(7-z7Dw{q+y{9?NJqXA|Ete1Xiw>G0CvW=XS z)E1+yn!t!Ri1j@=A)$kOo&jDh;un`%GWwsrtu!<=vyZckh@fIlF5Y&7Xt85u;@F^g^4duK z#=@HV3O4}pF%rs~!vJ9Te~^R%o>KtV{|8BtX@(jQ2o}x4TvP-2Dzy7j;s1fM^OyO% zupkB0rz)FR8gEl0jayi)v12U}P8CcfCMH%^$pr#9u94nRrjHodSXg0{3yfDM37c>i zpYyQ#B*aQEg(=RMxM8HInUcNEF5VKI#x|x9ud}x2ogOouS~K=Cvi9b1zM4g*b}63Y zx_e5)!bD?r`nKt7&azOv#r?9;&|GACc?MQ~V2U#5wtmviH0$NNCbX3n?WZRv zg39b=&*%a?fg&&a`1~I~5)HwPy-T5r#SKKV*Eo9?I{)a7tq=8$Ly|A_mGx(>w3M$W z?AD#Xo2lt0rM4HA4xa@Ug`SW18H{hon|hd~>Msg%jrS31ih}n3UVWg`f$csSID!^1 zv)S5O_g(48$Ox{3gTq`%2%NN;Sw6NIvbOw=Xv)Kagi~gw!Jen5=QtfT_4e4BtzlZ8Om z@cytm^25V62?+^b90m=EiHJPe*w`?o?pDYyJ=<7ha$}zwFC0SqOg)mm40QWQ+M+`k z?TK_?O%W+{>$+^ozTaaIBZs12;BZl_M(u~!zODRLH&Rzu@4e%iOVU+SQ)_B%J;Xt$ zEW#;BJy%5(fWC=*e={SVJ8WJRNA;%-7xJ*3$(NGyKZ5>!LIC^3;mk|AFIoJOcrm zv90Zi$<%DN?=V8ev+b-sx&1c=k{t3z!qp%gaCPYqn5o=!)<+f*?Z{$IIjo>=@h!70 zwAw{|nI|qTt{*K{VR5;~Z_7@Kex9C>;Dh)m2mQW0TiK+QZ6|p)Yb&ewp9~CKCMG8M z1<91-Tz#7LD+XRi#&_j1R&V#r+@if^{E_I05k}doDjL2 zc;e-ovfDJKe+tv?`lkvyz3CCy#o61567EC9?SCBm`$M%bTc*do!77cZ${_vbU}wLq zpHg7QEC)|>6u+}mWR{0Jl>PekD^x(v4-Mcg;$C^$O|es0h^mZOd;b2Vqe`9Ox~Ryl z0Jk($P*BjCn3yQ=k#}>X*EYBFnG`|e(9oK(K)l(!M+OAn^yT-mJFP*IMHOAQgDL*Ts zfTtQ#`+YcAp7k&zPrkqJI!{*C1%JfZOhI3}?II-RPkX*@Gna|2(O>kp34uxvFB{mk z{)A^orE$KAH;-}YiK{vDy5f>YoO>K^s5G8N*3*5cs?4+G&kxj(9h$fM68J7^V)NuhzL8~PGQ%$tc$gVDn^xPeZ1#xU#Eh2(W&R+#qb zn|c4Mh18Lf5`EZY6nOhPyMFZQyUwTept9kYkJ3d*U<{D(`v_0imf9Tp;g}E@0&?;* zO-&C4Hx%-K0T(ERX;P7wwo_9>$n;2YrRnh}dYq5eypXA>sieL>N#XHF0|ce@noN-w zxTwPEg9IGVxF>D;Se6NtHyU#QgRzN^kDvsRp5Pf>XK6gOhYFAX)1<-jpFe+sZ&h7! z1~4TcyD?Ew9+w=r%^c7%<`X=XZdq7@VrP!iy*pzu@R{UAN9S5HHH4Nn-T z0rR5h#eG$L1SqIEFKE2n!otF%qgn9WA;BNDw6uiOa6h#<+FDs1;54V1z$CIB;#Ngm z@XoG_`hb?{L99V1w=^Xv`0>53piJrkOqh+>Pl<=-(SOgr@$Mih)f}bT)k5uffH&VmS(+;w5wOl zQL&oZg$)#iCt>P&g$rXS@x;C%I#uwtvpY4rOvMH*EKg2OlA(oW+VH^XQiOI=5mcJm zXq6x=)YX*Z4YJ9sDE&n-l&6@r~w}0)I@sBC{ejj#rcF_Aa z9UjB`Yf_K9XJ%&73&y->@N1UQTm$hTiogOf@3D&AO&EojJDpyHdAuozmrY)^Tbmf4 zwX~v)GH2hRR9val=JeUE9q%QwiJcWmH~&x*8}gTpJm@{s&&*Ho${(3-@rWVR5omv_ zL+HiGJI;I>u@KRP>B|u9h#0s*Q!?Ar_~4kH4a+SfPBQtp*Tw>)9_74j6VAsL7>}+f z%Q4A}j#SRPKg9{0SG<)QsICyLZJ$@6W6pK&FVP_=IR@t(OzE0#vL)LVaFXy4jc3-y z%f@V1@PQXT`3d*>4&BIl>A^uV!-o$g^a!T%4DjY0sLRhCpdoo7r>ScCJawM;mtVJY z`b-y<_kv^MlRAPlu-M<0Q@`HI43wM86UE7F=NRfGO0YbP%1TjDQDy$p7;b59KD>PJ z&Rn`WxNy&!a}5<#VLpYWIXt~F@w#E4)jQF>Lq&7l^y*R+8q{vLvD~q<;wTPMNf+`A zTX?`%@?uL)PDZ!9vTUT5wWULy+N>)NuGt_vCn+vOGw%UZgGue8%*?f$N?G=!rNZl8 zs<51yLTxZWT_&8e9KDXm#l=O#2BHKZH;mC<1#(LL$yM5X*l+dnPC*$Pwl+34(`p=V z>a%LBW1?sm)-PC`k&i_zYp!5XhJ(AO7X!xZ^g7bXvw(4%#y2LvWXA7JC-KRg3X+L} zKYsjpDk&{}|6cco9QzU6K#O2^n%^(SZ9X!-V*d-?3-NW++0CsZQD)_`*EAq>3HG?G z%s}Hk4fl{^Qh@85-o_g~0iz!@;<FH8JY9)<1RCg-MuYFBaiXw05CJ4d$E4{X-Bn)SlY+s|!gX1CboT zgzeq;k5PJ3a;j!1m&`0w;HjVXP7`gf~UN(gXvj8ZSCq}NGC!Dgq#(yzQ=N&!f z=U}(Ok*!&^;!3*(W>B9%o#VMDv)x+6zdm*OBxQX2_AR+bhS;4@AZ{Ph*0sO{weHjP zz_G4Ai5&e&w++4({H)*0tiE=X6N-G_Ib#SOr~2?Nj0BV$2`iERM~dLeVXqRjxLwR2 z3=+Oafqp!HR@0nCCPcObWK(b)zJCm{5bSLVIAeB^6v|x)ju|r11*xz~hJ%Aw)|Cw` z0W6n=lt*U@X0Yes!paItJSYN0d4q;;AEJfcKFQ@{4~T;;z`B$;uelMr8)~}HWuaf~ zuDZ6g!F3oxK;+$r(wh&z^2^K1ea+0aM*I687stoPX|2WIq!ZoKej3a;zZ^wJqp>WC zEE_x%qGtJQn9x6SFmQ!Q^u zH+PeDMyiQO&#&Nsc1ewjyjQAwsO>b^6`0l#r?P_C;t60+qF`V+3S*S7uVI`wZR#z; zb-;8rY&6NhL4gxoU0p5b>G?Yva88##{)QvA#y0CA0Po~|Pt5R%epP@B0 zHs)h*ZG9-v?Z<={6_v$*w^1ta5$oY-`+O_lmAkea+84O^Q=7JM;>6W{few z$i{)@l=jPz2pXpjUd};B*BrZ}Nop3+tjoz6oy3c^Q_Je?*V0n5KMzyGYREUbxU4{O z@yTq7yvk!5lxIgd)sbH*zw$@o81JR%bB7FxM79a_r4v=O+ENw+Q|p^t4Q9B+iaAI4 z6{SNr%sRz%Y6^NEAuo$kRTs!6AqHojrA=X0b4#R#kpl0#poCN3RWM~hsUcz1;svW| z4nDt$p`jsEIK|W_z8t=~?`bEiqBrpqL0dYila@p{WavD93?P5!udkhFnZ!MhI(EP} zgjZiIEYPO(YcTs8>>A38Ba*#oNu+@2!lh})9Ul)b?ZwwGv)ac~Aj?O}`5tbT@i+%! zG>u_+6=79TUH;_L-VB%nJivCxXNJVb7Cwmz8I+D4n)LR;W*B!z^YQaPk-Tu{1uy>y zw25WvYDhff6ab?^R%fc}>uze3MZ#WR zU-MD~XgRWDAdu|s{T>U0@FD%Q!u2;^=QTsB0n9mSdaxtCuy99nRaI3Q)_`{^E4eX) zygXBPp;R6pXR?hBW)(gOZEvr`$IJmO?RkOk-{r|lic;t~bJoDY zzrglHyeMT9Ox<(fPY@E3pFgd>QE=?#c%8rfE`VvO|E+7wi=T)m`GY7MG`c6_DJ$bzjqBok1r}*>Pd;kpE!7x_#30fW5|s zh~B1;?V4@tfI%&Q){BVP`pWZ-+p~>fOsljWnzgKz)Tdbl-F?}jR&$!f@@!K;1N?$^ zAL}#=O(5#mTV$~sXRXN;INlG2g@J+5+NI zDm^#bv~jsKEj|6~pN5s!J?^m!%o-j@UTe@T>-@uKOG;aQP}r~XlN)UR&JMSX;kvpy z0sQJEZ#=zAN#U8;fMD+cqK8PWGN)IXYh2CwN^dUqOW*|(OXyH1C#RAA0Xpk#5Vz_> z)fq<^LmqkmPM~P!kx{JK_)XmJ-@$i`c=9w4@h}uaP)JoOC6&34FRwX1_V!hByzRuY z%F2G0o}SI=M~^#tM@Qst&d!{Ki>fF_syjmV7$i`5qU=zU1XgHiS5}wrvaMqv)_f<# zM@OiDaixXdg)4$;;b2_`CSo*0v6nSU#@OCG!nM@j2kO za?-^4g?JbJ@n}$&Qw4?#QV5-)U|O-3QyD+U$2ob!?>%yOcqr%d^(*({?=Q1vG{nZg zSOo;UX>pMLM11MlFYrT$4HQO0MXev^Pm4?~WDMV%NaFwVg_r+Hy1b;MP7oiI1a1K= z4NJ$G@Z#Fq8d0A|!?R?8Ki09KYRr1eHiixqPbd5Q1LZZ%x%&+A&>Ws{j$@e)uc9Cb z_P&$o?-SB|k3XcNYXm|g5Xs33$z-LXGRwx4=oXO>Cfd4imx`olHO6)CCj66}Lmr7@ ztjt<$2QMgtMyv!Su^4#iGeTaw!u9H1P>e$g2{ zUDek1vfbYwLfV)D2bc~uo9reH0frhg8x>RvM|hgzG2RGn_CQW8nY(C*u{UV4u$nXz;xNde7XQxar*`hCjq@j+m!7z6s@bbS0bvK2+zZnfK{ezVL_)H z$60c!1393}IM6{=lpF6wboP)tCZ4c@rg_#zV696loiXl>g6)-Q^@ z$_Pi1(KQBd=ai1Q$V~@C=aej2p>>*eZ4zCy1G%q!ZB32bFMCQB>^S&^k^wW=NY+Ps z&XE2o5=Ph|s8GaT_T3%GbKVU{^Mc&gFtiw31xMObrj%G2j=L#auRL*n_|)&;ptkx; zpTPuWm;VAS;(rINh_z)R0NQu|fELLe3IMGFi6+iKWv+&zyDlP|#>ICr;tgb?{7C}j zuck$e!Iv2C5k}gV0#Z1;C=hI+`tC*9po}nW0=(nS!!ZzJ`=vD{=D7>vdRa_$_nV2u z(Fop!UFcK`C5`bwlg4CDExxfo*=~^mSk$tCL(Vkm{tcP)SOu_7go79LBvc2#36&EBmz$rFM?ea z$Uzbg!b8Iwa$i0wpN4%Oodt1+n@18x^_e@mNdqCne>WF!JFSnv@Fzn`1}#o%owf@8 zEH2E?&nK#~uac3H`Lns1CyR-8xBCP(CYxxML_T$G8H2>3-np*%T3HRzdPDZbkSkP^ zJW#LAAfjkQC?N^mzmh=57M<4C)*l4PV){;8QzePRX21Oek3*8o2IM{jqhDsjj|Xs{ z*ZE@7LLVv&Iubg=J>o@2M`ul)Dk~{zLBn}K5g@`CcS|{~39zyK3Dc7XhBIiC)o?3E zkaFZl0f%q)&`dIWmm2U|G6*Ne7u5d3k;LvG#VCnd1pSH5=7)Ssz2mv3~C(KYzCP zB+ulVqP^ipD}3`euP;yKxw-F3!-hC>zi$El>+|$9$ITY=#>ASqq^yn!nDq0v;s4OCb7Yk8Ex#24F&1NwsB_`&VR63K3Pe>ro$jtO{`SPV` z!lP&LbK~-nr89K|uG%U5Lk^gL%T!k6`p*MBl(Jf6tmYWr=x)E1Iw16A)8=((8e5+7 zhR)Di;j_t26uqID?r~btvrKU^w1ljz6QcTtK;F?JF~;IgB%ijh2+Z3dm7-u|*f|kF z_W?YrT01W?e>mKuE8S=OEOb4p4k zjW!v6bF#7;&z@O&qEHxy9}0`V#onV-8oiz1E-fQNefReg!B1&#bMUGwD%x`nTPJ*E zp+v+ns}5rBa)ZUvp7q#gSSPk8Y=t31^PpV%yBqphX%?k79mJipm+J?MoKY(5_`?Wl zZPOF46-8&pv;d-d9Q6MEdw6<843~xPu&Jr32S6-MWoZQ40m<$}=cF_WOngh+5)t_c z2I;gmSYmyFVl%SWs7ohkl-9-0_SdXBzIqbE@p*cB(z9=VM7kqc|H4}7c*CD|+Gb53 zt(2agJ~ul%`*Ut?&f4~=PKR;AGGCln0~_Jas4B$7)#NnO@{LVM$dJlAY)XKO%jF#g zf_{?b%@e@oER|W6sq!f*3PpYktFp4P8E9H)hGtUit9H-}K8+)cCpQ<@4b+DGo*t4m zsu5Va-YjwL%um0A*?yfK#w%2<8GYgW+@3gOK2UP6yB_-)Q2`P+K^YMTn}?i26RnlNh z>I;734db}TwzjsiWg zAPlAeg{xLqxZWdS59QRNZ_x?9j!ewXHp)y+)|PZ4t2OuEf?n;;eG70ISxOtBT!LVB zy--^Z&^(37XpUq2UVEc@d<#g~CeO^NgdU9iV)8GfBL8=!mOr=n0A~NY z$VG7~OgOqQL_&IlMvc%cp$Jo(;dIIf-Sd^*0>Qoh_?$yjz8cbX79 zYiopS%cCC_%}LlWc13>)zlBl0bXCP^F?PeY9Gyr&f7nf1LAVAf#;@;| zNJu)f8JRJI$BPkls-T&mm^g2tJ9DulT$)|5!}_)|_46L3DO4(H>3X-Sl~%#t?M~(1 zlx%cSV6xx40vj2yh?m-PDO`aMn)VQ{$o!#Pb zW@;RrB0_QUb4mp&7`jN~>G+tDhROq$l_O~AeYGe^buO!{6sY6bY4UqXFrOY^XHW6b528O@>#A411Y-~(mZb(LWTyQkDwk}~v zm2p4&`+Ex*ciNfFV(L^x#-o$KDM4G{end>PXQSW69FDut+8SwhILiX|ru^WOQo~=j z?gA&(I?t%R0_gYtjRfORxNu1sF7Kyp6rA3=Y#*Dc-{a@7tcwtbXt6=JS}iEqEx*^L z&4F)rq@gIJ{&XYBct~l*NnMvX_e(hQPQBlb{)On^;W5wnn;r z03H5ed}|7D!ElE{0BJ*F{L!IU&K0CWpYCv}vQ*QM-+zIYhFGm5uXA`CWQ+Mhzd)s- zQjeBmV3+sEe!w=eO>UJtl#LJ5{74dSXG2RT-K5cDP2O|*LgEj zhhOQdd%HlE+e~UIch+$OJ~}`1Kho3FquS?fB zkC|CdeM7_U{@K|#?HJ{vX;}tGD>53iq%woJo$TCiFpB)#5AeELc*bvN4U@e)h{%1N zvo`(d-S{yBmBzXL2M1P0KbKY3o39B}MulsEwEW{Bl&tR$+y~_aEq}?|!v~@*a{u&* zvQe{oY)MH;Wpzg8hN^j6cWB-UAE^r;6Ylgy>mMBu*03_sH>rk;iwj@fBz)Cy*abV# zTJfw2+Yvqd$Pa^sr^#|tJG+YST0I|PX(_OwbagG5>)mtU$hAaY@jUx;wBv^g#0~gP zQM5mQE|hFbGx?4I)d2g!AFFiMlc)f%N^l0*QsyDe4%*DjOp!u#$1Oj-{NO1AFB$?;E$1iL`F4yGh0+rl_d6 zoLf?&)v(tboL1=H$umAWI*RbYiRVYW9eiL{uHZA6dtCMwvu4HdC!_CM;Q1S}^YGfW ztdC|M%io)SArke!BT|HW2r&NOgMSc-_8)t%r=TxMFfb1x!e)*G@`O5SDH+kMby+I~ zxyGMlIwO+wH7m*LxF3F|$Q8oLa}lYLDY)klpjtKdE(HZ87Kr*lnXPvrhwXnSP=k_p zGpGXBw0xQ1+j?6bpXsS;I#|4?=@>m9^G<%*b+uo>?O*U!8CWD=>-NnF?V_qNoWJqh zSH_x29vBL-!A8wO7RbRRN$gi53b`ne5hLO+<}lc4_#I9?NeylP<^3GEOy~N2jwE&1 zA?LEv`stijCeFUh3Yb+IOxMtGI=85lQ+qWg$A{r=S_!rsEy)K1I*Wl6QRd?L*}Jx@ zYVNJ#&VlIs38tJfc4F@;HoCtIF_!7UJr;Go;HV7lWLp2FVEUkp;tM5Iq;%ly%uMU? z-IJbAI~V%R!_c`758YxsIuUZP*y3bn4gn6soa%R?HR<`0Nek1a!K0hzU|(2 zSmx*i98TKZsL05s+>a7Moel>xb!rL^qa~d5-gs(}DV1sZ6=P9R zNlQyhNbMD_G}+!j^xrU;{`ATqmub*~6DAuC4))f8?h(#!&-sfv6A)#p0_T+@^asqT z_%)<*-V753E}aCZ0I|T@=MQzw+xPs@$wMqI`PAOt{ueI$8$=y?C9l#$AdCG$D#0ND zOw<0R;DJS&8XRmye7|aF?sP&9jWqW*y1BXetE8j^n=RnWu+;l?1j7yk<*F!f7Ia(A zfbp?G-5JC&mTa1W#NzkIX(n{FZp3X!OecJ?7>j$%JIp!*OJpmhm4QK!;fjTom6daS zJAz@(RR8-Y4hj}PeyssRDLr0SpYywS8~_Wl;RV-8+?@xU%B-53x6DlK+EY9BD(rc^ zgW0ZFrp?{fkEi^oC;j=iKP)N3_`z$`^vOE1u&~^PSwoORFb^;h5oAwKPb>betY~O! zYwLad__3t#hL4+j4l?9xADVisT-R}7Txg8tjTmuuFnT0&PW0N2A_O$3_~nGoIa?k9 zQ3>PU`C!cJZDMTPiG9SSQDERnFDUrpz?%jqWKYbvWttiZ$1!G=kSZ(|nzTx>dV70I z^Xx;aFF6#d`bzdcy`o{m$_+Mq9dD@%;t}|{&JRsoyu9vdF)t{-B9t7K`LZ{+w%P&3gI;#Kd)Hw?9ZPgjf&q1-u9t9s;?AS0uxFz!(dEm zM?$a7yq=2A3ns%y+{7oh#^qJ|EQ@{LJn%hMIGEi&ye;pjAAiyZtu-VUeNoBS)%BJ# zLSG*Lrrfa@V@o-Y9Dk zT5-fD!X!R^O12w*3VVuu5|KC4^;aRs%OT5qkVo~hO$2)#bc^6LR#K9+P8sxDFrtDt z_3W<%m}Cpgs8gZ}!G!brFgXZI$v>co-1NKo69WcmD-0AoAD@ZKjYYW?6e%ekg9PRJ zhC8(7xFr?vDJgDvVweBJ!^2idbla<2#|bAU%3pi?JQ0e?UhqN`^kA~-ieeY3I!+tW zJYC8IX6fuFrLHE>=(ku+;J+I#P*j>?{ac=wD|=dGpKLo$;4Yv%nW{+Np=~am7TfZE z6H}FQ80&T306LqhcI3pwrRH`MFf=Gy?2{x$dpDjj-5L^XpcZ>;lHT`Ox^#*W17AHB zwE>iQ>wJg<%y!;OVu~Iuw#nx^PU`eAEv2KuQ18AJ=e{1kJ~#Q{U+P7rz|XV1z-wAP z{eq&b2kIq;_0AmG@k~k}dM8aeUQtnjAATha4blUK4F|owJT7_D)@7F*1g<3BneLPb z*hb1T*zgYF(3aaZ*GVc!ev+^wj=e*-SfXd10y6EGx~{L$IyO&o1k!c_MNj@dohF|~ zP1Hm}Fak}5BuSQCx!4RE#d7=8($X9oDlMd;`VfNcxFY)679|fX#5+V@=h_=o|i; zC1n}n<(lfVg2SK5Nfm8glJ=igY2?-uFn1{{Z(@h&$jHd3#{?1Esd<60O$7%_F8YBY zBGWEdCS0OfQKqgNOITkmM2_{|ab@+Cb|S?=`-ul-zZgbHiNT;YRH z^<5~ms2TJG-#KmGbLNC_+I7a!c>wV4<+=Xv;^IU6#NJl}Jv}EEH#hBX^Qbhra^I(> zr>(v+=VR>Ix4|il)Og3m`GkCYfF``?ekEJ12o?Lb{z`JrJqg39h7v*3o3!cDBQC=B z7OCdkrW6zRhB68g2CPVZjk6!DH`+Vub+elK`ubTZ%^T9B;6@0KKb=){pMVHS|ju zN=jB*T1lBFzYpS&7Z6N0P*6~sdK~Ye2Zb-)1;!knsa>-tW!@c6?UXsZyf(gjWntxe zg_3#J<0IvV9fFzn*{t9H5Q2(e%tp8P!B$_1s^8hOmWQeQY1qbOs zBO)UD6eF>mRLF89wiE{Of5!iyx718sL#d_4ldJk&Ry-1&S_(1Z*AC?e%c<*Np%l-; zbyTZ>I$Rx>9#{X*DI8mOYgvCTf_~IsD_@SJ3VwOrdm8td!?K#hC2a{>O^A?YNqYiskIX;9#P@!>oVgQBPgDSbvI*^f{{Ym zVOwvq!^oe;sP_LMlJg0p=5HueDYFt7nqd}`*#5Uta=6%fwLM(%xQ-N@KC^aepTtK_ zF0R>5&e0p;D+38!!!vSM1504O6Gu$XPL!i#ZAOP&VW?V%v>kJ`X%3)DF6sbIg&eE2 zxY)h_=w>N78K3wd^(<0qYqLPdI`A-{Yh5UjlnQlf$+|Q+;7v+3B91QaV`E20ha3xl zNh&ruar%{R+k#l^)`YW^CuvRGq9 zy**gJ5sCeNQt#~TB~N+bh*z7YC+0h$UD$-XwipQzp;Uwz;sK*VWg^dX*zQ8cmo~tG z6gjI>9n~BIJpmTFF+W1k!@MCoJ449 zM`iJQCav?w=Hqpza4EM8SJkrC_R|zmJ?}@PCMmh5oKR6TUT7p|O3qk{I#JtGI#dVv z#K81*<>(j{!Y3DV^KHiLc^P#rU@iQb*b`=EwtK;&f$0EMmi+2aM~giw=3%16MkEZD z#KzN{_MOwPMHEib$Z^mRoAu@VDiXKzNmWNWX@_V8*iw*-pAli*I5pb>pSh*BxQ8u( zjA6wBb!K)JcPjjS1Pe3s642rM-ixi+YoYemzNCy}ba-;&0t8qFT{sFow&?B@-47Fm zPbR=vDf*kZs(>nr49quRGIR$)@rJ*2Wn?CkU`*5#RcL}(FmuD$72jobz|HgU@Hn|y z8@sr;pd)@S&6YAZGow<+iGf#NK;;<(hrAMR8+G^M1Ks>@KtyuZeFkIv<~r^FC@2Al zXXwlzy))1Tdv}bqhGya4_;YPm`_;3%7-tuk%$$ej7SFrSi7`Fv^p|sQ7>#Oz?ykPR zf90yL6-CHtrC@3(`FmM*_ZhS+Jy`|j1G=Inq@<f!?AxtsAxua;oWW5D4Ywl(=)~|fhmlX^C(aUtKPAtM=a$8enqFMoY#2w1So;% z&rol$%(ow=7l;QZ0{4E|SXqU8-ji7NnQH+(f> z3zPzgx0pU}W@aWTlwZ#Bo*v))+?*CRtm zL5+%Q;~`cKb1rAA=A;JW&xjCw?Cx22s;Gh>c&sQkQ(`gff?w^3GmOXG6|up=wR@X) zMthT63%H)#N|z%f7OuNb7Q4dun~}7dnlT`Tt-)8ONMuqt^oyN%>e<|9645np!TQ{W z>WDoUetU>O#c2lP$Tv&cre*=z9~ot~zKn20oKSPRd4C~f1|F1_GbpC6<3!w5m?)q4 zayMZJ=;wOFjqQ7^7a+^4pZbvf2l5DWKKc+6+PAD~RtI$r0m8DjCZfK*@$Zht##K2# z=ex@JuV3JXZ{UiVZX70W>|jPBO8$zTn)c~h)c%hDIE^9`PlQ?e>zBvu-W6Z#UtE5l z+Dwyqc)I#Rp<=r)U-sySm1>)Y_xjX3$xHI?V=Mh#yw@b`#9aOWG$6Fqz{bX=mO7v@ zHc9yfIjmcY0>(X}e;f{B5}jK5q0o*{1?1p5kt{mDlSn1HZ2LNBlSIeFu;4O^{h&ao z%Yy!DVM;rCoF1HHd~M@LuoH8nnC;*y0`Qr^`po+~RW zFT3P3f&QrZ-|{Dq+yu~;&{0Q>12ZP;spn8A6*X<``SrV}%G$+qdOzX|e{GfQ{sopo z%;#u|pR`3bK-7*~&_|q;hzd4703x#Gzkgq4RcF=&$tIG4f5!tjSCx-_{sc&T-^_Tb zc4}FpjxD3e;08qASMAGi7*j+Y<>LrQ6FsBR!wLuThdmp`VRsB|oUbe_EJ!v~NU4hg zA;D*gs>Q)I(j_K2IA4kFH?d+6BdZ-1!Iw=_1?mF)UBzD6i0iTq)ZR|F zYNA+)KmEvG!}4_Sd4N8U5DA)JOhCF$07BR+v8hf583~C^)U1e)j}KvHN-J8O~0Ad)e|Hzw^S9_nN}YZic;Z+x%wZmdSgR;xk=mJg}pAw*oAW` z%L-ND|Aky9LpW?(#t;Q7pQ{*dE#Ro6hVB{l9=hvtG>~XvX~{Dq=wZKzaB+2YY_Bgt zCc{BdHPK<)$bVvQcb6I1Knk~>tYYEOPWT;T0n;EwxAEczawFV`k;b86|AfF`G+hj= zT_GzV@y)rpd^;#Y6OxqHW($~q{W``K2b`=jwU++|?U}NV8Wz95Z8VCwwY7CpOn?d( zn2m~pQn&driX>Z5P>>~o_Z}f8o?(!MtvY|5$rwFYOj&BU2|m1M!`+a7PA@I31gKk{ z08uVbdmDfH8v>1AIH0bkwx2nPCJ(Uy;v%oUUBcbHZgY z{bARxarpg6FU*xV3z|*@58DIt+8>>*1U+i#;3p{Vj)Q?!TwC}DeGF_%}a)vjqm(|&?C)M*;3&c|YSRG` z;WN0OBz1sv1gkjxD*7BD3rmJu=?0{JFtR}@tH5w^XL)&9+w@9g8hRYN zT2A9Z%kR}UTBWl?m+KGY`AFr#9R1-|8NAvXJohk6FUS|@=Ollb3_j^L7pR`#d79t` z`=Ww3K36$tQ2?i1imu6k66H;kM#$S$uH4xVc!%Sog>PjdXwRc9ciK&8e%(>_yw466 z7C&vhy<5N9*px9)QHetb#7;1n>{#IyL_{DJQOnM{|8#V5xhas-G^v2(Wk`A(H$o%e zb*#OiSv)eHg@5(@mNUx(=&B>sawdO?TnWF5`urP@YGYawBrj(DeZH|_>JVdpq?T1f zas;r@K%lm}q_6*4F3KIc)2_epmuJfB)4PdLPCQ&(J{?_CSRHyWqD|mS;9q{XGkq=2 zlOjMMDc982#()-)gQ#rCg2diUjQvg@v$1qPlW8q$dWWneLbKq!%fxenm@Y~q0HeFP zr;TJ}5@%AI^?*r>OXEqHP!SdLwIsIyIA!&_zJ3QU6ox1VVw~jb-^-H%S)-iu8Bhet zss~mZQ#Jg+ettlCyEoOqEk^$VtumwRUqDqNVc_YXw?D2#MF^boJ3BspCdY3NLWB!e zHolBB!?l5nM@t^j{H)*L(zPu5``51_<_b$nh63#PVPPZh;KzH65X7ji`6^G9RY45ybYh(X6(ay83-PmRK`$4(-ZT8)xxIC z_{S8KzM0?!Z){s9i6`TD5xgAo=9VdJ%{nCy0?a+-BSr_0py0`8hIdoJ_ME?x#FdoB zP1b0Pd|DSPRZKVn6n@|$O~Ri6%CddO`Qz6Gci6x#Iahkg!jBjo#@xG}->b2cYTXu7 zA*2dq6(ApXeyJ)T2yBp`jB|6S@n~su%RyYWvUvdd#*Ajc;_!9;C}5q}T#M(L(wA|Q_<_n0Gfo{OYfaa>r8!>musf)(= zHepY6D}sAD7|j0e+xtIu_a8E5VpQW0e27w8p-u)9>tDG-dv-yl0vq#<@BS1M%TV?n@1CE-&z2C`N-iz0t{U{*ImH*l69i$e?oG_ElPVJc zVK1o&*1MlPY=*$_|F*SNfPX6fg0(ApyKLvNA3A7bLgtwCmYMu2QT&|->t=8G3-iKC z;yh{xGVhibmU0m;W5y!$7cQR(>SyE@#WFqaV!k~9mDtXbI?n3fES%j;96y8POziEx ZP&l%&@zL$q{%42|l9g1Fs1P#__P)f7wOH{J8@xqHK&Z&Rg&Ka^Nx_w{OH z9m_}{f#t3B*DH2;LRN>ve93sSHo*-nGyj%E|okxgm zwh?+OeAn@Q=~fY1{^q7nZVNPje{Tf@WFvlD#Z27f@ xHm5*9K*0Q3+R{Et{`F7gkdg000AQNkl+qx@PFC2mwUI+_V#0!U0aTB~4lirBT6~rN1X&QR5 ziS$l!Yw6r@1zSsJY|}JHn=~zE#x^mTTW2Vij5U8sa-O{(2WEP{rm**SIDC2jyypZ$ zu-UMQe)e*dDJ}~sIR)q!6*{`)VITiso_|U8Pg*R?r@W{^akpIH_^Ea`77qaQWFHU10yx4`egk5sl z*L^xY$SjrrLXvIv13!=HiuO_NUk4Dp-rxP!Akej+u+9vmRIn=r&V)#%D{n z^zUANtej%Bh>gI#bW1tXbffYiQ;O^U>#+0frzN8px$(&j*!fOcii#hF0H5;dS{O~x z=S_6reYxw?v=&yqLID5#!X%TKfeij91FHA;2r34j@JZrQ0y-RKPWX|~NnBFBbpz%c z7q~EgZXP;JDo^gvnLnpIa}H*V2_{l!Q_vB|0y?R)$}wZ8OsOAB?m`Ya;#fc@cR@Lo zFkanZjIove73hd#0iBh8<-Ga{=^$r0Tb?LGM;r_2lqZyv4r2UcJ`!g6t{xKI0vhi~ zL!7ZwIN_;I)1Xld7GXzp3)m?Jm0q1b;Q_WM`xzBx>C=Ky3r+X&vC@BuMa*c3vhgNxHQU1A<8>!BO1^qZdBz;qo)pU{QGfz zcC>Vl4}~z}{DyDa%c6YEn7EQD-TS-~F4$(r@gu8)3{f$|Igarwo?)kOMowd*%vkQ~ z;PE5a0e#@w-4VHJPVfO0lZ?>dBf*fAp@H*>o|iYvBj&g{ULJXQGto0}-g^jp^k@GIS5r3yiD|~C00000NkvXX Hu0mjfs1U=| literal 0 HcmV?d00001 diff --git a/browser/extensions/mortar/host/pdf/chrome/style/images/secondaryToolbarButton-firstPage.png b/browser/extensions/mortar/host/pdf/chrome/style/images/secondaryToolbarButton-firstPage.png new file mode 100644 index 0000000000000000000000000000000000000000..e68846aa5f609f48e89b25692abdd85c2de7ecb9 GIT binary patch literal 179 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!60wlNoGJgf6sytmBLn;{eUNGc3kdg0002dNklu=O3C8jVap{PU;A41oOzOaJ;Key$ zQU*)*)D8A5V+RX%R3~;UVg_@zlxMcgLkF6gqD74k8E7`-9X9B`!HkM$kBXUZFs0+2AR>HC Q6951J07*qoM6N<$f&iRyUH||9 literal 0 HcmV?d00001 diff --git a/browser/extensions/mortar/host/pdf/chrome/style/images/secondaryToolbarButton-handTool.png b/browser/extensions/mortar/host/pdf/chrome/style/images/secondaryToolbarButton-handTool.png new file mode 100644 index 0000000000000000000000000000000000000000..cb85a841b18be0235fc6c6714223609e1097d1f4 GIT binary patch literal 301 zcmV+|0n+}7P)J24O| z%QaP!}IU9e5CrM>v9W%fW1qojxzD%=Q00000NkvXXu0mjf%W{5L literal 0 HcmV?d00001 diff --git a/browser/extensions/mortar/host/pdf/chrome/style/images/secondaryToolbarButton-handTool@2x.png b/browser/extensions/mortar/host/pdf/chrome/style/images/secondaryToolbarButton-handTool@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..5c13f77ff003460753a39d9e406c0020231cabda GIT binary patch literal 583 zcmV-N0=WH&P)kdg0006GNklsDncb1tl(lO0{5H zQE6&xnvkURPmGNv7*b6L!Th=V`QF__%SrC--TQe6-{l_O7Xsbk5HrdU;SJOpV0KIxYb5^yMTWCRz8#4m*=<-RYnu#WwP~*n506n@GajHIFM;%}f zFY^Y^aW7$86$8At-QN{yj&9v@sxj9<1L$1g8gpFdYaS((q*!NG$}P*BQ`PAzs=(Gm zuGm&PFW5_{a(v>7UM*fj4M<$)vPc?t4M_V?iB(Vmj)#B6xFk|MFXcmJ%3gpyBWK$S zOgPLXDIdy{Wt3sfzR7D`46gK~gc4x?9LbFFLr|r0SztMRsut(_Uiii;Sc}-002ovPDHLkV1iPk2)h6P literal 0 HcmV?d00001 diff --git a/browser/extensions/mortar/host/pdf/chrome/style/images/secondaryToolbarButton-lastPage.png b/browser/extensions/mortar/host/pdf/chrome/style/images/secondaryToolbarButton-lastPage.png new file mode 100644 index 0000000000000000000000000000000000000000..be763e0c4a02cab5d7842c8999faade8c47059bf GIT binary patch literal 175 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!60wlNoGJgf6$~;{hLn;{eb{X<9DT=r}_bOuI z*S;pAB4U5DMLQrPIWf`wN4P|1^q&c>d5`zJymvU>ZK0k3(_cShdv}w=iShns``k;6 z|9a2*kZNL>>-ng7x$0%-AZ2dv-evusD-M1!nVC^#Cw7NZpelLZ;<(0t-0Qey{BDRJ YJiB<=q@5ck0$sr1>FVdQ&MBb@0Mz?GUH||9 literal 0 HcmV?d00001 diff --git a/browser/extensions/mortar/host/pdf/chrome/style/images/secondaryToolbarButton-lastPage@2x.png b/browser/extensions/mortar/host/pdf/chrome/style/images/secondaryToolbarButton-lastPage@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..8570984f2d9952ebb8543a6c8bbca2408be3fe90 GIT binary patch literal 276 zcmV+v0qg#WP)kdg0002nNkl&Czfjc{g zj6%Epm%+!Y13m~u!|`;DXFGIF9(|doYCM^ve(0R2@MwmrSf3_JJZz&%)@Kv4!2LS1 zV0}4}<8B$5v%a3la66C8Hg!&j6gN{uYNm4{!PR#}Vyttbi*Y&9#dbQsBEkhDB5R!! zZ3qqBhHg41f;Mp0Iq}XP49B>3;NV a-`N}fhF>K<1*gRT0000IXDMlYJjH!bP6)MzmI9A`JeaMrW zP{;Eb78VxP+o^u+tz)%w>Y7tjQAHKiynbv>Q2u<>aK#ZG+*=LzzJU35q7H&2Nb8UG z4tHis9hc+YH714zU~vDD-l4 zafLJ>w7618y&iZMZti8jkXl?(NPqY>rLdN@q_C#sSI-x0yte^Yo}fkdg0007_Nklh8e7=r0Vcp)Y9Pr|5OlrS&sF1(Z=>P7`I$&2V#B8FQ@ z#xx11n2B@MtaN4N=HFayP|U&0*qP^fzdz3rbvx5{@V?*A7yO;ybIvoweHnhs|HM2| zKI2b<|A+)(s$d&GYW}mq85+9hKEosr^Z)ai~BEfeTNO#3*wjb*wP4^U`OFpp(!|`#~2s8 z`FYx|7Q`+s4a0>};|dO&@9pxBxm8wN7W`#thbT7CssC=I zTAKz9&;++jKrz^NzcAADM`@&iv`7W`N3qmw3RZ&e8hPgH3^G7Qpcx$&o`vOn_6(y+ zZas$_WXt7wl$(nFs}3E|%QjcV-;}eBGn_%TTz6djMaiyYk%erz{(qejCHZ9%NywHf z{V9J|qQg-{A#0$GFYt5L61R9<|A{{;zE^$lK~~|*404N++(Ztym|$2*&p8|pI3TP1 z`Lol$YO^mh!s0;lvGNuWs=UoKADO*y*%)pt=Qi+&XoY ztsnG;h7yz6Kt7lcW&?@I(9rw6m9415J&yxVq8aUYUbLfGo*u)4nY;A)5mO4m-#Y*R N002ovPDHLkV1o45W##|? literal 0 HcmV?d00001 diff --git a/browser/extensions/mortar/host/pdf/chrome/style/images/secondaryToolbarButton-rotateCw.png b/browser/extensions/mortar/host/pdf/chrome/style/images/secondaryToolbarButton-rotateCw.png new file mode 100644 index 0000000000000000000000000000000000000000..e1c7598886bd49e194764015577b766aadd82288 GIT binary patch literal 359 zcmV-t0hs=YP)x?uT5p77|>RR|+!(Z0%SPBBerLNU!<(Nsaeb!tN(Ep1s3u|3Lqc zXA482_4)TIcUT&Mg&ka9PU%bJ(4vmb9tomENw9}a{m@cGL+1YGpu!Cenlx!}GpOuu z%G3xmxmwG;o&*28mt2*pekdg0007!Nkl7D_=c-w$rRM%>rppb3*+sVXe|le>e}?;(Er{M9e0<;c?0eV_qyI8^j_+&`1R|)U z;XGO}fI0Zt9GrYA<6DaHV~zRM1twVFK>**djW85SZR6yh2FUfJb!D6Sq1r_=#U#5b6Imp7B9ZQ6dlA8G-$eSq@9Y$Onc`L6}j4VAGA1e z1=skwPmHutJ|&xcR~vkBjDocAI6jNzhpOjziuITk{*=Ke2$x|I3s}%U+A3|7NKzG} zAk>06vGjn6XdlOMA5}2zo(U{7GxQ7|5$+DtKDyz>3|zQm6o@A`;T9ZPLCJCIg`0Wi>*q{U9GDRL?<%aEPKbabJ1?6A$s(GnBf}UMn8ID;D}MVOPR2!KxT(5{c95|#cUhyO zcqQP07oE6>JRD?syzAu0o}Dy0+GSP$>9RT+BSRRAndFjb%&=+RP43=DhB_K4i;_&1 zr8a2C%jAM~ORYRlKIV)PyKSob%7 literal 0 HcmV?d00001 diff --git a/browser/extensions/mortar/host/pdf/chrome/style/images/shadow.png b/browser/extensions/mortar/host/pdf/chrome/style/images/shadow.png new file mode 100644 index 0000000000000000000000000000000000000000..31d3bdb14f1d67953d18dc04e73db834aaa200f2 GIT binary patch literal 290 zcmV+-0p0$IP)tp5%OSAJIN=ixy1VT$o%fP?@g+jsMa19L&IXO8Q85uMh zjmP5^6cjF8xB!7bE?&F{g+d7gf{~FCi9`|+5ivJ6CzHuSLP8)A2nYmPT3Yh+^P8BM zaC380C=@3rCtF)vcXxMAPEH302Uk~DJ3BinmFnr~>Fwf;bFE=oXuo zt+mZZaClmj@DNe$a8Kt|-tM(oY$3fnvV5ri{UJLuRI)(c={e$|6`XkQ(!Ft-)*V3~ zJSd%`)Aw~)-?b?XIWhnd4GbP!X&wXr{Nbh#t>tp)0GUe$UNJmbK`seUZs-6p_=s|d zxmlplYK~|zP;XOM;N6pi(1zv!U!$1VhdtVOxZkYeJabID7P#Q86p^S+4JnqT#}V zI7N7*to)YG-P>ZQHOBcODz1`!W4d#*<~3pJ<4WHZJI4nFlH{je&`9iHj*E?88*@6k zF&I&!9xnLUUj$iLqu*wjcC@G*hcx?~m*Y}bM%+?Na$SN&SlqF3;nH%D0*zxGhwM6= z^ou8kL9{TgTwYDJV`k~thK5IgTT=o&p2K1L>yF~OkxGsETU+U+$F!8mhHuMWm4N?o z=d})fElC|5XbU-(l+-HeV3hu&y$EpKf3ldFIKPgSINoQO14ELg>VUXT!-WG3W7f;j zY1N{P)x+;%s%vxx;p=;kHM=NaL3IQTK$13|SH4a!D~ULA-GLxaA5EO!q1!dwFHRn4l{z9PmhXYxLc7^4aLC4nd@E$e4#=RbY9)&CUz> z+Y@V+-XStqR2r13s{pY*6GNES|2tJc__DiXG z;*JN?q;4LpFi`Fsu^!er!CdMFH#Nr3JjC`)J}tQ;!D_8}64LZ{tzhecHAj{xjLQ2* zS`*bmPkpa)zB(`CJYm0~&w8@?ky2$#SYoK#oU5XxP)>5L`Hb|7(8o%=b4Wvlrg(Dh zMzsf((8F2y>mdAGD%wWOjW^<%EXJPo-s{BFT6w2dv$x^%Eyp6+7kNq*C;HWg{B53H z786;o1QnHv5nHwJmk7}~y|LsWD_f!btUD#)4{mUf^i#K z&^mpQQ&0U$!8UqzEGGe${+G6DG+IPI6K+K8UPojnQLaf8gubfw^a4&BQ{O=;Uzt|0 z>C+Fsf4FUUv~+Or;fJ&I7ALym8{vX)T1eA1F7-I*NVkt?BE$p6c-@ruu#^PT&1bUf znHm)$6y2f039WQ&%e8>Yn&-TCPX-SpuBuH$eviP9+FCIF;$ev|+@n;lIy1EPkHYwr z0kWS11Ct0oJL-sS_rFuoj04k)i+|@UXwVxE(`u_9b`qfVYvLHJtCMsl&++c~09-5l z+pq$IW`OEfi?+7o!(?P_B@`oniO~``{0hGrw_A;J-ZpicQ^0(NQ`<9X{M=$BW1Q`ct-73apy1@#Ca-k5=L4c@LZBOWBFK)j!t?Dsu90KBdST zW2y%HV1fUvm8r2GG#B;TDT9-S%9sJeZ54JZpn@QDP~4X~;Gb+J&Ux})Uv{8vgpJR` zS^LPaF=645uOTrDID?Za%k%G1*~<5b@#lB=O-SoJZ#N)Q-iG z4qn08+gCDs;f{wd^fwbyhOTZWy)AYtRL?s^| zY$h(iLUlQ>ukG;1&Ernn=~fgGVE){W(_3 z6J{!B(X8{ei2|^yFFSOEtKXc{P~>}_h}$8O@bt)={fw#bgzSq+30BC0W@+p?&uumLn^njl#pXWRd!uk= z&5U+h@bW>)+6UYtvUrN`W4(OjJmKtIW2OP=hosdJDu@eT_Y_1n-YUa6^7#9^+Fr%urXxSPi|$4sFs zv^u16-CcUh6%y6CQ;M*N9^{vhBRYT$SFQ!OCqKt=#7G3JZPT!EoNn4td+m_kXo?zO znR5@Zp)$rm^e*9MQGO zUHcsG7hqP*z$sF87d3T!bYK?AAK%x%1VkwI@$okOm}%$Hl~H5mymQ}vt>;C6eN)*Q$iLn>`hH;28}V=>tyzpi1dq!_s#Y(o?Z6PqD=UotbK;z z+=pt1eY;;C=TG8Xk<7mK*`GaMCo^*7N1nAT`yj#0VsudA+GmM(2Yq*^+n%4r$i(=* XtGDvpiMgkM4q)(f^>bP0l+XkKeAzzU literal 0 HcmV?d00001 diff --git a/browser/extensions/mortar/host/pdf/chrome/style/images/toolbarButton-bookmark@2x.png b/browser/extensions/mortar/host/pdf/chrome/style/images/toolbarButton-bookmark@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..4efbaa6758dce6ea82f9e03e81c0196cd806b266 GIT binary patch literal 260 zcmV+f0sH=mP)kdg0002XNkl|Mj3PYt*CIh*)L;+Ye)qJLer!U=dbLBLZSzSesM4tY9KKocB+w3G#Z zP#|$ck0S&$A%{+O@CHd@not;m^nk=r!lx-oOkfDo1ASdr=)nV-#q?0Gf`(oI0000< KMNUMnLSTYMTxkmc literal 0 HcmV?d00001 diff --git a/browser/extensions/mortar/host/pdf/chrome/style/images/toolbarButton-download.png b/browser/extensions/mortar/host/pdf/chrome/style/images/toolbarButton-download.png new file mode 100644 index 0000000000000000000000000000000000000000..eaab35f09e12fed1a285ca765b38846f84ebbb91 GIT binary patch literal 259 zcmV+e0sQ`nP)kdg0004SNkl) zyTrz@9NlC#^DUV~uyB6O#`Wc|{GJapsNf}n_~s#6@aR;~Ks|!^o;hKkb<`q>uf_@c ze2Ny_{735Rz+(^grfCv7@DMF@(?E&?)gFc+;s(Y=f4GnKw)K%<_IcMs6%8~k4%~hd z1#ZH&m*NR=jd9Z9?xHxKc#XI|a&$D7>pcNfCv2 z6(}mA@U8*{MHJpuAa5+piu*}@=C6x$-8&9=MtcJe#2}8pdIkrw28vjvgyHy0F}R~Z zCUA)rP9TO&f3a5-II~coM6B}%`OpmoPD3uR3@7y8J#|5W6U7S>1Ne&^?G!jBIjmz4 zBlw35uM~LQ#}Ub*j1tayY3;VeknSU$Z13T)Kdqf~GA)J#k0F^Bw@*|4^-q28r{Use T)~jCX00000NkvXXu0mjf;mWr^ literal 0 HcmV?d00001 diff --git a/browser/extensions/mortar/host/pdf/chrome/style/images/toolbarButton-menuArrows.png b/browser/extensions/mortar/host/pdf/chrome/style/images/toolbarButton-menuArrows.png new file mode 100644 index 0000000000000000000000000000000000000000..e50ca4eee46e25d92e06847004f323d616237f85 GIT binary patch literal 107 zcmeAS@N?(olHy`uVBq!ia0vp^>_9BQ!3HF6HKu+5QbwLGjv*C{$r2tP{{OG9Q;1_& zbWt^;p+Z-{zWI{QiAmlEggExJ)R+qxP213Hu-B-8fx+-v^k(la_imtW22WQ%mvv4F FO#tGFAX@+c literal 0 HcmV?d00001 diff --git a/browser/extensions/mortar/host/pdf/chrome/style/images/toolbarButton-menuArrows@2x.png b/browser/extensions/mortar/host/pdf/chrome/style/images/toolbarButton-menuArrows@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..f7570bc0d30db3dafe54aa7c1fe92367690f5046 GIT binary patch literal 152 zcmeAS@N?(olHy`uVBq!ia0vp^d_b(g!2%>Zo;S(>sd!Hp$B+ufWQooP^)>=V3JT0Z z$G`noR@ib>ZRMZ;zy7B?RLGuin*8K{y@Up1n}eABCY96wr#d)VuzZRTnDjQlktL_y z<57djB$XEmhvE+MurwWXw|F2ZV0`Mr1B0n74EE`D>#U8d6@XSTc)I$ztaD0e0s!v6 BGzG;VmC z;q~VKH(~JG$%=&H*l#BhBA@m%+@JRU8U%hjmgvvG%fOT9|Lqt|?CCOwE9L($f#A18 zKxs~}zd3BF({67qbqF`wWgvfL;hE+U&_WnNzfk1a( t2EvOl{_oukEDQ`x40a3-IG`;90|2DgL5N;Bd29dx002ovPDHLkV1nayd!_&Y literal 0 HcmV?d00001 diff --git a/browser/extensions/mortar/host/pdf/chrome/style/images/toolbarButton-openFile@2x.png b/browser/extensions/mortar/host/pdf/chrome/style/images/toolbarButton-openFile@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..91ab76593eadd6280b2a554d8d3eb1430d7ef6ba GIT binary patch literal 550 zcmV+>0@?kEP)kdg0005)NklV8EdrV)CkilFRiwZGwaE58mndUOxVhkz-=YH-{A&5&o{d zns22dWrs@ZlkDB%fnWKmLb;Wa?OQuga#3zxZ}MmDC0|@s&JT+HXqXKe@Ow>O zxH{3h$him+5RYuj9yN~lP7jG!JjhF_%4%QAQk5*<6Jqsm?Kz+C$$K}&xzJc>>|@Nm zsKzm_h^c1H4jjOTZ(zSQ>)J$FIwS8?teL?fGyt^0A!|lm!cm zrf{tQ1#;(QSpf${lMm-1Pv*3|P{2Xa=o32VET52+0uG8MJ)VX%$q`vnz(LU@4ksYN zlb}3P@CY_uRWrYD9_C5zkwt}Z+X>H)v#KVxI|eagyX2`tMhu(u=AyNL7l4cY^~bW% oyZVDVb*O{JA&&H6n13-p0bKq8;5tc*kN^Mx07*qoM6N<$g1cw`kpKVy literal 0 HcmV?d00001 diff --git a/browser/extensions/mortar/host/pdf/chrome/style/images/toolbarButton-pageDown-rtl.png b/browser/extensions/mortar/host/pdf/chrome/style/images/toolbarButton-pageDown-rtl.png new file mode 100644 index 0000000000000000000000000000000000000000..1957f79ab95a970cc93eaeadec532661c5a1ae55 GIT binary patch literal 242 zcmVkgj4Lv#w4(S5>&h#|Q|$T30}L=f&H#|39(FQ@U4`qXaxf1Bc1+XmFJ4%~M*)ck=@jF*AE z@OmCGUIsRTT4WE_AE@?zRCReJsxQhE$k7T*n^xpdHBOme(Nrc9n@SO5E{eDjb45p( sF&)`4S3;ynbtti233MRw&&qfF1f{Oim%bdkdg00041Nklk=KUzNjE&+Z(ng)kL^NUuQIUigABdoZ zjSq~+fdO@9zMHugg5R&b=MNYE`8du+Zn4FCK6*TGn{x~k1gJ8@hCRLGEpOaj+8e8g zB8)MpkFy_r`|-8kb8}@LQy6}n7&Pq1SAK);+5#pKbni>{+q`3FZOa;uPgpuN| s!;t41i6pD68cF@RkkFqi61Km+Pl0_ej2E!U-~a#s07*qoM6N<$f+7928vp6;%ZmspUL<91jYXM#X%ehtN;K207*qoM6N<$g5$DeH~;_u literal 0 HcmV?d00001 diff --git a/browser/extensions/mortar/host/pdf/chrome/style/images/toolbarButton-pageDown@2x.png b/browser/extensions/mortar/host/pdf/chrome/style/images/toolbarButton-pageDown@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..758c01d8364c5597d7e9ead825cf4e7754c8d929 GIT binary patch literal 396 zcmV;70dxL|P)kdg0003~NkluFpq+}Hm0+F1Hup;*cG@Vugl*K#ZX`wwAsWOGa}fz> zkwzm~KZOBxbLOmLAviyn;=uQ(|M3vS0uJzqrx86=v5yr@f+Xsjpdf{JHeYJ!j=0AI zdMIPgH=xkW`qFa+9gXf=3-i7Kg{HTb-3Hnk9k+}r-+)2^XB#c8_HcDb96Kz|zFy%@ zr+?TdjvvNrduZwmN(16Fr=vAAblkd2oaVF}#;t%j0<#gojle8GW2g(H0CO!c4%7t3 zfvP|ZM9}o82$~*|&j5vrIb8luF-IZ#_Cih;7v`L-ntKx&oSShnYR(gBlz!%<)m)pf zQ#kWyr_@|dB;m;HB%5m!ww^R+i9!MvS4hZno`~brs}PswLc)&W1w*T#Q92I_?)jA__{b8r{ocmDkjB;))luQR&DQs#s?5{OcWsXDuPe zmo+wBW`Ex!Y-z#88@{DbU>|qCUYXlY&65@XZDezLlfot}w3kTg-zv6Kc{)$s27`wd tL8q?PzUn!-=+u@K&b74>{cp1VFo`V}NvvaB+5+?kgQu&X%Q~loCIFI;U?~6q literal 0 HcmV?d00001 diff --git a/browser/extensions/mortar/host/pdf/chrome/style/images/toolbarButton-pageUp-rtl@2x.png b/browser/extensions/mortar/host/pdf/chrome/style/images/toolbarButton-pageUp-rtl@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..a01b02380b90e5ab32727ac5460eca3108a8f1e5 GIT binary patch literal 405 zcmV;G0c!qkdg00048Nklrkxqu zT8M?#!bm@}5SjL#xxE$==eN2ibN;KL|31hDNQNMj#dAQK=y(1Y5EDv)44Ux1HIb1A zxbp_wkVaG@>bwr8M;#f}fPp8}M8Vcj2^jETNAO_u3+Qn1AmKun1#~zl_u)W~3TUX} zUO^Qa7tmniPLU0*H;_gJx9U(qIvhx$jGJF7BlQ!YX-bCSn%DhRa1}MU;;H}2mpt`A ziKiME#syC?(4NFOPciVagfos`@JYn1UN>;cY3;X2BrFj7v{2+Y+YX6@#fO0+3LJCQ zBvH>3vz-&-ueoS%1%d+z!pldaMb1S zJy+Y=T^nDZ7)fV{#%PX`f<=ncJWbF5{oQ;4iDXE!#q;ab00000NkvXXu0mjfx2&{B literal 0 HcmV?d00001 diff --git a/browser/extensions/mortar/host/pdf/chrome/style/images/toolbarButton-pageUp.png b/browser/extensions/mortar/host/pdf/chrome/style/images/toolbarButton-pageUp.png new file mode 100644 index 0000000000000000000000000000000000000000..fb9daa337656a75091ea00d4c5600ba4f557d834 GIT binary patch literal 246 zcmV4@1mz9~E$`$~;b_k}_F6G1q{7jr18lHWj_7~< wLcHP)kdg00046NklObOG9sOZQNBke(N5=mxxi_UHnda|*&J&5TH*h$u8)^QA!? z;xt&CUk(xa@IS{#Xz2Hu|6d*s2mgJH_rVY7C(gG%-^8f%*FGts5wO{2{YRVjxB;6j z)&{h^5?<#`RuxU!x&ey~Rs;=NIsuDymORvHjS85o@x@1treDBhm4y+iG`#`_%Y4>Q zrXd9kmiVNpL_-b4SmY!16&V{0L|Nd&m{h`q6-zeg7QAIlCLxaTHheG%?nYsXZ0`) zJwbTMNirjGFS)Go0!$`0KT}Lg+!F?+fC96-Tkl6a7i8QNLsCG2!2H_bPUYYu$y1&U xNi)wqhB>1K6qvvQRuRHFB2cYh4paDxeFMq5jmkNGJDLCh002ovPDHLkV1nI`spbFx literal 0 HcmV?d00001 diff --git a/browser/extensions/mortar/host/pdf/chrome/style/images/toolbarButton-presentationMode.png b/browser/extensions/mortar/host/pdf/chrome/style/images/toolbarButton-presentationMode.png new file mode 100644 index 0000000000000000000000000000000000000000..3ac21244dff26830f46ec462f2dab36e1a18938c GIT binary patch literal 321 zcmV-H0lxl;P)d-;VqjhMU0mZ4X2g!hLXQ*2lyD zAO1T4QSzVf-}e8HzMQ-~=l=t+g42^3RNS0C9Q=RpM>>fAJ?a1b&&NYN8B~EX5F3G* z)y-)~6N3zxFSVx?D9sL)fdf{kGziForAY+;dH)B&*)2a2N#7G$Xm3^>hP76r$iD7@qu}40l!X|5FfA2;Tt;<=`gB!NnK=_L!_3 TdOB@M00000NkvXXu0mjfBu|wT literal 0 HcmV?d00001 diff --git a/browser/extensions/mortar/host/pdf/chrome/style/images/toolbarButton-presentationMode@2x.png b/browser/extensions/mortar/host/pdf/chrome/style/images/toolbarButton-presentationMode@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..cada9e7918da28bdf84af38c354dbf1e1c6fe31a GIT binary patch literal 586 zcmV-Q0=4~#P)kdg0006JNkl6nm`NYOT@I1}o-1mKoVd&o&{7f+mN-&#|()Zx;dz{8H zjZ$((8_UU@2);#emg03$I7{)Q2)+sjYw5ZuyjRhz2zmk^;uiyU5k4mtKpo5NDq;oH3c;DYmG_Dw9@94#Qd!Np$MYD$j zPc4{FS9m_nZFoN1#o4faN{cjOD4v!1b8BVb^Z!9gw9*2_{C#gi$nn)e!f!}1hmw`k2Xb!g|HAo2t*7E*&>DgR^vZU zVV4ks^D731!9T-ielNTbGw_$axq|YpFKNTWBMo*4b40@@e=r<~g@MK&J_SO41MfMq z6K6!=^stS5fYisq7foRJTRX628(*Bq(yKr%dZE{WZ`;7vZJ2IZv$kcQLwS8}%Xy#f zfMcjMVUtA}0uh@ufx-#qxPlcm-vgSJD;yl)1oluX_K^Glse?0qV_8Mk00000NkvXX Hu0mjf@9=3h literal 0 HcmV?d00001 diff --git a/browser/extensions/mortar/host/pdf/chrome/style/images/toolbarButton-print@2x.png b/browser/extensions/mortar/host/pdf/chrome/style/images/toolbarButton-print@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..53d18daf7825ae12d99406068073d16ab682737e GIT binary patch literal 464 zcmV;>0WbcEP)kdg0004(Nkl|6%E6&Q zgKhE5R6HaVnnStjcWqH1ObaL>24WBUJ_Y#4uV1O`0z?e~qSOfwF1Pr+z z$Bpe>*voD2#tn`c<-UL;j`nO=$Qx_VPMhTiws^}Shpj6L11HP{ZY}JG58#d<-o%HwW2=;PUN2XFHukd_-`kI$Y@{*S`_h91y zIW}gls+39Ng#)bOp}H?Gw|H@Pf)(V=%H0Vs*gACdn;u{lW|A|ybdPtAQD7%+lCuPJ zNHpGOlkX&todVvkrYUPEpq8BS?cYmI7hZsM*cGhfU(HW?%hSMo{ZqpL0000YA literal 0 HcmV?d00001 diff --git a/browser/extensions/mortar/host/pdf/chrome/style/images/toolbarButton-search.png b/browser/extensions/mortar/host/pdf/chrome/style/images/toolbarButton-search.png new file mode 100644 index 0000000000000000000000000000000000000000..f9b75579b1e058baada95941a4a7ff0c80edb5cb GIT binary patch literal 309 zcmV-50m}Y~P)}CT$H)>Cl*KShVy4rnvP0Z8?}Z*4h&|1f^pNMc6--g9AMzMF;T^ zdxEUy+IsY03~>NTiO@2lBS(WyDLQStmhYno%7XP%~a zg|t=`Q(SSy6w-os!-I2sl2TAVdpUcr6!sO=uOix1Q2+A@lD3RUk?l9y00000NkvXX Hu0mjfGKYz; literal 0 HcmV?d00001 diff --git a/browser/extensions/mortar/host/pdf/chrome/style/images/toolbarButton-search@2x.png b/browser/extensions/mortar/host/pdf/chrome/style/images/toolbarButton-search@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..456b133248fd5310857db3e2b174730f6488371b GIT binary patch literal 653 zcmV;80&@L{P)kdg00071Nkl{bbX%$pI4<4dGmxrK3y9C*x5W092iXDWyS$NGul86ip{iUm* zph&8bY4&exY`K>GnEG>Dd62o*(mD5i_k8$VY~O9Br=aKc@csAZc|K$K(~H}AmbW;? zMG@u@&$EhH4=lw&FBkZQF-Ap9o)(M%&-~tka$b|+DChG;`IX(=w(){a#`%8{F<#$j z!3oAVrx=lttE;Wi(dg)E3%QJl{>ms%ms(Jfo#2eJ;_GOI4YjBgwXk)xuK0A4^|Gqy zg0)keVT6&~w6g^ktS^hRB{!`y&ScJIkb$(>x10P=3G|{G`Bfe0)oE%dg%qUCmd7}) z3^)d0=5pwC)whaONSkH-{G>RoP849(sVpfg@*ia0@S_s8gi(M+r$*3#0co@3D5sRA zh9wlxpwskt8fi$I&Gs>uWY z?@M2Nt`6yC6T6=Kx^U>Q*>AFmU}|CQ^VA2Q+|HIZgo*jpkAZhSx|3}@2xVraKJvzU wce9NLp>&q3J+HiVD_f9=9_zn#f#kpM2NJQXccvwU^Z)<=07*qoM6N<$g7779MF0Q* literal 0 HcmV?d00001 diff --git a/browser/extensions/mortar/host/pdf/chrome/style/images/toolbarButton-secondaryToolbarToggle-rtl@2x.png b/browser/extensions/mortar/host/pdf/chrome/style/images/toolbarButton-secondaryToolbarToggle-rtl@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..9d9bfa4f63d6a8ae5cbaafa2efadd2c16b48a3d8 GIT binary patch literal 456 zcmV;(0XP1MP)kdg0004xNkl&Eo0wtSl_%_c@)#x6@Nc{?`phhD&@IIESE8yJl-K zSNKF1)hUn5sOZvq+E~U7KGIR4efOfQ^}884Zquc$Li5&n8S%Rr1@7~nmioPL?ToDQ zyBRA(nRhf*zjpbgtnj-TYr+Ig8tT{lh2v82yBQlog$4`i$IR)&lJ~nAn?g*Tx2iXJ zWWVJ6ZpK)6$s20w>%%>JCF}K+&F|>X@+#3QMD!p6D zD}Un9_eZ=yRl_vval1L7BzJJ%w+GCj;t)~vyE&jFTPl6N#|&!ruPuHz2b3(`y7R*w zDyWF(Z1=l4pkzsLTk9rI70-y-?RRDWXwkZ{`gNuh)5IL`x)Kb@EZ>3!A!A$=*8}1L$Je~+C1~_8?0000)($5yeRDdaQJ-M|4aWbecXOn@Guga;V=~b z@A-fE|GC#2l&u(8kl8S=_WnQr|Ky7m5@rlc$ZVK&-~ZG9k3Lz%WyHXU%!Wxf{y*{m t;LXXb20&>fHXkdg0004zNklungn#PzRCDDkC`n~n-$qc_|=6h2P`+3##e4qF2k^f~&;~by5E|5SX@g5gF zM(V@4qrL*vqBy9 zmb;|w9+AI3)?7ThQODDyXUp*o57Q zk<^j>?O9%<$}VJ!)rCGJIWh710VUKc_nfi8UFd6Wq&>}xNGDg=Rgg%$YmQ;9d&EnM z>U;L=QAvw#VE4vGm!-&}`ugz1AsMo}H!?0DWI=tocW|Gi?CyR7|OZx}=1^9!Vb3w=BGynhq07*qoM6N<$f>h_@ AZvX%Q literal 0 HcmV?d00001 diff --git a/browser/extensions/mortar/host/pdf/chrome/style/images/toolbarButton-sidebarToggle-rtl.png b/browser/extensions/mortar/host/pdf/chrome/style/images/toolbarButton-sidebarToggle-rtl.png new file mode 100644 index 0000000000000000000000000000000000000000..6f85ec061ea167b1718d2865cfc1e53370f11b7a GIT binary patch literal 225 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!60wlNoGJgf6R(QHNhEy=Fy|9t%kby|+!~K<= z=lYs7_Vv%s4-^nwVp00$&6?)LeSG^I3$L4YTv-}i{FpUUBct%;PlbZ%#R_fqh7bDx z-F*1OP);pG_ExTK`(Chn5R(EeH9pPAiYO~EVU zg;AX0YiF?m$$s9yK0f=U*jm^Eqt`WV2>kpZ@LOBJCk~ccO~LBz65exMPv3u}^Njbh X)s)<0)dyODZf5Xw^>bP0l+XkKTSZs> literal 0 HcmV?d00001 diff --git a/browser/extensions/mortar/host/pdf/chrome/style/images/toolbarButton-sidebarToggle-rtl@2x.png b/browser/extensions/mortar/host/pdf/chrome/style/images/toolbarButton-sidebarToggle-rtl@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..291e006797fc7f0e84d297e952630c719fe6eeab GIT binary patch literal 344 zcmV-e0jK_nP)kdg0003WNklzGl0Qy}Zomti9P@(RHP^G#|@5~=y7$K!siiboRh zuIeZWmVB=G=|>dh^>JgTvTX_3{+V)mF&H3EjY7F_lyu+m(` z^5@!%E%1sIf<-iET7g&00wOY5YylCO%que#{I4g>zrp+oX2Hs@7Sy8){GqKd3+i8+ z(La(~<(6kl$Y?0+E!3g~6pVPYgsgOBL}3a(#z;E(drpoEc78P(r=PdlEn2u>S!eOM qa*)PSBkN>jxL^#qr<+KRA;34`pdw#DmQPIp0000%D&|RWz?R3S%8@5!h6F=s6G4bYqaW?MzjoCkpng6|s zXV#N@oaktrz{i#`@v)}nB&N==y>HnTvNCfR?M_V%Q~Gzyo8O~>Q6}#e!-ESy&GlaR zu`s+4fAKGyamxbfPlhLUim60w=5E=2>$USub|+s^j;X5ze{YfSp5y*9zfkTo Zkdg0003JNkl$GH;g-ye=E3m76~FBj%$^S3p8p9*q*pSbd*{>iVWHsKF0S;I z^gX4t*wuc`Tb2cq{&%P`@>A8<^(NL(>Ho}s&vtk+Fua<7E9$@Hp92jMpDMqu z1xm9(o%fjY|H;!pyNX@EE&si$I{ZV$w@o%SaA_c5db|2dDUjx3Fk~?LRQ7GXy(6+T z5KNBxck+Mrf8+l~|GU4fb8ui_Wk3UhZHZr2{6GKy)RPIe_L$OOB@D*mE*uUFn%Jcw efQf+-n=k;HAC|A!G+~AS0000kdg0009bNklO!qs?nO>`2G`bN+(=Af|T(S(@31n57R7<0pDb zv*kV(PVYe$9;O?e1ONJb6Yc5BKP*8IY3C>D9Hdz{8730PBZ^sbmXX%4tmg@4vsUTxntmOiRVB}nLnYi#??6;a}ZB3eP57p|1DS zXl@|>xwZ%;kT8Pz`Hz3Db$te9qxmP|1)H#*aDh5Lj}^X@`uu%;NfI2egk?GY;;*~a z@dUdWZu{mdd@#VUTEfucA z9}iccG?Fc|>vewjnSi)TqAu#895Qn;HT?c?WeWVQy!reZ_MEv1^(6j}Uth0B86;mF zdF6c{@Vju11>@nYT*bfq@_HT0Bh@l39~}OgKg2Iw!R~CvPMjyc=5Ky}tMIgxcku}S zhy2W6{6`&XB>Y8u|6sYo(^$Sr?Vhc2yC#0%M}7=@X>@SpAe2G6%8YVoT%t?Q{>}Sj lZHt=7g$$J$Igkx$P79l;1h5EfFlGP%002ovPDHLkV1kE3p%MT9 literal 0 HcmV?d00001 diff --git a/browser/extensions/mortar/host/pdf/chrome/style/images/toolbarButton-viewOutline-rtl.png b/browser/extensions/mortar/host/pdf/chrome/style/images/toolbarButton-viewOutline-rtl.png new file mode 100644 index 0000000000000000000000000000000000000000..aaa9430211e168a593f7e3bb486b3cac2be6556b GIT binary patch literal 177 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!60wlNoGJgf6Dm+~rLn;{8UeM)Zaui^FxJzhG z!|qKIVyq93J2V|v60i`ubLP&1jLj#z)YdH6_dNZQ&xuJ2GPazLv>Ue+?>6bs6%sUl z=5wmNX+x=cM?cG@Z*M=Wx3_WU$gY-DxaT(E)^*=hf#2W0ec7YVF<0AhkJ^MyIkdg0003|NklAE8oCqP6^J2Th#(YoIRh@jaAR$9RboY0TBz8UW*<_dt4i~Ob~DGonWs6N zDHmgSc1896;1BQmyd3=B*_8?FdJfKrFg8ajkxH`r#|ZrHE^89r%(@^&LP zaU~!CnZY3+ryJx4P}Ww4*H%5boJ10kK>!OHX7MpIn8%#kUo_liM?;42gn8)-kME$x z2MsMkajI;x=~Nv!fDG?7K@n$i6P3?9=x2F1U4N$!WpzoMSmnfG0tr9{|91dxvNb`P z@Pt@#g$O@Ts`FxkI-!h8tg$vKjo=3vo__&~$jeRS1pFY=P4m>Rm+nD{$E*W$KOT$2 zPbKiz-rYZ3=dFef!V_e{6&&9|na3K+gyQ5_WYNiu|AQk^Ne|QKRngBbo7l z(Z#9O-!Ih&DHL`j3;gi;Q|>%Z+C4MQ_`#CC(&&{H^BL7&PFp7vkdg0003JNkl4op8oHYTF~kcIgrY7-m_-=gLr9yLNJGQQw7)|`w#sbRZsr&`=k35ZXB7v& zrAY4&X89~W4uka=>r9+FQTkQ_0Xjv(1s6q9K=4z^2Y#M8=iEFR2+oy!;P`O)ls|M1 zIuQI&@&RmN2ixxJx2v>4V~zJtjVOI7`6Jp1XPnuIh2Wc#513n~OwGtZFjew_qkVIo zU$ytz5PVhoe+S{Q%8^qgO78)3#J^TUPB~o-R}j1l2nEaq#~hp3KyVxo3PjEPJUfe; z5d?1nLIL%=*r2h(o>L)8FG~K1Hs*i>8(RooD*3?jlzsNIZU(`=k`J^Rc{e+0HChnt dDXqo-;1^oHB*H?C%i{n5002ovPDHLkV1gg@i>m+t literal 0 HcmV?d00001 diff --git a/browser/extensions/mortar/host/pdf/chrome/style/images/toolbarButton-viewThumbnail.png b/browser/extensions/mortar/host/pdf/chrome/style/images/toolbarButton-viewThumbnail.png new file mode 100644 index 0000000000000000000000000000000000000000..584ba55881f9a192ddea645d6d8525bab205e289 GIT binary patch literal 185 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!60wlNoGJgf68a!PbLn;`1FBoz$1@g2!+&O99 zf!$e4*(j56dDxhu@!aQ2zL__%gK{mTjH$a~4^&m3zt@ zUaiuXsMG0KBR${yp3FT-zMKuGw=rB1}fgF!j@Pa jH|Ai1Yx4!(rbx9*stQkf2`I11D?x VwzoOr^jH7@002ovPDHLkV1mA0TJZn? literal 0 HcmV?d00001 diff --git a/browser/extensions/mortar/host/pdf/chrome/style/images/toolbarButton-zoomIn.png b/browser/extensions/mortar/host/pdf/chrome/style/images/toolbarButton-zoomIn.png new file mode 100644 index 0000000000000000000000000000000000000000..513d081bc2d2f3eb64801a5e8cde86ef4455829c GIT binary patch literal 136 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!60wlNoGJgf6{5@S9Ln;`P7g+!J&&MG-LGg5b zi0J(bTQ@BD_154)g5P7Bj9n-%)M8r~??+_T|q$+)-V kia5^-HX{oL#i@)8E52we&r^_U0~*cX>FVdQ&MBb@0BWi($p8QV literal 0 HcmV?d00001 diff --git a/browser/extensions/mortar/host/pdf/chrome/style/images/toolbarButton-zoomIn@2x.png b/browser/extensions/mortar/host/pdf/chrome/style/images/toolbarButton-zoomIn@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..d5d49d5ff107f01daa307bd0f89f98efc31eeec7 GIT binary patch literal 160 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE0wix1Z>k4U>7Fi*Ar*|t5-bTK29GBH`OkMs z;LzH(r}lQj`-ICFx#MpBpCa|4zl7P1x1vYwH*5P29X)2dhZ~*=Z`AwIt>?Q+{9j-O zLo#EO)0^fl@rko%`Z-H3Q%PTTaY>Is!UArQV{B|y4S@^{cTUS(`F>5r0%#?Jr>mdK II;Vst0FRG1RsaA1 literal 0 HcmV?d00001 diff --git a/browser/extensions/mortar/host/pdf/chrome/style/images/toolbarButton-zoomOut.png b/browser/extensions/mortar/host/pdf/chrome/style/images/toolbarButton-zoomOut.png new file mode 100644 index 0000000000000000000000000000000000000000..156c26b941c12a13130e7a7c181d13300a85de89 GIT binary patch literal 88 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!60wlNoGJgf6mdKI;Vst01!SC>;M1& literal 0 HcmV?d00001 diff --git a/browser/extensions/mortar/host/pdf/chrome/style/images/toolbarButton-zoomOut@2x.png b/browser/extensions/mortar/host/pdf/chrome/style/images/toolbarButton-zoomOut@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..959e1919d5a7a83a9c319de4d65ddaf6dc6c2763 GIT binary patch literal 109 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE0wix1Z>k4UCY~;iAr*|t5x6B zz{uFh!Ff-a?~&O9p+bS}jK@2hEqD_O6oi80fl3Ux7>c+~q1|%O$WD@{VVV*9IAr*|t6(1k5>aAfpGT9*~ zXOfab4D%87#veSpl*$zRm>xL?oHRbsHKXB%c*k}H6$4SxhZAg?^X4iGtUtb-qb;)0 qg018G0wld=oSO}#+&x_!LpZJ{CnQuDzHAj@)~YCc zcJ!pUslH1WIk z$<$8#)-<<4$>7e1Lt^WdBv>MS0tC+_?dkdu(KF##vY``K|4|Ok95LarEgxHDk6!z_ xe}ZGN#WGb9Hnl@SJ`EdME-hi&#=_6Qka7RV*Qd`VTY>g4c)I$ztaD0e0sz~DGV1^U literal 0 HcmV?d00001 diff --git a/browser/extensions/mortar/host/pdf/chrome/style/images/treeitem-expanded.png b/browser/extensions/mortar/host/pdf/chrome/style/images/treeitem-expanded.png new file mode 100644 index 0000000000000000000000000000000000000000..c8d557351cd2fc80c3abd4b19e52924cd74780d5 GIT binary patch literal 125 zcmeAS@N?(olHy`uVBq!ia0vp^oFL4>0wld=oSO}#Ts&PILn;`P75MhNs4Zk;-DbE) zpt_L5GvPZo^g4)z4*}Q$iB}$ABb+ literal 0 HcmV?d00001 diff --git a/browser/extensions/mortar/host/pdf/chrome/style/images/treeitem-expanded@2x.png b/browser/extensions/mortar/host/pdf/chrome/style/images/treeitem-expanded@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..3b3b6103b356200d05caf7fa692cadf2c1e89043 GIT binary patch literal 172 zcmeAS@N?(olHy`uVBq!ia0vp^LLkh+0wn(&ce?|mialK%Ln;`P7Z_I div { + cursor: none; +} + +.pdfPresentationMode.pdfPresentationModeControls > *, +.pdfPresentationMode.pdfPresentationModeControls .textLayer > div { + cursor: default; +} + +/* outer/inner center provides horizontal center */ +.outerCenter { + pointer-events: none; + position: relative; +} +html[dir='ltr'] .outerCenter { + float: right; + right: 50%; +} +html[dir='rtl'] .outerCenter { + float: left; + left: 50%; +} +.innerCenter { + pointer-events: auto; + position: relative; +} +html[dir='ltr'] .innerCenter { + float: right; + right: -50%; +} +html[dir='rtl'] .innerCenter { + float: left; + left: -50%; +} + +#outerContainer { + width: 100%; + height: 100%; + position: relative; +} + +#sidebarContainer { + position: absolute; + top: 0; + bottom: 0; + width: 200px; + visibility: hidden; + transition-duration: 200ms; + transition-timing-function: ease; + +} +html[dir='ltr'] #sidebarContainer { + transition-property: left; + left: -200px; +} +html[dir='rtl'] #sidebarContainer { + transition-property: right; + right: -200px; +} + +#outerContainer.sidebarMoving > #sidebarContainer, +#outerContainer.sidebarOpen > #sidebarContainer { + visibility: visible; +} +html[dir='ltr'] #outerContainer.sidebarOpen > #sidebarContainer { + left: 0px; +} +html[dir='rtl'] #outerContainer.sidebarOpen > #sidebarContainer { + right: 0px; +} + +#mainContainer { + position: absolute; + top: 0; + right: 0; + bottom: 0; + left: 0; + min-width: 320px; + transition-duration: 200ms; + transition-timing-function: ease; +} +html[dir='ltr'] #outerContainer.sidebarOpen > #mainContainer { + transition-property: left; + left: 200px; +} +html[dir='rtl'] #outerContainer.sidebarOpen > #mainContainer { + transition-property: right; + right: 200px; +} + +#sidebarContent { + top: var(--toolbar-height); + bottom: 0; + overflow: auto; + position: absolute; + width: 200px; + background-color: hsla(0,0%,0%,.1); +} +html[dir='ltr'] #sidebarContent { + left: 0; + box-shadow: inset -1px 0 0 hsla(0,0%,0%,.25); +} +html[dir='rtl'] #sidebarContent { + right: 0; + box-shadow: inset 1px 0 0 hsla(0,0%,0%,.25); +} + +#viewerContainer { + overflow: hidden; + position: absolute; + top: var(--toolbar-height); + right: 0; + bottom: 0; + left: 0; + outline: none; +} +html[dir='ltr'] #viewerContainer { + box-shadow: inset 1px 0 0 hsla(0,0%,100%,.05); +} +html[dir='rtl'] #viewerContainer { + box-shadow: inset -1px 0 0 hsla(0,0%,100%,.05); +} + +#canvasContainer, #viewportController { + position: absolute; + left: 0; + top: 2px; + right: 0; + bottom: 0; + outline: none; + overflow: hidden; +} + +#canvasContainer canvas { + display: block; + position: absolute; + left: 0; + top: 0; +} + +#viewportController { + overflow: auto; +} + +#sizer { + margin: 0 auto; +} + +.toolbar { + position: relative; + left: 0; + right: 0; + z-index: 9999; + cursor: default; +} + +#toolbarContainer { + width: 100%; +} + +#toolbarSidebar { + width: 200px; + height: var(--toolbar-height); + background-color: #424242; /* fallback */ + background-image: url(images/texture.png), + linear-gradient(hsla(0,0%,30%,.99), hsla(0,0%,25%,.95)); +} +html[dir='ltr'] #toolbarSidebar { + box-shadow: inset -1px 0 0 rgba(0, 0, 0, 0.25), + inset 0 -1px 0 hsla(0,0%,100%,.05), + 0 1px 0 hsla(0,0%,0%,.15), + 0 0 1px hsla(0,0%,0%,.1); +} +html[dir='rtl'] #toolbarSidebar { + box-shadow: inset 1px 0 0 rgba(0, 0, 0, 0.25), + inset 0 1px 0 hsla(0,0%,100%,.05), + 0 1px 0 hsla(0,0%,0%,.15), + 0 0 1px hsla(0,0%,0%,.1); +} + +#toolbarContainer, .findbar, .secondaryToolbar { + position: relative; + height: var(--toolbar-height); + background-color: #474747; /* fallback */ + background-image: url(images/texture.png), + linear-gradient(hsla(0,0%,32%,.99), hsla(0,0%,27%,.95)); +} +html[dir='ltr'] #toolbarContainer, +html[dir='ltr'] .findbar, +html[dir='ltr'] .secondaryToolbar, +html[dir='ltr'] .polyfillDropdown { + box-shadow: inset 1px 0 0 hsla(0,0%,100%,.08), + inset 0 1px 1px hsla(0,0%,0%,.15), + inset 0 -1px 0 hsla(0,0%,100%,.05), + 0 1px 0 hsla(0,0%,0%,.15), + 0 1px 1px hsla(0,0%,0%,.1); +} +html[dir='rtl'] #toolbarContainer, +html[dir='rtl'] .findbar, +html[dir='rtl'] .secondaryToolbar, +html[dir='rtl'] .polyfillDropdown { + box-shadow: inset -1px 0 0 hsla(0,0%,100%,.08), + inset 0 1px 1px hsla(0,0%,0%,.15), + inset 0 -1px 0 hsla(0,0%,100%,.05), + 0 1px 0 hsla(0,0%,0%,.15), + 0 1px 1px hsla(0,0%,0%,.1); +} + +#toolbarViewer { + height: var(--toolbar-height); +} + +#loadingBar { + position: relative; + width: 100%; + height: 4px; + background-color: #333; + border-bottom: 1px solid #333; +} + +#loadingBar .progress { + position: absolute; + top: 0; + left: 0; + width: 0%; + height: 100%; + background-color: #ddd; + overflow: hidden; + transition: width 200ms; +} + +@keyframes progressIndeterminate { + 0% { left: -142px; } + 100% { left: 0; } +} + +#loadingBar .progress.indeterminate { + background-color: #999; + transition: none; +} + +#loadingBar .progress.indeterminate .glimmer { + position: absolute; + top: 0; + left: 0; + height: 100%; + width: calc(100% + 150px); + + background: repeating-linear-gradient(135deg, + #bbb 0, #999 5px, + #999 45px, #ddd 55px, + #ddd 95px, #bbb 100px); + + animation: progressIndeterminate 950ms linear infinite; +} + +.findbar, .secondaryToolbar { + top: var(--toolbar-height); + position: absolute; + z-index: 10000; + height: 32px; + + min-width: 16px; + padding: 0px 6px 0px 6px; + margin: 4px 2px 4px 2px; + color: hsl(0,0%,85%); + font-size: 12px; + line-height: 14px; + text-align: left; + cursor: default; +} + +html[dir='ltr'] .findbar { + left: 68px; +} + +html[dir='rtl'] .findbar { + right: 68px; +} + +.findbar label { + -moz-user-select: none; +} + +.polyfillDropdown { + position: absolute; + z-index: 10000; + color: hsl(0,0%,85%); + padding: 4px 4px; + min-width: 112px; + max-height: calc(100vh - var(--toolbar-height) - 10px); + overflow-x: hidden; + overflow-y: auto; + transform: translateX(-1px); + border: 1px solid hsla(0,0%,0%,.5); + border-radius: 2px; + box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3); + background-color: #474747; /* fallback */ + background-image: url(images/texture.png), + linear-gradient(hsla(0,0%,32%,.99), hsla(0,0%,27%,.95)); + -moz-user-select: none; +} + +.polyfillDropdown > .polyfillOption { + min-width: 0; + padding: 1px 6px; + line-height: 18px; + white-space: nowrap; +} + +#findInput[data-status="pending"] { + background-image: url(images/loading-small.png); + background-repeat: no-repeat; + background-position: right; +} +html[dir='rtl'] #findInput[data-status="pending"] { + background-position: left; +} + +.secondaryToolbar { + padding: 6px; + height: auto; + z-index: 30000; +} +html[dir='ltr'] .secondaryToolbar { + right: 4px; +} +html[dir='rtl'] .secondaryToolbar { + left: 4px; +} + +#secondaryToolbarButtonContainer { + max-width: 200px; + max-height: calc(100vh - var(--toolbar-height) - 30px); + overflow-y: auto; + margin-bottom: -4px; +} + +.doorHanger, +.doorHangerRight { + border: 1px solid hsla(0,0%,0%,.5); + border-radius: 2px; + box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3); +} +.doorHanger:after, .doorHanger:before, +.doorHangerRight:after, .doorHangerRight:before { + bottom: 100%; + border: solid transparent; + content: " "; + height: 0; + width: 0; + position: absolute; + pointer-events: none; +} +.doorHanger:after, +.doorHangerRight:after { + border-bottom-color: hsla(0,0%,32%,.99); + border-width: 8px; +} +.doorHanger:before, +.doorHangerRight:before { + border-bottom-color: hsla(0,0%,0%,.5); + border-width: 9px; +} + +html[dir='ltr'] .doorHanger:after, +html[dir='rtl'] .doorHangerRight:after { + left: 13px; + margin-left: -8px; +} + +html[dir='ltr'] .doorHanger:before, +html[dir='rtl'] .doorHangerRight:before { + left: 13px; + margin-left: -9px; +} + +html[dir='rtl'] .doorHanger:after, +html[dir='ltr'] .doorHangerRight:after { + right: 13px; + margin-right: -8px; +} + +html[dir='rtl'] .doorHanger:before, +html[dir='ltr'] .doorHangerRight:before { + right: 13px; + margin-right: -9px; +} + +#findResultsCount { + background-color: hsl(0, 0%, 85%); + color: hsl(0, 0%, 32%); + text-align: center; + padding: 3px 4px; +} + +#findMsg { + font-style: italic; + color: #A6B7D0; +} + +#findInput.notFound { + background-color: rgb(255, 102, 102); +} + +html[dir='ltr'] #toolbarViewerLeft { + margin-left: -1px; +} +html[dir='rtl'] #toolbarViewerRight { + margin-right: -1px; +} + +html[dir='ltr'] #toolbarViewerLeft, +html[dir='rtl'] #toolbarViewerRight { + position: absolute; + top: 0; + left: 0; +} +html[dir='ltr'] #toolbarViewerRight, +html[dir='rtl'] #toolbarViewerLeft { + position: absolute; + top: 0; + right: 0; +} +html[dir='ltr'] #toolbarViewerLeft > *, +html[dir='ltr'] #toolbarViewerMiddle > *, +html[dir='ltr'] #toolbarViewerRight > *, +html[dir='ltr'] .findbar > * { + position: relative; + float: left; +} +html[dir='rtl'] #toolbarViewerLeft > *, +html[dir='rtl'] #toolbarViewerMiddle > *, +html[dir='rtl'] #toolbarViewerRight > *, +html[dir='rtl'] .findbar > * { + position: relative; + float: right; +} + +html[dir='ltr'] .splitToolbarButton { + margin: 3px 2px 4px 0; + display: inline-block; +} +html[dir='rtl'] .splitToolbarButton { + margin: 3px 0 4px 2px; + display: inline-block; +} +html[dir='ltr'] .splitToolbarButton > .toolbarButton { + border-radius: 0; + float: left; +} +html[dir='rtl'] .splitToolbarButton > .toolbarButton { + border-radius: 0; + float: right; +} + +.toolbarButton, +.secondaryToolbarButton, +.overlayButton { + border: 0 none; + background: none; + width: 32px; + height: 25px; +} + +.toolbarButton > span { + display: inline-block; + width: 0; + height: 0; + overflow: hidden; +} + +.toolbarButton[disabled], +.secondaryToolbarButton[disabled], +.overlayButton[disabled] { + opacity: .5; +} + +.toolbarButton.group { + margin-right: 0; +} + +.splitToolbarButton.toggled .toolbarButton { + margin: 0; +} + +.splitToolbarButton:hover > .toolbarButton, +.splitToolbarButton:focus > .toolbarButton, +.splitToolbarButton.toggled > .toolbarButton, +.toolbarButton.textButton { + background-color: hsla(0,0%,0%,.12); + background-image: linear-gradient(hsla(0,0%,100%,.05), hsla(0,0%,100%,0)); + background-clip: padding-box; + border: 1px solid hsla(0,0%,0%,.35); + border-color: hsla(0,0%,0%,.32) hsla(0,0%,0%,.38) hsla(0,0%,0%,.42); + box-shadow: 0 1px 0 hsla(0,0%,100%,.05) inset, + 0 0 1px hsla(0,0%,100%,.15) inset, + 0 1px 0 hsla(0,0%,100%,.05); + transition-property: background-color, border-color, box-shadow; + transition-duration: 150ms; + transition-timing-function: ease; + +} +.splitToolbarButton > .toolbarButton:hover, +.splitToolbarButton > .toolbarButton:focus, +.dropdownToolbarButton:hover, +.overlayButton:hover, +.overlayButton:focus, +.toolbarButton.textButton:hover, +.toolbarButton.textButton:focus { + background-color: hsla(0,0%,0%,.2); + box-shadow: 0 1px 0 hsla(0,0%,100%,.05) inset, + 0 0 1px hsla(0,0%,100%,.15) inset, + 0 0 1px hsla(0,0%,0%,.05); + z-index: 199; +} +.splitToolbarButton > .toolbarButton { + position: relative; +} +html[dir='ltr'] .splitToolbarButton > .toolbarButton:first-child, +html[dir='rtl'] .splitToolbarButton > .toolbarButton:last-child { + position: relative; + margin: 0; + margin-right: -1px; + border-top-left-radius: 2px; + border-bottom-left-radius: 2px; + border-right-color: transparent; +} +html[dir='ltr'] .splitToolbarButton > .toolbarButton:last-child, +html[dir='rtl'] .splitToolbarButton > .toolbarButton:first-child { + position: relative; + margin: 0; + margin-left: -1px; + border-top-right-radius: 2px; + border-bottom-right-radius: 2px; + border-left-color: transparent; +} +.splitToolbarButtonSeparator { + padding: 8px 0; + width: 1px; + background-color: hsla(0,0%,0%,.5); + z-index: 99; + box-shadow: 0 0 0 1px hsla(0,0%,100%,.08); + display: inline-block; + margin: 5px 0; +} +html[dir='ltr'] .splitToolbarButtonSeparator { + float: left; +} +html[dir='rtl'] .splitToolbarButtonSeparator { + float: right; +} +.splitToolbarButton:hover > .splitToolbarButtonSeparator, +.splitToolbarButton.toggled > .splitToolbarButtonSeparator { + padding: 12px 0; + margin: 1px 0; + box-shadow: 0 0 0 1px hsla(0,0%,100%,.03); + transition-property: padding; + transition-duration: 10ms; + transition-timing-function: ease; +} + +.toolbarButton, +.dropdownToolbarButton, +.secondaryToolbarButton, +.overlayButton, +.polyfillOption { + min-width: 16px; + padding: 2px 6px 0; + border: 1px solid transparent; + border-radius: 2px; + color: hsla(0,0%,100%,.8); + font-size: 12px; + line-height: 14px; + -moz-user-select: none; + cursor: default; + transition-property: background-color, border-color, box-shadow; + transition-duration: 150ms; + transition-timing-function: ease; +} + +html[dir='ltr'] .toolbarButton, +html[dir='ltr'] .overlayButton, +html[dir='ltr'] .dropdownToolbarButton { + margin: 3px 2px 4px 0; +} +html[dir='rtl'] .toolbarButton, +html[dir='rtl'] .overlayButton, +html[dir='rtl'] .dropdownToolbarButton { + margin: 3px 0 4px 2px; +} + +.toolbarButton:hover, +.toolbarButton:focus, +.dropdownToolbarButton, +.overlayButton, +.secondaryToolbarButton:hover, +.secondaryToolbarButton:focus, +.polyfillOption:hover, +.polyfillOption:focus { + background-color: hsla(0,0%,0%,.12); + background-image: linear-gradient(hsla(0,0%,100%,.05), hsla(0,0%,100%,0)); + background-clip: padding-box; + border: 1px solid hsla(0,0%,0%,.35); + border-color: hsla(0,0%,0%,.32) hsla(0,0%,0%,.38) hsla(0,0%,0%,.42); + box-shadow: 0 1px 0 hsla(0,0%,100%,.05) inset, + 0 0 1px hsla(0,0%,100%,.15) inset, + 0 1px 0 hsla(0,0%,100%,.05); +} + +.toolbarButton:hover:active, +.overlayButton:hover:active, +.dropdownToolbarButton:hover:active, +.secondaryToolbarButton:hover:active, +.polyfillOption:hover:active { + background-color: hsla(0,0%,0%,.2); + background-image: linear-gradient(hsla(0,0%,100%,.05), hsla(0,0%,100%,0)); + border-color: hsla(0,0%,0%,.35) hsla(0,0%,0%,.4) hsla(0,0%,0%,.45); + box-shadow: 0 1px 1px hsla(0,0%,0%,.1) inset, + 0 0 1px hsla(0,0%,0%,.2) inset, + 0 1px 0 hsla(0,0%,100%,.05); + transition-property: background-color, border-color, box-shadow; + transition-duration: 10ms; + transition-timing-function: linear; +} + +.toolbarButton.toggled, +.splitToolbarButton.toggled > .toolbarButton.toggled, +.secondaryToolbarButton.toggled, +.polyfillOption.toggled { + background-color: hsla(0,0%,0%,.3); + background-image: linear-gradient(hsla(0,0%,100%,.05), hsla(0,0%,100%,0)); + border-color: hsla(0,0%,0%,.4) hsla(0,0%,0%,.45) hsla(0,0%,0%,.5); + box-shadow: 0 1px 1px hsla(0,0%,0%,.1) inset, + 0 0 1px hsla(0,0%,0%,.2) inset, + 0 1px 0 hsla(0,0%,100%,.05); + transition-property: background-color, border-color, box-shadow; + transition-duration: 10ms; + transition-timing-function: linear; +} + +.toolbarButton.toggled:hover:active, +.splitToolbarButton.toggled > .toolbarButton.toggled:hover:active, +.secondaryToolbarButton.toggled:hover:active, +.polyfillOption.toggled:hover { + background-color: hsla(0,0%,0%,.4); + border-color: hsla(0,0%,0%,.4) hsla(0,0%,0%,.5) hsla(0,0%,0%,.55); + box-shadow: 0 1px 1px hsla(0,0%,0%,.2) inset, + 0 0 1px hsla(0,0%,0%,.3) inset, + 0 1px 0 hsla(0,0%,100%,.05); +} + +.dropdownToolbarButton { + width: 120px; + max-width: 120px; + padding: 0; + overflow: hidden; + background: url(images/toolbarButton-menuArrows.png) no-repeat; +} +html[dir='ltr'] .dropdownToolbarButton { + background-position: 95%; +} +html[dir='rtl'] .dropdownToolbarButton { + background-position: 5%; +} + +.dropdownToolbarButton > select { + min-width: 140px; + font-size: 12px; + color: hsl(0,0%,95%); + margin: 0; + padding: 3px 2px 2px; + border: none; + background: transparent; +} + +.dropdownToolbarButton > select > option { + background: hsl(0,0%,24%); +} + +#customScaleOption { + display: none; +} + +#pageWidthOption { + border-bottom: 1px rgba(255, 255, 255, .5) solid; +} + +html[dir='ltr'] .splitToolbarButton:first-child, +html[dir='ltr'] .toolbarButton:first-child, +html[dir='rtl'] .splitToolbarButton:last-child, +html[dir='rtl'] .toolbarButton:last-child { + margin-left: 4px; +} +html[dir='ltr'] .splitToolbarButton:last-child, +html[dir='ltr'] .toolbarButton:last-child, +html[dir='rtl'] .splitToolbarButton:first-child, +html[dir='rtl'] .toolbarButton:first-child { + margin-right: 4px; +} + +.toolbarButtonSpacer { + width: 30px; + display: inline-block; + height: 1px; +} + +.toolbarButtonFlexibleSpacer { + -moz-box-flex: 1; + min-width: 30px; +} + +html[dir='ltr'] #findPrevious { + margin-left: 3px; +} +html[dir='ltr'] #findNext { + margin-right: 3px; +} + +html[dir='rtl'] #findPrevious { + margin-right: 3px; +} +html[dir='rtl'] #findNext { + margin-left: 3px; +} + +.toolbarButton::before, +.secondaryToolbarButton::before { + /* All matching images have a size of 16x16 + * All relevant containers have a size of 32x25 */ + position: absolute; + display: inline-block; + top: 4px; + left: 7px; +} + +html[dir="ltr"] .secondaryToolbarButton::before { + left: 4px; +} +html[dir="rtl"] .secondaryToolbarButton::before { + right: 4px; +} + +html[dir='ltr'] .toolbarButton#sidebarToggle::before { + content: url(images/toolbarButton-sidebarToggle.png); +} +html[dir='rtl'] .toolbarButton#sidebarToggle::before { + content: url(images/toolbarButton-sidebarToggle-rtl.png); +} + +html[dir='ltr'] .toolbarButton#secondaryToolbarToggle::before { + content: url(images/toolbarButton-secondaryToolbarToggle.png); +} +html[dir='rtl'] .toolbarButton#secondaryToolbarToggle::before { + content: url(images/toolbarButton-secondaryToolbarToggle-rtl.png); +} + +html[dir='ltr'] .toolbarButton.findPrevious::before { + content: url(images/findbarButton-previous.png); +} +html[dir='rtl'] .toolbarButton.findPrevious::before { + content: url(images/findbarButton-previous-rtl.png); +} + +html[dir='ltr'] .toolbarButton.findNext::before { + content: url(images/findbarButton-next.png); +} +html[dir='rtl'] .toolbarButton.findNext::before { + content: url(images/findbarButton-next-rtl.png); +} + +html[dir='ltr'] .toolbarButton.pageUp::before { + content: url(images/toolbarButton-pageUp.png); +} +html[dir='rtl'] .toolbarButton.pageUp::before { + content: url(images/toolbarButton-pageUp-rtl.png); +} + +html[dir='ltr'] .toolbarButton.pageDown::before { + content: url(images/toolbarButton-pageDown.png); +} +html[dir='rtl'] .toolbarButton.pageDown::before { + content: url(images/toolbarButton-pageDown-rtl.png); +} + +.toolbarButton.zoomOut::before { + content: url(images/toolbarButton-zoomOut.png); +} + +.toolbarButton.zoomIn::before { + content: url(images/toolbarButton-zoomIn.png); +} + +.toolbarButton.presentationMode::before, +.secondaryToolbarButton.presentationMode::before { + content: url(images/toolbarButton-presentationMode.png); +} + +.toolbarButton.print::before, +.secondaryToolbarButton.print::before { + content: url(images/toolbarButton-print.png); +} + +.toolbarButton.openFile::before, +.secondaryToolbarButton.openFile::before { + content: url(images/toolbarButton-openFile.png); +} + +.toolbarButton.download::before, +.secondaryToolbarButton.download::before { + content: url(images/toolbarButton-download.png); +} + +.toolbarButton.bookmark, +.secondaryToolbarButton.bookmark { + box-sizing: border-box; + outline: none; + padding-top: 4px; + text-decoration: none; +} +.secondaryToolbarButton.bookmark { + padding-top: 5px; +} + +.bookmark[href='#'] { + opacity: .5; + pointer-events: none; +} + +.toolbarButton.bookmark::before, +.secondaryToolbarButton.bookmark::before { + content: url(images/toolbarButton-bookmark.png); +} + +#viewThumbnail.toolbarButton::before { + content: url(images/toolbarButton-viewThumbnail.png); +} + +html[dir="ltr"] #viewOutline.toolbarButton::before { + content: url(images/toolbarButton-viewOutline.png); +} +html[dir="rtl"] #viewOutline.toolbarButton::before { + content: url(images/toolbarButton-viewOutline-rtl.png); +} + +#viewAttachments.toolbarButton::before { + content: url(images/toolbarButton-viewAttachments.png); +} + +#viewFind.toolbarButton::before { + content: url(images/toolbarButton-search.png); +} + +.secondaryToolbarButton { + position: relative; + margin: 0 0 4px 0; + padding: 3px 0 1px 0; + height: auto; + min-height: 25px; + width: auto; + min-width: 100%; + white-space: normal; +} +html[dir="ltr"] .secondaryToolbarButton { + padding-left: 24px; + text-align: left; +} +html[dir="rtl"] .secondaryToolbarButton { + padding-right: 24px; + text-align: right; +} +html[dir="ltr"] .secondaryToolbarButton.bookmark { + padding-left: 27px; +} +html[dir="rtl"] .secondaryToolbarButton.bookmark { + padding-right: 27px; +} + +html[dir="ltr"] .secondaryToolbarButton > span { + padding-right: 4px; +} +html[dir="rtl"] .secondaryToolbarButton > span { + padding-left: 4px; +} + +.secondaryToolbarButton.firstPage::before { + content: url(images/secondaryToolbarButton-firstPage.png); +} + +.secondaryToolbarButton.lastPage::before { + content: url(images/secondaryToolbarButton-lastPage.png); +} + +.secondaryToolbarButton.rotateCcw::before { + content: url(images/secondaryToolbarButton-rotateCcw.png); +} + +.secondaryToolbarButton.rotateCw::before { + content: url(images/secondaryToolbarButton-rotateCw.png); +} + +.secondaryToolbarButton.handTool::before { + content: url(images/secondaryToolbarButton-handTool.png); +} + +.secondaryToolbarButton.documentProperties::before { + content: url(images/secondaryToolbarButton-documentProperties.png); +} + +.verticalToolbarSeparator { + display: block; + padding: 8px 0; + margin: 8px 4px; + width: 1px; + background-color: hsla(0,0%,0%,.5); + box-shadow: 0 0 0 1px hsla(0,0%,100%,.08); +} +html[dir='ltr'] .verticalToolbarSeparator { + margin-left: 2px; +} +html[dir='rtl'] .verticalToolbarSeparator { + margin-right: 2px; +} + +.horizontalToolbarSeparator { + display: block; + margin: 0 0 4px 0; + height: 1px; + width: 100%; + background-color: hsla(0,0%,0%,.5); + box-shadow: 0 0 0 1px hsla(0,0%,100%,.08); +} + +.toolbarField { + padding: 3px 6px; + margin: 4px 0 4px 0; + border: 1px solid transparent; + border-radius: 2px; + background-color: hsla(0,0%,100%,.09); + background-image: linear-gradient(hsla(0,0%,100%,.05), hsla(0,0%,100%,0)); + background-clip: padding-box; + border: 1px solid hsla(0,0%,0%,.35); + border-color: hsla(0,0%,0%,.32) hsla(0,0%,0%,.38) hsla(0,0%,0%,.42); + box-shadow: 0 1px 0 hsla(0,0%,0%,.05) inset, + 0 1px 0 hsla(0,0%,100%,.05); + color: hsl(0,0%,95%); + font-size: 12px; + line-height: 14px; + outline-style: none; + transition-property: background-color, border-color, box-shadow; + transition-duration: 150ms; + transition-timing-function: ease; +} + +.toolbarField[type=checkbox] { + display: inline-block; + margin: 8px 0px; +} + +.toolbarField.pageNumber { + -moz-appearance: textfield; /* hides the spinner in moz */ + min-width: 16px; + text-align: right; + width: 40px; +} + +.toolbarField.pageNumber.visiblePageIsLoading { + background-image: url(images/loading-small.png); + background-repeat: no-repeat; + background-position: 1px; +} + +.toolbarField:hover { + background-color: hsla(0,0%,100%,.11); + border-color: hsla(0,0%,0%,.4) hsla(0,0%,0%,.43) hsla(0,0%,0%,.45); +} + +.toolbarField:focus { + background-color: hsla(0,0%,100%,.15); + border-color: hsla(204,100%,65%,.8) hsla(204,100%,65%,.85) hsla(204,100%,65%,.9); +} + +.toolbarLabel { + min-width: 16px; + padding: 3px 6px 3px 2px; + margin: 4px 2px 4px 0; + border: 1px solid transparent; + border-radius: 2px; + color: hsl(0,0%,85%); + font-size: 12px; + line-height: 14px; + text-align: left; + -moz-user-select: none; + cursor: default; +} + +#thumbnailView { + position: absolute; + width: 120px; + top: 0; + bottom: 0; + padding: 10px 40px 0; + overflow: auto; +} + +.thumbnail { + float: left; + margin-bottom: 5px; +} + +#thumbnailView > a:last-of-type > .thumbnail { + margin-bottom: 10px; +} + +#thumbnailView > a:last-of-type > .thumbnail:not([data-loaded]) { + margin-bottom: 9px; +} + +.thumbnail:not([data-loaded]) { + border: 1px dashed rgba(255, 255, 255, 0.5); + margin: -1px -1px 4px -1px; +} + +.thumbnailImage { + border: 1px solid transparent; + box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.5), 0 2px 8px rgba(0, 0, 0, 0.3); + opacity: 0.8; + z-index: 99; + background-color: white; + background-clip: content-box; +} + +.thumbnailSelectionRing { + border-radius: 2px; + padding: 7px; +} + +a:focus > .thumbnail > .thumbnailSelectionRing > .thumbnailImage, +.thumbnail:hover > .thumbnailSelectionRing > .thumbnailImage { + opacity: .9; +} + +a:focus > .thumbnail > .thumbnailSelectionRing, +.thumbnail:hover > .thumbnailSelectionRing { + background-color: hsla(0,0%,100%,.15); + background-image: linear-gradient(hsla(0,0%,100%,.05), hsla(0,0%,100%,0)); + background-clip: padding-box; + box-shadow: 0 1px 0 hsla(0,0%,100%,.05) inset, + 0 0 1px hsla(0,0%,100%,.2) inset, + 0 0 1px hsla(0,0%,0%,.2); + color: hsla(0,0%,100%,.9); +} + +.thumbnail.selected > .thumbnailSelectionRing > .thumbnailImage { + box-shadow: 0 0 0 1px hsla(0,0%,0%,.5); + opacity: 1; +} + +.thumbnail.selected > .thumbnailSelectionRing { + background-color: hsla(0,0%,100%,.3); + background-image: linear-gradient(hsla(0,0%,100%,.05), hsla(0,0%,100%,0)); + background-clip: padding-box; + box-shadow: 0 1px 0 hsla(0,0%,100%,.05) inset, + 0 0 1px hsla(0,0%,100%,.1) inset, + 0 0 1px hsla(0,0%,0%,.2); + color: hsla(0,0%,100%,1); +} + +#outlineView, +#attachmentsView { + position: absolute; + width: 192px; + top: 0; + bottom: 0; + overflow: auto; + -moz-user-select: none; +} + +#outlineView { + padding: 4px 4px 0; +} +#attachmentsView { + padding: 3px 4px 0; +} + +html[dir='ltr'] .outlineWithDeepNesting > .outlineItem, +html[dir='ltr'] .outlineItem > .outlineItems { + margin-left: 20px; +} + +html[dir='rtl'] .outlineWithDeepNesting > .outlineItem, +html[dir='rtl'] .outlineItem > .outlineItems { + margin-right: 20px; +} + +.outlineItem > a, +.attachmentsItem > button { + text-decoration: none; + display: inline-block; + min-width: 95%; + min-width: calc(100% - 4px); /* Subtract the right padding (left, in RTL mode) + of the container. */ + height: auto; + margin-bottom: 1px; + border-radius: 2px; + color: hsla(0,0%,100%,.8); + font-size: 13px; + line-height: 15px; + -moz-user-select: none; + white-space: normal; +} + +.attachmentsItem > button { + border: 0 none; + background: none; + cursor: pointer; + width: 100%; +} + +html[dir='ltr'] .outlineItem > a { + padding: 2px 0 5px 4px; +} +html[dir='ltr'] .attachmentsItem > button { + padding: 2px 0 3px 7px; + text-align: left; +} + +html[dir='rtl'] .outlineItem > a { + padding: 2px 4px 5px 0; +} +html[dir='rtl'] .attachmentsItem > button { + padding: 2px 7px 3px 0; + text-align: right; +} + +.outlineItemToggler { + position: relative; + height: 0; + width: 0; + color: hsla(0,0%,100%,.5); +} +.outlineItemToggler::before { + content: url(images/treeitem-expanded.png); + display: inline-block; + position: absolute; +} +html[dir='ltr'] .outlineItemToggler.outlineItemsHidden::before { + content: url(images/treeitem-collapsed.png); +} +html[dir='rtl'] .outlineItemToggler.outlineItemsHidden::before { + content: url(images/treeitem-collapsed-rtl.png); +} +.outlineItemToggler.outlineItemsHidden ~ .outlineItems { + display: none; +} +html[dir='ltr'] .outlineItemToggler { + float: left; +} +html[dir='rtl'] .outlineItemToggler { + float: right; +} +html[dir='ltr'] .outlineItemToggler::before { + right: 4px; +} +html[dir='rtl'] .outlineItemToggler::before { + left: 4px; +} + +.outlineItemToggler:hover, +.outlineItemToggler:hover + a, +.outlineItemToggler:hover ~ .outlineItems, +.outlineItem > a:hover, +.attachmentsItem > button:hover { + background-color: hsla(0,0%,100%,.02); + background-image: linear-gradient(hsla(0,0%,100%,.05), hsla(0,0%,100%,0)); + background-clip: padding-box; + box-shadow: 0 1px 0 hsla(0,0%,100%,.05) inset, + 0 0 1px hsla(0,0%,100%,.2) inset, + 0 0 1px hsla(0,0%,0%,.2); + border-radius: 2px; + color: hsla(0,0%,100%,.9); +} + +.outlineItem.selected { + background-color: hsla(0,0%,100%,.08); + background-image: linear-gradient(hsla(0,0%,100%,.05), hsla(0,0%,100%,0)); + background-clip: padding-box; + box-shadow: 0 1px 0 hsla(0,0%,100%,.05) inset, + 0 0 1px hsla(0,0%,100%,.1) inset, + 0 0 1px hsla(0,0%,0%,.2); + color: hsla(0,0%,100%,1); +} + +.noResults { + font-size: 12px; + color: hsla(0,0%,100%,.8); + font-style: italic; + cursor: default; +} + +/* TODO: file FF bug to support ::-moz-selection:window-inactive + so we can override the opaque grey background when the window is inactive; + see https://bugzilla.mozilla.org/show_bug.cgi?id=706209 */ +::selection { background: rgba(0,0,255,0.3); } +::-moz-selection { background: rgba(0,0,255,0.3); } + +#errorWrapper { + background: none repeat scroll 0 0 #FF5555; + color: white; + left: 0; + position: absolute; + right: 0; + z-index: 1000; + padding: 3px; + font-size: 0.8em; +} +.loadingInProgress #errorWrapper { + top: calc(var(--toolbar-height) + 5px); +} + +#errorMessageLeft { + float: left; +} + +#errorMessageRight { + float: right; +} + +#errorMoreInfo { + background-color: #FFFFFF; + color: black; + padding: 3px; + margin: 3px; + width: 98%; +} + +.overlayButton { + width: auto; + margin: 3px 4px 2px 4px !important; + padding: 2px 6px 3px 6px; +} + +#overlayContainer { + display: table; + position: absolute; + width: 100%; + height: 100%; + background-color: hsla(0,0%,0%,.2); + z-index: 40000; +} +#overlayContainer > * { + overflow: auto; +} + +#overlayContainer > .container { + display: table-cell; + vertical-align: middle; + text-align: center; +} + +#overlayContainer > .container > .dialog { + display: inline-block; + padding: 15px; + border-spacing: 4px; + color: hsl(0,0%,85%); + font-size: 12px; + line-height: 14px; + background-color: #474747; /* fallback */ + background-image: url(images/texture.png), + linear-gradient(hsla(0,0%,32%,.99), hsla(0,0%,27%,.95)); + box-shadow: inset 1px 0 0 hsla(0,0%,100%,.08), + inset 0 1px 1px hsla(0,0%,0%,.15), + inset 0 -1px 0 hsla(0,0%,100%,.05), + 0 1px 0 hsla(0,0%,0%,.15), + 0 1px 1px hsla(0,0%,0%,.1); + border: 1px solid hsla(0,0%,0%,.5); + border-radius: 4px; + box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3); +} + +.dialog > .row { + display: table-row; +} + +.dialog > .row > * { + display: table-cell; +} + +.dialog .toolbarField { + margin: 5px 0; +} + +.dialog .separator { + display: block; + margin: 4px 0 4px 0; + height: 1px; + width: 100%; + background-color: hsla(0,0%,0%,.5); + box-shadow: 0 0 0 1px hsla(0,0%,100%,.08); +} + +.dialog .buttonRow { + text-align: center; + vertical-align: middle; +} + +.dialog :link { + color: white; +} + +#passwordOverlay > .dialog { + text-align: center; +} +#passwordOverlay .toolbarField { + width: 200px; +} + +#documentPropertiesOverlay > .dialog { + text-align: left; +} +#documentPropertiesOverlay .row > * { + min-width: 100px; +} +html[dir='ltr'] #documentPropertiesOverlay .row > * { + text-align: left; +} +html[dir='rtl'] #documentPropertiesOverlay .row > * { + text-align: right; +} +#documentPropertiesOverlay .row > span { + width: 125px; + word-wrap: break-word; +} +#documentPropertiesOverlay .row > p { + max-width: 225px; + word-wrap: break-word; +} +#documentPropertiesOverlay .buttonRow { + margin-top: 10px; +} + +.clearBoth { + clear: both; +} + +.fileInput { + background: white; + color: black; + margin-top: 5px; + visibility: hidden; + position: fixed; + right: 0; + top: 0; +} + +#PDFBug { + background: none repeat scroll 0 0 white; + border: 1px solid #666666; + position: fixed; + top: 32px; + right: 0; + bottom: 0; + font-size: 10px; + padding: 0; + width: 300px; +} +#PDFBug .controls { + background:#EEEEEE; + border-bottom: 1px solid #666666; + padding: 3px; +} +#PDFBug .panels { + bottom: 0; + left: 0; + overflow: auto; + position: absolute; + right: 0; + top: 27px; +} +#PDFBug button.active { + font-weight: bold; +} +.debuggerShowText { + background: none repeat scroll 0 0 yellow; + color: blue; +} +.debuggerHideText:hover { + background: none repeat scroll 0 0 yellow; +} +#PDFBug .stats { + font-family: courier; + font-size: 10px; + white-space: pre; +} +#PDFBug .stats .title { + font-weight: bold; +} +#PDFBug table { + font-size: 10px; +} + +.grab-to-pan-grab { + cursor: url("images/grab.cur"), move !important; + cursor: -moz-grab !important; + cursor: grab !important; +} +.grab-to-pan-grab *:not(input):not(textarea):not(button):not(select):not(:link) { + cursor: inherit !important; +} +.grab-to-pan-grab:active, +.grab-to-pan-grabbing { + cursor: url("images/grabbing.cur"), move !important; + cursor: -moz-grabbing !important; + cursor: grabbing !important; + + position: fixed; + background: transparent; + display: block; + top: 0; + left: 0; + right: 0; + bottom: 0; + overflow: hidden; + z-index: 50000; /* should be higher than anything else in PDF.js! */ +} + +@page { + margin: 0; +} + +#printContainer { + display: none; +} + +@media screen and (min-resolution: 2dppx) { + /* Rules for Retina screens */ + .toolbarButton::before { + transform: scale(0.5); + top: -5px; + } + + .secondaryToolbarButton::before { + transform: scale(0.5); + top: -4px; + } + + html[dir='ltr'] .toolbarButton::before, + html[dir='rtl'] .toolbarButton::before { + left: -1px; + } + + html[dir='ltr'] .secondaryToolbarButton::before { + left: -2px; + } + html[dir='rtl'] .secondaryToolbarButton::before { + left: 186px; + } + + .toolbarField.pageNumber.visiblePageIsLoading, + #findInput[data-status="pending"] { + background-image: url(images/loading-small@2x.png); + background-size: 16px 17px; + } + + .dropdownToolbarButton { + background: url(images/toolbarButton-menuArrows@2x.png) no-repeat; + background-size: 7px 16px; + } + + html[dir='ltr'] .toolbarButton#sidebarToggle::before { + content: url(images/toolbarButton-sidebarToggle@2x.png); + } + html[dir='rtl'] .toolbarButton#sidebarToggle::before { + content: url(images/toolbarButton-sidebarToggle-rtl@2x.png); + } + + html[dir='ltr'] .toolbarButton#secondaryToolbarToggle::before { + content: url(images/toolbarButton-secondaryToolbarToggle@2x.png); + } + html[dir='rtl'] .toolbarButton#secondaryToolbarToggle::before { + content: url(images/toolbarButton-secondaryToolbarToggle-rtl@2x.png); + } + + html[dir='ltr'] .toolbarButton.findPrevious::before { + content: url(images/findbarButton-previous@2x.png); + } + html[dir='rtl'] .toolbarButton.findPrevious::before { + content: url(images/findbarButton-previous-rtl@2x.png); + } + + html[dir='ltr'] .toolbarButton.findNext::before { + content: url(images/findbarButton-next@2x.png); + } + html[dir='rtl'] .toolbarButton.findNext::before { + content: url(images/findbarButton-next-rtl@2x.png); + } + + html[dir='ltr'] .toolbarButton.pageUp::before { + content: url(images/toolbarButton-pageUp@2x.png); + } + html[dir='rtl'] .toolbarButton.pageUp::before { + content: url(images/toolbarButton-pageUp-rtl@2x.png); + } + + html[dir='ltr'] .toolbarButton.pageDown::before { + content: url(images/toolbarButton-pageDown@2x.png); + } + html[dir='rtl'] .toolbarButton.pageDown::before { + content: url(images/toolbarButton-pageDown-rtl@2x.png); + } + + .toolbarButton.zoomIn::before { + content: url(images/toolbarButton-zoomIn@2x.png); + } + + .toolbarButton.zoomOut::before { + content: url(images/toolbarButton-zoomOut@2x.png); + } + + .toolbarButton.presentationMode::before, + .secondaryToolbarButton.presentationMode::before { + content: url(images/toolbarButton-presentationMode@2x.png); + } + + .toolbarButton.print::before, + .secondaryToolbarButton.print::before { + content: url(images/toolbarButton-print@2x.png); + } + + .toolbarButton.openFile::before, + .secondaryToolbarButton.openFile::before { + content: url(images/toolbarButton-openFile@2x.png); + } + + .toolbarButton.download::before, + .secondaryToolbarButton.download::before { + content: url(images/toolbarButton-download@2x.png); + } + + .toolbarButton.bookmark::before, + .secondaryToolbarButton.bookmark::before { + content: url(images/toolbarButton-bookmark@2x.png); + } + + #viewThumbnail.toolbarButton::before { + content: url(images/toolbarButton-viewThumbnail@2x.png); + } + + html[dir="ltr"] #viewOutline.toolbarButton::before { + content: url(images/toolbarButton-viewOutline@2x.png); + } + html[dir="rtl"] #viewOutline.toolbarButton::before { + content: url(images/toolbarButton-viewOutline-rtl@2x.png); + } + + #viewAttachments.toolbarButton::before { + content: url(images/toolbarButton-viewAttachments@2x.png); + } + + #viewFind.toolbarButton::before { + content: url(images/toolbarButton-search@2x.png); + } + + .secondaryToolbarButton.firstPage::before { + content: url(images/secondaryToolbarButton-firstPage@2x.png); + } + + .secondaryToolbarButton.lastPage::before { + content: url(images/secondaryToolbarButton-lastPage@2x.png); + } + + .secondaryToolbarButton.rotateCcw::before { + content: url(images/secondaryToolbarButton-rotateCcw@2x.png); + } + + .secondaryToolbarButton.rotateCw::before { + content: url(images/secondaryToolbarButton-rotateCw@2x.png); + } + + .secondaryToolbarButton.handTool::before { + content: url(images/secondaryToolbarButton-handTool@2x.png); + } + + .secondaryToolbarButton.documentProperties::before { + content: url(images/secondaryToolbarButton-documentProperties@2x.png); + } + + .outlineItemToggler::before { + transform: scale(0.5); + top: -1px; + content: url(images/treeitem-expanded@2x.png); + } + html[dir='ltr'] .outlineItemToggler.outlineItemsHidden::before { + content: url(images/treeitem-collapsed@2x.png); + } + html[dir='rtl'] .outlineItemToggler.outlineItemsHidden::before { + content: url(images/treeitem-collapsed-rtl@2x.png); + } + html[dir='ltr'] .outlineItemToggler::before { + right: 0; + } + html[dir='rtl'] .outlineItemToggler::before { + left: 0; + } +} + +@media print { + /* General rules for printing. */ + body { + background: transparent none; + } + + /* Rules for browsers that don't support mozPrintCallback. */ + #sidebarContainer, #secondaryToolbar, .toolbar, #loadingBox, #errorWrapper, .textLayer { + display: none; + } + #viewerContainer { + overflow: visible; + } + + #mainContainer, #viewerContainer, .page, .page canvas { + position: static; + padding: 0; + margin: 0; + } + + .page { + float: left; + display: none; + border: none; + box-shadow: none; + background-clip: content-box; + background-color: white; + } + + .page[data-loaded] { + display: block; + } + + .fileInput { + display: none; + } + + /* Rules for browsers that support mozPrintCallback */ + body[data-mozPrintCallback] #outerContainer { + display: none; + } + body[data-mozPrintCallback] #printContainer { + display: block; + } + #printContainer { + height: 100%; + } + /* wrapper around (scaled) print canvas elements */ + #printContainer > div { + position: relative; + top: 0; + left: 0; + height: 100%; + overflow: hidden; + } + #printContainer canvas { + display: block; + } +} + +.visibleLargeView, +.visibleMediumView, +.visibleSmallView { + display: none; +} + +@media all and (max-width: 960px) { + html[dir='ltr'] #outerContainer.sidebarMoving .outerCenter, + html[dir='ltr'] #outerContainer.sidebarOpen .outerCenter { + float: left; + left: 205px; + } + html[dir='rtl'] #outerContainer.sidebarMoving .outerCenter, + html[dir='rtl'] #outerContainer.sidebarOpen .outerCenter { + float: right; + right: 205px; + } +} + +@media all and (max-width: 900px) { + .sidebarOpen .hiddenLargeView { + display: none; + } + .sidebarOpen .visibleLargeView { + display: inherit; + } +} + +@media all and (max-width: 860px) { + .sidebarOpen .hiddenMediumView { + display: none; + } + .sidebarOpen .visibleMediumView { + display: inherit; + } +} + +@media all and (max-width: 770px) { + #sidebarContainer { + top: var(--toolbar-height); + z-index: 100; + } + .loadingInProgress #sidebarContainer { + top: calc(var(--toolbar-height) + 5px); + } + #sidebarContent { + top: var(--toolbar-height); + background-color: hsla(0,0%,0%,.7); + } + + html[dir='ltr'] #outerContainer.sidebarOpen > #mainContainer { + left: 0px; + } + html[dir='rtl'] #outerContainer.sidebarOpen > #mainContainer { + right: 0px; + } + + html[dir='ltr'] .outerCenter { + float: left; + left: 205px; + } + html[dir='rtl'] .outerCenter { + float: right; + right: 205px; + } + + #outerContainer .hiddenLargeView, + #outerContainer .hiddenMediumView { + display: inherit; + } + #outerContainer .visibleLargeView, + #outerContainer .visibleMediumView { + display: none; + } +} + +@media all and (max-width: 700px) { + #outerContainer .hiddenLargeView { + display: none; + } + #outerContainer .visibleLargeView { + display: inherit; + } +} + +@media all and (max-width: 660px) { + #outerContainer .hiddenMediumView { + display: none; + } + #outerContainer .visibleMediumView { + display: inherit; + } +} + +@media all and (max-width: 600px) { + .hiddenSmallView { + display: none; + } + .visibleSmallView { + display: inherit; + } + html[dir='ltr'] #outerContainer.sidebarMoving .outerCenter, + html[dir='ltr'] #outerContainer.sidebarOpen .outerCenter, + html[dir='ltr'] .outerCenter { + left: 156px; + } + html[dir='rtl'] #outerContainer.sidebarMoving .outerCenter, + html[dir='rtl'] #outerContainer.sidebarOpen .outerCenter, + html[dir='rtl'] .outerCenter { + right: 156px; + } + .toolbarButtonSpacer { + width: 0; + } +} + +@media all and (max-width: 510px) { + #scaleSelectContainer, #pageNumberLabel, .polyfillDropdown { + display: none; + } +} diff --git a/browser/extensions/mortar/host/pdf/chrome/viewer.html b/browser/extensions/mortar/host/pdf/chrome/viewer.html new file mode 100644 index 000000000000..83d97713408a --- /dev/null +++ b/browser/extensions/mortar/host/pdf/chrome/viewer.html @@ -0,0 +1,309 @@ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+
+ + + +
+
+
+
+
+ + +
+
+ +
+ + + + +
+
+
+
+ +
+ +
+ +
+ +
+ + + +
+
+ + + + + + + + + Current View + + +
+ + +
+
+
+
+ +
+ +
+ + + +
+
+
+
+
+
+
+
+
+
+
+ +
+
+
+
+
+
+ + +
+ + + +
+
+ + diff --git a/browser/extensions/mortar/host/pdf/install.rdf b/browser/extensions/mortar/host/pdf/install.rdf new file mode 100644 index 000000000000..b918ac02030d --- /dev/null +++ b/browser/extensions/mortar/host/pdf/install.rdf @@ -0,0 +1,25 @@ + + + + + + ppapipdf.js@mozilla.org + ppapipdf.js + ppapipdf.js + 0.1 + 2 + true + true + + + {ec8030f7-c20a-464f-9b0e-13a3a9e97384} + 37.0 + 45.* + + + false + + diff --git a/browser/extensions/mortar/host/pdf/ppapi-content-sandbox.js b/browser/extensions/mortar/host/pdf/ppapi-content-sandbox.js new file mode 100644 index 000000000000..0d380fb84992 --- /dev/null +++ b/browser/extensions/mortar/host/pdf/ppapi-content-sandbox.js @@ -0,0 +1,95 @@ +/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +/** + * This code runs in the sandbox in the content process where the page that + * loaded the plugin lives. It communicates with the process where the PPAPI + * implementation lives. + */ +const { utils: Cu } = Components; + +let mm = pluginElement.frameLoader.messageManager; +let containerWindow = pluginElement.ownerDocument.defaultView; +// Prevent the drag event's default action on the element, to avoid dragging of +// that element while the user selects text. +pluginElement.addEventListener("dragstart", + function(event) { event.preventDefault(); }); +// For synthetic documents only, prevent the select event's default action on +// the element, to avoid selecting the element and the copying of an empty +// string into the clipboard. Don't do this for non-synthetic documents, as +// users still need to be able to select text outside the plugin. +let isSynthetic = pluginElement.ownerDocument.mozSyntheticDocument; +if (isSynthetic) { + pluginElement.ownerDocument.body.addEventListener( + "selectstart", function(event) { event.preventDefault(); }); +} + +function mapValue(v, instance) { + return instance.rt.toPP_Var(v, instance); +} + +dump("<>>>>>>>>>>>>>>>>>>>> AHA <<<<<<<<<<<<<<<<<<<<<>\n"); +dump(`pluginElement: ${pluginElement.toSource()}\n`); +dump(`pluginElement.frameLoader: ${pluginElement.frameLoader.toSource()}\n`); +dump(`pluginElement.frameLoader.messageManager: ${pluginElement.frameLoader.messageManager.toSource()}\n`); +dump("<>>>>>>>>>>>>>>>>>>>> AHA2 <<<<<<<<<<<<<<<<<<<<<>\n"); + +mm.addMessageListener("ppapi.js:frameLoaded", ({ target }) => { + let tagName = pluginElement.nodeName; + + // Getting absolute URL from the EMBED tag + let url = pluginElement.srcURI.spec; + let objectParams = new Map(); + for (let i = 0; i < pluginElement.attributes.length; ++i) { + let paramName = pluginElement.attributes[i].localName; + objectParams.set(paramName, pluginElement.attributes[i].value); + } + if (tagName == "OBJECT") { + let params = pluginElement.getElementsByTagName("param"); + Array.prototype.forEach.call(params, (p) => { + var paramName = p.getAttribute("name").toLowerCase(); + objectParams.set(paramName, p.getAttribute("value")); + }); + } + + let documentURL = pluginElement.ownerDocument.location.href; + let baseUrl = documentURL; + if (objectParams.base) { + try { + let parsedDocumentUrl = Services.io.newURI(documentURL); + baseUrl = Services.io.newURI(objectParams.base, null, parsedDocumentUrl).spec; + } catch (e) { /* ignore */ } + } + + let info = { + documentURL: "chrome-extension://mhjfbmdgcfjbbpaeojofohoefgiehjai", + url, + setupJSInstanceObject: false, + isFullFrame: false, //pluginElement.ownerDocument.mozSyntheticDocument, + arguments: { + keys: ["src", "full-frame", "top-level-url"], + values: [url, "", documentURL], + }, + }; + + mm.sendAsyncMessage("ppapi.js:createInstance", { type: "pdf", info }, + { pluginWindow: containerWindow }); + + containerWindow.document.addEventListener("fullscreenchange", () => { + let fullscreen = (containerWindow.document.fullscreenElement == pluginElement); + mm.sendAsyncMessage("ppapi.js:fullscreenchange", { fullscreen }); + }); +}); + +mm.addMessageListener("ppapi.js:setFullscreen", ({ data }) => { + if (data) { + pluginElement.requestFullscreen(); + } else { + containerWindow.document.exitFullscreen(); + } +}); + +mm.loadFrameScript("resource://ppapi.js/ppapi-instance.js", true); diff --git a/browser/extensions/mortar/host/rpc.cc b/browser/extensions/mortar/host/rpc.cc new file mode 100644 index 000000000000..647437549b8e --- /dev/null +++ b/browser/extensions/mortar/host/rpc.cc @@ -0,0 +1,187 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "../ppapi/out/rpc.cc" + +typedef void (*RpcFromPlugin)(const char*, bool, char**); +RpcFromPlugin gRpcFromPlugin; +PP_GetInterface_Func gGetInterface; + +void ToHost(std::stringstream &s, bool abortIfNonMainThread) { + gRpcFromPlugin(s.str().c_str(), abortIfNonMainThread, nullptr); +} + +std::string ToHostWithResult(std::stringstream &s, bool abortIfNonMainThread) { + char* result; + gRpcFromPlugin(s.str().c_str(), abortIfNonMainThread, &result); + return result; +} + +static const void* GetInterfaceForRPC(const char* interfaceName) { + const void* _interface = gInterfaces[interfaceName]; + if (!_interface) { + printf("MISSING INTERFACE %s\n", interfaceName); + } + return _interface; +} + +void +Fail(const char *reason, const char *data) +{ + fprintf(stdout, reason, data); + fflush(stdout); + exit(-1); +} + +char* +CallFromJSON(JSONIterator& iterator) +{ + iterator.expectObjectAndGotoFirstProperty(); + const Token& propertyName = iterator.getCurrentStringAndGotoNext(); + if (!propertyName.value().compare("__interface")) { + const Token& interfaceNameToken = iterator.getCurrentStringAndGotoNext(); + string interfaceName = interfaceNameToken.value(); + const Token& instanceToken = iterator; + const void* _interface; + if (!instanceToken.value().compare("__instance")) { + iterator.skip(); + void* instance; + FromJSON_mem_t(iterator, instance); + _interface = instance; + } else { + _interface = gGetInterface(interfaceName.c_str()); + } + if (!_interface) { + printf("Missing interface %s\n", interfaceName.c_str()); + return nullptr; + } + return gInterfaceMemberCallers[interfaceName](_interface, iterator); + } + + if (!propertyName.value().compare("__callback")) { + const Token& callbackNameToken = iterator.getCurrentAndGotoNext(); + if (!callbackNameToken.isString()) { + return nullptr; + } + if (!callbackNameToken.value().compare("PP_CompletionCallback")) { + iterator.skip(); + PP_CompletionCallback callback; + FromJSON_PP_CompletionCallback(iterator, callback); + iterator.skip(); + int32_t result; + FromJSON_int32_t(iterator, result); + PP_RunCompletionCallback(&callback, result); + return nullptr; + } + if (!callbackNameToken.value().compare("PPB_Audio_Callback_1_0")) { + iterator.skip(); + PPB_Audio_Callback_1_0 callback; + FromJSON_PPB_Audio_Callback(iterator, callback); + iterator.skip(); + void* sample_buffer; + FromJSON_mem_t(iterator, sample_buffer); + iterator.skip(); + uint32_t buffer_size_in_bytes; + FromJSON_uint32_t(iterator, buffer_size_in_bytes); + iterator.skip(); + void* user_data; + FromJSON_mem_t(iterator, user_data); + callback(sample_buffer, buffer_size_in_bytes, user_data); + return nullptr; + } + + Fail("Don't have code for callback ", callbackNameToken.value().c_str()); + return nullptr; + } + + Fail("Don't know what to do with a call for ", propertyName.value().c_str()); + return nullptr; +} + +#ifdef __cplusplus +extern "C" { +#endif + +PP_EXPORT char* +CallFromJSON(const char* json) +{ + JSONIterator iterator(json); + + const Token& item = iterator; + if (item.isArray()) { + iterator.skip(); + std::string result("["); + for (size_t i = 0; i < item.children(); ++i) { + const char* r = CallFromJSON(iterator); + if (!r) { + result.append("null"); + } else { + result.append(r); + delete r; + } + if (i + 1 != item.children()) { + result.append(", "); + } + } + result.append("]"); + return strdup(result.c_str()); + } + + return CallFromJSON(iterator); +} + +PP_EXPORT void +Initialize(RpcFromPlugin aRpcFromPlugin, + PP_GetInterface_Func aGetInterface, + PP_InitializeModule_Func aInitializeModule) { + gRpcFromPlugin = aRpcFromPlugin; + gGetInterface = aGetInterface; + InitializeInterfaceList(); + aInitializeModule(1, GetInterfaceForRPC); +} + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +void FromJSON_PP_Flash_Menu(JSONIterator& iterator, PP_Flash_Menu *&value) { + const JSON::Token& pointer = iterator.getCurrentAndGotoNext(); + if (!pointer.isObject()) { + if (!pointer.isPrimitive() || !pointer.value().compare("null")) { + Fail("Not a pointer value!", ""); + } + value = nullptr; + } else { + value = new PP_Flash_Menu(); + FromJSON_PP_Flash_Menu(iterator, *value); + } +} + +void FromJSON_PP_DirContents_Dev(JSONIterator& iterator, PP_DirContents_Dev *&value) +{ + value = new PP_DirContents_Dev(); + const JSON::Token& current = iterator.getCurrentAndGotoNext(); + if (current.isPrimitive() && !current.value().compare("null")) { + return; + } + + if (!current.isObject()) { + Fail("Expected object!", ""); + } + + iterator.skip(); + FromJSON_int32_t(iterator, value->count); + + iterator.skip(); + size_t children = iterator.expectArrayAndGotoFirstItem(); + if (children > value->count) { + Fail("Too many items in array\n", ""); + } + + value->entries = new PP_DirEntry_Dev[value->count]; + for (uint32_t _n = 0; _n < children; ++_n) { + FromJSON_PP_DirEntry_Dev(iterator, value->entries[_n]); + } + // FIXME Null out remaining items? +} diff --git a/browser/extensions/mortar/host/rpc.h b/browser/extensions/mortar/host/rpc.h new file mode 100644 index 000000000000..7a7eccb8c1fb --- /dev/null +++ b/browser/extensions/mortar/host/rpc.h @@ -0,0 +1,606 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#ifndef __rpc_h__ +#define __rpc_h__ + +#include +#include +#include +#include +#include +#include + +#include "json/json.h" + +extern void Fail(const char *reason, const char *data); + +#ifdef INTERPOSE +const void* RealGetInterface(const char* interfaceName); +void Logging_PP_CompletionCallback(void* user_data, int32_t result); +void Logging_PPB_Audio_Callback_1_0(void* sample_buffer, + uint32_t buffer_size_in_bytes, + void* user_data); +struct Logging_PPB_Audio_Callback_1_0_holder { + PPB_Audio_Callback_1_0 func; + void* user_data; +}; +struct Logging_PPP_Class_Deprecated_holder { + const PPP_Class_Deprecated* _real_PPP_Class_Deprecated; + const void* object; +}; +extern const PPP_Class_Deprecated _interpose_PPP_Class_Deprecated_1_0; +#else // INTERPOSE +void ToHost(std::stringstream &s, bool abortIfNonMainThread); +std::string ToHostWithResult(std::stringstream &s, bool abortIfNonMainThread); + +enum RPCType { + WithResult, + NoResult +}; +enum RPCThread { + MainThreadOnly, + MaybeNonMainThread +}; +template +void RPC(std::stringstream &s) { + return ToHost(s, rpcThread == MainThreadOnly); +} +template +std::string RPCWithResult(std::stringstream &s) { + return ToHostWithResult(s, rpcThread == MainThreadOnly); +} +#endif // INTERPOSE + +typedef float float_t; +typedef double double_t; +typedef const void* mem_t; +typedef void* const * mem_ptr_t; +typedef const char* str_t; +typedef const char* cstr_t; +typedef int GLint; +typedef unsigned int GLuint; +typedef unsigned int GLenum; +typedef unsigned int GLbitfield; +typedef unsigned char GLboolean; +typedef float GLclampf; +typedef float GLfloat; +typedef long int GLintptr; +typedef int GLsizei; +typedef long int GLsizeiptr; +typedef const GLint * GLint_ptr_t; +typedef const GLuint * GLuint_ptr_t; +typedef const GLenum * GLenum_ptr_t; +typedef const GLboolean * GLboolean_ptr_t; +typedef const GLfloat * GLfloat_ptr_t; +typedef const GLsizei * GLsizei_ptr_t; +typedef const GLubyte * GLubyte_ptr_t; + +#ifdef _WIN32 +#include +typedef HANDLE PP_FileHandle; +#else +typedef int PP_FileHandle; +#endif + +struct PPP_MessageHandler_0_2; + +static void BeginProps(std::stringstream &s) { + s << '{'; +} + +static void EndProps(std::stringstream &s) { + s << '}'; +} + +static void BeginProp(std::stringstream &s, const std::string &key) { + if (s.str().back() != '{') + s << ','; + s << '"' << key << "\":"; +} + +static void AddProp(std::stringstream &s, const std::string &key, const std::string &value) { + BeginProp(s, key); + s << value; +} + +static void BeginElements(std::stringstream &s) { + s << '['; +} + +static void EndElements(std::stringstream &s) { + s << ']'; +} + +static void BeginElement(std::stringstream &s) { + if (s.str().back() != '[') + s << ','; +} + +static void AddElement(std::stringstream &s, const std::string &value) { + BeginElement(s); + s << value; +} + +// Define how to send certain primitive types to the browser. + +template +static const std::string ToString(const T *value) { + std::stringstream x; + x << *value; + return x.str(); +} + +static void WriteEscapedChar(std::stringstream& x, const char value) +{ + switch (value) { + case '\\': + x << "\\\\"; + return; + case '"': + x << "\\" << value; + return; + } + unsigned int v = (unsigned int)value; + if (v <= 0x001f) { + x << "\\u" << std::setw(4) << std::setfill('0') << std::hex << v; + } else { + x << value; + } +} + +template +static void WriteString(std::stringstream& x, const T *value, size_t length) { + const char* start = *value; + const char* end = start + length; + size_t pos = 0; + while (start != end) { + WriteEscapedChar(x, *(start++)); + } +} + +template +static const std::string StringToQuotedString(const T *value, size_t length) { + std::stringstream x; + x << '"'; + WriteString(x, value, length); + x << '"'; + return x.str(); +} + +template +static const std::string StringToQuotedString(const T *value) { + return StringToQuotedString(value, strlen(*value)); +} + +static const std::string StringToQuotedString(const char *value) { + return StringToQuotedString(&value, 1); +} + +template +static const std::string PointerToString(T *value) { + std::stringstream x; + if (!value) { + x << "null"; + } else { + x << (std::intptr_t)value; + } + return x.str(); +} + +#define DEFINE_TOSTRING_FORWARD_REF_TO_POINTER(T) \ + static const std::string ToString_##T(const T &value) { \ + return ToString_##T(&value); \ + } +#define DEFINE_TOSTRING(T) \ + static const std::string ToString_##T(const T *value) { \ + return ToString(value); \ + } \ + DEFINE_TOSTRING_FORWARD_REF_TO_POINTER(T) +#define DEFINE_INT_TOSTRING(T) \ + static const std::string ToString_##T(const T *value) { \ + std::stringstream x; \ + x << std::dec << (int)*value; \ + return x.str(); \ + } \ + DEFINE_TOSTRING_FORWARD_REF_TO_POINTER(T) +#define DEFINE_UNSIGNED_INT_TOSTRING(T) \ + static const std::string ToString_##T(const T *value) { \ + std::stringstream x; \ + x << std::dec << (unsigned int)*value; \ + return x.str(); \ + } \ + DEFINE_TOSTRING_FORWARD_REF_TO_POINTER(T) +#define DEFINE_FLOAT_TOSTRING(T) \ + static const std::string ToString_##T(const T *value) { \ + switch (std::fpclassify(*value)) { \ + case FP_INFINITE: \ + case FP_NAN: \ + return "null"; \ + default: \ + return ToString(value); \ + } \ + } \ + DEFINE_TOSTRING_FORWARD_REF_TO_POINTER(T) +#define DEFINE_POINTER_TOSTRING(T) \ + static const std::string ToString_##T(const T *value) { \ + return PointerToString(*value); \ + } \ + DEFINE_TOSTRING_FORWARD_REF_TO_POINTER(T) +#define DEFINE_STRING_TOSTRING(T) \ + static const std::string ToString_##T(const T *value) { \ + return StringToQuotedString(value); \ + } \ + DEFINE_TOSTRING_FORWARD_REF_TO_POINTER(T) + +DEFINE_STRING_TOSTRING(char) +DEFINE_INT_TOSTRING(int8_t) +DEFINE_INT_TOSTRING(int32_t) +DEFINE_INT_TOSTRING(int64_t) +DEFINE_UNSIGNED_INT_TOSTRING(uint8_t) +DEFINE_UNSIGNED_INT_TOSTRING(uint16_t) +DEFINE_UNSIGNED_INT_TOSTRING(uint32_t) +DEFINE_UNSIGNED_INT_TOSTRING(uint64_t) +DEFINE_FLOAT_TOSTRING(float_t) +DEFINE_FLOAT_TOSTRING(double_t) +DEFINE_POINTER_TOSTRING(mem_t) +DEFINE_TOSTRING(mem_ptr_t) +DEFINE_STRING_TOSTRING(str_t) +static const std::string ToString_str_t(const str_t *value, size_t length) { + return StringToQuotedString(value, length); +} +static const std::string ToString_str_t(const str_t &value, size_t length) { + return StringToQuotedString(&value, length); +} +DEFINE_STRING_TOSTRING(cstr_t) +DEFINE_TOSTRING(GLint) +DEFINE_TOSTRING(GLuint) +DEFINE_TOSTRING(GLenum) +DEFINE_TOSTRING(GLbitfield) +static const std::string ToString_GLboolean(const GLboolean *value) { + std::stringstream x; + x << (*value ? "true" : "false"); + return x.str(); +} +DEFINE_TOSTRING_FORWARD_REF_TO_POINTER(GLboolean) +DEFINE_TOSTRING(GLfloat) +DEFINE_TOSTRING(GLclampf) +DEFINE_TOSTRING(GLintptr) +DEFINE_TOSTRING(GLsizei) +DEFINE_TOSTRING(GLsizeiptr) +DEFINE_TOSTRING(GLuint_ptr_t) +DEFINE_TOSTRING(GLenum_ptr_t) +DEFINE_TOSTRING(GLboolean_ptr_t) +DEFINE_POINTER_TOSTRING(GLint_ptr_t) +DEFINE_POINTER_TOSTRING(GLfloat_ptr_t) +DEFINE_TOSTRING(GLsizei_ptr_t) +DEFINE_TOSTRING(PP_FileHandle) + +#ifdef INTERPOSE +static const std::string ToString_GLubyte_ptr_t(const GLubyte *value) { + std::stringstream x; + x << (const char*)value; + return x.str(); +} +static const std::string ToString_uint16_ptr_t(const uint16_ptr_t value) { + return ""; +} +extern const std::string ToString_PP_DirContents_Dev(const PP_DirContents_Dev *v); +static const std::string ToString_PP_DirContents_Dev(PP_DirContents_Dev **value) { + if (!value && !*value) { + return "{}"; + } + return ToString_PP_DirContents_Dev(*value); +} +#endif + +// Define how to emit client objects that the client sends to the host. We just want +// to send a pointer value here, not actually unpack the struct. + +static const std::string ToString_PPP_MessageHandler(const PPP_MessageHandler_0_2 *value) { + std::stringstream x; + x << value; + return x.str(); +} + +static const std::string ToString_PPP_Class_Deprecated(const PPP_Class_Deprecated *value) { + return PointerToString(value); +} + + +class JSONIterator { + JSON::Parser parser; + JSON::Parser::iterator iterator; + JSON::Parser::iterator end; + +public: + JSONIterator(const std::string& json) + { + if (parser.parse(json) <= 0) { + Fail("Fatal: failed to parse '%s'\n", json.c_str()); + } + iterator = parser.begin(); + end = parser.end(); + } + + bool isValid() const { + return iterator != end; + } + operator const JSON::Token&() const { + return *iterator; + } + + void skip() { + ++iterator; + } + const JSON::Token& getCurrentAndGotoNext() { + const JSON::Token& token = *iterator; + ++iterator; + return token; + } + + const JSON::Token& getCurrentPrimitiveAndGotoNext() + { + const JSON::Token& token = getCurrentAndGotoNext(); + if (!token.isPrimitive()) { + Fail("Expected primitive", ""); + }; + return token; + } + const JSON::Token& getCurrentStringAndGotoNext() + { + const JSON::Token& token = getCurrentAndGotoNext(); + if (!token.isString()) { + Fail("Expected string", ""); + }; + return token; + } + + const void expectObjectAndGotoFirstProperty() + { + if (!getCurrentAndGotoNext().isObject()) { + Fail("Expected object", ""); + } + if (!iterator->isString()) { + Fail("Expected string", ""); + } + } + const size_t expectArrayAndGotoFirstItem() + { + const JSON::Token& token = getCurrentAndGotoNext(); + if (!token.isArray()) { + Fail("Expected array", ""); + } + return token.children(); + } +}; + +template +struct OutParam +{ + typedef typename std::conditional::value, typename std::remove_pointer::type, T>::type nopointer; + typedef typename std::remove_const::type noconst; + typedef typename std::conditional::value, typename std::add_pointer::type, noconst>::type type; +}; + +static void FromJSON_int(JSONIterator& iterator, long int& value) +{ + value = atol(iterator.getCurrentPrimitiveAndGotoNext().value().c_str()); +} + +static void FromJSON_uintptr(JSONIterator& iterator, std::uintptr_t& value) +{ + long long pointer = std::atoll(iterator.getCurrentPrimitiveAndGotoNext().value().c_str()); + value = static_cast(pointer); +} + +template +static void PointerValueFromJSON(JSONIterator& iterator, T*& value) { + std::uintptr_t pointer; + FromJSON_uintptr(iterator, pointer); + value = (T*)pointer; +} + +static void FromJSON_charArray(JSONIterator& iterator, char* value, size_t count) +{ + const JSON::Token& token = iterator.getCurrentStringAndGotoNext(); + std::strncpy(value, token.value().c_str(), count); +} + +// FIXME Check range? +#define DEFINE_FROMJSON_INT(T) \ + static void FromJSON_##T(JSONIterator& iterator, OutParam::type& value) { \ + long int v; \ + FromJSON_int(iterator, v); \ + value = v; \ + } + +#define DEFINE_FROMJSON_FLOAT(T) \ +static void FromJSON_##T(JSONIterator& iterator, OutParam::type& value) \ + { \ + value = atof(iterator.getCurrentPrimitiveAndGotoNext().value().c_str()); \ + } + +DEFINE_FROMJSON_INT(int8_t) +DEFINE_FROMJSON_INT(int32_t) +DEFINE_FROMJSON_INT(int64_t) +DEFINE_FROMJSON_INT(uint8_t) +DEFINE_FROMJSON_INT(uint16_t) +DEFINE_FROMJSON_INT(uint32_t) +DEFINE_FROMJSON_INT(uint64_t) +DEFINE_FROMJSON_FLOAT(float_t) +DEFINE_FROMJSON_FLOAT(double_t) +static void FromJSON_mem_t(JSONIterator& iterator, OutParam::type& value) +{ + PointerValueFromJSON(iterator, value); +} +static void FromJSON_mem_ptr_t(JSONIterator& iterator, OutParam::type& value) +{ + const JSON::Token& token = iterator.getCurrentAndGotoNext(); + Fail("UNIMPLEMENTED: %s\n", "FromJSON_mem_ptr_t"); +} +static void FromJSON_str_t(JSONIterator& iterator, OutParam::type& value) +{ + const JSON::Token& token = iterator.getCurrentAndGotoNext(); + if (token.isString()) { + size_t length = 0; + std::string tokenValue = token.value(); + for (std::string::iterator it = tokenValue.begin(); it != tokenValue.cend(); ++it) { + ++length; + if (*it == '\\' && it + 1 != tokenValue.cend()) { + std::string::iterator next = it + 1; + switch (*next) { + case '\"': + case '/': + case '\\': + tokenValue.erase(it); + break; + case 'b': + tokenValue.replace(it, next + 1, "\b"); + break; + case 'f': + tokenValue.replace(it, next + 1, "\f"); + break; + case 'r': + tokenValue.replace(it, next + 1, "\r"); + break; + case 'n': + tokenValue.replace(it, next + 1, "\n"); + break; + case 't': + tokenValue.replace(it, next + 1, "\t"); + break; + case 'u': + if (tokenValue.cend() - next >= 5) { + if (*(next + 1) == '0' && + *(next + 2) == '0' && + *(next + 3) == '0' && + *(next + 4) == '0') { + tokenValue.replace(it, next + 5, 1, '\0'); + break; + } + Fail("Need to handle unicode escapes in strings: %s.", + tokenValue.c_str()); + } + } + } + } + value = (char*) malloc(length + 1); + std::memcpy(value, tokenValue.c_str(), length + 1); + return; + } + + if (!token.isArray()) { + Fail("Expected array", ""); + return; + } + + size_t size = token.children(); + char* buff = new char[size]; + for (size_t i = 0; i < size; ++i) { + buff[i] = iterator.getCurrentAndGotoNext().value()[0]; + } + value = buff; +} +static void FromJSON_str_t(JSONIterator& iterator, str_t& value) +{ + return FromJSON_str_t(iterator, const_cast::type&>(value)); +} +static void FromJSON_cstr_t(JSONIterator& iterator, cstr_t& value) +{ + value = strdup(iterator.getCurrentStringAndGotoNext().value().c_str()); +} +DEFINE_FROMJSON_INT(GLint) +DEFINE_FROMJSON_INT(GLuint) +static void FromJSON_GLenum(JSONIterator& iterator, OutParam::type& value) +{ + const JSON::Token& token = iterator.getCurrentAndGotoNext(); + Fail("UNIMPLEMENTED: %s\n", "FromJSON_GLenum"); +} +static void FromJSON_GLbitfield(JSONIterator& iterator, OutParam::type& value) +{ + const JSON::Token& token = iterator.getCurrentAndGotoNext(); + Fail("UNIMPLEMENTED: %s\n", "FromJSON_GLbitfield"); +} +DEFINE_FROMJSON_INT(GLboolean) +static void FromJSON_GLfloat(JSONIterator& iterator, OutParam::type& value) +{ + const JSON::Token& token = iterator.getCurrentAndGotoNext(); + Fail("UNIMPLEMENTED: %s\n", "FromJSON_GLfloat"); +} +static void FromJSON_GLclampf(JSONIterator& iterator, OutParam::type& value) +{ + const JSON::Token& token = iterator.getCurrentAndGotoNext(); + Fail("UNIMPLEMENTED: %s\n", "FromJSON_GLclampf"); +} +static void FromJSON_GLintptr(JSONIterator& iterator, OutParam::type& value) +{ + const JSON::Token& token = iterator.getCurrentAndGotoNext(); + Fail("UNIMPLEMENTED: %s\n", "FromJSON_GLintptr"); +} +DEFINE_FROMJSON_INT(GLsizei) +static void FromJSON_GLboolean_ptr_t(JSONIterator& iterator, OutParam::type& value) +{ + const JSON::Token& token = iterator.getCurrentAndGotoNext(); + Fail("UNIMPLEMENTED: %s\n", "FromJSON_GLboolean_ptr_t"); +} +static void FromJSON_GLenum_ptr_t(JSONIterator& iterator, OutParam::type& value) +{ + const JSON::Token& token = iterator.getCurrentAndGotoNext(); + Fail("UNIMPLEMENTED: %s\n", "FromJSON_GLenum_ptr_t"); +} +static void FromJSON_GLfloat_ptr_t(JSONIterator& iterator,OutParam::type& value) +{ + const JSON::Token& token = iterator.getCurrentAndGotoNext(); + Fail("UNIMPLEMENTED: %s\n", "FromJSON_GLfloat_ptr_t"); +} +static void FromJSON_GLint_ptr_t(JSONIterator& iterator, OutParam::type& value) +{ + return FromJSON_GLint(iterator, *value); + Fail("UNIMPLEMENTED: %s\n", "FromJSON_GLint_ptr_t"); +} +static void FromJSON_GLsizei_ptr_t(JSONIterator& iterator, OutParam::type& value) +{ + if (!value) { + iterator.skip(); + } else { + FromJSON_GLsizei(iterator, *value); + } +} +static void FromJSON_GLubyte_ptr_t(JSONIterator& iterator, OutParam::type& value) +{ + const JSON::Token& token = iterator.getCurrentStringAndGotoNext(); + std::string tokenValue = token.value(); + size_t size = tokenValue.size(); + value = new GLubyte[size]; + std::memcpy(value, tokenValue.data(), size); +} +static void FromJSON_GLuint_ptr_t(JSONIterator& iterator, OutParam::type& value) +{ + const JSON::Token& token = iterator.getCurrentAndGotoNext(); + Fail("UNIMPLEMENTED: %s\n", "FromJSON_GLuint_ptr_t"); +} +#ifdef _WIN32 +static void FromJSON_PP_FileHandle(JSONIterator& iterator, PP_FileHandle& value) +{ + PointerValueFromJSON(iterator, value); +} +#else +DEFINE_FROMJSON_INT(PP_FileHandle) +#endif +static void FromJSON_uint16_ptr_t(JSONIterator& iterator, uint16_ptr_t& value) +{ + PointerValueFromJSON(iterator, value); +} + +struct PP_Flash_Menu; +void FromJSON_PP_Flash_Menu(JSONIterator& iterator, PP_Flash_Menu &value); +void FromJSON_PP_Flash_Menu(JSONIterator& iterator, PP_Flash_Menu *&value); + +struct PP_DirEntry_Dev; +struct PP_DirContents_Dev; +void FromJSON_PP_DirEntry_Dev(JSONIterator& iterator, PP_DirEntry_Dev &value); +void FromJSON_PP_DirContents_Dev(JSONIterator& iterator, PP_DirContents_Dev *&value); + +#endif diff --git a/browser/extensions/mortar/json/json.cpp b/browser/extensions/mortar/json/json.cpp new file mode 100644 index 000000000000..edd68eb2a6a5 --- /dev/null +++ b/browser/extensions/mortar/json/json.cpp @@ -0,0 +1,201 @@ +/* +Copyright (c) 2010 Serge A. Zaitsev +Copyright (c) 2015 Andreas Gal + +Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + +#include +#include "json.h" + +using namespace std; + +namespace JSON { + +enum { + PRIMITIVE = 0, // number, boolean, true, false, null + OBJECT = 1, + ARRAY = 2, + STRING = 3 +}; + +Token::Token(int _type, const string& _v) { + type = _type; + size = 0; + v = _v; +} + +bool Token::isPrimitive() const { + return type == PRIMITIVE; +} + +bool Token::isString() const { + return type == STRING; +} + +bool Token::isObject() const { + return type == OBJECT; +} + +bool Token::isArray() const { + return type == ARRAY; +} + +void Parser::addToken(int type, const string& value, stack& parents) { + tokens.push_back(Token(type, value)); + if (!parents.empty()) { + // Add this token to the enclosing value. + Token *t = &tokens[parents.top()]; + t->size++; + // String keys only have one child value, so we pop the parent here. + if (t->type == STRING) + parents.pop(); + } +} + +int Parser::parsePrimitive(const string& js, string::const_iterator& pos, stack& parents) { + string::const_iterator start = pos; + + for (; pos != js.cend(); pos++) { + if (isspace(*pos) || *pos == ',' || *pos == ']' || *pos == '}') { + addToken(PRIMITIVE, string(start, pos), parents); + pos--; + return OK; + } + if (*pos < 32 || *pos >= 127) { + pos = start; + return ERROR_INVAL; + } + } + pos = start; + return ERROR_PART; +} + +int Parser::parseString(const string& js, string::const_iterator& pos, stack& parents) { + string::const_iterator start = pos; + + pos++; // skip starting quote + + for (; pos != js.cend(); pos++) { + // Quote: end of string + if (*pos == '\"') { + addToken(STRING, string(start + 1, pos), parents); + return OK; + } + + // Backslash: Quoted symbol expected + if (*pos == '\\' && pos + 1 < js.cend()) { + pos++; + switch (*pos) { + // Allowed escaped symbols + case '\"': case '/' : case '\\' : case 'b' : + case 'f' : case 'r' : case 'n' : case 't' : + break; + // Allows escaped symbol \uXXXX + case 'u': + pos++; + for (int i = 0; i < 4 && pos < js.cend(); i++) { + if (!isxdigit(*pos)) { + pos = start; + return ERROR_INVAL; + } + pos++; + } + pos--; + break; + // Unexpected symbol + default: + pos = start; + return ERROR_INVAL; + } + } + } + pos = start; + return ERROR_PART; +} + +int Parser::parse(const std::string& js) { + stack parents; + string::const_iterator pos = js.cbegin(); + + tokens.clear(); + + for (; pos != js.cend(); pos++) { + if (isspace(*pos)) + continue; + switch (*pos) { + case '{': case '[': { + int type = (*pos == '{' ? OBJECT : ARRAY); + addToken(type, string(), parents); + parents.push(tokens.size() - 1); + break; + } + case '}': case ']': { + if (parents.empty()) + return ERROR_INVAL; + int type = (*pos == '}' ? OBJECT : ARRAY); + Token* t = &tokens[parents.top()]; + parents.pop(); + if (t->type != type) + return ERROR_INVAL; + break; + } + case '\"': { + int r = parseString(js, pos, parents); + if (r < 0) return r; + break; + } + case ':': { + if (tokens.empty() || tokens.back().type != STRING) + return ERROR_INVAL; + parents.push(tokens.size() - 1); + break; + } + case ',': { + if (parents.empty()) + return ERROR_INVAL; + break; + } + case '-': case '0': case '1' : case '2': case '3' : case '4': + case '5': case '6': case '7' : case '8': case '9': + case 't': case 'f': case 'n' : { + if (parents.empty()) + return ERROR_INVAL; + Token *t = &tokens[parents.top()]; + if (t->type == OBJECT || + (t->type == STRING && t->size != 0)) { + return ERROR_INVAL; + } + int r = parsePrimitive(js, pos, parents); + if (r < 0) return r; + break; + } + default: + // Unexpected character + return ERROR_INVAL; + } + } + + if (!parents.empty()) + return ERROR_PART; + + return tokens.size(); +} + +} diff --git a/browser/extensions/mortar/json/json.h b/browser/extensions/mortar/json/json.h new file mode 100644 index 000000000000..0b6b0127e86e --- /dev/null +++ b/browser/extensions/mortar/json/json.h @@ -0,0 +1,67 @@ +#ifndef __JSON_H_ +#define __JSON_H_ + +#include +#include +#include +#include + +namespace JSON { + +enum { + OK = 0, + ERROR_INVAL = -1, /* Invalid character inside JSON string */ + ERROR_PART = -2 /* The string is not a full JSON packet, more bytes expected */ +}; + +class Token { + friend class Parser; + +protected: + int type; + int size; + std::string v; + +public: + Token(int _type, const std::string& _v); + + bool isPrimitive() const; + bool isString() const; + bool isObject() const; + bool isArray() const; + + std::string value() const { + return v; + } + + size_t children() const { + return size; + } +}; + +class Parser { + std::vector tokens; + + void addToken(int type, const std::string& value, std::stack& parents); + int parsePrimitive(const std::string& js, std::string::const_iterator& pos, std::stack& parents); + int parseString(const std::string& js, std::string::const_iterator& pos, std::stack& parents); +public: + int parse(const std::string& js); + + typedef std::vector::const_iterator iterator; + + iterator begin() const { return tokens.cbegin(); } + iterator end() const { return tokens.cend(); } + + const Token& operator[](int index) const { + return tokens[index]; + } + + size_t size() const { + return tokens.size(); + } +}; + +} + +#endif /* __JSON_H_ */ diff --git a/browser/extensions/mortar/json/test.cpp b/browser/extensions/mortar/json/test.cpp new file mode 100644 index 000000000000..5d148e5dd268 --- /dev/null +++ b/browser/extensions/mortar/json/test.cpp @@ -0,0 +1,433 @@ +#include +#include +#include + +static int test_passed = 0; +static int test_failed = 0; + +/* Terminate current test with error */ +#define fail() return __LINE__ + +/* Successfull end of the test case */ +#define done() return 0 + +/* Check single condition */ +#define check(cond) do { if (!(cond)) fail(); } while (0) + +/* Test runner */ +static void test(int (*func)(void), const char *name) { + int r = func(); + if (r == 0) { + test_passed++; + } else { + test_failed++; + printf("FAILED: %s (at line %d)\n", name, r); + } +} + +#include "json.cpp" + +using namespace std; +using namespace JSON; + +static bool TOKEN_STRING(const Token& t, const char *s) { + return !t.value().compare(string(s)); +} + +static bool isObject(const Token& t, int children) { + return t.isObject() && t.children() == children; +} + +static bool isArray(const Token& t, int children) { + return t.isArray() && t.children() == children; +} + +static bool isKey(const Token& t, const char* v) { + return t.isString() && t.children() == 1 && t.value() == v; +} + +static bool isPrimitive(const Token& t, const char* v) { + return t.isPrimitive() && t.children() == 0 && t.value() == v; +} + +int test_empty() { + const char *js; + int r; + Parser p; + + js = "{}"; + r = p.parse(string(js)); + check(r == 1); + check(isObject(p[0], 0)); + + js = "[]"; + r = p.parse(string(js)); + check(r == 1); + check(isArray(p[0], 0)); + + js = "{\"a\":[]}"; + r = p.parse(string(js)); + check(r == 3); + check(isObject(p[0], 1)); + check(isKey(p[1], "a")); + check(isArray(p[2], 0)); + + js = "[{},{}]"; + r = p.parse(string(js)); + check(r >= 0); + check(isArray(p[0], 2)); + check(isObject(p[1], 0)); + check(isObject(p[2], 0)); + return 0; +} + +int test_simple() { + const char *js; + int r; + Parser p; + + js = "{\"a\": 0}"; + + r = p.parse(string(js)); + check(r == 3); + check(isObject(p[0], 1)); + check(isKey(p[1], "a")); + check(isPrimitive(p[2], "0")); + + js = "[\"a\":{},\"b\":{}]"; + r = p.parse(string(js)); + check(r == 5); + check(isArray(p[0], 2)); + check(isKey(p[1], "a")); + check(isObject(p[2], 0)); + check(isKey(p[3], "b")); + check(isObject(p[4], 0)); + + js = "{\n \"Day\": 26,\n \"Month\": 9,\n \"Year\": 12\n }"; + r = p.parse(string(js)); + check(r == 7); + + return 0; +} + +int test_primitive() { + int r; + Parser p; + const char *js; + js = "{\"boolVar\" : true}"; + r = p.parse(string(js)); + check(r == 3); + check(p[0].isObject() && p[1].isString() && p[2].isPrimitive()); + check(TOKEN_STRING(p[1], "boolVar")); + check(TOKEN_STRING(p[2], "true")); + + js = "{\"boolVar\" : false}"; + r = p.parse(string(js)); + check(r == 3); + check(p[0].isObject() && p[1].isString() && p[2].isPrimitive()); + check(TOKEN_STRING(p[1], "boolVar")); + check(TOKEN_STRING(p[2], "false")); + + js = "{\"intVar\" : 12345}"; + r = p.parse(string(js)); + check(r == 3); + check(p[0].isObject() && p[1].isString() && p[2].isPrimitive()); + check(TOKEN_STRING(p[1], "intVar")); + check(TOKEN_STRING(p[2], "12345")); + + js = "{\"floatVar\" : 12.345}"; + r = p.parse(string(js)); + check(r == 3); + check(p[0].isObject() && p[1].isString() && p[2].isPrimitive()); + check(TOKEN_STRING(p[1], "floatVar")); + check(TOKEN_STRING(p[2], "12.345")); + + js = "{\"nullVar\" : null}"; + r = p.parse(string(js)); + check(r == 3); + check(p[0].isObject() && p[1].isString() && p[2].isPrimitive()); + check(TOKEN_STRING(p[1], "nullVar")); + check(TOKEN_STRING(p[2], "null")); + + return 0; +} + +int test_string() { + int r; + Parser p; + const char *js; + + js = "\"strVar\" : \"hello world\""; + r = p.parse(string(js)); + check(r >= 0 && p[0].isString() + && p[1].isString()); + check(TOKEN_STRING(p[0], "strVar")); + check(TOKEN_STRING(p[1], "hello world")); + + js = "\"strVar\" : \"escapes: \\/\\r\\n\\t\\b\\f\\\"\\\\\""; + r = p.parse(string(js)); + check(r >= 0 && p[0].isString() + && p[1].isString()); + check(TOKEN_STRING(p[0], "strVar")); + check(TOKEN_STRING(p[1], "escapes: \\/\\r\\n\\t\\b\\f\\\"\\\\")); + + js = "\"strVar\" : \"\""; + r = p.parse(string(js)); + check(r >= 0 && p[0].isString() + && p[1].isString()); + check(TOKEN_STRING(p[0], "strVar")); + check(TOKEN_STRING(p[1], "")); + + return 0; +} + +int test_partial_string() { + int r; + Parser p; + const char *js; + + js = "\"x\": \"va"; + r = p.parse(string(js)); + check(r == ERROR_PART && p[0].isString()); + check(TOKEN_STRING(p[0], "x")); + check(p.size() == 1); + + char js_slash[] = "\"x\": \"va\\"; + r = p.parse(string(js_slash)); // intentionally not sizeof(js_slash) + check(r == ERROR_PART); + + char js_unicode[] = "\"x\": \"va\\u"; + r = p.parse(string(js_unicode)); // intentionally not sizeof(js_unicode) + check(r == ERROR_PART); + + js = "\"x\": \"valu"; + r = p.parse(string(js)); + check(r == ERROR_PART && p[0].isString()); + check(TOKEN_STRING(p[0], "x")); + check(p.size() == 1); + + js = "\"x\": \"value\""; + r = p.parse(string(js)); + check(r >= 0 && p[0].isString() + && p[1].isString()); + check(TOKEN_STRING(p[0], "x")); + check(TOKEN_STRING(p[1], "value")); + + js = "{\"x\": \"value\", \"y\": \"value y\"}"; + r = p.parse(string(js)); + check(r >= 0 + && p[0].isObject() + && p[1].isString() + && p[2].isString() + && p[3].isString() + && p[4].isString()); + check(TOKEN_STRING(p[1], "x")); + check(TOKEN_STRING(p[2], "value")); + check(TOKEN_STRING(p[3], "y")); + check(TOKEN_STRING(p[4], "value y")); + + return 0; +} + +int test_partial_array() { + int r; + Parser p; + const char *js; + + js = " [ 1, true, "; + r = p.parse(string(js)); + check(r == ERROR_PART && p[0].isArray() + && p[1].isPrimitive() && p[2].isPrimitive()); + + js = " [ 1, true, [123, \"hello"; + r = p.parse(string(js)); + check(r == ERROR_PART && p[0].isArray() + && p[1].isPrimitive() && p[2].isPrimitive() + && p[3].isArray() && p[4].isPrimitive()); + + js = " [ 1, true, [123, \"hello\"]"; + r = p.parse(string(js)); + check(r == ERROR_PART && p[0].isArray() + && p[1].isPrimitive() && p[2].isPrimitive() + && p[3].isArray() && p[4].isPrimitive() + && p[5].isString()); + /* check child nodes of the 2nd array */ + check(p[3].children() == 2); + + js = " [ 1, true, [123, \"hello\"]]"; + r = p.parse(string(js)); + check(r >= 0 && p[0].isArray() + && p[1].isPrimitive() && p[2].isPrimitive() + && p[3].isArray() && p[4].isPrimitive() + && p[5].isString()); + check(p[3].children() == 2); + check(p[0].children() == 3); + return 0; +} + +int test_objects_arrays() { + int r; + Parser p; + const char *js; + + js = "[10}"; + r = p.parse(string(js)); + check(r == ERROR_INVAL); + + js = "[10]"; + r = p.parse(string(js)); + check(r >= 0); + + js = "{\"a\": 1]"; + r = p.parse(string(js)); + check(r == ERROR_INVAL); + + js = "{\"a\": 1}"; + r = p.parse(string(js)); + check(r >= 0); + + return 0; +} + +int test_issue_22() { + int r; + Parser p; + const char *js; + + js = "{ \"height\":10, \"layers\":[ { \"data\":[6,6], \"height\":10, " + "\"name\":\"Calque de Tile 1\", \"opacity\":1, \"type\":\"tilelayer\", " + "\"visible\":true, \"width\":10, \"x\":0, \"y\":0 }], " + "\"orientation\":\"orthogonal\", \"properties\": { }, \"tileheight\":32, " + "\"tilesets\":[ { \"firstgid\":1, \"image\":\"..\\/images\\/tiles.png\", " + "\"imageheight\":64, \"imagewidth\":160, \"margin\":0, \"name\":\"Tiles\", " + "\"properties\":{}, \"spacing\":0, \"tileheight\":32, \"tilewidth\":32 }], " + "\"tilewidth\":32, \"version\":1, \"width\":10 }"; + r = p.parse(string(js)); + check(r >= 0); + return 0; +} + +int test_unicode_characters() { + Parser p; + const char *js; + + int r; + js = "{\"a\":\"\\uAbcD\"}"; + r = p.parse(string(js)); + check(r >= 0); + + js = "{\"a\":\"str\\u0000\"}"; + r = p.parse(string(js)); + check(r >= 0); + + js = "{\"a\":\"\\uFFFFstr\"}"; + r = p.parse(string(js)); + check(r >= 0); + + js = "{\"a\":\"str\\uFFGFstr\"}"; + r = p.parse(string(js)); + check(r == ERROR_INVAL); + + js = "{\"a\":\"str\\u@FfF\"}"; + r = p.parse(string(js)); + check(r == ERROR_INVAL); + + js = "{\"a\":[\"\\u028\"]}"; + r = p.parse(string(js)); + check(r == ERROR_INVAL); + + js = "{\"a\":[\"\\u0280\"]}"; + r = p.parse(string(js)); + check(r >= 0); + + return 0; +} + +int test_count() { + Parser p; + const char *js; + + js = "{}"; + check(p.parse(string(js)) == 1); + + js = "[]"; + check(p.parse(string(js)) == 1); + + js = "[[]]"; + check(p.parse(string(js)) == 2); + + js = "[[], []]"; + check(p.parse(string(js)) == 3); + + js = "[[], []]"; + check(p.parse(string(js)) == 3); + + js = "[[], [[]], [[], []]]"; + check(p.parse(string(js)) == 7); + + js = "[\"a\", [[], []]]"; + check(p.parse(string(js)) == 5); + + js = "[[], \"[], [[]]\", [[]]]"; + check(p.parse(string(js)) == 5); + + js = "[1, 2, 3]"; + check(p.parse(string(js)) == 4); + + js = "[1, 2, [3, \"a\"], null]"; + check(p.parse(string(js)) == 7); + + return 0; +} + +int test_keyvalue() { + const char *js; + int r; + Parser p; + vector tokens; + + js = "{\"a\": 0, \"b\": \"c\"}"; + + r = p.parse(string(js)); + check(r == 5); + check(p[0].children() == 2); /* two keys */ + check(p[1].children() == 1 && p[3].children() == 1); /* one value per key */ + check(p[2].children() == 0 && p[4].children() == 0); /* values have zero size */ + + js = "{\"a\"\n0}"; + r = p.parse(string(js)); + check(r == ERROR_INVAL); + + js = "{\"a\", 0}"; + r = p.parse(string(js)); + check(r == ERROR_INVAL); + + js = "{\"a\": {2}}"; + r = p.parse(string(js)); + check(r == ERROR_INVAL); + + js = "{\"a\": {2: 3}}"; + r = p.parse(string(js)); + check(r == ERROR_INVAL); + + js = "{\"a\": {\"a\": 2 3}}"; + r = p.parse(string(js)); + check(r == ERROR_INVAL); + return 0; +} + +int main() { + test(test_empty, "general test for a empty JSON objects/arrays"); + test(test_simple, "general test for a simple JSON string"); + test(test_primitive, "test primitive JSON data types"); + test(test_string, "test string JSON data types"); + test(test_partial_string, "test partial JSON string parsing"); + test(test_partial_array, "test partial array reading"); + test(test_objects_arrays, "test objects and arrays"); + test(test_unicode_characters, "test unicode characters"); + test(test_issue_22, "test issue #22"); + test(test_count, "test tokens count estimation"); + test(test_keyvalue, "test for keys/values"); + printf("PASSED: %d\nFAILED: %d\n", test_passed, test_failed); + return 0; +} diff --git a/browser/extensions/mortar/ppapi/LICENSE b/browser/extensions/mortar/ppapi/LICENSE new file mode 100644 index 000000000000..dd8b4c462eb5 --- /dev/null +++ b/browser/extensions/mortar/ppapi/LICENSE @@ -0,0 +1,51 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +/* +** Copyright (c) 2007-2010 The Khronos Group Inc. +** +** Permission is hereby granted, free of charge, to any person obtaining a +** copy of this software and/or associated documentation files (the +** "Materials"), to deal in the Materials without restriction, including +** without limitation the rights to use, copy, modify, merge, publish, +** distribute, sublicense, and/or sell copies of the Materials, and to +** permit persons to whom the Materials are furnished to do so, subject to +** the following conditions: +** +** The above copyright notice and this permission notice shall be included +** in all copies or substantial portions of the Materials. +** +** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. +*/ diff --git a/browser/extensions/mortar/ppapi/api/dev/pp_cursor_type_dev.idl b/browser/extensions/mortar/ppapi/api/dev/pp_cursor_type_dev.idl new file mode 100644 index 000000000000..08abec3b224c --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/dev/pp_cursor_type_dev.idl @@ -0,0 +1,56 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * This file defines enumerations for cursor types. + */ + +[assert_size(4),notypedef] enum PP_CursorType_Dev { + PP_CURSORTYPE_CUSTOM = -1, + PP_CURSORTYPE_POINTER = 0, + PP_CURSORTYPE_CROSS = 1, + PP_CURSORTYPE_HAND = 2, + PP_CURSORTYPE_IBEAM = 3, + PP_CURSORTYPE_WAIT = 4, + PP_CURSORTYPE_HELP = 5, + PP_CURSORTYPE_EASTRESIZE = 6, + PP_CURSORTYPE_NORTHRESIZE = 7, + PP_CURSORTYPE_NORTHEASTRESIZE = 8, + PP_CURSORTYPE_NORTHWESTRESIZE = 9, + PP_CURSORTYPE_SOUTHRESIZE = 10, + PP_CURSORTYPE_SOUTHEASTRESIZE = 11, + PP_CURSORTYPE_SOUTHWESTRESIZE = 12, + PP_CURSORTYPE_WESTRESIZE = 13, + PP_CURSORTYPE_NORTHSOUTHRESIZE = 14, + PP_CURSORTYPE_EASTWESTRESIZE = 15, + PP_CURSORTYPE_NORTHEASTSOUTHWESTRESIZE = 16, + PP_CURSORTYPE_NORTHWESTSOUTHEASTRESIZE = 17, + PP_CURSORTYPE_COLUMNRESIZE = 18, + PP_CURSORTYPE_ROWRESIZE = 19, + PP_CURSORTYPE_MIDDLEPANNING = 20, + PP_CURSORTYPE_EASTPANNING = 21, + PP_CURSORTYPE_NORTHPANNING = 22, + PP_CURSORTYPE_NORTHEASTPANNING = 23, + PP_CURSORTYPE_NORTHWESTPANNING = 24, + PP_CURSORTYPE_SOUTHPANNING = 25, + PP_CURSORTYPE_SOUTHEASTPANNING = 26, + PP_CURSORTYPE_SOUTHWESTPANNING = 27, + PP_CURSORTYPE_WESTPANNING = 28, + PP_CURSORTYPE_MOVE = 29, + PP_CURSORTYPE_VERTICALTEXT = 30, + PP_CURSORTYPE_CELL = 31, + PP_CURSORTYPE_CONTEXTMENU = 32, + PP_CURSORTYPE_ALIAS = 33, + PP_CURSORTYPE_PROGRESS = 34, + PP_CURSORTYPE_NODROP = 35, + PP_CURSORTYPE_COPY = 36, + PP_CURSORTYPE_NONE = 37, + PP_CURSORTYPE_NOTALLOWED = 38, + PP_CURSORTYPE_ZOOMIN = 39, + PP_CURSORTYPE_ZOOMOUT = 40, + PP_CURSORTYPE_GRAB = 41, + PP_CURSORTYPE_GRABBING = 42 +}; + diff --git a/browser/extensions/mortar/ppapi/api/dev/pp_print_settings_dev.idl b/browser/extensions/mortar/ppapi/api/dev/pp_print_settings_dev.idl new file mode 100644 index 000000000000..fafcc08b28bc --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/dev/pp_print_settings_dev.idl @@ -0,0 +1,45 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * This file defines the struct for PrintSettings. + */ + +[assert_size(4)] +enum PP_PrintOrientation_Dev { + PP_PRINTORIENTATION_NORMAL = 0, + PP_PRINTORIENTATION_ROTATED_90_CW = 1, + PP_PRINTORIENTATION_ROTATED_180 = 2, + PP_PRINTORIENTATION_ROTATED_90_CCW = 3 +}; + +[assert_size(4)] +enum PP_PrintOutputFormat_Dev { + PP_PRINTOUTPUTFORMAT_RASTER = 1u << 0, + PP_PRINTOUTPUTFORMAT_PDF = 1u << 1, + PP_PRINTOUTPUTFORMAT_POSTSCRIPT = 1u << 2, + PP_PRINTOUTPUTFORMAT_EMF = 1u << 3 +}; + +[assert_size(4)] +enum PP_PrintScalingOption_Dev { + PP_PRINTSCALINGOPTION_NONE = 0, + PP_PRINTSCALINGOPTION_FIT_TO_PRINTABLE_AREA = 1, + PP_PRINTSCALINGOPTION_SOURCE_SIZE = 2 +}; + +[assert_size(60)] +struct PP_PrintSettings_Dev { + /** This is the size of the printable area in points (1/72 of an inch). */ + PP_Rect printable_area; + PP_Rect content_area; + PP_Size paper_size; + int32_t dpi; + PP_PrintOrientation_Dev orientation; + PP_PrintScalingOption_Dev print_scaling_option; + PP_Bool grayscale; + /** Note that Chrome currently only supports PDF printing. */ + PP_PrintOutputFormat_Dev format; +}; diff --git a/browser/extensions/mortar/ppapi/api/dev/pp_video_capture_dev.idl b/browser/extensions/mortar/ppapi/api/dev/pp_video_capture_dev.idl new file mode 100644 index 000000000000..7acee8906805 --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/dev/pp_video_capture_dev.idl @@ -0,0 +1,47 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * Structs for dealing with video capture. + */ + +/** + * PP_VideoCaptureDeviceInfo_Dev is a structure that represent a video capture + * configuration, such as resolution and frame rate. + */ +[assert_size(12)] +struct PP_VideoCaptureDeviceInfo_Dev { + uint32_t width; + uint32_t height; + uint32_t frames_per_second; +}; + +/** + * PP_VideoCaptureStatus_Dev is an enumeration that defines the various possible + * states of a VideoCapture. + */ +[assert_size(4)] +enum PP_VideoCaptureStatus_Dev { + /** + * Initial state, capture is stopped. + */ + PP_VIDEO_CAPTURE_STATUS_STOPPED = 0, + /** + * StartCapture has been called, but capture hasn't started yet. + */ + PP_VIDEO_CAPTURE_STATUS_STARTING = 1, + /** + * Capture has been started. + */ + PP_VIDEO_CAPTURE_STATUS_STARTED = 2, + /** + * Capture has been started, but is paused because no buffer is available. + */ + PP_VIDEO_CAPTURE_STATUS_PAUSED = 3, + /** + * StopCapture has been called, but capture hasn't stopped yet. + */ + PP_VIDEO_CAPTURE_STATUS_STOPPING = 4 +}; diff --git a/browser/extensions/mortar/ppapi/api/dev/pp_video_dev.idl b/browser/extensions/mortar/ppapi/api/dev/pp_video_dev.idl new file mode 100644 index 000000000000..1c70342effcf --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/dev/pp_video_dev.idl @@ -0,0 +1,126 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * NOTE: these must be kept in sync with the versions in media/! + */ + + +/** + * Video format. + * + * Keep the values in this enum unique, as they imply format (h.264 vs. VP8, + * for example), and keep the values for a particular format grouped together + * for clarity. + * Note: Keep these in sync with media::VideoCodecProfile. + */ +[assert_size(4)] +enum PP_VideoDecoder_Profile { + PP_VIDEODECODER_PROFILE_UNKNOWN = -1, + PP_VIDEODECODER_H264PROFILE_NONE = 0, + PP_VIDEODECODER_H264PROFILE_BASELINE = 1, + PP_VIDEODECODER_H264PROFILE_MAIN = 2, + PP_VIDEODECODER_H264PROFILE_EXTENDED = 3, + PP_VIDEODECODER_H264PROFILE_HIGH = 4, + PP_VIDEODECODER_H264PROFILE_HIGH10PROFILE = 5, + PP_VIDEODECODER_H264PROFILE_HIGH422PROFILE = 6, + PP_VIDEODECODER_H264PROFILE_HIGH444PREDICTIVEPROFILE = 7, + PP_VIDEODECODER_H264PROFILE_SCALABLEBASELINE = 8, + PP_VIDEODECODER_H264PROFILE_SCALABLEHIGH = 9, + PP_VIDEODECODER_H264PROFILE_STEREOHIGH = 10, + PP_VIDEODECODER_H264PROFILE_MULTIVIEWHIGH = 11, + PP_VIDEODECODER_VP8PROFILE_ANY = 12 +}; + +/** + * The data structure for video bitstream buffer. + */ +[assert_size(12)] +struct PP_VideoBitstreamBuffer_Dev { + /** + * Client-specified identifier for the bitstream buffer. Valid values are + * non-negative. + */ + int32_t id; + + /** + * Buffer to hold the bitstream data. Should be allocated using the + * PPB_Buffer interface for consistent interprocess behaviour. + */ + PP_Resource data; + + /** + * Size of the bitstream contained in buffer (in bytes). + */ + uint32_t size; +}; + +/** + * Struct for specifying texture-backed picture data. + */ +[assert_size(16)] +struct PP_PictureBuffer_Dev { + /** + * Client-specified id for the picture buffer. By using this value client can + * keep track of the buffers it has assigned to the video decoder and how they + * are passed back to it. Valid values are non-negative. + */ + int32_t id; + + /** + * Dimensions of the buffer. + */ + PP_Size size; + + /** + * Texture ID in the given context where picture is stored. + */ + uint32_t texture_id; +}; + +/** + * Structure to describe a decoded output frame. + */ +[assert_size(8)] +struct PP_Picture_Dev { + /** + * ID of the picture buffer where the picture is stored. + */ + int32_t picture_buffer_id; + + /** + * ID of the bitstream from which this data was decoded. + */ + int32_t bitstream_buffer_id; +}; + +/** + * Decoder error codes reported to the plugin. A reasonable naive + * error handling policy is for the plugin to Destroy() the decoder on error. + */ +[assert_size(4)] +enum PP_VideoDecodeError_Dev { + /** + * An operation was attempted during an incompatible decoder state. + */ + PP_VIDEODECODERERROR_ILLEGAL_STATE = 1, + + /** + * Invalid argument was passed to an API method. + */ + PP_VIDEODECODERERROR_INVALID_ARGUMENT = 2, + + /** + * Encoded input is unreadable. + */ + PP_VIDEODECODERERROR_UNREADABLE_INPUT = 3, + + /** + * A failure occurred at the browser layer or lower. Examples of such + * failures include GPU hardware failures, GPU driver failures, GPU library + * failures, browser programming errors, and so on. + */ + PP_VIDEODECODERERROR_PLATFORM_FAILURE = 4 +}; diff --git a/browser/extensions/mortar/ppapi/api/dev/ppb_audio_input_dev.idl b/browser/extensions/mortar/ppapi/api/dev/ppb_audio_input_dev.idl new file mode 100644 index 000000000000..71ce6eb7525f --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/dev/ppb_audio_input_dev.idl @@ -0,0 +1,198 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * This file defines the PPB_AudioInput_Dev interface, which + * provides realtime audio input capture. + */ + +label Chrome { + M25 = 0.3, + M30 = 0.4 +}; + +/** + * PPB_AudioInput_Callback defines the type of an audio callback + * function used to provide the audio buffer with data. This callback will be + * called on a separate thread from the creation thread. + * + * @param[in] sample_buffer A buffer providing audio input data. + * @param[in] buffer_size_in_bytes The size of the buffer in bytes. + * @param[in] latency The time that has elapsed since the data was recorded. + * @param[inout] user_data An opaque pointer that was passed into + * PPB_AudioInput_Dev.Open(). + */ +typedef void PPB_AudioInput_Callback([in] mem_t sample_buffer, + [in] uint32_t buffer_size_in_bytes, + [in, version=0.4] PP_TimeDelta latency, + [inout] mem_t user_data); + +/** + * The PPB_AudioInput_Dev interface contains pointers to several + * functions for handling audio input resources. + * + * TODO(brettw) before moving out of dev, we need to resolve the issue of + * the mismatch between the current audio config interface and this one. + * + * In particular, the params for input assume stereo, but this class takes + * everything as mono. We either need to not use an audio config resource, or + * add mono support. + * + * In addition, RecommendSampleFrameCount is completely wrong for audio input. + * RecommendSampleFrameCount returns the frame count for the current + * low-latency output device, which is likely inappropriate for a random input + * device. We may want to move the "recommend" functions to the input or output + * classes rather than the config. + */ +[macro="PPB_AUDIO_INPUT_DEV_INTERFACE"] +interface PPB_AudioInput_Dev { + /** + * Creates an audio input resource. + * + * @param[in] instance A PP_Instance identifying one instance of + * a module. + * + * @return A PP_Resource corresponding to an audio input resource + * if successful, 0 if failed. + */ + PP_Resource Create( + [in] PP_Instance instance); + + /** + * Determines if the given resource is an audio input resource. + * + * @param[in] resource A PP_Resource containing a resource. + * + * @return A PP_Bool containing PP_TRUE if the given + * resource is an audio input resource, otherwise PP_FALSE. + */ + PP_Bool IsAudioInput( + [in] PP_Resource resource); + + /** + * Enumerates audio input devices. + * + * @param[in] audio_input A PP_Resource corresponding to an audio + * input resource. + * @param[in] output An output array which will receive + * PPB_DeviceRef_Dev resources on success. Please note that the + * ref count of those resources has already been increased by 1 for the + * caller. + * @param[in] callback A PP_CompletionCallback to run on + * completion. + * + * @return An error code from pp_errors.h. + */ + [version=0.3] + int32_t EnumerateDevices( + [in] PP_Resource audio_input, + [in] PP_ArrayOutput output, + [in] PP_CompletionCallback callback); + + /** + * Requests device change notifications. + * + * @param[in] audio_input A PP_Resource corresponding to an audio + * input resource. + * @param[in] callback The callback to receive notifications. If not NULL, it + * will be called once for the currently available devices, and then every + * time the list of available devices changes. All calls will happen on the + * same thread as the one on which MonitorDeviceChange() is called. It will + * receive notifications until audio_input is destroyed or + * MonitorDeviceChange() is called to set a new callback for + * audio_input. You can pass NULL to cancel sending + * notifications. + * @param[inout] user_data An opaque pointer that will be passed to + * callback. + * + * @return An error code from pp_errors.h. + */ + [version=0.3] + int32_t MonitorDeviceChange( + [in] PP_Resource audio_input, + [in] PP_MonitorDeviceChangeCallback callback, + [inout] mem_t user_data); + + /** + * Opens an audio input device. No sound will be captured until + * StartCapture() is called. + * + * @param[in] audio_input A PP_Resource corresponding to an audio + * input resource. + * @param[in] device_ref Identifies an audio input device. It could be one of + * the resource in the array returned by EnumerateDevices(), or 0 which means + * the default device. + * @param[in] config A PPB_AudioConfig audio configuration + * resource. + * @param[in] audio_input_callback A PPB_AudioInput_Callback + * function that will be called when data is available. + * @param[inout] user_data An opaque pointer that will be passed into + * audio_input_callback. + * @param[in] callback A PP_CompletionCallback to run when this + * open operation is completed. + * + * @return An error code from pp_errors.h. + */ + int32_t Open( + [in] PP_Resource audio_input, + [in] PP_Resource device_ref, + [in] PP_Resource config, + [in] PPB_AudioInput_Callback audio_input_callback, + [inout] mem_t user_data, + [in] PP_CompletionCallback callback); + + /** + * Returns an audio config resource for the given audio input resource. + * + * @param[in] audio_input A PP_Resource corresponding to an audio + * input resource. + * + * @return A PP_Resource containing the audio config resource if + * successful. + */ + PP_Resource GetCurrentConfig( + [in] PP_Resource audio_input); + + /** + * Starts the capture of the audio input resource and begins periodically + * calling the callback. + * + * @param[in] audio_input A PP_Resource corresponding to an audio + * input resource. + * + * @return A PP_Bool containing PP_TRUE if + * successful, otherwise PP_FALSE. + * Also returns PP_TRUE (and is a no-op) if called while capture + * is already started. + */ + PP_Bool StartCapture( + [in] PP_Resource audio_input); + + /** + * Stops the capture of the audio input resource. + * + * @param[in] audio_input A PP_Resource containing the audio input resource. + * + * @return A PP_Bool containing PP_TRUE if + * successful, otherwise PP_FALSE. + * Also returns PP_TRUE (and is a no-op) if called while capture + * is already stopped. If a buffer is being captured, StopCapture will block + * until the call completes. + */ + PP_Bool StopCapture( + [in] PP_Resource audio_input); + + /** + * Closes the audio input device, and stops capturing if necessary. It is + * not valid to call Open() again after a call to this method. + * If an audio input resource is destroyed while a device is still open, then + * it will be implicitly closed, so you are not required to call this method. + * + * @param[in] audio_input A PP_Resource corresponding to an audio + * input resource. + */ + void Close( + [in] PP_Resource audio_input); +}; diff --git a/browser/extensions/mortar/ppapi/api/dev/ppb_buffer_dev.idl b/browser/extensions/mortar/ppapi/api/dev/ppb_buffer_dev.idl new file mode 100644 index 000000000000..0fbc5b8fceba --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/dev/ppb_buffer_dev.idl @@ -0,0 +1,51 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * This file defines the PPB_Buffer_Dev interface. + */ + +label Chrome { + M14 = 0.4 +}; + +interface PPB_Buffer_Dev { + /** + * Allocates a buffer of the given size in bytes. The return value will have + * a non-zero ID on success, or zero on failure. Failure means the module + * handle was invalid. The buffer will be initialized to contain zeroes. + */ + PP_Resource Create( + [in] PP_Instance instance, + [in] uint32_t size_in_bytes); + + /** + * Returns PP_TRUE if the given resource is a Buffer. Returns PP_FALSE if the + * resource is invalid or some type other than a Buffer. + */ + PP_Bool IsBuffer( + [in] PP_Resource resource); + + /** + * Gets the size of the buffer. Returns PP_TRUE on success, PP_FALSE + * if the resource is not a buffer. On failure, |*size_in_bytes| is not set. + */ + PP_Bool Describe( + [in] PP_Resource resource, + [out] uint32_t size_in_bytes); + + /** + * Maps this buffer into the plugin address space and returns a pointer to + * the beginning of the data. + */ + mem_t Map( + [in] PP_Resource resource); + + /** + * Unmaps this buffer. + */ + void Unmap( + [in] PP_Resource resource); +}; diff --git a/browser/extensions/mortar/ppapi/api/dev/ppb_char_set_dev.idl b/browser/extensions/mortar/ppapi/api/dev/ppb_char_set_dev.idl new file mode 100644 index 000000000000..1e63ecc97cb6 --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/dev/ppb_char_set_dev.idl @@ -0,0 +1,106 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * This file defines the PPB_CharSet_Dev interface. + */ + +label Chrome { + M14 = 0.4 +}; + +[assert_size(4)] enum PP_CharSet_ConversionError { + /** + * Causes the entire conversion to fail if an error is encountered. The + * conversion function will return NULL. + */ + PP_CHARSET_CONVERSIONERROR_FAIL, + + /** + * Silently skips over errors. Unrepresentable characters and input encoding + * errors will be removed from the output. + */ + PP_CHARSET_CONVERSIONERROR_SKIP, + + /** + * Replaces the error or unrepresentable character with a substitution + * character. When converting to a Unicode character set (UTF-8 or UTF-16) it + * will use the unicode "substitution character" U+FFFD. When converting to + * another character set, the character will be charset-specific. For many + * languages this will be the representation of the '?' character. + */ + PP_CHARSET_CONVERSIONERROR_SUBSTITUTE +}; + +[version=0.0] +describe { + uint16_ptr_t; +}; + +#inline c + +typedef uint16_t* uint16_ptr_t; + +#endinl + +/** + * The PPB_CharSet_Trusted interface provides functions for + * converting between character sets. + * + * This inteface is provided for trusted plugins only since in Native Client it + * would require an expensive out-of-process IPC call for each conversion, + * which makes performance unacceptable. Native Client plugins should include + * ICU or some other library if they need this feature. + */ +interface PPB_CharSet_Dev { + /** + * Converts the UTF-16 string pointed to by |*utf16| to an 8-bit string in + * the specified code page. |utf16_len| is measured in UTF-16 units, not + * bytes. This value may not be NULL. + * + * The given output buffer will be filled up to output_length bytes with the + * result. output_length will be updated with the number of bytes required + * for the given string. The output buffer may be null to just retrieve the + * required buffer length. + * + * This function will return PP_FALSE if there was an error converting the + * string and you requested PP_CHARSET_CONVERSIONERROR_FAIL, or the output + * character set was unknown. Otherwise, it will return PP_TRUE. + */ + str_t UTF16ToCharSet([in] PP_Instance instance, + [in, size_as=utf16_len] uint16_t[] utf16, + [in] uint32_t utf16_len, + [in] str_t output_char_set, + [in] PP_CharSet_ConversionError on_error, + [out] uint32_t output_length); + + /** + * Same as UTF16ToCharSet except converts in the other direction. The input + * is in the given charset, and the |input_len| is the number of bytes in + * the |input| string. + * + * Note that the output_utf16_length is measured in UTF-16 characters. + * + * Since UTF16 can represent every Unicode character, the only time the + * replacement character will be used is if the encoding in the input string + * is incorrect. + */ + uint16_ptr_t CharSetToUTF16([in] PP_Instance instance, + [in] str_t input, + [in] uint32_t input_len, + [in] str_t input_char_set, + [in] PP_CharSet_ConversionError on_error, + [out] uint32_t output_utf16_length); + + /** + * Returns a string var representing the current multi-byte character set of + * the current system. + * + * WARNING: You really shouldn't be using this function unless you're dealing + * with legacy data. You should be using UTF-8 or UTF-16 and you don't have + * to worry about the character sets. + */ + PP_Var GetDefaultCharSet([in] PP_Instance instance); +}; diff --git a/browser/extensions/mortar/ppapi/api/dev/ppb_crypto_dev.idl b/browser/extensions/mortar/ppapi/api/dev/ppb_crypto_dev.idl new file mode 100644 index 000000000000..51b2baec334c --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/dev/ppb_crypto_dev.idl @@ -0,0 +1,20 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * This file defines the PPB_Crypto_Dev interface. + */ + +label Chrome { + M13 = 0.1 +}; + +interface PPB_Crypto_Dev { + /** + * Fills the given buffer with random bytes. This is potentially slow so only + * request the amount of data you need. + */ + void GetRandomBytes([out] str_t buffer, [in] uint32_t num_bytes); +}; diff --git a/browser/extensions/mortar/ppapi/api/dev/ppb_cursor_control_dev.idl b/browser/extensions/mortar/ppapi/api/dev/ppb_cursor_control_dev.idl new file mode 100644 index 000000000000..8f5a107615dc --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/dev/ppb_cursor_control_dev.idl @@ -0,0 +1,65 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * This file defines the PPB_CursorControl_Dev interface + * implemented by the browser for controlling the cursor. + */ + +label Chrome { + M14 = 0.4 +}; + +[macro="PPB_CURSOR_CONTROL_DEV_INTERFACE"] +interface PPB_CursorControl_Dev { + /** + * Set a cursor. If "type" is PP_CURSORTYPE_CUSTOM, then "custom_image" + * must be an ImageData resource containing the cursor and "hot_spot" must + * contain the offset within that image that refers to the cursor's position. + */ + PP_Bool SetCursor([in] PP_Instance instance, + [in] PP_CursorType_Dev type, + [in] PP_Resource custom_image, + [in] PP_Point hot_spot); + + /** + * This method causes the cursor to be moved to the center of the + * instance and be locked, preventing the user from moving it. + * The cursor is implicitly hidden from the user while locked. + * Cursor lock may only be requested in response to a + * PP_InputEvent_MouseDown, and then only if the event was generated via + * user gesture. + * + * While the cursor is locked, any movement of the mouse will + * generate a PP_InputEvent_Type_MouseMove, whose x and y values + * indicate the position the cursor would have been moved to had + * the cursor not been locked, and had the screen been infinite in size. + * + * The browser may revoke cursor lock for reasons including but not + * limited to the user pressing the ESC key, the user activating + * another program via a reserved keystroke (e.g., ALT+TAB), or + * some other system event. + * + * Returns PP_TRUE if the cursor could be locked, PP_FALSE otherwise. + */ + PP_Bool LockCursor([in] PP_Instance instance); + + /** + * Causes the cursor to be unlocked, allowing it to track user + * movement again. + */ + PP_Bool UnlockCursor([in] PP_Instance instance); + + /** + * Returns PP_TRUE if the cursor is locked, PP_FALSE otherwise. + */ + PP_Bool HasCursorLock([in] PP_Instance instance); + + /** + * Returns PP_TRUE if the cursor can be locked, PP_FALSE otherwise. + */ + PP_Bool CanLockCursor([in] PP_Instance instance); +}; + diff --git a/browser/extensions/mortar/ppapi/api/dev/ppb_device_ref_dev.idl b/browser/extensions/mortar/ppapi/api/dev/ppb_device_ref_dev.idl new file mode 100644 index 000000000000..98d127234f4b --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/dev/ppb_device_ref_dev.idl @@ -0,0 +1,76 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * This file defines the PPB_DeviceRef_Dev interface. + */ + +[generate_thunk] + +label Chrome { + M18 = 0.1 +}; + +/** + * Defines the callback type to receive device change notifications for + * PPB_AudioInput_Dev.MonitorDeviceChange() and + * PPB_VideoCapture_Dev.MonitorDeviceChange(). + * + * @param[inout] user_data The opaque pointer that the caller passed into + * MonitorDeviceChange(). + * @param[in] device_count How many devices in the array. + * @param[in] devices An array of PPB_DeviceRef_Dev. Please note + * that the ref count of the elements is not increased on behalf of the plugin. + */ +typedef void PP_MonitorDeviceChangeCallback( + [inout] mem_t user_data, + [in] uint32_t device_count, + [in, size_is(device_count)] PP_Resource[] devices); + +/** + * Device types. + */ +[assert_size(4)] +enum PP_DeviceType_Dev { + PP_DEVICETYPE_DEV_INVALID = 0, + PP_DEVICETYPE_DEV_AUDIOCAPTURE = 1, + PP_DEVICETYPE_DEV_VIDEOCAPTURE = 2 +}; + +interface PPB_DeviceRef_Dev { + /** + * Determines if the provided resource is a device reference. + * + * @param[in] resource A PP_Resource corresponding to a generic + * resource. + * + * @return A PP_Bool that is PP_TRUE if the given + * resource is a device reference, otherwise PP_FALSE. + */ + PP_Bool IsDeviceRef([in] PP_Resource resource); + + /** + * Gets the device type. + * + * @param[in] device_ref A PP_Resource corresponding to a device + * reference. + * + * @return A PP_DeviceType_Dev value. + */ + [on_failure=PP_DEVICETYPE_DEV_INVALID] + PP_DeviceType_Dev GetType([in] PP_Resource device_ref); + + /** + * Gets the device name. + * + * @param[in] device_ref A PP_Resource corresponding to a device + * reference. + * + * @return A PP_Var of type PP_VARTYPE_STRING + * containing the name of the device if successful; a PP_Var of + * type PP_VARTYPE_UNDEFINED if failed. + */ + PP_Var GetName([in] PP_Resource device_ref); +}; diff --git a/browser/extensions/mortar/ppapi/api/dev/ppb_file_chooser_dev.idl b/browser/extensions/mortar/ppapi/api/dev/ppb_file_chooser_dev.idl new file mode 100644 index 000000000000..594ba3e0d7b2 --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/dev/ppb_file_chooser_dev.idl @@ -0,0 +1,155 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + + +/** + * This file defines the PPB_FileChooser_Dev interface. + */ + +[generate_thunk] + +label Chrome { + M16 = 0.5, + M19 = 0.6 +}; + +/** + * This enumeration contains constants to control the behavior of the file + * chooser dialog. + */ +[assert_size(4)] +enum PP_FileChooserMode_Dev { + /** + * Mode for choosing a single existing file. + */ + PP_FILECHOOSERMODE_OPEN = 0, + /** + * Mode for choosing multiple existing files. + */ + PP_FILECHOOSERMODE_OPENMULTIPLE = 1 +}; + +interface PPB_FileChooser_Dev { + /** + * This function creates a file chooser dialog resource. The chooser is + * associated with a particular instance, so that it may be positioned on the + * screen relative to the tab containing the instance. + * + * @param[in] instance A PP_Instance identifying one instance + * of a module. + * @param[in] mode A PP_FileChooserMode_Dev value that controls + * the behavior of the file chooser dialog. + * @param[in] accept_types A comma-separated list of MIME types and file + * extensions such as "audio/ *,text/plain,.html" (note there should be no + * space between the '/' and the '*', but one is added to avoid confusing C++ + * comments). The dialog may restrict selectable files to the specified MIME + * types and file extensions. If a string in the comma-separated list begins + * with a period (.) then the string is interpreted as a file extension, + * otherwise it is interpreted as a MIME-type. An empty string or an undefined + * var may be given to indicate that all types should be accepted. + * + * @return A PP_Resource containing the file chooser if + * successful or 0 if it could not be created. + */ + PP_Resource Create( + [in] PP_Instance instance, + [in] PP_FileChooserMode_Dev mode, + [in] PP_Var accept_types); + + /** + * Determines if the provided resource is a file chooser. + * + * @param[in] resource A PP_Resource corresponding to a generic + * resource. + * + * @return A PP_Bool that is PP_TRUE if the given + * resource is a file chooser resource, otherwise PP_FALSE. + */ + PP_Bool IsFileChooser( + [in] PP_Resource resource); + + /** + * This function displays a previously created file chooser resource as a + * dialog box, prompting the user to choose a file or files. This function + * must be called in response to a user gesture, such as a mouse click or + * touch event. The callback is called with PP_OK on successful completion + * with a file (or files) selected, PP_ERROR_USERCANCEL if the user selected + * no file, or another error code from pp_errors.h on failure. + * + * Subtle note: This function will only work when the tab containing + * the plugin is visible. Show will fail if the tab is in the background. + * Since it's not normally possible to get input events while invisible, this + * is not an issue. But there is a race condition because events are + * processed asynchronously that authors should be aware of. If the user + * clicks and switches tabs very quickly, a plugin could believe the tab is + * visible while Chrome believes it is invisible and the Show() call will + * fail. This will not generally cause user confusion since the user will + * have switched tabs and will not want to see a file chooser from a + * different tab. + * + * @param[in] chooser The file chooser resource. + * @param[in] callback A CompletionCallback to be called after + * the user has closed the file chooser dialog. + * + * @return PP_OK_COMPLETIONPENDING if request to show the dialog was + * successful, another error code from pp_errors.h on failure. + */ + [deprecate=0.6] + int32_t Show( + [in] PP_Resource chooser, + [in] PP_CompletionCallback callback); + + /** + * After a successful completion callback call from Show, this method may be + * used to query the chosen files. It should be called in a loop until it + * returns 0. Their file system type will be PP_FileSystemType_External. If + * the user chose no files or canceled the dialog, then this method will + * simply return 0 the first time it is called. + * + * @param[in] chooser The file chooser resource. + * + * @return A PP_Resource containing the next file chosen by the + * user, or 0 if there are no more files. + */ + [deprecate=0.6] + PP_Resource GetNextChosenFile( + [in] PP_Resource chooser); + + /** + * This function displays a previously created file chooser resource as a + * dialog box, prompting the user to choose a file or files. This function + * must be called in response to a user gesture, such as a mouse click or + * touch event. The callback is called with PP_OK on successful completion + * with a file (or files) selected, PP_ERROR_USERCANCEL if the user selected + * no file, or another error code from pp_errors.h on failure. + * + * Subtle note: This function will only work when the tab containing + * the plugin is visible. Show() will fail if the tab is in the background. + * Since it's not normally possible to get input events while invisible, this + * is not normally an issue. But there is a race condition because events are + * processed asynchronously. If the user clicks and switches tabs very + * quickly, a plugin could believe the tab is visible while Chrome believes + * it is invisible and the Show() call will fail. This will not generally + * cause user confusion since the user will have switched tabs and will not + * want to see a file chooser from a different tab. + * + * @param[in] chooser The file chooser resource. + * + * @param[in] output An output array which will receive PP_Resource(s) + * identifying the PPB_FileRef objects that the user selected on + * success. + * + * @param[in] callback A CompletionCallback to be called after + * the user has closed the file chooser dialog. + * + * @return PP_OK_COMPLETIONPENDING if request to show the dialog was + * successful, another error code from pp_errors.h on failure. + */ + [version=0.6] + int32_t Show([in] PP_Resource chooser, + [in] PP_ArrayOutput output, + [in] PP_CompletionCallback callback); +}; + diff --git a/browser/extensions/mortar/ppapi/api/dev/ppb_font_dev.idl b/browser/extensions/mortar/ppapi/api/dev/ppb_font_dev.idl new file mode 100644 index 000000000000..d2051a0be45c --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/dev/ppb_font_dev.idl @@ -0,0 +1,261 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * This file defines the PPB_Font_Dev interface. + */ +label Chrome { + M14 = 0.6 +}; + +[assert_size(4)] +enum PP_FontFamily_Dev { + /** + * Uses the user's default web page font (normally either the default serif + * or sans serif font). + */ + PP_FONTFAMILY_DEFAULT = 0, + + /** + * These families will use the default web page font corresponding to the + * given family. + */ + PP_FONTFAMILY_SERIF = 1, + PP_FONTFAMILY_SANSSERIF = 2, + PP_FONTFAMILY_MONOSPACE = 3 +}; + +/** + * Specifies the font weight. Normally users will only use NORMAL or BOLD. + */ +[assert_size(4)] +enum PP_FontWeight_Dev { + PP_FONTWEIGHT_100 = 0, + PP_FONTWEIGHT_200 = 1, + PP_FONTWEIGHT_300 = 2, + PP_FONTWEIGHT_400 = 3, + PP_FONTWEIGHT_500 = 4, + PP_FONTWEIGHT_600 = 5, + PP_FONTWEIGHT_700 = 6, + PP_FONTWEIGHT_800 = 7, + PP_FONTWEIGHT_900 = 8, + PP_FONTWEIGHT_NORMAL = PP_FONTWEIGHT_400, + PP_FONTWEIGHT_BOLD = PP_FONTWEIGHT_700 +}; + +[assert_size(48)] +struct PP_FontDescription_Dev { + /** + * Font face name as a string. This can also be an undefined var, in which + * case the generic family will be obeyed. If the face is not available on + * the system, the browser will attempt to do font fallback or pick a default + * font. + */ + PP_Var face; + + /** + * When Create()ing a font and the face is an undefined var, the family + * specifies the generic font family type to use. If the face is specified, + * this will be ignored. + * + * When Describe()ing a font, the family will be the value you passed in when + * the font was created. In other words, if you specify a face name, the + * family will not be updated to reflect whether the font name you requested + * is serif or sans serif. + */ + PP_FontFamily_Dev family; + + /** + * Size in pixels. + * + * You can specify 0 to get the default font size. The default font size + * may vary depending on the requested font. The typical example is that + * the user may have a different font size for the default monospace font to + * give it a similar optical size to the proportionally spaced fonts. + */ + uint32_t size; + + /** + * Normally you will use either PP_FONTWEIGHT_NORMAL or PP_FONTWEIGHT_BOLD. + */ + PP_FontWeight_Dev weight; + + PP_Bool italic; + PP_Bool small_caps; + + /** + * Adjustment to apply to letter and word spacing, respectively. Initialize + * to 0 to get normal spacing. Negative values bring letters/words closer + * together, positive values separate them. + */ + int32_t letter_spacing; + int32_t word_spacing; + + /** + * Ensure that this struct is 48-bytes wide by padding the end. In some + * compilers, PP_Var is 8-byte aligned, so those compilers align this struct + * on 8-byte boundaries as well and pad it to 16 bytes even without this + * padding attribute. This padding makes its size consistent across + * compilers. + */ + int32_t padding; +}; + +[assert_size(20)] +struct PP_FontMetrics_Dev { + int32_t height; + int32_t ascent; + int32_t descent; + int32_t line_spacing; + int32_t x_height; +}; + +[assert_size(24)] +struct PP_TextRun_Dev { + /** + * This var must either be a string or a null/undefined var (which will be + * treated as a 0-length string). + */ + PP_Var text; + + /** + * Set to PP_TRUE if the text is right-to-left. + * + * When override_direction is false, the browser will perform + * the Unicode Bidirectional Algorithm (http://unicode.org/reports/tr9/) on + * the text. The value of the rtl flag specifies the + * directionality of the surrounding environment. This means that Hebrew + * word will always display right to left, even if rtl is false. + * + * When override_direction is true, no autodetection will be done + * and rtl specifies the direction of the text. + * + * TODO(brettw) note that autodetection with rtl = true is currently + * unimplemented. + */ + PP_Bool rtl; + + /** + * Set to PP_TRUE to force the directionality of the text regardless of + * content. + * + * If this flag is set, the browser will skip autodetection of the content + * and will display all text in the direction specified by the + * rtl flag. + */ + PP_Bool override_direction; +}; + +interface PPB_Font_Dev { + /** + * Returns a list of all available font families on the system. You can use + * this list to decide whether to Create() a font. + * + * The return value will be a single string with null characters delimiting + * the end of each font name. For example: "Arial\0Courier\0Times\0". + * + * Returns an undefined var on failure (this typically means you passed an + * invalid instance). + */ + PP_Var GetFontFamilies( + [in] PP_Instance instance); + + /** + * Returns a font which best matches the given description. The return value + * will have a non-zero ID on success, or zero on failure. + */ + PP_Resource Create( + [in] PP_Instance instance, + [in] PP_FontDescription_Dev description); + + /** + * Returns PP_TRUE if the given resource is a Font. Returns PP_FALSE if the + * resource is invalid or some type other than a Font. + */ + PP_Bool IsFont( + [in] PP_Resource resource); + + /** + * Loads the description and metrics of the font into the given structures. + * The description will be different than the description the font was + * created with since it will be filled with the real values from the font + * that was actually selected. + * + * The PP_Var in the description should be of type Void on input. On output, + * this will contain the string and will have a reference count of 1. The + * plugin is responsible for calling Release on this var. + * + * Returns PP_TRUE on success, PP_FALSE if the font is invalid or if the Var + * in the description isn't Null (to prevent leaks). + */ + PP_Bool Describe( + [in] PP_Resource font, + [out] PP_FontDescription_Dev description, + [out] PP_FontMetrics_Dev metrics); + + /** + * Draws the text to the image buffer. + * + * The given point represents the baseline of the left edge of the font, + * regardless of whether it is left-to-right or right-to-left (in the case of + * RTL text, this will actually represent the logical end of the text). + * + * The clip is optional and may be NULL. In this case, the text will be + * clipped to the image. + * + * The image_data_is_opaque flag indicates whether subpixel antialiasing can + * be performed, if it is supported. When the image below the text is + * opaque, subpixel antialiasing is supported and you should set this to + * PP_TRUE to pick up the user's default preferences. If your plugin is + * partially transparent, then subpixel antialiasing is not possible and + * grayscale antialiasing will be used instead (assuming the user has + * antialiasing enabled at all). + */ + PP_Bool DrawTextAt( + [in] PP_Resource font, + [in] PP_Resource image_data, + [in] PP_TextRun_Dev text, + [in] PP_Point position, + [in] uint32_t color, + [in] PP_Rect clip, + [in] PP_Bool image_data_is_opaque); + + /** + * Returns the width of the given string. If the font is invalid or the var + * isn't a valid string, this will return -1. + * + * Note that this function handles complex scripts such as Arabic, combining + * accents, etc. so that adding the width of substrings won't necessarily + * produce the correct width of the entire string. + * + * Returns -1 on failure. + */ + int32_t MeasureText( + [in] PP_Resource font, + [in] PP_TextRun_Dev text); + + /** + * Returns the character at the given pixel X position from the beginning of + * the string. This handles complex scripts such as Arabic, where characters + * may be combined or replaced depending on the context. Returns (uint32)-1 + * on failure. + */ + uint32_t CharacterOffsetForPixel( + [in] PP_Resource font, + [in] PP_TextRun_Dev text, + [in] int32_t pixel_position); + + /** + * Returns the horizontal advance to the given character if the string was + * placed at the given position. This handles complex scripts such as Arabic, + * where characters may be combined or replaced depending on context. Returns + * -1 on error. + */ + int32_t PixelOffsetForCharacter( + [in] PP_Resource font, + [in] PP_TextRun_Dev text, + [in] uint32_t char_offset); +}; + diff --git a/browser/extensions/mortar/ppapi/api/dev/ppb_ime_input_event_dev.idl b/browser/extensions/mortar/ppapi/api/dev/ppb_ime_input_event_dev.idl new file mode 100644 index 000000000000..9e728d6ed049 --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/dev/ppb_ime_input_event_dev.idl @@ -0,0 +1,143 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * This file defines the PPB_IMEInputEvent_Dev interface. + */ + +label Chrome { + M16 = 0.1, + M21 = 0.2 +}; + +[macro="PPB_IME_INPUT_EVENT_DEV_INTERFACE"] +interface PPB_IMEInputEvent_Dev { + /** + * Create() creates an IME input event with the given parameters. Normally + * you will get an IME event passed through the HandleInputEvent + * and will not need to create them, but some applications may want to create + * their own for internal use. + * + * @param[in] instance The instance for which this event occurred. + * + * @param[in] type A PP_InputEvent_Type identifying the type of + * input event. The type must be one of the IME event types. + * + * @param[in] time_stamp A PP_TimeTicks indicating the time + * when the event occurred. + * + * @param[in] text The string returned by GetText. + * + * @param[in] segment_number The number returned by + * GetSegmentNumber. + * + * @param[in] segment_offsets The array of numbers returned by + * GetSegmentOffset. If segment_number is zero, + * the number of elements of the array should be zero. If + * segment_number is non-zero, the length of the array must be + * segment_number + 1. + * + * @param[in] target_segment The number returned by + * GetTargetSegment. + * + * @param[in] selection_start The start index returned by + * GetSelection. + * + * @param[in] selection_end The end index returned by + * GetSelection. + * + * @return A PP_Resource containing the new IME input event. + */ + [version=0.2] + PP_Resource Create([in] PP_Instance instance, + [in] PP_InputEvent_Type type, + [in] PP_TimeTicks time_stamp, + [in] PP_Var text, + [in] uint32_t segment_number, + [in] uint32_t[] segment_offsets, + [in] int32_t target_segment, + [in] uint32_t selection_start, + [in] uint32_t selection_end); + + /** + * IsIMEInputEvent() determines if a resource is an IME event. + * + * @param[in] resource A PP_Resource corresponding to an event. + * + * @return PP_TRUE if the given resource is a valid input event. + */ + PP_Bool IsIMEInputEvent([in] PP_Resource resource); + + /** + * GetText() returns the composition text as a UTF-8 string for the given IME + * event. + * + * @param[in] ime_event A PP_Resource corresponding to an IME + * event. + * + * @return A string var representing the composition text. For non-IME input + * events the return value will be an undefined var. + */ + PP_Var GetText([in] PP_Resource ime_event); + + /** + * GetSegmentNumber() returns the number of segments in the composition text. + * + * @param[in] ime_event A PP_Resource corresponding to an IME + * event. + * + * @return The number of segments. For events other than COMPOSITION_UPDATE, + * returns 0. + */ + uint32_t GetSegmentNumber([in] PP_Resource ime_event); + + /** + * GetSegmentOffset() returns the position of the index-th segmentation point + * in the composition text. The position is given by a byte-offset (not a + * character-offset) of the string returned by GetText(). It always satisfies + * 0=GetSegmentOffset(0) < ... < GetSegmentOffset(i) < GetSegmentOffset(i+1) + * < ... < GetSegmentOffset(GetSegmentNumber())=(byte-length of GetText()). + * Note that [GetSegmentOffset(i), GetSegmentOffset(i+1)) represents the range + * of the i-th segment, and hence GetSegmentNumber() can be a valid argument + * to this function instead of an off-by-1 error. + * + * @param[in] ime_event A PP_Resource corresponding to an IME + * event. + * + * @param[in] index An integer indicating a segment. + * + * @return The byte-offset of the segmentation point. If the event is not + * COMPOSITION_UPDATE or index is out of range, returns 0. + */ + uint32_t GetSegmentOffset([in] PP_Resource ime_event, + [in] uint32_t index); + + /** + * GetTargetSegment() returns the index of the current target segment of + * composition. + * + * @param[in] ime_event A PP_Resource corresponding to an IME + * event. + * + * @return An integer indicating the index of the target segment. When there + * is no active target segment, or the event is not COMPOSITION_UPDATE, + * returns -1. + */ + int32_t GetTargetSegment([in] PP_Resource ime_event); + + /** + * GetSelection() returns the range selected by caret in the composition text. + * + * @param[in] ime_event A PP_Resource corresponding to an IME + * event. + * + * @param[out] start The start position of the current selection. + * + * @param[out] end The end position of the current selection. + */ + void GetSelection([in] PP_Resource ime_event, + [out] uint32_t start, + [out] uint32_t end); +}; diff --git a/browser/extensions/mortar/ppapi/api/dev/ppb_memory_dev.idl b/browser/extensions/mortar/ppapi/api/dev/ppb_memory_dev.idl new file mode 100644 index 000000000000..e77c1d2891d6 --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/dev/ppb_memory_dev.idl @@ -0,0 +1,37 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * This file defines the PPB_Memory interface for functions + * related to memory management. + */ + +label Chrome { + M14 = 0.1 +}; + +/** + * The PPB_Memory_Dev interface contains pointers to functions related to memory + * management. + * + */ +interface PPB_Memory_Dev { + /** + * MemAlloc is a pointer to a function that allocate memory. + * + * @param[in] num_bytes A number of bytes to allocate. + * @return A pointer to the memory if successful, NULL If the + * allocation fails. + */ + mem_t MemAlloc([in] uint32_t num_bytes); + + /** + * MemFree is a pointer to a function that deallocates memory. + * + * @param[in] ptr A pointer to the memory to deallocate. It is safe to + * pass NULL to this function. + */ + void MemFree([inout] mem_t ptr); +}; diff --git a/browser/extensions/mortar/ppapi/api/dev/ppb_opengles2ext_dev.idl b/browser/extensions/mortar/ppapi/api/dev/ppb_opengles2ext_dev.idl new file mode 100644 index 000000000000..7d1b5d1ab6a7 --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/dev/ppb_opengles2ext_dev.idl @@ -0,0 +1,27 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// This file is auto-generated from +// gpu/command_buffer/build_gles2_cmd_buffer.py +// It's formatted by clang-format using chromium coding style: +// clang-format -i -style=chromium filename +// DO NOT EDIT! + +label Chrome { + M39 = 1.0 +}; + +#inline c +#include "ppapi/c/pp_resource.h" +#include "ppapi/c/ppb_opengles2.h" + +#endinl + +[macro="PPB_OPENGLES2_DRAWBUFFERS_DEV_INTERFACE", force_struct_namespace] +interface PPB_OpenGLES2DrawBuffers_Dev { + void DrawBuffersEXT([in] PP_Resource context, + [in] GLsizei count, + [in] GLenum_ptr_t bufs); +}; + diff --git a/browser/extensions/mortar/ppapi/api/dev/ppb_printing_dev.idl b/browser/extensions/mortar/ppapi/api/dev/ppb_printing_dev.idl new file mode 100644 index 000000000000..60239d2f7d88 --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/dev/ppb_printing_dev.idl @@ -0,0 +1,44 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * Definition of the PPB_Printing interface. + */ + +[generate_thunk] + +// Note: This version should always match the PPP_Printing_Dev interface. +label Chrome { + M23 = 0.7 +}; + +interface PPB_Printing_Dev { + /** Create a resource for accessing printing functionality. + * + * @param[in] instance A PP_Instance identifying one instance + * of a module. + * + * @return A PP_Resource containing the printing resource if + * successful or 0 if it could not be created. + */ + PP_Resource Create([in] PP_Instance instance); + + /** + * Outputs the default print settings for the default printer into + * print_settings. The callback is called with + * PP_OK when the settings have been retrieved successfully. + * + * @param[in] resource The printing resource. + * + * @param[in] callback A CompletionCallback to be called when + * print_settings have been retrieved. + * + * @return PP_OK_COMPLETIONPENDING if request for the default print settings + * was successful, another error code from pp_errors.h on failure. + */ + int32_t GetDefaultPrintSettings([in] PP_Resource resource, + [out] PP_PrintSettings_Dev print_settings, + [in] PP_CompletionCallback callback); +}; diff --git a/browser/extensions/mortar/ppapi/api/dev/ppb_text_input_dev.idl b/browser/extensions/mortar/ppapi/api/dev/ppb_text_input_dev.idl new file mode 100644 index 000000000000..7ea49013356d --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/dev/ppb_text_input_dev.idl @@ -0,0 +1,109 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * This file defines the PPB_TextInput_Dev interface. + */ + +label Chrome { + M16 = 0.1, + M19 = 0.2 +}; + +/** + * PP_TextInput_Type is used to indicate the status of a plugin in regard to + * text input. + */ +[assert_size(4)] +enum PP_TextInput_Type_Dev { + /** + * Input caret is not in an editable mode, no input method shall be used. + */ + PP_TEXTINPUT_TYPE_DEV_NONE = 0, + /** + * Input caret is in a normal editable mode, any input method can be used. + */ + PP_TEXTINPUT_TYPE_DEV_TEXT = 1, + /** + * Input caret is in a password box, an input method may be used only if + * it's suitable for password input. + */ + PP_TEXTINPUT_TYPE_DEV_PASSWORD = 2, + PP_TEXTINPUT_TYPE_DEV_SEARCH = 3, + PP_TEXTINPUT_TYPE_DEV_EMAIL = 4, + PP_TEXTINPUT_TYPE_DEV_NUMBER = 5, + PP_TEXTINPUT_TYPE_DEV_TELEPHONE = 6, + PP_TEXTINPUT_TYPE_DEV_URL = 7 +}; + +/** + * PPB_TextInput_Dev provides a set of functions for giving hints + * to the browser about the text input status of plugins, and functions for + * controlling input method editors (IMEs). + */ +interface PPB_TextInput_Dev { + /** + * Informs the browser about the current text input mode of the plugin. + * Typical use of this information in the browser is to properly + * display/suppress tools for supporting text inputs (such as virtual + * keyboards in touch screen based devices, or input method editors often + * used for composing East Asian characters). + */ + void SetTextInputType([in] PP_Instance instance, + [in] PP_TextInput_Type_Dev type); + + /** + * Informs the browser about the coordinates of the text input caret and the + * bounding box of the text input area. Typical use of this information in + * the browser is to layout IME windows etc. + */ + void UpdateCaretPosition([in] PP_Instance instance, + [in] PP_Rect caret, + [in] PP_Rect bounding_box); + + /** + * Cancels the current composition in IME. + */ + void CancelCompositionText([in] PP_Instance instance); + + /** + * In response to the PPP_TextInput_Dev::RequestSurroundingText + * call, informs the browser about the current text selection and surrounding + * text. text is a UTF-8 string that contains the current range + * of text selection in the plugin. caret is the byte-index of + * the caret position within text. anchor is the + * byte-index of the anchor position (i.e., if a range of text is selected, + * it is the other edge of selection different from caret. If + * there are no selection, anchor is equal to caret. + * + * Typical use of this information in the browser is to enable "reconversion" + * features of IME that puts back the already committed text into the + * pre-commit composition state. Another use is to improve the precision + * of suggestion of IME by taking the context into account (e.g., if the caret + * looks to be on the beginning of a sentence, suggest capital letters in a + * virtual keyboard). + * + * When the focus is not on text, call this function setting text + * to an empty string and caret and anchor to zero. + * Also, the plugin should send the empty text when it does not want to reveal + * the selection to IME (e.g., when the surrounding text is containing + * password text). + */ + [version=0.2] + void UpdateSurroundingText([in] PP_Instance instance, + [in] str_t text, + [in] uint32_t caret, + [in] uint32_t anchor); + + /** + * Informs the browser when a range of text selection is changed in a plugin. + * When the browser needs to know the content of the updated selection, it + * pings back by PPP_TextInput_Dev::RequestSurroundingText. The + * plugin then should send the information with + * UpdateSurroundingText. + */ + [version=0.2] + void SelectionChanged([in] PP_Instance instance); +}; diff --git a/browser/extensions/mortar/ppapi/api/dev/ppb_trace_event_dev.idl b/browser/extensions/mortar/ppapi/api/dev/ppb_trace_event_dev.idl new file mode 100644 index 000000000000..8e483cd6e824 --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/dev/ppb_trace_event_dev.idl @@ -0,0 +1,84 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * This file defines the PPB_Trace_Event interface. It is meant + * to be used in plugins as the API that trace macros from trace_event.h use. + */ + +label Chrome { + M25 = 0.1, + M29 = 0.2 +}; + +/** + * A trace event timestamp. + */ +typedef int64_t PP_TraceEventTime; + +interface PPB_Trace_Event_Dev { + /** + * Gets a pointer to a character for identifying a category name in the + * tracing system as well as for being able to early exit in client-side + * tracing code. + * + * NB: This mem_t return value should technically be const, but return values + * for Pepper IDL of mem_t type are not const. The same is true for the arg + * |category_enabled| for AddTraceEvent. + */ + mem_t GetCategoryEnabled([in] cstr_t category_name); + + /** + * Adds a trace event to the platform tracing system. This function call is + * usually the result of a TRACE_* macro from trace_event.h when tracing and + * the category of the particular trace are enabled. It is not advisable to + * call this function on its own; it is really only meant to be used by the + * trace macros. + */ + void AddTraceEvent( + [in] int8_t phase, + [in] mem_t category_enabled, + [in] cstr_t name, + [in] uint64_t id, + [in] uint32_t num_args, + [in, size_as=num_args] str_t[] arg_names, + [in, size_as=num_args] uint8_t[] arg_types, + [in, size_as=num_args] uint64_t[] arg_values, + [in] uint8_t flags); + + /** + * Version of the above interface that allows specifying a custom thread id + * and timestamp. This is useful for when tracing data cannot be registered + * in real time. For example, this could be used by storing timestamps + * internally and then registering the events retroactively. + */ + [version=0.2] + void AddTraceEventWithThreadIdAndTimestamp( + [in] int8_t phase, + [in] mem_t category_enabled, + [in] cstr_t name, + [in] uint64_t id, + [in] int32_t thread_id, + [in] PP_TraceEventTime timestamp, + [in] uint32_t num_args, + [in, size_as=num_args] str_t[] arg_names, + [in, size_as=num_args] uint8_t[] arg_types, + [in, size_as=num_args] uint64_t[] arg_values, + [in] uint8_t flags); + + /** + * Get the current clock value. Since this uses the same function as the trace + * events use internally, it can be used to create events with explicit time + * stamps. + */ + [version=0.2] + PP_TraceEventTime Now(); + + /** + * Sets the thread name of the calling thread in the tracing system so it will + * show up properly in chrome://tracing. + */ + void SetThreadName([in] cstr_t thread_name); +}; diff --git a/browser/extensions/mortar/ppapi/api/dev/ppb_truetype_font_dev.idl b/browser/extensions/mortar/ppapi/api/dev/ppb_truetype_font_dev.idl new file mode 100644 index 000000000000..8a3ff2b0f0ac --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/dev/ppb_truetype_font_dev.idl @@ -0,0 +1,270 @@ +/* Copyright (c) 2013 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * This file defines the PPB_TrueTypeFont_Dev interface. This + * interface exposes font table data for 'sfnt' fonts on the host system. These + * include TrueType and OpenType fonts. + */ + +[generate_thunk,thunk_include="ppapi/thunk/ppb_truetype_font_singleton_api.h"] + +label Chrome { + M26 = 0.1 +}; + +/** + * The PP_TrueTypeFontFamily_Dev defines generic font families. These can be + * used to create generic fonts consistent with the user's browser settings. + */ +[assert_size(4)] +enum PP_TrueTypeFontFamily_Dev { + /** + * For a description of these default families, see the + * + * 3.1.1 Generic font families documentation. + */ + PP_TRUETYPEFONTFAMILY_SERIF = 0, + PP_TRUETYPEFONTFAMILY_SANSSERIF = 1, + PP_TRUETYPEFONTFAMILY_CURSIVE = 2, + PP_TRUETYPEFONTFAMILY_FANTASY = 3, + PP_TRUETYPEFONTFAMILY_MONOSPACE = 4 +}; + +/** + * The PP_TrueTypeFontStyle_Dev enum defines font styles. + */ +[assert_size(4)] +enum PP_TrueTypeFontStyle_Dev { + PP_TRUETYPEFONTSTYLE_NORMAL = 0, + PP_TRUETYPEFONTSTYLE_ITALIC = 1 +}; + +/** + * The PP_TrueTypeFontWeight_Dev enum defines font weights. + */ +[assert_size(4)] +enum PP_TrueTypeFontWeight_Dev { + PP_TRUETYPEFONTWEIGHT_THIN = 100, + PP_TRUETYPEFONTWEIGHT_ULTRALIGHT = 200, + PP_TRUETYPEFONTWEIGHT_LIGHT = 300, + PP_TRUETYPEFONTWEIGHT_NORMAL = 400, + PP_TRUETYPEFONTWEIGHT_MEDIUM = 500, + PP_TRUETYPEFONTWEIGHT_SEMIBOLD = 600, + PP_TRUETYPEFONTWEIGHT_BOLD = 700, + PP_TRUETYPEFONTWEIGHT_ULTRABOLD = 800, + PP_TRUETYPEFONTWEIGHT_HEAVY = 900 +}; + +/** + * The PP_TrueTypeFontWidth_Dev enum defines font widths. + */ +[assert_size(4)] +enum PP_TrueTypeFontWidth_Dev { + PP_TRUETYPEFONTWIDTH_ULTRACONDENSED = 0, + PP_TRUETYPEFONTWIDTH_EXTRACONDENSED = 1, + PP_TRUETYPEFONTWIDTH_CONDENSED = 2, + PP_TRUETYPEFONTWIDTH_SEMICONDENSED = 3, + PP_TRUETYPEFONTWIDTH_NORMAL = 4, + PP_TRUETYPEFONTWIDTH_SEMIEXPANDED = 5, + PP_TRUETYPEFONTWIDTH_EXPANDED = 6, + PP_TRUETYPEFONTWIDTH_EXTRAEXPANDED = 7, + PP_TRUETYPEFONTWIDTH_ULTRAEXPANDED = 8 +}; + +/** + * The PP_TrueTypeFontCharset enum defines font character sets. + */ +[assert_size(4)] +enum PP_TrueTypeFontCharset_Dev { + PP_TRUETYPEFONTCHARSET_ANSI = 0, + PP_TRUETYPEFONTCHARSET_DEFAULT = 1, + PP_TRUETYPEFONTCHARSET_SYMBOL = 2, + PP_TRUETYPEFONTCHARSET_MAC = 77, + PP_TRUETYPEFONTCHARSET_SHIFTJIS = 128, + PP_TRUETYPEFONTCHARSET_HANGUL = 129, + PP_TRUETYPEFONTCHARSET_JOHAB = 130, + PP_TRUETYPEFONTCHARSET_GB2312 =134, + PP_TRUETYPEFONTCHARSET_CHINESEBIG5 = 136, + PP_TRUETYPEFONTCHARSET_GREEK = 161, + PP_TRUETYPEFONTCHARSET_TURKISH = 162, + PP_TRUETYPEFONTCHARSET_VIETNAMESE = 163, + PP_TRUETYPEFONTCHARSET_HEBREW = 177, + PP_TRUETYPEFONTCHARSET_ARABIC = 178, + PP_TRUETYPEFONTCHARSET_BALTIC = 186, + PP_TRUETYPEFONTCHARSET_RUSSIAN = 204, + PP_TRUETYPEFONTCHARSET_THAI = 222, + PP_TRUETYPEFONTCHARSET_EASTEUROPE = 238, + PP_TRUETYPEFONTCHARSET_OEM = 255 +}; + +/** + * The PP_TrueTypeFontDesc struct describes a TrueType font. It is + * passed to Create(), and returned by Describe(). + */ +[assert_size(40)] +struct PP_TrueTypeFontDesc_Dev { + /** + * Font family name as a string. This can also be an undefined var, in which + * case the generic family will be obeyed. If the face is not available on + * the system, the browser will attempt to do font fallback or pick a default + * font. + */ + PP_Var family; + + /** This value specifies a generic font family. If a family name string is + * provided when creating a font, this is ignored. */ + PP_TrueTypeFontFamily_Dev generic_family; + + /** This value specifies the font style. */ + PP_TrueTypeFontStyle_Dev style; + + /** This value specifies the font weight. */ + PP_TrueTypeFontWeight_Dev weight; + + /** This value specifies the font width, for condensed or expanded fonts */ + PP_TrueTypeFontWidth_Dev width; + + /** This value specifies a character set. */ + PP_TrueTypeFontCharset_Dev charset; + + /** + * Ensure that this struct is 40-bytes wide by padding the end. In some + * compilers, PP_Var is 8-byte aligned, so those compilers align this struct + * on 8-byte boundaries as well and pad it to 16 bytes even without this + * padding attribute. This padding makes its size consistent across + * compilers. + */ + int32_t padding; +}; + +interface PPB_TrueTypeFont_Dev { + /** + * Gets an array of TrueType font family names available on the host. + * These names can be used to create a font from a specific family. + * + * @param[in] instance A PP_Instance requesting the family names. + * @param[in] output A PP_ArrayOutput to hold the names. + * The output is an array of PP_Vars, each holding a family name. + * @param[in] callback A PP_CompletionCallback to be called upon + * completion of GetFontFamilies. + * + * @return If >= 0, the number of family names returned, otherwise an error + * code from pp_errors.h. + */ + [singleton,api=PPB_TrueTypeFont_Singleton_API] + int32_t GetFontFamilies([in] PP_Instance instance, + [in] PP_ArrayOutput output, + [in] PP_CompletionCallback callback); + + /** + * Gets an array of TrueType font descriptors for a given font family. These + * descriptors can be used to create a font in that family and matching the + * descriptor attributes. + * + * @param[in] instance A PP_Instance requesting the font + * descriptors. + * @param[in] family A PP_Var holding a string specifying the + * font family. + * @param[in] output A PP_ArrayOutput to hold the descriptors. + * The output is an array of PP_TrueTypeFontDesc structs. Each + * desc contains a PP_Var for the family name which must be released. + * @param[in] callback A PP_CompletionCallback to be called upon + * completion of GetFontsInFamily. + * + * @return If >= 0, the number of font descriptors returned, otherwise an + * error code from pp_errors.h. + */ + [singleton,api=PPB_TrueTypeFont_Singleton_API] + int32_t GetFontsInFamily([in] PP_Instance instance, + [in] PP_Var family, + [in] PP_ArrayOutput output, + [in] PP_CompletionCallback callback); + + /** + * Creates a font resource matching the given font characteristics. The + * resource id will be non-zero on success, or zero on failure. + * + * @param[in] instance A PP_Instance to own the font. + * @param[in] desc A pointer to a PP_TrueTypeFontDesc describing + * the font. + */ + PP_Resource Create([in] PP_Instance instance, + [in] PP_TrueTypeFontDesc_Dev desc); + + /** + * Determines if the given resource is a TrueType font. + * + * @param[in] resource A PP_Resource corresponding to a resource. + * + * @return PP_TRUE if the resource is a + * PPB_TrueTypeFont_Dev, PP_FALSE otherwise. + */ + PP_Bool IsTrueTypeFont([in] PP_Resource resource); + + /** + * Returns a description of the given font resource. This description may + * differ from the description passed to Create, reflecting the host's font + * matching and fallback algorithm. + * + * @param[in] font A PP_Resource corresponding to a font. + * @param[out] desc A pointer to a PP_TrueTypeFontDesc to hold + * the description. The internal 'family' PP_Var should be set to undefined, + * since this function overwrites the PP_TrueTypeFontDesc. After + * successful completion, the family will be set to a PP_Var with a single + * reference, which the caller must release after use. + * @param[in] callback A PP_CompletionCallback to be called upon + * completion of Describe. + * + * @return A return code from pp_errors.h. If an error code is + * returned, the PP_TrueTypeFontDesc will be unchanged. + */ + int32_t Describe([in] PP_Resource font, + [out] PP_TrueTypeFontDesc_Dev desc, + [in] PP_CompletionCallback callback); + + /** + * Gets an array of identifying tags for each table in the font. These tags + * can be used to request specific tables using GetTable. + * + * @param[in] font A PP_Resource corresponding to a font. + * @param[in] output A PP_ArrayOutput to hold the tags. + * The output is an array of 4 byte integers, each representing a table tag. + * @param[in] callback A PP_CompletionCallback to be called upon + * completion of GetTableTags. + * + * @return If >= 0, the number of table tags returned, otherwise an error + * code from pp_errors.h. + */ + int32_t GetTableTags([in] PP_Resource font, + [in] PP_ArrayOutput output, + [in] PP_CompletionCallback callback); + + /** + * Copies the given font table into client memory. + * + * @param[in] font A PP_Resource corresponding to a font. + * @param[in] table A 4 byte value indicating which table to copy. + * For example, 'glyf' will cause the outline table to be copied into the + * output array. A zero tag value will cause the entire font to be copied. + * @param[in] offset The offset into the font table. Passing an offset + * greater than or equal to the table size will succeed with 0 bytes copied. + * @param[in] max_data_length The maximum number of bytes to transfer from + * offset. + * @param[in] output A PP_ArrayOutput to hold the font data. + * The output is an array of bytes. + * @param[in] callback A PP_CompletionCallback to be called upon + * completion of GetTable. + * + * @return If >= 0, the table size in bytes, otherwise an error code from + * pp_errors.h. + */ + int32_t GetTable([in] PP_Resource font, + [in] uint32_t table, + [in] int32_t offset, + [in] int32_t max_data_length, + [in] PP_ArrayOutput output, + [in] PP_CompletionCallback callback); +}; diff --git a/browser/extensions/mortar/ppapi/api/dev/ppb_url_util_dev.idl b/browser/extensions/mortar/ppapi/api/dev/ppb_url_util_dev.idl new file mode 100644 index 000000000000..f3eb66f90f15 --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/dev/ppb_url_util_dev.idl @@ -0,0 +1,162 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * This file defines the PPB_URLUtil_Dev interface. + */ + +label Chrome { + M17 = 0.6, + M31 = 0.7 +}; + +/* + * A component specifies the range of the part of the URL. The begin specifies + * the index into the string of the first character of that component. The len + * specifies the length of that component. + * + * This range does not include any special delimiter for that component, so + * the scheme doesn't include the trailing colon, the username and password + * don't include the @ and :, the port doesn't include the colon, the query + * doesn't include the ?, and the ref doesn't include the #. + * + * The exception is that the path *does* include the first /, since that's an + * integral part of the path. + * + * If the component is not present at all, begin will be 0 and len will be -1. + * If the component is present but empty, the length will be 0 instead. Example: + * http://foo/search -> query = (0, -1) + * http://foo/search? -> query = (18, 0) + */ +[assert_size(8)] +struct PP_URLComponent_Dev { + int32_t begin; + int32_t len; +}; + +[assert_size(64)] +struct PP_URLComponents_Dev { + PP_URLComponent_Dev scheme; + PP_URLComponent_Dev username; + PP_URLComponent_Dev password; + PP_URLComponent_Dev host; + PP_URLComponent_Dev port; + PP_URLComponent_Dev path; + PP_URLComponent_Dev query; + PP_URLComponent_Dev ref; +}; + +/* + * URL encoding: URLs are supplied to this interface as NULL-terminated 8-bit + * strings. You can pass non-ASCII characters which will be interpreted as + * UTF-8. Canonicalized URL strings returned by these functions will be ASCII + * except for the reference fragment (stuff after the '#') which will be + * encoded as UTF-8. + */ +interface PPB_URLUtil_Dev { + /* + * Canonicalizes the given URL string according to the rules of the host + * browser. If the URL is invalid or the var is not a string, this will + * return a Null var and the components structure will be unchanged. + * + * The components pointer, if non-NULL and the canonicalized URL is valid, + * will identify the components of the resulting URL. Components may be NULL + * to specify that no component information is necessary. + */ + PP_Var Canonicalize([in] PP_Var url, [out] PP_URLComponents_Dev components); + + /* + * Resolves the given URL relative to the given base URL. The resulting URL + * is returned as a string. If the resolution is invalid or either of the + * inputs are not strings, a Null var will be returned. The resulting URL + * will also be canonicalized according to the rules of the browser. + * + * Note that the "relative" URL may in fact be absolute, in which case it + * will be returned. This function is identical to resolving the full URL + * for an on a web page. Attempting to resolve a relative URL + * on a base URL that doesn't support this (e.g. "data") will fail and will + * return a Null var, unless the relative URL is itself absolute. + * + * The components pointer, if non-NULL and the canonicalized URL is valid, + * will identify the components of the resulting URL. Components may be NULL + * to specify that no component information is necessary. + */ + PP_Var ResolveRelativeToURL( + [in] PP_Var base_url, + [in] PP_Var relative_string, + [out] PP_URLComponents_Dev components); + + /* + * Identical to ResolveRelativeToURL except that the base URL is the base + * URL of the document containing the given plugin instance. + * + * Danger: This will be identical to resolving a relative URL on the page, + * and might be overridden by the page to something different than its actual + * URL via the tag. Therefore, resolving a relative URL of "" won't + * necessarily give you the URL of the page! + */ + PP_Var ResolveRelativeToDocument( + [in] PP_Instance instance, + [in] PP_Var relative_string, + [out] PP_URLComponents_Dev components); + + /* + * Checks whether the given two URLs are in the same security origin. Returns + * FALSE if either of the URLs are invalid. + */ + PP_Bool IsSameSecurityOrigin([in] PP_Var url_a, [in] PP_Var url_b); + + /* + * Checks whether the document hosting the given plugin instance can access + * the given URL according to the same origin policy of the browser. Returns + * PP_FALSE if the instance or the URL is invalid. + */ + PP_Bool DocumentCanRequest([in] PP_Instance instance, [in] PP_Var url); + + /* + * Checks whether the document containing the |active| plugin instance can + * access the document containing the |target| plugin instance according to + * the security policy of the browser. This includes the same origin policy + * and any cross-origin capabilities enabled by the document. If either of + * the plugin instances are invalid, returns PP_FALSE. + */ + PP_Bool DocumentCanAccessDocument([in] PP_Instance active, + [in] PP_Instance target); + + /* + * Returns the URL for the document. This is a safe way to retrieve + * window.location.href. + * The components pointer, if non-NULL and the canonicalized URL is valid, + * will identify the components of the resulting URL. Components may be NULL + * to specify that no component information is necessary. + */ + PP_Var GetDocumentURL([in] PP_Instance instance, + [out] PP_URLComponents_Dev components); + + /* + * Returns the Source URL for the plugin. This returns the URL that would be + * streamed to the plugin if it were a NPAPI plugin. This is usually the src + * attribute on the element, but the rules are obscure and different + * based on whether the plugin is loaded from an element or an + * element. + * The components pointer, if non-NULL and the canonicalized URL is valid, + * will identify the components of the resulting URL. Components may be NULL + * to specify that no component information is necessary. + */ + PP_Var GetPluginInstanceURL([in] PP_Instance instance, + [out] PP_URLComponents_Dev components); + + /* + * Returns the Referrer URL of the HTTP request that loaded the plugin. This + * is the value of the 'Referer' header of the request. An undefined value + * means the 'Referer' header was absent. + * The components pointer, if non-NULL and the canonicalized URL is valid, + * will identify the components of the resulting URL. Components may be NULL + * to specify that no component information is necessary. + */ + [version=0.7] + PP_Var GetPluginReferrerURL([in] PP_Instance instance, + [out] PP_URLComponents_Dev components); +}; diff --git a/browser/extensions/mortar/ppapi/api/dev/ppb_var_deprecated.idl b/browser/extensions/mortar/ppapi/api/dev/ppb_var_deprecated.idl new file mode 100644 index 000000000000..25fee857770a --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/dev/ppb_var_deprecated.idl @@ -0,0 +1,234 @@ +/* Copyright (c) 2010 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * Defines the PPB_Var_Deprecated struct. + * See http://code.google.com/p/ppapi/wiki/InterfacingWithJavaScript + * for general information on using this interface. + * {PENDING: Should the generated doc really be pointing to methods?} + */ + +label Chrome { + M39 = 0.3 +}; + +[iname="PPB_Var(Deprecated)"] +interface PPB_Var_Deprecated { + /** + * Adds a reference to the given var. If this is not a refcounted object, + * this function will do nothing so you can always call it no matter what the + * type. + */ + void AddRef([in] PP_Var var); + + /** + * Removes a reference to given var, deleting it if the internal refcount + * becomes 0. If the given var is not a refcounted object, this function will + * do nothing so you can always call it no matter what the type. + */ + void Release([in] PP_Var var); + + /** + * Creates a string var from a string. The string must be encoded in valid + * UTF-8 and is NOT NULL-terminated, the length must be specified in |len|. + * It is an error if the string is not valid UTF-8. + * + * If the length is 0, the |data| pointer will not be dereferenced and may + * be NULL. Note, however, that if you do this, the "NULL-ness" will not be + * preserved, as VarToUtf8 will never return NULL on success, even for empty + * strings. + * + * The resulting object will be a refcounted string object. It will be + * AddRef()ed for the caller. When the caller is done with it, it should be + * Release()d. + * + * On error (basically out of memory to allocate the string, or input that + * is not valid UTF-8), this function will return a Null var. + */ + PP_Var VarFromUtf8([in] PP_Module module, [in] str_t data, [in] uint32_t len); + + /** + * Converts a string-type var to a char* encoded in UTF-8. This string is NOT + * NULL-terminated. The length will be placed in |*len|. If the string is + * valid but empty the return value will be non-NULL, but |*len| will still + * be 0. + * + * If the var is not a string, this function will return NULL and |*len| will + * be 0. + * + * The returned buffer will be valid as long as the underlying var is alive. + * If the plugin frees its reference, the string will be freed and the pointer + * will be to random memory. + */ + str_t VarToUtf8([in] PP_Var var, [out] uint32_t len); + + /** + * Returns true if the property with the given name exists on the given + * object, false if it does not. Methods are also counted as properties. + * + * The name can either be a string or an integer var. It is an error to pass + * another type of var as the name. + * + * If you pass an invalid name or object, the exception will be set (if it is + * non-NULL, and the return value will be false). + */ + PP_Bool HasProperty([in] PP_Var object, + [in] PP_Var name, + [out] PP_Var exception); + + /** + * Identical to HasProperty, except that HasMethod additionally checks if the + * property is a function. + */ + PP_Bool HasMethod([in] PP_Var object, + [in] PP_Var name, + [out] PP_Var exception); + + /** + * Returns the value of the given property. If the property doesn't exist, the + * exception (if non-NULL) will be set and a "Void" var will be returned. + */ + PP_Var GetProperty([in] PP_Var object, + [in] PP_Var name, + [out] PP_Var exception); + + /** + * Retrieves all property names on the given object. Property names include + * methods. + * + * If there is a failure, the given exception will be set (if it is non-NULL). + * On failure, |*properties| will be set to NULL and |*property_count| will be + * set to 0. + * + * A pointer to the array of property names will be placesd in |*properties|. + * The caller is responsible for calling Release() on each of these properties + * (as per normal refcounted memory management) as well as freeing the array + * pointer with PPB_Core.MemFree(). + * + * This function returns all "enumerable" properties. Some JavaScript + * properties are "hidden" and these properties won't be retrieved by this + * function, yet you can still set and get them. + * + * Example: + *
  uint32_t count;
+   *   PP_Var* properties;
+   *   ppb_var.GetAllPropertyNames(object, &count, &properties);
+   *
+   *   ...use the properties here...
+   *
+   *   for (uint32_t i = 0; i < count; i++)
+   *     ppb_var.Release(properties[i]);
+   *   ppb_core.MemFree(properties); 
+ */ + void GetAllPropertyNames([in] PP_Var object, + [out] uint32_t property_count, + [out, size_is(property_count)] PP_Var[] properties, + [out] PP_Var exception); + + /** + * Sets the property with the given name on the given object. The exception + * will be set, if it is non-NULL, on failure. + */ + void SetProperty([in] PP_Var object, + [in] PP_Var name, + [in] PP_Var value, + [out] PP_Var exception); + + /** + * Removes the given property from the given object. The property name must + * be an string or integer var, using other types will throw an exception + * (assuming the exception pointer is non-NULL). + */ + void RemoveProperty([in] PP_Var object, + [in] PP_Var name, + [out] PP_Var exception); + + // TODO(brettw) need native array access here. + + /** + * Invoke the function |method_name| on the given object. If |method_name| + * is a Null var, the default method will be invoked, which is how you can + * invoke function objects. + * + * Unless it is type Null, |method_name| must be a string. Unlike other + * Var functions, integer lookup is not supported since you can't call + * functions on integers in JavaScript. + * + * Pass the arguments to the function in order in the |argv| array, and the + * number of arguments in the |argc| parameter. |argv| can be NULL if |argc| + * is zero. + * + * Example: + * Call(obj, VarFromUtf8("DoIt"), 0, NULL, NULL) = obj.DoIt() in JavaScript. + * Call(obj, PP_MakeNull(), 0, NULL, NULL) = obj() in JavaScript. + */ + PP_Var Call([in] PP_Var object, + [in] PP_Var method_name, + [in] uint32_t argc, + [in, size_is(argc)] PP_Var[] argv, + [out] PP_Var exception); + + /** + * Invoke the object as a constructor. + * + * For example, if |object| is |String|, this is like saying |new String| in + * JavaScript. + */ + PP_Var Construct([in] PP_Var object, + [in] uint32_t argc, + [in, size_is(argc)] PP_Var[] argv, + [out] PP_Var exception); + + /** + * If the object is an instance of the given class, then this method returns + * true and sets *object_data to the value passed to CreateObject provided + * object_data is non-NULL. Otherwise, this method returns false. + */ + PP_Bool IsInstanceOf([in] PP_Var var, + [in, ref] PPP_Class_Deprecated object_class, + [out] mem_t object_data); + + /** + * Creates an object that the plugin implements. The plugin supplies a + * pointer to the class interface it implements for that object, and its + * associated internal data that represents that object. This object data + * must be unique among all "live" objects. + * + * The returned object will have a reference count of 1. When the reference + * count reached 0, the class' Destruct function wlil be called. + * + * On failure, this will return a null var. This probably means the module + * was invalid. + * + * Example: Say we're implementing a "Point" object. + *
  void PointDestruct(void* object) {
+   *     delete (Point*)object;
+   *   }
+   *
+   *   const PPP_Class_Deprecated point_class = {
+   *     ... all the other class functions go here ...
+   *     &PointDestruct
+   *   };
+   *
+   *    * The plugin's internal object associated with the point.
+   *   class Point {
+   *     ...
+   *   };
+   *
+   *   PP_Var MakePoint(int x, int y) {
+   *     return CreateObject(&point_class, new Point(x, y));
+   *   }
+ */ + PP_Var CreateObject([in] PP_Instance instance, + [in, ref] PPP_Class_Deprecated object_class, + [inout] mem_t object_data); + + // Like CreateObject but takes a module. This will be deleted when all callers + // can be changed to use the PP_Instance CreateObject one. + PP_Var CreateObjectWithModuleDeprecated( + [in] PP_Module module, + [in, ref] PPP_Class_Deprecated object_class, + [inout] mem_t object_data); +}; diff --git a/browser/extensions/mortar/ppapi/api/dev/ppb_video_capture_dev.idl b/browser/extensions/mortar/ppapi/api/dev/ppb_video_capture_dev.idl new file mode 100644 index 000000000000..a05374a41074 --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/dev/ppb_video_capture_dev.idl @@ -0,0 +1,158 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * This file defines the PPB_VideoCapture_Dev interface. + */ +label Chrome { + M25 = 0.3 +}; + +/** + * Video capture interface. It goes hand-in-hand with PPP_VideoCapture_Dev. + * + * Theory of operation: + * 1- Create a VideoCapture resource using Create. + * 2- Find available video capture devices using EnumerateDevices. + * 3- Open a video capture device. In addition to a device reference (0 can be + * used to indicate the default device), you pass in the requested info + * (resolution, frame rate), as well as suggest a number of buffers you will + * need. + * 4- Start the capture using StartCapture. + * 5- Receive the OnDeviceInfo callback, in PPP_VideoCapture_Dev, which will + * give you the actual capture info (the requested one is not guaranteed), as + * well as an array of buffers allocated by the browser. + * 6- On every frame captured by the browser, OnBufferReady (in + * PPP_VideoCapture_Dev) is called with the index of the buffer from the array + * containing the new frame. The buffer is now "owned" by the plugin, and the + * browser won't reuse it until ReuseBuffer is called. + * 7- When the plugin is done with the buffer, call ReuseBuffer. + * 8- Stop the capture using StopCapture. + * 9- Close the device. + * + * The browser may change the resolution based on the constraints of the system, + * in which case OnDeviceInfo will be called again, with new buffers. + * + * The buffers contain the pixel data for a frame. The format is planar YUV + * 4:2:0, one byte per pixel, tightly packed (width x height Y values, then + * width/2 x height/2 U values, then width/2 x height/2 V values). + */ +interface PPB_VideoCapture_Dev { + /** + * Creates a new VideoCapture. + */ + PP_Resource Create( + [in] PP_Instance instance); + + /** + * Returns PP_TRUE if the given resource is a VideoCapture. + */ + PP_Bool IsVideoCapture( + [in] PP_Resource video_capture); + + /** + * Enumerates video capture devices. + * + * @param[in] video_capture A PP_Resource corresponding to a + * video capture resource. + * @param[in] output An output array which will receive + * PPB_DeviceRef_Dev resources on success. Please note that the + * ref count of those resources has already been increased by 1 for the + * caller. + * @param[in] callback A PP_CompletionCallback to run on + * completion. + * + * @return An error code from pp_errors.h. + */ + [version=0.3] + int32_t EnumerateDevices( + [in] PP_Resource video_capture, + [in] PP_ArrayOutput output, + [in] PP_CompletionCallback callback); + + /** + * Requests device change notifications. + * + * @param[in] video_capture A PP_Resource corresponding to a + * video capture resource. + * @param[in] callback The callback to receive notifications. If not NULL, it + * will be called once for the currently available devices, and then every + * time the list of available devices changes. All calls will happen on the + * same thread as the one on which MonitorDeviceChange() is called. It will + * receive notifications until video_capture is destroyed or + * MonitorDeviceChange() is called to set a new callback for + * video_capture. You can pass NULL to cancel sending + * notifications. + * @param[inout] user_data An opaque pointer that will be passed to + * callback. + * + * @return An error code from pp_errors.h. + */ + [version=0.3] + int32_t MonitorDeviceChange( + [in] PP_Resource video_capture, + [in] PP_MonitorDeviceChangeCallback callback, + [inout] mem_t user_data); + + /** + * Opens a video capture device. |device_ref| identifies a video capture + * device. It could be one of the resource in the array returned by + * |EnumerateDevices()|, or 0 which means the default device. + * |requested_info| is a pointer to a structure containing the requested + * resolution and frame rate. |buffer_count| is the number of buffers + * requested by the plugin. Note: it is only used as advisory, the browser may + * allocate more or fewer based on available resources. How many buffers + * depends on usage. At least 2 to make sure latency doesn't cause lost + * frames. If the plugin expects to hold on to more than one buffer at a time + * (e.g. to do multi-frame processing, like video encoding), it should request + * that many more. + */ + int32_t Open( + [in] PP_Resource video_capture, + [in] PP_Resource device_ref, + [in] PP_VideoCaptureDeviceInfo_Dev requested_info, + [in] uint32_t buffer_count, + [in] PP_CompletionCallback callback); + + /** + * Starts the capture. + * + * Returns PP_ERROR_FAILED if called when the capture was already started, or + * PP_OK on success. + */ + int32_t StartCapture( + [in] PP_Resource video_capture); + + /** + * Allows the browser to reuse a buffer that was previously sent by + * PPP_VideoCapture_Dev.OnBufferReady. |buffer| is the index of the buffer in + * the array returned by PPP_VideoCapture_Dev.OnDeviceInfo. + * + * Returns PP_ERROR_BADARGUMENT if buffer is out of range (greater than the + * number of buffers returned by PPP_VideoCapture_Dev.OnDeviceInfo), or if it + * is not currently owned by the plugin. Returns PP_OK otherwise. + */ + int32_t ReuseBuffer( + [in] PP_Resource video_capture, + [in] uint32_t buffer); + + /** + * Stops the capture. + * + * Returns PP_ERROR_FAILED if the capture wasn't already started, or PP_OK on + * success. + */ + int32_t StopCapture( + [in] PP_Resource video_capture); + + /** + * Closes the video capture device, and stops capturing if necessary. It is + * not valid to call |Open()| again after a call to this method. + * If a video capture resource is destroyed while a device is still open, then + * it will be implicitly closed, so you are not required to call this method. + */ + void Close( + [in] PP_Resource video_capture); +}; diff --git a/browser/extensions/mortar/ppapi/api/dev/ppb_video_decoder_dev.idl b/browser/extensions/mortar/ppapi/api/dev/ppb_video_decoder_dev.idl new file mode 100644 index 000000000000..da408c94fcec --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/dev/ppb_video_decoder_dev.idl @@ -0,0 +1,155 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * This file defines the PPB_VideoDecoder_Dev interface. + */ +label Chrome { + M14 = 0.16 +}; + +/** + * Video decoder interface. + * + * Typical usage: + * - Use Create() to create & configure a new PPB_VideoDecoder_Dev resource. + * - Call Decode() to decode some video data. + * - Receive ProvidePictureBuffers callback + * - Supply the decoder with textures using AssignPictureBuffers. + * - Receive PictureReady callbacks + * - Hand the textures back to the decoder using ReusePictureBuffer. + * - To signal EOS to the decoder: call Flush() and wait for NotifyFlushDone + * callback. + * - To reset the decoder (e.g. to implement Seek): call Reset() and wait for + * NotifyResetDone callback. + * - To tear down the decoder call Destroy(). + * + * See PPP_VideoDecoder_Dev for the notifications the decoder may send the + * plugin. + */ +interface PPB_VideoDecoder_Dev { + /** + * Creates & initializes a video decoder. + * + * Parameters: + * |instance| pointer to the plugin instance. + * |context| a PPB_Graphics3D resource in which decoding will happen. + * |profile| the video stream's format profile. + * + * The created decoder is returned as PP_Resource. 0 means failure. + */ + PP_Resource Create( + [in] PP_Instance instance, + [in] PP_Resource context, + [in] PP_VideoDecoder_Profile profile); + + /** + * Tests whether |resource| is a video decoder created through Create + * function of this interface. + * + * Parameters: + * |resource| is handle to resource to test. + * + * Returns true if is a video decoder, false otherwise. + */ + PP_Bool IsVideoDecoder( + [in] PP_Resource resource); + + /** + * Dispatches bitstream buffer to the decoder. + * + * Parameters: + * |video_decoder| is the previously created handle to the decoder resource. + * |bitstream_buffer| is the bitstream buffer that contains at most one + * input frame. + * |callback| will be called when |bitstream_buffer| has been processed by + * the decoder. + * + * Returns an error code from pp_errors.h. + */ + int32_t Decode( + [in] PP_Resource video_decoder, + [in] PP_VideoBitstreamBuffer_Dev bitstream_buffer, + [in] PP_CompletionCallback callback); + + /** + * Provides the decoder with texture-backed picture buffers for video + * decoding. + * + * This function should be called when the plugin has its + * ProvidePictureBuffers method called. The decoder will stall until it has + * received all the buffers it's asked for. + * + * Parameters: + * |video_decoder| is the previously created handle to the decoder resource. + * |no_of_buffers| how many buffers are behind picture buffer pointer. + * |buffers| contains the reference to the picture buffer that was + * allocated. + */ + void AssignPictureBuffers( + [in] PP_Resource video_decoder, + [in] uint32_t no_of_buffers, + [in, size_as=no_of_buffers] PP_PictureBuffer_Dev[] buffers); + + /** + * Tells the decoder to reuse the given picture buffer. Typical use of this + * function is to call from PictureReady callback to recycle picture buffer + * back to the decoder after blitting the image so that decoder can use the + * image for output again. + * + * Parameters: + * |video_decoder| is the previously created handle to the decoder resource. + * |picture_buffer_id| contains the id of the picture buffer that was + * processed. + */ + void ReusePictureBuffer( + [in] PP_Resource video_decoder, + [in] int32_t picture_buffer_id); + + /** + * Flush input and output buffers in the decoder. Any pending inputs are + * decoded and pending outputs are delivered to the plugin. Once done + * flushing, the decoder will call |callback|. + * + * Parameters: + * |video_decoder| is the previously created handle to the decoder resource. + * |callback| is one-time callback that will be called once the flushing + * request has been completed. + * + * Returns an error code from pp_errors.h. + */ + int32_t Flush( + [in] PP_Resource video_decoder, + [in] PP_CompletionCallback callback); + + /** + * Reset the decoder as quickly as possible. Pending inputs and outputs are + * dropped and the decoder is put back into a state ready to receive further + * Decode() calls. |callback| will be called when the reset is done. + * + * Parameters: + * |video_decoder| is the previously created handle to the decoder resource. + * |callback| is one-time callback that will be called once the reset + * request has been completed. + * + * Returns an error code from pp_errors.h. + */ + int32_t Reset( + [in] PP_Resource video_decoder, + [in] PP_CompletionCallback callback); + + /** + * Tear down the decoder as quickly as possible. Pending inputs and outputs + * are dropped and the decoder frees all of its resources. Although resources + * may be freed asynchronously, after this method returns no more callbacks + * will be made on the client. Any resources held by the client at that point + * may be freed. + * + * Parameters: + * |video_decoder| is the previously created handle to the decoder resource. + */ + void Destroy( + [in] PP_Resource video_decoder); +}; diff --git a/browser/extensions/mortar/ppapi/api/dev/ppb_view_dev.idl b/browser/extensions/mortar/ppapi/api/dev/ppb_view_dev.idl new file mode 100644 index 000000000000..0846bd819f81 --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/dev/ppb_view_dev.idl @@ -0,0 +1,46 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* This file contains the PPB_View_Dev interface. */ + +[generate_thunk] + +label Chrome { + M22 = 0.1 +}; + +/* PPB_View_Dev interface */ +interface PPB_View_Dev { + /** + * GetDeviceScale returns the scale factor between device pixels and DIPs + * (also known as logical pixels or UI pixels on some platforms). This allows + * the developer to render their contents at device resolution, even as + * coordinates / sizes are given in DIPs through the API. + * + * Note that the coordinate system for Pepper APIs is DIPs. Also note that + * one DIP might not equal one CSS pixel - when page scale/zoom is in effect. + * + * @param[in] resource A PP_Resource corresponding to a + * PPB_View resource. + * + * @return A float value representing the number of device pixels + * per DIP. If the resource is invalid, the value will be 0.0. + */ + float_t GetDeviceScale([in] PP_Resource resource); + + /** + * GetCSSScale returns the scale factor between DIPs and CSS pixels. This + * allows proper scaling between DIPs - as sent via the Pepper API - and CSS + * pixel coordinates used for Web content. + * + * @param[in] resource A PP_Resource corresponding to a + * PPB_View resource. + * + * @return css_scale A float value representing the number of + * DIPs per CSS pixel. If the resource is invalid, the value will be 0.0. + */ + float_t GetCSSScale([in] PP_Resource resource); +}; + diff --git a/browser/extensions/mortar/ppapi/api/dev/ppp_class_deprecated.idl b/browser/extensions/mortar/ppapi/api/dev/ppp_class_deprecated.idl new file mode 100644 index 000000000000..5a184ad8a8bd --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/dev/ppp_class_deprecated.idl @@ -0,0 +1,119 @@ +/* Copyright (c) 2010 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * Defines the PPP_Class_Deprecated struct. + */ +label Chrome { + M39 = 1.0 +}; + +/** + * Interface for the plugin to implement JavaScript-accessible objects. + * + * This interface has no interface name. Instead, the plugin passes a pointer + * to this interface to PPB_Var_Deprecated.CreateObject that corresponds to the + * object being implemented. + * + * See the PPB_Var_Deprecated interface for more information on these functions. + * This interface just allows you to implement the "back end" of those + * functions, so most of the contract is specified in that interface. + * + * See + * http://code.google.com/p/ppapi/wiki/InterfacingWithJavaScript + * for general information on using and implementing vars. + */ +interface PPP_Class_Deprecated { + /** + * |name| is guaranteed to be an integer or string type var. Exception is + * guaranteed non-NULL. An integer is used for |name| when implementing + * array access into the object. This test should only return true for + * properties that are not methods. Use HasMethod() to handle methods. + */ + PP_Bool HasProperty([in] mem_t object, + [in] PP_Var name, + [out] PP_Var exception); + + /** + * |name| is guaranteed to be a string-type. Exception is guaranteed non-NULL. + * If the method does not exist, return false and don't set the exception. + * Errors in this function will probably not occur in general usage, but + * if you need to throw an exception, still return false. + */ + PP_Bool HasMethod([in] mem_t object, + [in] PP_Var name, + [out] PP_Var exception); + + /** + * |name| is guaranteed to be a string-type or an integer-type var. Exception + * is guaranteed non-NULL. An integer is used for |name| when implementing + * array access into the object. If the property does not exist, set the + * exception and return a var of type Void. A property does not exist if + * a call HasProperty() for the same |name| would return false. + */ + PP_Var GetProperty([in] mem_t object, + [in] PP_Var name, + [out] PP_Var exception); + + /** + * Exception is guaranteed non-NULL. + * + * This should include all enumerable properties, including methods. Be sure + * to set |*property_count| to 0 and |properties| to NULL in all failure + * cases, these should never be unset when calling this function. The + * pointers passed in are guaranteed not to be NULL, so you don't have to + * NULL check them. + * + * If you have any properties, allocate the property array with + * PPB_Core.MemAlloc(sizeof(PP_Var) * property_count) and add a reference + * to each property on behalf of the caller. The caller is responsible for + * Release()ing each var and calling PPB_Core.MemFree on the property pointer. + */ + void GetAllPropertyNames([in] mem_t object, + [out] uint32_t property_count, + [out, size_is(property_count)] PP_Var[] properties, + [out] PP_Var exception); + + /** + * |name| is guaranteed to be an integer or string type var. Exception is + * guaranteed non-NULL. + */ + void SetProperty([in] mem_t object, + [in] PP_Var name, + [in] PP_Var value, + [out] PP_Var exception); + + /** + * |name| is guaranteed to be an integer or string type var. Exception is + * guaranteed non-NULL. + */ + void RemoveProperty([in] mem_t object, + [in] PP_Var name, + [out] PP_Var exception); + + // TODO(brettw) need native array access here. + + /** + * |name| is guaranteed to be a string type var. Exception is guaranteed + * non-NULL + */ + PP_Var Call([in] mem_t object, + [in] PP_Var method_name, + [in] uint32_t argc, + [in, size_is(argc)] PP_Var[] argv, + [out] PP_Var exception); + + /** Exception is guaranteed non-NULL. */ + PP_Var Construct([in] mem_t object, + [in] uint32_t argc, + [in, size_is(argc)] PP_Var[] argv, + [out] PP_Var exception); + + /** + * Called when the reference count of the object reaches 0. Normally, plugins + * would free their internal data pointed to by the |object| pointer. + */ + void Deallocate([in] mem_t object); +}; diff --git a/browser/extensions/mortar/ppapi/api/dev/ppp_network_state_dev.idl b/browser/extensions/mortar/ppapi/api/dev/ppp_network_state_dev.idl new file mode 100644 index 000000000000..86df33d98ef9 --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/dev/ppp_network_state_dev.idl @@ -0,0 +1,25 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * This file defines the PPP_NetworkState interface. + */ + +label Chrome { + M14 = 0.1 +}; + +[macro="PPP_NETWORK_STATE_DEV_INTERFACE"] +interface PPP_NetworkState_Dev { + /** + * Notification that the online state has changed for the user's network. + * This will change as a result of a network cable being plugged or + * unplugged, WiFi connections going up and down, or other events. + * + * Note that being "online" isn't a guarantee that any particular connections + * will succeed. + */ + void SetOnLine([in] PP_Bool is_online); +}; diff --git a/browser/extensions/mortar/ppapi/api/dev/ppp_printing_dev.idl b/browser/extensions/mortar/ppapi/api/dev/ppp_printing_dev.idl new file mode 100644 index 000000000000..df107abe009b --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/dev/ppp_printing_dev.idl @@ -0,0 +1,60 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * Definition of the PPP_Printing interface. + */ + +// Note: This version should always match the PPB_Printing_Dev interface. +label Chrome { + M21 = 0.6 +}; + +/** + * Specifies a contiguous range of page numbers to be printed. + * The page numbers use a zero-based index. + */ +[assert_size(8)] +struct PP_PrintPageNumberRange_Dev { + uint32_t first_page_number; + uint32_t last_page_number; +}; + +interface PPP_Printing_Dev { + /** + * Returns a bit field representing the supported print output formats. For + * example, if only PDF and PostScript are supported, + * QuerySupportedFormats returns a value equivalent to: + * (PP_PRINTOUTPUTFORMAT_PDF | PP_PRINTOUTPUTFORMAT_POSTSCRIPT) + */ + uint32_t QuerySupportedFormats([in] PP_Instance instance); + + /** + * Begins a print session with the given print settings. Calls to PrintPages + * can only be made after a successful call to Begin. Returns the number of + * pages required for the print output at the given page size (0 indicates + * a failure). + */ + int32_t Begin([in] PP_Instance instance, + [in] PP_PrintSettings_Dev print_settings); + + /** + * Prints the specified pages using the format specified in Begin. + * Returns a PPB_Buffer resource that represents the printed output. Returns + * 0 on failure. + */ + PP_Resource PrintPages([in] PP_Instance instance, + [in] PP_PrintPageNumberRange_Dev page_ranges, + [in] uint32_t page_range_count); + + /** Ends the print session. Further calls to PrintPages will fail. */ + void End([in] PP_Instance instance); + + /** + * Returns true if the current content should be printed into the full page + * and not scaled down to fit within the printer's printable area. + */ + PP_Bool IsScalingDisabled([in] PP_Instance instance); +}; diff --git a/browser/extensions/mortar/ppapi/api/dev/ppp_text_input_dev.idl b/browser/extensions/mortar/ppapi/api/dev/ppp_text_input_dev.idl new file mode 100644 index 000000000000..b6bdd88671cd --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/dev/ppp_text_input_dev.idl @@ -0,0 +1,27 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * This file defines the PPP_TextInput_Dev interface. + */ + +label Chrome { + M19 = 0.1 +}; + +/** + * PPP_TextInput_Dev is a set of function pointers that the + * plugin has to implement to provide hints for text input system (IME). + */ +interface PPP_TextInput_Dev { + /** + * Requests the plugin to send back the text around the current caret or + * selection by PPB_TextInput_Dev::UpdateSurroundingText. + * It is recommended to include the desired_number_of_characters + * characters before and after the selection, but not mandatory. + */ + void RequestSurroundingText([in] PP_Instance instance, + [in] uint32_t desired_number_of_characters); +}; diff --git a/browser/extensions/mortar/ppapi/api/dev/ppp_video_capture_dev.idl b/browser/extensions/mortar/ppapi/api/dev/ppp_video_capture_dev.idl new file mode 100644 index 000000000000..007870fd8f16 --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/dev/ppp_video_capture_dev.idl @@ -0,0 +1,64 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * This file defines the PPP_VideoCapture_Dev interface. + */ +label Chrome { + M15 = 0.1 +}; + +/** + * Video Capture client interface. See |PPB_VideoCapture_Dev| for general theory + * of operation. + */ +[macro="PPP_VIDEO_CAPTURE_DEV_INTERFACE"] +interface PPP_VideoCapture_Dev { + /** + * Signals the capture device information, such as resolution and frame rate, + * and the array of buffers that the browser will use to send pixel data. + * + * |info| is a pointer to the PP_VideoCaptureDeviceInfo_Dev structure + * containing resolution and frame rate. + * |buffer_count| is the number of buffers, and |buffers| is the array of + * PPB_Buffer_Dev buffers. + * + * Note: the buffers are passed without an extra reference. The plugin is + * expected to add its own references to the buffers. + */ + void OnDeviceInfo([in] PP_Instance instance, + [in] PP_Resource video_capture, + [in] PP_VideoCaptureDeviceInfo_Dev info, + [in] uint32_t buffer_count, + [in, size_is(buffer_count)] PP_Resource[] buffers); + + /** + * Signals status changes on the VideoCapture. |status| is a + * one of the values from PP_VideoCaptureStatus_Dev; + */ + void OnStatus([in] PP_Instance instance, + [in] PP_Resource video_capture, + [in] uint32_t status); + + /** + * Signals an error from the video capture system. + * + * Errors that can be generated: + * - PP_ERROR_NOMEMORY: not enough memory was available to allocate buffers. + * - PP_ERROR_FAILED: video capture could not start. + */ + void OnError([in] PP_Instance instance, + [in] PP_Resource video_capture, + [in] uint32_t error_code); + + /** + * Signals that a buffer is available for consumption by the plugin. + * + * |buffer| is the index of the buffer, in the array returned by OnDeviceInfo. + */ + void OnBufferReady([in] PP_Instance instance, + [in] PP_Resource video_capture, + [in] uint32_t buffer); +}; diff --git a/browser/extensions/mortar/ppapi/api/dev/ppp_video_decoder_dev.idl b/browser/extensions/mortar/ppapi/api/dev/ppp_video_decoder_dev.idl new file mode 100644 index 000000000000..42546ec18d82 --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/dev/ppp_video_decoder_dev.idl @@ -0,0 +1,87 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * This file defines the PPP_VideoDecoder_Dev interface. + */ +label Chrome { + M21 = 0.11 +}; + +/** + * PPP_VideoDecoder_Dev structure contains the function pointers that the + * plugin MUST implement to provide services needed by the video decoder + * implementation. + * + * See PPB_VideoDecoder_Dev for general usage tips. + */ +interface PPP_VideoDecoder_Dev { + /** + * Callback function to provide buffers for the decoded output pictures. If + * succeeds plugin must provide buffers through AssignPictureBuffers function + * to the API. If |req_num_of_bufs| matching exactly the specification + * given in the parameters cannot be allocated decoder should be destroyed. + * + * Decoding will not proceed until buffers have been provided. + * + * Parameters: + * |instance| the plugin instance to which the callback is responding. + * |decoder| the PPB_VideoDecoder_Dev resource. + * |req_num_of_bufs| tells how many buffers are needed by the decoder. + * |dimensions| tells the dimensions of the buffer to allocate. + * |texture_target| the type of texture used. Sample targets in use are + * TEXTURE_2D (most platforms) and TEXTURE_EXTERNAL_OES (on ARM). + */ + [version=0.11] + void ProvidePictureBuffers( + [in] PP_Instance instance, + [in] PP_Resource decoder, + [in] uint32_t req_num_of_bufs, + [in] PP_Size dimensions, + [in] uint32_t texture_target); + + /** + * Callback function for decoder to deliver unneeded picture buffers back to + * the plugin. + * + * Parameters: + * |instance| the plugin instance to which the callback is responding. + * |decoder| the PPB_VideoDecoder_Dev resource. + * |picture_buffer| points to the picture buffer that is no longer needed. + */ + void DismissPictureBuffer( + [in] PP_Instance instance, + [in] PP_Resource decoder, + [in] int32_t picture_buffer_id); + + /** + * Callback function for decoder to deliver decoded pictures ready to be + * displayed. Decoder expects the plugin to return the buffer back to the + * decoder through ReusePictureBuffer function in PPB Video Decoder API. + * + * Parameters: + * |instance| the plugin instance to which the callback is responding. + * |decoder| the PPB_VideoDecoder_Dev resource. + * |picture| is the picture that is ready. + */ + void PictureReady( + [in] PP_Instance instance, + [in] PP_Resource decoder, + [in] PP_Picture_Dev picture); + + /** + * Error handler callback for decoder to deliver information about detected + * errors to the plugin. + * + * Parameters: + * |instance| the plugin instance to which the callback is responding. + * |decoder| the PPB_VideoDecoder_Dev resource. + * |error| error is the enumeration specifying the error. + */ + void NotifyError( + [in] PP_Instance instance, + [in] PP_Resource decoder, + [in] PP_VideoDecodeError_Dev error); +}; diff --git a/browser/extensions/mortar/ppapi/api/pp_array_output.idl b/browser/extensions/mortar/ppapi/api/pp_array_output.idl new file mode 100644 index 000000000000..8e04a4cc9d79 --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/pp_array_output.idl @@ -0,0 +1,93 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * PP_ArrayOutput_GetDataBuffer is a callback function to allocate plugin + * memory for an array. It returns the allocated memory or null on failure. + * + * This function will be called reentrantly. This means that if you call a + * function PPB_Foo.GetData(&array_output), GetData will call your + * GetDataBuffer function before it returns. + * + * This function will be called even when returning 0-length arrays, so be sure + * your implementation can support that. You can return NULL for 0 length + * arrays and it will not be treated as a failure. + + * You should not perform any processing in this callback, including calling + * other PPAPI functions, outside of allocating memory. You should not throw + * any exceptions. In C++, this means using "new (nothrow)" or being sure to + * catch any exceptions before returning. + * + * The C++ wrapper provides a convenient templatized implementation around + * std::vector which you should generally use instead of coding this + * specifically. + * + * @param user_data The pointer provided in the PP_ArrayOutput structure. This + * has no meaning to the browser, it is intended to be used by the + * implementation to figure out where to put the data. + * + * @param element_count The number of elements in the array. This will be 0 + * if there is no data to return. + * + * @param element_size The size of each element in bytes. + * + * @return Returns a pointer to the allocated memory. On failure, returns null. + * You can also return null if the element_count is 0. When a non-null value is + * returned, the buffer must remain valid until after the callback runs. If used + * with a blocking callback, the buffer must remain valid until after the + * function returns. The plugin can then free any memory that it allocated. + */ +typedef mem_t PP_ArrayOutput_GetDataBuffer([inout] mem_t user_data, + [in] uint32_t element_count, + [in] uint32_t element_size); + +/** + * A structure that defines a way for the browser to return arrays of data + * to the plugin. The browser can not allocate memory on behalf of the plugin + * because the plugin and browser may have different allocators. + * + * Array output works by having the browser call to the plugin to allocate a + * buffer, and then the browser will copy the contents of the array into that + * buffer. + * + * In C, you would typically implement this as follows: + * + * @code + * struct MyArrayOutput { + * void* data; + * int element_count; + * }; + * void* MyGetDataBuffer(void* user_data, uint32_t count, uint32_t size) { + * MyArrayOutput* output = (MyArrayOutput*)user_data; + * output->element_count = count; + * if (size) { + * output->data = malloc(count * size); + * if (!output->data) // Be careful to set size properly on malloc failure. + * output->element_count = 0; + * } else { + * output->data = NULL; + * } + * return output->data; + * } + * void MyFunction() { + * MyArrayOutput array = { NULL, 0 }; + * PP_ArrayOutput output = { &MyGetDataBuffer, &array }; + * ppb_foo->GetData(&output); + * } + * @endcode + */ +[passByValue] +struct PP_ArrayOutput { + /** + * A pointer to the allocation function that the browser will call. + */ + PP_ArrayOutput_GetDataBuffer GetDataBuffer; + + /** + * Data that is passed to the allocation function. Typically, this is used + * to communicate how the data should be stored. + */ + mem_t user_data; +}; diff --git a/browser/extensions/mortar/ppapi/api/pp_bool.idl b/browser/extensions/mortar/ppapi/api/pp_bool.idl new file mode 100644 index 000000000000..1f8137b96350 --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/pp_bool.idl @@ -0,0 +1,44 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * This file defines the PP_Bool enumeration for use in PPAPI C + * headers. + */ + +/** + * The PP_Bool enum is a boolean value for use in PPAPI C headers. + * The standard bool type is not available to pre-C99 compilers, and is not + * guaranteed to be compatible between C and C++, whereas the PPAPI C headers + * can be included from C or C++ code. + */ +[assert_size(4)] enum PP_Bool { + PP_FALSE = 0, + PP_TRUE = 1 +}; + +#inline cc +/** + * Converts a C++ "bool" type to a PP_Bool. + * + * @param[in] b A C++ "bool" type. + * + * @return A PP_Bool. + */ +inline PP_Bool PP_FromBool(bool b) { + return b ? PP_TRUE : PP_FALSE; +} + +/** + * Converts a PP_Bool to a C++ "bool" type. + * + * @param[in] b A PP_Bool. + * + * @return A C++ "bool" type. + */ +inline bool PP_ToBool(PP_Bool b) { + return (b != PP_FALSE); +} +#endinl diff --git a/browser/extensions/mortar/ppapi/api/pp_codecs.idl b/browser/extensions/mortar/ppapi/api/pp_codecs.idl new file mode 100644 index 000000000000..8699ec9853d9 --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/pp_codecs.idl @@ -0,0 +1,254 @@ +/* Copyright (c) 2014 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * Video profiles. + */ +enum PP_VideoProfile { + PP_VIDEOPROFILE_H264BASELINE = 0, + PP_VIDEOPROFILE_H264MAIN = 1, + PP_VIDEOPROFILE_H264EXTENDED = 2, + PP_VIDEOPROFILE_H264HIGH = 3, + PP_VIDEOPROFILE_H264HIGH10PROFILE = 4, + PP_VIDEOPROFILE_H264HIGH422PROFILE = 5, + PP_VIDEOPROFILE_H264HIGH444PREDICTIVEPROFILE = 6, + PP_VIDEOPROFILE_H264SCALABLEBASELINE = 7, + PP_VIDEOPROFILE_H264SCALABLEHIGH = 8, + PP_VIDEOPROFILE_H264STEREOHIGH = 9, + PP_VIDEOPROFILE_H264MULTIVIEWHIGH = 10, + PP_VIDEOPROFILE_VP8_ANY = 11, + PP_VIDEOPROFILE_VP9_ANY = 12, + PP_VIDEOPROFILE_MAX = PP_VIDEOPROFILE_VP9_ANY +}; + +/** + * Audio profiles. + */ +enum PP_AudioProfile { + PP_AUDIOPROFILE_OPUS = 0, + PP_AUDIOPROFILE_MAX = PP_AUDIOPROFILE_OPUS +}; + +/** + * Hardware acceleration options. + */ +enum PP_HardwareAcceleration { + /** Create a hardware accelerated resource only. */ + PP_HARDWAREACCELERATION_ONLY = 0, + + /** + * Create a hardware accelerated resource if possible. Otherwise, fall back + * to the software implementation. + */ + PP_HARDWAREACCELERATION_WITHFALLBACK = 1, + + /** Create the software implementation only. */ + PP_HARDWAREACCELERATION_NONE = 2, + + PP_HARDWAREACCELERATION_LAST = PP_HARDWAREACCELERATION_NONE +}; + +/** + * Struct describing a decoded video picture. The decoded picture data is stored + * in the GL texture corresponding to |texture_id|. The plugin can determine + * which Decode call generated the picture using |decode_id|. + */ +struct PP_VideoPicture { + /** + * |decode_id| parameter of the Decode call which generated this picture. + * See the PPB_VideoDecoder function Decode() for more details. + */ + uint32_t decode_id; + + /** + * Texture ID in the plugin's GL context. The plugin can use this to render + * the decoded picture. + */ + uint32_t texture_id; + + /** + * The GL texture target for the decoded picture. Possible values are: + * GL_TEXTURE_2D + * GL_TEXTURE_RECTANGLE_ARB + * GL_TEXTURE_EXTERNAL_OES + * + * The pixel format of the texture is GL_RGBA. + */ + uint32_t texture_target; + + /** + * Dimensions of the texture holding the decoded picture. + */ + PP_Size texture_size; + + /** + * The visible subrectangle of the picture. The plugin should display only + * this part of the picture. + */ + PP_Rect visible_rect; +}; + +/** + * Struct describing a decoded video picture. The decoded picture data is stored + * in the GL texture corresponding to |texture_id|. The plugin can determine + * which Decode call generated the picture using |decode_id|. + */ +struct PP_VideoPicture_0_1 { + /** + * |decode_id| parameter of the Decode call which generated this picture. + * See the PPB_VideoDecoder function Decode() for more details. + */ + uint32_t decode_id; + + /** + * Texture ID in the plugin's GL context. The plugin can use this to render + * the decoded picture. + */ + uint32_t texture_id; + + /** + * The GL texture target for the decoded picture. Possible values are: + * GL_TEXTURE_2D + * GL_TEXTURE_RECTANGLE_ARB + * GL_TEXTURE_EXTERNAL_OES + * + * The pixel format of the texture is GL_RGBA. + */ + uint32_t texture_target; + + /** + * Dimensions of the texture holding the decoded picture. + */ + PP_Size texture_size; +}; + +/** + * Supported video profile information. See the PPB_VideoEncoder function + * GetSupportedProfiles() for more details. + */ +struct PP_VideoProfileDescription { + /** + * The codec profile. + */ + PP_VideoProfile profile; + + /** + * Dimensions of the maximum resolution of video frames, in pixels. + */ + PP_Size max_resolution; + + /** + * The numerator of the maximum frame rate. + */ + uint32_t max_framerate_numerator; + + /** + * The denominator of the maximum frame rate. + */ + uint32_t max_framerate_denominator; + + /** + * Whether the profile is hardware accelerated. + */ + PP_Bool hardware_accelerated; +}; + +/** + * Supported video profile information. See the PPB_VideoEncoder function + * GetSupportedProfiles() for more details. + */ +struct PP_VideoProfileDescription_0_1 { + /** + * The codec profile. + */ + PP_VideoProfile profile; + + /** + * Dimensions of the maximum resolution of video frames, in pixels. + */ + PP_Size max_resolution; + + /** + * The numerator of the maximum frame rate. + */ + uint32_t max_framerate_numerator; + + /** + * The denominator of the maximum frame rate. + */ + uint32_t max_framerate_denominator; + + /** + * A value indicating if the profile is available in hardware, software, or + * both. + */ + PP_HardwareAcceleration acceleration; +}; + +/** + * Supported audio profile information. See the PPB_AudioEncoder function + * GetSupportedProfiles() for more details. + */ +struct PP_AudioProfileDescription { + /** + * The codec profile. + */ + PP_AudioProfile profile; + + /** + * Maximum number of channels that can be encoded. + */ + uint32_t max_channels; + + /** + * Sample size. + */ + uint32_t sample_size; + + /** + * Sampling rate that can be encoded + */ + uint32_t sample_rate; + + /** + * Whether the profile is hardware accelerated. + */ + PP_Bool hardware_accelerated; +}; + +/** + * Struct describing a bitstream buffer. + */ +struct PP_BitstreamBuffer { + /** + * The size, in bytes, of the bitstream data. + */ + uint32_t size; + + /** + * The base address of the bitstream data. + */ + mem_t buffer; + + /** + * Whether the buffer represents a key frame. + */ + PP_Bool key_frame; +}; + +/** + * Struct describing an audio bitstream buffer. + */ +struct PP_AudioBitstreamBuffer { + /** + * The size, in bytes, of the bitstream data. + */ + uint32_t size; + + /** + * The base address of the bitstream data. + */ + mem_t buffer; +}; diff --git a/browser/extensions/mortar/ppapi/api/pp_completion_callback.idl b/browser/extensions/mortar/ppapi/api/pp_completion_callback.idl new file mode 100644 index 000000000000..72aed837704b --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/pp_completion_callback.idl @@ -0,0 +1,262 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * This file defines the API to create and run a callback. + */ + +/** + * This typedef defines the signature that you implement to receive callbacks + * on asynchronous completion of an operation. + * + * @param[in] user_data A pointer to user data passed to a callback function. + * @param[in] result If result is 0 (PP_OK), the operation succeeded. Negative + * values (other than -1 or PP_OK_COMPLETE) indicate error and are specified + * in pp_errors.h. Positive values for result usually indicate success and have + * some operation-dependent meaning (such as bytes read). + */ +typedef void PP_CompletionCallback_Func([inout] mem_t user_data, + [in] int32_t result); + +/** + * This enumeration contains flags used to control how non-NULL callbacks are + * scheduled by asynchronous methods. + */ +[assert_size(4)] +enum PP_CompletionCallback_Flag { + /** + * By default any non-NULL callback will always invoked asynchronously, + * on success or error, even if the operation could complete synchronously + * without blocking. + * + * The method taking such callback will always return PP_OK_COMPLETIONPENDING. + * The callback will be invoked on the same thread on which the method was + * invoked. + * + * NOTE: If the method taking the callback is invoked on a background + * thread that has no valid PPB_MessageLoop resource attached, the system has + * no way to run the callback on the correct thread. In this case, a log + * message will be emitted and the plugin will be made to crash. + */ + PP_COMPLETIONCALLBACK_FLAG_NONE = 0 << 0, + /** + * This flag allows any method taking such callback to complete synchronously + * and not call the callback if the operation would not block. This is useful + * when performance is an issue, and the operation bandwidth should not be + * limited to the processing speed of the message loop. + * + * On synchronous method completion, the completion result will be returned + * by the method itself. Otherwise, the method will return + * PP_OK_COMPLETIONPENDING, and the callback will be invoked asynchronously on + * the same thread on which the method was invoked. If there is no valid + * PPB_MessageLoop attached to that thread, and the callback would normally + * run asynchronously, the invoked method will return + * PP_ERROR_NO_MESSAGE_LOOP. + */ + PP_COMPLETIONCALLBACK_FLAG_OPTIONAL = 1 << 0 +}; + + +/** + * PP_CompletionCallback is a common mechanism for supporting + * potentially asynchronous calls in browser interfaces. Any method that takes a + * PP_CompletionCallback can be used in one of three different + * ways: + * - Required: The callback will always be invoked asynchronously on the + * thread where the associated PPB method was invoked. The method + * will always return PP_OK_COMPLETIONPENDING when a required + * callback, and the callback will be invoked later (barring + * system or thread shutdown; see PPB_MessageLoop for details). + * Required callbacks are the default. + *

+ * NOTE: If you use a required callback on a background thread, + * you must have created and attached a PPB_MessageLoop. + * Otherwise, the system can not run your callback on that thread, + * and will instead emit a log message and crash your plugin to + * make the problem more obvious. + * + * - Optional: The callback may be invoked asynchronously, or the PPB method + * may complete synchronously if it can do so without blocking. + * If the method will complete asynchronously, it will return + * PP_OK_COMPLETIONPENDING. Otherwise, it will complete + * synchronously and return an appropriate code (see below for + * more information on the return code). Optional callbacks are + * generally more difficult to use correctly than Required + * callbacks, but can provide better performance for some APIs + * (especially APIs with buffered reads, such as PPB_URLLoader or + * PPB_FileIO). + *

+ * NOTE: If you use an optional callback on a background thread, + * and you have not created and attached a PPB_MessageLoop, then + * the method you invoke will fail without running and return + * PP_ERROR_NO_MESSAGE_LOOP. + * + * - Blocking: In this case, the callback's function pointer is NULL, and the + * invoked method must complete synchronously. The method will + * run to completion and return an appropriate code when finished + * (see below for more information). Blocking completion + * callbacks are only supported on background threads. + *

+ * PP_BlockUntilComplete() provides a convenient way + * to specify blocking behavior. Refer to + * PP_BlockUntilComplete for more information. + * + * When the callback is run asynchronously, the result parameter passed to + * func is an int32_t that, if negative indicates an error code + * whose meaning is specific to the calling method (refer to + * pp_error.h for further information). A positive or 0 value is a + * return result indicating success whose meaning depends on the calling method + * (e.g. number of bytes read). + */ +[passByValue] struct PP_CompletionCallback { + /** + * This value is a callback function that will be called, or NULL if this is + * a blocking completion callback. + */ + PP_CompletionCallback_Func func; + /** + * This value is a pointer to user data passed to a callback function. + */ + mem_t user_data; + + /** + * Flags used to control how non-NULL callbacks are scheduled by + * asynchronous methods. + */ + int32_t flags; +}; + +#inline c +#include + +/** + * @addtogroup Functions + * @{ + */ +/** + * PP_MakeCompletionCallback() is used to create a + * PP_CompletionCallback. + * + * Example, creating a Required callback: + * + * @code + * struct PP_CompletionCallback cc = PP_MakeCompletionCallback(Foo, NULL); + * @endcode + * + * Example, creating an Optional callback: + * + * @code + * struct PP_CompletionCallback cc = PP_MakeCompletionCallback(Foo, NULL); + * cc.flags = cc.flags | PP_COMPLETIONCALLBACK_FLAG_OPTIONAL; + * @endcode + * + * @param[in] func A PP_CompletionCallback_Func that will be + * called. + * @param[in] user_data A pointer to user data passed to your callback + * function. This is optional and is typically used to help track state + * when you may have multiple callbacks pending. + * + * @return A PP_CompletionCallback structure. + */ +PP_INLINE struct PP_CompletionCallback PP_MakeCompletionCallback( + PP_CompletionCallback_Func func, + void* user_data) { + struct PP_CompletionCallback cc; + cc.func = func; + cc.user_data = user_data; + cc.flags = PP_COMPLETIONCALLBACK_FLAG_NONE; + return cc; +} + +/** + * PP_MakeOptionalCompletionCallback() is used to create a PP_CompletionCallback + * with PP_COMPLETIONCALLBACK_FLAG_OPTIONAL set. + * + * @param[in] func A PP_CompletionCallback_Func to be called on completion. + * @param[in] user_data A pointer to user data passed to be passed to the + * callback function. This is optional and is typically used to help track state + * in case of multiple pending callbacks. + * + * @return A PP_CompletionCallback structure. + */ +PP_INLINE struct PP_CompletionCallback PP_MakeOptionalCompletionCallback( + PP_CompletionCallback_Func func, + void* user_data) { + struct PP_CompletionCallback cc = PP_MakeCompletionCallback(func, user_data); + cc.flags = cc.flags | PP_COMPLETIONCALLBACK_FLAG_OPTIONAL; + return cc; +} +/** + * @} + */ + +/** + * @addtogroup Functions + * @{ + */ + +/** + * PP_RunCompletionCallback() is used to run a callback. It invokes + * the callback function passing it user data specified on creation and + * completion |result|. + * + * @param[in] cc A pointer to a PP_CompletionCallback that will be + * run. + * @param[in] result The result of the operation. Non-positive values correspond + * to the error codes from pp_errors.h (excluding PP_OK_COMPLETIONPENDING). + * Positive values indicate additional information such as bytes read. + */ +PP_INLINE void PP_RunCompletionCallback(struct PP_CompletionCallback* cc, + int32_t result) { + cc->func(cc->user_data, result); +} + +/** + * @} + */ + +/** + * @addtogroup Functions + * @{ + */ + + /** + * PP_BlockUntilComplete() is used in place of an actual completion callback + * to request blocking behavior. If specified, the calling thread will block + * until the function completes. Blocking completion callbacks are only allowed + * from background threads. + * + * @return A PP_CompletionCallback structure. + */ +PP_INLINE struct PP_CompletionCallback PP_BlockUntilComplete(void) { + return PP_MakeCompletionCallback(NULL, NULL); +} + +/** + * PP_RunAndClearCompletionCallback() runs a callback and clears the reference + * to that callback. + * + * This function is used when the null-ness of a completion callback is used as + * a signal for whether a completion callback has been registered. In this + * case, after the execution of the callback, it should be cleared. However, + * this introduces a conflict if the completion callback wants to schedule more + * work that involves the same completion callback again (for example, when + * reading data from an URLLoader, one would typically queue up another read + * callback). As a result, this function clears the pointer + * before the provided callback is executed. + */ +PP_INLINE void PP_RunAndClearCompletionCallback( + struct PP_CompletionCallback* cc, + int32_t res) { + struct PP_CompletionCallback temp = *cc; + *cc = PP_BlockUntilComplete(); + PP_RunCompletionCallback(&temp, res); +} +/** + * @} + */ + +#endinl + diff --git a/browser/extensions/mortar/ppapi/api/pp_directory_entry.idl b/browser/extensions/mortar/ppapi/api/pp_directory_entry.idl new file mode 100644 index 000000000000..4b12c34b2499 --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/pp_directory_entry.idl @@ -0,0 +1,14 @@ +/* Copyright (c) 2013 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* + * This file defines the PP_DirectoryEntry struct. + */ + +[assert_size(8)] +struct PP_DirectoryEntry { + PP_Resource file_ref; + PP_FileType file_type; +}; diff --git a/browser/extensions/mortar/ppapi/api/pp_errors.idl b/browser/extensions/mortar/ppapi/api/pp_errors.idl new file mode 100644 index 000000000000..b17e87c73ee1 --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/pp_errors.idl @@ -0,0 +1,202 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * This file defines an enumeration of all PPAPI error codes. + */ + +/** + * This enumeration contains enumerators of all PPAPI error codes. + * + * Errors are negative valued. Callers should treat all negative values as a + * failure, even if it's not in the list, since the possible errors are likely + * to expand and change over time. + */ +[unnamed] enum PP_Error { + /** + * This value is returned by a function on successful synchronous completion + * or is passed as a result to a PP_CompletionCallback_Func on successful + * asynchronous completion. + */ + PP_OK = 0, + /** + * This value is returned by a function that accepts a PP_CompletionCallback + * and cannot complete synchronously. This code indicates that the given + * callback will be asynchronously notified of the final result once it is + * available. + */ + PP_OK_COMPLETIONPENDING = -1, + + /**This value indicates failure for unspecified reasons. */ + PP_ERROR_FAILED = -2, + + /** + * This value indicates failure due to an asynchronous operation being + * interrupted. The most common cause of this error code is destroying a + * resource that still has a callback pending. All callbacks are guaranteed + * to execute, so any callbacks pending on a destroyed resource will be + * issued with PP_ERROR_ABORTED. + * + * If you get an aborted notification that you aren't expecting, check to + * make sure that the resource you're using is still in scope. A common + * mistake is to create a resource on the stack, which will destroy the + * resource as soon as the function returns. + */ + PP_ERROR_ABORTED = -3, + + /** This value indicates failure due to an invalid argument. */ + PP_ERROR_BADARGUMENT = -4, + + /** This value indicates failure due to an invalid PP_Resource. */ + PP_ERROR_BADRESOURCE = -5, + + /** This value indicates failure due to an unavailable PPAPI interface. */ + PP_ERROR_NOINTERFACE = -6, + + /** This value indicates failure due to insufficient privileges. */ + PP_ERROR_NOACCESS = -7, + + /** This value indicates failure due to insufficient memory. */ + PP_ERROR_NOMEMORY = -8, + + /** This value indicates failure due to insufficient storage space. */ + PP_ERROR_NOSPACE = -9, + + /** This value indicates failure due to insufficient storage quota. */ + PP_ERROR_NOQUOTA = -10, + + /** + * This value indicates failure due to an action already being in + * progress. + */ + PP_ERROR_INPROGRESS = -11, + + /** + * The requested command is not supported by the browser. + */ + PP_ERROR_NOTSUPPORTED = -12, + + /** + * Returned if you try to use a null completion callback to "block until + * complete" on the main thread. Blocking the main thread is not permitted + * to keep the browser responsive (otherwise, you may not be able to handle + * input events, and there are reentrancy and deadlock issues). + */ + PP_ERROR_BLOCKS_MAIN_THREAD = -13, + /** + * This value indicates that the plugin sent bad input data to a resource, + * leaving it in an invalid state. The resource can't be used after returning + * this error and should be released. + */ + PP_ERROR_MALFORMED_INPUT = -14, + /** + * This value indicates that a resource has failed. The resource can't be + * used after returning this error and should be released. + */ + PP_ERROR_RESOURCE_FAILED = -15, + + /** This value indicates failure due to a file that does not exist. */ + PP_ERROR_FILENOTFOUND = -20, + /** This value indicates failure due to a file that already exists. */ + PP_ERROR_FILEEXISTS = -21, + /** This value indicates failure due to a file that is too big. */ + PP_ERROR_FILETOOBIG = -22, + /** + * This value indicates failure due to a file having been modified + * unexpectedly. + */ + PP_ERROR_FILECHANGED = -23, + /** This value indicates that the pathname does not reference a file. */ + PP_ERROR_NOTAFILE = -24, + /** This value indicates failure due to a time limit being exceeded. */ + PP_ERROR_TIMEDOUT = -30, + /** + * This value indicates that the user cancelled rather than providing + * expected input. + */ + PP_ERROR_USERCANCEL = -40, + /** + * This value indicates failure due to lack of a user gesture such as a + * mouse click or key input event. Examples of actions requiring a user + * gesture are showing the file chooser dialog and going into fullscreen + * mode. + */ + PP_ERROR_NO_USER_GESTURE = -41, + /** + * This value indicates that the graphics context was lost due to a + * power management event. + */ + PP_ERROR_CONTEXT_LOST = -50, + /** + * Indicates an attempt to make a PPAPI call on a thread without previously + * registering a message loop via PPB_MessageLoop.AttachToCurrentThread. + * Without this registration step, no PPAPI calls are supported. + */ + PP_ERROR_NO_MESSAGE_LOOP = -51, + /** + * Indicates that the requested operation is not permitted on the current + * thread. + */ + PP_ERROR_WRONG_THREAD = -52, + /** + * Indicates that a null completion callback was used on a thread handling a + * blocking message from JavaScript. Null completion callbacks "block until + * complete", which could cause the main JavaScript thread to be blocked + * excessively. + */ + PP_ERROR_WOULD_BLOCK_THREAD = -53, + + /** + * This value indicates that the connection was closed. For TCP sockets, it + * corresponds to a TCP FIN. + */ + PP_ERROR_CONNECTION_CLOSED = -100, + /** + * This value indicates that the connection was reset. For TCP sockets, it + * corresponds to a TCP RST. + */ + PP_ERROR_CONNECTION_RESET = -101, + /** + * This value indicates that the connection attempt was refused. + */ + PP_ERROR_CONNECTION_REFUSED = -102, + /** + * This value indicates that the connection was aborted. For TCP sockets, it + * means the connection timed out as a result of not receiving an ACK for data + * sent. This can include a FIN packet that did not get ACK'd. + */ + PP_ERROR_CONNECTION_ABORTED = -103, + /** + * This value indicates that the connection attempt failed. + */ + PP_ERROR_CONNECTION_FAILED = -104, + /** + * This value indicates that the connection attempt timed out. + */ + PP_ERROR_CONNECTION_TIMEDOUT = -105, + /** + * This value indicates that the IP address or port number is invalid. + */ + PP_ERROR_ADDRESS_INVALID = -106, + /** + * This value indicates that the IP address is unreachable. This usually means + * that there is no route to the specified host or network. + */ + PP_ERROR_ADDRESS_UNREACHABLE = -107, + /** + * This value is returned when attempting to bind an address that is already + * in use. + */ + PP_ERROR_ADDRESS_IN_USE = -108, + /** + * This value indicates that the message was too large for the transport. + */ + PP_ERROR_MESSAGE_TOO_BIG = -109, + /** + * This value indicates that the host name could not be resolved. + */ + PP_ERROR_NAME_NOT_RESOLVED = -110 +}; + diff --git a/browser/extensions/mortar/ppapi/api/pp_file_info.idl b/browser/extensions/mortar/ppapi/api/pp_file_info.idl new file mode 100644 index 000000000000..9cccc8948e70 --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/pp_file_info.idl @@ -0,0 +1,76 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * This file defines three enumerations for use in the PPAPI C file IO APIs. + */ + +/** + * The PP_FileType enum contains file type constants. + */ +[assert_size(4)] +enum PP_FileType { + /** A regular file type */ + PP_FILETYPE_REGULAR = 0, + /** A directory */ + PP_FILETYPE_DIRECTORY = 1, + /** A catch-all for unidentified types */ + PP_FILETYPE_OTHER = 2 +}; + +/** + * The PP_FileSystemType enum contains file system type constants. + */ +[assert_size(4)] +enum PP_FileSystemType { + /** For identified invalid return values */ + PP_FILESYSTEMTYPE_INVALID = 0, + /** For external file system types */ + PP_FILESYSTEMTYPE_EXTERNAL = 1, + /** For local persistent file system types */ + PP_FILESYSTEMTYPE_LOCALPERSISTENT = 2, + /** For local temporary file system types */ + PP_FILESYSTEMTYPE_LOCALTEMPORARY = 3, + /** For isolated file system types */ + PP_FILESYSTEMTYPE_ISOLATED = 4 +}; + +/** + * The PP_FileInfo struct represents all information about a file, + * such as size, type, and creation time. + */ +[assert_size(40)] +struct PP_FileInfo { + /** This value represents the size of the file measured in bytes */ + int64_t size; + + /** + * This value represents the type of file as defined by the + * PP_FileType enum + */ + PP_FileType type; + + /** + * This value represents the file system type of the file as defined by the + * PP_FileSystemType enum. + */ + PP_FileSystemType system_type; + + /** + * This value represents the creation time of the file. + */ + PP_Time creation_time; + + /** + * This value represents the last time the file was accessed. + */ + PP_Time last_access_time; + + /** + * This value represents the last time the file was modified. + */ + PP_Time last_modified_time; +}; + diff --git a/browser/extensions/mortar/ppapi/api/pp_graphics_3d.idl b/browser/extensions/mortar/ppapi/api/pp_graphics_3d.idl new file mode 100644 index 000000000000..86dc6ae5d694 --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/pp_graphics_3d.idl @@ -0,0 +1,83 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * This file defines the PP_Graphics3DAttrib enumeration for use in + * PPAPI C headers. + */ + +[assert_size(4)] enum PP_Graphics3DAttrib { + /** + * Bits of Alpha in the color buffer. + */ + PP_GRAPHICS3DATTRIB_ALPHA_SIZE = 0x3021, + /** + * Bits of Blue in the color buffer. + */ + PP_GRAPHICS3DATTRIB_BLUE_SIZE = 0x3022, + /** + * Bits of Green in the color buffer. + */ + PP_GRAPHICS3DATTRIB_GREEN_SIZE = 0x3023, + /** + * Bits of Red in the color buffer. + */ + PP_GRAPHICS3DATTRIB_RED_SIZE = 0x3024, + /** + * Bits of Z in the depth buffer. + */ + PP_GRAPHICS3DATTRIB_DEPTH_SIZE = 0x3025, + /** + * Bits of Stencil in the stencil buffer. + */ + PP_GRAPHICS3DATTRIB_STENCIL_SIZE = 0x3026, + /** + * Number of samples per pixel. + */ + PP_GRAPHICS3DATTRIB_SAMPLES = 0x3031, + /** + * Number of multisample buffers. + */ + PP_GRAPHICS3DATTRIB_SAMPLE_BUFFERS = 0x3032, + /** + * Attrib list terminator. + */ + PP_GRAPHICS3DATTRIB_NONE = 0x3038, + /** + * Height of surface in pixels. + */ + PP_GRAPHICS3DATTRIB_HEIGHT = 0x3056, + /** + * Width of surface in pixels. + */ + PP_GRAPHICS3DATTRIB_WIDTH = 0x3057, + /** + * Specifies the effect on the color buffer of posting a surface + * with SwapBuffers. The initial value is chosen by the implementation. + */ + PP_GRAPHICS3DATTRIB_SWAP_BEHAVIOR = 0x3093, + /** + * Indicates that color buffer contents are unaffected. + */ + PP_GRAPHICS3DATTRIB_BUFFER_PRESERVED = 0x3094, + /** + * Indicates that color buffer contents may be destroyed or changed. + */ + PP_GRAPHICS3DATTRIB_BUFFER_DESTROYED = 0x3095, + /** + * Specifies whether the context is intended to be low-power or + * high-performance. The initial value is + * PP_GRAPHICS3DATTRIB_GPU_PREFERENCE_PERFORMANCE. + */ + PP_GRAPHICS3DATTRIB_GPU_PREFERENCE = 0x11000, + /** + * The context should be low-power, and may be created on an integrated gpu. + */ + PP_GRAPHICS3DATTRIB_GPU_PREFERENCE_LOW_POWER = 0x11001, + /** + * The context may be high-power and may be created on a discrete gpu. + */ + PP_GRAPHICS3DATTRIB_GPU_PREFERENCE_PERFORMANCE = 0x11002 +}; diff --git a/browser/extensions/mortar/ppapi/api/pp_input_event.idl b/browser/extensions/mortar/ppapi/api/pp_input_event.idl new file mode 100644 index 000000000000..6a76cb4cce09 --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/pp_input_event.idl @@ -0,0 +1,201 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * This file defines the API used to handle mouse and keyboard input events. + */ + +/** + * The PP_InputEvent_Key struct represents a key up or key down + * event. + * + * Key up and key down events correspond to physical keys on the keyboard. The + * actual character that the user typed (if any) will be delivered in a + * "character" event. + * + * If the user loses focus on the module while a key is down, a key up + * event might not occur. For example, if the module has focus and the user + * presses and holds the shift key, the module will see a "shift down" message. + * Then if the user clicks elsewhere on the web page, the module's focus will + * be lost and no more input events will be delivered. + * + * If your module depends on receiving key up events, it should also handle + * "lost focus" as the equivalent of "all keys up." + */ +[assert_size(8)] +struct PP_InputEvent_Key { + /** This value is a bit field combination of the EVENT_MODIFIER flags. */ + uint32_t modifier; + + /** + * This value reflects the DOM KeyboardEvent keyCode field. + * Chrome populates this with the Windows-style Virtual Key code of the key. + */ + + uint32_t key_code; +}; + +/** + * The PP_InputEvent_Character struct represents a typed character + * event. + * + * Normally, the program will receive a key down event, followed by a character + * event, followed by a key up event. The character event will have any + * modifier keys applied. Obvious examples are symbols, where Shift-5 gives you + * a '%'. The key down and up events will give you the scan code for the "5" + * key, and the character event will give you the '%' character. + * + * You may not get a character event for all key down events if the key doesn't + * generate a character. Likewise, you may actually get multiple character + * events in a row. For example, some locales have an accent key that modifies + * the next character typed. You might get this stream of events: accent down, + * accent up (it didn't generate a character), letter key down, letter with + * accent character event (it was modified by the previous accent key), letter + * key up. If the letter can't be combined with the accent, like an umlaut and + * an 'R', the system might send umlaut down, umlaut up, 'R' key down, umlaut + * character (can't combine it with 'R', so just send the raw umlaut so it + * isn't lost"), 'R' character event, 'R' key up. + */ +[assert_size(12)] +struct PP_InputEvent_Character { + /** A combination of the PP_InputEvent_Modifier flags. */ + uint32_t modifier; + + /** + * This value represents the typed character as a single null-terminated UTF-8 + * character. Any unused bytes will be filled with null bytes. Since the + * maximum UTF-8 character is 4 bytes, there will always be at least one null + * at the end so you can treat this as a null-terminated UTF-8 string. + */ + int8_t[5] text; +}; + +/** + * The PP_InputEvent_Mouse struct represents all mouse events + * except mouse wheel events. + */ +[assert_size(20)] +struct PP_InputEvent_Mouse { + /** + * This value is a bit field combination of the + * PP_InputEvent_Modifier flags. + */ + uint32_t modifier; + + /** + * This value represents the button that changed for mouse down or up events. + * This value will be PP_EVENT_MOUSEBUTTON_NONE for mouse move, + * enter, and leave events. + */ + PP_InputEvent_MouseButton button; + + /** + * This values represents the x coordinate of the mouse when the event + * occurred. + * + * In most, but not all, cases these coordinates will just be integers. + * For example, the plugin element might be arbitrarily scaled or transformed + * in the DOM, and translating a mouse event into the coordinate space of the + * plugin will give non-integer values. + */ + float_t x; + /** + * This values represents the y coordinate of the mouse when the event + * occurred. + * + * In most, but not all, cases these coordinates will just be integers. + * For example, the plugin element might be arbitrarily scaled or transformed + * in the DOM, and translating a mouse event into the coordinate space of the + * plugin will give non-integer values. + */ + float_t y; + int32_t click_count; +}; + +/** + * The PP_InputEvent_Wheel struct represents all mouse wheel + * events. + */ +[assert_size(24)] struct PP_InputEvent_Wheel { + /** + * This value represents a combination of the EVENT_MODIFIER + * flags. + */ + uint32_t modifier; + + /** + * The mouse wheel's horizontal scroll amount. A scroll to the right + * (where the content moves left) is represented as positive values, + * and a scroll to the left (where the content moves right) is + * represented as negative values. + * + * The units are either in pixels (when scroll_by_page is false) or pages + * (when scroll_by_page is true). For example, delta_y = -3 means scroll up 3 + * pixels when scroll_by_page is false, and scroll up 3 pages when + * scroll_by_page is true. + * + * This amount is system dependent and will take into account the user's + * preferred scroll sensitivity and potentially also nonlinear acceleration + * based on the speed of the scrolling. + * + * Devices will be of varying resolution. Some mice with large detents will + * only generate integer scroll amounts. But fractional values are also + * possible, for example, on some trackpads and newer mice that don't have + * "clicks". + */ + float_t delta_x; + + /** + * The mouse wheel's vertical scroll amount. A scroll down (where the + * content moves up) is represented as positive values, and a scroll up + * (where the content moves down) is represented as negative values. + * + * The units are either in pixels (when scroll_by_page is false) or pages + * (when scroll_by_page is true). For example, delta_y = -3 means scroll up 3 + * pixels when scroll_by_page is false, and scroll up 3 pages when + * scroll_by_page is true. + * + * This amount is system dependent and will take into account the user's + * preferred scroll sensitivity and potentially also nonlinear acceleration + * based on the speed of the scrolling. + * + * Devices will be of varying resolution. Some mice with large detents will + * only generate integer scroll amounts. But fractional values are also + * possible, for example, on some trackpads and newer mice that don't have + * "clicks". + */ + float_t delta_y; + + /** + * The number of "clicks" of the scroll wheel that have produced the + * event. The value may have system-specific acceleration applied to it, + * depending on the device. The positive and negative meanings are the same + * as for delta_x and delta_y. + * + * If you are scrolling, you probably want to use the delta values above. + * These tick events can be useful if you aren't doing actual scrolling and + * don't want or pixel values. An example may be cycling between different + * items in a game. + * + * You may receive fractional values for the wheel ticks if the mouse wheel + * is high resolution or doesn't have "clicks". If your program wants + * discrete events (as in the "picking items" example) you should accumulate + * fractional click values from multiple messages until the total value + * reaches positive or negative one. This should represent a similar amount + * of scrolling as for a mouse that has a discrete mouse wheel. + */ + float_t wheel_ticks_x; + + /** This value represents */ + float_t wheel_ticks_y; + + /** + * Indicates if the scroll delta_x/delta_y + * indicates pages or lines to scroll by. When true, the user is requesting + * to scroll by pages. + */ + PP_Bool scroll_by_page; +}; + diff --git a/browser/extensions/mortar/ppapi/api/pp_instance.idl b/browser/extensions/mortar/ppapi/api/pp_instance.idl new file mode 100644 index 000000000000..569fb252ba4b --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/pp_instance.idl @@ -0,0 +1,21 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * This file defines the PP_Instance type which uniquely identifies one module + * instance. + */ + +/** + * The PP_Instance value uniquely identifies one instance of a + * module (.nexe/PP_Module). There will be one module instance for every + * \ tag on a page. + * + * This identifier is an opaque handle assigned by the browser to the module. + * It is guaranteed never to be 0, so a module can initialize it to 0 to + * indicate a "NULL handle." + */ +[assert_size(4)] typedef int32_t PP_Instance; + diff --git a/browser/extensions/mortar/ppapi/api/pp_macros.idl b/browser/extensions/mortar/ppapi/api/pp_macros.idl new file mode 100644 index 000000000000..9f02c2749853 --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/pp_macros.idl @@ -0,0 +1,94 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * Defines the common macros such as assert, inline, ... + */ + +#inline c + +/* + * @addtogroup PP + * @{ + */ + +/* Use PP_INLINE to tell the compiler to inline functions. The main purpose of + * inline functions in ppapi is to allow us to define convenience functions in + * the ppapi header files, without requiring clients or implementers to link a + * PPAPI C library. The "inline" keyword is not supported by pre-C99 C + * compilers (such as MS Visual Studio 2008 and older versions of GCC). MSVS + * supports __forceinline and GCC supports __inline__. Use of the static + * keyword ensures (in C) that the function is not compiled on its own, which + * could cause multiple definition errors. + * http://msdn.microsoft.com/en-us/library/z8y1yy88.aspx + * http://gcc.gnu.org/onlinedocs/gcc/Inline.html + */ +#if defined(__cplusplus) +/* The inline keyword is part of C++ and guarantees we won't get multiple + * definition errors. + */ +# define PP_INLINE inline +#else +# if defined(_MSC_VER) +# define PP_INLINE static __forceinline +# else +# define PP_INLINE static __inline__ +# endif +#endif + +/* This is a compile-time assertion useful for ensuring that a given type is + a given number of bytes wide. The size of the array is designed to be 1 + (which should always be valid) if the enum's size is SIZE, and otherwise the + size of the array will be -1 (which all/most compilers should flag as an + error). This is wrapped inside a struct, because if it is a simple global + we get multiple definition errors at link time. + + NAME is the name of the type without any spaces or the struct or enum + keywords. + + CTYPENAME is the typename required by C. I.e., for a struct or enum, the + appropriate keyword must be included. + + SIZE is the expected size in bytes. + */ +#define PP_COMPILE_ASSERT_SIZE_IN_BYTES_IMPL(NAME, CTYPENAME, SIZE) \ +struct PP_Dummy_Struct_For_##NAME { \ +char _COMPILE_ASSERT_FAILED_The_type_named_ \ +## NAME ## _is_not_ ## SIZE ## \ +_bytes_wide[(sizeof(CTYPENAME) == SIZE) ? 1 : -1]; } + +/* PP_COMPILE_ASSERT_SIZE_IN_BYTES is for typenames that contain no spaces. + E.g.: + PP_COMPILE_ASSERT_SIZE_IN_BYTES(int, 4); + typedef struct { int a; } Foo; + PP_COMPILE_ASSERT_SIZE_IN_BYTES(Foo, 4); + */ +#define PP_COMPILE_ASSERT_SIZE_IN_BYTES(NAME, SIZE) \ +PP_COMPILE_ASSERT_SIZE_IN_BYTES_IMPL(NAME, NAME, SIZE) + +/* PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES is for typenames that contain 'struct' + in C. That is, struct names that are not typedefs. + E.g.: + struct Foo { int a; }; + PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(Foo, 4); + */ +#define PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(NAME, SIZE) \ +PP_COMPILE_ASSERT_SIZE_IN_BYTES_IMPL(NAME, struct NAME, SIZE) + +/* PP_COMPILE_ASSERT_ENUM_SIZE_IN_BYTES is for typenames that contain 'enum' + in C. That is, enum names that are not typedefs. + E.g.: + enum Bar { A = 0, B = 1 }; + PP_COMPILE_ASSERT_ENUM_SIZE_IN_BYTES(Foo, 4); + */ +#define PP_COMPILE_ASSERT_ENUM_SIZE_IN_BYTES(NAME, SIZE) \ +PP_COMPILE_ASSERT_SIZE_IN_BYTES_IMPL(NAME, enum NAME, SIZE) + +/** + * @} + * End of addtogroup PP + */ + +#endinl diff --git a/browser/extensions/mortar/ppapi/api/pp_module.idl b/browser/extensions/mortar/ppapi/api/pp_module.idl new file mode 100644 index 000000000000..d96d60a76ab3 --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/pp_module.idl @@ -0,0 +1,20 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * This file defines the PP_Module type which uniquely identifies the module + * or .nexe. + */ + +/** + * The PP_Module value uniquely identifies the module or .nexe. + * + * This identifier is an opaque handle assigned by the browser to the module. It + * is guaranteed never to be 0, so a module can initialize it to 0 to + * indicate a "NULL handle." + */ +[assert_size(4)] +typedef int32_t PP_Module; + diff --git a/browser/extensions/mortar/ppapi/api/pp_point.idl b/browser/extensions/mortar/ppapi/api/pp_point.idl new file mode 100644 index 000000000000..7be466f0ef0d --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/pp_point.idl @@ -0,0 +1,74 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * This file defines the API to create a 2 dimensional point. + * 0,0 is the upper-left starting coordinate. + */ + +/** + * The PP_Point structure defines the integer x and y coordinates of a point. + */ +[assert_size(8), returnByValue] +struct PP_Point { + /** + * This value represents the horizontal coordinate of a point, starting with 0 + * as the left-most coordinate. + */ + int32_t x; + + /** + * This value represents the vertical coordinate of a point, starting with 0 + * as the top-most coordinate. + */ + int32_t y; +}; + +/** + * The PP_FloatPoint structure defines the floating-point x and y coordinates + * of a point. + */ +[assert_size(8), returnByValue] +struct PP_FloatPoint { + float_t x; + float_t y; +}; + +#inline c +/** + * @addtogroup Functions + * @{ + */ + +/** + * PP_MakePoint() creates a PP_Point given the x and y coordinates + * as int32_t values. + * + * @param[in] x An int32_t value representing a horizontal coordinate of a + * point, starting with 0 as the left-most coordinate. + * @param[in] y An int32_t value representing a vertical coordinate of a point, + * starting with 0 as the top-most coordinate. + * + * @return A PP_Point structure. + */ +PP_INLINE struct PP_Point PP_MakePoint(int32_t x, int32_t y) { + struct PP_Point ret; + ret.x = x; + ret.y = y; + return ret; +} + +PP_INLINE struct PP_FloatPoint PP_MakeFloatPoint(float x, float y) { + struct PP_FloatPoint ret; + ret.x = x; + ret.y = y; + return ret; +} +/** + * @} + */ + +#endinl + diff --git a/browser/extensions/mortar/ppapi/api/pp_rect.idl b/browser/extensions/mortar/ppapi/api/pp_rect.idl new file mode 100644 index 000000000000..b83e3cdb5a1a --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/pp_rect.idl @@ -0,0 +1,99 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * This file defines the APIs for creating a 2 dimensional rectangle. + */ + +/** + * The PP_Rect struct contains the size and location of a 2D + * rectangle. + */ +[assert_size(16)] +struct PP_Rect { + /** + * This value represents the x and y coordinates of the upper-left corner of + * the rectangle. + */ + PP_Point point; + + /** This value represents the width and height of the rectangle. */ + PP_Size size; +}; + +/** + * The PP_FloatRect struct contains the size and location of a 2D + * rectangle. + */ +struct PP_FloatRect { + /** + * This value represents the x and y coordinates of the upper-left corner of + * the rectangle. + */ + PP_FloatPoint point; + + /** This value represents the width and height of the rectangle. */ + PP_FloatSize size; +}; + +#inline c + +/** + * @addtogroup Functions + * @{ + */ + +/** + * PP_MakeRectFromXYWH() creates a PP_Rect given x and y + * coordinates and width and height dimensions as int32_t values. + * + * @param[in] x An int32_t value representing a horizontal coordinate of a + * point, starting with 0 as the left-most coordinate. + * @param[in] y An int32_t value representing a vertical coordinate of a point, + * starting with 0 as the top-most coordinate. + * @param[in] w An int32_t value representing a width. + * @param[in] h An int32_t value representing a height. + * + * @return A PP_Rect structure. + */ +PP_INLINE struct PP_Rect PP_MakeRectFromXYWH(int32_t x, int32_t y, + int32_t w, int32_t h) { + struct PP_Rect ret; + ret.point.x = x; + ret.point.y = y; + ret.size.width = w; + ret.size.height = h; + return ret; +} + +/** + * PP_MakeFloatRectFromXYWH() creates a PP_FloatRect given x and y + * coordinates and width and height dimensions as float values. + * + * @param[in] x An float value representing a horizontal coordinate of a + * point, starting with 0 as the left-most coordinate. + * @param[in] y An float value representing a vertical coordinate of a point, + * starting with 0 as the top-most coordinate. + * @param[in] w An float value representing a width. + * @param[in] h An float value representing a height. + * + * @return A PP_FloatRect structure. + */ +PP_INLINE struct PP_FloatRect PP_MakeFloatRectFromXYWH(float x, float y, + float w, float h) { + struct PP_FloatRect ret; + ret.point.x = x; + ret.point.y = y; + ret.size.width = w; + ret.size.height = h; + return ret; +} + +/** + * @} + */ + +#endinl + diff --git a/browser/extensions/mortar/ppapi/api/pp_resource.idl b/browser/extensions/mortar/ppapi/api/pp_resource.idl new file mode 100644 index 000000000000..7f09d29db99e --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/pp_resource.idl @@ -0,0 +1,27 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * This file defines the PP_Resource type which represents data + * associated with the module. + */ + +/** + * This typedef represents an opaque handle assigned by the browser to the + * resource. The handle is guaranteed never to be 0 for a valid resource, so a + * module can initialize it to 0 to indicate a "NULL handle." Some interfaces + * may return a NULL resource to indicate failure. + * + * While a Var represents something callable to JS or from the module to + * the DOM, a resource has no meaning or visibility outside of the module + * interface. + * + * Resources are reference counted. Use AddRefResource() + * and ReleaseResource() in ppb_core.h to manage the + * reference count of a resource. The data will be automatically destroyed when + * the internal reference count reaches 0. + */ +[assert_size(4)] typedef int32_t PP_Resource; + diff --git a/browser/extensions/mortar/ppapi/api/pp_size.idl b/browser/extensions/mortar/ppapi/api/pp_size.idl new file mode 100644 index 000000000000..e320fadee61c --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/pp_size.idl @@ -0,0 +1,72 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * This file defines the width and height of a 2D rectangle. + */ + +/** + * The PP_Size struct contains the size of a 2D rectangle. + */ +[assert_size(8)] +struct PP_Size { + /** This value represents the width of the rectangle. */ + int32_t width; + /** This value represents the height of the rectangle. */ + int32_t height; +}; + +/** + * The PP_FloatSize struct contains the size of a 2D rectangle. + */ +struct PP_FloatSize { + /** This value represents the width of the rectangle. */ + float_t width; + /** This value represents the height of the rectangle. */ + float_t height; +}; + +#inline c +/** + * @addtogroup Functions + * @{ + */ + +/** + * PP_MakeSize() creates a PP_Size given a width and height as + * int32_t values. + * + * @param[in] w An int32_t value representing a width. + * @param[in] h An int32_t value representing a height. + * + * @return A PP_Size structure. + */ +PP_INLINE struct PP_Size PP_MakeSize(int32_t w, int32_t h) { + struct PP_Size ret; + ret.width = w; + ret.height = h; + return ret; +} + +/** + * PP_MakeFloatSize() creates a PP_FloatSize given a + * width and height as float values. + * + * @param[in] w An float value representing a width. + * @param[in] h An float value representing a height. + * + * @return A PP_FloatSize structure. + */ +PP_INLINE struct PP_FloatSize PP_MakeFloatSize(float w, float h) { + struct PP_FloatSize ret; + ret.width = w; + ret.height = h; + return ret; +} +/** + * @} + */ +#endinl + diff --git a/browser/extensions/mortar/ppapi/api/pp_stdint.idl b/browser/extensions/mortar/ppapi/api/pp_stdint.idl new file mode 100644 index 000000000000..9f54d63bad31 --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/pp_stdint.idl @@ -0,0 +1,100 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * This file provides a definition of C99 sized types + * for Microsoft compilers. These definitions only apply + * for trusted modules. + */ + +label Chrome { + M13 = 0.0 +}; + +[version=0.0] +describe { + /** Standard Ints. */ + int8_t; + int16_t; + int32_t; + int64_t; + uint8_t; + uint16_t; + uint32_t; + uint64_t; + /** Small and large floats. */ + double_t; + float_t; + + /** Native file handle (int). */ + handle_t; + + /** Interface object (void *). */ + interface_t; + + /** Used for padding, should be (u)int8_t */ + char; + + /** Pointer to memory (void *). */ + mem_t; + + /** Pointer to pointer to memory (void **). */ + mem_ptr_t; + + /** Pointer to null terminated string (char *). */ + str_t; + + /** Pointer to constant null terminated string (const char *). */ + cstr_t; + + /** No return value. */ + void; + + /** Platform-specific file handle */ + PP_FileHandle; +}; + +#inline c + +/** + * + * @addtogroup Typedefs + * @{ + */ +#if defined(_MSC_VER) + +/** This value represents a guaranteed unsigned 8 bit integer. */ +typedef unsigned char uint8_t; + +/** This value represents a guaranteed signed 8 bit integer. */ +typedef signed char int8_t; + +/** This value represents a guaranteed unsigned 16 bit short. */ +typedef unsigned short uint16_t; + +/** This value represents a guaranteed signed 16 bit short. */ +typedef short int16_t; + +/** This value represents a guaranteed unsigned 32 bit integer. */ +typedef unsigned int uint32_t; + +/** This value represents a guaranteed signed 32 bit integer. */ +typedef int int32_t; + +/** This value represents a guaranteed signed 64 bit integer. */ +typedef __int64 int64_t; + +/** This value represents a guaranteed unsigned 64 bit integer. */ +typedef unsigned __int64 uint64_t; + +#else +#include +#endif +/** + * @} + */ + +#endinl + diff --git a/browser/extensions/mortar/ppapi/api/pp_time.idl b/browser/extensions/mortar/ppapi/api/pp_time.idl new file mode 100644 index 000000000000..fdcac59be40b --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/pp_time.idl @@ -0,0 +1,37 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * This file defines time, time ticks and time delta types. + */ + + +/** + * The PP_Time type represents the "wall clock time" according + * to the browser and is defined as the number of seconds since the Epoch + * (00:00:00 UTC, January 1, 1970). + */ +[assert_size(8)] +typedef double_t PP_Time; + +/** + * A PP_TimeTicks value represents time ticks which are measured + * in seconds and are used for indicating the time that certain messages were + * received. In contrast to PP_Time, PP_TimeTicks + * does not correspond to any actual wall clock time and will not change + * discontinuously if the user changes their computer clock. + * + * The units are in seconds, but are not measured relative to any particular + * epoch, so the most you can do is compare two values. + */ +[assert_size(8)] +typedef double_t PP_TimeTicks; + +/** + * A PP_TimeDelta value represents a duration of time which is + * measured in seconds. + */ +[assert_size(8)] +typedef double_t PP_TimeDelta; diff --git a/browser/extensions/mortar/ppapi/api/pp_touch_point.idl b/browser/extensions/mortar/ppapi/api/pp_touch_point.idl new file mode 100644 index 000000000000..42c08097df2f --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/pp_touch_point.idl @@ -0,0 +1,74 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + + +/** + * This file defines the API to create a touch point or position where fingers + * makes contact with touch screen device. + */ + +/** + * The PP_TouchPoint struct represents all information about a + * single touch point, such as position, id, rotation angle, and pressure. + */ +[assert_size(28), returnByValue] +struct PP_TouchPoint { + /** + * This value represents the identifier for this TouchPoint. The id + * corresponds to the order in which the points were pressed. For example, + * the first point to be pressed has an id of 0, the second has an id of 1, + * and so on. An id can be reused when a touch point is released. For + * example, if two fingers are down, with id 0 and 1, and finger 0 releases, + * the next finger to be pressed can be assigned to id 0. + */ + uint32_t id; + + /** + * This value represents the x and y pixel position of this TouchPoint + * relative to the upper-left of the module instance receiving the event. + */ + PP_FloatPoint position; + + /** + * This value represents the elliptical radii, in screen pixels, in the x + * and y direction of this TouchPoint. + */ + PP_FloatPoint radius; + + /** + * This value represents the angle of rotation in degrees of the elliptical + * model of this TouchPoint clockwise from "up." + */ + float_t rotation_angle; + + /** + * This value represents the pressure applied to this TouchPoint. This value + * is typically between 0 and 1, with 0 indicating no pressure and 1 + * indicating some maximum pressure. Scaling differs depending on the + * hardware and the value is not guaranteed to stay within that range. + */ + float_t pressure; +}; + +#inline c +/** + * @addtogroup Functions + * @{ + */ + +/** + * PP_MakeTouchPoint() creates a PP_TouchPoint. + * + * @return A PP_TouchPoint structure. + */ +PP_INLINE struct PP_TouchPoint PP_MakeTouchPoint(void) { + struct PP_TouchPoint result = { 0, {0, 0}, {0, 0}, 0, 0 }; + return result; +} +/** + * @} + */ + +#endinl diff --git a/browser/extensions/mortar/ppapi/api/pp_var.idl b/browser/extensions/mortar/ppapi/api/pp_var.idl new file mode 100644 index 000000000000..545585d14ea8 --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/pp_var.idl @@ -0,0 +1,254 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * This file defines the API for handling the passing of data types between + * your module and the page. + */ + +/** + * The PP_VarType is an enumeration of the different types that + * can be contained within a PP_Var structure. + */ +[assert_size(4)] +enum PP_VarType { + /** + * An undefined value. + */ + PP_VARTYPE_UNDEFINED = 0, + + /** + * A NULL value. This is similar to undefined, but JavaScript differentiates + * the two so it is exposed here as well. + */ + PP_VARTYPE_NULL = 1, + + /** + * A boolean value, use the as_bool member of the var. + */ + PP_VARTYPE_BOOL = 2, + + /** + * A 32-bit integer value. Use the as_int member of the var. + */ + PP_VARTYPE_INT32 = 3, + + /** + * A double-precision floating point value. Use the as_double + * member of the var. + */ + PP_VARTYPE_DOUBLE = 4, + + /** + * The Var represents a string. The as_id field is used to + * identify the string, which may be created and retrieved from the + * PPB_Var interface. These objects are reference counted, so + * AddRef() and Release() must be used properly to avoid memory leaks. + */ + PP_VARTYPE_STRING = 5, + + /** + * Represents a JavaScript object. This vartype is not currently usable + * from modules, although it is used internally for some tasks. These objects + * are reference counted, so AddRef() and Release() must be used properly to + * avoid memory leaks. + */ + PP_VARTYPE_OBJECT = 6, + + /** + * Represents an array of Vars. The as_id field is used to + * identify the array, which may be created and manipulated from the + * PPB_VarArray interface. These objects are reference counted, + * so AddRef() and Release() must be used properly to avoid memory leaks. + */ + PP_VARTYPE_ARRAY = 7, + + /** + * Represents a mapping from strings to Vars. The as_id field is + * used to identify the dictionary, which may be created and manipulated from + * the PPB_VarDictionary interface. These objects are reference + * counted, so AddRef() and Release() must be used properly to avoid memory + * leaks. + */ + PP_VARTYPE_DICTIONARY = 8, + + /** + * ArrayBuffer represents a JavaScript ArrayBuffer. This is the type which + * represents Typed Arrays in JavaScript. Unlike JavaScript 'Array', it is + * only meant to contain basic numeric types, and is always stored + * contiguously. See PPB_VarArrayBuffer_Dev for functions special to + * ArrayBuffer vars. These objects are reference counted, so AddRef() and + * Release() must be used properly to avoid memory leaks. + */ + PP_VARTYPE_ARRAY_BUFFER = 9, + + /** + * This type allows the PP_Var to wrap a PP_Resource + * . This can be useful for sending or receiving some types of + * PP_Resource using PPB_Messaging or + * PPP_Messaging. + * + * These objects are reference counted, so AddRef() and Release() must be used + * properly to avoid memory leaks. Under normal circumstances, the + * PP_Var will implicitly hold a reference count on the + * PP_Resource on your behalf. For example, if you call + * VarFromResource(), it implicitly calls PPB_Core::AddRefResource() on the + * PP_Resource. Likewise, PPB_Var::Release() on a Resource + * PP_Var will invoke PPB_Core::ReleaseResource() when the Var + * reference count goes to zero. + */ + PP_VARTYPE_RESOURCE = 10 +}; + + +/** + * The PP_VarValue union stores the data for any one of the types listed + * in the PP_VarType enum. + */ +[union] struct PP_VarValue { + /** + * If type is PP_VARTYPE_BOOL, + * as_bool represents the value of this PP_Var as + * PP_Bool. + */ + PP_Bool as_bool; + + /** + * If type is PP_VARTYPE_INT32, + * as_int represents the value of this PP_Var as + * int32_t. + */ + int32_t as_int; + + /** + * If type is PP_VARTYPE_DOUBLE, + * as_double represents the value of this PP_Var + * as double. + */ + double_t as_double; + + /** + * If type is PP_VARTYPE_STRING, + * PP_VARTYPE_OBJECT, PP_VARTYPE_ARRAY, + * PP_VARTYPE_DICTIONARY, PP_VARTYPE_ARRAY_BUFFER, + * or PP_VARTYPE_RESOURCE, as_id represents the + * value of this PP_Var as an opaque handle assigned by the + * browser. This handle is guaranteed never to be 0, so a module can + * initialize this ID to 0 to indicate a "NULL handle." + */ + int64_t as_id; +}; + +/** + * The PP_VAR struct is a variant data type and can contain any + * value of one of the types named in the PP_VarType enum. This + * structure is for passing data between native code which can be strongly + * typed and the browser (JavaScript) which isn't strongly typed. + * + * JavaScript has a "number" type for holding a number, and does not + * differentiate between floating point and integer numbers. The + * JavaScript operations will try to optimize operations by using + * integers when possible, but could end up with doubles. Therefore, + * you can't assume a numeric PP_Var will be the type you expect. + * Your code should be capable of handling either int32_t or double for numeric + * PP_Vars sent from JavaScript. + */ +[passByValue, returnByValue, assert_size(16)] +struct PP_Var { + PP_VarType type; + + /** + * The padding ensures value is aligned on an + * 8-byte boundary relative to the start of the struct. Some compilers + * align doubles on 8-byte boundaries for 32-bit x86, and some align on + * 4-byte boundaries. + */ + int32_t padding; + + /** + * This value represents the contents of the PP_Var. Only one of + * the fields of value is valid at a time based upon + * type. + */ + PP_VarValue value; +}; + + +#inline c +/** + * @addtogroup Functions + * @{ + */ + +/** + * PP_MakeUndefined() is used to wrap an undefined value into a + * PP_Var struct for passing to the browser. + * + * @return A PP_Var structure. + */ +PP_INLINE struct PP_Var PP_MakeUndefined(void) { + struct PP_Var result = { PP_VARTYPE_UNDEFINED, 0, {PP_FALSE} }; + return result; +} + +/** + * PP_MakeNull() is used to wrap a null value into a + * PP_Var struct for passing to the browser. + * + * @return A PP_Var structure, + */ +PP_INLINE struct PP_Var PP_MakeNull(void) { + struct PP_Var result = { PP_VARTYPE_NULL, 0, {PP_FALSE} }; + return result; +} + +/** + * PP_MakeBool() is used to wrap a boolean value into a + * PP_Var struct for passing to the browser. + * + * @param[in] value A PP_Bool enumeration to + * wrap. + * + * @return A PP_Var structure. + */ +PP_INLINE struct PP_Var PP_MakeBool(PP_Bool value) { + struct PP_Var result = { PP_VARTYPE_BOOL, 0, {PP_FALSE} }; + result.value.as_bool = value; + return result; +} + +/** + * PP_MakeInt32() is used to wrap a 32 bit integer value + * into a PP_Var struct for passing to the browser. + * + * @param[in] value An int32 to wrap. + * + * @return A PP_Var structure. + */ +PP_INLINE struct PP_Var PP_MakeInt32(int32_t value) { + struct PP_Var result = { PP_VARTYPE_INT32, 0, {PP_FALSE} }; + result.value.as_int = value; + return result; +} + +/** + * PP_MakeDouble() is used to wrap a double value into a + * PP_Var struct for passing to the browser. + * + * @param[in] value A double to wrap. + * + * @return A PP_Var structure. + */ +PP_INLINE struct PP_Var PP_MakeDouble(double value) { + struct PP_Var result = { PP_VARTYPE_DOUBLE, 0, {PP_FALSE} }; + result.value.as_double = value; + return result; +} +/** + * @} + */ + +#endinl + diff --git a/browser/extensions/mortar/ppapi/api/ppb.idl b/browser/extensions/mortar/ppapi/api/ppb.idl new file mode 100644 index 000000000000..76d80b31900b --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/ppb.idl @@ -0,0 +1,29 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * This file defines a function pointer type for the + * PPB_GetInterface function. + */ + +/** + * This function pointer type defines the signature for the + * PPB_GetInterface function. A generic + * PPB_GetInterface pointer is passed to + * PPP_InitializedModule when your module is loaded. You can use + * this pointer to request a pointer to a specific browser interface. Browser + * interface names are ASCII strings and are generally defined in the header + * file for the interface, such as PPB_AUDIO_INTERFACE found in + * ppb.audio.h or + * PPB_GRAPHICS_2D_INTERFACE in ppb_graphics_2d.h. + * Click + * here for a complete list of interface + * names. + * + * This value will be NULL if the interface is not supported on the browser. + */ +typedef interface_t PPB_GetInterface([in] str_t interface_name); + diff --git a/browser/extensions/mortar/ppapi/api/ppb_audio.idl b/browser/extensions/mortar/ppapi/api/ppb_audio.idl new file mode 100644 index 000000000000..d79ca97739ef --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/ppb_audio.idl @@ -0,0 +1,153 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * This file defines the PPB_Audio interface, which provides + * realtime stereo audio streaming capabilities. + */ + +label Chrome { + M14 = 1.0, + M31 = 1.1 +}; + +/** + * PPB_Audio_Callback defines the type of an audio callback + * function used to fill the audio buffer with data. Please see the + * Create() function in the PPB_Audio interface for + * more details on this callback. + * + * @param[in] sample_buffer A buffer to fill with audio data. + * @param[in] buffer_size_in_bytes The size of the buffer in bytes. + * @param[in] latency How long before the audio data is to be presented. + * @param[inout] user_data An opaque pointer that was passed into + * PPB_Audio.Create(). + */ +typedef void PPB_Audio_Callback([out] mem_t sample_buffer, + [in] uint32_t buffer_size_in_bytes, + [in, version=1.1] PP_TimeDelta latency, + [inout] mem_t user_data); + +/** + * The PPB_Audio interface contains pointers to several functions + * for handling audio resources. Refer to the + * Audio + * chapter in the Developer's Guide for information on using this interface. + * Please see descriptions for each PPB_Audio and + * PPB_AudioConfig function for more details. A C example using + * PPB_Audio and PPB_AudioConfig follows. + * + * Example: + * + * @code + * void audio_callback(void* sample_buffer, + * uint32_t buffer_size_in_bytes, + * void* user_data) { + * ... quickly fill in the buffer with samples and return to caller ... + * } + * + * ...Assume the application has cached the audio configuration interface in + * audio_config_interface and the audio interface in + * audio_interface... + * + * uint32_t count = audio_config_interface->RecommendSampleFrameCount( + * PP_AUDIOSAMPLERATE_44100, 4096); + * PP_Resource pp_audio_config = audio_config_interface->CreateStereo16Bit( + * pp_instance, PP_AUDIOSAMPLERATE_44100, count); + * PP_Resource pp_audio = audio_interface->Create(pp_instance, pp_audio_config, + * audio_callback, NULL); + * audio_interface->StartPlayback(pp_audio); + * + * ...audio_callback() will now be periodically invoked on a separate thread... + * @endcode + */ +interface PPB_Audio { + /** + * Create() creates an audio resource. No sound will be heard until + * StartPlayback() is called. The callback is called with the buffer address + * and given user data whenever the buffer needs to be filled. From within the + * callback, you should not call PPB_Audio functions. The + * callback will be called on a different thread than the one which created + * the interface. For performance-critical applications (i.e. low-latency + * audio), the callback should avoid blocking or calling functions that can + * obtain locks, such as malloc. The layout and the size of the buffer passed + * to the audio callback will be determined by the device configuration and is + * specified in the AudioConfig documentation. + * + * @param[in] instance A PP_Instance identifying one instance + * of a module. + * @param[in] config A PP_Resource corresponding to an audio + * config resource. + * @param[in] audio_callback A PPB_Audio_Callback callback + * function that the browser calls when it needs more samples to play. + * @param[in] user_data A pointer to user data used in the callback function. + * + * @return A PP_Resource containing the audio resource if + * successful or 0 if the configuration cannot be honored or the callback is + * null. + */ + PP_Resource Create( + [in] PP_Instance instance, + [in] PP_Resource config, + [in] PPB_Audio_Callback audio_callback, + [inout] mem_t user_data); + + /** + * IsAudio() determines if the provided resource is an audio resource. + * + * @param[in] resource A PP_Resource corresponding to a generic + * resource. + * + * @return A PP_Bool containing containing PP_TRUE + * if the given resource is an Audio resource, otherwise + * PP_FALSE. + */ + PP_Bool IsAudio( + [in] PP_Resource resource); + + /** + * GetCurrrentConfig() returns an audio config resource for the given audio + * resource. + * + * @param[in] config A PP_Resource corresponding to an audio + * resource. + * + * @return A PP_Resource containing the audio config resource if + * successful. + */ + PP_Resource GetCurrentConfig( + [in] PP_Resource audio); + + /** + * StartPlayback() starts the playback of the audio resource and begins + * periodically calling the callback. + * + * @param[in] config A PP_Resource corresponding to an audio + * resource. + * + * @return A PP_Bool containing PP_TRUE if + * successful, otherwise PP_FALSE. Also returns + * PP_TRUE (and be a no-op) if called while playback is already + * in progress. + */ + PP_Bool StartPlayback( + [in] PP_Resource audio); + + /** + * StopPlayback() stops the playback of the audio resource. + * + * @param[in] config A PP_Resource corresponding to an audio + * resource. + * + * @return A PP_Bool containing PP_TRUE if + * successful, otherwise PP_FALSE. Also returns + * PP_TRUE (and is a no-op) if called while playback is already + * stopped. If a callback is in progress, StopPlayback() will block until the + * callback completes. + */ + PP_Bool StopPlayback( + [in] PP_Resource audio); +}; + diff --git a/browser/extensions/mortar/ppapi/api/ppb_audio_buffer.idl b/browser/extensions/mortar/ppapi/api/ppb_audio_buffer.idl new file mode 100644 index 000000000000..8640f00dd1f0 --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/ppb_audio_buffer.idl @@ -0,0 +1,140 @@ +/* Copyright 2014 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * Defines the PPB_AudioBuffer interface. + */ + +[generate_thunk] + +label Chrome { + [channel=dev] M34 = 0.1, + M35 = 0.1 +}; + +/** + * PP_AudioBuffer_SampleRate is an enumeration of the different audio sample + * rates. + */ +enum PP_AudioBuffer_SampleRate { + PP_AUDIOBUFFER_SAMPLERATE_UNKNOWN = 0, + PP_AUDIOBUFFER_SAMPLERATE_8000 = 8000, + PP_AUDIOBUFFER_SAMPLERATE_16000 = 16000, + PP_AUDIOBUFFER_SAMPLERATE_22050 = 22050, + PP_AUDIOBUFFER_SAMPLERATE_32000 = 32000, + PP_AUDIOBUFFER_SAMPLERATE_44100 = 44100, + PP_AUDIOBUFFER_SAMPLERATE_48000 = 48000, + PP_AUDIOBUFFER_SAMPLERATE_96000 = 96000, + PP_AUDIOBUFFER_SAMPLERATE_192000 = 192000 +}; + +/** + * PP_AudioBuffer_SampleSize is an enumeration of the different audio sample + * sizes. + */ +enum PP_AudioBuffer_SampleSize { + PP_AUDIOBUFFER_SAMPLESIZE_UNKNOWN = 0, + PP_AUDIOBUFFER_SAMPLESIZE_16_BITS = 2 +}; + +[version=0.1] +interface PPB_AudioBuffer { + /** + * Determines if a resource is an AudioBuffer resource. + * + * @param[in] resource The PP_Resource to test. + * + * @return A PP_Bool with PP_TRUE if the given + * resource is an AudioBuffer resource or PP_FALSE otherwise. + */ + PP_Bool IsAudioBuffer([in] PP_Resource resource); + + /** + * Gets the timestamp of the audio buffer. + * + * @param[in] buffer A PP_Resource corresponding to an audio + * buffer resource. + * + * @return A PP_TimeDelta containing the timestamp of the audio + * buffer. Given in seconds since the start of the containing audio stream. + */ + [on_failure=0.0] + PP_TimeDelta GetTimestamp([in] PP_Resource buffer); + + /** + * Sets the timestamp of the audio buffer. + * + * @param[in] buffer A PP_Resource corresponding to an audio + * buffer resource. + * @param[in] timestamp A PP_TimeDelta containing the timestamp + * of the audio buffer. Given in seconds since the start of the containing + * audio stream. + */ + void SetTimestamp([in] PP_Resource buffer, [in] PP_TimeDelta timestamp); + + /** + * Gets the sample rate of the audio buffer. + * + * @param[in] buffer A PP_Resource corresponding to an audio + * buffer resource. + * + * @return The sample rate of the audio buffer. + */ + [on_failure=PP_AUDIOBUFFER_SAMPLERATE_UNKNOWN] + PP_AudioBuffer_SampleRate GetSampleRate([in] PP_Resource buffer); + + /** + * Gets the sample size of the audio buffer. + * + * @param[in] buffer A PP_Resource corresponding to an audio + * buffer resource. + * + * @return The sample size of the audio buffer. + */ + [on_failure=PP_AUDIOBUFFER_SAMPLESIZE_UNKNOWN] + PP_AudioBuffer_SampleSize GetSampleSize([in] PP_Resource buffer); + + /** + * Gets the number of channels in the audio buffer. + * + * @param[in] buffer A PP_Resource corresponding to an audio + * buffer resource. + * + * @return The number of channels in the audio buffer. + */ + uint32_t GetNumberOfChannels([in] PP_Resource buffer); + + /** + * Gets the number of samples in the audio buffer. + * + * @param[in] buffer A PP_Resource corresponding to an audio + * buffer resource. + * + * @return The number of samples in the audio buffer. + * For example, at a sampling rate of 44,100 Hz in stereo audio, a buffer + * containing 4410 * 2 samples would have a duration of 100 milliseconds. + */ + uint32_t GetNumberOfSamples([in] PP_Resource buffer); + + /** + * Gets the data buffer containing the audio samples. + * + * @param[in] buffer A PP_Resource corresponding to an audio + * buffer resource. + * + * @return A pointer to the beginning of the data buffer. + */ + mem_t GetDataBuffer([in] PP_Resource buffer); + + /** + * Gets the size of the data buffer in bytes. + * + * @param[in] buffer A PP_Resource corresponding to an audio + * buffer resource. + * + * @return The size of the data buffer in bytes. + */ + uint32_t GetDataBufferSize([in] PP_Resource buffer); +}; diff --git a/browser/extensions/mortar/ppapi/api/ppb_audio_config.idl b/browser/extensions/mortar/ppapi/api/ppb_audio_config.idl new file mode 100644 index 000000000000..fd4cef4fe05a --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/ppb_audio_config.idl @@ -0,0 +1,216 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * This file defines the PPB_AudioConfig interface for establishing an + * audio configuration resource within the browser. + */ + +label Chrome { + M14 = 1.0, + M19 = 1.1 +}; + +/** + * This enumeration contains audio frame count constants. + * PP_AUDIOMINSAMPLEFRAMECOUNT is the minimum possible frame + * count. PP_AUDIOMAXSAMPLEFRAMECOUNT is the maximum possible + * frame count. + */ +[unnamed] enum PP_AudioFrameSize { + PP_AUDIOMINSAMPLEFRAMECOUNT = 64, + PP_AUDIOMAXSAMPLEFRAMECOUNT = 32768 +}; + + +/** + * PP_AudioSampleRate is an enumeration of the different audio sampling rates. + * PP_AUDIOSAMPLERATE_44100 is the sample rate used on CDs and + * PP_AUDIOSAMPLERATE_48000 is the sample rate used on DVDs and + * Digital Audio Tapes. + */ +[assert_size(4)] +enum PP_AudioSampleRate { + PP_AUDIOSAMPLERATE_NONE = 0, + PP_AUDIOSAMPLERATE_44100 = 44100, + PP_AUDIOSAMPLERATE_48000 = 48000 +} ; + + +/** + * The PPB_AudioConfig interface contains pointers to several + * functions for establishing your audio configuration within the browser. + * This interface only supports 16-bit stereo output. + * + * Refer to the + * Audio + * chapter in the Developer's Guide for information on using this + * interface. + */ +[macro="PPB_AUDIO_CONFIG_INTERFACE"] +interface PPB_AudioConfig { + /** + * CreateStereo16bit() creates a 16 bit audio configuration resource. The + * sample_rate should be the result of calling + * RecommendSampleRate and sample_frame_count should + * be the result of calling RecommendSampleFrameCount. If the + * sample frame count or bit rate isn't supported, this function will fail and + * return a null resource. + * + * A single sample frame on a stereo device means one value for the left + * channel and one value for the right channel. + * + * Buffer layout for a stereo int16 configuration: + * int16_t *buffer16; + * buffer16[0] is the first left channel sample. + * buffer16[1] is the first right channel sample. + * buffer16[2] is the second left channel sample. + * buffer16[3] is the second right channel sample. + * ... + * buffer16[2 * (sample_frame_count - 1)] is the last left + * channel sample. + * buffer16[2 * (sample_frame_count - 1) + 1] is the last + * right channel sample. + * Data will always be in the native endian format of the platform. + * + * @param[in] instance A PP_Instance identifying one instance + * of a module. + * @param[in] sample_rate A PP_AudioSampleRate which is either + * PP_AUDIOSAMPLERATE_44100 or + * PP_AUDIOSAMPLERATE_48000. + * @param[in] sample_frame_count A uint32_t frame count returned + * from the RecommendSampleFrameCount function. + * + * @return A PP_Resource containing the + * PPB_Audio_Config if successful or a null resource if the + * sample frame count or bit rate are not supported. + */ + PP_Resource CreateStereo16Bit( + [in] PP_Instance instance, + [in] PP_AudioSampleRate sample_rate, + [in] uint32_t sample_frame_count); + + /** + * This comment block applies to version 1.0, which is deprecated in favor of + * the same function but with slightly different signature and behavior. + * + * RecommendSampleFrameCount() returns the supported sample frame count + * closest to the requested count. The sample frame count determines the + * overall latency of audio. Since one "frame" is always buffered in advance, + * smaller frame counts will yield lower latency, but higher CPU utilization. + * For best audio performance, use the value returned by RecommendSampleRate + * as the input sample rate, then use the RecommendSampleFrameCount return + * value when creating the audio configuration resource. + * + * Sample counts less than + * PP_AUDIOMINSAMPLEFRAMECOUNT and greater than + * PP_AUDIOMAXSAMPLEFRAMECOUNT are never supported on any + * system, but values in between aren't necessarily glitch-free. + * + * @param[in] sample_rate A PP_AudioSampleRate which is either + * PP_AUDIOSAMPLERATE_44100 or + * PP_AUDIOSAMPLERATE_48000. + * @param[in] requested_sample_frame_count A uint_32t requested + * frame count. + * + * @return A uint32_t containing the recommended sample frame + * count if successful. + */ + [deprecate=1.1] + uint32_t RecommendSampleFrameCount( + [in] PP_AudioSampleRate sample_rate, + [in] uint32_t requested_sample_frame_count); + + /** + * RecommendSampleFrameCount() returns the supported sample frame count + * closest to the requested count. The sample frame count determines the + * overall latency of audio. Since one "frame" is always buffered in advance, + * smaller frame counts will yield lower latency, but higher CPU utilization. + * + * Supported sample frame counts will vary by hardware and system (consider + * that the local system might be anywhere from a cell phone or a high-end + * audio workstation). Sample counts less than + * PP_AUDIOMINSAMPLEFRAMECOUNT and greater than + * PP_AUDIOMAXSAMPLEFRAMECOUNT are never supported on any + * system, but values in between aren't necessarily valid. This function + * will return a supported count closest to the requested frame count. + * + * RecommendSampleFrameCount() result is intended for audio output devices. + * + * @param[in] instance + * @param[in] sample_rate A PP_AudioSampleRate which is either + * PP_AUDIOSAMPLERATE_44100 or + * PP_AUDIOSAMPLERATE_48000. + * @param[in] requested_sample_frame_count A uint_32t requested + * frame count. + * + * @return A uint32_t containing the recommended sample frame + * count if successful. + */ + [version=1.1] + uint32_t RecommendSampleFrameCount( + [in] PP_Instance instance, + [in] PP_AudioSampleRate sample_rate, + [in] uint32_t requested_sample_frame_count); + + /** + * IsAudioConfig() determines if the given resource is a + * PPB_Audio_Config. + * + * @param[in] resource A PP_Resource corresponding to an audio + * config resource. + * + * @return A PP_Bool containing PP_TRUE if the given + * resource is an AudioConfig resource, otherwise + * PP_FALSE. + */ + PP_Bool IsAudioConfig( + [in] PP_Resource resource); + + /** + * GetSampleRate() returns the sample rate for the given + * PPB_Audio_Config. + * + * @param[in] config A PP_Resource corresponding to a + * PPB_Audio_Config. + * + * @return A PP_AudioSampleRate containing sample rate or + * PP_AUDIOSAMPLERATE_NONE if the resource is invalid. + */ + PP_AudioSampleRate GetSampleRate( + [in] PP_Resource config); + + /** + * GetSampleFrameCount() returns the sample frame count for the given + * PPB_Audio_Config. + * + * @param[in] config A PP_Resource corresponding to an audio + * config resource. + * + * @return A uint32_t containing sample frame count or + * 0 if the resource is invalid. Refer to + * RecommendSampleFrameCount() for more on sample frame counts. + */ + uint32_t GetSampleFrameCount( + [in] PP_Resource config); + + /** + * RecommendSampleRate() returns the native sample rate that the browser + * is using in the backend. Applications that use the recommended sample + * rate will have potentially better latency and fidelity. The return value + * is intended for audio output devices. If the output sample rate cannot be + * determined, this function can return PP_AUDIOSAMPLERATE_NONE. + * + * @param[in] instance + * + * @return A uint32_t containing the recommended sample frame + * count if successful. + */ + [version=1.1] + PP_AudioSampleRate RecommendSampleRate( + [in] PP_Instance instance); + +}; + diff --git a/browser/extensions/mortar/ppapi/api/ppb_audio_encoder.idl b/browser/extensions/mortar/ppapi/api/ppb_audio_encoder.idl new file mode 100644 index 000000000000..0a8029fcd386 --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/ppb_audio_encoder.idl @@ -0,0 +1,209 @@ +/* Copyright 2015 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * This file defines the PPB_AudioEncoder interface. + */ + +[generate_thunk] + +label Chrome { + [channel=dev] M47 = 0.1 +}; + +/** + * Audio encoder interface. + * + * Typical usage: + * - Call Create() to create a new audio encoder resource. + * - Call GetSupportedProfiles() to determine which codecs and profiles are + * available. + * - Call Initialize() to initialize the encoder for a supported profile. + * - Call GetBuffer() to get an empty buffer and fill it in, or get an audio + * buffer from another resource, e.g. PPB_MediaStreamAudioTrack. + * - Call Encode() to push the audio buffer to the encoder. If an external + * buffer is pushed, wait for completion to recycle the buffer. + * - Call GetBitstreamBuffer() continuously (waiting for each previous call to + * complete) to pull encoded buffers from the encoder. + * - Call RecycleBitstreamBuffer() after consuming the data in the bitstream + * buffer. + * - To destroy the encoder, the plugin should release all of its references to + * it. Any pending callbacks will abort before the encoder is destroyed. + * + * Available audio codecs vary by platform. + * All: opus. + */ +interface PPB_AudioEncoder { + /** + * Creates a new audio encoder resource. + * + * @param[in] instance A PP_Instance identifying the instance + * with the audio encoder. + * + * @return A PP_Resource corresponding to an audio encoder if + * successful or 0 otherwise. + */ + PP_Resource Create([in] PP_Instance instance); + + /** + * Determines if the given resource is an audio encoder. + * + * @param[in] resource A PP_Resource identifying a resource. + * + * @return PP_TRUE if the resource is a + * PPB_AudioEncoder, PP_FALSE if the resource is + * invalid or some other type. + */ + PP_Bool IsAudioEncoder([in] PP_Resource resource); + + /** + * Gets an array of supported audio encoder profiles. + * These can be used to choose a profile before calling Initialize(). + * + * @param[in] audio_encoder A PP_Resource identifying the audio + * encoder. + * @param[in] output A PP_ArrayOutput to receive the supported + * PP_AudioProfileDescription structs. + * @param[in] callback A PP_CompletionCallback to be called upon + * completion. + * + * @return If >= 0, the number of supported profiles returned, otherwise an + * error code from pp_errors.h. + */ + int32_t GetSupportedProfiles([in] PP_Resource audio_encoder, + [in] PP_ArrayOutput output, + [in] PP_CompletionCallback callback); + + /** + * Initializes an audio encoder resource. The plugin should call Initialize() + * successfully before calling any of the functions below. + * + * @param[in] audio_encoder A PP_Resource identifying the audio + * encoder. + * @param[in] channels The number of audio channels to encode. + * @param[in] input_sampling_rate The sampling rate of the input audio buffer. + * @param[in] input_sample_size The sample size of the input audio buffer. + * @param[in] output_profile A PP_AudioProfile specifying the + * codec profile of the encoded output stream. + * @param[in] initial_bitrate The initial bitrate for the encoder. + * @param[in] acceleration A PP_HardwareAcceleration specifying + * whether to use a hardware accelerated or a software implementation. + * @param[in] callback A PP_CompletionCallback to be called upon + * completion. + * + * @return An int32_t containing an error code from pp_errors.h. + * Returns PP_ERROR_NOTSUPPORTED if audio encoding is not available, or the + * requested codec profile is not supported. + */ + int32_t Initialize([in] PP_Resource audio_encoder, + [in] uint32_t channels, + [in] PP_AudioBuffer_SampleRate input_sample_rate, + [in] PP_AudioBuffer_SampleSize input_sample_size, + [in] PP_AudioProfile output_profile, + [in] uint32_t initial_bitrate, + [in] PP_HardwareAcceleration acceleration, + [in] PP_CompletionCallback callback); + + /** + * Gets the number of audio samples per channel that audio buffers must + * contain in order to be processed by the encoder. This will be the number of + * samples per channels contained in buffers returned by GetBuffer(). + * + * @param[in] audio_encoder A PP_Resource identifying the audio + * encoder. + * @return An int32_t containing the number of samples required, or an error + * code from pp_errors.h. + * Returns PP_ERROR_FAILED if Initialize() has not successfully completed. + */ + int32_t GetNumberOfSamples([in] PP_Resource audio_encoder); + + /** + * Gets a blank audio buffer (with metadata given by the Initialize() + * call) which can be filled with audio data and passed to the encoder. + * + * @param[in] audio_encoder A PP_Resource identifying the audio + * encoder. + * @param[out] audio_buffer A blank PPB_AudioBuffer resource. + * @param[in] callback A PP_CompletionCallback to be called upon + * completion. + * + * @return An int32_t containing an error code from pp_errors.h. + * Returns PP_ERROR_FAILED if Initialize() has not successfully completed. + */ + int32_t GetBuffer([in] PP_Resource audio_encoder, + [out] PP_Resource audio_buffer, + [in] PP_CompletionCallback callback); + + /** + * Encodes an audio buffer. + * + * @param[in] audio_encoder A PP_Resource identifying the audio + * encoder. + * @param[in] audio_buffer The PPB_AudioBuffer to be encoded. + * @param[in] callback A PP_CompletionCallback to be called upon + * completion. Plugins that pass PPB_AudioBuffer resources owned + * by other resources should wait for completion before reusing them. + * + * @return An int32_t containing an error code from pp_errors.h. + * Returns PP_ERROR_FAILED if Initialize() has not successfully completed. + */ + int32_t Encode([in] PP_Resource audio_encoder, + [in] PP_Resource audio_buffer, + [in] PP_CompletionCallback callback); + + /** + * Gets the next encoded bitstream buffer from the encoder. + * + * @param[in] audio_encoder A PP_Resource identifying the audio + * encoder. + * @param[out] bitstream_buffer A PP_BitstreamBuffer containing + * encoded audio data. + * @param[in] callback A PP_CompletionCallback to be called upon + * completion. The plugin can call GetBitstreamBuffer from the callback in + * order to continuously "pull" bitstream buffers from the encoder. + * + * @return An int32_t containing an error code from pp_errors.h. + * Returns PP_ERROR_FAILED if Initialize() has not successfully completed. + * Returns PP_ERROR_INPROGRESS if a prior call to GetBitstreamBuffer() has + * not completed. + */ + int32_t GetBitstreamBuffer([in] PP_Resource audio_encoder, + [out] PP_AudioBitstreamBuffer bitstream_buffer, + [in] PP_CompletionCallback callback); + + /** + * Recycles a bitstream buffer back to the encoder. + * + * @param[in] audio_encoder A PP_Resource identifying the audio + * encoder. + * @param[in] bitstream_buffer A PP_BitstreamBuffer that is no + * longer needed by the plugin. + */ + void RecycleBitstreamBuffer([in] PP_Resource audio_encoder, + [in] PP_AudioBitstreamBuffer bitstream_buffer); + + /** + * Requests a change to the encoding bitrate. This is only a request, + * fulfilled on a best-effort basis. + * + * @param[in] audio_encoder A PP_Resource identifying the audio + * encoder. + * @param[in] bitrate The requested new bitrate, in bits per second. + */ + void RequestBitrateChange([in] PP_Resource audio_encoder, + [in] uint32_t bitrate); + + /** + * Closes the audio encoder, and cancels any pending encodes. Any pending + * callbacks will still run, reporting PP_ERROR_ABORTED . It is + * not valid to call any encoder functions after a call to this method. + * Note: Destroying the audio encoder closes it implicitly, + * so you are not required to call Close(). + * + * @param[in] audio_encoder A PP_Resource identifying the audio + * encoder. + */ + void Close([in] PP_Resource audio_encoder); +}; diff --git a/browser/extensions/mortar/ppapi/api/ppb_compositor.idl b/browser/extensions/mortar/ppapi/api/ppb_compositor.idl new file mode 100644 index 000000000000..d9b4e64bd346 --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/ppb_compositor.idl @@ -0,0 +1,131 @@ +/* Copyright 2014 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +[generate_thunk] + +label Chrome { + [channel=dev] M37 = 0.1 +}; + +/** + * Defines the PPB_Compositor interface. Used for setting + * PPB_CompositorLayer layers to the Chromium compositor for + * compositing. This allows a plugin to combine different sources of visual + * data efficiently, such as PPB_ImageData images and + * OpenGL textures. See also PPB_CompositorLayer for more + * information. + * This interface is still in development (Dev API status) and may change, + * so is only supported on Dev channel and Canary currently. + * + * Example usage from plugin code: + * + * Setup: + * @code + * PP_Resource compositor; + * compositor = compositor_if->Create(instance); + * instance_if->BindGraphics(instance, compositor); + * @endcode + * + * Setup layer stack: + * @code + * PP_Resource color_layer = compositor_if->AddLayer(compositor); + * PP_Resource texture_layer = compositor_if->AddLayer(compositor); + * @endcode + * + * Present one frame: + * layer_if->SetColor(color_layer, 255, 255, 0, 255, PP_MakeSize(400, 400)); + * PP_CompletionCallback release_callback = { + * TextureReleasedCallback, 0, PP_COMPLETIONCALLBACK_FLAG_NONE, + * }; + * layer_if->SetTexture(texture_layer, graphics3d, texture_id, + * PP_MakeSize(300, 300), release_callback); + * + * PP_CompletionCallback callback = { + * DidFinishCommitLayersCallback, + * (void*) texture_id, + * PP_COMPLETIONCALLBACK_FLAG_NONE, + * }; + * compositor_if->CommitLayers(compositor, callback); + * @endcode + * + * release callback + * void ReleaseCallback(int32_t result, void* user_data) { + * if (result == PP_OK) { + * uint32_t texture_id = (uint32_t) user_data; + * // reuse the texture or delete it. + * } + * } + * + * Shutdown: + * @code + * core->ReleaseResource(color_layer); + * core->ReleaseResource(texture_layer); + * core->ReleaseResource(compositor); + * @endcode + */ + +interface PPB_Compositor { + /** + * Determines if a resource is a compositor resource. + * + * @param[in] resource The PP_Resource to test. + * + * @return A PP_Bool with PP_TRUE if the given + * resource is a compositor resource or PP_FALSE otherwise. + */ + PP_Bool IsCompositor([in] PP_Resource resource); + + /** + * Creates a Compositor resource. + * + * @param[in] instance A PP_Instance identifying one instance + * of a module. + * + * @return A PP_Resource containing the compositor resource if + * successful or 0 otherwise. + */ + PP_Resource Create([in] PP_Instance instance); + + /** + * Creates a new PPB_CompositorLayer and adds it to the end + * of the layer stack. A PP_Resource containing the layer is + * returned. It is uninitialized, SetColor(), + * SetTexture or SetImage should be used to + * initialize it. The layer will appear above other pre-existing layers. + * If ResetLayers is called or the PPB_Compositor is + * released, the returned layer will be invalidated, and any further calls on + * the layer will return PP_ERROR_BADRESOURCE. + * + * param[in] compositor A PP_Resource corresponding to + * a compositor layer resource. + * + * @return A PP_Resource containing the compositor layer + * resource if successful or 0 otherwise. + */ + PP_Resource AddLayer([in] PP_Resource compositor); + + /** + * Commits layers added by AddLayer() to the chromium compositor. + * + * param[in] compositor A PP_Resource corresponding to + * a compositor layer resource. + * @param[in] cc A PP_CompletionCallback to be called when + * layers have been represented on screen. + * + * @return An int32_t containing a result code from pp_errors.h. + */ + int32_t CommitLayers([in] PP_Resource compositor, + [in] PP_CompletionCallback cc); + + /** + * Resets layers added by AddLayer(). + * + * param[in] compositor A PP_Resource corresponding to + * a compositor layer resource. + * + * @return An int32_t containing a result code from pp_errors.h. + */ + int32_t ResetLayers([in] PP_Resource compositor); +}; diff --git a/browser/extensions/mortar/ppapi/api/ppb_compositor_layer.idl b/browser/extensions/mortar/ppapi/api/ppb_compositor_layer.idl new file mode 100644 index 000000000000..ed0967d4fa42 --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/ppb_compositor_layer.idl @@ -0,0 +1,251 @@ +/* Copyright 2014 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +[generate_thunk] + +label Chrome { + [channel=dev] M37 = 0.1, + [channel=dev] M38 = 0.2 +}; + +/** + * This enumeration contains blend modes used for computing the result pixels + * based on the source RGBA values in layers with the RGBA values that are + * already in the destination framebuffer. + * alpha_src, color_src: source alpha and color. + * alpha_dst, color_dst: destination alpha and color (before compositing). + * Below descriptions of the blend modes assume the colors are pre-multiplied. + * This interface is still in development (Dev API status) and may change, + * so is only supported on Dev channel and Canary currently. + */ +enum PP_BlendMode { + /** + * No blending, copy source to the destination directly. + */ + PP_BLENDMODE_NONE, + + /** + * Source is placed over the destination. + * Resulting alpha = alpha_src + alpha_dst - alpha_src * alpha_dst + * Resulting color = color_src + color_dst * (1 - alpha_src) + */ + PP_BLENDMODE_SRC_OVER, + + /** + * The last blend mode. + */ + PP_BLENDMODE_LAST = PP_BLENDMODE_SRC_OVER +}; + +/** + * Defines the PPB_CompositorLayer interface. It is used by + * PPB_Compositor. + */ +interface PPB_CompositorLayer { + /** + * Determines if a resource is a compositor layer resource. + * + * @param[in] resource The PP_Resource to test. + * + * @return A PP_Bool with PP_TRUE if the given + * resource is a compositor layer resource or PP_FALSE + * otherwise. + */ + PP_Bool IsCompositorLayer([in] PP_Resource resource); + + /** + * Sets the color of a solid color layer. If the layer is uninitialized, + * it will initialize the layer first, and then set its color. + * If the layer has been initialized to another kind of layer, the layer will + * not be changed, and PP_ERROR_BADARGUMENT will be returned. + * + * param[in] layer A PP_Resource corresponding to a compositor + * layer resource. + * param[in] red A float for the red color component. It will be + * clamped to [0, 1]. + * param[in] green A float for the green color component. It will + * be clamped to [0, 1]. + * param[in] blue A float for the blue color component. It will + * be clamped to [0, 1]. + * param[in] alpha A float for the alpha color component. It will + * be clamped to [0, 1]. + * param[in] size A PP_Size for the size of the layer before + * transform. + * + * @return An int32_t containing a result code from pp_errors.h. + */ + int32_t SetColor([in] PP_Resource layer, + [in] float_t red, + [in] float_t green, + [in] float_t blue, + [in] float_t alpha, + [in] PP_Size size); + + /** + * Sets the texture of a texture layer. If the layer is uninitialized, + * it will initialize the layer first, and then set its texture. + * The source rect will be set to ((0, 0), (1, 1)). If the layer has been + * initialized to another kind of layer, the layer will not be changed, + * and PP_ERROR_BADARGUMENT will be returned. + * + * param[in] layer A PP_Resource corresponding to a compositor + * layer resource. + * param[in] context A PP_Resource corresponding to a graphics + * 3d resource which owns the GL texture. + * param[in] texture A GL texture object id. + * param[in] size A PP_Size for the size of the layer before + * transform. + * param[in] cc A PP_CompletionCallback to be called when + * the texture is released by Chromium compositor. + * + * @return An int32_t containing a result code from pp_errors.h. + */ + int32_t SetTexture([in] PP_Resource layer, + [in] PP_Resource context, + [in] uint32_t texture, + [in] PP_Size size, + [in] PP_CompletionCallback cc); + + /** + * Sets the texture of a texture layer. If the layer is uninitialized, + * it will initialize the layer first, and then set its texture. + * The source rect will be set to ((0, 0), (1, 1)). If the layer has been + * initialized to another kind of layer, the layer will not be changed, + * and PP_ERROR_BADARGUMENT will be returned. + * + * param[in] layer A PP_Resource corresponding to a compositor + * layer resource. + * param[in] context A PP_Resource corresponding to a graphics + * 3d resource which owns the GL texture. + * param[in] target GL texture target (GL_TEXTURE_2D, etc). + * param[in] texture A GL texture object id. + * param[in] size A PP_Size for the size of the layer before + * transform. + * param[in] cc A PP_CompletionCallback to be called when + * the texture is released by Chromium compositor. + * + * @return An int32_t containing a result code from pp_errors.h. + */ + [version = 0.2] + int32_t SetTexture([in] PP_Resource layer, + [in] PP_Resource context, + [in] uint32_t target, + [in] uint32_t texture, + [in] PP_Size size, + [in] PP_CompletionCallback cc); + + /** + * Sets the image of an image layer. If the layer is uninitialized, + * it will initialize the layer first, and then set its image. + * The layer size will be set to the image's size. The source rect will be set + * to the full image. If the layer has been initialized to another kind of + * layer, the layer will not be changed, and PP_ERROR_BADARGUMENT + * will be returned. + * + * param[in] layer A PP_Resource corresponding to a compositor + * layer resource. + * param[in] image_data A PP_Resource corresponding to + * an image data resource. + * param[in] size A PP_Size for the size of the layer before + * transform. If NULL, the image's size will be used. + * param[in] cc A PP_CompletionCallback to be called when + * the image data is released by Chromium compositor. + * + * @return An int32_t containing a result code from pp_errors.h. + */ + int32_t SetImage([in] PP_Resource layer, + [in] PP_Resource image_data, + [in] PP_Size size, + [in] PP_CompletionCallback cc); + + /** + * Sets a clip rectangle for a compositor layer. The Chromium compositor + * applies a transform matrix on the layer first, and then clips the layer + * with the rectangle. + * + * param[in] layer A PP_Resource corresponding to a compositor + * layer resource. + * param[in] rect The clip rectangle. The origin is top-left corner of + * the plugin. + * + * @return An int32_t containing a result code from pp_errors.h. + */ + int32_t SetClipRect([in] PP_Resource layer, + [in] PP_Rect rect); + + /** + * Sets a transform matrix which is used to composite the layer. + * + * param[in] layer A PP_Resource corresponding to a compositor + * layer resource. + * param[in] matrix A float array with 16 elements. The matrix is + * column major. The default transform matrix is an identity matrix. + * + * @return An int32_t containing a result code from pp_errors.h. + */ + int32_t SetTransform([in] PP_Resource layer, + [in] float_t[16] matrix); + + /** + * Sets the opacity value which will be applied to the layer. The effective + * value of each pixel is computed as: + * + * if (premult_alpha) + * pixel.rgb = pixel.rgb * opacity; + * pixel.a = pixel.a * opactiy; + * + * param[in] layer A PP_Resource corresponding to a compositor + * layer resource. + * param[in] opacity A float for the opacity value, The default + * value is 1.0f. + * + * @return An int32_t containing a result code from pp_errors.h. + */ + int32_t SetOpacity([in] PP_Resource layer, + [in] float_t opacity); + + /** + * Sets the blend mode which is used to composite the layer. + * + * param[in] layer A PP_Resource corresponding to a compositor + * layer resource. + * param[in] mode A PP_BlendMode. The default mode is + * PP_BLENDMODE_SRC_OVER. + * + * @return An int32_t containing a result code from pp_errors.h. + */ + int32_t SetBlendMode([in] PP_Resource layer, + [in] PP_BlendMode mode); + + /** + * Sets a source rectangle for a texture layer or an image layer. + * + * param[in] layer A PP_Resource corresponding to a compositor + * layer resource. + * param[in] rect A PP_FloatRect for an area of the source to + * consider. For a texture layer, rect is in uv coordinates. For an image + * layer, rect is in pixels. If the rect is beyond the dimensions of the + * texture or image, PP_ERROR_BADARGUMENT will be returned. + * If the layer size does not match the source rect size, bilinear scaling + * will be used. + * + * @return An int32_t containing a result code from pp_errors.h. + */ + int32_t SetSourceRect([in] PP_Resource layer, + [in] PP_FloatRect rect); + + /** + * Sets the premultiplied alpha for an texture layer. + * + * param[in] layer A PP_Resource corresponding to a compositor + * layer resource. + * param[in] premult A PP_Bool with PP_TRUE if + * pre-multiplied alpha is used. + * + * @return An int32_t containing a result code from pp_errors.h. + */ + int32_t SetPremultipliedAlpha([in] PP_Resource layer, + [in] PP_Bool premult); +}; diff --git a/browser/extensions/mortar/ppapi/api/ppb_console.idl b/browser/extensions/mortar/ppapi/api/ppb_console.idl new file mode 100644 index 000000000000..84daa6fd842f --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/ppb_console.idl @@ -0,0 +1,51 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * This file defines the PPB_Console interface. + */ + +[generate_thunk] + +label Chrome { + M25 = 1.0 +}; + +[assert_size(4)] +enum PP_LogLevel { + PP_LOGLEVEL_TIP = 0, + PP_LOGLEVEL_LOG = 1, + PP_LOGLEVEL_WARNING = 2, + PP_LOGLEVEL_ERROR = 3 +}; + +interface PPB_Console { + /** + * Logs the given message to the JavaScript console associated with the + * given plugin instance with the given logging level. The name of the plugin + * issuing the log message will be automatically prepended to the message. + * The value may be any type of Var. + */ + void Log( + [in] PP_Instance instance, + [in] PP_LogLevel level, + [in] PP_Var value); + + /** + * Logs a message to the console with the given source information rather + * than using the internal PPAPI plugin name. The name must be a string var. + * + * The regular log function will automatically prepend the name of your + * plugin to the message as the "source" of the message. Some plugins may + * wish to override this. For example, if your plugin is a Python + * interpreter, you would want log messages to contain the source .py file + * doing the log statement rather than have "python" show up in the console. + */ + void LogWithSource( + [in] PP_Instance instance, + [in] PP_LogLevel level, + [in] PP_Var source, + [in] PP_Var value); +}; diff --git a/browser/extensions/mortar/ppapi/api/ppb_core.idl b/browser/extensions/mortar/ppapi/api/ppb_core.idl new file mode 100644 index 000000000000..58bd9216d985 --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/ppb_core.idl @@ -0,0 +1,101 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * This file defines the PPB_Core interface defined by the browser + * and containing pointers to functions related to memory management, time, and + * threads. + */ + +label Chrome { + M14 = 1.0 +}; + +/** + * The PPB_Core interface contains pointers to functions related + * to memory management, time, and threads on the browser. + * + */ +interface PPB_Core { + /** + * + * AddRefResource() adds a reference to a resource. + * + * @param[in] config A PP_Resource corresponding to a + * resource. + */ + void AddRefResource([in] PP_Resource resource); + + /** + * ReleaseResource() removes a reference from a resource. + * + * @param[in] config A PP_Resource corresponding to a + * resource. + */ + void ReleaseResource([in] PP_Resource resource); + + /** + * GetTime() returns the "wall clock time" according to the + * browser. + * + * @return A PP_Time containing the "wall clock time" according + * to the browser. + */ + PP_Time GetTime(); + + /** + * GetTimeTicks() returns the "tick time" according to the browser. + * This clock is used by the browser when passing some event times to the + * module (e.g. using the PP_InputEvent::time_stamp_seconds + * field). It is not correlated to any actual wall clock time + * (like GetTime()). Because of this, it will not run change if the user + * changes their computer clock. + * + * @return A PP_TimeTicks containing the "tick time" according + * to the browser. + */ + PP_TimeTicks GetTimeTicks(); + + /** + * CallOnMainThread() schedules work to be executed on the main module thread + * after the specified delay. The delay may be 0 to specify a call back as + * soon as possible. + * + * The result parameter will just be passed as the second + * argument to the callback. Many applications won't need this, but it allows + * a module to emulate calls of some callbacks which do use this value. + * + * Note: CallOnMainThread, even when used from the main + * thread with a delay of 0 milliseconds, will never directly invoke the + * callback. Even in this case, the callback will be scheduled + * asynchronously. + * + * Note: If the browser is shutting down or if the module + * has no instances, then the callback function may not be called. + * + * @param[in] delay_in_milliseconds An int32_t delay in milliseconds. + * @param[in] callback A PP_CompletionCallback callback function + * that the browser will call after the specified delay. + * @param[in] result An int32_t that the browser will pass to the given + * PP_CompletionCallback. + */ + void CallOnMainThread( + [in] int32_t delay_in_milliseconds, + [in] PP_CompletionCallback callback, + [in] int32_t result); + + /** + * IsMainThread() returns true if the current thread is the main pepper + * thread. + * + * This function is useful for implementing sanity checks, and deciding if + * dispatching using CallOnMainThread() is required. + * + * @return A PP_Bool containing PP_TRUE if the + * current thread is the main pepper thread, otherwise PP_FALSE. + */ + PP_Bool IsMainThread(); +}; + diff --git a/browser/extensions/mortar/ppapi/api/ppb_file_io.idl b/browser/extensions/mortar/ppapi/api/ppb_file_io.idl new file mode 100644 index 000000000000..9b8c9e22bdfd --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/ppb_file_io.idl @@ -0,0 +1,293 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + + +/** + * This file defines the API to create a file i/o object. + */ + +[generate_thunk] + +label Chrome { + M14 = 1.0, + M25 = 1.1, + M29 = 1.2 +}; + +/** + * The PP_FileOpenFlags enum contains file open constants. + */ +[assert_size(4)] + enum PP_FileOpenFlags { + /** Requests read access to a file. */ + PP_FILEOPENFLAG_READ = 1 << 0, + + /** + * Requests write access to a file. May be combined with + * PP_FILEOPENFLAG_READ to request read and write access. + */ + PP_FILEOPENFLAG_WRITE = 1 << 1, + + /** + * Requests that the file be created if it does not exist. If the file + * already exists, then this flag is ignored unless + * PP_FILEOPENFLAG_EXCLUSIVE was also specified, in which case + * FileIO::Open() will fail. + */ + PP_FILEOPENFLAG_CREATE = 1 << 2, + + /** + * Requests that the file be truncated to length 0 if it exists and is a + * regular file. PP_FILEOPENFLAG_WRITE must also be specified. + */ + PP_FILEOPENFLAG_TRUNCATE = 1 << 3, + + /** + * Requests that the file is created when this flag is combined with + * PP_FILEOPENFLAG_CREATE. If this flag is specified, and the + * file already exists, then the FileIO::Open() call will fail. + */ + PP_FILEOPENFLAG_EXCLUSIVE = 1 << 4, + + /** + * Requests write access to a file, but writes will always occur at the end of + * the file. Mututally exclusive with PP_FILEOPENFLAG_WRITE. + * + * This is only supported in version 1.2 (Chrome 29) and later. + */ + [version=1.2] + PP_FILEOPENFLAG_APPEND = 1 << 5 +}; + + +/** + * The PPB_FileIO struct is used to operate on a regular file + * (PP_FileType_Regular). + */ +interface PPB_FileIO { + /** + * Create() creates a new FileIO object. + * + * @param[in] instance A PP_Instance identifying the instance + * with the file. + * + * @return A PP_Resource corresponding to a FileIO if + * successful or 0 if the module is invalid. + */ + PP_Resource Create([in] PP_Instance instance); + /** + * IsFileIO() determines if the provided resource is a FileIO. + * + * @param[in] resource A PP_Resource corresponding to a FileIO. + * + * @return PP_TRUE if the resource is a + * PPB_FileIO, PP_FALSE if the resource is + * invalid or some type other than PPB_FileIO. + */ + PP_Bool IsFileIO([in] PP_Resource resource); + + /** + * Open() opens the specified regular file for I/O according to the given + * open flags, which is a bit-mask of the PP_FileOpenFlags + * values. Upon success, the corresponding file is classified as "in use" + * by this FileIO object until such time as the FileIO object is closed + * or destroyed. + * + * @param[in] file_io A PP_Resource corresponding to a + * FileIO. + * @param[in] file_ref A PP_Resource corresponding to a file + * reference. + * @param[in] open_flags A bit-mask of the PP_FileOpenFlags + * values. + * @param[in] callback A PP_CompletionCallback to be called upon + * completion of Open(). + * + * @return An int32_t containing an error code from pp_errors.h. + */ + int32_t Open([in] PP_Resource file_io, + [in] PP_Resource file_ref, + [in] int32_t open_flags, + [in] PP_CompletionCallback callback); + + /** + * Query() queries info about the file opened by this FileIO object. The + * FileIO object must be opened, and there must be no other operations + * pending. + * + * @param[in] file_io A PP_Resource corresponding to a + * FileIO. + * @param[out] info The PP_FileInfo structure representing all + * information about the file. + * @param[in] callback A PP_CompletionCallback to be called upon + * completion of Query(). info must remain valid until after the + * callback runs. If you pass a blocking callback, info must + * remain valid until after Query() returns. + * + * @return An int32_t containing an error code from pp_errors.h. + * PP_ERROR_FAILED will be returned if the file isn't opened, and + * PP_ERROR_INPROGRESS will be returned if there is another operation pending. + */ + int32_t Query([in] PP_Resource file_io, + [out] PP_FileInfo info, + [in] PP_CompletionCallback callback); + + /** + * Touch() Updates time stamps for the file opened by this FileIO object. + * This function will fail if the FileIO object has not been opened. The + * FileIO object must be opened, and there must be no other operations + * pending. + * + * @param[in] file_io A PP_Resource corresponding to a file + * FileIO. + * @param[in] last_access_time The last time the FileIO was accessed. + * @param[in] last_modified_time The last time the FileIO was modified. + * @param[in] callback A PP_CompletionCallback to be called upon + * completion of Touch(). + * + * @return An int32_t containing an error code from pp_errors.h. + * PP_ERROR_FAILED will be returned if the file isn't opened, and + * PP_ERROR_INPROGRESS will be returned if there is another operation pending. + */ + int32_t Touch([in] PP_Resource file_io, + [in] PP_Time last_access_time, + [in] PP_Time last_modified_time, + [in] PP_CompletionCallback callback); + + /** + * Read() reads from an offset in the file. The size of the buffer must be + * large enough to hold the specified number of bytes to read. This function + * might perform a partial read, meaning all the requested bytes + * might not be returned, even if the end of the file has not been reached. + * The FileIO object must have been opened with read access. + * + * ReadToArray() is preferred to Read() when doing asynchronous operations. + * + * @param[in] file_io A PP_Resource corresponding to a file + * FileIO. + * @param[in] offset The offset into the file. + * @param[in] buffer The buffer to hold the specified number of bytes read. + * @param[in] bytes_to_read The number of bytes to read from + * offset. + * @param[in] callback A PP_CompletionCallback to be called upon + * completion of Read(). buffer must remain valid until after + * the callback runs. If you pass a blocking callback, buffer + * must remain valid until after Read() returns. + * + * @return The number of bytes read or an error code from + * pp_errors.h. If the return value is 0, then end-of-file was + * reached. It is valid to call Read() multiple times with a completion + * callback to queue up parallel reads from the file, but pending reads + * cannot be interleaved with other operations. + */ + int32_t Read([in] PP_Resource file_io, + [in] int64_t offset, + [inout] str_t buffer, + [in] int32_t bytes_to_read, + [in] PP_CompletionCallback callback); + + /** + * Write() writes to an offset in the file. This function might perform a + * partial write. The FileIO object must have been opened with write access. + * + * @param[in] file_io A PP_Resource corresponding to a file + * FileIO. + * @param[in] offset The offset into the file. + * @param[in] buffer The buffer to hold the specified number of bytes read. + * @param[in] bytes_to_write The number of bytes to write to + * offset. + * @param[in] callback A PP_CompletionCallback to be called upon + * completion of Write(). + * + * @return The number of bytes written or an error code from + * pp_errors.h. If the return value is 0, then end-of-file was + * reached. It is valid to call Write() multiple times with a completion + * callback to queue up parallel writes to the file, but pending writes + * cannot be interleaved with other operations. + */ + int32_t Write([in] PP_Resource file_io, + [in] int64_t offset, + [in] str_t buffer, + [in] int32_t bytes_to_write, + [in] PP_CompletionCallback callback); + /** + * SetLength() sets the length of the file. If the file size is extended, + * then the extended area of the file is zero-filled. The FileIO object must + * have been opened with write access and there must be no other operations + * pending. + * + * @param[in] file_io A PP_Resource corresponding to a file + * FileIO. + * @param[in] length The length of the file to be set. + * @param[in] callback A PP_CompletionCallback to be called upon + * completion of SetLength(). + * + * @return An int32_t containing an error code from pp_errors.h. + * PP_ERROR_FAILED will be returned if the file isn't opened, and + * PP_ERROR_INPROGRESS will be returned if there is another operation pending. + */ + int32_t SetLength([in] PP_Resource file_io, + [in] int64_t length, + [in] PP_CompletionCallback callback); + + /** + * Flush() flushes changes to disk. This call can be very expensive! The + * FileIO object must have been opened with write access and there must be no + * other operations pending. + * + * @param[in] file_io A PP_Resource corresponding to a file + * FileIO. + * @param[in] callback A PP_CompletionCallback to be called upon + * completion of Flush(). + * + * @return An int32_t containing an error code from pp_errors.h. + * PP_ERROR_FAILED will be returned if the file isn't opened, and + * PP_ERROR_INPROGRESS will be returned if there is another operation pending. + */ + int32_t Flush([in] PP_Resource file_io, + [in] PP_CompletionCallback callback); + + /** + * Close() cancels any IO that may be pending, and closes the FileIO object. + * Any pending callbacks will still run, reporting + * PP_ERROR_ABORTED if pending IO was interrupted. It is not + * valid to call Open() again after a call to this method. + * Note: If the FileIO object is destroyed, and it is still + * open, then it will be implicitly closed, so you are not required to call + * Close(). + * + * @param[in] file_io A PP_Resource corresponding to a file + * FileIO. + */ + void Close([in] PP_Resource file_io); + + /** + * ReadToArray() reads from an offset in the file. A PP_ArrayOutput must be + * provided so that output will be stored in its allocated buffer. This + * function might perform a partial read. The FileIO object must have been + * opened with read access. + * + * @param[in] file_io A PP_Resource corresponding to a file + * FileIO. + * @param[in] offset The offset into the file. + * @param[in] max_read_length The maximum number of bytes to read from + * offset. + * @param[in] output A PP_ArrayOutput to hold the output data. + * @param[in] callback A PP_CompletionCallback to be called upon + * completion of ReadToArray(). + * + * @return The number of bytes read or an error code from + * pp_errors.h. If the return value is 0, then end-of-file was + * reached. It is valid to call ReadToArray() multiple times with a completion + * callback to queue up parallel reads from the file, but pending reads + * cannot be interleaved with other operations. + */ + [version = 1.1] + int32_t ReadToArray([in] PP_Resource file_io, + [in] int64_t offset, + [in] int32_t max_read_length, + [inout] PP_ArrayOutput output, + [in] PP_CompletionCallback callback); +}; + diff --git a/browser/extensions/mortar/ppapi/api/ppb_file_ref.idl b/browser/extensions/mortar/ppapi/api/ppb_file_ref.idl new file mode 100644 index 000000000000..f3207e05bd2a --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/ppb_file_ref.idl @@ -0,0 +1,247 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * This file defines the API to create a file reference or "weak pointer" to a + * file in a file system. + */ + +label Chrome { + M14 = 1.0, + M28 = 1.1, + M34 = 1.2 +}; + +/** + * The PP_MakeDirectoryFlags enum contains flags used to control + * behavior of PPB_FileRef.MakeDirectory(). + */ +enum PP_MakeDirectoryFlags { + PP_MAKEDIRECTORYFLAG_NONE = 0 << 0, + + /** Requests that ancestor directories are created if they do not exist. */ + PP_MAKEDIRECTORYFLAG_WITH_ANCESTORS = 1 << 0, + + /** + * Requests that the PPB_FileRef.MakeDirectory() call fails if the directory + * already exists. + */ + PP_MAKEDIRECTORYFLAG_EXCLUSIVE = 1 << 1 +}; + +/** + * The PPB_FileRef struct represents a "weak pointer" to a file in + * a file system. This struct contains a PP_FileSystemType + * identifier and a file path string. + */ +interface PPB_FileRef { + /** + * Create() creates a weak pointer to a file in the given file system. File + * paths are POSIX style. + * + * @param[in] resource A PP_Resource corresponding to a file + * system. + * @param[in] path A path to the file. Must begin with a '/' character. + * + * @return A PP_Resource corresponding to a file reference if + * successful or 0 if the path is malformed. + */ + PP_Resource Create([in] PP_Resource file_system, [in] str_t path); + /** + * IsFileRef() determines if the provided resource is a file reference. + * + * @param[in] resource A PP_Resource corresponding to a file + * reference. + * + * @return PP_TRUE if the resource is a + * PPB_FileRef, PP_FALSE if the resource is + * invalid or some type other than PPB_FileRef. + */ + PP_Bool IsFileRef([in] PP_Resource resource); + + /** + * GetFileSystemType() returns the type of the file system. + * + * @param[in] file_ref A PP_Resource corresponding to a file + * reference. + * + * @return A PP_FileSystemType with the file system type if + * valid or PP_FILESYSTEMTYPE_INVALID if the provided resource + * is not a valid file reference. + */ + PP_FileSystemType GetFileSystemType([in] PP_Resource file_ref); + + /** + * GetName() returns the name of the file. + * + * @param[in] file_ref A PP_Resource corresponding to a file + * reference. + * + * @return A PP_Var containing the name of the file. The value + * returned by this function does not include any path components (such as + * the name of the parent directory, for example). It is just the name of the + * file. Use GetPath() to get the full file path. + */ + PP_Var GetName([in] PP_Resource file_ref); + + /** + * GetPath() returns the absolute path of the file. + * + * @param[in] file_ref A PP_Resource corresponding to a file + * reference. + * + * @return A PP_Var containing the absolute path of the file. + * This function fails if the file system type is + * PP_FileSystemType_External. + */ + PP_Var GetPath([in] PP_Resource file_ref); + + /** + * GetParent() returns the parent directory of this file. If + * file_ref points to the root of the filesystem, then the root + * is returned. + * + * @param[in] file_ref A PP_Resource corresponding to a file + * reference. + * + * @return A PP_Resource containing the parent directory of the + * file. This function fails if the file system type is + * PP_FileSystemType_External. + */ + PP_Resource GetParent([in] PP_Resource file_ref); + + /** + * MakeDirectory() makes a new directory in the file system as well as any + * parent directories if the make_ancestors argument is + * PP_TRUE. It is not valid to make a directory in the external + * file system. + * + * @param[in] file_ref A PP_Resource corresponding to a file + * reference. + * @param[in] make_ancestors A PP_Bool set to + * PP_TRUE to make ancestor directories or PP_FALSE + * if ancestor directories are not needed. + * @param[in] callback A PP_CompletionCallback to be called upon + * completion of MakeDirectory(). + * + * @return An int32_t containing an error code from pp_errors.h. + * Succeeds if the directory already exists. Fails if ancestor directories + * do not exist and make_ancestors was passed as + * PP_FALSE. + */ + [deprecate=1.2] + int32_t MakeDirectory([in] PP_Resource directory_ref, + [in] PP_Bool make_ancestors, + [in] PP_CompletionCallback callback); + + /** + * MakeDirectory() makes a new directory in the file system according to the + * given make_directory_flags, which is a bit-mask of the + * PP_MakeDirectoryFlags values. It is not valid to make a + * directory in the external file system. + * + * @param[in] file_ref A PP_Resource corresponding to a file + * reference. + * @param[in] make_directory_flags A bit-mask of the + * PP_MakeDirectoryFlags values. + * @param[in] callback A PP_CompletionCallback to be called upon + * completion of MakeDirectory(). + * + * @return An int32_t containing an error code from pp_errors.h. + */ + [version=1.2] + int32_t MakeDirectory([in] PP_Resource directory_ref, + [in] int32_t make_directory_flags, + [in] PP_CompletionCallback callback); + + /** + * Touch() Updates time stamps for a file. You must have write access to the + * file if it exists in the external filesystem. + * + * @param[in] file_ref A PP_Resource corresponding to a file + * reference. + * @param[in] last_access_time The last time the file was accessed. + * @param[in] last_modified_time The last time the file was modified. + * @param[in] callback A PP_CompletionCallback to be called upon + * completion of Touch(). + * + * @return An int32_t containing an error code from pp_errors.h. + */ + int32_t Touch([in] PP_Resource file_ref, + [in] PP_Time last_access_time, + [in] PP_Time last_modified_time, + [in] PP_CompletionCallback callback); + + /** + * Delete() deletes a file or directory. If file_ref refers to + * a directory, then the directory must be empty. It is an error to delete a + * file or directory that is in use. It is not valid to delete a file in + * the external file system. + * + * @param[in] file_ref A PP_Resource corresponding to a file + * reference. + * @param[in] callback A PP_CompletionCallback to be called upon + * completion of Delete(). + * + * @return An int32_t containing an error code from pp_errors.h. + */ + int32_t Delete([in] PP_Resource file_ref, + [in] PP_CompletionCallback callback); + + /** + * Rename() renames a file or directory. Arguments file_ref and + * new_file_ref must both refer to files in the same file + * system. It is an error to rename a file or directory that is in use. It + * is not valid to rename a file in the external file system. + * + * @param[in] file_ref A PP_Resource corresponding to a file + * reference. + * @param[in] new_file_ref A PP_Resource corresponding to a new + * file reference. + * @param[in] callback A PP_CompletionCallback to be called upon + * completion of Rename(). + * + * @return An int32_t containing an error code from pp_errors.h. + */ + int32_t Rename([in] PP_Resource file_ref, + [in] PP_Resource new_file_ref, + [in] PP_CompletionCallback callback); + + /** + * Query() queries info about a file or directory. You must have access to + * read this file or directory if it exists in the external filesystem. + * + * @param[in] file_ref A PP_Resource corresponding to a file + * reference. + * @param[out] info A pointer to a PP_FileInfo which will be + * populated with information about the file or directory. + * @param[in] callback A PP_CompletionCallback to be called upon + * completion of Query(). + * + * @return An int32_t containing an error code from pp_errors.h. + */ + [version=1.1] + int32_t Query([in] PP_Resource file_ref, + [out] PP_FileInfo info, + [in] PP_CompletionCallback callback); + + /** + * ReadDirectoryEntries() reads all entries in a directory. + * + * @param[in] file_ref A PP_Resource corresponding to a directory + * reference. + * @param[in] output An output array which will receive + * PP_DirectoryEntry objects on success. + * @param[in] callback A PP_CompletionCallback to run on + * completion. + * + * @return An int32_t containing an error code from pp_errors.h. + */ + [version=1.1] + int32_t ReadDirectoryEntries([in] PP_Resource file_ref, + [in] PP_ArrayOutput output, + [in] PP_CompletionCallback callback); +}; + diff --git a/browser/extensions/mortar/ppapi/api/ppb_file_system.idl b/browser/extensions/mortar/ppapi/api/ppb_file_system.idl new file mode 100644 index 000000000000..c66b6a1092e1 --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/ppb_file_system.idl @@ -0,0 +1,82 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * This file defines the API to create a file system associated with a file. + */ + +[generate_thunk] + +label Chrome { + M14 = 1.0 +}; + +/** + * The PPB_FileSystem struct identifies the file system type + * associated with a file. + */ +interface PPB_FileSystem { + /** Create() creates a file system object of the given type. + * + * @param[in] instance A PP_Instance identifying the instance + * with the file. + * @param[in] type A file system type as defined by + * PP_FileSystemType enum (except PP_FILESYSTEMTYPE_ISOLATED, + * which is currently not supported). + * @return A PP_Resource corresponding to a file system if + * successful. + */ + PP_Resource Create([in] PP_Instance instance, [in] PP_FileSystemType type); + + /** + * IsFileSystem() determines if the provided resource is a file system. + * + * @param[in] resource A PP_Resource corresponding to a file + * system. + * + * @return PP_TRUE if the resource is a + * PPB_FileSystem, PP_FALSE if the resource is + * invalid or some type other than PPB_FileSystem. + */ + PP_Bool IsFileSystem([in] PP_Resource resource); + + /** + * Open() opens the file system. A file system must be opened before running + * any other operation on it. + * + * @param[in] file_system A PP_Resource corresponding to a file + * system. + * + * @param[in] expected_size The expected size of the file system. Note that + * this does not request quota; to do that, you must either invoke + * requestQuota from JavaScript: + * http://www.html5rocks.com/en/tutorials/file/filesystem/#toc-requesting-quota + * or set the unlimitedStorage permission for Chrome Web Store apps: + * http://code.google.com/chrome/extensions/manifest.html#permissions + * + * @param[in] callback A PP_CompletionCallback to be called upon + * completion of Open(). + * + * @return An int32_t containing an error code from pp_errors.h. + */ + int32_t Open([in] PP_Resource file_system, + [in] int64_t expected_size, + [in] PP_CompletionCallback callback); + + /** + * GetType() returns the type of the provided file system. + * + * @param[in] file_system A PP_Resource corresponding to a file + * system. + * + * @return A PP_FileSystemType with the file system type if + * valid or PP_FILESYSTEMTYPE_INVALID if the provided resource + * is not a valid file system. It is valid to call this function even before + * Open() completes. + */ + [on_failure=PP_FILESYSTEMTYPE_INVALID] + PP_FileSystemType GetType([in] PP_Resource file_system); +}; + diff --git a/browser/extensions/mortar/ppapi/api/ppb_fullscreen.idl b/browser/extensions/mortar/ppapi/api/ppb_fullscreen.idl new file mode 100644 index 000000000000..0599e186943d --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/ppb_fullscreen.idl @@ -0,0 +1,78 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + + +/** + * This file defines the PPB_Fullscreen interface for + * handling transitions of a module instance to and from fullscreen mode. + */ + +[generate_thunk] + +label Chrome { + M16 = 1.0 +}; + +/** + * The PPB_Fullscreen interface is implemented by the browser. + * This interface provides a way of checking the current screen mode and + * toggling fullscreen mode. + */ +interface PPB_Fullscreen { + /** + * IsFullscreen() checks whether the module instance is currently in + * fullscreen mode. + * + * @param[in] instance A PP_Instance identifying one instance + * of a module. + * + * @return PP_TRUE if the module instance is in fullscreen mode, + * PP_FALSE if the module instance is not in fullscreen mode. + */ + PP_Bool IsFullscreen( + [in] PP_Instance instance); + + /** + * SetFullscreen() switches the module instance to and from fullscreen + * mode. + * + * The transition to and from fullscreen mode is asynchronous. During the + * transition, IsFullscreen() will return the previous value and + * no 2D or 3D device can be bound. The transition ends at DidChangeView() + * when IsFullscreen() returns the new value. You might receive other + * DidChangeView() calls while in transition. + * + * The transition to fullscreen mode can only occur while the browser is + * processing a user gesture, even if PP_TRUE is returned. + * + * @param[in] instance A PP_Instance identifying one instance + * of a module. + * @param[in] fullscreen PP_TRUE to enter fullscreen mode, or + * PP_FALSE to exit fullscreen mode. + * + * @return PP_TRUE on success or PP_FALSE on + * failure. + */ + PP_Bool SetFullscreen( + [in] PP_Instance instance, + [in] PP_Bool fullscreen); + + /** + * GetScreenSize() gets the size of the screen in pixels. The module instance + * will be resized to this size when SetFullscreen() is called to enter + * fullscreen mode. + * + * @param[in] instance A PP_Instance identifying one instance + * of a module. + * @param[out] size The size of the entire screen in pixels. + * + * @return PP_TRUE on success or PP_FALSE on + * failure. + */ + PP_Bool GetScreenSize( + [in] PP_Instance instance, + [out] PP_Size size); +}; + diff --git a/browser/extensions/mortar/ppapi/api/ppb_gamepad.idl b/browser/extensions/mortar/ppapi/api/ppb_gamepad.idl new file mode 100644 index 000000000000..927f5cceb69e --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/ppb_gamepad.idl @@ -0,0 +1,97 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * This file defines the PPB_Gamepad interface, which + * provides access to gamepad devices. + */ + +[generate_thunk] + +label Chrome { + M19 = 1.0 +}; + +/** + * The data for one gamepad device. + */ +[assert_size(472)] +struct PP_GamepadSampleData { + /** + * Number of valid elements in the |axes| array. + */ + uint32_t axes_length; + + /** + * Normalized values for the axes, indices valid up to |axes_length|-1. Axis + * values range from -1..1, and are in order of "importance". + */ + float_t[16] axes; + + /** + * Number of valid elements in the |buttons| array. + */ + uint32_t buttons_length; + + /** + * Normalized values for the buttons, indices valid up to |buttons_length| + * - 1. Button values range from 0..1, and are in order of importance. + */ + float_t[32] buttons; + + /** + * Monotonically increasing value that is incremented when the data have + * been updated. + */ + double_t timestamp; + + /** + * Identifier for the type of device/manufacturer. + */ + uint16_t[128] id; + + /** + * Is there a gamepad connected at this index? If this is false, no other + * data in this structure is valid. + */ + PP_Bool connected; + + /* Padding to make the struct the same size between 64 and 32. */ + int8_t[4] unused_pad_; +}; + +/** + * The data for all gamepads connected to the system. + */ +[assert_size(1896)] +struct PP_GamepadsSampleData { + /** + * Number of valid elements in the |items| array. + */ + uint32_t length; + + /* Padding to make the struct the same size between 64 and 32. */ + int8_t[4] unused_pad_; + + /** + * Data for an individual gamepad device connected to the system. + */ + PP_GamepadSampleData[4] items; +}; + +/** + * The PPB_Gamepad interface allows retrieving data from + * gamepad/joystick devices that are connected to the system. + */ +[version=1.0, macro="PPB_GAMEPAD_INTERFACE", singleton] +interface PPB_Gamepad { + /** + * Samples the current state of the available gamepads. + */ + [always_set_output_parameters] + void Sample( + [in] PP_Instance instance, + [out] PP_GamepadsSampleData data); +}; diff --git a/browser/extensions/mortar/ppapi/api/ppb_graphics_2d.idl b/browser/extensions/mortar/ppapi/api/ppb_graphics_2d.idl new file mode 100644 index 000000000000..f2fa64a58534 --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/ppb_graphics_2d.idl @@ -0,0 +1,308 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * Defines the PPB_Graphics2D struct representing a 2D graphics + * context within the browser. + */ + +[generate_thunk] + +label Chrome { + M14 = 1.0, + M27 = 1.1, + M52 = 1.2 +}; + +/** + * PPB_Graphics2D defines the interface for a 2D graphics context. + */ +[macro="PPB_GRAPHICS_2D_INTERFACE"] +interface PPB_Graphics2D { + /** + * Create() creates a 2D graphics context. The returned graphics context will + * not be bound to the module instance on creation (call BindGraphics() on + * the module instance to bind the returned graphics context to the module + * instance). + * + * @param[in] instance The module instance. + * @param[in] size The size of the graphic context. + * @param[in] is_always_opaque Set the is_always_opaque flag to + * PP_TRUE if you know that you will be painting only opaque + * data to this context. This option will disable blending when compositing + * the module with the web page, which might give higher performance on some + * computers. + * + * If you set is_always_opaque, your alpha channel should always + * be set to 0xFF or there may be painting artifacts. The alpha values + * overwrite the destination alpha values without blending when + * is_always_opaque is true. + * + * @return A PP_Resource containing the 2D graphics context if + * successful or 0 if unsuccessful. + */ + PP_Resource Create( + [in] PP_Instance instance, + [in] PP_Size size, + [in] PP_Bool is_always_opaque); + + /** + * IsGraphics2D() determines if the given resource is a valid + * Graphics2D. + * + * @param[in] resource A Graphics2D context resource. + * + * @return PP_TRUE if the given resource is a valid Graphics2D, + * PP_FALSE if it is an invalid resource or is a resource of + * another type. + */ + PP_Bool IsGraphics2D( + [in] PP_Resource resource); + + /** + * Describe() retrieves the configuration for the given graphics context, + * filling the given values (which must not be NULL). + * + * @param[in] resource The 2D Graphics resource. + * @param[in,out] size The size of the 2D graphics context in the browser. + * @param[in,out] is_always_opaque Identifies whether only opaque data + * will be painted. + * + * @return Returns PP_TRUE on success or PP_FALSE if + * the resource is invalid. The output parameters will be set to 0 on a + * PP_FALSE. + */ + [always_set_output_parameters] + PP_Bool Describe( + [in] PP_Resource graphics_2d, + [out] PP_Size size, + [out] PP_Bool is_always_opaque); + + /** + * PaintImageData() enqueues a paint of the given image into the context. + * This function has no effect until you call Flush() As a result, what + * counts is the contents of the bitmap when you call Flush(), not when + * you call this function. + * + * The provided image will be placed at top_left from the top + * left of the context's internal backing store. Then the pixels contained + * in src_rect will be copied into the backing store. This + * means that the rectangle being painted will be at src_rect + * offset by top_left. + * + * The src_rect is specified in the coordinate system of the + * image being painted, not the context. For the common case of copying the + * entire image, you may specify an empty src_rect. + * + * The painted area of the source bitmap must fall entirely within the + * context. Attempting to paint outside of the context will result in an + * error. However, the source bitmap may fall outside the context, as long + * as the src_rect subset of it falls entirely within the + * context. + * + * There are two methods most modules will use for painting. The first + * method is to generate a new ImageData and then paint it. In + * this case, you'll set the location of your painting to + * top_left and set src_rect to NULL. + * The second is that you're generating small invalid regions out of a larger + * bitmap representing your entire instance. In this case, you would set the + * location of your image to (0,0) and then set src_rect to the + * pixels you changed. + * + * @param[in] resource The 2D Graphics resource. + * @param[in] image The ImageData to be painted. + * @param[in] top_left A Point representing the + * top_left location where the ImageData will be + * painted. + * @param[in] src_rect The rectangular area where the ImageData + * will be painted. + */ + void PaintImageData( + [in] PP_Resource graphics_2d, + [in] PP_Resource image_data, + [in] PP_Point top_left, + [in] PP_Rect src_rect); + + /** + * Scroll() enqueues a scroll of the context's backing store. This + * function has no effect until you call Flush(). The data within the + * provided clipping rectangle will be shifted by (dx, dy) pixels. + * + * This function will result in some exposed region which will have undefined + * contents. The module should call PaintImageData() on these exposed regions + * to give the correct contents. + * + * The scroll can be larger than the area of the clipping rectangle, which + * means the current image will be scrolled out of the rectangle. This + * scenario is not an error but will result in a no-op. + * + * @param[in] graphics_2d The 2D Graphics resource. + * @param[in] clip The clipping rectangle. + * @param[in] amount The amount the area in the clipping rectangle will + * shifted. + */ + void Scroll( + [in] PP_Resource graphics_2d, + [in] PP_Rect clip_rect, + [in] PP_Point amount); + + /** + * ReplaceContents() provides a slightly more efficient way to paint the + * entire module's image. Normally, calling PaintImageData() requires that + * the browser copy the pixels out of the image and into the graphics + * context's backing store. This function replaces the graphics context's + * backing store with the given image, avoiding the copy. + * + * The new image must be the exact same size as this graphics context. If the + * new image uses a different image format than the browser's native bitmap + * format (use PPB_ImageData.GetNativeImageDataFormat() to + * retrieve the format), then a conversion will be done inside the browser + * which may slow the performance a little bit. + * + * Note: The new image will not be painted until you call + * Flush(). + * + * After this call, you should take care to release your references to the + * image. If you paint to the image after ReplaceContents(), there is the + * possibility of significant painting artifacts because the page might use + * partially-rendered data when copying out of the backing store. + * + * In the case of an animation, you will want to allocate a new image for the + * next frame. It is best if you wait until the flush callback has executed + * before allocating this bitmap. This gives the browser the option of + * caching the previous backing store and handing it back to you (assuming + * the sizes match). In the optimal case, this means no bitmaps are allocated + * during the animation, and the backing store and "front buffer" (which the + * plugin is painting into) are just being swapped back and forth. + * + * @param[in] graphics_2d The 2D Graphics resource. + * @param[in] image The ImageData to be painted. + */ + void ReplaceContents( + [in] PP_Resource graphics_2d, + [in] PP_Resource image_data); + + /** + * Flush() flushes any enqueued paint, scroll, and replace commands to the + * backing store. This function actually executes the updates, and causes a + * repaint of the webpage, assuming this graphics context is bound to a module + * instance. + * + * Flush() runs in asynchronous mode. Specify a callback function and the + * argument for that callback function. The callback function will be + * executed on the calling thread when the image has been painted to the + * screen. While you are waiting for a flush callback, additional calls to + * Flush() will fail. + * + * Because the callback is executed (or thread unblocked) only when the + * instance's image is actually on the screen, this function provides + * a way to rate limit animations. By waiting until the image is on the + * screen before painting the next frame, you can ensure you're not + * flushing 2D graphics faster than the screen can be updated. + * + * Unbound contexts + * If the context is not bound to a module instance, you will + * still get a callback. The callback will execute after Flush() returns + * to avoid reentrancy. The callback will not wait until anything is + * painted to the screen because there will be nothing on the screen. The + * timing of this callback is not guaranteed and may be deprioritized by + * the browser because it is not affecting the user experience. + * + * Off-screen instances + * If the context is bound to an instance that is currently not visible (for + * example, scrolled out of view) it will behave like the "unbound context" + * case. + * + * Detaching a context + * If you detach a context from a module instance, any pending flush + * callbacks will be converted into the "unbound context" case. + * + * Released contexts + * A callback may or may not get called even if you have released all + * of your references to the context. This scenario can occur if there are + * internal references to the context suggesting it has not been internally + * destroyed (for example, if it is still bound to an instance) or due to + * other implementation details. As a result, you should be careful to + * check that flush callbacks are for the context you expect and that + * you're capable of handling callbacks for unreferenced contexts. + * + * Shutdown + * If a module instance is removed when a flush is pending, the + * callback will not be executed. + * + * @param[in] graphics_2d The 2D Graphics resource. + * @param[in] callback A CompletionCallback to be called when + * the image has been painted on the screen. + * + * @return Returns PP_OK on success or + * PP_ERROR_BADRESOURCE if the graphics context is invalid, + * PP_ERROR_BADARGUMENT if the callback is null and flush is + * being called from the main thread of the module, or + * PP_ERROR_INPROGRESS if a flush is already pending that has + * not issued its callback yet. In the failure case, nothing will be updated + * and no callback will be scheduled. + */ + int32_t Flush( + [in] PP_Resource graphics_2d, + [in] PP_CompletionCallback callback); + + /** + * SetScale() sets the scale factor that will be applied when painting the + * graphics context onto the output device. Typically, if rendering at device + * resolution is desired, the context would be created with the width and + * height scaled up by the view's GetDeviceScale and SetScale called with a + * scale of 1.0 / GetDeviceScale(). For example, if the view resource passed + * to DidChangeView has a rectangle of (w=200, h=100) and a device scale of + * 2.0, one would call Create with a size of (w=400, h=200) and then call + * SetScale with 0.5. One would then treat each pixel in the context as a + * single device pixel. + * + * @param[in] resource A Graphics2D context resource. + * @param[in] scale The scale to apply when painting. + * + * @return Returns PP_TRUE on success or PP_FALSE if + * the resource is invalid or the scale factor is 0 or less. + */ + [version=1.1] + PP_Bool SetScale( + [in] PP_Resource resource, + [in] float_t scale); + + /*** + * GetScale() gets the scale factor that will be applied when painting the + * graphics context onto the output device. + * + * @param[in] resource A Graphics2D context resource. + * + * @return Returns the scale factor for the graphics context. If the resource + * is not a valid Graphics2D context, this will return 0.0. + */ + [version=1.1] + float_t GetScale( + [in] PP_Resource resource); + + /** + * SetLayerTransform() sets a transformation factor that will be applied for + * the current graphics context displayed on the output device. If both + * SetScale and SetLayerTransform will be used, they are going to get combined + * for the final result. + * + * This function has no effect until you call Flush(). + * + * @param[in] scale The scale to be applied. + * @param[in] origin The origin of the scale. + * @param[in] translate The translation to be applied. + * + * @return Returns PP_TRUE on success or PP_FALSE + * if the resource is invalid or the scale factor is 0 or less. + */ + [version=1.2] + PP_Bool SetLayerTransform( + [in] PP_Resource resource, + [in] float_t scale, + [in] PP_Point origin, + [in] PP_Point translate); +}; + diff --git a/browser/extensions/mortar/ppapi/api/ppb_graphics_3d.idl b/browser/extensions/mortar/ppapi/api/ppb_graphics_3d.idl new file mode 100644 index 000000000000..b39ad24e38d3 --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/ppb_graphics_3d.idl @@ -0,0 +1,298 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * Defines the PPB_Graphics3D struct representing a 3D graphics + * context within the browser. + */ + +[generate_thunk] + +label Chrome { + M15 = 1.0 +}; + +#inline c +/* Add 3D graphics enums */ +#include "ppapi/c/pp_graphics_3d.h" +#endinl + +/** + * PPB_Graphics3D defines the interface for a 3D graphics context. + * Example usage from plugin code: + * + * Setup: + * @code + * PP_Resource context; + * int32_t attribs[] = {PP_GRAPHICS3DATTRIB_WIDTH, 800, + * PP_GRAPHICS3DATTRIB_HEIGHT, 800, + * PP_GRAPHICS3DATTRIB_NONE}; + * context = g3d->Create(instance, 0, attribs); + * inst->BindGraphics(instance, context); + * @endcode + * + * Present one frame: + * @code + * PP_CompletionCallback callback = { + * DidFinishSwappingBuffers, 0, PP_COMPLETIONCALLBACK_FLAG_NONE, + * }; + * gles2->Clear(context, GL_COLOR_BUFFER_BIT); + * g3d->SwapBuffers(context, callback); + * @endcode + * + * Shutdown: + * @code + * core->ReleaseResource(context); + * @endcode + */ +[macro="PPB_GRAPHICS_3D_INTERFACE"] +interface PPB_Graphics3D { + /** + * GetAttribMaxValue() retrieves the maximum supported value for the + * given attribute. This function may be used to check if a particular + * attribute value is supported before attempting to create a context. + * + * @param[in] instance The module instance. + * @param[in] attribute The attribute for which maximum value is queried. + * Attributes that can be queried for include: + * - PP_GRAPHICS3DATTRIB_ALPHA_SIZE + * - PP_GRAPHICS3DATTRIB_BLUE_SIZE + * - PP_GRAPHICS3DATTRIB_GREEN_SIZE + * - PP_GRAPHICS3DATTRIB_RED_SIZE + * - PP_GRAPHICS3DATTRIB_DEPTH_SIZE + * - PP_GRAPHICS3DATTRIB_STENCIL_SIZE + * - PP_GRAPHICS3DATTRIB_SAMPLES + * - PP_GRAPHICS3DATTRIB_SAMPLE_BUFFERS + * - PP_GRAPHICS3DATTRIB_WIDTH + * - PP_GRAPHICS3DATTRIB_HEIGHT + * @param[out] value The maximum supported value for attribute + * + * @return Returns PP_TRUE on success or the following on error: + * - PP_ERROR_BADRESOURCE if instance is invalid + * - PP_ERROR_BADARGUMENT if attribute is invalid + * or value is 0 + */ + int32_t GetAttribMaxValue( + [in] PP_Resource instance, + [in] int32_t attribute, + [out] int32_t value); + + /** + * Create() creates and initializes a 3D rendering context. + * The returned context is off-screen to start with. It must be attached to + * a plugin instance using PPB_Instance::BindGraphics to draw + * on the web page. + * + * @param[in] instance The module instance. + * + * @param[in] share_context The 3D context with which the created context + * would share resources. If share_context is not 0, then all + * shareable data, as defined by the client API (note that for OpenGL and + * OpenGL ES, shareable data excludes texture objects named 0) will be shared + * by share_context, all other contexts share_context + * already shares with, and the newly created context. An arbitrary number of + * PPB_Graphics3D can share data in this fashion. + * + * @param[in] attrib_list specifies a list of attributes for the context. + * It is a list of attribute name-value pairs in which each attribute is + * immediately followed by the corresponding desired value. The list is + * terminated with PP_GRAPHICS3DATTRIB_NONE. + * The attrib_list may be 0 or empty (first attribute is + * PP_GRAPHICS3DATTRIB_NONE). If an attribute is not + * specified in attrib_list, then the default value is used + * (it is said to be specified implicitly). + * Attributes for the context are chosen according to an attribute-specific + * criteria. Attributes can be classified into two categories: + * - AtLeast: The attribute value in the returned context meets or exceeds + * the value specified in attrib_list. + * - Exact: The attribute value in the returned context is equal to + * the value specified in attrib_list. + * + * Attributes that can be specified in attrib_list include: + * - PP_GRAPHICS3DATTRIB_ALPHA_SIZE: + * Category: AtLeast Default: 0. + * - PP_GRAPHICS3DATTRIB_BLUE_SIZE: + * Category: AtLeast Default: 0. + * - PP_GRAPHICS3DATTRIB_GREEN_SIZE: + * Category: AtLeast Default: 0. + * - PP_GRAPHICS3DATTRIB_RED_SIZE: + * Category: AtLeast Default: 0. + * - PP_GRAPHICS3DATTRIB_DEPTH_SIZE: + * Category: AtLeast Default: 0. + * - PP_GRAPHICS3DATTRIB_STENCIL_SIZE: + * Category: AtLeast Default: 0. + * - PP_GRAPHICS3DATTRIB_SAMPLES: + * Category: AtLeast Default: 0. + * - PP_GRAPHICS3DATTRIB_SAMPLE_BUFFERS: + * Category: AtLeast Default: 0. + * - PP_GRAPHICS3DATTRIB_WIDTH: + * Category: Exact Default: 0. + * - PP_GRAPHICS3DATTRIB_HEIGHT: + * Category: Exact Default: 0. + * - PP_GRAPHICS3DATTRIB_SWAP_BEHAVIOR: + * Category: Exact Default: Implementation defined. + * + * @return A PP_Resource containing the 3D graphics context if + * successful or 0 if unsuccessful. + */ + PP_Resource Create( + [in] PP_Instance instance, + [in] PP_Resource share_context, + [in] int32_t[] attrib_list); + + /** + * IsGraphics3D() determines if the given resource is a valid + * Graphics3D context. + * + * @param[in] resource A Graphics3D context resource. + * + * @return PP_TRUE if the given resource is a valid Graphics3D, + * PP_FALSE if it is an invalid resource or is a resource of + * another type. + */ + PP_Bool IsGraphics3D( + [in] PP_Resource resource); + + /** + * GetAttribs() retrieves the value for each attribute in + * attrib_list. + * + * @param[in] context The 3D graphics context. + * @param[in,out] attrib_list The list of attributes that are queried. + * attrib_list has the same structure as described for + * PPB_Graphics3D::Create. It is both input and output + * structure for this function. All attributes specified in + * PPB_Graphics3D::Create can be queried for. + * + * @return Returns PP_OK on success or: + * - PP_ERROR_BADRESOURCE if context is invalid + * - PP_ERROR_BADARGUMENT if attrib_list is 0 or any attribute + * in the attrib_list is not a valid attribute. + * + * Example usage: To get the values for rgb bits in the + * color buffer, this function must be called as following: + * @code + * int attrib_list[] = {PP_GRAPHICS3DATTRIB_RED_SIZE, 0, + * PP_GRAPHICS3DATTRIB_GREEN_SIZE, 0, + * PP_GRAPHICS3DATTRIB_BLUE_SIZE, 0, + * PP_GRAPHICS3DATTRIB_NONE}; + * GetAttribs(context, attrib_list); + * int red_bits = attrib_list[1]; + * int green_bits = attrib_list[3]; + * int blue_bits = attrib_list[5]; + * @endcode + */ + int32_t GetAttribs( + [in] PP_Resource context, + [inout] int32_t[] attrib_list); + + /** + * SetAttribs() sets the values for each attribute in + * attrib_list. + * + * @param[in] context The 3D graphics context. + * @param[in] attrib_list The list of attributes whose values need to be set. + * attrib_list has the same structure as described for + * PPB_Graphics3D::Create. + * Attributes that can be specified are: + * - PP_GRAPHICS3DATTRIB_SWAP_BEHAVIOR + * + * @return Returns PP_OK on success or: + * - PP_ERROR_BADRESOURCE if context is invalid. + * - PP_ERROR_BADARGUMENT if attrib_list is 0 or + * any attribute in the attrib_list is not a valid attribute. + */ + int32_t SetAttribs( + [in] PP_Resource context, + [in] int32_t[] attrib_list); + + /** + * GetError() returns the current state of the given 3D context. + * + * The recoverable error conditions that have no side effect are + * detected and returned immediately by all functions in this interface. + * In addition the implementation may get into a fatal state while + * processing a command. In this case the application must destroy the + * context and reinitialize client API state and objects to continue + * rendering. + * + * Note that the same error code is also returned in the SwapBuffers callback. + * It is recommended to handle error in the SwapBuffers callback because + * GetError is synchronous. This function may be useful in rare cases where + * drawing a frame is expensive and you want to verify the result of + * ResizeBuffers before attempting to draw a frame. + * + * @param[in] The 3D graphics context. + * @return Returns: + * - PP_OK if no error + * - PP_ERROR_NOMEMORY + * - PP_ERROR_CONTEXT_LOST + */ + int32_t GetError( + [in] PP_Resource context); + + /** + * ResizeBuffers() resizes the backing surface for context. + * + * If the surface could not be resized due to insufficient resources, + * PP_ERROR_NOMEMORY error is returned on the next + * SwapBuffers callback. + * + * @param[in] context The 3D graphics context. + * @param[in] width The width of the backing surface. + * @param[in] height The height of the backing surface. + * @return Returns PP_OK on success or: + * - PP_ERROR_BADRESOURCE if context is invalid. + * - PP_ERROR_BADARGUMENT if the value specified for + * width or height is less than zero. + */ + int32_t ResizeBuffers( + [in] PP_Resource context, + [in] int32_t width, + [in] int32_t height); + + /** + * SwapBuffers() makes the contents of the color buffer available for + * compositing. This function has no effect on off-screen surfaces - ones not + * bound to any plugin instance. The contents of ancillary buffers are always + * undefined after calling SwapBuffers. The contents of the color + * buffer are undefined if the value of the + * PP_GRAPHICS3DATTRIB_SWAP_BEHAVIOR attribute of context is not + * PP_GRAPHICS3DATTRIB_BUFFER_PRESERVED. + * + * SwapBuffers runs in asynchronous mode. Specify a callback + * function and the argument for that callback function. The callback function + * will be executed on the calling thread after the color buffer has been + * composited with rest of the html page. While you are waiting for a + * SwapBuffers callback, additional calls to SwapBuffers will fail. + * + * Because the callback is executed (or thread unblocked) only when the + * plugin's current state is actually on the screen, this function provides a + * way to rate limit animations. By waiting until the image is on the screen + * before painting the next frame, you can ensure you're not generating + * updates faster than the screen can be updated. + * + * SwapBuffers performs an implicit flush operation on context. + * If the context gets into an unrecoverable error condition while + * processing a command, the error code will be returned as the argument + * for the callback. The callback may return the following error codes: + * - PP_ERROR_NOMEMORY + * - PP_ERROR_CONTEXT_LOST + * Note that the same error code may also be obtained by calling GetError. + * + * @param[in] context The 3D graphics context. + * @param[in] callback The callback that will executed when + * SwapBuffers completes. + * + * @return Returns PP_OK on success or: + * - PP_ERROR_BADRESOURCE if context is invalid. + * - PP_ERROR_BADARGUMENT if callback is invalid. + * + */ + int32_t SwapBuffers( + [in] PP_Resource context, + [in] PP_CompletionCallback callback); +}; + diff --git a/browser/extensions/mortar/ppapi/api/ppb_host_resolver.idl b/browser/extensions/mortar/ppapi/api/ppb_host_resolver.idl new file mode 100644 index 000000000000..20ff906a37f2 --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/ppb_host_resolver.idl @@ -0,0 +1,141 @@ +/* Copyright 2013 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * This file defines the PPB_HostResolver interface. + */ + +[generate_thunk] + +label Chrome { + M29 = 1.0 +}; + +/** + * PP_HostResolver_Flag is an enumeration of flags which can be + * OR-ed and passed to the host resolver. Currently there is only one flag + * defined. + */ +[assert_size(4)] +enum PP_HostResolver_Flag { + /** + * Hint to request the canonical name of the host, which can be retrieved by + * GetCanonicalName(). + */ + PP_HOSTRESOLVER_FLAG_CANONNAME = 1 << 0 +}; + +/** + * PP_HostResolver_Hint represents hints for host resolution. + */ +[assert_size(8)] +struct PP_HostResolver_Hint { + /** + * Network address family. + */ + PP_NetAddress_Family family; + /** + * Combination of flags from PP_HostResolver_Flag. + */ + int32_t flags; +}; + +/** + * The PPB_HostResolver interface supports host name + * resolution. + * + * Permissions: In order to run Resolve(), apps permission + * socket with subrule resolve-host is required. + * For more details about network communication permissions, please see: + * http://developer.chrome.com/apps/app_network.html + */ +interface PPB_HostResolver { + /** + * Creates a host resolver resource. + * + * @param[in] instance A PP_Instance identifying one instance of + * a module. + * + * @return A PP_Resource corresponding to a host reslover or 0 + * on failure. + */ + PP_Resource Create([in] PP_Instance instance); + + /** + * Determines if a given resource is a host resolver. + * + * @param[in] resource A PP_Resource to check. + * + * @return PP_TRUE if the input is a + * PPB_HostResolver resource; PP_FALSE otherwise. + */ + PP_Bool IsHostResolver([in] PP_Resource resource); + + /** + * Requests resolution of a host name. If the call completes successfully, the + * results can be retrieved by GetCanonicalName(), + * GetNetAddressCount() and GetNetAddress(). + * + * @param[in] host_resolver A PP_Resource corresponding to a host + * resolver. + * @param[in] host The host name (or IP address literal) to resolve. + * @param[in] port The port number to be set in the resulting network + * addresses. + * @param[in] hint A PP_HostResolver_Hint structure providing + * hints for host resolution. + * @param[in] callback A PP_CompletionCallback to be called upon + * completion. + * + * @return An int32_t containing an error code from pp_errors.h. + * PP_ERROR_NOACCESS will be returned if the caller doesn't have + * required permissions. PP_ERROR_NAME_NOT_RESOLVED will be + * returned if the host name couldn't be resolved. + */ + int32_t Resolve([in] PP_Resource host_resolver, + [in] str_t host, + [in] uint16_t port, + [in] PP_HostResolver_Hint hint, + [in] PP_CompletionCallback callback); + + /** + * Gets the canonical name of the host. + * + * @param[in] host_resolver A PP_Resource corresponding to a host + * resolver. + * + * @return A string PP_Var on success, which is an empty string + * if PP_HOSTRESOLVER_FLAG_CANONNAME is not set in the hint flags + * when calling Resolve(); an undefined PP_Var if + * there is a pending Resolve() call or the previous + * Resolve() call failed. + */ + PP_Var GetCanonicalName([in] PP_Resource host_resolver); + + /** + * Gets the number of network addresses. + * + * @param[in] host_resolver A PP_Resource corresponding to a host + * resolver. + * + * @return The number of available network addresses on success; 0 if there is + * a pending Resolve() call or the previous + * Resolve() call failed. + */ + uint32_t GetNetAddressCount([in] PP_Resource host_resolver); + + /** + * Gets a network address. + * + * @param[in] host_resolver A PP_Resource corresponding to a host + * resolver. + * @param[in] index An index indicating which address to return. + * + * @return A PPB_NetAddress resource on success; 0 if there is a + * pending Resolve() call or the previous Resolve() + * call failed, or the specified index is out of range. + */ + PP_Resource GetNetAddress([in] PP_Resource host_resolver, + [in] uint32_t index); +}; diff --git a/browser/extensions/mortar/ppapi/api/ppb_image_data.idl b/browser/extensions/mortar/ppapi/api/ppb_image_data.idl new file mode 100644 index 000000000000..8e1d09dc2634 --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/ppb_image_data.idl @@ -0,0 +1,188 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * This file defines the PPB_ImageData struct for determining how + * a browser handles image data. + */ + +[generate_thunk] + +label Chrome { + M14 = 1.0 +}; + +/** + * PP_ImageDataFormat is an enumeration of the different types of + * image data formats. + * + * The third part of each enumeration value describes the memory layout from + * the lowest address to the highest. For example, BGRA means the B component + * is stored in the lowest address, no matter what endianness the platform is + * using. + * + * The PREMUL suffix implies pre-multiplied alpha is used. In this mode, the + * red, green and blue color components of the pixel data supplied to an image + * data should be pre-multiplied by their alpha value. For example: starting + * with floating point color components, here is how to convert them to 8-bit + * premultiplied components for image data: + * + * ...components of a pixel, floats ranging from 0 to 1... + * float red = 1.0f; + * float green = 0.50f; + * float blue = 0.0f; + * float alpha = 0.75f; + * ...components for image data are 8-bit values ranging from 0 to 255... + * uint8_t image_data_red_premul = (uint8_t)(red * alpha * 255.0f); + * + * uint8_t image_data_green_premul = (uint8_t)(green * alpha * 255.0f); + * + * uint8_t image_data_blue_premul = (uint8_t)(blue * alpha * 255.0f); + * + * uint8_t image_data_alpha_premul = (uint8_t)(alpha * 255.0f); + * + * Note: The resulting pre-multiplied red, green and blue + * components should not be greater than the alpha value. + */ +[assert_size(4)] +enum PP_ImageDataFormat { + PP_IMAGEDATAFORMAT_BGRA_PREMUL, + PP_IMAGEDATAFORMAT_RGBA_PREMUL +}; + +/** + * The PP_ImageDataDesc structure represents a description of + * image data. + */ +[assert_size(16)] +struct PP_ImageDataDesc { + /** + * This value represents one of the image data types in the + * PP_ImageDataFormat enum. + */ + PP_ImageDataFormat format; + + /** This value represents the size of the bitmap in pixels. */ + PP_Size size; + + /** + * This value represents the row width in bytes. This may be different than + * width * 4 since there may be padding at the end of the lines. + */ + int32_t stride; +}; + +/** + * The PPB_ImageData interface contains pointers to several + * functions for determining the browser's treatment of image data. + */ +interface PPB_ImageData { + /** + * GetNativeImageDataFormat() returns the browser's preferred format for + * image data. The browser uses this format internally for painting. Other + * formats may require internal conversions to paint or may have additional + * restrictions depending on the function. + * + * @return A PP_ImageDataFormat containing the preferred format. + */ + PP_ImageDataFormat GetNativeImageDataFormat(); + + /** + * IsImageDataFormatSupported() determines if the given image data format is + * supported by the browser. Note: PP_IMAGEDATAFORMAT_BGRA_PREMUL + * and PP_IMAGEDATAFORMAT_RGBA_PREMUL formats are always + * supported. Other image formats do not make this guarantee, and should be + * checked first with IsImageDataFormatSupported() before using. + * + * @param[in] format The image data format. + * + * @return A PP_Bool with PP_TRUE if the given + * image data format is supported by the browser. + */ + PP_Bool IsImageDataFormatSupported( + [in] PP_ImageDataFormat format); + + /** + * Create() allocates an image data resource with the given format and size. + * + * For security reasons, if uninitialized, the bitmap will not contain random + * memory, but may contain data from a previous image produced by the same + * module if the bitmap was cached and re-used. + * + * @param[in] instance A PP_Instance identifying one instance + * of a module. + * @param[in] format The desired image data format. + * @param[in] size A pointer to a PP_Size containing the image + * size. + * @param[in] init_to_zero A PP_Bool to determine transparency + * at creation. + * Set the init_to_zero flag if you want the bitmap initialized + * to transparent during the creation process. If this flag is not set, the + * current contents of the bitmap will be undefined, and the module should + * be sure to set all the pixels. + * + * @return A PP_Resource with a nonzero ID on success or zero on + * failure. Failure means the instance, image size, or format was invalid. + */ + PP_Resource Create( + [in] PP_Instance instance, + [in] PP_ImageDataFormat format, + [in] PP_Size size, + [in] PP_Bool init_to_zero); + + /** + * IsImageData() determines if a given resource is image data. + * + * @param[in] image_data A PP_Resource corresponding to image + * data. + * + * @return A PP_Bool with PP_TRUE if the given + * resource is an image data or PP_FALSE if the resource is + * invalid or some type other than image data. + */ + PP_Bool IsImageData( + [in] PP_Resource image_data); + + /** + * Describe() computes the description of the + * image data. + * + * @param[in] image_data A PP_Resource corresponding to image + * data. + * @param[in,out] desc A pointer to a PP_ImageDataDesc + * containing the description. + * + * @return A PP_Bool with PP_TRUE on success or + * PP_FALSE if the resource is not an image data. On + * PP_FALSE, the desc structure will be filled + * with 0. + */ + [always_set_output_parameters] + PP_Bool Describe( + [in] PP_Resource image_data, + [out] PP_ImageDataDesc desc); + + /** + * Map() maps an image data into the module address space. + * + * @param[in] image_data A PP_Resource corresponding to image + * data. + * + * @return A pointer to the beginning of the data. + */ + mem_t Map( + [in] PP_Resource image_data); + + /** + * Unmap is a pointer to a function that unmaps an image data from the module + * address space. + * + * @param[in] image_data A PP_Resource corresponding to image + * data. + */ + void Unmap( + [in] PP_Resource image_data); +}; + diff --git a/browser/extensions/mortar/ppapi/api/ppb_input_event.idl b/browser/extensions/mortar/ppapi/api/ppb_input_event.idl new file mode 100644 index 000000000000..b737a2e4832b --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/ppb_input_event.idl @@ -0,0 +1,1085 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * This file defines the Input Event interfaces. + */ + +label Chrome { + M13 = 1.0, + M14 = 1.1, + M34 = 1.2, + M55 = 1.3 +}; + +/** + * This enumeration contains the types of input events. + */ +[assert_size(4)] +enum PP_InputEvent_Type { + PP_INPUTEVENT_TYPE_UNDEFINED = -1, + + /** + * Notification that a mouse button was pressed. + * + * Register for this event using the PP_INPUTEVENT_CLASS_MOUSE class. + */ + PP_INPUTEVENT_TYPE_MOUSEDOWN = 0, + + /** + * Notification that a mouse button was released. + * + * Register for this event using the PP_INPUTEVENT_CLASS_MOUSE class. + */ + PP_INPUTEVENT_TYPE_MOUSEUP = 1, + + /** + * Notification that a mouse button was moved when it is over the instance + * or dragged out of it. + * + * Register for this event using the PP_INPUTEVENT_CLASS_MOUSE class. + */ + PP_INPUTEVENT_TYPE_MOUSEMOVE = 2, + + /** + * Notification that the mouse entered the instance's bounds. + * + * Register for this event using the PP_INPUTEVENT_CLASS_MOUSE class. + */ + PP_INPUTEVENT_TYPE_MOUSEENTER = 3, + + /** + * Notification that a mouse left the instance's bounds. + * + * Register for this event using the PP_INPUTEVENT_CLASS_MOUSE class. + */ + PP_INPUTEVENT_TYPE_MOUSELEAVE = 4, + + /** + * Notification that the scroll wheel was used. + * + * Register for this event using the PP_INPUTEVENT_CLASS_WHEEL class. + */ + PP_INPUTEVENT_TYPE_WHEEL = 5, + + /** + * Notification that a key transitioned from "up" to "down". + * + * Register for this event using the PP_INPUTEVENT_CLASS_KEYBOARD class. + */ + PP_INPUTEVENT_TYPE_RAWKEYDOWN = 6, + + /** + * Notification that a key was pressed. This does not necessarily correspond + * to a character depending on the key and language. Use the + * PP_INPUTEVENT_TYPE_CHAR for character input. + * + * Register for this event using the PP_INPUTEVENT_CLASS_KEYBOARD class. + */ + PP_INPUTEVENT_TYPE_KEYDOWN = 7, + + /** + * Notification that a key was released. + * + * Register for this event using the PP_INPUTEVENT_CLASS_KEYBOARD class. + */ + PP_INPUTEVENT_TYPE_KEYUP = 8, + + /** + * Notification that a character was typed. Use this for text input. Key + * down events may generate 0, 1, or more than one character event depending + * on the key, locale, and operating system. + * + * Register for this event using the PP_INPUTEVENT_CLASS_KEYBOARD class. + */ + PP_INPUTEVENT_TYPE_CHAR = 9, + + /** + * Notification that a context menu should be shown. + * + * This message will be sent when the user right-clicks or performs another + * OS-specific mouse command that should open a context menu. When this event + * is delivered depends on the system, on some systems (Mac) it will + * delivered after the mouse down event, and on others (Windows) it will be + * delivered after the mouse up event. + * + * You will always get the normal mouse events. For example, you may see + * MOUSEDOWN,CONTEXTMENU,MOUSEUP or MOUSEDOWN,MOUSEUP,CONTEXTMENU. + * + * The return value from the event handler determines if the context menu + * event will be passed to the page when you are using filtered input events + * (via RequestFilteringInputEvents()). In non-filtering mode the event will + * never be propagated and no context menu will be displayed. If you are + * handling mouse events in filtering mode, you may want to return true from + * this event even if you do not support a context menu to suppress the + * default one. + * + * Register for this event using the PP_INPUTEVENT_CLASS_MOUSE class. + */ + PP_INPUTEVENT_TYPE_CONTEXTMENU = 10, + + /** + * Notification that an input method composition process has just started. + * + * Register for this event using the PP_INPUTEVENT_CLASS_IME class. + */ + PP_INPUTEVENT_TYPE_IME_COMPOSITION_START = 11, + + /** + * Notification that the input method composition string is updated. + * + * Register for this event using the PP_INPUTEVENT_CLASS_IME class. + */ + PP_INPUTEVENT_TYPE_IME_COMPOSITION_UPDATE = 12, + + /** + * Notification that an input method composition process has completed. + * + * Register for this event using the PP_INPUTEVENT_CLASS_IME class. + */ + PP_INPUTEVENT_TYPE_IME_COMPOSITION_END = 13, + + /** + * Notification that an input method committed a string. + * + * Register for this event using the PP_INPUTEVENT_CLASS_IME class. + */ + PP_INPUTEVENT_TYPE_IME_TEXT = 14, + + /** + * Notification that a finger was placed on a touch-enabled device. + * + * Register for this event using the PP_INPUTEVENT_CLASS_TOUCH class. + */ + PP_INPUTEVENT_TYPE_TOUCHSTART = 15, + + /** + * Notification that a finger was moved on a touch-enabled device. + * + * Register for this event using the PP_INPUTEVENT_CLASS_TOUCH class. + */ + PP_INPUTEVENT_TYPE_TOUCHMOVE = 16, + + /** + * Notification that a finger was released on a touch-enabled device. + * + * Register for this event using the PP_INPUTEVENT_CLASS_TOUCH class. + */ + PP_INPUTEVENT_TYPE_TOUCHEND = 17, + + /** + * Notification that a touch event was canceled. + * + * Register for this event using the PP_INPUTEVENT_CLASS_TOUCH class. + */ + PP_INPUTEVENT_TYPE_TOUCHCANCEL = 18 +}; + +/** + * This enumeration contains event modifier constants. Each modifier is one + * bit. Retrieve the modifiers from an input event using the GetEventModifiers + * function on PPB_InputEvent. + */ +[assert_size(4)] +enum PP_InputEvent_Modifier { + PP_INPUTEVENT_MODIFIER_SHIFTKEY = 1 << 0, + PP_INPUTEVENT_MODIFIER_CONTROLKEY = 1 << 1, + PP_INPUTEVENT_MODIFIER_ALTKEY = 1 << 2, + PP_INPUTEVENT_MODIFIER_METAKEY = 1 << 3, + PP_INPUTEVENT_MODIFIER_ISKEYPAD = 1 << 4, + PP_INPUTEVENT_MODIFIER_ISAUTOREPEAT = 1 << 5, + PP_INPUTEVENT_MODIFIER_LEFTBUTTONDOWN = 1 << 6, + PP_INPUTEVENT_MODIFIER_MIDDLEBUTTONDOWN = 1 << 7, + PP_INPUTEVENT_MODIFIER_RIGHTBUTTONDOWN = 1 << 8, + PP_INPUTEVENT_MODIFIER_CAPSLOCKKEY = 1 << 9, + PP_INPUTEVENT_MODIFIER_NUMLOCKKEY = 1 << 10, + PP_INPUTEVENT_MODIFIER_ISLEFT = 1 << 11, + PP_INPUTEVENT_MODIFIER_ISRIGHT = 1 << 12, + [version=1.3] + PP_INPUTEVENT_MODIFIER_ISPEN = 1 << 13, + [version=1.3] + PP_INPUTEVENT_MODIFIER_ISERASER = 1 << 14 +}; + +/** + * This enumeration contains constants representing each mouse button. To get + * the mouse button for a mouse down or up event, use GetMouseButton on + * PPB_InputEvent. + */ +[assert_size(4)] +enum PP_InputEvent_MouseButton { + PP_INPUTEVENT_MOUSEBUTTON_NONE = -1, + PP_INPUTEVENT_MOUSEBUTTON_LEFT = 0, + PP_INPUTEVENT_MOUSEBUTTON_MIDDLE = 1, + PP_INPUTEVENT_MOUSEBUTTON_RIGHT = 2 +}; + +[assert_size(4)] +enum PP_InputEvent_Class { + /** + * Request mouse input events. + * + * Normally you will request mouse events by calling RequestInputEvents(). + * The only use case for filtered events (via RequestFilteringInputEvents()) + * is for instances that have irregular outlines and you want to perform hit + * testing, which is very uncommon. Requesting non-filtered mouse events will + * lead to higher performance. + */ + PP_INPUTEVENT_CLASS_MOUSE = 1 << 0, + + /** + * Requests keyboard events. Often you will want to request filtered mode + * (via RequestFilteringInputEvents) for keyboard events so you can pass on + * events (by returning false) that you don't handle. For example, if you + * don't request filtered mode and the user pressed "Page Down" when your + * instance has focus, the page won't scroll which will be a poor experience. + * + * A small number of tab and window management commands like Alt-F4 are never + * sent to the page. You can not request these keyboard commands since it + * would allow pages to trap users on a page. + */ + PP_INPUTEVENT_CLASS_KEYBOARD = 1 << 1, + + /** + * Identifies scroll wheel input event. Wheel events must be requested in + * filtering mode via RequestFilteringInputEvents(). This is because many + * wheel commands should be forwarded to the page. + * + * Most instances will not need this event. Consuming wheel events by + * returning true from your filtered event handler will prevent the user from + * scrolling the page when the mouse is over the instance which can be very + * annoying. + * + * If you handle wheel events (for example, you have a document viewer which + * the user can scroll), the recommended behavior is to return false only if + * the wheel event actually causes your document to scroll. When the user + * reaches the end of the document, return false to indicating that the event + * was not handled. This will then forward the event to the containing page + * for scrolling, producing the nested scrolling behavior users expect from + * frames in a page. + */ + PP_INPUTEVENT_CLASS_WHEEL = 1 << 2, + + /** + * Identifies touch input events. + * + * Request touch events only if you intend to handle them. If the browser + * knows you do not need to handle touch events, it can handle them at a + * higher level and achieve higher performance. If the plugin does not + * register for touch-events, then it will receive synthetic mouse events that + * are generated from the touch events (e.g. mouse-down for touch-start, + * mouse-move for touch-move (with left-button down), and mouse-up for + * touch-end. If the plugin does register for touch events, then the synthetic + * mouse events are not created. + */ + PP_INPUTEVENT_CLASS_TOUCH = 1 << 3, + + /** + * Identifies IME composition input events. + * + * Request this input event class if you allow on-the-spot IME input. + */ + PP_INPUTEVENT_CLASS_IME = 1 << 4 +}; + +/** + * The PPB_InputEvent interface contains pointers to several + * functions related to generic input events on the browser. + */ +[version=1.0, macro="PPB_INPUT_EVENT_INTERFACE"] +interface PPB_InputEvent { + /** + * RequestInputEvent() requests that input events corresponding to the given + * input events are delivered to the instance. + * + * It's recommended that you use RequestFilteringInputEvents() for keyboard + * events instead of this function so that you don't interfere with normal + * browser accelerators. + * + * By default, no input events are delivered. Call this function with the + * classes of events you are interested in to have them be delivered to + * the instance. Calling this function will override any previous setting for + * each specified class of input events (for example, if you previously + * called RequestFilteringInputEvents(), this function will set those events + * to non-filtering mode). + * + * Input events may have high overhead, so you should only request input + * events that your plugin will actually handle. For example, the browser may + * do optimizations for scroll or touch events that can be processed + * substantially faster if it knows there are no non-default receivers for + * that message. Requesting that such messages be delivered, even if they are + * processed very quickly, may have a noticeable effect on the performance of + * the page. + * + * Note that synthetic mouse events will be generated from touch events if + * (and only if) you do not request touch events. + * + * When requesting input events through this function, the events will be + * delivered and not bubbled to the default handlers. + * + * Example: + * @code + * RequestInputEvents(instance, PP_INPUTEVENT_CLASS_MOUSE); + * RequestFilteringInputEvents(instance, + * PP_INPUTEVENT_CLASS_WHEEL | PP_INPUTEVENT_CLASS_KEYBOARD); + * @endcode + * + * @param instance The PP_Instance of the instance requesting + * the given events. + * + * @param event_classes A combination of flags from + * PP_InputEvent_Class that identifies the classes of events the + * instance is requesting. The flags are combined by logically ORing their + * values. + * + * @return PP_OK if the operation succeeded, + * PP_ERROR_BADARGUMENT if instance is invalid, or + * PP_ERROR_NOTSUPPORTED if one of the event class bits were + * illegal. In the case of an invalid bit, all valid bits will be applied + * and only the illegal bits will be ignored. The most common cause of a + * PP_ERROR_NOTSUPPORTED return value is requesting keyboard + * events, these must use RequestFilteringInputEvents(). + */ + int32_t RequestInputEvents([in] PP_Instance instance, + [in] uint32_t event_classes); + + /** + * RequestFilteringInputEvents() requests that input events corresponding to + * the given input events are delivered to the instance for filtering. + * + * By default, no input events are delivered. In most cases you would + * register to receive events by calling RequestInputEvents(). In some cases, + * however, you may wish to filter events such that they can be bubbled up + * to the default handlers. In this case, register for those classes of + * events using this function instead of RequestInputEvents(). + * + * Filtering input events requires significantly more overhead than just + * delivering them to the instance. As such, you should only request + * filtering in those cases where it's absolutely necessary. The reason is + * that it requires the browser to stop and block for the instance to handle + * the input event, rather than sending the input event asynchronously. This + * can have significant overhead. + * + * Example: + * @code + * RequestInputEvents(instance, PP_INPUTEVENT_CLASS_MOUSE); + * RequestFilteringInputEvents(instance, + * PP_INPUTEVENT_CLASS_WHEEL | PP_INPUTEVENT_CLASS_KEYBOARD); + * @endcode + * + * @return PP_OK if the operation succeeded, + * PP_ERROR_BADARGUMENT if instance is invalid, or + * PP_ERROR_NOTSUPPORTED if one of the event class bits were + * illegal. In the case of an invalid bit, all valid bits will be applied + * and only the illegal bits will be ignored. + */ + int32_t RequestFilteringInputEvents([in] PP_Instance instance, + [in] uint32_t event_classes); + + /** + * ClearInputEventRequest() requests that input events corresponding to the + * given input classes no longer be delivered to the instance. + * + * By default, no input events are delivered. If you have previously + * requested input events via RequestInputEvents() or + * RequestFilteringInputEvents(), this function will unregister handling + * for the given instance. This will allow greater browser performance for + * those events. + * + * Note that you may still get some input events after clearing the flag if + * they were dispatched before the request was cleared. For example, if + * there are 3 mouse move events waiting to be delivered, and you clear the + * mouse event class during the processing of the first one, you'll still + * receive the next two. You just won't get more events generated. + * + * @param instance The PP_Instance of the instance requesting + * to no longer receive the given events. + * + * @param event_classes A combination of flags from + * PP_InputEvent_Class that identify the classes of events the + * instance is no longer interested in. + */ + void ClearInputEventRequest([in] PP_Instance instance, + [in] uint32_t event_classes); + + /** + * IsInputEvent() returns true if the given resource is a valid input event + * resource. + * + * @param[in] resource A PP_Resource corresponding to a generic + * resource. + * + * @return PP_TRUE if the given resource is a valid input event + * resource. + */ + PP_Bool IsInputEvent([in] PP_Resource resource); + + /** + * GetType() returns the type of input event for the given input event + * resource. + * + * @param[in] resource A PP_Resource corresponding to an input + * event. + * + * @return A PP_InputEvent_Type if its a valid input event or + * PP_INPUTEVENT_TYPE_UNDEFINED if the resource is invalid. + */ + PP_InputEvent_Type GetType([in] PP_Resource event); + + /** + * GetTimeStamp() Returns the time that the event was generated. This will be + * before the current time since processing and dispatching the event has + * some overhead. Use this value to compare the times the user generated two + * events without being sensitive to variable processing time. + * + * @param[in] resource A PP_Resource corresponding to the event. + * + * @return The return value is in time ticks, which is a monotonically + * increasing clock not related to the wall clock time. It will not change + * if the user changes their clock or daylight savings time starts, so can + * be reliably used to compare events. This means, however, that you can't + * correlate event times to a particular time of day on the system clock. + */ + PP_TimeTicks GetTimeStamp([in] PP_Resource event); + + /** + * GetModifiers() returns a bitfield indicating which modifiers were down + * at the time of the event. This is a combination of the flags in the + * PP_InputEvent_Modifier enum. + * + * @param[in] resource A PP_Resource corresponding to an input + * event. + * + * @return The modifiers associated with the event, or 0 if the given + * resource is not a valid event resource. + */ + uint32_t GetModifiers([in] PP_Resource event); +}; + +/** + * The PPB_MouseInputEvent interface contains pointers to several + * functions related to mouse input events. + */ +[macro="PPB_MOUSE_INPUT_EVENT_INTERFACE"] +interface PPB_MouseInputEvent { + /** + * Create() creates a mouse input event with the given parameters. Normally + * you will get a mouse event passed through the + * HandleInputEvent and will not need to create them, but some + * applications may want to create their own for internal use. The type must + * be one of the mouse event types. + * + * @param[in] instance The instance for which this event occurred. + * + * @param[in] type A PP_InputEvent_Type identifying the type of + * input event. + * + * @param[in] time_stamp A PP_TimeTicks indicating the time + * when the event occurred. + * + * @param[in] modifiers A bit field combination of the + * PP_InputEvent_Modifier flags. + * + * @param[in] mouse_button The button that changed for mouse down or up + * events. This value will be PP_EVENT_MOUSEBUTTON_NONE for + * mouse move, enter, and leave events. + * + * @param[in] mouse_position A Point containing the x and y + * position of the mouse when the event occurred. + * + * @return A PP_Resource containing the new mouse input event. + */ + PP_Resource Create([in] PP_Instance instance, + [in] PP_InputEvent_Type type, + [in] PP_TimeTicks time_stamp, + [in] uint32_t modifiers, + [in] PP_InputEvent_MouseButton mouse_button, + [in] PP_Point mouse_position, + [in] int32_t click_count); + + /** + * Create() creates a mouse input event with the given parameters. Normally + * you will get a mouse event passed through the + * HandleInputEvent and will not need to create them, but some + * applications may want to create their own for internal use. The type must + * be one of the mouse event types. + * + * @param[in] instance The instance for which this event occurred. + * + * @param[in] type A PP_InputEvent_Type identifying the type of + * input event. + * + * @param[in] time_stamp A PP_TimeTicks indicating the time + * when the event occurred. + * + * @param[in] modifiers A bit field combination of the + * PP_InputEvent_Modifier flags. + * + * @param[in] mouse_button The button that changed for mouse down or up + * events. This value will be PP_EVENT_MOUSEBUTTON_NONE for + * mouse move, enter, and leave events. + * + * @param[in] mouse_position A Point containing the x and y + * position of the mouse when the event occurred. + * + * @param[in] mouse_movement The change in position of the mouse. + * + * @return A PP_Resource containing the new mouse input event. + */ + [version=1.1] + PP_Resource Create([in] PP_Instance instance, + [in] PP_InputEvent_Type type, + [in] PP_TimeTicks time_stamp, + [in] uint32_t modifiers, + [in] PP_InputEvent_MouseButton mouse_button, + [in] PP_Point mouse_position, + [in] int32_t click_count, + [in] PP_Point mouse_movement); + /** + * IsMouseInputEvent() determines if a resource is a mouse event. + * + * @param[in] resource A PP_Resource corresponding to an event. + * + * @return PP_TRUE if the given resource is a valid mouse input + * event, otherwise PP_FALSE. + */ + PP_Bool IsMouseInputEvent([in] PP_Resource resource); + + /** + * GetButton() returns the mouse button that generated a mouse down or up + * event. + * + * @param[in] mouse_event A PP_Resource corresponding to a + * mouse event. + * + * @return The mouse button associated with mouse down and up events. This + * value will be PP_EVENT_MOUSEBUTTON_NONE for mouse move, + * enter, and leave events, and for all non-mouse events. + */ + PP_InputEvent_MouseButton GetButton([in] PP_Resource mouse_event); + + /** + * GetPosition() returns the pixel location of a mouse input event. When + * the mouse is locked, it returns the last known mouse position just as + * mouse lock was entered. + * + * @param[in] mouse_event A PP_Resource corresponding to a + * mouse event. + * + * @return The point associated with the mouse event, relative to the upper- + * left of the instance receiving the event. These values can be negative for + * mouse drags. The return value will be (0, 0) for non-mouse events. + */ + [returnByValue] PP_Point GetPosition([in] PP_Resource mouse_event); + + int32_t GetClickCount([in] PP_Resource mouse_event); + + /** + * Returns the change in position of the mouse. When the mouse is locked, + * although the mouse position doesn't actually change, this function + * still provides movement information, which indicates what the change in + * position would be had the mouse not been locked. + * + * @param[in] mouse_event A PP_Resource corresponding to a + * mouse event. + * + * @return The change in position of the mouse, relative to the previous + * position. + */ + [version=1.1] + PP_Point GetMovement([in] PP_Resource mouse_event); +}; + + +/** + * The PPB_WheelIputEvent interface contains pointers to several + * functions related to wheel input events. + */ +[version=1.0, macro="PPB_WHEEL_INPUT_EVENT_INTERFACE"] +interface PPB_WheelInputEvent { + /** + * Create() creates a wheel input event with the given parameters. Normally + * you will get a wheel event passed through the + * HandleInputEvent and will not need to create them, but some + * applications may want to create their own for internal use. + * + * @param[in] instance The instance for which this event occurred. + * + * @param[in] time_stamp A PP_TimeTicks indicating the time + * when the event occurred. + * + * @param[in] modifiers A bit field combination of the + * PP_InputEvent_Modifier flags. + * + * @param[in] wheel_delta The scroll wheel's horizontal and vertical scroll + * amounts. + * + * @param[in] wheel_ticks The number of "clicks" of the scroll wheel that + * have produced the event. + * + * @param[in] scroll_by_page When true, the user is requesting to scroll + * by pages. When false, the user is requesting to scroll by lines. + * + * @return A PP_Resource containing the new wheel input event. + */ + PP_Resource Create([in] PP_Instance instance, + [in] PP_TimeTicks time_stamp, + [in] uint32_t modifiers, + [in] PP_FloatPoint wheel_delta, + [in] PP_FloatPoint wheel_ticks, + [in] PP_Bool scroll_by_page); + + /** + * IsWheelInputEvent() determines if a resource is a wheel event. + * + * @param[in] wheel_event A PP_Resource corresponding to an + * event. + * + * @return PP_TRUE if the given resource is a valid wheel input + * event. + */ + PP_Bool IsWheelInputEvent([in] PP_Resource resource); + + /** + * GetDelta() returns the amount vertically and horizontally the user has + * requested to scroll by with their mouse wheel. A scroll down or to the + * right (where the content moves up or left) is represented as positive + * values, and a scroll up or to the left (where the content moves down or + * right) is represented as negative values. + * + * This amount is system dependent and will take into account the user's + * preferred scroll sensitivity and potentially also nonlinear acceleration + * based on the speed of the scrolling. + * + * Devices will be of varying resolution. Some mice with large detents will + * only generate integer scroll amounts. But fractional values are also + * possible, for example, on some trackpads and newer mice that don't have + * "clicks". + * + * @param[in] wheel_event A PP_Resource corresponding to a wheel + * event. + * + * @return The vertical and horizontal scroll values. The units are either in + * pixels (when scroll_by_page is false) or pages (when scroll_by_page is + * true). For example, y = -3 means scroll up 3 pixels when scroll_by_page + * is false, and scroll up 3 pages when scroll_by_page is true. + */ + PP_FloatPoint GetDelta([in] PP_Resource wheel_event); + + /** + * GetTicks() returns the number of "clicks" of the scroll wheel + * that have produced the event. The value may have system-specific + * acceleration applied to it, depending on the device. The positive and + * negative meanings are the same as for GetDelta(). + * + * If you are scrolling, you probably want to use the delta values. These + * tick events can be useful if you aren't doing actual scrolling and don't + * want or pixel values. An example may be cycling between different items in + * a game. + * + * @param[in] wheel_event A PP_Resource corresponding to a wheel + * event. + * + * @return The number of "clicks" of the scroll wheel. You may receive + * fractional values for the wheel ticks if the mouse wheel is high + * resolution or doesn't have "clicks". If your program wants discrete + * events (as in the "picking items" example) you should accumulate + * fractional click values from multiple messages until the total value + * reaches positive or negative one. This should represent a similar amount + * of scrolling as for a mouse that has a discrete mouse wheel. + */ + PP_FloatPoint GetTicks([in] PP_Resource wheel_event); + + /** + * GetScrollByPage() indicates if the scroll delta x/y indicates pages or + * lines to scroll by. + * + * @param[in] wheel_event A PP_Resource corresponding to a wheel + * event. + * + * @return PP_TRUE if the event is a wheel event and the user is + * scrolling by pages. PP_FALSE if not or if the resource is not + * a wheel event. + */ + PP_Bool GetScrollByPage([in] PP_Resource wheel_event); +}; + +/** + * The PPB_KeyboardInputEvent interface contains pointers to + * several functions related to keyboard input events. + */ +[version=1.0, macro="PPB_KEYBOARD_INPUT_EVENT_INTERFACE"] +interface PPB_KeyboardInputEvent { + /** + * Creates a keyboard input event with the given parameters. Normally you + * will get a keyboard event passed through the HandleInputEvent and will not + * need to create them, but some applications may want to create their own + * for internal use. The type must be one of the keyboard event types. + * + * @param[in] instance The instance for which this event occurred. + * + * @param[in] type A PP_InputEvent_Type identifying the type of + * input event. + * + * @param[in] time_stamp A PP_TimeTicks indicating the time + * when the event occurred. + * + * @param[in] modifiers A bit field combination of the + * PP_InputEvent_Modifier flags. + * + * @param[in] key_code This value reflects the DOM KeyboardEvent + * keyCode field, which is the Windows-style Virtual Key + * code of the key. + * + * @param[in] character_text This value represents the typed character as a + * UTF-8 string. + * + * @return A PP_Resource containing the new keyboard input + * event. + */ + [deprecate=1.2] + PP_Resource Create([in] PP_Instance instance, + [in] PP_InputEvent_Type type, + [in] PP_TimeTicks time_stamp, + [in] uint32_t modifiers, + [in] uint32_t key_code, + [in] PP_Var character_text); + + /** + * Creates a keyboard input event with the given parameters. Normally you + * will get a keyboard event passed through the HandleInputEvent and will not + * need to create them, but some applications may want to create their own + * for internal use. The type must be one of the keyboard event types. + * + * @param[in] instance The instance for which this event occurred. + * + * @param[in] type A PP_InputEvent_Type identifying the type of + * input event. + * + * @param[in] time_stamp A PP_TimeTicks indicating the time + * when the event occurred. + * + * @param[in] modifiers A bit field combination of the + * PP_InputEvent_Modifier flags. + * + * @param[in] key_code This value reflects the DOM KeyboardEvent + * keyCode field, which is the Windows-style Virtual Key + * code of the key. + * + * @param[in] character_text This value represents the typed character as a + * UTF-8 string. + * + * @param[in] code This value represents the DOM3 |code| string that + * corresponds to the physical key being pressed. + * + * @return A PP_Resource containing the new keyboard input + * event. + */ + [version=1.2] + PP_Resource Create([in] PP_Instance instance, + [in] PP_InputEvent_Type type, + [in] PP_TimeTicks time_stamp, + [in] uint32_t modifiers, + [in] uint32_t key_code, + [in] PP_Var character_text, + [in] PP_Var code); + + /** + * IsKeyboardInputEvent() determines if a resource is a keyboard event. + * + * @param[in] resource A PP_Resource corresponding to an event. + * + * @return PP_TRUE if the given resource is a valid input event. + */ + PP_Bool IsKeyboardInputEvent([in] PP_Resource resource); + + /** + * GetKeyCode() returns the DOM keyCode field for the keyboard event. + * Chrome populates this with the Windows-style Virtual Key code of the key. + * + * @param[in] key_event A PP_Resource corresponding to a + * keyboard event. + * + * @return The DOM keyCode field for the keyboard event. + */ + uint32_t GetKeyCode([in] PP_Resource key_event); + + /** + * GetCharacterText() returns the typed character as a UTF-8 string for the + * given character event. + * + * @param[in] character_event A PP_Resource corresponding to a + * keyboard event. + * + * @return A string var representing a single typed character for character + * input events. For non-character input events the return value will be an + * undefined var. + */ + PP_Var GetCharacterText([in] PP_Resource character_event); + + /** + * GetCode() returns the DOM |code| field for this keyboard event, as + * defined in the DOM3 Events spec: + * http://www.w3.org/TR/DOM-Level-3-Events/ + * + * @param[in] key_event The key event for which to return the key code. + * + * @return The string that contains the DOM |code| for the keyboard event. + */ + [version=1.2] + PP_Var GetCode([in] PP_Resource key_event); +}; + +[assert_size(4)] +enum PP_TouchListType { + /** + * The list of all TouchPoints which are currently down. + */ + PP_TOUCHLIST_TYPE_TOUCHES = 0, + + /** + * The list of all TouchPoints whose state has changed since the last + * TouchInputEvent. + */ + PP_TOUCHLIST_TYPE_CHANGEDTOUCHES = 1, + + /** + * The list of all TouchPoints which are targeting this plugin. This is a + * subset of Touches. + */ + PP_TOUCHLIST_TYPE_TARGETTOUCHES = 2 +}; + +/** + * The PPB_TouchInputEvent interface contains pointers to several + * functions related to touch events. + */ +[version=1.0, macro="PPB_TOUCH_INPUT_EVENT_INTERFACE"] +interface PPB_TouchInputEvent { + /** + * Creates a touch input event with the given parameters. Normally you + * will get a touch event passed through the HandleInputEvent and will not + * need to create them, but some applications may want to create their own + * for internal use. The type must be one of the touch event types. + * This newly created touch input event does not have any touch point in any + * of the touch-point lists. AddTouchPoint should be called to + * add the touch-points. + * + * @param[in] instance The instance for which this event occurred. + * + * @param[in] type A PP_InputEvent_Type identifying the type of + * input event. + * + * @param[in] time_stamp A PP_TimeTicks indicating the time + * when the event occurred. + * + * @param[in] modifiers A bit field combination of the + * PP_InputEvent_Modifier flags. + * + * @return A PP_Resource containing the new touch input event. + */ + PP_Resource Create([in] PP_Instance instance, + [in] PP_InputEvent_Type type, + [in] PP_TimeTicks time_stamp, + [in] uint32_t modifiers); + + /** + * Adds a touch point to the touch event in the specified touch-list. + * + * @param[in] touch_event A PP_Resource corresponding to a touch + * event. + * + * @param[in] list The list to add the touch point to. + * + * @param[in] point The point to add to the list. + */ + void AddTouchPoint([in] PP_Resource touch_event, + [in] PP_TouchListType list, + [in] PP_TouchPoint point); + + /** + * IsTouchInputEvent() determines if a resource is a touch event. + * + * @param[in] resource A PP_Resource corresponding to an event. + * + * @return PP_TRUE if the given resource is a valid touch input + * event, otherwise PP_FALSE. + */ + PP_Bool IsTouchInputEvent([in] PP_Resource resource); + + /** + * Returns the number of touch-points in the specified list. + * + * @param[in] resource A PP_Resource corresponding to a touch + * event. + * + * @param[in] list The list. + * + * @return The number of touch-points in the specified list. + */ + uint32_t GetTouchCount([in] PP_Resource resource, + [in] PP_TouchListType list); + + /** + * Returns the touch-point at the specified index from the specified list. + * + * @param[in] resource A PP_Resource corresponding to a touch + * event. + * + * @param[in] list The list. + * + * @param[in] index The index. + * + * @return A PP_TouchPoint representing the touch-point. + */ + PP_TouchPoint GetTouchByIndex([in] PP_Resource resource, + [in] PP_TouchListType list, + [in] uint32_t index); + + /** + * Returns the touch-point with the specified touch-id in the specified list. + * + * @param[in] resource A PP_Resource corresponding to a touch + * event. + * + * @param[in] list The list. + * + * @param[in] touch_id The id of the touch-point. + * + * @return A PP_TouchPoint representing the touch-point. + */ + PP_TouchPoint GetTouchById([in] PP_Resource resource, + [in] PP_TouchListType list, + [in] uint32_t touch_id); +}; + +[macro="PPB_IME_INPUT_EVENT_INTERFACE"] +interface PPB_IMEInputEvent { + /** + * Create() creates an IME input event with the given parameters. Normally + * you will get an IME event passed through the HandleInputEvent + * and will not need to create them, but some applications may want to create + * their own for internal use. + * + * @param[in] instance The instance for which this event occurred. + * + * @param[in] type A PP_InputEvent_Type identifying the type of + * input event. The type must be one of the IME event types. + * + * @param[in] time_stamp A PP_TimeTicks indicating the time + * when the event occurred. + * + * @param[in] text The string returned by GetText. + * + * @param[in] segment_number The number returned by + * GetSegmentNumber. + * + * @param[in] segment_offsets The array of numbers returned by + * GetSegmentOffset. If segment_number is zero, + * the number of elements of the array should be zero. If + * segment_number is non-zero, the length of the array must be + * segment_number + 1. + * + * @param[in] target_segment The number returned by + * GetTargetSegment. + * + * @param[in] selection_start The start index returned by + * GetSelection. + * + * @param[in] selection_end The end index returned by + * GetSelection. + * + * @return A PP_Resource containing the new IME input event. + */ + PP_Resource Create([in] PP_Instance instance, + [in] PP_InputEvent_Type type, + [in] PP_TimeTicks time_stamp, + [in] PP_Var text, + [in] uint32_t segment_number, + [in] uint32_t[] segment_offsets, + [in] int32_t target_segment, + [in] uint32_t selection_start, + [in] uint32_t selection_end); + + /** + * IsIMEInputEvent() determines if a resource is an IME event. + * + * @param[in] resource A PP_Resource corresponding to an event. + * + * @return PP_TRUE if the given resource is a valid input event. + */ + PP_Bool IsIMEInputEvent([in] PP_Resource resource); + + /** + * GetText() returns the composition text as a UTF-8 string for the given IME + * event. + * + * @param[in] ime_event A PP_Resource corresponding to an IME + * event. + * + * @return A string var representing the composition text. For non-IME input + * events the return value will be an undefined var. + */ + PP_Var GetText([in] PP_Resource ime_event); + + /** + * GetSegmentNumber() returns the number of segments in the composition text. + * + * @param[in] ime_event A PP_Resource corresponding to an IME + * event. + * + * @return The number of segments. For events other than COMPOSITION_UPDATE, + * returns 0. + */ + uint32_t GetSegmentNumber([in] PP_Resource ime_event); + + /** + * GetSegmentOffset() returns the position of the index-th segmentation point + * in the composition text. The position is given by a byte-offset (not a + * character-offset) of the string returned by GetText(). It always satisfies + * 0=GetSegmentOffset(0) < ... < GetSegmentOffset(i) < GetSegmentOffset(i+1) + * < ... < GetSegmentOffset(GetSegmentNumber())=(byte-length of GetText()). + * Note that [GetSegmentOffset(i), GetSegmentOffset(i+1)) represents the range + * of the i-th segment, and hence GetSegmentNumber() can be a valid argument + * to this function instead of an off-by-1 error. + * + * @param[in] ime_event A PP_Resource corresponding to an IME + * event. + * + * @param[in] index An integer indicating a segment. + * + * @return The byte-offset of the segmentation point. If the event is not + * COMPOSITION_UPDATE or index is out of range, returns 0. + */ + uint32_t GetSegmentOffset([in] PP_Resource ime_event, + [in] uint32_t index); + + /** + * GetTargetSegment() returns the index of the current target segment of + * composition. + * + * @param[in] ime_event A PP_Resource corresponding to an IME + * event. + * + * @return An integer indicating the index of the target segment. When there + * is no active target segment, or the event is not COMPOSITION_UPDATE, + * returns -1. + */ + int32_t GetTargetSegment([in] PP_Resource ime_event); + + /** + * GetSelection() returns the range selected by caret in the composition text. + * + * @param[in] ime_event A PP_Resource corresponding to an IME + * event. + * + * @param[out] start The start position of the current selection. + * + * @param[out] end The end position of the current selection. + */ + void GetSelection([in] PP_Resource ime_event, + [out] uint32_t start, + [out] uint32_t end); +}; diff --git a/browser/extensions/mortar/ppapi/api/ppb_instance.idl b/browser/extensions/mortar/ppapi/api/ppb_instance.idl new file mode 100644 index 000000000000..794b4521a769 --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/ppb_instance.idl @@ -0,0 +1,69 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * This file defines the PPB_Instance interface implemented by the + * browser and containing pointers to functions related to + * the module instance on a web page. + */ + +[generate_thunk] + +label Chrome { + M14 = 1.0 + }; + +/** + * The PPB_Instance interface contains pointers to functions + * related to the module instance on a web page. + */ +interface PPB_Instance { + /** + * BindGraphics() binds the given graphics as the current display surface. + * The contents of this device is what will be displayed in the instance's + * area on the web page. The device must be a 2D or a 3D device. + * + * You can pass a NULL resource as the device parameter to + * unbind all devices from the given instance. The instance will then appear + * transparent. Re-binding the same device will return PP_TRUE + * and will do nothing. + * + * Any previously-bound device will be released. It is an error to bind + * a device when it is already bound to another instance. If you want + * to move a device between instances, first unbind it from the old one, and + * then rebind it to the new one. + * + * Binding a device will invalidate that portion of the web page to flush the + * contents of the new device to the screen. + * + * @param[in] instance A PP_Instance identifying one instance of a module. + * @param[in] device A PP_Resource corresponding to a graphics device. + * + * @return PP_Bool containing PP_TRUE if bind was + * successful or PP_FALSE if the device was not the correct + * type. On success, a reference to the device will be held by the + * instance, so the caller can release its reference if it chooses. + */ + PP_Bool BindGraphics( + [in] PP_Instance instance, + [in] PP_Resource device); + + /** + * IsFullFrame() determines if the instance is full-frame. Such an instance + * represents the entire document in a frame rather than an embedded + * resource. This can happen if the user does a top-level navigation or the + * page specifies an iframe to a resource with a MIME type registered by the + * module. + * + * @param[in] instance A PP_Instance identifying one instance + * of a module. + * + * @return A PP_Bool containing PP_TRUE if the + * instance is full-frame. + */ + PP_Bool IsFullFrame( + [in] PP_Instance instance); +}; + diff --git a/browser/extensions/mortar/ppapi/api/ppb_media_stream_audio_track.idl b/browser/extensions/mortar/ppapi/api/ppb_media_stream_audio_track.idl new file mode 100644 index 000000000000..4ffa9461aef5 --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/ppb_media_stream_audio_track.idl @@ -0,0 +1,201 @@ +/* Copyright 2014 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * Defines the PPB_MediaStreamAudioTrack interface. Used for + * receiving audio samples from a MediaStream audio track in the browser. + */ + +[generate_thunk] + +label Chrome { + [channel=dev] M34 = 0.1, + M35 = 0.1 +}; + +/** + * This enumeration contains audio track attributes which are used by + * Configure(). + */ +enum PP_MediaStreamAudioTrack_Attrib { + /** + * Attribute list terminator. + */ + PP_MEDIASTREAMAUDIOTRACK_ATTRIB_NONE = 0, + + /** + * The maximum number of buffers to hold audio samples. + * Note: this is only used as advisory; the browser may allocate more or fewer + * based on available resources. How many buffers depends on usage - + * request at least 2 to make sure latency doesn't cause lost samples. If + * the plugin expects to hold on to more than one buffer at a time (e.g. to do + * multi-buffer processing), it should request that many more. + */ + PP_MEDIASTREAMAUDIOTRACK_ATTRIB_BUFFERS = 1, + + /** + * The sample rate of audio data in buffers. The attribute value is a + * PP_AudioBuffer_SampleRate. + */ + PP_MEDIASTREAMAUDIOTRACK_ATTRIB_SAMPLE_RATE = 2, + + /** + * The sample size of audio data in buffers in bytes. The attribute value is a + * PP_AudioBuffer_SampleSize. + */ + PP_MEDIASTREAMAUDIOTRACK_ATTRIB_SAMPLE_SIZE = 3, + + /** + * The number of channels in audio buffers. + * + * Supported values: 1, 2 + */ + PP_MEDIASTREAMAUDIOTRACK_ATTRIB_CHANNELS = 4, + + /** + * The duration of an audio buffer in milliseconds. + * + * Valid range: 10 to 10000 + */ + PP_MEDIASTREAMAUDIOTRACK_ATTRIB_DURATION = 5 +}; + +[version=0.1] +interface PPB_MediaStreamAudioTrack { + /** + * Determines if a resource is a MediaStream audio track resource. + * + * @param[in] resource The PP_Resource to test. + * + * @return A PP_Bool with PP_TRUE if the given + * resource is a Mediastream audio track resource or PP_FALSE + * otherwise. + */ + PP_Bool IsMediaStreamAudioTrack([in] PP_Resource resource); + + /** + * Configures underlying buffers for incoming audio samples. + * If the application doesn't want to drop samples, then the + * PP_MEDIASTREAMAUDIOTRACK_ATTRIB_BUFFERS should be + * chosen such that inter-buffer processing time variability won't overrun all + * the input buffers. If all buffers are filled, then samples will be + * dropped. The application can detect this by examining the timestamp on + * returned buffers. If Configure() is not called, default + * settings will be used. Calls to Configure while the plugin holds + * buffers will fail. + * Example usage from plugin code: + * @code + * int32_t attribs[] = { + * PP_MEDIASTREAMAUDIOTRACK_ATTRIB_BUFFERS, 4, + * PP_MEDIASTREAMAUDIOTRACK_ATTRIB_DURATION, 10, + * PP_MEDIASTREAMAUDIOTRACK_ATTRIB_NONE}; + * track_if->Configure(track, attribs, callback); + * @endcode + * + * @param[in] audio_track A PP_Resource corresponding to an audio + * resource. + * @param[in] attrib_list A list of attribute name-value pairs in which each + * attribute is immediately followed by the corresponding desired value. + * The list is terminated by + * PP_MEDIASTREAMAUDIOTRACK_ATTRIB_NONE. + * @param[in] callback A PP_CompletionCallback to be called upon + * completion of Configure(). + * + * @return An int32_t containing a result code from pp_errors.h. + */ + int32_t Configure([in] PP_Resource audio_track, + [in] int32_t[] attrib_list, + [in] PP_CompletionCallback callback); + + /** + * Gets attribute value for a given attribute name. + * + * @param[in] audio_track A PP_Resource corresponding to an audio + * resource. + * @param[in] attrib A PP_MediaStreamAudioTrack_Attrib for + * querying. + * @param[out] value A int32_t for storing the attribute value on success. + * Otherwise, the value will not be changed. + * + * @return An int32_t containing a result code from pp_errors.h. + */ + int32_t GetAttrib([in] PP_Resource audio_track, + [in] PP_MediaStreamAudioTrack_Attrib attrib, + [out] int32_t value); + + /** + * Returns the track ID of the underlying MediaStream audio track. + * + * @param[in] audio_track The PP_Resource to check. + * + * @return A PP_Var containing the MediaStream track ID as + * a string. + */ + PP_Var GetId([in] PP_Resource audio_track); + + /** + * Checks whether the underlying MediaStream track has ended. + * Calls to GetBuffer while the track has ended are safe to make and will + * complete, but will fail. + * + * @param[in] audio_track The PP_Resource to check. + * + * @return A PP_Bool with PP_TRUE if the given + * MediaStream track has ended or PP_FALSE otherwise. + */ + [on_failure=PP_TRUE] + PP_Bool HasEnded([in] PP_Resource audio_track); + + /** + * Gets the next audio buffer from the MediaStream track. + * If internal processing is slower than the incoming buffer rate, new buffers + * will be dropped from the incoming stream. Once all buffers are full, + * audio samples will be dropped until RecycleBuffer() is called + * to free a slot for another buffer. + * If there are no audio data in the input buffer, + * PP_OK_COMPLETIONPENDING will be returned immediately and the + * callback will be called, when a new buffer of audio samples + * is received or an error happens. + * + * @param[in] audio_track A PP_Resource corresponding to an audio + * resource. + * @param[out] buffer A PP_Resource corresponding to + * an AudioBuffer resource. + * @param[in] callback A PP_CompletionCallback to be called upon + * completion of GetBuffer(). + * + * @return An int32_t containing a result code from pp_errors.h. + */ + int32_t GetBuffer([in] PP_Resource audio_track, + [out] PP_Resource buffer, + [in] PP_CompletionCallback callback); + + /** + * Recycles a buffer returned by GetBuffer(), so the track can + * reuse the buffer. And the buffer will become invalid. The caller should + * release all references it holds to buffer and not use it + * anymore. + * + * @param[in] audio_track A PP_Resource corresponding to an audio + * resource. + * @param[in] buffer A PP_Resource corresponding to + * an AudioBuffer resource returned by GetBuffer(). + * + * @return An int32_t containing a result code from pp_errors.h. + */ + int32_t RecycleBuffer([in] PP_Resource audio_track, + [in] PP_Resource buffer); + + /** + * Closes the MediaStream audio track and disconnects it from the audio + * source. After calling Close(), no new buffers will be + * received. + * + * @param[in] audio_track A PP_Resource corresponding to a + * MediaStream audio track resource. + */ + void Close([in] PP_Resource audio_track); +}; + diff --git a/browser/extensions/mortar/ppapi/api/ppb_media_stream_video_track.idl b/browser/extensions/mortar/ppapi/api/ppb_media_stream_video_track.idl new file mode 100644 index 000000000000..2cf85304c386 --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/ppb_media_stream_video_track.idl @@ -0,0 +1,247 @@ +/* Copyright 2014 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * Defines the PPB_MediaStreamVideoTrack interface. Used for + * receiving video frames from a MediaStream video track in the browser. + */ + +[generate_thunk] + +label Chrome { + [channel=dev] M34 = 0.1, + M35 = 0.1, + [channel=dev] M36 = 1.0 +}; + +/** + * This enumeration contains video track attributes which are used by + * Configure(). + */ +enum PP_MediaStreamVideoTrack_Attrib { + /** + * Attribute list terminator. + */ + PP_MEDIASTREAMVIDEOTRACK_ATTRIB_NONE = 0, + + /** + * The maximum number of frames to hold in the input buffer. + * Note: this is only used as advisory; the browser may allocate more or fewer + * based on available resources. How many frames to buffer depends on usage - + * request at least 2 to make sure latency doesn't cause lost frames. If + * the plugin expects to hold on to more than one frame at a time (e.g. to do + * multi-frame processing), it should request that many more. + * If this attribute is not specified or value 0 is specified for this + * attribute, the default value will be used. + */ + PP_MEDIASTREAMVIDEOTRACK_ATTRIB_BUFFERED_FRAMES = 1, + + /** + * The width of video frames in pixels. It should be a multiple of 4. + * If the specified size is different from the video source (webcam), + * frames will be scaled to specified size. + * If this attribute is not specified or value 0 is specified, the original + * frame size of the video track will be used. + * + * Maximum value: 4096 (4K resolution). + */ + PP_MEDIASTREAMVIDEOTRACK_ATTRIB_WIDTH = 2, + + /** + * The height of video frames in pixels. It should be a multiple of 4. + * If the specified size is different from the video source (webcam), + * frames will be scaled to specified size. + * If this attribute is not specified or value 0 is specified, the original + * frame size of the video track will be used. + * + * Maximum value: 4096 (4K resolution). + */ + PP_MEDIASTREAMVIDEOTRACK_ATTRIB_HEIGHT = 3, + + /** + * The format of video frames. The attribute value is + * a PP_VideoFrame_Format. If the specified format is different + * from the video source (webcam), frames will be converted to specified + * format. + * If this attribute is not specified or value + * PP_VIDEOFRAME_FORMAT_UNKNOWN is specified, the orignal frame + * format of the video track will be used. + */ + PP_MEDIASTREAMVIDEOTRACK_ATTRIB_FORMAT = 4 +}; + +[version=0.1] +interface PPB_MediaStreamVideoTrack { + /** + * Creates a PPB_MediaStreamVideoTrack resource for video output. Call this + * when you will be creating frames and putting them to the track. + * + * @param[in] instance A PP_Instance identifying one instance of + * a module. + * + * @return A PP_Resource corresponding to a + * PPB_MediaStreamVideoTrack resource if successful, 0 if failed. + */ + [version=1.0] + PP_Resource Create([in] PP_Instance instance); + + /** + * Determines if a resource is a MediaStream video track resource. + * + * @param[in] resource The PP_Resource to test. + * + * @return A PP_Bool with PP_TRUE if the given + * resource is a Mediastream video track resource or PP_FALSE + * otherwise. + */ + PP_Bool IsMediaStreamVideoTrack([in] PP_Resource resource); + + /** + * Configures underlying frame buffers for incoming frames. + * If the application doesn't want to drop frames, then the + * PP_MEDIASTREAMVIDEOTRACK_ATTRIB_BUFFERED_FRAMES should be + * chosen such that inter-frame processing time variability won't overrun the + * input buffer. If the buffer is overfilled, then frames will be dropped. + * The application can detect this by examining the timestamp on returned + * frames. If some attributes are not specified, default values will be used + * for those unspecified attributes. If Configure() is not + * called, default settings will be used. + * Example usage from plugin code: + * @code + * int32_t attribs[] = { + * PP_MEDIASTREAMVIDEOTRACK_ATTRIB_BUFFERED_FRAMES, 4, + * PP_MEDIASTREAMVIDEOTRACK_ATTRIB_NONE}; + * track_if->Configure(track, attribs, callback); + * @endcode + * + * @param[in] video_track A PP_Resource corresponding to a video + * resource. + * @param[in] attrib_list A list of attribute name-value pairs in which each + * attribute is immediately followed by the corresponding desired value. + * The list is terminated by + * PP_MEDIASTREAMVIDEOTRACK_ATTRIB_NONE. + * @param[in] callback PP_CompletionCallback to be called upon + * completion of Configure(). + * + * @return An int32_t containing a result code from pp_errors.h. + * Returns PP_ERROR_INPROGRESS if there is a pending call of + * Configure() or GetFrame(), or the plugin + * holds some frames which are not recycled with RecycleFrame(). + * If an error is returned, all attributes and the underlying buffer will not + * be changed. + */ + int32_t Configure([in] PP_Resource video_track, + [in] int32_t[] attrib_list, + [in] PP_CompletionCallback callback); + + /** + * Gets attribute value for a given attribute name. + * + * @param[in] video_track A PP_Resource corresponding to a video + * resource. + * @param[in] attrib A PP_MediaStreamVideoTrack_Attrib for + * querying. + * @param[out] value A int32_t for storing the attribute value on success. + * Otherwise, the value will not be changed. + * + * @return An int32_t containing a result code from pp_errors.h. + */ + int32_t GetAttrib([in] PP_Resource video_track, + [in] PP_MediaStreamVideoTrack_Attrib attrib, + [out] int32_t value); + + /** + * Returns the track ID of the underlying MediaStream video track. + * + * @param[in] video_track The PP_Resource to check. + * + * @return A PP_Var containing the MediaStream track ID as + * a string. + */ + PP_Var GetId([in] PP_Resource video_track); + + /** + * Checks whether the underlying MediaStream track has ended. + * Calls to GetFrame while the track has ended are safe to make and will + * complete, but will fail. + * + * @param[in] video_track The PP_Resource to check. + * + * @return A PP_Bool with PP_TRUE if the given + * MediaStream track has ended or PP_FALSE otherwise. + */ + [on_failure=PP_TRUE] + PP_Bool HasEnded([in] PP_Resource video_track); + + /** + * Gets the next video frame from the MediaStream track. + * If internal processing is slower than the incoming frame rate, new frames + * will be dropped from the incoming stream. Once the input buffer is full, + * frames will be dropped until RecycleFrame() is called to free + * a spot for another frame to be buffered. + * If there are no frames in the input buffer, + * PP_OK_COMPLETIONPENDING will be returned immediately and the + * callback will be called when a new frame is received or an + * error happens. + * + * @param[in] video_track A PP_Resource corresponding to a video + * resource. + * @param[out] frame A PP_Resource corresponding to a VideoFrame + * resource. + * @param[in] callback A PP_CompletionCallback to be called upon + * completion of GetFrame(). + * + * @return An int32_t containing a result code from pp_errors.h. + * Returns PP_ERROR_NOMEMORY if max_buffered_frames frames buffer + * was not allocated successfully. + */ + int32_t GetFrame([in] PP_Resource video_track, + [out] PP_Resource frame, + [in] PP_CompletionCallback callback); + + /** + * Recycles a frame returned by GetFrame(), so the track can + * reuse the underlying buffer of this frame. And the frame will become + * invalid. The caller should release all references it holds to + * frame and not use it anymore. + * + * @param[in] video_track A PP_Resource corresponding to a video + * resource. + * @param[in] frame A PP_Resource corresponding to a VideoFrame + * resource returned by GetFrame(). + * + * @return An int32_t containing a result code from pp_errors.h. + */ + int32_t RecycleFrame([in] PP_Resource video_track, + [in] PP_Resource frame); + + /** + * Closes the MediaStream video track and disconnects it from video source. + * After calling Close(), no new frames will be received. + * + * @param[in] video_track A PP_Resource corresponding to a + * MediaStream video track resource. + */ + void Close([in] PP_Resource video_track); + + /** + * Gets a free frame for output. The frame is allocated by + * Configure(). The caller should fill it with frame data, and + * then use |PutFrame()| to send the frame back. + */ + [version=1.0] + int32_t GetEmptyFrame([in] PP_Resource video_track, + [out] PP_Resource frame, + [in] PP_CompletionCallback callback); + + /** + * Sends a frame returned by |GetEmptyFrame()| to the output track. + * After this function, the |frame| should not be used anymore and the + * caller should release the reference that it holds. + */ + [version=1.0] + int32_t PutFrame([in] PP_Resource video_track, [in] PP_Resource frame); +}; + diff --git a/browser/extensions/mortar/ppapi/api/ppb_message_loop.idl b/browser/extensions/mortar/ppapi/api/ppb_message_loop.idl new file mode 100644 index 000000000000..73ad14db836c --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/ppb_message_loop.idl @@ -0,0 +1,271 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * Defines the PPB_MessageLoop interface. + */ +label Chrome { + M25 = 1.0 +}; + +/** + * A message loop allows PPAPI calls to be issued on a thread. You may not + * issue any API calls on a thread without creating a message loop. It also + * allows you to post work to the message loop for a thread. + * + * To process work posted to the message loop, as well as completion callbacks + * for asynchronous operations, you must run the message loop via Run(). + * + * Note the system manages the lifetime of the instance (and all associated + * resources). If the instance is deleted from the page, background threads may + * suddenly see their PP_Resource handles become invalid. In this case, calls + * will fail with PP_ERROR_BADRESOURCE. If you need to access data associated + * with your instance, you will probably want to create some kind of threadsafe + * proxy object that can handle asynchronous destruction of the instance object. + * + * Typical usage: + * On the main thread: + * - Create the thread yourself (using pthreads). + * - Create the message loop resource. + * - Pass the message loop resource to your thread's main function. + * - Call PostWork() on the message loop to run functions on the thread. + * + * From the background thread's main function: + * - Call AttachToCurrentThread() with the message loop resource. + * - Call Run() with the message loop resource. + * + * Your callbacks should look like this: + * @code + * void DoMyWork(void* user_data, int32_t status) { + * if (status != PP_OK) { + * Cleanup(); // e.g. free user_data. + * return; + * } + * ... do your work... + * } + * @endcode + * For a C++ example, see ppapi/utility/threading/simple_thread.h + * + * (You can also create the message loop resource on the background thread, + * but then the main thread will have no reference to it should you want to + * call PostWork()). + * + * + * THREAD HANDLING + * + * The main thread has an implicitly created message loop. The main thread is + * the thread where PPP_InitializeModule and PPP_Instance functions are called. + * You can retrieve a reference to this message loop by calling + * GetForMainThread() or, if your code is on the main thread, GetCurrent() will + * also work. + * + * Some special threads created by the system can not have message loops. In + * particular, the background thread created for audio processing has this + * requirement because it's intended to be highly responsive to keep up with + * the realtime requirements of audio processing. You can not make PPAPI calls + * from these threads. + * + * Once you associate a message loop with a thread, you don't have to keep a + * reference to it. The system will hold a reference to the message loop for as + * long as the thread is running. The current message loop can be retrieved + * using the GetCurrent() function. + * + * It is legal to create threads in your plugin without message loops, but + * PPAPI calls will fail unless explicitly noted in the documentation. + * + * You can create a message loop object on a thread and never actually run the + * message loop. This will allow you to call blocking PPAPI calls (via + * PP_BlockUntilComplete()). If you make any asynchronous calls, the callbacks + * from those calls will be queued in the message loop and never run. The same + * thing will happen if work is scheduled after the message loop exits and + * the message loop is not run again. + * + * + * DESTRUCTION AND ERROR HANDLING + * + * Often, your application will associate memory with completion callbacks. For + * example, the C++ CompletionCallbackFactory has a small amount of + * heap-allocated memory for each callback. This memory will be leaked if the + * callback is never run. To avoid this memory leak, you need to be careful + * about error handling and shutdown. + * + * There are a number of cases where posted callbacks will never be run: + * + * - You tear down the thread (via pthreads) without "destroying" the message + * loop (via PostQuit with should_destroy = PP_TRUE). In this case, any + * tasks in the message queue will be lost. + * + * - You create a message loop, post callbacks to it, and never run it. + * + * - You quit the message loop via PostQuit with should_destroy set to + * PP_FALSE. In this case, the system will assume the message loop will be + * run again later and keep your tasks. + * + * To do proper shutdown, call PostQuit with should_destroy = PP_TRUE. This + * will prohibit future work from being posted, and will allow the message loop + * to run until all pending tasks are run. + * + * If you post a callback to a message loop that's been destroyed, or to an + * invalid message loop, PostWork will return an error and will not run the + * callback. This is true even for callbacks with the "required" flag set, + * since the system may not even know what thread to issue the error callback + * on. + * + * Therefore, you should check for errors from PostWork and destroy any + * associated memory to avoid leaks. If you're using the C++ + * CompletionCallbackFactory, use the following pattern: + * @code + * pp::CompletionCallback callback = factory_.NewOptionalCallback(...); + * int32_t result = message_loop.PostWork(callback); + * if (result != PP_OK) + * callback.Run(result); + * @endcode + * This will run the callback with an error value, and assumes that the + * implementation of your callback checks the "result" argument and returns + * immediately on error. + */ +interface PPB_MessageLoop { + /** + * Creates a message loop resource. + * + * This may be called from any thread. After your thread starts but before + * issuing any other PPAPI calls on it, you must associate it with a message + * loop by calling AttachToCurrentThread. + */ + PP_Resource Create(PP_Instance instance); + + /** + * Returns a resource identifying the message loop for the main thread. The + * main thread always has a message loop created by the system. + */ + PP_Resource GetForMainThread(); + + /** + * Returns a reference to the PPB_MessageLoop object attached to the current + * thread. If there is no attached message loop, the return value will be 0. + */ + PP_Resource GetCurrent(); + + /** + * Sets the given message loop resource as being the associated message loop + * for the currently running thread. + * + * You must call this function exactly once on a thread before making any + * PPAPI calls. A message loop can only be attached to one thread, and the + * message loop can not be changed later. The message loop will be attached + * as long as the thread is running or until you quit with should_destroy + * set to PP_TRUE. + * + * If this function fails, attempting to run the message loop will fail. + * Note that you can still post work to the message loop: it will get queued + * up should the message loop eventually be successfully attached and run. + * + * @return + * - PP_OK: The message loop was successfully attached to the thread and is + * ready to use. + * - PP_ERROR_BADRESOURCE: The given message loop resource is invalid. + * - PP_ERROR_INPROGRESS: The current thread already has a message loop + * attached. This will always be the case for the main thread, which has + * an implicit system-created message loop attached. + * - PP_ERROR_WRONG_THREAD: The current thread type can not have a message + * loop attached to it. See the interface level discussion about these + * special threads, which include realtime audio threads. + */ + int32_t AttachToCurrentThread([in] PP_Resource message_loop); + + /** + * Runs the thread message loop. Running the message loop is required for you + * to get issued completion callbacks on the thread. + * + * The message loop identified by the argument must have been previously + * successfully attached to the current thread. + * + * You may not run nested message loops. Since the main thread has an + * implicit message loop that the system runs, you may not call Run on the + * main thread. + * + * @return + * - PP_OK: The message loop was successfully run. Note that on + * success, the message loop will only exit when you call PostQuit(). + * - PP_ERROR_BADRESOURCE: The given message loop resource is invalid. + * - PP_ERROR_WRONG_THREAD: You are attempting to run a message loop that + * has not been successfully attached to the current thread. Call + * AttachToCurrentThread(). + * - PP_ERROR_INPROGRESS: You are attempting to call Run in a nested + * fashion (Run is already on the stack). This will occur if you attempt + * to call run on the main thread's message loop (see above). + */ + int32_t Run([in] PP_Resource message_loop); + + /** + * Schedules work to run on the given message loop. This may be called from + * any thread. Posted work will be executed in the order it was posted when + * the message loop is Run(). + * + * @param message_loop The message loop resource. + * + * @param callback The completion callback to execute from the message loop. + * + * @param delay_ms The number of milliseconds to delay execution of the given + * completion callback. Passing 0 means it will get queued normally and + * executed in order. + * + * + * The completion callback will be called with PP_OK as the "result" parameter + * if it is run normally. It is good practice to check for PP_OK and return + * early otherwise. + * + * The "required" flag on the completion callback is ignored. If there is an + * error posting your callback, the error will be returned from PostWork and + * the callback will never be run (because there is no appropriate place to + * run your callback with an error without causing unexpected threading + * problems). If you associate memory with the completion callback (for + * example, you're using the C++ CompletionCallbackFactory), you will need to + * free this or manually run the callback. See "Destruction and error + * handling" above. + * + * + * You can call this function before the message loop has started and the + * work will get queued until the message loop is run. You can also post + * work after the message loop has exited as long as should_destroy was + * PP_FALSE. It will be queued until the next invocation of Run(). + * + * @return + * - PP_OK: The work was posted to the message loop's queue. As described + * above, this does not mean that the work has been or will be executed + * (if you never run the message loop after posting). + * - PP_ERROR_BADRESOURCE: The given message loop resource is invalid. + * - PP_ERROR_BADARGUMENT: The function pointer for the completion callback + * is null (this will be the case if you pass PP_BlockUntilComplete()). + * - PP_ERROR_FAILED: The message loop has been destroyed. + */ + int32_t PostWork([in] PP_Resource message_loop, + [in] PP_CompletionCallback callback, + [in] int64_t delay_ms); + + /** + * Posts a quit message to the given message loop's work queue. Work posted + * before that point will be processed before quitting. + * + * This may be called on the message loop registered for the current thread, + * or it may be called on the message loop registered for another thread. It + * is an error to attempt to PostQuit() the main thread loop. + * + * @param should_destroy Marks the message loop as being in a destroyed state + * and prevents further posting of messages. + * + * If you quit a message loop without setting should_destroy, it will still + * be attached to the thread and you can still run it again by calling Run() + * again. If you destroy it, it will be detached from the current thread. + * + * @return + * - PP_OK: The request to quit was successfully posted. + * - PP_ERROR_BADRESOURCE: The message loop was invalid. + * - PP_ERROR_WRONG_THREAD: You are attempting to quit the main thread. + * The main thread's message loop is managed by the system and can't be + * quit. + */ + int32_t PostQuit([in] PP_Resource message_loop, PP_Bool should_destroy); +}; diff --git a/browser/extensions/mortar/ppapi/api/ppb_messaging.idl b/browser/extensions/mortar/ppapi/api/ppb_messaging.idl new file mode 100644 index 000000000000..aa5c6d769bca --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/ppb_messaging.idl @@ -0,0 +1,146 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * This file defines the PPB_Messaging interface implemented + * by the browser for sending messages to DOM elements associated with a + * specific module instance. + */ + +[generate_thunk] + +label Chrome { + M14 = 1.0, + M39 = 1.2 +}; + +/** + * The PPB_Messaging interface is implemented by the browser + * and is related to sending messages to JavaScript message event listeners on + * the DOM element associated with specific module instance. + */ +interface PPB_Messaging { + /** + * PostMessage() asynchronously invokes any listeners for message events on + * the DOM element for the given module instance. A call to PostMessage() + * will not block while the message is processed. + * + * @param[in] instance A PP_Instance identifying one instance + * of a module. + * @param[in] message A PP_Var containing the data to be sent to + * JavaScript. + * message can be any PP_Var type except + * PP_VARTYPE_OBJECT. Array/Dictionary types are supported from + * Chrome M29 onward. All var types are copied when passing them to + * JavaScript. + * + * When passing array or dictionary PP_Vars, the entire reference + * graph will be converted and transferred. If the reference graph has cycles, + * the message will not be sent and an error will be logged to the console. + * + * Listeners for message events in JavaScript code will receive an object + * conforming to the HTML 5 MessageEvent interface. + * Specifically, the value of message will be contained as a property called + * data in the received MessageEvent. + * + * This messaging system is similar to the system used for listening for + * messages from Web Workers. Refer to + * http://www.whatwg.org/specs/web-workers/current-work/ for + * further information. + * + * Example: + * + * @code + * + * + * + * + * + * + * @endcode + * + * The module instance then invokes PostMessage() as follows: + * + * @code + * + * char hello_world[] = "Hello world!"; + * PP_Var hello_var = ppb_var_interface->VarFromUtf8(instance, + * hello_world, + * sizeof(hello_world)); + * ppb_messaging_interface->PostMessage(instance, hello_var); // Copies var. + * ppb_var_interface->Release(hello_var); + * + * @endcode + * + * The browser will pop-up an alert saying "Hello world!" + */ + [version=1.0] + void PostMessage([in] PP_Instance instance, [in] PP_Var message); + + /** + * Registers a handler for receiving messages from JavaScript. If a handler + * is registered this way, it will replace PPP_Messaging, and all messages + * sent from JavaScript via postMessage and postMessageAndAwaitResponse will + * be dispatched to handler. + * + * The function calls will be dispatched via message_loop. This + * means that the functions will be invoked on the thread to which + * message_loop is attached, when message_loop is + * run. It is illegal to pass the main thread message loop; + * RegisterMessageHandler will return PP_ERROR_WRONG_THREAD in that case. + * If you quit message_loop before calling Unregister(), + * the browser will not be able to call functions in the plugin's message + * handler any more. That could mean missing some messages or could cause a + * leak if you depend on Destroy() to free hander data. So you should, + * whenever possible, Unregister() the handler prior to quitting its event + * loop. + * + * Attempting to register a message handler when one is already registered + * will cause the current MessageHandler to be unregistered and replaced. In + * that case, no messages will be sent to the "default" message handler + * (PPP_Messaging). Messages will stop arriving at the prior message handler + * and will begin to be dispatched at the new message handler. + * + * @param[in] instance A PP_Instance identifying one instance + * of a module. + * @param[in] user_data A pointer the plugin may choose to use when handling + * calls to functions within PPP_MessageHandler. The browser will pass this + * same pointer when invoking functions within PPP_MessageHandler. + * @param[in] handler The plugin-provided set of functions for handling + * messages. + * @param[in] message_loop Represents the message loop on which + * PPP_MessageHandler functions should be invoked. + * @return PP_OK on success, or an error from pp_errors.h. + */ + [version=1.2] + int32_t RegisterMessageHandler([in] PP_Instance instance, + [inout] mem_t user_data, + [in] PPP_MessageHandler handler, + [in] PP_Resource message_loop); + /** + * Unregisters the current message handler for instance if one + * is registered. After this call, the message handler (if one was + * registered) will have "Destroy" called on it and will receive no further + * messages after that point. After that point, all messages sent from + * JavaScript using postMessage() will be dispatched to PPP_Messaging (if + * the plugin supports PPP_MESSAGING_INTERFACE). Attempts to call + * postMessageAndAwaitResponse() from JavaScript will fail. + * + * Attempting to unregister a message handler when none is registered has no + * effect. + * + * @param[in] instance A PP_Instance identifying one instance + * of a module. + */ + [version=1.2] + void UnregisterMessageHandler([in] PP_Instance instance); +}; + diff --git a/browser/extensions/mortar/ppapi/api/ppb_mouse_cursor.idl b/browser/extensions/mortar/ppapi/api/ppb_mouse_cursor.idl new file mode 100644 index 000000000000..9fba254195c0 --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/ppb_mouse_cursor.idl @@ -0,0 +1,108 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * This file defines the PPB_MouseCursor interface for setting + * the mouse cursor. + */ + +[generate_thunk] + +label Chrome { + M19 = 1.0 +}; + +/** + * The PP_MouseCursor_Type enumeration lists the available stock + * cursor types. + */ +[assert_size(4), notypedef] +enum PP_MouseCursor_Type { + PP_MOUSECURSOR_TYPE_CUSTOM = -1, + PP_MOUSECURSOR_TYPE_POINTER = 0, + PP_MOUSECURSOR_TYPE_CROSS = 1, + PP_MOUSECURSOR_TYPE_HAND = 2, + PP_MOUSECURSOR_TYPE_IBEAM = 3, + PP_MOUSECURSOR_TYPE_WAIT = 4, + PP_MOUSECURSOR_TYPE_HELP = 5, + PP_MOUSECURSOR_TYPE_EASTRESIZE = 6, + PP_MOUSECURSOR_TYPE_NORTHRESIZE = 7, + PP_MOUSECURSOR_TYPE_NORTHEASTRESIZE = 8, + PP_MOUSECURSOR_TYPE_NORTHWESTRESIZE = 9, + PP_MOUSECURSOR_TYPE_SOUTHRESIZE = 10, + PP_MOUSECURSOR_TYPE_SOUTHEASTRESIZE = 11, + PP_MOUSECURSOR_TYPE_SOUTHWESTRESIZE = 12, + PP_MOUSECURSOR_TYPE_WESTRESIZE = 13, + PP_MOUSECURSOR_TYPE_NORTHSOUTHRESIZE = 14, + PP_MOUSECURSOR_TYPE_EASTWESTRESIZE = 15, + PP_MOUSECURSOR_TYPE_NORTHEASTSOUTHWESTRESIZE = 16, + PP_MOUSECURSOR_TYPE_NORTHWESTSOUTHEASTRESIZE = 17, + PP_MOUSECURSOR_TYPE_COLUMNRESIZE = 18, + PP_MOUSECURSOR_TYPE_ROWRESIZE = 19, + PP_MOUSECURSOR_TYPE_MIDDLEPANNING = 20, + PP_MOUSECURSOR_TYPE_EASTPANNING = 21, + PP_MOUSECURSOR_TYPE_NORTHPANNING = 22, + PP_MOUSECURSOR_TYPE_NORTHEASTPANNING = 23, + PP_MOUSECURSOR_TYPE_NORTHWESTPANNING = 24, + PP_MOUSECURSOR_TYPE_SOUTHPANNING = 25, + PP_MOUSECURSOR_TYPE_SOUTHEASTPANNING = 26, + PP_MOUSECURSOR_TYPE_SOUTHWESTPANNING = 27, + PP_MOUSECURSOR_TYPE_WESTPANNING = 28, + PP_MOUSECURSOR_TYPE_MOVE = 29, + PP_MOUSECURSOR_TYPE_VERTICALTEXT = 30, + PP_MOUSECURSOR_TYPE_CELL = 31, + PP_MOUSECURSOR_TYPE_CONTEXTMENU = 32, + PP_MOUSECURSOR_TYPE_ALIAS = 33, + PP_MOUSECURSOR_TYPE_PROGRESS = 34, + PP_MOUSECURSOR_TYPE_NODROP = 35, + PP_MOUSECURSOR_TYPE_COPY = 36, + PP_MOUSECURSOR_TYPE_NONE = 37, + PP_MOUSECURSOR_TYPE_NOTALLOWED = 38, + PP_MOUSECURSOR_TYPE_ZOOMIN = 39, + PP_MOUSECURSOR_TYPE_ZOOMOUT = 40, + PP_MOUSECURSOR_TYPE_GRAB = 41, + PP_MOUSECURSOR_TYPE_GRABBING = 42 +}; + +/** + * The PPB_MouseCursor allows setting the mouse cursor. + */ +interface PPB_MouseCursor { + /** + * Sets the given mouse cursor. The mouse cursor will be in effect whenever + * the mouse is over the given instance until it is set again by another + * call. Note that you can hide the mouse cursor by setting it to the + * PP_MOUSECURSOR_TYPE_NONE type. + * + * This function allows setting both system defined mouse cursors and + * custom cursors. To set a system-defined cursor, pass the type you want + * and set the custom image to 0 and the hot spot to NULL. To set a custom + * cursor, set the type to PP_MOUSECURSOR_TYPE_CUSTOM and + * specify your image and hot spot. + * + * @param[in] instance A PP_Instance identifying the instance + * that the mouse cursor will affect. + * + * @param[in] type A PP_MouseCursor_Type identifying the type of + * mouse cursor to show. + * + * @param[in] image A PPB_ImageData resource identifying the + * custom image to set when the type is + * PP_MOUSECURSOR_TYPE_CUSTOM. The image must be less than 32 + * pixels in each direction and must be of the system's native image format. + * When you are specifying a predefined cursor, this parameter must be 0. + * + * @param[in] hot_spot When setting a custom cursor, this identifies the + * pixel position within the given image of the "hot spot" of the cursor. + * When specifying a stock cursor, this parameter is ignored. + * + * @return PP_TRUE on success, or PP_FALSE if the instance or cursor type + * is invalid, or if the image is too large. + */ + PP_Bool SetCursor([in] PP_Instance instance, + [in] PP_MouseCursor_Type type, + [in] PP_Resource image, + [in] PP_Point hot_spot); +}; diff --git a/browser/extensions/mortar/ppapi/api/ppb_mouse_lock.idl b/browser/extensions/mortar/ppapi/api/ppb_mouse_lock.idl new file mode 100644 index 000000000000..b0e9488eeba5 --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/ppb_mouse_lock.idl @@ -0,0 +1,62 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * This file defines the PPB_MouseLock interface for + * locking the target of mouse events to a specific module instance. + */ + +[generate_thunk] + +label Chrome { + M16 = 1.0 +}; + +/** + * The PPB_MouseLock interface is implemented by the browser. + * This interface provides a way of locking the target of mouse events to a + * single module instance and removing the cursor from view. This mode is + * useful for certain classes of applications, especially first-person + * perspective 3D applications and 3D modeling software. + */ +interface PPB_MouseLock { + /** + * LockMouse() requests the mouse to be locked. + * + * While the mouse is locked, the cursor is implicitly hidden from the user. + * Any movement of the mouse will generate a + * PP_INPUTEVENT_TYPE_MOUSEMOVE event. The + * GetPosition() function in the PPB_MouseInputEvent + * interface reports the last known mouse position just as mouse lock was + * entered. The GetMovement() function provides relative movement + * information indicating what the change in position of the mouse would be + * had it not been locked. + * + * The browser may revoke the mouse lock for reasons including (but not + * limited to) the user pressing the ESC key, the user activating another + * program using a reserved keystroke (e.g. ALT+TAB), or some other system + * event. + * + * @param[in] instance A PP_Instance identifying one instance + * of a module. + * @param[in] callback A PP_CompletionCallback to be called upon + * completion. + * + * @return An int32_t containing an error code from pp_errors.h. + */ + int32_t LockMouse([in] PP_Instance instance, + [in] PP_CompletionCallback callback); + + /** + * UnlockMouse() causes the mouse to be unlocked, allowing it to track user + * movement again. This is an asynchronous operation. The module instance + * will be notified using the PPP_MouseLock interface when it + * has lost the mouse lock. + * + * @param[in] instance A PP_Instance identifying one instance + * of a module. + */ + void UnlockMouse([in] PP_Instance instance); +}; diff --git a/browser/extensions/mortar/ppapi/api/ppb_net_address.idl b/browser/extensions/mortar/ppapi/api/ppb_net_address.idl new file mode 100644 index 000000000000..ddd69b57e0e0 --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/ppb_net_address.idl @@ -0,0 +1,169 @@ +/* Copyright 2013 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * This file defines the PPB_NetAddress interface. + */ + +label Chrome { + M29 = 1.0 +}; + +/** + * Network address family types. + */ +[assert_size(4)] +enum PP_NetAddress_Family { + /** + * The address family is unspecified. + */ + PP_NETADDRESS_FAMILY_UNSPECIFIED = 0, + /** + * The Internet Protocol version 4 (IPv4) address family. + */ + PP_NETADDRESS_FAMILY_IPV4 = 1, + /** + * The Internet Protocol version 6 (IPv6) address family. + */ + PP_NETADDRESS_FAMILY_IPV6 = 2 +}; + +/** + * All members are expressed in network byte order. + */ +[assert_size(6)] +struct PP_NetAddress_IPv4 { + /** + * Port number. + */ + uint16_t port; + /** + * IPv4 address. + */ + uint8_t[4] addr; +}; + +/** + * All members are expressed in network byte order. + */ +[assert_size(18)] +struct PP_NetAddress_IPv6 { + /** + * Port number. + */ + uint16_t port; + /** + * IPv6 address. + */ + uint8_t[16] addr; +}; + +/** + * The PPB_NetAddress interface provides operations on network + * addresses. + */ +interface PPB_NetAddress { + /** + * Creates a PPB_NetAddress resource with the specified IPv4 + * address. + * + * @param[in] instance A PP_Instance identifying one instance of + * a module. + * @param[in] ipv4_addr An IPv4 address. + * + * @return A PP_Resource representing the same address as + * ipv4_addr or 0 on failure. + */ + PP_Resource CreateFromIPv4Address([in] PP_Instance instance, + [in] PP_NetAddress_IPv4 ipv4_addr); + + /** + * Creates a PPB_NetAddress resource with the specified IPv6 + * address. + * + * @param[in] instance A PP_Instance identifying one instance of + * a module. + * @param[in] ipv6_addr An IPv6 address. + * + * @return A PP_Resource representing the same address as + * ipv6_addr or 0 on failure. + */ + PP_Resource CreateFromIPv6Address([in] PP_Instance instance, + [in] PP_NetAddress_IPv6 ipv6_addr); + + /** + * Determines if a given resource is a network address. + * + * @param[in] resource A PP_Resource to check. + * + * @return PP_TRUE if the input is a PPB_NetAddress + * resource; PP_FALSE otherwise. + */ + PP_Bool IsNetAddress([in] PP_Resource resource); + + /** + * Gets the address family. + * + * @param[in] addr A PP_Resource corresponding to a network + * address. + * + * @return The address family on success; + * PP_NETADDRESS_FAMILY_UNSPECIFIED on failure. + */ + PP_NetAddress_Family GetFamily([in] PP_Resource addr); + + /** + * Returns a human-readable description of the network address. The + * description is in the form of host [ ":" port ] and conforms to + * http://tools.ietf.org/html/rfc3986#section-3.2 for IPv4 and IPv6 addresses + * (e.g., "192.168.0.1", "192.168.0.1:99", or "[::1]:80"). + * + * @param[in] addr A PP_Resource corresponding to a network + * address. + * @param[in] include_port Whether to include the port number in the + * description. + * + * @return A string PP_Var on success; an undefined + * PP_Var on failure. + */ + PP_Var DescribeAsString([in] PP_Resource addr, + [in] PP_Bool include_port); + + /** + * Fills a PP_NetAddress_IPv4 structure if the network address is + * of PP_NETADDRESS_FAMILY_IPV4 address family. + * Note that passing a network address of + * PP_NETADDRESS_FAMILY_IPV6 address family will fail even if the + * address is an IPv4-mapped IPv6 address. + * + * @param[in] addr A PP_Resource corresponding to a network + * address. + * @param[out] ipv4_addr A PP_NetAddress_IPv4 structure to store + * the result. + * + * @return A PP_Bool value indicating whether the operation + * succeeded. + */ + PP_Bool DescribeAsIPv4Address([in] PP_Resource addr, + [out] PP_NetAddress_IPv4 ipv4_addr); + + /** + * Fills a PP_NetAddress_IPv6 structure if the network address is + * of PP_NETADDRESS_FAMILY_IPV6 address family. + * Note that passing a network address of + * PP_NETADDRESS_FAMILY_IPV4 address family will fail - this + * method doesn't map it to an IPv6 address. + * + * @param[in] addr A PP_Resource corresponding to a network + * address. + * @param[out] ipv6_addr A PP_NetAddress_IPv6 structure to store + * the result. + * + * @return A PP_Bool value indicating whether the operation + * succeeded. + */ + PP_Bool DescribeAsIPv6Address([in] PP_Resource addr, + [out] PP_NetAddress_IPv6 ipv6_addr); +}; diff --git a/browser/extensions/mortar/ppapi/api/ppb_network_list.idl b/browser/extensions/mortar/ppapi/api/ppb_network_list.idl new file mode 100644 index 000000000000..70c301f8754c --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/ppb_network_list.idl @@ -0,0 +1,172 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * This file defines the PPB_NetworkList interface. + */ + +[generate_thunk] + +label Chrome { + M31 = 1.0 +}; + +/** + * Type of a network interface. + */ +[assert_size(4)] +enum PP_NetworkList_Type { + /** + * Type of the network interface is not known. + */ + PP_NETWORKLIST_TYPE_UNKNOWN = 0, + + /** + * Wired Ethernet network. + */ + PP_NETWORKLIST_TYPE_ETHERNET = 1, + + /** + * Wireless Wi-Fi network. + */ + PP_NETWORKLIST_TYPE_WIFI = 2, + + /** + * Cellular network (e.g. LTE). + */ + PP_NETWORKLIST_TYPE_CELLULAR = 3 +}; + +/** + * State of a network interface. + */ +[assert_size(4)] +enum PP_NetworkList_State { + /** + * Network interface is down. + */ + PP_NETWORKLIST_STATE_DOWN = 0, + + /** + * Network interface is up. + */ + PP_NETWORKLIST_STATE_UP = 1 +}; + +/** + * The PPB_NetworkList is used to represent a list of + * network interfaces and their configuration. The content of the list + * is immutable. The current networks configuration can be received + * using the PPB_NetworkMonitor interface. + */ +interface PPB_NetworkList { + /** + * Determines if the specified resource is a + * NetworkList object. + * + * @param[in] resource A PP_Resource resource. + * + * @return Returns PP_TRUE if resource is + * a PPB_NetworkList, PP_FALSE + * otherwise. + */ + PP_Bool IsNetworkList([in] PP_Resource resource); + + /** + * Gets number of interfaces in the list. + * + * @param[in] resource A PP_Resource corresponding to a + * network list. + * + * @return Returns number of available network interfaces or 0 if + * the list has never been updated. + */ + uint32_t GetCount([in] PP_Resource resource); + + /** + * Gets name of a network interface. + * + * @param[in] resource A PP_Resource corresponding to a + * network list. + * @param[in] index Index of the network interface. + * + * @return Returns name for the network interface with the specified + * index. + */ + PP_Var GetName([in] PP_Resource resource, + [in] uint32_t index); + + /** + * Gets type of a network interface. + * + * @param[in] resource A PP_Resource corresponding to a + * network list. + * @param[in] index Index of the network interface. + * + * @return Returns type of the network interface with the specified + * index. + */ + [on_failure=PP_NETWORKLIST_TYPE_UNKNOWN] + PP_NetworkList_Type GetType([in] PP_Resource resource, + [in] uint32_t index); + + /** + * Gets state of a network interface. + * + * @param[in] resource A PP_Resource corresponding to a + * network list. + * @param[in] index Index of the network interface. + * + * @return Returns current state of the network interface with the + * specified index. + */ + [on_failure=PP_NETWORKLIST_STATE_DOWN] + PP_NetworkList_State GetState([in] PP_Resource resource, + [in] uint32_t index); + + /** + * Gets list of IP addresses for a network interface. + * + * @param[in] resource A PP_Resource corresponding to a + * network list. + * @param[in] index Index of the network interface. + * @param[in] output An output array which will receive + * PPB_NetAddress resources on success. Please note that the + * ref count of those resources has already been increased by 1 for the + * caller. + * + * @return An error code from pp_errors.h. + */ + int32_t GetIpAddresses([in] PP_Resource resource, + [in] uint32_t index, + [in] PP_ArrayOutput output); + + /** + * Gets display name of a network interface. + * + * @param[in] resource A PP_Resource corresponding to a + * network list. + * @param[in] index Index of the network interface. + * + * @return Returns display name for the network interface with the + * specified index. + */ + PP_Var GetDisplayName([in] PP_Resource resource, + [in] uint32_t index); + + /** + * Gets MTU (Maximum Transmission Unit) of a network interface. + * + * @param[in] resource A PP_Resource corresponding to a + * network list. + * @param[in] index Index of the network interface. + * + * @return Returns MTU for the network interface with the specified + * index or 0 if MTU is unknown. + */ + uint32_t GetMTU([in] PP_Resource resource, + [in] uint32_t index); + +}; diff --git a/browser/extensions/mortar/ppapi/api/ppb_network_monitor.idl b/browser/extensions/mortar/ppapi/api/ppb_network_monitor.idl new file mode 100644 index 000000000000..361f7cbbeb49 --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/ppb_network_monitor.idl @@ -0,0 +1,69 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * This file defines the PPB_NetworkMonitor interface. + */ + +[generate_thunk] + +label Chrome { + M31 = 1.0 +}; + +/** + * The PPB_NetworkMonitor allows to get network interfaces + * configuration and monitor network configuration changes. + * + * Permissions: Apps permission socket with subrule + * network-state is required for UpdateNetworkList(). + * For more details about network communication permissions, please see: + * http://developer.chrome.com/apps/app_network.html + */ +interface PPB_NetworkMonitor { + /** + * Creates a Network Monitor resource. + * + * @param[in] instance A PP_Instance identifying one instance of + * a module. + * + * @return A PP_Resource corresponding to a network monitor or 0 + * on failure. + */ + PP_Resource Create([in] PP_Instance instance); + + + /** + * Gets current network configuration. When called for the first time, + * completes as soon as the current network configuration is received from + * the browser. Each consequent call will wait for network list changes, + * returning a new PPB_NetworkList resource every time. + * + * @param[in] network_monitor A PP_Resource corresponding to a + * network monitor. + * @param[out] network_list The PPB_NetworkList resource with the + * current state of network interfaces. + * @param[in] callback A PP_CompletionCallback to be called upon + * completion. + * + * @return An int32_t containing an error code from pp_errors.h. + * PP_ERROR_NOACCESS will be returned if the caller doesn't have + * required permissions. + */ + int32_t UpdateNetworkList([in] PP_Resource network_monitor, + [out] PP_Resource network_list, + [in] PP_CompletionCallback callback); + + /** + * Determines if the specified resource is a + * NetworkMonitor object. + * + * @param[in] resource A PP_Resource resource. + * + * @return Returns PP_TRUE if resource is a + * PPB_NetworkMonitor, PP_FALSE otherwise. + */ + PP_Bool IsNetworkMonitor([in] PP_Resource resource); +}; diff --git a/browser/extensions/mortar/ppapi/api/ppb_network_proxy.idl b/browser/extensions/mortar/ppapi/api/ppb_network_proxy.idl new file mode 100644 index 000000000000..6957f4a6babe --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/ppb_network_proxy.idl @@ -0,0 +1,53 @@ +/* Copyright 2013 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * This file defines the PPB_NetworkProxy interface. + */ + +[generate_thunk] + +label Chrome { + M29 = 1.0 +}; + +/** + * This interface provides a way to determine the appropriate proxy settings + * for a given URL. + * + * Permissions: Apps permission socket with subrule + * resolve-proxy is required for using this API. + * For more details about network communication permissions, please see: + * http://developer.chrome.com/apps/app_network.html + */ +[singleton] +interface PPB_NetworkProxy { + /** + * Retrieves the proxy that will be used for the given URL. The result will + * be a string in PAC format. For more details about PAC format, please see + * http://en.wikipedia.org/wiki/Proxy_auto-config + * + * @param[in] instance A PP_Instance identifying one instance + * of a module. + * + * @param[in] url A string PP_Var containing a URL. + * + * @param[out] proxy_string A PP_Var that GetProxyForURL will + * set upon successful completion. If the call fails, proxy_string + * will be unchanged. Otherwise, it will be set to a string + * PP_Var containing the appropriate PAC string for url. + * If set, proxy_string will have a reference count of 1 which + * the plugin must manage. + * + * @param[in] callback A PP_CompletionCallback to be called upon + * completion. + * + * @return An int32_t containing an error code from pp_errors.h. + */ + int32_t GetProxyForURL([in] PP_Instance instance, + [in] PP_Var url, + [out] PP_Var proxy_string, + [in] PP_CompletionCallback callback); +}; diff --git a/browser/extensions/mortar/ppapi/api/ppb_opengles2.idl b/browser/extensions/mortar/ppapi/api/ppb_opengles2.idl new file mode 100644 index 000000000000..5f0809928600 --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/ppb_opengles2.idl @@ -0,0 +1,741 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// This file is auto-generated from +// gpu/command_buffer/build_gles2_cmd_buffer.py +// It's formatted by clang-format using chromium coding style: +// clang-format -i -style=chromium filename +// DO NOT EDIT! + +label Chrome { + M39 = 1.0 +}; + +[version=1.0] +describe { + GLbitfield; + GLbitfield_ptr_t; + GLboolean; + GLboolean_ptr_t; + GLbyte; + GLbyte_ptr_t; + GLclampf; + GLclampf_ptr_t; + GLclampx; + GLclampx_ptr_t; + GLenum; + GLenum_ptr_t; + GLfixed; + GLfixed_ptr_t; + GLfloat; + GLfloat_ptr_t; + GLint; + GLint_ptr_t; + GLintptr; + GLintptr_ptr_t; + GLshort; + GLshort_ptr_t; + GLsizei; + GLsizei_ptr_t; + GLsizeiptr; + GLsizeiptr_ptr_t; + GLubyte; + GLubyte_ptr_t; + GLuint; + GLuint_ptr_t; + GLushort; + GLushort_ptr_t; +}; + +#inline c +#include "ppapi/c/pp_resource.h" + +#ifndef __gl2_h_ +typedef void GLvoid; +typedef int GLsizei; +typedef unsigned short GLushort; +typedef short GLshort; +typedef unsigned char GLubyte; +typedef unsigned int GLenum; +typedef int GLint; +typedef unsigned char GLboolean; +typedef unsigned int GLbitfield; +typedef float GLfloat; +typedef float GLclampf; +typedef signed char GLbyte; +typedef unsigned int GLuint; +typedef int GLfixed; +typedef int GLclampx; +#ifdef _WIN64 +typedef long long int GLintptr; +typedef long long int GLsizeiptr; +#else +typedef long int GLintptr; +typedef long int GLsizeiptr; +#endif // _WIN64 +#endif // __gl2_h_ + +#endinl + +[macro="PPB_OPENGLES2_INTERFACE", force_struct_namespace] +interface PPB_OpenGLES2 { + void ActiveTexture([in] PP_Resource context, + [in] GLenum texture); + void AttachShader([in] PP_Resource context, + [in] GLuint program, + [in] GLuint shader); + void BindAttribLocation([in] PP_Resource context, + [in] GLuint program, + [in] GLuint index, + [in] cstr_t name); + void BindBuffer([in] PP_Resource context, + [in] GLenum target, + [in] GLuint buffer); + void BindFramebuffer([in] PP_Resource context, + [in] GLenum target, + [in] GLuint framebuffer); + void BindRenderbuffer([in] PP_Resource context, + [in] GLenum target, + [in] GLuint renderbuffer); + void BindTexture([in] PP_Resource context, + [in] GLenum target, + [in] GLuint texture); + void BlendColor([in] PP_Resource context, + [in] GLclampf red, + [in] GLclampf green, + [in] GLclampf blue, + [in] GLclampf alpha); + void BlendEquation([in] PP_Resource context, + [in] GLenum mode); + void BlendEquationSeparate([in] PP_Resource context, + [in] GLenum modeRGB, + [in] GLenum modeAlpha); + void BlendFunc([in] PP_Resource context, + [in] GLenum sfactor, + [in] GLenum dfactor); + void BlendFuncSeparate([in] PP_Resource context, + [in] GLenum srcRGB, + [in] GLenum dstRGB, + [in] GLenum srcAlpha, + [in] GLenum dstAlpha); + void BufferData([in] PP_Resource context, + [in] GLenum target, + [in] GLsizeiptr size, + [in] mem_t data, + [in] GLenum usage); + void BufferSubData([in] PP_Resource context, + [in] GLenum target, + [in] GLintptr offset, + [in] GLsizeiptr size, + [in] mem_t data); + GLenum CheckFramebufferStatus([in] PP_Resource context, + [in] GLenum target); + void Clear([in] PP_Resource context, + [in] GLbitfield mask); + void ClearColor([in] PP_Resource context, + [in] GLclampf red, + [in] GLclampf green, + [in] GLclampf blue, + [in] GLclampf alpha); + void ClearDepthf([in] PP_Resource context, + [in] GLclampf depth); + void ClearStencil([in] PP_Resource context, + [in] GLint s); + void ColorMask([in] PP_Resource context, + [in] GLboolean red, + [in] GLboolean green, + [in] GLboolean blue, + [in] GLboolean alpha); + void CompileShader([in] PP_Resource context, + [in] GLuint shader); + void CompressedTexImage2D([in] PP_Resource context, + [in] GLenum target, + [in] GLint level, + [in] GLenum internalformat, + [in] GLsizei width, + [in] GLsizei height, + [in] GLint border, + [in] GLsizei imageSize, + [in] mem_t data); + void CompressedTexSubImage2D([in] PP_Resource context, + [in] GLenum target, + [in] GLint level, + [in] GLint xoffset, + [in] GLint yoffset, + [in] GLsizei width, + [in] GLsizei height, + [in] GLenum format, + [in] GLsizei imageSize, + [in] mem_t data); + void CopyTexImage2D([in] PP_Resource context, + [in] GLenum target, + [in] GLint level, + [in] GLenum internalformat, + [in] GLint x, + [in] GLint y, + [in] GLsizei width, + [in] GLsizei height, + [in] GLint border); + void CopyTexSubImage2D([in] PP_Resource context, + [in] GLenum target, + [in] GLint level, + [in] GLint xoffset, + [in] GLint yoffset, + [in] GLint x, + [in] GLint y, + [in] GLsizei width, + [in] GLsizei height); + GLuint CreateProgram([in] PP_Resource context); + GLuint CreateShader([in] PP_Resource context, + [in] GLenum type); + void CullFace([in] PP_Resource context, + [in] GLenum mode); + void DeleteBuffers([in] PP_Resource context, + [in] GLsizei n, + [in] GLuint_ptr_t buffers); + void DeleteFramebuffers([in] PP_Resource context, + [in] GLsizei n, + [in] GLuint_ptr_t framebuffers); + void DeleteProgram([in] PP_Resource context, + [in] GLuint program); + void DeleteRenderbuffers([in] PP_Resource context, + [in] GLsizei n, + [in] GLuint_ptr_t renderbuffers); + void DeleteShader([in] PP_Resource context, + [in] GLuint shader); + void DeleteTextures([in] PP_Resource context, + [in] GLsizei n, + [in] GLuint_ptr_t textures); + void DepthFunc([in] PP_Resource context, + [in] GLenum func); + void DepthMask([in] PP_Resource context, + [in] GLboolean flag); + void DepthRangef([in] PP_Resource context, + [in] GLclampf zNear, + [in] GLclampf zFar); + void DetachShader([in] PP_Resource context, + [in] GLuint program, + [in] GLuint shader); + void Disable([in] PP_Resource context, + [in] GLenum cap); + void DisableVertexAttribArray([in] PP_Resource context, + [in] GLuint index); + void DrawArrays([in] PP_Resource context, + [in] GLenum mode, + [in] GLint first, + [in] GLsizei count); + void DrawElements([in] PP_Resource context, + [in] GLenum mode, + [in] GLsizei count, + [in] GLenum type, + [in] mem_t indices); + void Enable([in] PP_Resource context, + [in] GLenum cap); + void EnableVertexAttribArray([in] PP_Resource context, + [in] GLuint index); + void Finish([in] PP_Resource context); + void Flush([in] PP_Resource context); + void FramebufferRenderbuffer([in] PP_Resource context, + [in] GLenum target, + [in] GLenum attachment, + [in] GLenum renderbuffertarget, + [in] GLuint renderbuffer); + void FramebufferTexture2D([in] PP_Resource context, + [in] GLenum target, + [in] GLenum attachment, + [in] GLenum textarget, + [in] GLuint texture, + [in] GLint level); + void FrontFace([in] PP_Resource context, + [in] GLenum mode); + void GenBuffers([in] PP_Resource context, + [in] GLsizei n, + [out] GLuint_ptr_t buffers); + void GenerateMipmap([in] PP_Resource context, + [in] GLenum target); + void GenFramebuffers([in] PP_Resource context, + [in] GLsizei n, + [out] GLuint_ptr_t framebuffers); + void GenRenderbuffers([in] PP_Resource context, + [in] GLsizei n, + [out] GLuint_ptr_t renderbuffers); + void GenTextures([in] PP_Resource context, + [in] GLsizei n, + [out] GLuint_ptr_t textures); + void GetActiveAttrib([in] PP_Resource context, + [in] GLuint program, + [in] GLuint index, + [in] GLsizei bufsize, + [out] GLsizei_ptr_t length, + [out] GLint_ptr_t size, + [out] GLenum_ptr_t type, + [out] str_t name); + void GetActiveUniform([in] PP_Resource context, + [in] GLuint program, + [in] GLuint index, + [in] GLsizei bufsize, + [out] GLsizei_ptr_t length, + [out] GLint_ptr_t size, + [out] GLenum_ptr_t type, + [out] str_t name); + void GetAttachedShaders([in] PP_Resource context, + [in] GLuint program, + [in] GLsizei maxcount, + [out] GLsizei_ptr_t count, + [out] GLuint_ptr_t shaders); + GLint GetAttribLocation([in] PP_Resource context, + [in] GLuint program, + [in] cstr_t name); + void GetBooleanv([in] PP_Resource context, + [in] GLenum pname, + [out] GLboolean_ptr_t params); + void GetBufferParameteriv([in] PP_Resource context, + [in] GLenum target, + [in] GLenum pname, + [out] GLint_ptr_t params); + GLenum GetError([in] PP_Resource context); + void GetFloatv([in] PP_Resource context, + [in] GLenum pname, + [out] GLfloat_ptr_t params); + void GetFramebufferAttachmentParameteriv([in] PP_Resource context, + [in] GLenum target, + [in] GLenum attachment, + [in] GLenum pname, + [out] GLint_ptr_t params); + void GetIntegerv([in] PP_Resource context, + [in] GLenum pname, + [out] GLint_ptr_t params); + void GetProgramiv([in] PP_Resource context, + [in] GLuint program, + [in] GLenum pname, + [out] GLint_ptr_t params); + void GetProgramInfoLog([in] PP_Resource context, + [in] GLuint program, + [in] GLsizei bufsize, + [out] GLsizei_ptr_t length, + [out] str_t infolog); + void GetRenderbufferParameteriv([in] PP_Resource context, + [in] GLenum target, + [in] GLenum pname, + [out] GLint_ptr_t params); + void GetShaderiv([in] PP_Resource context, + [in] GLuint shader, + [in] GLenum pname, + [out] GLint_ptr_t params); + void GetShaderInfoLog([in] PP_Resource context, + [in] GLuint shader, + [in] GLsizei bufsize, + [out] GLsizei_ptr_t length, + [out] str_t infolog); + void GetShaderPrecisionFormat([in] PP_Resource context, + [in] GLenum shadertype, + [in] GLenum precisiontype, + [out] GLint_ptr_t range, + [out] GLint_ptr_t precision); + void GetShaderSource([in] PP_Resource context, + [in] GLuint shader, + [in] GLsizei bufsize, + [out] GLsizei_ptr_t length, + [out] str_t source); + GLubyte_ptr_t GetString([in] PP_Resource context, + [in] GLenum name); + void GetTexParameterfv([in] PP_Resource context, + [in] GLenum target, + [in] GLenum pname, + [out] GLfloat_ptr_t params); + void GetTexParameteriv([in] PP_Resource context, + [in] GLenum target, + [in] GLenum pname, + [out] GLint_ptr_t params); + void GetUniformfv([in] PP_Resource context, + [in] GLuint program, + [in] GLint location, + [out] GLfloat_ptr_t params); + void GetUniformiv([in] PP_Resource context, + [in] GLuint program, + [in] GLint location, + [out] GLint_ptr_t params); + GLint GetUniformLocation([in] PP_Resource context, + [in] GLuint program, + [in] cstr_t name); + void GetVertexAttribfv([in] PP_Resource context, + [in] GLuint index, + [in] GLenum pname, + [out] GLfloat_ptr_t params); + void GetVertexAttribiv([in] PP_Resource context, + [in] GLuint index, + [in] GLenum pname, + [out] GLint_ptr_t params); + void GetVertexAttribPointerv([in] PP_Resource context, + [in] GLuint index, + [in] GLenum pname, + [out] mem_ptr_t pointer); + void Hint([in] PP_Resource context, + [in] GLenum target, + [in] GLenum mode); + GLboolean IsBuffer([in] PP_Resource context, + [in] GLuint buffer); + GLboolean IsEnabled([in] PP_Resource context, + [in] GLenum cap); + GLboolean IsFramebuffer([in] PP_Resource context, + [in] GLuint framebuffer); + GLboolean IsProgram([in] PP_Resource context, + [in] GLuint program); + GLboolean IsRenderbuffer([in] PP_Resource context, + [in] GLuint renderbuffer); + GLboolean IsShader([in] PP_Resource context, + [in] GLuint shader); + GLboolean IsTexture([in] PP_Resource context, + [in] GLuint texture); + void LineWidth([in] PP_Resource context, + [in] GLfloat width); + void LinkProgram([in] PP_Resource context, + [in] GLuint program); + void PixelStorei([in] PP_Resource context, + [in] GLenum pname, + [in] GLint param); + void PolygonOffset([in] PP_Resource context, + [in] GLfloat factor, + [in] GLfloat units); + void ReadPixels([in] PP_Resource context, + [in] GLint x, + [in] GLint y, + [in] GLsizei width, + [in] GLsizei height, + [in] GLenum format, + [in] GLenum type, + [out] mem_t pixels); + void ReleaseShaderCompiler([in] PP_Resource context); + void RenderbufferStorage([in] PP_Resource context, + [in] GLenum target, + [in] GLenum internalformat, + [in] GLsizei width, + [in] GLsizei height); + void SampleCoverage([in] PP_Resource context, + [in] GLclampf value, + [in] GLboolean invert); + void Scissor([in] PP_Resource context, + [in] GLint x, + [in] GLint y, + [in] GLsizei width, + [in] GLsizei height); + void ShaderBinary([in] PP_Resource context, + [in] GLsizei n, + [in] GLuint_ptr_t shaders, + [in] GLenum binaryformat, + [in] mem_t binary, + [in] GLsizei length); + void ShaderSource([in] PP_Resource context, + [in] GLuint shader, + [in] GLsizei count, + [out] cstr_t str, + [in] GLint_ptr_t length); + void StencilFunc([in] PP_Resource context, + [in] GLenum func, + [in] GLint ref, + [in] GLuint mask); + void StencilFuncSeparate([in] PP_Resource context, + [in] GLenum face, + [in] GLenum func, + [in] GLint ref, + [in] GLuint mask); + void StencilMask([in] PP_Resource context, + [in] GLuint mask); + void StencilMaskSeparate([in] PP_Resource context, + [in] GLenum face, + [in] GLuint mask); + void StencilOp([in] PP_Resource context, + [in] GLenum fail, + [in] GLenum zfail, + [in] GLenum zpass); + void StencilOpSeparate([in] PP_Resource context, + [in] GLenum face, + [in] GLenum fail, + [in] GLenum zfail, + [in] GLenum zpass); + void TexImage2D([in] PP_Resource context, + [in] GLenum target, + [in] GLint level, + [in] GLint internalformat, + [in] GLsizei width, + [in] GLsizei height, + [in] GLint border, + [in] GLenum format, + [in] GLenum type, + [in] mem_t pixels); + void TexParameterf([in] PP_Resource context, + [in] GLenum target, + [in] GLenum pname, + [in] GLfloat param); + void TexParameterfv([in] PP_Resource context, + [in] GLenum target, + [in] GLenum pname, + [in] GLfloat_ptr_t params); + void TexParameteri([in] PP_Resource context, + [in] GLenum target, + [in] GLenum pname, + [in] GLint param); + void TexParameteriv([in] PP_Resource context, + [in] GLenum target, + [in] GLenum pname, + [in] GLint_ptr_t params); + void TexSubImage2D([in] PP_Resource context, + [in] GLenum target, + [in] GLint level, + [in] GLint xoffset, + [in] GLint yoffset, + [in] GLsizei width, + [in] GLsizei height, + [in] GLenum format, + [in] GLenum type, + [in] mem_t pixels); + void Uniform1f([in] PP_Resource context, + [in] GLint location, + [in] GLfloat x); + void Uniform1fv([in] PP_Resource context, + [in] GLint location, + [in] GLsizei count, + [in] GLfloat_ptr_t v); + void Uniform1i([in] PP_Resource context, + [in] GLint location, + [in] GLint x); + void Uniform1iv([in] PP_Resource context, + [in] GLint location, + [in] GLsizei count, + [in] GLint_ptr_t v); + void Uniform2f([in] PP_Resource context, + [in] GLint location, + [in] GLfloat x, + [in] GLfloat y); + void Uniform2fv([in] PP_Resource context, + [in] GLint location, + [in] GLsizei count, + [in] GLfloat_ptr_t v); + void Uniform2i([in] PP_Resource context, + [in] GLint location, + [in] GLint x, + [in] GLint y); + void Uniform2iv([in] PP_Resource context, + [in] GLint location, + [in] GLsizei count, + [in] GLint_ptr_t v); + void Uniform3f([in] PP_Resource context, + [in] GLint location, + [in] GLfloat x, + [in] GLfloat y, + [in] GLfloat z); + void Uniform3fv([in] PP_Resource context, + [in] GLint location, + [in] GLsizei count, + [in] GLfloat_ptr_t v); + void Uniform3i([in] PP_Resource context, + [in] GLint location, + [in] GLint x, + [in] GLint y, + [in] GLint z); + void Uniform3iv([in] PP_Resource context, + [in] GLint location, + [in] GLsizei count, + [in] GLint_ptr_t v); + void Uniform4f([in] PP_Resource context, + [in] GLint location, + [in] GLfloat x, + [in] GLfloat y, + [in] GLfloat z, + [in] GLfloat w); + void Uniform4fv([in] PP_Resource context, + [in] GLint location, + [in] GLsizei count, + [in] GLfloat_ptr_t v); + void Uniform4i([in] PP_Resource context, + [in] GLint location, + [in] GLint x, + [in] GLint y, + [in] GLint z, + [in] GLint w); + void Uniform4iv([in] PP_Resource context, + [in] GLint location, + [in] GLsizei count, + [in] GLint_ptr_t v); + void UniformMatrix2fv([in] PP_Resource context, + [in] GLint location, + [in] GLsizei count, + [in] GLboolean transpose, + [in] GLfloat_ptr_t value); + void UniformMatrix3fv([in] PP_Resource context, + [in] GLint location, + [in] GLsizei count, + [in] GLboolean transpose, + [in] GLfloat_ptr_t value); + void UniformMatrix4fv([in] PP_Resource context, + [in] GLint location, + [in] GLsizei count, + [in] GLboolean transpose, + [in] GLfloat_ptr_t value); + void UseProgram([in] PP_Resource context, + [in] GLuint program); + void ValidateProgram([in] PP_Resource context, + [in] GLuint program); + void VertexAttrib1f([in] PP_Resource context, + [in] GLuint indx, + [in] GLfloat x); + void VertexAttrib1fv([in] PP_Resource context, + [in] GLuint indx, + [in] GLfloat_ptr_t values); + void VertexAttrib2f([in] PP_Resource context, + [in] GLuint indx, + [in] GLfloat x, + [in] GLfloat y); + void VertexAttrib2fv([in] PP_Resource context, + [in] GLuint indx, + [in] GLfloat_ptr_t values); + void VertexAttrib3f([in] PP_Resource context, + [in] GLuint indx, + [in] GLfloat x, + [in] GLfloat y, + [in] GLfloat z); + void VertexAttrib3fv([in] PP_Resource context, + [in] GLuint indx, + [in] GLfloat_ptr_t values); + void VertexAttrib4f([in] PP_Resource context, + [in] GLuint indx, + [in] GLfloat x, + [in] GLfloat y, + [in] GLfloat z, + [in] GLfloat w); + void VertexAttrib4fv([in] PP_Resource context, + [in] GLuint indx, + [in] GLfloat_ptr_t values); + void VertexAttribPointer([in] PP_Resource context, + [in] GLuint indx, + [in] GLint size, + [in] GLenum type, + [in] GLboolean normalized, + [in] GLsizei stride, + [in] mem_t ptr); + void Viewport([in] PP_Resource context, + [in] GLint x, + [in] GLint y, + [in] GLsizei width, + [in] GLsizei height); +}; + + +[macro="PPB_OPENGLES2_INSTANCEDARRAYS_INTERFACE", force_struct_namespace] +interface PPB_OpenGLES2InstancedArrays { + void DrawArraysInstancedANGLE([in] PP_Resource context, + [in] GLenum mode, + [in] GLint first, + [in] GLsizei count, + [in] GLsizei primcount); + void DrawElementsInstancedANGLE([in] PP_Resource context, + [in] GLenum mode, + [in] GLsizei count, + [in] GLenum type, + [in] mem_t indices, + [in] GLsizei primcount); + void VertexAttribDivisorANGLE([in] PP_Resource context, + [in] GLuint index, + [in] GLuint divisor); +}; + + +[macro="PPB_OPENGLES2_FRAMEBUFFERBLIT_INTERFACE", force_struct_namespace] +interface PPB_OpenGLES2FramebufferBlit { + void BlitFramebufferEXT([in] PP_Resource context, + [in] GLint srcX0, + [in] GLint srcY0, + [in] GLint srcX1, + [in] GLint srcY1, + [in] GLint dstX0, + [in] GLint dstY0, + [in] GLint dstX1, + [in] GLint dstY1, + [in] GLbitfield mask, + [in] GLenum filter); +}; + + +[macro="PPB_OPENGLES2_FRAMEBUFFERMULTISAMPLE_INTERFACE", force_struct_namespace] +interface PPB_OpenGLES2FramebufferMultisample { + void RenderbufferStorageMultisampleEXT([in] PP_Resource context, + [in] GLenum target, + [in] GLsizei samples, + [in] GLenum internalformat, + [in] GLsizei width, + [in] GLsizei height); +}; + + +[macro="PPB_OPENGLES2_CHROMIUMENABLEFEATURE_INTERFACE", force_struct_namespace] +interface PPB_OpenGLES2ChromiumEnableFeature { + GLboolean EnableFeatureCHROMIUM([in] PP_Resource context, + [in] cstr_t feature); +}; + + +[macro="PPB_OPENGLES2_CHROMIUMMAPSUB_INTERFACE", force_struct_namespace] +interface PPB_OpenGLES2ChromiumMapSub { + mem_t MapBufferSubDataCHROMIUM([in] PP_Resource context, + [in] GLuint target, + [in] GLintptr offset, + [in] GLsizeiptr size, + [in] GLenum access); + void UnmapBufferSubDataCHROMIUM([in] PP_Resource context, + [in] mem_t mem); + mem_t MapTexSubImage2DCHROMIUM([in] PP_Resource context, + [in] GLenum target, + [in] GLint level, + [in] GLint xoffset, + [in] GLint yoffset, + [in] GLsizei width, + [in] GLsizei height, + [in] GLenum format, + [in] GLenum type, + [in] GLenum access); + void UnmapTexSubImage2DCHROMIUM([in] PP_Resource context, + [in] mem_t mem); +}; + + +[macro="PPB_OPENGLES2_QUERY_INTERFACE", force_struct_namespace] +interface PPB_OpenGLES2Query { + void GenQueriesEXT([in] PP_Resource context, + [in] GLsizei n, + [out] GLuint_ptr_t queries); + void DeleteQueriesEXT([in] PP_Resource context, + [in] GLsizei n, + [in] GLuint_ptr_t queries); + GLboolean IsQueryEXT([in] PP_Resource context, + [in] GLuint id); + void BeginQueryEXT([in] PP_Resource context, + [in] GLenum target, + [in] GLuint id); + void EndQueryEXT([in] PP_Resource context, + [in] GLenum target); + void GetQueryivEXT([in] PP_Resource context, + [in] GLenum target, + [in] GLenum pname, + [out] GLint_ptr_t params); + void GetQueryObjectuivEXT([in] PP_Resource context, + [in] GLuint id, + [in] GLenum pname, + [out] GLuint_ptr_t params); +}; + + +[macro="PPB_OPENGLES2_VERTEXARRAYOBJECT_INTERFACE", force_struct_namespace] +interface PPB_OpenGLES2VertexArrayObject { + void GenVertexArraysOES([in] PP_Resource context, + [in] GLsizei n, + [out] GLuint_ptr_t arrays); + void DeleteVertexArraysOES([in] PP_Resource context, + [in] GLsizei n, + [in] GLuint_ptr_t arrays); + GLboolean IsVertexArrayOES([in] PP_Resource context, + [in] GLuint array); + void BindVertexArrayOES([in] PP_Resource context, + [in] GLuint array); +}; + diff --git a/browser/extensions/mortar/ppapi/api/ppb_tcp_socket.idl b/browser/extensions/mortar/ppapi/api/ppb_tcp_socket.idl new file mode 100644 index 000000000000..5851f1d3e34d --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/ppb_tcp_socket.idl @@ -0,0 +1,291 @@ +/* Copyright 2013 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * This file defines the PPB_TCPSocket interface. + */ + +label Chrome { + M29 = 1.0, + M31 = 1.1, + M41 = 1.2 +}; + +/** + * Option names used by SetOption(). + */ +[assert_size(4)] +enum PP_TCPSocket_Option { + /** + * Disables coalescing of small writes to make TCP segments, and instead + * delivers data immediately. Value's type is PP_VARTYPE_BOOL. + * On version 1.1 or earlier, this option can only be set after a successful + * Connect() call. On version 1.2 or later, there is no such + * limitation. + */ + PP_TCPSOCKET_OPTION_NO_DELAY = 0, + + /** + * Specifies the total per-socket buffer space reserved for sends. Value's + * type should be PP_VARTYPE_INT32. + * On version 1.1 or earlier, this option can only be set after a successful + * Connect() call. On version 1.2 or later, there is no such + * limitation. + * + * Note: This is only treated as a hint for the browser to set the buffer + * size. Even if SetOption() succeeds, the browser doesn't + * guarantee it will conform to the size. + */ + PP_TCPSOCKET_OPTION_SEND_BUFFER_SIZE = 1, + + /** + * Specifies the total per-socket buffer space reserved for receives. Value's + * type should be PP_VARTYPE_INT32. + * On version 1.1 or earlier, this option can only be set after a successful + * Connect() call. On version 1.2 or later, there is no such + * limitation. + * + * Note: This is only treated as a hint for the browser to set the buffer + * size. Even if SetOption() succeeds, the browser doesn't + * guarantee it will conform to the size. + */ + PP_TCPSOCKET_OPTION_RECV_BUFFER_SIZE = 2 +}; + +/** + * The PPB_TCPSocket interface provides TCP socket operations. + * + * Permissions: Apps permission socket with subrule + * tcp-connect is required for Connect(); subrule + * tcp-listen is required for Listen(). + * For more details about network communication permissions, please see: + * http://developer.chrome.com/apps/app_network.html + */ +interface PPB_TCPSocket { + /** + * Creates a TCP socket resource. + * + * @param[in] instance A PP_Instance identifying one instance of + * a module. + * + * @return A PP_Resource corresponding to a TCP socket or 0 + * on failure. + */ + PP_Resource Create([in] PP_Instance instance); + + /** + * Determines if a given resource is a TCP socket. + * + * @param[in] resource A PP_Resource to check. + * + * @return PP_TRUE if the input is a + * PPB_TCPSocket resource; PP_FALSE otherwise. + */ + PP_Bool IsTCPSocket([in] PP_Resource resource); + + /** + * Binds the socket to the given address. The socket must not be bound. + * + * @param[in] tcp_socket A PP_Resource corresponding to a TCP + * socket. + * @param[in] addr A PPB_NetAddress resource. + * @param[in] callback A PP_CompletionCallback to be called upon + * completion. + * + * @return An int32_t containing an error code from pp_errors.h, + * including (but not limited to): + * - PP_ERROR_ADDRESS_IN_USE: the address is already in use. + * - PP_ERROR_ADDRESS_INVALID: the address is invalid. + */ + [version=1.1] + int32_t Bind([in] PP_Resource tcp_socket, + [in] PP_Resource addr, + [in] PP_CompletionCallback callback); + + /** + * Connects the socket to the given address. The socket must not be listening. + * Binding the socket beforehand is optional. + * + * @param[in] tcp_socket A PP_Resource corresponding to a TCP + * socket. + * @param[in] addr A PPB_NetAddress resource. + * @param[in] callback A PP_CompletionCallback to be called upon + * completion. + * + * @return An int32_t containing an error code from pp_errors.h, + * including (but not limited to): + * - PP_ERROR_NOACCESS: the caller doesn't have required + * permissions. + * - PP_ERROR_ADDRESS_UNREACHABLE: addr is + * unreachable. + * - PP_ERROR_CONNECTION_REFUSED: the connection attempt was + * refused. + * - PP_ERROR_CONNECTION_FAILED: the connection attempt failed. + * - PP_ERROR_CONNECTION_TIMEDOUT: the connection attempt timed + * out. + * + * Since version 1.1, if the socket is listening/connected or has a pending + * listen/connect request, Connect() will fail without starting a + * connection attempt; otherwise, any failure during the connection attempt + * will cause the socket to be closed. + */ + int32_t Connect([in] PP_Resource tcp_socket, + [in] PP_Resource addr, + [in] PP_CompletionCallback callback); + + /** + * Gets the local address of the socket, if it is bound. + * + * @param[in] tcp_socket A PP_Resource corresponding to a TCP + * socket. + * + * @return A PPB_NetAddress resource on success or 0 on failure. + */ + PP_Resource GetLocalAddress([in] PP_Resource tcp_socket); + + /** + * Gets the remote address of the socket, if it is connected. + * + * @param[in] tcp_socket A PP_Resource corresponding to a TCP + * socket. + * + * @return A PPB_NetAddress resource on success or 0 on failure. + */ + PP_Resource GetRemoteAddress([in] PP_Resource tcp_socket); + + /** + * Reads data from the socket. The socket must be connected. It may perform a + * partial read. + * + * @param[in] tcp_socket A PP_Resource corresponding to a TCP + * socket. + * @param[out] buffer The buffer to store the received data on success. It + * must be at least as large as bytes_to_read. + * @param[in] bytes_to_read The number of bytes to read. + * @param[in] callback A PP_CompletionCallback to be called upon + * completion. + * + * @return A non-negative number on success to indicate how many bytes have + * been read, 0 means that end-of-file was reached; otherwise, an error code + * from pp_errors.h. + */ + int32_t Read([in] PP_Resource tcp_socket, + [out] str_t buffer, + [in] int32_t bytes_to_read, + [in] PP_CompletionCallback callback); + + /** + * Writes data to the socket. The socket must be connected. It may perform a + * partial write. + * + * @param[in] tcp_socket A PP_Resource corresponding to a TCP + * socket. + * @param[in] buffer The buffer containing the data to write. + * @param[in] bytes_to_write The number of bytes to write. + * @param[in] callback A PP_CompletionCallback to be called upon + * completion. + * + * @return A non-negative number on success to indicate how many bytes have + * been written; otherwise, an error code from pp_errors.h. + */ + int32_t Write([in] PP_Resource tcp_socket, + [in] str_t buffer, + [in] int32_t bytes_to_write, + [in] PP_CompletionCallback callback); + /** + * Starts listening. The socket must be bound and not connected. + * + * @param[in] tcp_socket A PP_Resource corresponding to a TCP + * socket. + * @param[in] backlog A hint to determine the maximum length to which the + * queue of pending connections may grow. + * @param[in] callback A PP_CompletionCallback to be called upon + * completion. + * + * @return An int32_t containing an error code from pp_errors.h, + * including (but not limited to): + * - PP_ERROR_NOACCESS: the caller doesn't have required + * permissions. + * - PP_ERROR_ADDRESS_IN_USE: Another socket is already listening + * on the same port. + */ + [version=1.1] + int32_t Listen([in] PP_Resource tcp_socket, + [in] int32_t backlog, + [in] PP_CompletionCallback callback); + + /** + * Accepts a connection. The socket must be listening. + * + * @param[in] tcp_socket A PP_Resource corresponding to a TCP + * socket. + * @param[out] accepted_tcp_socket Stores the accepted TCP socket on success. + * @param[in] callback A PP_CompletionCallback to be called upon + * completion. + * + * @return An int32_t containing an error code from pp_errors.h, + * including (but not limited to): + * - PP_ERROR_CONNECTION_ABORTED: A connection has been aborted. + */ + [version=1.1] + int32_t Accept([in] PP_Resource tcp_socket, + [out] PP_Resource accepted_tcp_socket, + [in] PP_CompletionCallback callback); + + /** + * Cancels all pending operations and closes the socket. Any pending callbacks + * will still run, reporting PP_ERROR_ABORTED if pending IO was + * interrupted. After a call to this method, no output buffer pointers passed + * into previous Read() or Accept() calls will be + * accessed. It is not valid to call Connect() or + * Listen() again. + * + * The socket is implicitly closed if it is destroyed, so you are not required + * to call this method. + * + * @param[in] tcp_socket A PP_Resource corresponding to a TCP + * socket. + */ + void Close([in] PP_Resource tcp_socket); + + /** + * Sets a socket option on the TCP socket. + * Please see the PP_TCPSocket_Option description for option + * names, value types and allowed values. + * + * @param[in] tcp_socket A PP_Resource corresponding to a TCP + * socket. + * @param[in] name The option to set. + * @param[in] value The option value to set. + * @param[in] callback A PP_CompletionCallback to be called upon + * completion. + * + * @return An int32_t containing an error code from pp_errors.h. + */ + int32_t SetOption([in] PP_Resource tcp_socket, + [in] PP_TCPSocket_Option name, + [in] PP_Var value, + [in] PP_CompletionCallback callback); + + /** + * Sets a socket option on the TCP socket. + * Please see the PP_TCPSocket_Option description for option + * names, value types and allowed values. + * + * @param[in] tcp_socket A PP_Resource corresponding to a TCP + * socket. + * @param[in] name The option to set. + * @param[in] value The option value to set. + * @param[in] callback A PP_CompletionCallback to be called upon + * completion. + * + * @return An int32_t containing an error code from pp_errors.h. + */ + [version=1.2] + int32_t SetOption([in] PP_Resource tcp_socket, + [in] PP_TCPSocket_Option name, + [in] PP_Var value, + [in] PP_CompletionCallback callback); +}; diff --git a/browser/extensions/mortar/ppapi/api/ppb_text_input_controller.idl b/browser/extensions/mortar/ppapi/api/ppb_text_input_controller.idl new file mode 100644 index 000000000000..63a9b19bdd1c --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/ppb_text_input_controller.idl @@ -0,0 +1,95 @@ +/* Copyright 2013 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * This file defines the PPB_TextInputController interface. + */ + +label Chrome { + M30 = 1.0 +}; + +/** + * PP_TextInput_Type is used to indicate the status of a plugin in regard to + * text input. + */ +[assert_size(4)] +enum PP_TextInput_Type { + /** + * Input caret is not in an editable mode, no input method shall be used. + */ + PP_TEXTINPUT_TYPE_NONE = 0, + /** + * Input caret is in a normal editable mode, any input method can be used. + */ + PP_TEXTINPUT_TYPE_TEXT = 1, + /** + * Input caret is in a password box, an input method may be used only if + * it's suitable for password input. + */ + PP_TEXTINPUT_TYPE_PASSWORD = 2, + PP_TEXTINPUT_TYPE_SEARCH = 3, + PP_TEXTINPUT_TYPE_EMAIL = 4, + PP_TEXTINPUT_TYPE_NUMBER = 5, + PP_TEXTINPUT_TYPE_TELEPHONE = 6, + PP_TEXTINPUT_TYPE_URL = 7 +}; + +/** + * PPB_TextInputController provides a set of functions for giving + * hints to the browser about the text input status of plugins, and functions + * for controlling input method editors (IMEs). + */ +interface PPB_TextInputController { + /** + * Informs the browser about the current text input mode of the plugin. + * Typical use of this information in the browser is to properly + * display/suppress tools for supporting text inputs (such as virtual + * keyboards in touch screen based devices, or input method editors often + * used for composing East Asian characters). + */ + void SetTextInputType([in] PP_Instance instance, + [in] PP_TextInput_Type type); + + /** + * Informs the browser about the coordinates of the text input caret area. + * Typical use of this information in the browser is to layout IME windows + * etc. + */ + void UpdateCaretPosition([in] PP_Instance instance, + [in] PP_Rect caret); + + /** + * Cancels the current composition in IME. + */ + void CancelCompositionText([in] PP_Instance instance); + + /** + * Informs the browser about the current text selection and surrounding + * text. text is a UTF-8 string that contains the current range + * of text selection in the plugin. caret is the byte-index of + * the caret position within text. anchor is the + * byte-index of the anchor position (i.e., if a range of text is selected, + * it is the other edge of selection different from caret. If + * there are no selection, anchor is equal to caret. + * + * Typical use of this information in the browser is to enable "reconversion" + * features of IME that puts back the already committed text into the + * pre-commit composition state. Another use is to improve the precision + * of suggestion of IME by taking the context into account (e.g., if the caret + * looks to be on the beginning of a sentence, suggest capital letters in a + * virtual keyboard). + * + * When the focus is not on text, call this function setting text + * to an empty string and caret and anchor to zero. + * Also, the plugin should send the empty text when it does not want to reveal + * the selection to IME (e.g., when the surrounding text is containing + * password text). + */ + void UpdateSurroundingText([in] PP_Instance instance, + [in] PP_Var text, + [in] uint32_t caret, + [in] uint32_t anchor); +}; diff --git a/browser/extensions/mortar/ppapi/api/ppb_udp_socket.idl b/browser/extensions/mortar/ppapi/api/ppb_udp_socket.idl new file mode 100644 index 000000000000..a9e7f84c22cf --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/ppb_udp_socket.idl @@ -0,0 +1,303 @@ +/* Copyright 2013 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * This file defines the PPB_UDPSocket interface. + */ + +[generate_thunk] + +label Chrome { + M29 = 1.0, + M41 = 1.1, + M43 = 1.2 +}; + +/** + * Option names used by SetOption(). + */ +[assert_size(4)] +enum PP_UDPSocket_Option { + /** + * Allows the socket to share the local address to which it will be bound with + * other processes. Value's type should be PP_VARTYPE_BOOL. + * This option can only be set before calling Bind(). + */ + PP_UDPSOCKET_OPTION_ADDRESS_REUSE = 0, + + /** + * Allows sending and receiving packets to and from broadcast addresses. + * Value's type should be PP_VARTYPE_BOOL. + * On version 1.0, this option can only be set before calling + * Bind(). On version 1.1 or later, there is no such limitation. + */ + PP_UDPSOCKET_OPTION_BROADCAST = 1, + + /** + * Specifies the total per-socket buffer space reserved for sends. Value's + * type should be PP_VARTYPE_INT32. + * On version 1.0, this option can only be set after a successful + * Bind() call. On version 1.1 or later, there is no such + * limitation. + * + * Note: This is only treated as a hint for the browser to set the buffer + * size. Even if SetOption() succeeds, the browser doesn't + * guarantee it will conform to the size. + */ + PP_UDPSOCKET_OPTION_SEND_BUFFER_SIZE = 2, + + /** + * Specifies the total per-socket buffer space reserved for receives. Value's + * type should be PP_VARTYPE_INT32. + * On version 1.0, this option can only be set after a successful + * Bind() call. On version 1.1 or later, there is no such + * limitation. + * + * Note: This is only treated as a hint for the browser to set the buffer + * size. Even if SetOption() succeeds, the browser doesn't + * guarantee it will conform to the size. + */ + PP_UDPSOCKET_OPTION_RECV_BUFFER_SIZE = 3, + + /** + * Specifies whether the packets sent from the host to the multicast group + * should be looped back to the host or not. Value's type should be + * PP_VARTYPE_BOOL. + * This option can only be set before calling Bind(). + * + * This is only supported in version 1.2 of the API (Chrome 43) and later. + */ + PP_UDPSOCKET_OPTION_MULTICAST_LOOP = 4, + + /** + * Specifies the time-to-live for packets sent to the multicast group. The + * value should be within 0 to 255 range. The default value is 1 and means + * that packets will not be routed beyond the local network. Value's type + * should be PP_VARTYPE_INT32. + * This option can only be set before calling Bind(). + * + * This is only supported in version 1.2 of the API (Chrome 43) and later. + */ + PP_UDPSOCKET_OPTION_MULTICAST_TTL = 5 +}; + +/** + * The PPB_UDPSocket interface provides UDP socket operations. + * + * Permissions: Apps permission socket with subrule + * udp-bind is required for Bind(); subrule + * udp-send-to is required for SendTo(). + * For more details about network communication permissions, please see: + * http://developer.chrome.com/apps/app_network.html + */ +interface PPB_UDPSocket { + /** + * Creates a UDP socket resource. + * + * @param[in] instance A PP_Instance identifying one instance of + * a module. + * + * @return A PP_Resource corresponding to a UDP socket or 0 + * on failure. + */ + PP_Resource Create([in] PP_Instance instance); + + /** + * Determines if a given resource is a UDP socket. + * + * @param[in] resource A PP_Resource to check. + * + * @return PP_TRUE if the input is a PPB_UDPSocket + * resource; PP_FALSE otherwise. + */ + PP_Bool IsUDPSocket([in] PP_Resource resource); + + /** + * Binds the socket to the given address. + * + * @param[in] udp_socket A PP_Resource corresponding to a UDP + * socket. + * @param[in] addr A PPB_NetAddress resource. + * @param[in] callback A PP_CompletionCallback to be called upon + * completion. + * + * @return An int32_t containing an error code from pp_errors.h. + * PP_ERROR_NOACCESS will be returned if the caller doesn't have + * required permissions. PP_ERROR_ADDRESS_IN_USE will be returned + * if the address is already in use. + */ + int32_t Bind([in] PP_Resource udp_socket, + [in] PP_Resource addr, + [in] PP_CompletionCallback callback); + + /** + * Gets the address that the socket is bound to. The socket must be bound. + * + * @param[in] udp_socket A PP_Resource corresponding to a UDP + * socket. + * + * @return A PPB_NetAddress resource on success or 0 on failure. + */ + PP_Resource GetBoundAddress([in] PP_Resource udp_socket); + + /** + * Receives data from the socket and stores the source address. The socket + * must be bound. + * + * @param[in] udp_socket A PP_Resource corresponding to a UDP + * socket. + * @param[out] buffer The buffer to store the received data on success. It + * must be at least as large as num_bytes. + * @param[in] num_bytes The number of bytes to receive. + * @param[out] addr A PPB_NetAddress resource to store the source + * address on success. + * @param[in] callback A PP_CompletionCallback to be called upon + * completion. + * + * @return A non-negative number on success to indicate how many bytes have + * been received; otherwise, an error code from pp_errors.h. + */ + int32_t RecvFrom([in] PP_Resource udp_socket, + [out] str_t buffer, + [in] int32_t num_bytes, + [out] PP_Resource addr, + [in] PP_CompletionCallback callback); + + /** + * Sends data to a specific destination. The socket must be bound. + * + * @param[in] udp_socket A PP_Resource corresponding to a UDP + * socket. + * @param[in] buffer The buffer containing the data to send. + * @param[in] num_bytes The number of bytes to send. + * @param[in] addr A PPB_NetAddress resource holding the + * destination address. + * @param[in] callback A PP_CompletionCallback to be called upon + * completion. + * + * @return A non-negative number on success to indicate how many bytes have + * been sent; otherwise, an error code from pp_errors.h. + * PP_ERROR_NOACCESS will be returned if the caller doesn't have + * required permissions. + * PP_ERROR_INPROGRESS will be returned if the socket is busy + * sending. The caller should wait until a pending send completes before + * retrying. + */ + int32_t SendTo([in] PP_Resource udp_socket, + [in] str_t buffer, + [in] int32_t num_bytes, + [in] PP_Resource addr, + [in] PP_CompletionCallback callback); + + /** + * Cancels all pending reads and writes, and closes the socket. Any pending + * callbacks will still run, reporting PP_ERROR_ABORTED if + * pending IO was interrupted. After a call to this method, no output + * parameters passed into previous RecvFrom() calls will be + * accessed. It is not valid to call Bind() again. + * + * The socket is implicitly closed if it is destroyed, so you are not + * required to call this method. + * + * @param[in] udp_socket A PP_Resource corresponding to a UDP + * socket. + */ + void Close([in] PP_Resource udp_socket); + + /** + * Sets a socket option on the UDP socket. + * Please see the PP_UDPSocket_Option description for option + * names, value types and allowed values. + * + * @param[in] udp_socket A PP_Resource corresponding to a UDP + * socket. + * @param[in] name The option to set. + * @param[in] value The option value to set. + * @param[in] callback A PP_CompletionCallback to be called upon + * completion. + * + * @return An int32_t containing an error code from pp_errors.h. + */ + int32_t SetOption([in] PP_Resource udp_socket, + [in] PP_UDPSocket_Option name, + [in] PP_Var value, + [in] PP_CompletionCallback callback); + + /** + * Sets a socket option on the UDP socket. + * Please see the PP_UDPSocket_Option description for option + * names, value types and allowed values. + * + * @param[in] udp_socket A PP_Resource corresponding to a UDP + * socket. + * @param[in] name The option to set. + * @param[in] value The option value to set. + * @param[in] callback A PP_CompletionCallback to be called upon + * completion. + * + * @return An int32_t containing an error code from pp_errors.h. + */ + [version=1.1] + int32_t SetOption([in] PP_Resource udp_socket, + [in] PP_UDPSocket_Option name, + [in] PP_Var value, + [in] PP_CompletionCallback callback); + + /** + * Sets a socket option on the UDP socket. + * Please see the PP_UDPSocket_Option description for option + * names, value types and allowed values. + * + * @param[in] udp_socket A PP_Resource corresponding to a UDP + * socket. + * @param[in] name The option to set. + * @param[in] value The option value to set. + * @param[in] callback A PP_CompletionCallback to be called upon + * completion. + * + * @return An int32_t containing an error code from pp_errors.h. + */ + [version=1.2] + int32_t SetOption([in] PP_Resource udp_socket, + [in] PP_UDPSocket_Option name, + [in] PP_Var value, + [in] PP_CompletionCallback callback); + + /** + * Joins the multicast group with address specified by group + * parameter, which is expected to be a PPB_NetAddress object. + * + * @param[in] udp_socket A PP_Resource corresponding to a UDP + * socket. + * @param[in] group A PP_Resource corresponding to the network + * address of the multicast group. + * @param[in] callback A PP_CompletionCallback to be called upon + * completion. + * + * @return An int32_t containing an error code from pp_errors.h. + */ + [version=1.2] + int32_t JoinGroup([in] PP_Resource udp_socket, + [in] PP_Resource group, + [in] PP_CompletionCallback callback); + + /** + * Leaves the multicast group with address specified by group + * parameter, which is expected to be a PPB_NetAddress object. + * + * @param[in] udp_socket A PP_Resource corresponding to a UDP + * socket. + * @param[in] group A PP_Resource corresponding to the network + * address of the multicast group. + * @param[in] callback A PP_CompletionCallback to be called upon + * completion. + * + * @return An int32_t containing an error code from pp_errors.h. + */ + [version=1.2] + int32_t LeaveGroup([in] PP_Resource udp_socket, + [in] PP_Resource group, + [in] PP_CompletionCallback callback); +}; diff --git a/browser/extensions/mortar/ppapi/api/ppb_url_loader.idl b/browser/extensions/mortar/ppapi/api/ppb_url_loader.idl new file mode 100644 index 000000000000..6e1a271d8e08 --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/ppb_url_loader.idl @@ -0,0 +1,225 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * This file defines the PPB_URLLoader interface for loading + * URLs. + */ + +[generate_thunk] + +label Chrome { + M14 = 1.0 +}; + +/** + * The PPB_URLLoader interface contains pointers to functions + * for loading URLs. The typical steps for loading a URL are: + * + * -# Call Create() to create a URLLoader object. + * -# Create a URLRequestInfo object and set properties on it. + * Refer to PPB_URLRequestInfo for further information. + * -# Call Open() with the URLRequestInfo as an argument. + * -# When Open() completes, call GetResponseInfo() to examine the response + * headers. Refer to PPB_URLResponseInfo for further information. + * -# Call ReadResponseBody() to stream the data for the response. + * + * Alternatively, if PP_URLREQUESTPROPERTY_STREAMTOFILE was set on + * the URLRequestInfo in step #2: + * - Call FinishStreamingToFile(), after examining the response headers + * (step #4), to wait for the downloaded file to be complete. + * - Then, access the downloaded file using the GetBodyAsFileRef() function of + * the URLResponseInfo returned in step #4. + */ +interface PPB_URLLoader { + /** + * Create() creates a new URLLoader object. The + * URLLoader is associated with a particular instance, so that + * any UI dialogs that need to be shown to the user can be positioned + * relative to the window containing the instance. + * + * @param[in] instance A PP_Instance identifying one instance + * of a module. + * + * @return A PP_Resource corresponding to a URLLoader if + * successful, 0 if the instance is invalid. + */ + PP_Resource Create( + [in] PP_Instance instance); + + /** + * IsURLLoader() determines if a resource is an URLLoader. + * + * @param[in] resource A PP_Resource corresponding to a + * URLLoader. + * + * @return PP_TRUE if the resource is a URLLoader, + * PP_FALSE if the resource is invalid or some type other + * than URLLoader. + */ + PP_Bool IsURLLoader( + [in] PP_Resource resource); + + /** + * Open() begins loading the URLRequestInfo. The operation + * completes when response headers are received or when an error occurs. Use + * GetResponseInfo() to access the response headers. + * + * @param[in] loader A PP_Resource corresponding to a + * URLLoader. + * @param[in] resource A PP_Resource corresponding to a + * URLRequestInfo. + * @param[in] callback A PP_CompletionCallback to run on + * asynchronous completion of Open(). This callback will run when response + * headers for the url are received or error occurred. This callback + * will only run if Open() returns PP_OK_COMPLETIONPENDING. + * + * @return An int32_t containing an error code from pp_errors.h. + */ + int32_t Open( + [in] PP_Resource loader, + [in] PP_Resource request_info, + [in] PP_CompletionCallback callback); + + /** + * FollowRedirect() can be invoked to follow a redirect after Open() + * completed on receiving redirect headers. + * + * @param[in] loader A PP_Resource corresponding to a + * URLLoader. + * @param[in] callback A PP_CompletionCallback to run on + * asynchronous completion of FollowRedirect(). This callback will run when + * response headers for the redirect url are received or error occurred. This + * callback will only run if FollowRedirect() returns + * PP_OK_COMPLETIONPENDING. + * + * @return An int32_t containing an error code from pp_errors.h. + */ + int32_t FollowRedirect( + [in] PP_Resource loader, + [in] PP_CompletionCallback callback); + + /** + * GetUploadProgress() returns the current upload progress (which is + * meaningful after Open() has been called). Progress only refers to the + * request body and does not include the headers. + * + * This data is only available if the URLRequestInfo passed + * to Open() had the PP_URLREQUESTPROPERTY_REPORTUPLOADPROGRESS + * property set to PP_TRUE. + * + * @param[in] loader A PP_Resource corresponding to a + * URLLoader. + * @param[in] bytes_sent The number of bytes sent thus far. + * @param[in] total_bytes_to_be_sent The total number of bytes to be sent. + * + * @return PP_TRUE if the upload progress is available, + * PP_FALSE if it is not available. + */ + [always_set_output_parameters] + PP_Bool GetUploadProgress( + [in] PP_Resource loader, + [out] int64_t bytes_sent, + [out] int64_t total_bytes_to_be_sent); + + /** + * GetDownloadProgress() returns the current download progress, which is + * meaningful after Open() has been called. Progress only refers to the + * response body and does not include the headers. + * + * This data is only available if the URLRequestInfo passed to + * Open() had the PP_URLREQUESTPROPERTY_REPORTDOWNLOADPROGRESS + * property set to PP_TRUE. + * + * @param[in] loader A PP_Resource corresponding to a + * URLLoader. + * @param[in] bytes_received The number of bytes received thus far. + * @param[in] total_bytes_to_be_received The total number of bytes to be + * received. The total bytes to be received may be unknown, in which case + * total_bytes_to_be_received will be set to -1. + * + * @return PP_TRUE if the download progress is available, + * PP_FALSE if it is not available. + */ + [always_set_output_parameters] + PP_Bool GetDownloadProgress( + [in] PP_Resource loader, + [out] int64_t bytes_received, + [out] int64_t total_bytes_to_be_received); + + /** + * GetResponseInfo() returns the current URLResponseInfo object. + * + * @param[in] instance A PP_Resource corresponding to a + * URLLoader. + * + * @return A PP_Resource corresponding to the + * URLResponseInfo if successful, 0 if the loader is not a valid + * resource or if Open() has not been called. + */ + PP_Resource GetResponseInfo( + [in] PP_Resource loader); + + /** + * ReadResponseBody() is used to read the response body. The size of the + * buffer must be large enough to hold the specified number of bytes to read. + * This function might perform a partial read. + * + * @param[in] loader A PP_Resource corresponding to a + * URLLoader. + * @param[in,out] buffer A pointer to the buffer for the response body. + * @param[in] bytes_to_read The number of bytes to read. + * @param[in] callback A PP_CompletionCallback to run on + * asynchronous completion. The callback will run if the bytes (full or + * partial) are read or an error occurs asynchronously. This callback will + * run only if this function returns PP_OK_COMPLETIONPENDING. + * + * @return An int32_t containing the number of bytes read or an error code + * from pp_errors.h. + */ + int32_t ReadResponseBody( + [in] PP_Resource loader, + [out] mem_t buffer, + [in] int32_t bytes_to_read, + [in] PP_CompletionCallback callback); + + /** + * FinishStreamingToFile() is used to wait for the response body to be + * completely downloaded to the file provided by the GetBodyAsFileRef() + * in the current URLResponseInfo. This function is only used if + * PP_URLREQUESTPROPERTY_STREAMTOFILE was set on the + * URLRequestInfo passed to Open(). + * + * @param[in] loader A PP_Resource corresponding to a + * URLLoader. + * @param[in] callback A PP_CompletionCallback to run on + * asynchronous completion. This callback will run when body is downloaded + * or an error occurs after FinishStreamingToFile() returns + * PP_OK_COMPLETIONPENDING. + * + * @return An int32_t containing the number of bytes read or an error code + * from pp_errors.h. + */ + int32_t FinishStreamingToFile( + [in] PP_Resource loader, + [in] PP_CompletionCallback callback); + + /** + * Close is a pointer to a function used to cancel any pending IO and close + * the URLLoader object. Any pending callbacks will still run, + * reporting PP_ERROR_ABORTED if pending IO was interrupted. + * It is NOT valid to call Open() again after a call to this function. + * + * Note: If the URLLoader object is destroyed + * while it is still open, then it will be implicitly closed so you are not + * required to call Close(). + * + * @param[in] loader A PP_Resource corresponding to a + * URLLoader. + */ + void Close( + [in] PP_Resource loader); +}; + diff --git a/browser/extensions/mortar/ppapi/api/ppb_url_request_info.idl b/browser/extensions/mortar/ppapi/api/ppb_url_request_info.idl new file mode 100644 index 000000000000..856ae813abb5 --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/ppb_url_request_info.idl @@ -0,0 +1,260 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * This file defines the PPB_URLRequestInfo API for creating and + * manipulating URL requests. + */ + +[generate_thunk] + +label Chrome { + M14 = 1.0 +}; + +/** + * This enumeration contains properties that can be set on a URL request. + */ +[assert_size(4)] +enum PP_URLRequestProperty { + /** This corresponds to a string (PP_VARTYPE_STRING). */ + PP_URLREQUESTPROPERTY_URL = 0, + + /** + * This corresponds to a string (PP_VARTYPE_STRING); either + * POST or GET. Refer to the + * HTTP + * Methods documentation for further information. + * + */ + PP_URLREQUESTPROPERTY_METHOD = 1, + + /** + * This corresponds to a string (PP_VARTYPE_STRING); \n + * delimited. Refer to the + * documentation for further information. + */ + PP_URLREQUESTPROPERTY_HEADERS = 2, + + /** + * This corresponds to a PP_Bool (PP_VARTYPE_BOOL; + * default=PP_FALSE). + * Set this value to PP_TRUE if you want to download the data + * to a file. Use PPB_URLLoader.FinishStreamingToFile() to complete the + * download. + */ + PP_URLREQUESTPROPERTY_STREAMTOFILE = 3, + + /** + * This corresponds to a PP_Bool (PP_VARTYPE_BOOL; + * default=PP_TRUE). + * Set this value to PP_FALSE if you want to use + * PPB_URLLoader.FollowRedirects() to follow the redirects only after + * examining redirect headers. + */ + PP_URLREQUESTPROPERTY_FOLLOWREDIRECTS = 4, + + /** + * This corresponds to a PP_Bool (PP_VARTYPE_BOOL; + * default=PP_FALSE). + * Set this value to PP_TRUE if you want to be able to poll the + * download progress using PPB_URLLoader.GetDownloadProgress(). + */ + PP_URLREQUESTPROPERTY_RECORDDOWNLOADPROGRESS = 5, + + /** + * This corresponds to a PP_Bool + * (default=PP_FALSE). Set this value to PP_TRUE if + * you want to be able to poll the upload progress using + * PPB_URLLoader.GetUploadProgress(). + */ + PP_URLREQUESTPROPERTY_RECORDUPLOADPROGRESS = 6, + + /** + * This corresponds to a string (PP_VARTYPE_STRING) or may be + * undefined (PP_VARTYPE_UNDEFINED; default). + * Set it to a string to set a custom referrer (if empty, the referrer header + * will be omitted), or to undefined to use the default referrer. Only loaders + * with universal access (only available on trusted implementations) will + * accept URLRequestInfo objects that try to set a custom + * referrer; if given to a loader without universal access, + * PP_ERROR_NOACCESS will result. + */ + PP_URLREQUESTPROPERTY_CUSTOMREFERRERURL = 7, + + /** + * This corresponds to a PP_Bool (PP_VARTYPE_BOOL; + * default=PP_FALSE). Whether cross-origin requests are allowed. + * Cross-origin requests are made using the CORS (Cross-Origin Resource + * Sharing) algorithm to check whether the request should be allowed. For the + * complete CORS algorithm, refer to + * the Cross-Origin Resource + * Sharing documentation. + */ + PP_URLREQUESTPROPERTY_ALLOWCROSSORIGINREQUESTS = 8, + + /** + * This corresponds to a PP_Bool (PP_VARTYPE_BOOL; + * default=PP_FALSE). + * Whether HTTP credentials are sent with cross-origin requests. If false, + * no credentials are sent with the request and cookies are ignored in the + * response. If the request is not cross-origin, this property is ignored. + */ + PP_URLREQUESTPROPERTY_ALLOWCREDENTIALS = 9, + + /** + * This corresponds to a string (PP_VARTYPE_STRING) or may be + * undefined (PP_VARTYPE_UNDEFINED; default). + * Set it to a string to set a custom content-transfer-encoding header (if + * empty, that header will be omitted), or to undefined to use the default + * (if any). Only loaders with universal access (only available on trusted + * implementations) will accept URLRequestInfo objects that try + * to set a custom content transfer encoding; if given to a loader without + * universal access, PP_ERROR_NOACCESS will result. + */ + PP_URLREQUESTPROPERTY_CUSTOMCONTENTTRANSFERENCODING = 10, + + /** + * This corresponds to an integer (PP_VARTYPE_INT32); default + * is not defined and is set by the browser, possibly depending on system + * capabilities. Set it to an integer to set an upper threshold for the + * prefetched buffer of an asynchronous load. When exceeded, the browser will + * defer loading until + * PP_URLREQUESTPROPERTY_PREFETCHBUFFERLOWERERTHRESHOLD is hit, + * at which time it will begin prefetching again. When setting this property, + * PP_URLREQUESTPROPERTY_PREFETCHBUFFERLOWERERTHRESHOLD must also + * be set. Behavior is undefined if the former is <= the latter. + */ + PP_URLREQUESTPROPERTY_PREFETCHBUFFERUPPERTHRESHOLD = 11, + + /** + * This corresponds to an integer (PP_VARTYPE_INT32); default is + * not defined and is set by the browser to a value appropriate for the + * default PP_URLREQUESTPROPERTY_PREFETCHBUFFERUPPERTHRESHOLD. + * Set it to an integer to set a lower threshold for the prefetched buffer + * of an asynchronous load. When reached, the browser will resume loading if + * If PP_URLREQUESTPROPERTY_PREFETCHBUFFERLOWERERTHRESHOLD had + * previously been reached. + * When setting this property, + * PP_URLREQUESTPROPERTY_PREFETCHBUFFERUPPERTHRESHOLD must also + * be set. Behavior is undefined if the former is >= the latter. + */ + PP_URLREQUESTPROPERTY_PREFETCHBUFFERLOWERTHRESHOLD = 12, + + /** + * This corresponds to a string (PP_VARTYPE_STRING) or may be + * undefined (PP_VARTYPE_UNDEFINED; default). Set it to a string + * to set a custom user-agent header (if empty, that header will be omitted), + * or to undefined to use the default. Only loaders with universal access + * (only available on trusted implementations) will accept + * URLRequestInfo objects that try to set a custom user agent; if + * given to a loader without universal access, PP_ERROR_NOACCESS + * will result. + */ + PP_URLREQUESTPROPERTY_CUSTOMUSERAGENT = 13 +}; + +/** + * The PPB_URLRequestInfo interface is used to create + * and handle URL requests. This API is used in conjunction with + * PPB_URLLoader. Refer to PPB_URLLoader for further + * information. + */ +interface PPB_URLRequestInfo { + /** + * Create() creates a new URLRequestInfo object. + * + * @param[in] instance A PP_Instance identifying one instance + * of a module. + * + * @return A PP_Resource identifying the + * URLRequestInfo if successful, 0 if the instance is invalid. + */ + PP_Resource Create( + [in] PP_Instance instance); + + /** + * IsURLRequestInfo() determines if a resource is a + * URLRequestInfo. + * + * @param[in] resource A PP_Resource corresponding to a + * URLRequestInfo. + * + * @return PP_TRUE if the resource is a + * URLRequestInfo, PP_FALSE if the resource is + * invalid or some type other than URLRequestInfo. + */ + PP_Bool IsURLRequestInfo( + [in] PP_Resource resource); + + /** + * SetProperty() sets a request property. The value of the property must be + * the correct type according to the property being set. + * + * @param[in] request A PP_Resource corresponding to a + * URLRequestInfo. + * @param[in] property A PP_URLRequestProperty identifying the + * property to set. + * @param[in] value A PP_Var containing the property value. + * + * @return PP_TRUE if successful, PP_FALSE if any + * of the parameters are invalid. + */ + PP_Bool SetProperty( + [in] PP_Resource request, + [in] PP_URLRequestProperty property, + [in] PP_Var value); + + /** + * AppendDataToBody() appends data to the request body. A Content-Length + * request header will be automatically generated. + * + * @param[in] request A PP_Resource corresponding to a + * URLRequestInfo. + * @param[in] data A pointer to a buffer holding the data. + * @param[in] len The length, in bytes, of the data. + * + * @return PP_TRUE if successful, PP_FALSE if any + * of the parameters are invalid. + * + * + */ + PP_Bool AppendDataToBody( + [in] PP_Resource request, + [in] mem_t data, + [in] uint32_t len); + + /** + * AppendFileToBody() appends a file, to be uploaded, to the request body. + * A content-length request header will be automatically generated. + * + * @param[in] request A PP_Resource corresponding to a + * URLRequestInfo. + * @param[in] file_ref A PP_Resource corresponding to a file + * reference. + * @param[in] start_offset An optional starting point offset within the + * file. + * @param[in] number_of_bytes An optional number of bytes of the file to + * be included. If number_of_bytes is -1, then the sub-range + * to upload extends to the end of the file. + * @param[in] expected_last_modified_time An optional (non-zero) last + * modified time stamp used to validate that the file was not modified since + * the given time before it was uploaded. The upload will fail with an error + * code of PP_ERROR_FILECHANGED if the file has been modified + * since the given time. If expected_last_modified_time is 0, + * then no validation is performed. + * + * @return PP_TRUE if successful, PP_FALSE if any + * of the parameters are invalid. + */ + PP_Bool AppendFileToBody( + [in] PP_Resource request, + [in] PP_Resource file_ref, + [in] int64_t start_offset, + [in] int64_t number_of_bytes, + [in] PP_Time expected_last_modified_time); +}; + diff --git a/browser/extensions/mortar/ppapi/api/ppb_url_response_info.idl b/browser/extensions/mortar/ppapi/api/ppb_url_response_info.idl new file mode 100644 index 000000000000..2998b7ab47b6 --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/ppb_url_response_info.idl @@ -0,0 +1,132 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * This file defines the PPB_URLResponseInfo API for examining URL + * responses. + */ + +[generate_thunk] + +label Chrome { + M14 = 1.0 +}; + +/** + * This enumeration contains properties set on a URL response. + */ +[assert_size(4)] +enum PP_URLResponseProperty { + /** + * This corresponds to a string (PP_VARTYPE_STRING); an absolute URL formed by + * resolving the relative request URL with the absolute document URL. Refer + * to the + * + * HTTP Request URI and + * + * HTML Resolving Relative URIs documentation for further information. + */ + PP_URLRESPONSEPROPERTY_URL = 0, + + /** + * This corresponds to a string (PP_VARTYPE_STRING); the absolute URL returned + * in the response header's 'Location' field if this is a redirect response, + * an empty string otherwise. Refer to the + * + * HTTP Status Codes - Redirection documentation for further information. + */ + PP_URLRESPONSEPROPERTY_REDIRECTURL = 1, + + /** + * This corresponds to a string (PP_VARTYPE_STRING); the HTTP method to be + * used in a new request if this is a redirect response, an empty string + * otherwise. Refer to the + * + * HTTP Status Codes - Redirection documentation for further information. + */ + PP_URLRESPONSEPROPERTY_REDIRECTMETHOD = 2, + + /** + * This corresponds to an int32 (PP_VARETYPE_INT32); the status code from the + * response, e.g., 200 if the request was successful. Refer to the + * + * HTTP Status Code and Reason Phrase documentation for further + * information. + */ + PP_URLRESPONSEPROPERTY_STATUSCODE = 3, + + /** + * This corresponds to a string (PP_VARTYPE_STRING); the status line + * from the response. Refer to the + * + * HTTP Response Status Line documentation for further information. + */ + PP_URLRESPONSEPROPERTY_STATUSLINE = 4, + + /** + * This corresponds to a string(PP_VARTYPE_STRING), a \n-delimited list of + * header field/value pairs of the form "field: value", returned by the + * server. Refer to the + * + * HTTP Header Field Definitions documentation for further information. + */ + PP_URLRESPONSEPROPERTY_HEADERS = 5 +}; + + +/** + * The PPB_URLResponseInfo interface contains APIs for + * examining URL responses. Refer to PPB_URLLoader for further + * information. + */ +interface PPB_URLResponseInfo { + /** + * IsURLResponseInfo() determines if a response is a + * URLResponseInfo. + * + * @param[in] resource A PP_Resource corresponding to a + * URLResponseInfo. + * + * @return PP_TRUE if the resource is a + * URLResponseInfo, PP_FALSE if the resource is + * invalid or some type other than URLResponseInfo. + */ + PP_Bool IsURLResponseInfo( + [in] PP_Resource resource); + + /** + * GetProperty() gets a response property. + * + * @param[in] request A PP_Resource corresponding to a + * URLResponseInfo. + * @param[in] property A PP_URLResponseProperty identifying + * the type of property in the response. + * + * @return A PP_Var containing the response property value if + * successful, PP_VARTYPE_VOID if an input parameter is invalid. + */ + PP_Var GetProperty( + [in] PP_Resource response, + [in] PP_URLResponseProperty property); + + /** + * GetBodyAsFileRef() returns a FileRef pointing to the file containing the + * response body. This is only valid if + * PP_URLREQUESTPROPERTY_STREAMTOFILE was set on the + * URLRequestInfo used to produce this response. This file + * remains valid until the URLLoader associated with this + * URLResponseInfo is closed or destroyed. + * + * @param[in] request A PP_Resource corresponding to a + * URLResponseInfo. + * + * @return A PP_Resource corresponding to a FileRef + * if successful, 0 if PP_URLREQUESTPROPERTY_STREAMTOFILE was + * not requested or if the URLLoader has not been opened yet. + */ + PP_Resource GetBodyAsFileRef( + [in] PP_Resource response); +}; + diff --git a/browser/extensions/mortar/ppapi/api/ppb_var.idl b/browser/extensions/mortar/ppapi/api/ppb_var.idl new file mode 100644 index 000000000000..cc12b1bb3b75 --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/ppb_var.idl @@ -0,0 +1,147 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * This file defines the PPB_Var struct. + */ + +label Chrome { + M14 = 1.0, + M18 = 1.1, + M34 = 1.2 +}; + +/** + * PPB_Var API + */ +interface PPB_Var { + /** + * AddRef() adds a reference to the given var. If this is not a refcounted + * object, this function will do nothing so you can always call it no matter + * what the type. + * + * @param[in] var A PP_Var that will have a reference added. + */ + [version=1.0] + void AddRef([in] PP_Var var); + + /** + * Release() removes a reference to given var, deleting it if the internal + * reference count becomes 0. If the PP_Var is of type + * PP_VARTYPE_RESOURCE, + * it will implicitly release a reference count on the + * PP_Resource (equivalent to PPB_Core::ReleaseResource()). + * + * If the given var is not a refcounted object, this function will do nothing + * so you can always call it no matter what the type. + * + * @param[in] var A PP_Var that will have a reference removed. + */ + [version=1.0] + void Release([in] PP_Var var); + + /** + * VarFromUtf8() creates a string var from a string. The string must be + * encoded in valid UTF-8 and is NOT NULL-terminated, the length must be + * specified in len. It is an error if the string is not + * valid UTF-8. + * + * If the length is 0, the *data pointer will not be dereferenced + * and may be NULL. Note, however if length is 0, the + * "NULL-ness" will not be preserved, as VarToUtf8() will never + * return NULL on success, even for empty strings. + * + * The resulting object will be a refcounted string object. It will be + * AddRef'ed for the caller. When the caller is done with it, it should be + * Released. + * + * On error (basically out of memory to allocate the string, or input that + * is not valid UTF-8), this function will return a Null var. + * + * @param[in] module A PP_Module uniquely identifying the module or .nexe. + * @param[in] data A string + * @param[in] len The length of the string. + * + * @return A PP_Var structure containing a reference counted + * string object. + */ + [version=1.0] + PP_Var VarFromUtf8([in] PP_Module module, [in] str_t data, [in] uint32_t len); + + /** + * VarFromUtf8() creates a string var from a string. The string must be + * encoded in valid UTF-8 and is NOT NULL-terminated, the length must be + * specified in len. It is an error if the string is not + * valid UTF-8. + * + * If the length is 0, the *data pointer will not be dereferenced + * and may be NULL. Note, however if length is 0, the + * "NULL-ness" will not be preserved, as VarToUtf8() will never return + * NULL on success, even for empty strings. + * + * The resulting object will be a refcounted string object. It will be + * AddRef'ed for the caller. When the caller is done with it, it should be + * Released. + * + * On error (basically out of memory to allocate the string, or input that + * is not valid UTF-8), this function will return a Null var. + * + * @param[in] data A string + * @param[in] len The length of the string. + * + * @return A PP_Var structure containing a reference counted + * string object. + */ + [version=1.1] + PP_Var VarFromUtf8([in] str_t data, [in] uint32_t len); + + /** + * VarToUtf8() converts a string-type var to a char* encoded in UTF-8. This + * string is NOT NULL-terminated. The length will be placed in + * *len. If the string is valid but empty the return value will + * be non-NULL, but *len will still be 0. + * + * If the var is not a string, this function will return NULL and + * *len will be 0. + * + * The returned buffer will be valid as long as the underlying var is alive. + * If the instance frees its reference, the string will be freed and the + * pointer will be to arbitrary memory. + * + * @param[in] var A PP_Var struct containing a string-type var. + * @param[in,out] len A pointer to the length of the string-type var. + * + * @return A char* encoded in UTF-8. + */ + [version=1.0] + str_t VarToUtf8([in] PP_Var var, [out] uint32_t len); + + /** + * Converts a resource-type var to a PP_Resource. + * + * @param[in] var A PP_Var struct containing a resource-type var. + * + * @return A PP_Resource retrieved from the var, or 0 if the var + * is not a resource. The reference count of the resource is incremented on + * behalf of the caller. + */ + [version=1.2] + PP_Resource VarToResource([in] PP_Var var); + + /** + * Creates a new PP_Var from a given resource. Implicitly adds a + * reference count on the PP_Resource (equivalent to + * PPB_Core::AddRefResource(resource)). + * + * @param[in] resource A PP_Resource to be wrapped in a var. + * + * @return A PP_Var created for this resource, with type + * PP_VARTYPE_RESOURCE. The reference count of the var is set to + * 1 on behalf of the caller. + */ + [version=1.2] + PP_Var VarFromResource([in] PP_Resource resource); +}; + diff --git a/browser/extensions/mortar/ppapi/api/ppb_var_array.idl b/browser/extensions/mortar/ppapi/api/ppb_var_array.idl new file mode 100644 index 000000000000..9925e4471f8e --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/ppb_var_array.idl @@ -0,0 +1,77 @@ +/* Copyright 2013 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * This file defines the PPB_VarArray struct providing + * a way to interact with array vars. + */ + +label Chrome { + M29 = 1.0 +}; + +[macro="PPB_VAR_ARRAY_INTERFACE"] +interface PPB_VarArray { + /** + * Creates an array var, i.e., a PP_Var with type set to + * PP_VARTYPE_ARRAY. The array length is set to 0. + * + * @return An empty array var, whose reference count is set to 1 on behalf of + * the caller. + */ + PP_Var Create(); + + /** + * Gets an element from the array. + * + * @param[in] array An array var. + * @param[in] index An index indicating which element to return. + * + * @return The element at the specified position. The reference count of the + * element returned is incremented on behalf of the caller. If + * index is larger than or equal to the array length, an + * undefined var is returned. + */ + PP_Var Get([in] PP_Var array, [in] uint32_t index); + + /** + * Sets the value of an element in the array. + * + * @param[in] array An array var. + * @param[in] index An index indicating which element to modify. If + * index is larger than or equal to the array length, the length + * is updated to be index + 1. Any position in the array that + * hasn't been set before is set to undefined, i.e., PP_Var of + * type PP_VARTYPE_UNDEFINED. + * @param[in] value The value to set. The array holds a reference to it on + * success. + * + * @return A PP_Bool indicating whether the operation succeeds. + */ + PP_Bool Set([in] PP_Var array, [in] uint32_t index, [in] PP_Var value); + + /** + * Gets the array length. + * + * @param[in] array An array var. + * + * @return The array length. + */ + uint32_t GetLength([in] PP_Var array); + + /** + * Sets the array length. + * + * @param[in] array An array var. + * @param[in] length The new array length. If length is smaller + * than its current value, the array is truncated to the new length; any + * elements that no longer fit are removed and the references to them will be + * released. If length is larger than its current value, + * undefined vars are appended to increase the array to the specified length. + * + * @return A PP_Bool indicating whether the operation succeeds. + */ + PP_Bool SetLength([in] PP_Var array, [in] uint32_t length); +}; diff --git a/browser/extensions/mortar/ppapi/api/ppb_var_array_buffer.idl b/browser/extensions/mortar/ppapi/api/ppb_var_array_buffer.idl new file mode 100644 index 000000000000..f48c19fee395 --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/ppb_var_array_buffer.idl @@ -0,0 +1,101 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * This file defines the PPB_VarArrayBuffer struct providing + * a way to interact with JavaScript ArrayBuffers. + */ + +label Chrome { + M18 = 1.0 +}; + +/** + * The PPB_VarArrayBuffer interface provides a way to interact + * with JavaScript ArrayBuffers, which represent a contiguous sequence of + * bytes. Use PPB_Var to manage the reference count for a + * VarArrayBuffer. Note that these Vars are not part of the + * embedding page's DOM, and can only be shared with JavaScript using the + * PostMessage and HandleMessage functions of + * pp::Instance. + */ +[macro="PPB_VAR_ARRAY_BUFFER_INTERFACE"] +interface PPB_VarArrayBuffer { + /** + * Create() creates a zero-initialized VarArrayBuffer. + * + * @param[in] size_in_bytes The size of the ArrayBuffer to + * be created. + * + * @return A PP_Var representing a VarArrayBuffer + * of the requested size and with a reference count of 1. + */ + PP_Var Create([in] uint32_t size_in_bytes); + + /** + * ByteLength() retrieves the length of the VarArrayBuffer in + * bytes. On success, byte_length is set to the length of the + * given ArrayBuffer var. On failure, byte_length + * is unchanged (this could happen, for instance, if the given + * PP_Var is not of type PP_VARTYPE_ARRAY_BUFFER). + * Note that ByteLength() will successfully retrieve the size of an + * ArrayBuffer even if the ArrayBuffer is not + * currently mapped. + * + * @param[in] array The ArrayBuffer whose length should be + * returned. + * + * @param[out] byte_length A variable which is set to the length of the given + * ArrayBuffer on success. + * + * @return PP_TRUE on success, PP_FALSE on failure. + */ + PP_Bool ByteLength([in] PP_Var array, [out] uint32_t byte_length); + + /** + * Map() maps the ArrayBuffer in to the module's address space + * and returns a pointer to the beginning of the buffer for the given + * ArrayBuffer PP_Var. ArrayBuffers are copied when transmitted, + * so changes to the underlying memory are not automatically available to + * the embedding page. + * + * Note that calling Map() can be a relatively expensive operation. Use care + * when calling it in performance-critical code. For example, you should call + * it only once when looping over an ArrayBuffer. + * + * Example: + * + * @code + * char* data = (char*)(array_buffer_if.Map(array_buffer_var)); + * uint32_t byte_length = 0; + * PP_Bool ok = array_buffer_if.ByteLength(array_buffer_var, &byte_length); + * if (!ok) + * return DoSomethingBecauseMyVarIsNotAnArrayBuffer(); + * for (uint32_t i = 0; i < byte_length; ++i) + * data[i] = 'A'; + * @endcode + * + * @param[in] array The ArrayBuffer whose internal buffer should + * be returned. + * + * @return A pointer to the internal buffer for this + * ArrayBuffer. Returns NULL + * if the given PP_Var is not of type + * PP_VARTYPE_ARRAY_BUFFER. + */ + mem_t Map([in] PP_Var array); + + /** + * Unmap() unmaps the given ArrayBuffer var from the module + * address space. Use this if you want to save memory but might want to call + * Map() to map the buffer again later. The PP_Var remains valid + * and should still be released using PPB_Var when you are done + * with the ArrayBuffer. + * + * @param[in] array The ArrayBuffer to be released. + */ + void Unmap([in] PP_Var array); +}; + diff --git a/browser/extensions/mortar/ppapi/api/ppb_var_dictionary.idl b/browser/extensions/mortar/ppapi/api/ppb_var_dictionary.idl new file mode 100644 index 000000000000..b4b9c060709d --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/ppb_var_dictionary.idl @@ -0,0 +1,90 @@ +/* Copyright 2013 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * This file defines the PPB_VarDictionary struct providing + * a way to interact with dictionary vars. + */ + +label Chrome { + M29 = 1.0 +}; + +/** + * A dictionary var contains key-value pairs with unique keys. The keys are + * strings while the values can be arbitrary vars. Key comparison is always + * done by value instead of by reference. + */ +[macro="PPB_VAR_DICTIONARY_INTERFACE"] +interface PPB_VarDictionary { + /** + * Creates a dictionary var, i.e., a PP_Var with type set to + * PP_VARTYPE_DICTIONARY. + * + * @return An empty dictionary var, whose reference count is set to 1 on + * behalf of the caller. + */ + PP_Var Create(); + + /** + * Gets the value associated with the specified key. + * + * @param[in] dict A dictionary var. + * @param[in] key A string var. + * + * @return The value that is associated with key. The reference + * count of the element returned is incremented on behalf of the caller. If + * key is not a string var, or it doesn't exist in + * dict, an undefined var is returned. + */ + PP_Var Get([in] PP_Var dict, [in] PP_Var key); + + /** + * Sets the value associated with the specified key. + * + * @param[in] dict A dictionary var. + * @param[in] key A string var. If this key hasn't existed in + * dict, it is added and associated with value; + * otherwise, the previous value is replaced with value. + * @param[in] value The value to set. The dictionary holds a reference to it + * on success. + * + * @return A PP_Bool indicating whether the operation succeeds. + */ + PP_Bool Set([in] PP_Var dict, [in] PP_Var key, [in] PP_Var value); + + /** + * Deletes the specified key and its associated value, if the key exists. The + * reference to the element will be released. + * + * @param[in] dict A dictionary var. + * @param[in] key A string var. + */ + void Delete([in] PP_Var dict, [in] PP_Var key); + + /** + * Checks whether a key exists. + * + * @param[in] dict A dictionary var. + * @param[in] key A string var. + * + * @return A PP_Bool indicating whether the key exists. + */ + PP_Bool HasKey([in] PP_Var dict, [in] PP_Var key); + + /** + * Gets all the keys in a dictionary. Please note that for each key that you + * set into the dictionary, a string var with the same contents is returned; + * but it may not be the same string var (i.e., value.as_id may + * be different). + * + * @param[in] dict A dictionary var. + * + * @return An array var which contains all the keys of dict. Its + * reference count is incremented on behalf of the caller. The elements are + * string vars. Returns a null var if failed. + */ + PP_Var GetKeys([in] PP_Var dict); +}; diff --git a/browser/extensions/mortar/ppapi/api/ppb_video_decoder.idl b/browser/extensions/mortar/ppapi/api/ppb_video_decoder.idl new file mode 100644 index 000000000000..9997c79029f4 --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/ppb_video_decoder.idl @@ -0,0 +1,312 @@ +/* Copyright (c) 2014 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * This file defines the PPB_VideoDecoder interface. + */ + +[generate_thunk] + +label Chrome { + /** Though not labeled 'channel=dev', 0.1 is a still a 'Dev' only API. */ + M36 = 0.1, + M39 = 0.2, + M40 = 1.0, + M46 = 1.1 +}; + +/** + * Video decoder interface. + * + * Typical usage: + * - Call Create() to create a new video decoder resource. + * - Call Initialize() to initialize it with a 3d graphics context and the + * desired codec profile. + * - Call Decode() continuously (waiting for each previous call to complete) to + * push bitstream buffers to the decoder. + * - Call GetPicture() continuously (waiting for each previous call to complete) + * to pull decoded pictures from the decoder. + * - Call Flush() to signal end of stream to the decoder and perform shutdown + * when it completes. + * - Call Reset() to quickly stop the decoder (e.g. to implement Seek) and wait + * for the callback before restarting decoding at another point. + * - To destroy the decoder, the plugin should release all of its references to + * it. Any pending callbacks will abort before the decoder is destroyed. + * + * Available video codecs vary by platform. + * All: theora, vorbis, vp8. + * Chrome and ChromeOS: aac, h264. + * ChromeOS: mpeg4. + */ +interface PPB_VideoDecoder { + /** + * Creates a new video decoder resource. + * + * @param[in] instance A PP_Instance identifying the instance + * with the video decoder. + * + * @return A PP_Resource corresponding to a video decoder if + * successful or 0 otherwise. + */ + PP_Resource Create( + [in] PP_Instance instance); + + /** + * Determines if the given resource is a video decoder. + * + * @param[in] resource A PP_Resource identifying a resource. + * + * @return PP_TRUE if the resource is a + * PPB_VideoDecoder, PP_FALSE if the resource is + * invalid or some other type. + */ + PP_Bool IsVideoDecoder( + [in] PP_Resource resource); + + /** + * Initializes a video decoder resource. This should be called after Create() + * and before any other functions. + * + * @param[in] video_decoder A PP_Resource identifying the video + * decoder. + * @param[in] graphics3d_context A PPB_Graphics3D resource to use + * during decoding. + * @param[in] profile A PP_VideoProfile specifying the video + * codec profile. + * @param[in] allow_software_fallback A PP_Bool specifying + * whether the decoder can fall back to software decoding if a suitable + * hardware decoder isn't available. + * @param[in] callback A PP_CompletionCallback to be called upon + * completion. + * + * @return An int32_t containing an error code from pp_errors.h. + * Returns PP_ERROR_NOTSUPPORTED if video decoding is not available, or the + * requested profile is not supported. In this case, the client may call + * Initialize() again with different parameters to find a good configuration. + */ + int32_t Initialize( + [in] PP_Resource video_decoder, + [in] PP_Resource graphics3d_context, + [in] PP_VideoProfile profile, + [in] PP_Bool allow_software_fallback, + [in] PP_CompletionCallback callback); + + /** + * Initializes a video decoder resource. This should be called after Create() + * and before any other functions. + * + * @param[in] video_decoder A PP_Resource identifying the video + * decoder. + * @param[in] graphics3d_context A PPB_Graphics3D resource to use + * during decoding. + * @param[in] profile A PP_VideoProfile specifying the video + * codec profile. + * @param[in] acceleration A PP_HardwareAcceleration specifying + * whether to use a hardware accelerated or a software implementation. + * @param[in] callback A PP_CompletionCallback to be called upon + * completion. + * + * @return An int32_t containing an error code from pp_errors.h. + * Returns PP_ERROR_NOTSUPPORTED if video decoding is not available, or the + * requested profile is not supported. In this case, the client may call + * Initialize() again with different parameters to find a good configuration. + */ + [version = 0.2] + int32_t Initialize( + [in] PP_Resource video_decoder, + [in] PP_Resource graphics3d_context, + [in] PP_VideoProfile profile, + [in] PP_HardwareAcceleration acceleration, + [in] PP_CompletionCallback callback); + + /** + * Initializes a video decoder resource. This should be called after Create() + * and before any other functions. + * + * @param[in] video_decoder A PP_Resource identifying the video + * decoder. + * @param[in] graphics3d_context A PPB_Graphics3D resource to use + * during decoding. + * @param[in] profile A PP_VideoProfile specifying the video + * codec profile. + * @param[in] acceleration A PP_HardwareAcceleration specifying + * whether to use a hardware accelerated or a software implementation. + * @param[in] min_picture_count A count of pictures the plugin would like to + * have in flight. This is effectively the number of times the plugin can + * call GetPicture() and get a decoded frame without calling + * RecyclePicture(). The decoder has its own internal minimum count, and will + * take the larger of its internal and this value. A client that doesn't care + * can therefore just pass in zero for this argument. + * @param[in] callback A PP_CompletionCallback to be called upon + * completion. + * + * @return An int32_t containing an error code from pp_errors.h. + * Returns PP_ERROR_NOTSUPPORTED if video decoding is not available, or the + * requested profile is not supported. In this case, the client may call + * Initialize() again with different parameters to find a good configuration. + * Returns PP_ERROR_BADARGUMENT if the requested minimum picture count is + * unreasonably large. + */ + [version = 1.1] + int32_t Initialize( + [in] PP_Resource video_decoder, + [in] PP_Resource graphics3d_context, + [in] PP_VideoProfile profile, + [in] PP_HardwareAcceleration acceleration, + [in] uint32_t min_picture_count, + [in] PP_CompletionCallback callback); + + /** + * Decodes a bitstream buffer. Copies |size| bytes of data from the plugin's + * |buffer|. The plugin should wait until the decoder signals completion by + * returning PP_OK or by running |callback| before calling Decode() again. + * + * In general, each bitstream buffer should contain a demuxed bitstream frame + * for the selected video codec. For example, H264 decoders expect to receive + * one AnnexB NAL unit, including the 4 byte start code prefix, while VP8 + * decoders expect to receive a bitstream frame without the IVF frame header. + * + * If the call to Decode() eventually results in a picture, the |decode_id| + * parameter is copied into the returned picture. The plugin can use this to + * associate decoded pictures with Decode() calls (e.g. to assign timestamps + * or frame numbers to pictures.) This value is opaque to the API so the + * plugin is free to pass any value. + * + * @param[in] video_decoder A PP_Resource identifying the video + * decoder. + * @param[in] decode_id An optional value, chosen by the plugin, that can be + * used to associate calls to Decode() with decoded pictures returned by + * GetPicture(). + * @param[in] size Buffer size in bytes. + * @param[in] buffer Starting address of buffer. + * @param[in] callback A PP_CompletionCallback to be called on + * completion. + * + * @return An int32_t containing an error code from pp_errors.h. + * Returns PP_ERROR_FAILED if the decoder isn't initialized or if a Flush() + * or Reset() call is pending. + * Returns PP_ERROR_INPROGRESS if there is another Decode() call pending. + * Returns PP_ERROR_NOMEMORY if a bitstream buffer can't be created. + * Returns PP_ERROR_ABORTED when Reset() is called while Decode() is pending. + */ + int32_t Decode( + [in] PP_Resource video_decoder, + [in] uint32_t decode_id, + [in] uint32_t size, + [in] mem_t buffer, + [in] PP_CompletionCallback callback); + + /** + * Gets the next picture from the decoder. The picture is valid after the + * decoder signals completion by returning PP_OK or running |callback|. The + * plugin can call GetPicture() again after the decoder signals completion. + * When the plugin is finished using the picture, it should return it to the + * system by calling RecyclePicture(). + * + * @param[in] video_decoder A PP_Resource identifying the video + * decoder. + * @param[out] picture A PP_VideoPicture to hold the decoded + * picture. + * @param[in] callback A PP_CompletionCallback to be called on + * completion. + * + * @return An int32_t containing an error code from pp_errors.h. + * Returns PP_ERROR_FAILED if the decoder isn't initialized or if a Reset() + * call is pending. + * Returns PP_ERROR_INPROGRESS if there is another GetPicture() call pending. + * Returns PP_ERROR_ABORTED when Reset() is called, or if a call to Flush() + * completes while GetPicture() is pending. + */ + int32_t GetPicture( + [in] PP_Resource video_decoder, + [out] PP_VideoPicture_0_1 picture, + [in] PP_CompletionCallback callback); + + /** + * Gets the next picture from the decoder. The picture is valid after the + * decoder signals completion by returning PP_OK or running |callback|. The + * plugin can call GetPicture() again after the decoder signals completion. + * When the plugin is finished using the picture, it should return it to the + * system by calling RecyclePicture(). + * + * @param[in] video_decoder A PP_Resource identifying the video + * decoder. + * @param[out] picture A PP_VideoPicture to hold the decoded + * picture. + * @param[in] callback A PP_CompletionCallback to be called on + * completion. + * + * @return An int32_t containing an error code from pp_errors.h. + * Returns PP_ERROR_FAILED if the decoder isn't initialized or if a Reset() + * call is pending. + * Returns PP_ERROR_INPROGRESS if there is another GetPicture() call pending. + * Returns PP_ERROR_ABORTED when Reset() is called, or if a call to Flush() + * completes while GetPicture() is pending. + */ + [version = 1.0] + int32_t GetPicture( + [in] PP_Resource video_decoder, + [out] PP_VideoPicture picture, + [in] PP_CompletionCallback callback); + + /** + * Recycles a picture that the plugin has received from the decoder. + * The plugin should call this as soon as it has finished using the texture so + * the decoder can decode more pictures. + * + * @param[in] video_decoder A PP_Resource identifying the video + * decoder. + * @param[in] picture A PP_VideoPicture to return to + * the decoder. + */ + void RecyclePicture( + [in] PP_Resource video_decoder, + [in] PP_VideoPicture picture); + + /** + * Flushes the decoder. The plugin should call Flush() when it reaches the + * end of its video stream in order to stop cleanly. The decoder will run any + * pending Decode() call to completion. The plugin should make no further + * calls to the decoder other than GetPicture() and RecyclePicture() until + * the decoder signals completion by running |callback|. Just before + * completion, any pending GetPicture() call will complete by running its + * callback with result PP_ERROR_ABORTED to signal that no more pictures are + * available. Any pictures held by the plugin remain valid during and after + * the flush and should be recycled back to the decoder. + * + * @param[in] video_decoder A PP_Resource identifying the video + * decoder. + * @param[in] callback A PP_CompletionCallback to be called on + * completion. + * + * @return An int32_t containing an error code from pp_errors.h. + * Returns PP_ERROR_FAILED if the decoder isn't initialized. + */ + int32_t Flush( + [in] PP_Resource video_decoder, + [in] PP_CompletionCallback callback); + + /** + * Resets the decoder as quickly as possible. The plugin can call Reset() to + * skip to another position in the video stream. After Reset() returns, any + * pending calls to Decode() and GetPicture()) abort, causing their callbacks + * to run with PP_ERROR_ABORTED. The plugin should not make further calls to + * the decoder other than RecyclePicture() until the decoder signals + * completion by running |callback|. Any pictures held by the plugin remain + * valid during and after the reset and should be recycled back to the + * decoder. + * + * @param[in] video_decoder A PP_Resource identifying the video + * decoder. + * @param[in] callback A PP_CompletionCallback to be called on + * completion. + * + * @return An int32_t containing an error code from pp_errors.h. + * Returns PP_ERROR_FAILED if the decoder isn't initialized. + */ + int32_t Reset( + [in] PP_Resource video_decoder, + [in] PP_CompletionCallback callback); +}; diff --git a/browser/extensions/mortar/ppapi/api/ppb_video_encoder.idl b/browser/extensions/mortar/ppapi/api/ppb_video_encoder.idl new file mode 100644 index 000000000000..de96b690bf63 --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/ppb_video_encoder.idl @@ -0,0 +1,249 @@ +/* Copyright 2015 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * This file defines the PPB_VideoEncoder interface. + */ + +[generate_thunk] + +label Chrome { + [channel=dev] M42 = 0.1, + M44 = 0.2 +}; + +/** + * Video encoder interface. + * + * Typical usage: + * - Call Create() to create a new video encoder resource. + * - Call GetSupportedFormats() to determine which codecs and profiles are + * available. + * - Call Initialize() to initialize the encoder for a supported profile. + * - Call GetVideoFrame() to get a blank frame and fill it in, or get a video + * frame from another resource, e.g. PPB_MediaStreamVideoTrack. + * - Call Encode() to push the video frame to the encoder. If an external frame + * is pushed, wait for completion to recycle the frame. + * - Call GetBitstreamBuffer() continuously (waiting for each previous call to + * complete) to pull encoded pictures from the encoder. + * - Call RecycleBitstreamBuffer() after consuming the data in the bitstream + * buffer. + * - To destroy the encoder, the plugin should release all of its references to + * it. Any pending callbacks will abort before the encoder is destroyed. + * + * Available video codecs vary by platform. + * All: vp8 (software). + * ChromeOS, depending on your device: h264 (hardware), vp8 (hardware) + */ +interface PPB_VideoEncoder { + /** + * Creates a new video encoder resource. + * + * @param[in] instance A PP_Instance identifying the instance + * with the video encoder. + * + * @return A PP_Resource corresponding to a video encoder if + * successful or 0 otherwise. + */ + PP_Resource Create([in] PP_Instance instance); + + /** + * Determines if the given resource is a video encoder. + * + * @param[in] resource A PP_Resource identifying a resource. + * + * @return PP_TRUE if the resource is a + * PPB_VideoEncoder, PP_FALSE if the resource is + * invalid or some other type. + */ + PP_Bool IsVideoEncoder([in] PP_Resource resource); + + /** + * Gets an array of supported video encoder profiles. + * These can be used to choose a profile before calling Initialize(). + * + * @param[in] video_encoder A PP_Resource identifying the video + * encoder. + * @param[in] output A PP_ArrayOutput to receive the supported + * PP_VideoProfileDescription_0_1 structs. + * @param[in] callback A PP_CompletionCallback to be called upon + * completion. + * + * @return If >= 0, the number of supported profiles returned, otherwise an + * error code from pp_errors.h. + */ + int32_t GetSupportedProfiles([in] PP_Resource video_encoder, + [in] PP_ArrayOutput output, + [in] PP_CompletionCallback callback); + + /** + * Gets an array of supported video encoder profiles. + * These can be used to choose a profile before calling Initialize(). + * + * @param[in] video_encoder A PP_Resource identifying the video + * encoder. + * @param[in] output A PP_ArrayOutput to receive the supported + * PP_VideoProfileDescription structs. + * @param[in] callback A PP_CompletionCallback to be called upon + * completion. + * + * @return If >= 0, the number of supported profiles returned, otherwise an + * error code from pp_errors.h. + */ + [version = 0.2] + int32_t GetSupportedProfiles([in] PP_Resource video_encoder, + [in] PP_ArrayOutput output, + [in] PP_CompletionCallback callback); + + /** + * Initializes a video encoder resource. The plugin should call Initialize() + * successfully before calling any of the functions below. + * + * @param[in] video_encoder A PP_Resource identifying the video + * encoder. + * @param[in] input_format The PP_VideoFrame_Format of the + * frames which will be encoded. + * @param[in] input_visible_size A PP_Size specifying the + * dimensions of the visible part of the input frames. + * @param[in] output_profile A PP_VideoProfile specifying the + * codec profile of the encoded output stream. + * @param[in] acceleration A PP_HardwareAcceleration specifying + * whether to use a hardware accelerated or a software implementation. + * @param[in] callback A PP_CompletionCallback to be called upon + * completion. + * + * @return An int32_t containing an error code from pp_errors.h. + * Returns PP_ERROR_NOTSUPPORTED if video encoding is not available, or the + * requested codec profile is not supported. + */ + int32_t Initialize([in] PP_Resource video_encoder, + [in] PP_VideoFrame_Format input_format, + [in] PP_Size input_visible_size, + [in] PP_VideoProfile output_profile, + [in] uint32_t initial_bitrate, + [in] PP_HardwareAcceleration acceleration, + [in] PP_CompletionCallback callback); + + /** + * Gets the number of input video frames that the encoder may hold while + * encoding. If the plugin is providing the video frames, it should have at + * least this many available. + * + * @param[in] video_encoder A PP_Resource identifying the video + * encoder. + * @return An int32_t containing the number of frames required, or an error + * code from pp_errors.h. + * Returns PP_ERROR_FAILED if Initialize() has not successfully completed. + */ + int32_t GetFramesRequired([in] PP_Resource video_encoder); + + /** + * Gets the coded size of the video frames required by the encoder. Coded + * size is the logical size of the input frames, in pixels. The encoder may + * have hardware alignment requirements that make this different from + * |input_visible_size|, as requested in the call to Initialize(). + * + * @param[in] video_encoder A PP_Resource identifying the video + * encoder. + * @param[in] coded_size A PP_Size to hold the coded size. + * @return An int32_t containing a result code from pp_errors.h. + * Returns PP_ERROR_FAILED if Initialize() has not successfully completed. + */ + int32_t GetFrameCodedSize([in] PP_Resource video_encoder, + [out] PP_Size coded_size); + + /** + * Gets a blank video frame which can be filled with video data and passed + * to the encoder. + * + * @param[in] video_encoder A PP_Resource identifying the video + * encoder. + * @param[out] video_frame A blank PPB_VideoFrame resource. + * @param[in] callback A PP_CompletionCallback to be called upon + * completion. + * + * @return An int32_t containing an error code from pp_errors.h. + * Returns PP_ERROR_FAILED if Initialize() has not successfully completed. + */ + int32_t GetVideoFrame([in] PP_Resource video_encoder, + [out] PP_Resource video_frame, + [in] PP_CompletionCallback callback); + + /** + * Encodes a video frame. + * + * @param[in] video_encoder A PP_Resource identifying the video + * encoder. + * @param[in] video_frame The PPB_VideoFrame to be encoded. + * @param[in] force_keyframe A PP_Bool> specifying whether the encoder + * should emit a key frame for this video frame. + * @param[in] callback A PP_CompletionCallback to be called upon + * completion. Plugins that pass PPB_VideoFrame resources owned + * by other resources should wait for completion before reusing them. + * + * @return An int32_t containing an error code from pp_errors.h. + * Returns PP_ERROR_FAILED if Initialize() has not successfully completed. + */ + int32_t Encode([in] PP_Resource video_encoder, + [in] PP_Resource video_frame, + [in] PP_Bool force_keyframe, + [in] PP_CompletionCallback callback); + + /** + * Gets the next encoded bitstream buffer from the encoder. + * + * @param[in] video_encoder A PP_Resource identifying the video + * encoder. + * @param[out] bitstream_buffer A PP_BitstreamBuffer containing + * encoded video data. + * @param[in] callback A PP_CompletionCallback to be called upon + * completion. The plugin can call GetBitstreamBuffer from the callback in + * order to continuously "pull" bitstream buffers from the encoder. + * + * @return An int32_t containing an error code from pp_errors.h. + * Returns PP_ERROR_FAILED if Initialize() has not successfully completed. + * Returns PP_ERROR_INPROGRESS if a prior call to GetBitstreamBuffer() has + * not completed. + */ + int32_t GetBitstreamBuffer([in] PP_Resource video_encoder, + [out] PP_BitstreamBuffer bitstream_buffer, + [in] PP_CompletionCallback callback); + + /** + * Recycles a bitstream buffer back to the encoder. + * + * @param[in] video_encoder A PP_Resource identifying the video + * encoder. + * @param[in] bitstream_buffer A PP_BitstreamBuffer that is no + * longer needed by the plugin. + */ + void RecycleBitstreamBuffer([in] PP_Resource video_encoder, + [in] PP_BitstreamBuffer bitstream_buffer); + + /** + * Requests a change to encoding parameters. This is only a request, + * fulfilled on a best-effort basis. + * + * @param[in] video_encoder A PP_Resource identifying the video + * encoder. + * @param[in] bitrate The requested new bitrate, in bits per second. + * @param[in] framerate The requested new framerate, in frames per second. + */ + void RequestEncodingParametersChange([in] PP_Resource video_encoder, + [in] uint32_t bitrate, + [in] uint32_t framerate); + + /** + * Closes the video encoder, and cancels any pending encodes. Any pending + * callbacks will still run, reporting PP_ERROR_ABORTED . It is + * not valid to call any encoder functions after a call to this method. + * Note: Destroying the video encoder closes it implicitly, + * so you are not required to call Close(). + * + * @param[in] video_encoder A PP_Resource identifying the video + * encoder. + */ + void Close([in] PP_Resource video_encoder); +}; diff --git a/browser/extensions/mortar/ppapi/api/ppb_video_frame.idl b/browser/extensions/mortar/ppapi/api/ppb_video_frame.idl new file mode 100644 index 000000000000..57378925aa8c --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/ppb_video_frame.idl @@ -0,0 +1,123 @@ +/* Copyright 2014 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * Defines the PPB_VideoFrame interface. + */ + +[generate_thunk] + +label Chrome { + [channel=dev] M34 = 0.1, + M35 = 0.1 +}; + +enum PP_VideoFrame_Format { + /** + * Unknown format value. + */ + PP_VIDEOFRAME_FORMAT_UNKNOWN = 0, + + /** + * 12bpp YVU planar 1x1 Y, 2x2 VU samples. + */ + PP_VIDEOFRAME_FORMAT_YV12 = 1, + + /** + * 12bpp YUV planar 1x1 Y, 2x2 UV samples. + */ + PP_VIDEOFRAME_FORMAT_I420 = 2, + + /** + * 32bpp BGRA. + */ + PP_VIDEOFRAME_FORMAT_BGRA = 3, + + /** + * The last format. + */ + PP_VIDEOFRAME_FORMAT_LAST = PP_VIDEOFRAME_FORMAT_BGRA +}; + +[version=0.1] +interface PPB_VideoFrame { + /** + * Determines if a resource is a VideoFrame resource. + * + * @param[in] resource The PP_Resource to test. + * + * @return A PP_Bool with PP_TRUE if the given + * resource is a VideoFrame resource or PP_FALSE otherwise. + */ + PP_Bool IsVideoFrame([in] PP_Resource resource); + + /** + * Gets the timestamp of the video frame. + * + * @param[in] frame A PP_Resource corresponding to a video frame + * resource. + * + * @return A PP_TimeDelta containing the timestamp of the video + * frame. Given in seconds since the start of the containing video stream. + */ + [on_failure=0.0] + PP_TimeDelta GetTimestamp([in] PP_Resource frame); + + /** + * Sets the timestamp of the video frame. Given in seconds since the + * start of the containing video stream. + * + * @param[in] frame A PP_Resource corresponding to a video frame + * resource. + * @param[in] timestamp A PP_TimeDelta containing the timestamp + * of the video frame. Given in seconds since the start of the containing + * video stream. + */ + void SetTimestamp([in] PP_Resource frame, [in] PP_TimeDelta timestamp); + + /** + * Gets the format of the video frame. + * + * @param[in] frame A PP_Resource corresponding to a video frame + * resource. + * + * @return A PP_VideoFrame_Format containing the format of the + * video frame. + */ + [on_failure=PP_VIDEOFRAME_FORMAT_UNKNOWN] + PP_VideoFrame_Format GetFormat([in] PP_Resource frame); + + /** + * Gets the size of the video frame. + * + * @param[in] frame A PP_Resource corresponding to a video frame + * resource. + * @param[out] size A PP_Size. + * + * @return A PP_Bool with PP_TRUE on success or + * PP_FALSE on failure. + */ + PP_Bool GetSize([in] PP_Resource frame, [out] PP_Size size); + + /** + * Gets the data buffer for video frame pixels. + * + * @param[in] frame A PP_Resource corresponding to a video frame + * resource. + * + * @return A pointer to the beginning of the data buffer. + */ + mem_t GetDataBuffer([in] PP_Resource frame); + + /** + * Gets the size of data buffer. + * + * @param[in] frame A PP_Resource corresponding to a video frame + * resource. + * + * @return The size of the data buffer. + */ + uint32_t GetDataBufferSize([in] PP_Resource frame); +}; diff --git a/browser/extensions/mortar/ppapi/api/ppb_view.idl b/browser/extensions/mortar/ppapi/api/ppb_view.idl new file mode 100644 index 000000000000..6a878637c138 --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/ppb_view.idl @@ -0,0 +1,215 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * This file defines the PPB_View struct representing the state + * of the view of an instance. + */ + +[generate_thunk] + +label Chrome { + M18 = 1.0, + M28 = 1.1, + M37 = 1.2 +}; + +/** + * PPB_View represents the state of the view of an instance. + * You will receive new view information using + * PPP_Instance.DidChangeView. + */ +[macro="PPB_VIEW_INTERFACE"] +interface PPB_View { + /** + * IsView() determines if the given resource is a valid + * PPB_View resource. Note that PPB_ViewChanged + * resources derive from PPB_View and will return true here + * as well. + * + * @param resource A PP_Resource corresponding to a + * PPB_View resource. + * + * @return PP_TRUE if the given resource supports + * PPB_View or PP_FALSE if it is an invalid + * resource or is a resource of another type. + */ + PP_Bool IsView([in] PP_Resource resource); + + /** + * GetRect() retrieves the rectangle of the module instance associated + * with a view changed notification relative to the upper-left of the browser + * viewport. This position changes when the page is scrolled. + * + * The returned rectangle may not be inside the visible portion of the + * viewport if the module instance is scrolled off the page. Therefore, the + * position may be negative or larger than the size of the page. The size will + * always reflect the size of the module were it to be scrolled entirely into + * view. + * + * In general, most modules will not need to worry about the position of the + * module instance in the viewport, and only need to use the size. + * + * @param resource A PP_Resource corresponding to a + * PPB_View resource. + * + * @param rect A PP_Rect receiving the rectangle on success. + * + * @return Returns PP_TRUE if the resource was valid and the + * viewport rectangle was filled in, PP_FALSE if not. + */ + PP_Bool GetRect([in] PP_Resource resource, + [out] PP_Rect rect); + + /** + * IsFullscreen() returns whether the instance is currently + * displaying in fullscreen mode. + * + * @param resource A PP_Resource corresponding to a + * PPB_View resource. + * + * @return PP_TRUE if the instance is in full screen mode, + * or PP_FALSE if it's not or the resource is invalid. + */ + PP_Bool IsFullscreen([in] PP_Resource resource); + + /** + * IsVisible() determines whether the module instance might be visible to + * the user. For example, the Chrome window could be minimized or another + * window could be over it. In both of these cases, the module instance + * would not be visible to the user, but IsVisible() will return true. + * + * Use the result to speed up or stop updates for invisible module + * instances. + * + * This function performs the duties of GetRect() (determining whether the + * module instance is scrolled into view and the clip rectangle is nonempty) + * and IsPageVisible() (whether the page is visible to the user). + * + * @param resource A PP_Resource corresponding to a + * PPB_View resource. + * + * @return PP_TRUE if the instance might be visible to the + * user, PP_FALSE if it is definitely not visible. + */ + PP_Bool IsVisible([in] PP_Resource resource); + + /** + * IsPageVisible() determines if the page that contains the module instance + * is visible. The most common cause of invisible pages is that + * the page is in a background tab in the browser. + * + * Most applications should use IsVisible() instead of this function since + * the module instance could be scrolled off of a visible page, and this + * function will still return true. However, depending on how your module + * interacts with the page, there may be certain updates that you may want to + * perform when the page is visible even if your specific module instance is + * not visible. + * + * @param resource A PP_Resource corresponding to a + * PPB_View resource. + * + * @return PP_TRUE if the instance is plausibly visible to the + * user, PP_FALSE if it is definitely not visible. + */ + PP_Bool IsPageVisible([in] PP_Resource resource); + + /** + * GetClipRect() returns the clip rectangle relative to the upper-left corner + * of the module instance. This rectangle indicates the portions of the module + * instance that are scrolled into view. + * + * If the module instance is scrolled off the view, the return value will be + * (0, 0, 0, 0). This clip rectangle does not take into account page + * visibility. Therefore, if the module instance is scrolled into view, but + * the page itself is on a tab that is not visible, the return rectangle will + * contain the visible rectangle as though the page were visible. Refer to + * IsPageVisible() and IsVisible() if you want to account for page + * visibility. + * + * Most applications will not need to worry about the clip rectangle. The + * recommended behavior is to do full updates if the module instance is + * visible, as determined by IsVisible(), and do no updates if it is not + * visible. + * + * However, if the cost for computing pixels is very high for your + * application, or the pages you're targeting frequently have very large + * module instances with small visible portions, you may wish to optimize + * further. In this case, the clip rectangle will tell you which parts of + * the module to update. + * + * Note that painting of the page and sending of view changed updates + * happens asynchronously. This means when the user scrolls, for example, + * it is likely that the previous backing store of the module instance will + * be used for the first paint, and will be updated later when your + * application generates new content with the new clip. This may cause + * flickering at the boundaries when scrolling. If you do choose to do + * partial updates, you may want to think about what color the invisible + * portions of your backing store contain (be it transparent or some + * background color) or to paint a certain region outside the clip to reduce + * the visual distraction when this happens. + * + * @param resource A PP_Resource corresponding to a + * PPB_View resource. + * + * @param clip Output argument receiving the clip rect on success. + * + * @return Returns PP_TRUE if the resource was valid and the + * clip rect was filled in, PP_FALSE if not. + */ + PP_Bool GetClipRect([in] PP_Resource resource, + [out] PP_Rect clip); + + /** + * GetDeviceScale returns the scale factor between device pixels and Density + * Independent Pixels (DIPs, also known as logical pixels or UI pixels on + * some platforms). This allows the developer to render their contents at + * device resolution, even as coordinates / sizes are given in DIPs through + * the API. + * + * Note that the coordinate system for Pepper APIs is DIPs. Also note that + * one DIP might not equal one CSS pixel - when page scale/zoom is in effect. + * + * @param[in] resource A PP_Resource corresponding to a + * PPB_View resource. + * + * @return A float value representing the number of device pixels + * per DIP. If the resource is invalid, the value will be 0.0. + */ + [version=1.1] + float_t GetDeviceScale([in] PP_Resource resource); + + /** + * GetCSSScale returns the scale factor between DIPs and CSS pixels. This + * allows proper scaling between DIPs - as sent via the Pepper API - and CSS + * pixel coordinates used for Web content. + * + * @param[in] resource A PP_Resource corresponding to a + * PPB_View resource. + * + * @return css_scale A float value representing the number of + * DIPs per CSS pixel. If the resource is invalid, the value will be 0.0. + */ + [version=1.1] + float_t GetCSSScale([in] PP_Resource resource); + + /** + * GetScrollOffset returns the scroll offset of the window containing the + * plugin. + * + * @param[in] resource A PP_Resource corresponding to a + * PPB_View resource. + * + * @param[out] offset A PP_Point which will be set to the value + * of the scroll offset in CSS pixels. + * + * @return Returns PP_TRUE if the resource was valid and the + * offset was filled in, PP_FALSE if not. + */ + [version=1.2] + PP_Bool GetScrollOffset([in] PP_Resource resource, + [out] PP_Point offset); +}; + diff --git a/browser/extensions/mortar/ppapi/api/ppb_vpn_provider.idl b/browser/extensions/mortar/ppapi/api/ppb_vpn_provider.idl new file mode 100644 index 000000000000..92a8b4af5b94 --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/ppb_vpn_provider.idl @@ -0,0 +1,159 @@ +/* Copyright 2016 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * This file defines the PPB_VpnProvider interface. + */ + +[generate_thunk] + +label Chrome { + [channel=dev] M52 = 0.1 +}; + +/** + * Use the PPB_VpnProvider interface to implement a VPN client. + * Important: This API is available only on Chrome OS. + * + * This interface enhances the chrome.vpnProvider JavaScript API by + * providing a high performance path for packet handling. + * + * Permissions: Apps permission vpnProvider is required for + * PPB_VpnProvider.Bind(). + * + * Typical usage: + * - Create a PPB_VpnProvider instance. + * - Register the callback for PPB_VpnProvider.ReceivePacket(). + * - In the extension follow the usual workflow for configuring a VPN connection + * via the chrome.vpnProvider API until the step for notifying + * the connection state as "connected". + * - Bind to the previously created connection using + * PPB_VpnProvider.Bind(). + * - Notify the connection state as "connected" from JavaScript using + * chrome.vpnProvider.notifyConnectionStateChanged. + * - When the steps above are completed without errors, a virtual tunnel is + * created to the network stack of Chrome OS. IP packets can be sent through + * the tunnel using PPB_VpnProvider.SendPacket() and any packets + * originating on the Chrome OS device will be received using the callback + * registered for PPB_VpnProvider.ReceivePacket(). + * - When the user disconnects from the VPN configuration or there is an error + * the extension will be notfied via + * chrome.vpnProvider.onPlatformMessage. + */ +interface PPB_VpnProvider { + /** + * Create() creates a VpnProvider instance. + * + * @param[in] instance A PP_Instance identifying the instance + * with the VpnProvider. + * + * @return A PP_Resource corresponding to a VpnProvider if + * successful. + */ + PP_Resource Create([in] PP_Instance instance); + + /** + * IsVpnProvider() determines if the provided resource is a + * VpnProvider instance. + * + * @param[in] resource A PP_Resource corresponding to a + * VpnProvider. + * + * @return Returns PP_TRUE if resource is a + * PPB_VpnProvider, PP_FALSE if the + * resource is invalid or some type other than + * PPB_VpnProvider. + */ + PP_Bool IsVpnProvider([in] PP_Resource resource); + + /** + * Bind() binds to an existing configuration created from JavaScript by + * chrome.vpnProvider.createConfig. All packets will be routed + * via SendPacket and ReceivePacket. The user should + * register the callback for ReceivePacket before calling + * Bind(). + * + * @param[in] vpn_provider A PP_Resource corresponding to a + * VpnProvider. + * + * @param[in] configuration_id A PP_VARTYPE_STRING representing + * the configuration id from the callback of + * chrome.vpnProvider.createConfig. + * + * @param[in] configuration_name A PP_VARTYPE_STRING representing + * the configuration name as defined by the user when calling + * chrome.vpnProvider.createConfig. + * + * @param[in] callback A PP_CompletionCallback called on + * completion. + * + * @return An int32_t containing an error code from pp_errors.h. + * Returns PP_ERROR_INPROGRESS if a previous call to + * Bind() has not completed. + * Returns PP_ERROR_BADARGUMENT if either + * configuration_id or configuration_name are not of + * type PP_VARTYPE_STRING. + * Returns PP_ERROR_NOACCESS if the caller does the have the + * required "vpnProvider" permission. + * Returns PP_ERROR_FAILED if connection_id and + * connection_name could not be matched with the existing + * connection, or if the plugin originates from a different extension than the + * one that created the connection. + */ + int32_t Bind([in] PP_Resource vpn_provider, + [in] PP_Var configuration_id, + [in] PP_Var configuration_name, + [in] PP_CompletionCallback callback); + + /** + * SendPacket() sends an IP packet through the tunnel created for the VPN + * session. This will succeed only when the VPN session is owned by the + * module and the connection is bound. + * + * @param[in] vpn_provider A PP_Resource corresponding to a + * VpnProvider. + * + * @param[in] packet A PP_VARTYPE_ARRAY_BUFFER corresponding to + * an IP packet to be sent to the platform. + * + * @param[in] callback A PP_CompletionCallback called on + * completion. + * + * @return An int32_t containing an error code from pp_errors.h. + * Returns PP_ERROR_FAILED if the connection is not bound. + * Returns PP_ERROR_INPROGRESS if a previous call to + * SendPacket() has not completed. + * Returns PP_ERROR_BADARGUMENT if packet is not of + * type PP_VARTYPE_ARRAY_BUFFER. + */ + int32_t SendPacket([in] PP_Resource vpn_provider, + [in] PP_Var packet, + [in] PP_CompletionCallback callback); + + /** + * ReceivePacket() receives an IP packet from the tunnel for the VPN session. + * This function only returns a single packet. This function must be called at + * least N times to receive N packets, no matter the size of each packet. The + * callback should be registered before calling Bind(). + * + * @param[in] vpn_provider A PP_Resource corresponding to a + * VpnProvider. + * + * @param[out] packet The received packet is copied to provided + * packet. The packet must remain valid until + * ReceivePacket() completes. Its received PP_VarType will be + * PP_VARTYPE_ARRAY_BUFFER. + * + * @param[in] callback A PP_CompletionCallback called on + * completion. + * + * @return An int32_t containing an error code from pp_errors.h. + * Returns PP_ERROR_INPROGRESS if a previous call to + * ReceivePacket() has not completed. + */ + int32_t ReceivePacket([in] PP_Resource vpn_provider, + [out] PP_Var packet, + [in] PP_CompletionCallback callback); +}; diff --git a/browser/extensions/mortar/ppapi/api/ppb_websocket.idl b/browser/extensions/mortar/ppapi/api/ppb_websocket.idl new file mode 100644 index 000000000000..d006d282bcc7 --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/ppb_websocket.idl @@ -0,0 +1,460 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * This file defines the PPB_WebSocket interface providing + * bi-directional, full-duplex, communications over a single TCP socket. + */ + +[generate_thunk] + +label Chrome { + M18 = 1.0 +}; + +/** + * This enumeration contains the types representing the WebSocket ready state + * and these states are based on the JavaScript WebSocket API specification. + * GetReadyState() returns one of these states. + */ +[assert_size(4)] +enum PP_WebSocketReadyState { + /** + * Ready state is queried on an invalid resource. + */ + PP_WEBSOCKETREADYSTATE_INVALID = -1, + + /** + * Ready state that the connection has not yet been established. + */ + PP_WEBSOCKETREADYSTATE_CONNECTING = 0, + + /** + * Ready state that the WebSocket connection is established and communication + * is possible. + */ + PP_WEBSOCKETREADYSTATE_OPEN = 1, + + /** + * Ready state that the connection is going through the closing handshake. + */ + PP_WEBSOCKETREADYSTATE_CLOSING = 2, + + /** + * Ready state that the connection has been closed or could not be opened. + */ + PP_WEBSOCKETREADYSTATE_CLOSED = 3 +}; + +/** + * This enumeration contains status codes. These codes are used in Close() and + * GetCloseCode(). Refer to RFC 6455, The WebSocket Protocol, for further + * information. + * PP_WEBSOCKETSTATUSCODE_NORMAL_CLOSURE and codes in the range + * PP_WEBSOCKETSTATUSCODE_USER_REGISTERED_MIN to + * PP_WEBSOCKETSTATUSCODE_USER_REGISTERED_MAX, and + * PP_WEBSOCKETSTATUSCODE_USER_PRIVATE_MIN to + * PP_WEBSOCKETSTATUSCODE_USER_PRIVATE_MAX are valid for Close(). + */ +[assert_size(4)] +enum PP_WebSocketCloseCode { + /** + * Indicates to request closing connection without status code and reason. + * + * (Note that the code 1005 is forbidden to send in actual close frames by + * the RFC. PP_WebSocket reuses this code internally and the code will never + * appear in the actual close frames.) + */ + PP_WEBSOCKETSTATUSCODE_NOT_SPECIFIED = 1005, + + /** + * Status codes in the range 0-999 are not used. + */ + + /** + * Indicates a normal closure. + */ + PP_WEBSOCKETSTATUSCODE_NORMAL_CLOSURE = 1000, + + /** + * Indicates that an endpoint is "going away", such as a server going down. + */ + PP_WEBSOCKETSTATUSCODE_GOING_AWAY = 1001, + + /** + * Indicates that an endpoint is terminating the connection due to a protocol + * error. + */ + PP_WEBSOCKETSTATUSCODE_PROTOCOL_ERROR = 1002, + + /** + * Indicates that an endpoint is terminating the connection because it has + * received a type of data it cannot accept. + */ + PP_WEBSOCKETSTATUSCODE_UNSUPPORTED_DATA = 1003, + + /** + * Status code 1004 is reserved. + */ + + /** + * Pseudo code to indicate that receiving close frame doesn't contain any + * status code. + */ + PP_WEBSOCKETSTATUSCODE_NO_STATUS_RECEIVED = 1005, + + /** + * Pseudo code to indicate that connection was closed abnormally, e.g., + * without closing handshake. + */ + PP_WEBSOCKETSTATUSCODE_ABNORMAL_CLOSURE = 1006, + + /** + * Indicates that an endpoint is terminating the connection because it has + * received data within a message that was not consistent with the type of + * the message (e.g., non-UTF-8 data within a text message). + */ + PP_WEBSOCKETSTATUSCODE_INVALID_FRAME_PAYLOAD_DATA = 1007, + + /** + * Indicates that an endpoint is terminating the connection because it has + * received a message that violates its policy. + */ + PP_WEBSOCKETSTATUSCODE_POLICY_VIOLATION = 1008, + + /** + * Indicates that an endpoint is terminating the connection because it has + * received a message that is too big for it to process. + */ + PP_WEBSOCKETSTATUSCODE_MESSAGE_TOO_BIG = 1009, + + /** + * Indicates that an endpoint (client) is terminating the connection because + * it has expected the server to negotiate one or more extension, but the + * server didn't return them in the response message of the WebSocket + * handshake. + */ + PP_WEBSOCKETSTATUSCODE_MANDATORY_EXTENSION = 1010, + + /** + * Indicates that a server is terminating the connection because it + * encountered an unexpected condition. + */ + PP_WEBSOCKETSTATUSCODE_INTERNAL_SERVER_ERROR = 1011, + + /** + * Status codes in the range 1012-1014 are reserved. + */ + + /** + * Pseudo code to indicate that the connection was closed due to a failure to + * perform a TLS handshake. + */ + PP_WEBSOCKETSTATUSCODE_TLS_HANDSHAKE = 1015, + + /** + * Status codes in the range 1016-2999 are reserved. + */ + + /** + * Status codes in the range 3000-3999 are reserved for use by libraries, + * frameworks, and applications. These codes are registered directly with + * IANA. + */ + PP_WEBSOCKETSTATUSCODE_USER_REGISTERED_MIN = 3000, + PP_WEBSOCKETSTATUSCODE_USER_REGISTERED_MAX = 3999, + + /** + * Status codes in the range 4000-4999 are reserved for private use. + * Application can use these codes for application specific purposes freely. + */ + PP_WEBSOCKETSTATUSCODE_USER_PRIVATE_MIN = 4000, + PP_WEBSOCKETSTATUSCODE_USER_PRIVATE_MAX = 4999 +}; + +/** + * The PPB_WebSocket interface provides bi-directional, + * full-duplex, communications over a single TCP socket. + */ +interface PPB_WebSocket { + /** + * Create() creates a WebSocket instance. + * + * @param[in] instance A PP_Instance identifying the instance + * with the WebSocket. + * + * @return A PP_Resource corresponding to a WebSocket if + * successful. + */ + PP_Resource Create([in] PP_Instance instance); + + /** + * IsWebSocket() determines if the provided resource is a + * WebSocket instance. + * + * @param[in] resource A PP_Resource corresponding to a + * WebSocket. + * + * @return Returns PP_TRUE if resource is a + * PPB_WebSocket, PP_FALSE if the + * resource is invalid or some type other than + * PPB_WebSocket. + */ + PP_Bool IsWebSocket([in] PP_Resource resource); + + /** + * Connect() connects to the specified WebSocket server. You can call this + * function once for a web_socket. + * + * @param[in] web_socket A PP_Resource corresponding to a + * WebSocket. + * + * @param[in] url A PP_Var representing a WebSocket server URL. + * The PP_VarType must be PP_VARTYPE_STRING. + * + * @param[in] protocols A pointer to an array of PP_Var + * specifying sub-protocols. Each PP_Var represents one + * sub-protocol and its PP_VarType must be + * PP_VARTYPE_STRING. This argument can be null only if + * protocol_count is 0. + * + * @param[in] protocol_count The number of sub-protocols in + * protocols. + * + * @param[in] callback A PP_CompletionCallback called + * when a connection is established or an error occurs in establishing + * connection. + * + * @return An int32_t containing an error code from pp_errors.h. + * Returns PP_ERROR_BADARGUMENT if the specified + * url, or protocols contain an invalid string as + * defined in the WebSocket API specification. + * PP_ERROR_BADARGUMENT corresponds to a SyntaxError in the + * WebSocket API specification. + * Returns PP_ERROR_NOACCESS if the protocol specified in the + * url is not a secure protocol, but the origin of the caller + * has a secure scheme. Also returns PP_ERROR_NOACCESS if the + * port specified in the url is a port that the user agent + * is configured to block access to because it is a well-known port like + * SMTP. PP_ERROR_NOACCESS corresponds to a SecurityError of the + * specification. + * Returns PP_ERROR_INPROGRESS if this is not the first call to + * Connect(). + */ + [report_errors=False] + int32_t Connect([in] PP_Resource web_socket, + [in] PP_Var url, + [in, size_as=protocol_count] PP_Var[] protocols, + [in] uint32_t protocol_count, + [in] PP_CompletionCallback callback); + + /** + * Close() closes the specified WebSocket connection by specifying + * code and reason. + * + * @param[in] web_socket A PP_Resource corresponding to a + * WebSocket. + * + * @param[in] code The WebSocket close code. This is ignored if it is + * PP_WEBSOCKETSTATUSCODE_NOT_SPECIFIED. + * PP_WEBSOCKETSTATUSCODE_NORMAL_CLOSURE must be used for the + * usual case. To indicate some specific error cases, codes in the range + * PP_WEBSOCKETSTATUSCODE_USER_REGISTERED_MIN to + * PP_WEBSOCKETSTATUSCODE_USER_REGISTERED_MAX, and in the range + * PP_WEBSOCKETSTATUSCODE_USER_PRIVATE_MIN to + * PP_WEBSOCKETSTATUSCODE_USER_PRIVATE_MAX are available. + * + * @param[in] reason A PP_Var representing the WebSocket + * close reason. This is ignored if it is PP_VARTYPE_UNDEFINED. + * Otherwise, its PP_VarType must be + * PP_VARTYPE_STRING. + * + * @param[in] callback A PP_CompletionCallback called + * when the connection is closed or an error occurs in closing the + * connection. + * + * @return An int32_t containing an error code from pp_errors.h. + * Returns PP_ERROR_BADARGUMENT if reason contains + * an invalid character as a UTF-8 string, or is longer than 123 bytes. + * PP_ERROR_BADARGUMENT corresponds to a JavaScript SyntaxError + * in the WebSocket API specification. + * Returns PP_ERROR_NOACCESS if the code is not an integer + * equal to 1000 or in the range 3000 to 4999. PP_ERROR_NOACCESS + * corresponds to an InvalidAccessError in the WebSocket API specification. + * Returns PP_ERROR_INPROGRESS if a previous call to Close() is + * not finished. + */ + [report_errors=False] + int32_t Close([in] PP_Resource web_socket, + [in] uint16_t code, + [in] PP_Var reason, + [in] PP_CompletionCallback callback); + + /** + * ReceiveMessage() receives a message from the WebSocket server. + * This interface only returns a single message. That is, this interface must + * be called at least N times to receive N messages, no matter the size of + * each message. + * + * @param[in] web_socket A PP_Resource corresponding to a + * WebSocket. + * + * @param[out] message The received message is copied to provided + * message. The message must remain valid until + * ReceiveMessage() completes. Its received PP_VarType will be + * PP_VARTYPE_STRING or PP_VARTYPE_ARRAY_BUFFER. + * + * @param[in] callback A PP_CompletionCallback called + * when ReceiveMessage() completes. This callback is ignored if + * ReceiveMessage() completes synchronously and returns PP_OK. + * + * @return An int32_t containing an error code from pp_errors.h. + * If an error is detected or connection is closed, ReceiveMessage() returns + * PP_ERROR_FAILED after all buffered messages are received. + * Until buffered message become empty, ReceiveMessage() continues to return + * PP_OK as if connection is still established without errors. + */ + [report_errors=False] + int32_t ReceiveMessage([in] PP_Resource web_socket, + [out] PP_Var message, + [in] PP_CompletionCallback callback); + + /** + * SendMessage() sends a message to the WebSocket server. + * + * @param[in] web_socket A PP_Resource corresponding to a + * WebSocket. + * + * @param[in] message A message to send. The message is copied to an internal + * buffer, so the caller can free message safely after returning + * from the function. Its sent PP_VarType must be + * PP_VARTYPE_STRING or PP_VARTYPE_ARRAY_BUFFER. + * + * @return An int32_t containing an error code from pp_errors.h. + * Returns PP_ERROR_FAILED if the ReadyState is + * PP_WEBSOCKETREADYSTATE_CONNECTING. + * PP_ERROR_FAILED corresponds to a JavaScript + * InvalidStateError in the WebSocket API specification. + * Returns PP_ERROR_BADARGUMENT if the provided + * message contains an invalid character as a UTF-8 string. + * PP_ERROR_BADARGUMENT corresponds to a JavaScript + * SyntaxError in the WebSocket API specification. + * Otherwise, returns PP_OK, which doesn't necessarily mean + * that the server received the message. + */ + [report_errors=False] + int32_t SendMessage([in] PP_Resource web_socket, + [in] PP_Var message); + + /** + * GetBufferedAmount() returns the number of bytes of text and binary + * messages that have been queued for the WebSocket connection to send, but + * have not been transmitted to the network yet. + * + * @param[in] web_socket A PP_Resource corresponding to a + * WebSocket. + * + * @return Returns the number of bytes. + */ + [report_errors=False] + uint64_t GetBufferedAmount([in] PP_Resource web_socket); + + /** + * GetCloseCode() returns the connection close code for the WebSocket + * connection. + * + * @param[in] web_socket A PP_Resource corresponding to a + * WebSocket. + * + * @return Returns 0 if called before the close code is set. + */ + [report_errors=False] + uint16_t GetCloseCode([in] PP_Resource web_socket); + + /** + * GetCloseReason() returns the connection close reason for the WebSocket + * connection. + * + * @param[in] web_socket A PP_Resource corresponding to a + * WebSocket. + * + * @return Returns a PP_VARTYPE_STRING var. If called before the + * close reason is set, the return value contains an empty string. Returns a + * PP_VARTYPE_UNDEFINED if called on an invalid resource. + */ + [report_errors=False] + PP_Var GetCloseReason([in] PP_Resource web_socket); + + /** + * GetCloseWasClean() returns if the connection was closed cleanly for the + * specified WebSocket connection. + * + * @param[in] web_socket A PP_Resource corresponding to a + * WebSocket. + * + * @return Returns PP_FALSE if called before the connection is + * closed, called on an invalid resource, or closed for abnormal reasons. + * Otherwise, returns PP_TRUE if the connection was closed + * cleanly. + */ + [report_errors=False] + PP_Bool GetCloseWasClean([in] PP_Resource web_socket); + + /** + * GetExtensions() returns the extensions selected by the server for the + * specified WebSocket connection. + * + * @param[in] web_socket A PP_Resource corresponding to a + * WebSocket. + * + * @return Returns a PP_VARTYPE_STRING var. If called before the + * connection is established, the var's data is an empty string. Returns a + * PP_VARTYPE_UNDEFINED if called on an invalid resource. + */ + [report_errors=False] + PP_Var GetExtensions([in] PP_Resource web_socket); + + /** + * GetProtocol() returns the sub-protocol chosen by the server for the + * specified WebSocket connection. + * + * @param[in] web_socket A PP_Resource corresponding to a + * WebSocket. + * + * @return Returns a PP_VARTYPE_STRING var. If called before the + * connection is established, the var contains the empty string. Returns a + * PP_VARTYPE_UNDEFINED if called on an invalid resource. + */ + [report_errors=False] + PP_Var GetProtocol([in] PP_Resource web_socket); + + /** + * GetReadyState() returns the ready state of the specified WebSocket + * connection. + * + * @param[in] web_socket A PP_Resource corresponding to a + * WebSocket. + * + * @return Returns PP_WEBSOCKETREADYSTATE_INVALID if called + * before Connect() is called, or if this function is called on an + * invalid resource. + */ + [on_failure=PP_WEBSOCKETREADYSTATE_INVALID, report_errors=False] + PP_WebSocketReadyState GetReadyState([in] PP_Resource web_socket); + + /** + * GetURL() returns the URL associated with specified WebSocket connection. + * + * @param[in] web_socket A PP_Resource corresponding to a + * WebSocket. + * + * @return Returns a PP_VARTYPE_STRING var. If called before the + * connection is established, the var contains the empty string. Returns a + * PP_VARTYPE_UNDEFINED if this function is called on an + * invalid resource. + */ + [report_errors=False] + PP_Var GetURL([in] PP_Resource web_socket); +}; diff --git a/browser/extensions/mortar/ppapi/api/ppp.idl b/browser/extensions/mortar/ppapi/api/ppp.idl new file mode 100644 index 000000000000..6cb99e072051 --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/ppp.idl @@ -0,0 +1,139 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * This file defines three functions that your module must + * implement to interact with the browser. + */ + +#inline c + +#include "ppapi/c/pp_module.h" +#include "ppapi/c/pp_stdint.h" +#include "ppapi/c/ppb.h" + +#if __GNUC__ >= 4 +#define PP_EXPORT __attribute__ ((visibility("default"))) +#elif defined(_MSC_VER) +#define PP_EXPORT __declspec(dllexport) +#endif + +/* {PENDING: undefine PP_EXPORT?} */ + +/* We don't want name mangling for these external functions. We only need + * 'extern "C"' if we're compiling with a C++ compiler. + */ +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @addtogroup Functions + * @{ + */ + +/** + * PPP_InitializeModule() is the entry point for a module and is called by the + * browser when your module loads. Your code must implement this function. + * + * Failure indicates to the browser that this module can not be used. In this + * case, the module will be unloaded and ShutdownModule will NOT be called. + * + * @param[in] module A handle to your module. Generally you should store this + * value since it will be required for other API calls. + * @param[in] get_browser_interface A pointer to the function that you can + * use to query for browser interfaces. Generally you should store this value + * for future use. + * + * @return PP_OK on success. Any other value on failure. + */ +PP_EXPORT int32_t PPP_InitializeModule(PP_Module module, + PPB_GetInterface get_browser_interface); +/** + * @} + */ + +/** + * @addtogroup Functions + * @{ + */ + +/** + * PPP_ShutdownModule() is sometimes called before the module + * is unloaded. It is not recommended that you implement this function. + * + * There is no practical use of this function for third party modules. Its + * existence is because of some internal use cases inside Chrome. + * + * Since your module runs in a separate process, there's no need to free + * allocated memory. There is also no need to free any resources since all of + * resources associated with an instance will be force-freed when that instance + * is deleted. + * + * Note: This function will always be skipped on untrusted + * (Native Client) implementations. This function may be skipped on trusted + * implementations in certain circumstances when Chrome does "fast shutdown" + * of a web page. + */ +PP_EXPORT void PPP_ShutdownModule(void); +/** + * @} + */ + +/** + * @addtogroup Functions + * @{ + */ + +/** + * PPP_GetInterface() is called by the browser to query the module for + * interfaces it supports. + * + * Your module must implement the PPP_Instance interface or it + * will be unloaded. Other interfaces are optional. + * + * This function is called from within browser code whenever an interface is + * needed. This means your plugin could be reentered via this function if you + * make a browser call and it needs an interface. Furthermore, you should not + * make any other browser calls from within your implementation to avoid + * reentering the browser. + * + * As a result, your implementation of this should merely provide a lookup + * from the requested name to an interface pointer, via something like a big + * if/else block or a map, and not do any other work. + * + * @param[in] interface_name A pointer to a "PPP" (plugin) interface name. + * Interface names are null-terminated ASCII strings. + * + * @return A pointer for the interface or NULL if the interface is + * not supported. + */ +PP_EXPORT const void* PPP_GetInterface(const char* interface_name); +/** + * @} + */ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endinl + +/** + * Defines the type of the PPP_InitializeModule function. + */ +typedef int32_t PP_InitializeModule_Func( + [in] PP_Module module, + [in] PPB_GetInterface get_browser_interface); + +/** + * Defines the type of the PPP_ShutdownModule function. + */ +typedef void PP_ShutdownModule_Func(); + +/** + * Defines the type of the PPP_ShutdownModule function. + */ +typedef interface_t PP_GetInterface_Func([in] str_t interface_name); diff --git a/browser/extensions/mortar/ppapi/api/ppp_graphics_3d.idl b/browser/extensions/mortar/ppapi/api/ppp_graphics_3d.idl new file mode 100644 index 000000000000..007cae7aba9e --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/ppp_graphics_3d.idl @@ -0,0 +1,25 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * Defines the PPP_Graphics3D struct representing a 3D graphics + * context within the browser. + */ + +label Chrome { + M15 = 1.0 +}; + +/** + * PPP_Graphics3D defines the notification interface for a 3D + * graphics context. + */ +[macro="PPP_GRAPHICS_3D_INTERFACE", iname="PPP_Graphics_3D"] +interface PPP_Graphics3D { + /** + * Called when the OpenGL ES window is invalidated and needs to be repainted. + */ + void Graphics3DContextLost(PP_Instance instance); +}; diff --git a/browser/extensions/mortar/ppapi/api/ppp_input_event.idl b/browser/extensions/mortar/ppapi/api/ppp_input_event.idl new file mode 100644 index 000000000000..97285c284205 --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/ppp_input_event.idl @@ -0,0 +1,63 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * This file defines the API for receiving input events from the browser. + */ + +label Chrome { + M14 = 0.1 +}; + +[version=0.1, macro="PPP_INPUT_EVENT_INTERFACE"] +interface PPP_InputEvent { + /** + * Function for receiving input events from the browser. + * + * In order to receive input events, you must register for them by calling + * PPB_InputEvent.RequestInputEvents() or RequestFilteringInputEvents(). By + * default, no events are delivered. + * + * If the event was handled, it will not be forwarded to the default handlers + * in the web page. If it was not handled, it may be dispatched to a default + * handler. So it is important that an instance respond accurately with + * whether event propagation should continue. + * + * Event propagation also controls focus. If you handle an event like a mouse + * event, typically the instance will be given focus. Returning false from + * a filtered event handler or not registering for an event type means that + * the click will be given to a lower part of the page and your instance will + * not receive focus. This allows an instance to be partially transparent, + * where clicks on the transparent areas will behave like clicks to the + * underlying page. + * + * In general, you should try to keep input event handling short. Especially + * for filtered input events, the browser or page may be blocked waiting for + * you to respond. + * + * The caller of this function will maintain a reference to the input event + * resource during this call. Unless you take a reference to the resource + * to hold it for later, you don't need to release it. + * + * Note: If you're not receiving input events, make sure you + * register for the event classes you want by calling RequestInputEvents or + * RequestFilteringInputEvents. If you're still not receiving keyboard input + * events, make sure you're returning true (or using a non-filtered event + * handler) for mouse events. Otherwise, the instance will not receive focus + * and keyboard events will not be sent. + * + * \see PPB_InputEvent.RequestInputEvents and + * PPB_InputEvent.RequestFilteringInputEvents + * + * @return PP_TRUE if the event was handled, PP_FALSE if not. If you have + * registered to filter this class of events by calling + * RequestFilteringInputEvents, and you return PP_FALSE, the event will + * be forwarded to the page (and eventually the browser) for the default + * handling. For non-filtered events, the return value will be ignored. + */ + PP_Bool HandleInputEvent([in] PP_Instance instance, + [in] PP_Resource input_event); +}; + diff --git a/browser/extensions/mortar/ppapi/api/ppp_instance.idl b/browser/extensions/mortar/ppapi/api/ppp_instance.idl new file mode 100644 index 000000000000..f178b7a42e4f --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/ppp_instance.idl @@ -0,0 +1,242 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * This file defines the PPP_Instance structure - a series of + * pointers to methods that you must implement in your module. + */ + +label Chrome { + M14 = 1.0, + M17 = 1.1 +}; + +/** + * The PPP_Instance interface contains pointers to a series of + * functions that you must implement in your module. These functions can be + * trivial (simply return the default return value) unless you want your module + * to handle events such as change of focus or input events (keyboard/mouse) + * events. + */ +interface PPP_Instance { + /** + * DidCreate() is a creation handler that is called when a new instance is + * created. This function is called for each instantiation on the page, + * corresponding to one \ tag on the page. + * + * Generally you would handle this call by initializing the information + * your module associates with an instance and creating a mapping from the + * given PP_Instance handle to this data. The + * PP_Instance handle will be used in subsequent calls to + * identify which instance the call pertains to. + * + * It's possible for more than one instance to be created in a single module. + * This means that you may get more than one OnCreate without an + * OnDestroy in between, and should be prepared to maintain + * multiple states associated with each instance. + * + * If this function reports a failure (by returning PP_FALSE), + * the instance will be deleted. + * + * @param[in] instance A new PP_Instance identifying one + * instance of a module. This is an opaque handle. + * + * @param[in] argc The number of arguments contained in argn + * and argv. + * + * @param[in] argn An array of argument names. These argument names are + * supplied in the \ tag, for example: + * \ will produce two + * argument names: "id" and "dimensions." + * + * @param[in] argv An array of argument values. These are the values of the + * arguments listed in the \ tag, for example + * \ will produce two + * argument values: "nacl_module" and "2". The indices of these values match + * the indices of the corresponding names in argn. + * + * @return PP_TRUE on success or PP_FALSE on + * failure. + */ + PP_Bool DidCreate( + /* A PP_Instance identifying one instance of a module. */ + [in] PP_Instance instance, + /* The number of arguments contained in argn and argv. */ + [in] uint32_t argc, + /* An array of argument names. These argument names are + * supplied in the tag, for example: + * will produce two argument + * names: "id" and "dimensions." + */ + [in, size_as=argc] str_t[] argn, + /* An array of argument values. These are the values of the + * arguments listed in the tag, for example + * will produce two argument + * values: "nacl_module" and "2." The indices of these values match the + * indices of the corresponding names in argn. + */ + [in, size_as=argc] str_t[] argv); + + /** + * DidDestroy() is an instance destruction handler. This function is called + * in many cases (see below) when a module instance is destroyed. It will be + * called even if DidCreate() returned failure. + * + * Generally you will handle this call by deallocating the tracking + * information and the PP_Instance mapping you created in the + * DidCreate() call. You can also free resources associated with this + * instance but this isn't required; all resources associated with the deleted + * instance will be automatically freed when this function returns. + * + * The instance identifier will still be valid during this call, so the module + * can perform cleanup-related tasks. Once this function returns, the + * PP_Instance handle will be invalid. This means that you can't + * do any asynchronous operations like network requests, file writes or + * messaging from this function since they will be immediately canceled. + * + * Note: This function will always be skipped on untrusted + * (Native Client) implementations. This function may be skipped on trusted + * implementations in certain circumstances when Chrome does "fast shutdown" + * of a web page. Fast shutdown will happen in some cases when all module + * instances are being deleted, and no cleanup functions will be called. + * The module will just be unloaded and the process terminated. + * + * @param[in] instance A PP_Instance identifying one instance + * of a module. + */ + void DidDestroy( + /* A PP_Instance identifying one instance of a module. */ + [in] PP_Instance instance); + + /** + * Deprecated in 1.1 in favor of the version that takes a Resource. + * + * DidChangeView() is called when the position, the size, of the clip + * rectangle of the element in the browser that corresponds to this + * instance has changed. + * + * A typical implementation will check the size of the position + * argument and reallocate the graphics context when a different size is + * received. Note that this function will be called for scroll events where + * the size doesn't change, so you should always check that the size is + * actually different before doing any reallocations. + * + * @param[in] instance A PP_Instance identifying the instance + * that has changed. + * + * @param[in] position The location on the page of the instance. This is + * relative to the top left corner of the viewport, which changes as the + * page is scrolled. Generally the size of this value will be used to create + * a graphics device, and the position is ignored (most things are relative + * to the instance so the absolute position isn't useful in most cases). + * + * @param[in] clip The visible region of the instance. This is relative to + * the top left of the module's coordinate system (not the page). If the + * module is invisible, clip will be (0, 0, 0, 0). + * + * It's recommended to check for invisible instances and to stop + * generating graphics updates in this case to save system resources. It's + * not usually worthwhile, however, to generate partial updates according to + * the clip when the instance is partially visible. Instead, update the entire + * region. The time saved doing partial paints is usually not significant and + * it can create artifacts when scrolling (this notification is sent + * asynchronously from scrolling so there can be flashes of old content in the + * exposed regions). + */ + void DidChangeView( + /* A PP_Instance identifying the instance whose view changed. */ + [in] PP_Instance instance, + /* The new location on the page of this instance. This is relative to + * the top left corner of the viewport, which changes as the + * page is scrolled. + */ + [in] PP_Rect position, + /* The visible region of the NaCl module. This is relative to the top + * left of the plugin's coordinate system (not the page) If the plugin + * is invisible, clip will be (0, 0, 0, 0). + */ + [in] PP_Rect clip); + + /** + * DidChangeView() is called when the position, size, or other view + * attributes of the instance has changed. + */ + [version=1.1] + void DidChangeView( + /* A PP_Instance identifying the instance whose view changed. */ + [in] PP_Instance instance, + /** + * A handle to a PPB_View resource identifying the new view. + */ + [in] PP_Resource view); + + /** + * DidChangeFocus() is called when an instance has gained or lost focus. + * Having focus means that keyboard events will be sent to the instance. + * An instance's default condition is that it will not have focus. + * + * The focus flag takes into account both browser tab and window focus as + * well as focus of the plugin element on the page. In order to be deemed + * to have focus, the browser window must be topmost, the tab must be + * selected in the window, and the instance must be the focused element on + * the page. + * + * Note:Clicks on instances will give focus only if you + * handle the click event. Return true from + * HandleInputEvent in PPP_InputEvent (or use + * unfiltered events) to signal that the click event was handled. Otherwise, + * the browser will bubble the event and give focus to the element on the page + * that actually did end up consuming it. If you're not getting focus, check + * to make sure you're either requesting them via + * RequestInputEvents() (which implicitly marks all input events + * as consumed) or via RequestFilteringInputEvents() and + * returning true from your event handler. + * + * @param[in] instance A PP_Instance identifying the instance + * receiving the input event. + * + * @param[in] has_focus Indicates the new focused state of the instance. + */ + void DidChangeFocus( + /* A PP_Instance identifying one instance of a module. */ + [in] PP_Instance instance, + /* Indicates whether this NaCl module gained or lost event focus. */ + [in] PP_Bool has_focus); + + /** + * HandleDocumentLoad() is called after initialize for a full-frame + * instance that was instantiated based on the MIME type of a DOMWindow + * navigation. This situation only applies to modules that are pre-registered + * to handle certain MIME types. If you haven't specifically registered to + * handle a MIME type or aren't positive this applies to you, your + * implementation of this function can just return PP_FALSE. + * + * The given url_loader corresponds to a + * PPB_URLLoader instance that is already opened. Its response + * headers may be queried using PPB_URLLoader::GetResponseInfo. + * The reference count for the URL loader is not incremented automatically on + * behalf of the module. You need to increment the reference count yourself + * if you are going to keep a reference to it. + * + * This method returns PP_FALSE if the module cannot handle the + * data. In response to this method, the module should call + * ReadResponseBody() to read the incoming data. + * + * @param[in] instance A PP_Instance identifying the instance + * that should do the load. + * + * @param[in] url_loader An open PPB_URLLoader instance. + * + * @return PP_TRUE if the data was handled, + * PP_FALSE otherwise. If you return false, the load will be + * canceled for you. + */ + PP_Bool HandleDocumentLoad( + /* A PP_Instance identifying one instance of a module. */ + [in] PP_Instance instance, + /* A PP_Resource an open PPB_URLLoader instance. */ + [in] PP_Resource url_loader); + +}; diff --git a/browser/extensions/mortar/ppapi/api/ppp_message_handler.idl b/browser/extensions/mortar/ppapi/api/ppp_message_handler.idl new file mode 100644 index 000000000000..4fe7fa8c3246 --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/ppp_message_handler.idl @@ -0,0 +1,77 @@ +/* Copyright 2014 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * This file defines the PPP_MessageHandler interface that plugins + * can implement and register using PPB_Messaging::RegisterMessageHandler in + * order to handle messages sent from JavaScript via postMessage() or + * postMessageAndAwaitResponse(). + */ + +label Chrome { + M39 = 0.2 +}; + +/** + * The PPP_MessageHandler interface is implemented by the plugin + * if the plugin wants to receive messages from a thread other than the main + * Pepper thread, or if the plugin wants to handle blocking messages which + * JavaScript may send via postMessageAndAwaitResponse(). + * + * This interface struct should not be returned by PPP_GetInterface; instead it + * must be passed as a parameter to PPB_Messaging::RegisterMessageHandler. + */ +[no_interface_string] +interface PPP_MessageHandler { + /** + * Invoked as a result of JavaScript invoking postMessage() on the plugin's + * DOM element. + * + * @param[in] instance A PP_Instance identifying one instance + * of a module. + * @param[in] user_data is the same pointer which was provided by a call to + * RegisterMessageHandler(). + * @param[in] message A copy of the parameter that JavaScript provided to + * postMessage(). + */ + void HandleMessage([in] PP_Instance instance, + [inout] mem_t user_data, + [constptr_in] PP_Var message); + /** + * Invoked as a result of JavaScript invoking postMessageAndAwaitResponse() + * on the plugin's DOM element. + * + * NOTE: JavaScript execution is blocked during the duration of this call. + * Hence, the plugin should respond as quickly as possible. For this reason, + * blocking completion callbacks are disallowed while handling a blocking + * message. + * + * @param[in] instance A PP_Instance identifying one instance + * of a module. + * @param[in] user_data is the same pointer which was provided by a call to + * RegisterMessageHandler(). + * @param[in] message is a copy of the parameter that JavaScript provided + * to postMessageAndAwaitResponse(). + * @param[out] response will be copied to a JavaScript object which is + * returned as the result of postMessageAndAwaitResponse() to the invoking + JavaScript. + */ + void HandleBlockingMessage([in] PP_Instance instance, + [inout] mem_t user_data, + [constptr_in] PP_Var message, + [out] PP_Var response); + /** + * Invoked when the handler object is no longer needed. After this, no more + * calls will be made which pass this same value for instance + * and user_data. + * + * @param[in] instance A PP_Instance identifying one instance + * of a module. + * @param[in] user_data is the same pointer which was provided by a call to + * RegisterMessageHandler. + */ + void Destroy([in] PP_Instance instance, [inout] mem_t user_data); +}; + diff --git a/browser/extensions/mortar/ppapi/api/ppp_messaging.idl b/browser/extensions/mortar/ppapi/api/ppp_messaging.idl new file mode 100644 index 000000000000..83c2010382be --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/ppp_messaging.idl @@ -0,0 +1,64 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * This file defines the PPP_Messaging interface containing pointers to + * functions that you must implement to handle postMessage messages + * on the associated DOM element. + * + */ + +label Chrome { + M14 = 1.0 +}; + +/** + * The PPP_Messaging interface contains pointers to functions + * that you must implement to handle postMessage events on the associated + * DOM element. + */ +interface PPP_Messaging { + /** + * HandleMessage() is a function that the browser calls when PostMessage() + * is invoked on the DOM element for the module instance in JavaScript. Note + * that PostMessage() in the JavaScript interface is asynchronous, meaning + * JavaScript execution will not be blocked while HandleMessage() is + * processing the message. + * + * @param[in] instance A PP_Instance identifying one instance + * of a module. + * @param[in] message A PP_Var which has been converted from a + * JavaScript value. JavaScript array/object types are supported from Chrome + * M29 onward. All JavaScript values are copied when passing them to the + * plugin. + * + * When converting JavaScript arrays, any object properties whose name + * is not an array index are ignored. When passing arrays and objects, the + * entire reference graph will be converted and transferred. If the reference + * graph has cycles, the message will not be sent and an error will be logged + * to the console. + * + * The following JavaScript code invokes HandleMessage, passing + * the module instance on which it was invoked, with message + * being a string PP_Var containing "Hello world!" + * + * Example: + * + * @code + * + * + * + * + * + * + * @endcode + * + */ + void HandleMessage([in] PP_Instance instance, [in] PP_Var message); +}; + diff --git a/browser/extensions/mortar/ppapi/api/ppp_mouse_lock.idl b/browser/extensions/mortar/ppapi/api/ppp_mouse_lock.idl new file mode 100644 index 000000000000..f54543bd7789 --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/ppp_mouse_lock.idl @@ -0,0 +1,30 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * This file defines the PPP_MouseLock interface containing a + * function that you must implement to receive mouse lock events from the + * browser. + */ + +label Chrome { + M16 = 1.0 +}; + +/** + * The PPP_MouseLock interface contains a function that you must + * implement to receive mouse lock events from the browser. + */ +interface PPP_MouseLock { + /** + * MouseLockLost() is called when the instance loses the mouse lock, such as + * when the user presses the ESC key. + * + * @param[in] instance A PP_Instance identifying one instance + * of a module. + */ + void MouseLockLost([in] PP_Instance instance); +}; + diff --git a/browser/extensions/mortar/ppapi/api/private/finish_writing_these/ppb_flash_file.idl b/browser/extensions/mortar/ppapi/api/private/finish_writing_these/ppb_flash_file.idl new file mode 100644 index 000000000000..cf6fe8fb167d --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/private/finish_writing_these/ppb_flash_file.idl @@ -0,0 +1,81 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* This file contains PPB_Flash_File interface. */ + +/* A directory entry. */ +struct PP_DirEntry_Dev { + str_t name; + PP_Bool is_dir; +}; + +/* Directory. */ +struct PP_DirContents_Dev { + int32_t count; + [size_is(count)] PP_DirEntry_Dev[] entries; +}; + +/* PPB_Flash_File_ModuleLocal */ +interface PPB_Flash_File_ModuleLocal_0_1 { + /* Opens a module-local file, returning a file descriptor (posix) or a HANDLE + * (win32) into file. Module-local file paths (here and below) are + * '/'-separated UTF-8 strings, relative to a module-specific root. The return + * value is the ppapi error, PP_OK if success, one of the PP_ERROR_* in case + * of failure + */ + int32_t OpenFile( + [in] PP_Instance instance, + [in] str_t path, + [in] int32_t mode, + [out] PP_FileHandle file); + + /* Renames a module-local file. The return value is the ppapi error, PP_OK if + * success, one of the PP_ERROR_* in case of failure. + */ + int32_t RenameFile( + [in] PP_Instance instance, + [in] str_t path_from, + [in] str_t path_to); + + /* Deletes a module-local file or directory. If recursive is set and the path + * points to a directory, deletes all the contents of the directory. The + * return value is the ppapi error, PP_OK if success, one of the PP_ERROR_* in + * case of failure. + */ + int32_t DeleteFileOrDir( + [in] PP_Instance instance, + [in] str_t path, + [in] PP_Bool recursive); + + /* Creates a module-local directory. The return value is the ppapi error, + * PP_OK if success, one of the PP_ERROR_* in case of failure. + */ + int32_t CreateDir( + [in] PP_Instance instance, + [in] str_t path); + + /* Queries information about a module-local file. The return value is the + * ppapi error, PP_OK if success, one of the PP_ERROR_* in case of failure. + */ + int32_t QueryFile( + [in] PP_Instance instance, + [in] str_t path, + [out] PP_FileInfo info); + + /* Gets the list of files contained in a module-local directory. The return + * value is the ppapi error, PP_OK if success, one of the PP_ERROR_* in case + * of failure. If non-NULL, the returned contents should be freed with + * FreeDirContents. + */ + int32_t GetDirContents( + [in] PP_Instance instance, + [in] str_t path, + [out] PP_DirContents_Dev contents); + + /* Frees the data allocated by GetDirContents. */ + void FreeDirContents( + [in] PP_Instance instance, + [in] PP_DirContents_Dev contents); +}; diff --git a/browser/extensions/mortar/ppapi/api/private/finish_writing_these/ppb_pdf.idl b/browser/extensions/mortar/ppapi/api/private/finish_writing_these/ppb_pdf.idl new file mode 100644 index 000000000000..20e077f346a1 --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/private/finish_writing_these/ppb_pdf.idl @@ -0,0 +1,165 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* This file contains PPB_PDF interface. */ + +enum PP_ResourceString{ + PP_RESOURCESTRING_PDFGETPASSWORD = 0, + PP_RESOURCESTRING_PDFLOADING = 1, + PP_RESOURCESTRING_PDFLOAD_FAILED = 2 +}; + +enum PP_ResourceImage{ + PP_RESOURCEIMAGE_PDF_BUTTON_FTH = 0, + PP_RESOURCEIMAGE_PDF_BUTTON_FTH_HOVER = 1, + PP_RESOURCEIMAGE_PDF_BUTTON_FTH_PRESSED = 2, + PP_RESOURCEIMAGE_PDF_BUTTON_FTW = 3, + PP_RESOURCEIMAGE_PDF_BUTTON_FTW_HOVER = 4, + PP_RESOURCEIMAGE_PDF_BUTTON_FTW_PRESSED = 5, + PP_RESOURCEIMAGE_PDF_BUTTON_ZOOMIN = 6, + PP_RESOURCEIMAGE_PDF_BUTTON_ZOOMIN_HOVER = 7, + PP_RESOURCEIMAGE_PDF_BUTTON_ZOOMIN_PRESSED = 8, + PP_RESOURCEIMAGE_PDF_BUTTON_ZOOMOUT = 9, + PP_RESOURCEIMAGE_PDF_BUTTON_ZOOMOUT_HOVER = 10, + PP_RESOURCEIMAGE_PDF_BUTTON_ZOOMOUT_PRESSED = 11, + PP_RESOURCEIMAGE_PDF_BUTTON_THUMBNAIL_0 = 12, + PP_RESOURCEIMAGE_PDF_BUTTON_THUMBNAIL_1 = 13, + PP_RESOURCEIMAGE_PDF_BUTTON_THUMBNAIL_2 = 14, + PP_RESOURCEIMAGE_PDF_BUTTON_THUMBNAIL_3 = 15, + PP_RESOURCEIMAGE_PDF_BUTTON_THUMBNAIL_4 = 16, + PP_RESOURCEIMAGE_PDF_BUTTON_THUMBNAIL_5 = 17, + PP_RESOURCEIMAGE_PDF_BUTTON_THUMBNAIL_6 = 18, + PP_RESOURCEIMAGE_PDF_BUTTON_THUMBNAIL_7 = 19, + PP_RESOURCEIMAGE_PDF_BUTTON_THUMBNAIL_8 = 20, + PP_RESOURCEIMAGE_PDF_BUTTON_THUMBNAIL_9 = 21, + PP_RESOURCEIMAGE_PDF_BUTTON_THUMBNAIL_NUM_BACKGROUND = 22 +}; + +enum PP_PrivateFontCharset { + PP_PRIVATEFONTCHARSET_ANSI = 0, + PP_PRIVATEFONTCHARSET_DEFAULT = 1, + PP_PRIVATEFONTCHARSET_SYMBOL = 2, + PP_PRIVATEFONTCHARSET_MAC = 77, + PP_PRIVATEFONTCHARSET_SHIFTJIS = 128, + PP_PRIVATEFONTCHARSET_HANGUL = 129, + PP_PRIVATEFONTCHARSET_JOHAB = 130, + PP_PRIVATEFONTCHARSET_GB2312 = 134, + PP_PRIVATEFONTCHARSET_CHINESEBIG5 = 136, + PP_PRIVATEFONTCHARSET_GREEK = 161, + PP_PRIVATEFONTCHARSET_TURKISH = 162, + PP_PRIVATEFONTCHARSET_VIETNAMESE = 163, + PP_PRIVATEFONTCHARSET_HEBREW = 177, + PP_PRIVATEFONTCHARSET_ARABIC = 178, + PP_PRIVATEFONTCHARSET_BALTIC = 186, + PP_PRIVATEFONTCHARSET_RUSSIAN = 204, + PP_PRIVATEFONTCHARSET_THAI = 222, + PP_PRIVATEFONTCHARSET_EASTEUROPE = 238, + PP_PRIVATEFONTCHARSET_OEM = 255 +}; + +struct PP_PrivateFontFileDescription { + str_t face; + uint32_t weight; + PP_Bool italic; +}; + +struct PP_PrivateFindResult { + int32_t start_index; + int32_t length; +}; + +interface PPB_PDF_0_1 { + /* Returns a localized string. */ + PP_Var GetLocalizedString( + [in] PP_Instance instance, + [in] PP_ResourceString string_id); + + /* Returns a resource image. */ + PP_Resource GetResourceImage( + [in] PP_Instance instance, + [in] PP_ResourceImage image_id); + + /* Returns a resource identifying a font file corresponding to the given font + * request after applying the browser-specific fallback. + * + * Currently Linux-only. + */ + PP_Resource GetFontFileWithFallback( + [in] PP_Instance instance, + [in] PP_FontDescription_Dev description, + [in] PP_PrivateFontCharset charset); + + /* Given a resource previously returned by GetFontFileWithFallback, returns + * a pointer to the requested font table. Linux only. + */ + PP_Bool GetFontTableForPrivateFontFile( + [in] PP_Resource font_file, + [in] uint32_t table, + [out] mem_t output, + [out] uint32_t output_length); + + /* Search the given string using ICU. Use PPB_Core's MemFree on results when + * done. + */ + void SearchString( + [in] PP_Instance instance, + [in] mem_t string, + [in] mem_t term, + [in] PP_Bool case_sensitive, + [out, size_is(count)] PP_PrivateFindResult[] results, + [out] int32_t count); + + /* Since WebFrame doesn't know about PPAPI requests, it'll think the page has + * finished loading even if there are outstanding requests by the plugin. + * Take this out once WebFrame knows about requests by PPAPI plugins. + */ + void DidStartLoading( + [in] PP_Instance instance); + void DidStopLoading( + [in] PP_Instance instance); + + /* Sets content restriction for a full-page plugin (i.e. can't copy/print). + * The value is a bitfield of ContentRestriction enums. + */ + void SetContentRestriction( + [in] PP_Instance instance, + [in] int32_t restrictions); + + /* Use UMA so we know average pdf page count. */ + void HistogramPDFPageCount( + [in] int32_t count); + + /* Notifies the browser that the given action has been performed. */ + void UserMetricsRecordAction( + [in] PP_Var action); + + /* Notifies the browser that the PDF has an unsupported feature. */ + void HasUnsupportedFeature( + [in] PP_Instance instance); + + /* Tells the browser to open a dialog box to receive a password from the + * user, masking input characters. Returns the value entered by the user, or + * an empty string if the user cancels instead. + */ + PP_Var ModalPromptForPassword( + [in] PP_Instance instance, + [in] PP_Var message); + + /* Returns PP_TRUE if the plugin is out of process. */ + PP_Bool IsOutOfProcess( + [in] PP_Instance instance); + + /* Sets the selected text of the plugin. If |selected_text| is empty, then no + * text is selected. */ + void SetSelectedText( + [in] PP_Instance instance, + [in] str_t selected_text); + + /* Sets the link under the cursor. If |url| is empty, then no link is under + * the cursor. */ + void SetLinkUnderCursor( + [in] PP_Instance instance, + [in] str_t url); +}; diff --git a/browser/extensions/mortar/ppapi/api/private/finish_writing_these/ppb_proxy_private.idl b/browser/extensions/mortar/ppapi/api/private/finish_writing_these/ppb_proxy_private.idl new file mode 100644 index 000000000000..f0173ebc7366 --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/private/finish_writing_these/ppb_proxy_private.idl @@ -0,0 +1,17 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* Exposes functions needed by the out-of-process proxy to call into the + * renderer PPAPI implementation. + */ +interface PPB_Proxy_Private_0_2 { + /* Called when the given plugin process has crashed. */ + void PluginCrashed( + [in] PP_Module module); + + /* Returns the instance for the given resource, or 0 on failure. */ + PP_Instance GetInstanceForResource( + [in] PP_Resource resource); +}; diff --git a/browser/extensions/mortar/ppapi/api/private/pp_content_decryptor.idl b/browser/extensions/mortar/ppapi/api/private/pp_content_decryptor.idl new file mode 100644 index 000000000000..da62b14c2722 --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/private/pp_content_decryptor.idl @@ -0,0 +1,487 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * The PP_DecryptTrackingInfo struct contains necessary information + * that can be used to associate the decrypted block with a decrypt request + * and/or an input block. + */ +[assert_size(16)] +struct PP_DecryptTrackingInfo { + /** + * Client-specified identifier for the associated decrypt request. By using + * this value, the client can associate the decrypted block with a decryption + * request. + */ + uint32_t request_id; + + /** + * A unique buffer ID to identify a PPB_Buffer_Dev. Unlike a PP_Resource, + * this ID is identical at both the renderer side and the plugin side. + * In PPB_ContentDecryptor_Private calls, this is the ID of the + * buffer associated with the decrypted block/frame/samples. + * In PPP_ContentDecryptor_Private calls, this is the ID of a + * buffer that is no longer need at the renderer side, which can be released + * or recycled by the plugin. This ID can be 0 if there is no buffer to be + * released or recycled. + */ + uint32_t buffer_id; + + /** + * Timestamp in microseconds of the associated block. By using this value, + * the client can associate the decrypted (and decoded) data with an input + * block. This is needed because buffers may be delivered out of order and + * not in response to the request_id they were provided with. + */ + int64_t timestamp; +}; + +/** + * The PP_DecryptSubsampleDescription struct contains information + * to support subsample decryption. + * + * An input block can be split into several continuous subsamples. + * A PP_DecryptSubsampleEntry specifies the number of clear and + * cipher bytes in each subsample. For example, the following block has three + * subsamples: + * + * |<----- subsample1 ----->|<----- subsample2 ----->|<----- subsample3 ----->| + * | clear1 | cipher1 | clear2 | cipher2 | clear3 | cipher3 | + * + * For decryption, all of the cipher bytes in a block should be treated as a + * contiguous (in the subsample order) logical stream. The clear bytes should + * not be considered as part of decryption. + * + * Logical stream to decrypt: | cipher1 | cipher2 | cipher3 | + * Decrypted stream: | decrypted1| decrypted2 | decrypted3 | + * + * After decryption, the decrypted bytes should be copied over the position + * of the corresponding cipher bytes in the original block to form the output + * block. Following the above example, the decrypted block should be: + * + * |<----- subsample1 ----->|<----- subsample2 ----->|<----- subsample3 ----->| + * | clear1 | decrypted1| clear2 | decrypted2 | clear3 | decrypted3 | + */ +[assert_size(8)] +struct PP_DecryptSubsampleDescription { + /** + * Size in bytes of clear data in a subsample entry. + */ + uint32_t clear_bytes; + + /** + * Size in bytes of encrypted data in a subsample entry. + */ + uint32_t cipher_bytes; +}; + +/** + * The PP_EncryptedBlockInfo struct contains all the information + * needed to decrypt an encrypted block. + */ +[assert_size(368)] +struct PP_EncryptedBlockInfo { + /** + * Information needed by the client to track the block to be decrypted. + */ + PP_DecryptTrackingInfo tracking_info; + + /** + * Size in bytes of data to be decrypted (data_offset included). + */ + uint32_t data_size; + + /** + * Key ID of the block to be decrypted. + * + * For WebM the key ID can be as large as 2048 bytes in theory. But it's not + * used in current implementations. If we really need to support it, we should + * move key ID out as a separate parameter, e.g. as a PP_Var, or + * make the whole PP_EncryptedBlockInfo as a + * PP_Resource. + */ + uint8_t[64] key_id; + uint32_t key_id_size; + + /** + * Initialization vector of the block to be decrypted. + */ + uint8_t[16] iv; + uint32_t iv_size; + + /** + * Subsample information of the block to be decrypted. + * + * We need to have a fixed size of |subsamples| here. Choose 32 because it is + * sufficient for almost all real life scenarios. Note that in theory the + * number of subsamples could be larger than 32. If that happens, playback + * will fail. + */ + PP_DecryptSubsampleDescription[32] subsamples; + uint32_t num_subsamples; +}; + +/** + * PP_DecryptedFrameFormat contains video frame formats. + */ +[assert_size(4)] +enum PP_DecryptedFrameFormat { + PP_DECRYPTEDFRAMEFORMAT_UNKNOWN = 0, + PP_DECRYPTEDFRAMEFORMAT_YV12 = 1, + PP_DECRYPTEDFRAMEFORMAT_I420 = 2 +}; + +/** + * PP_DecryptedSampleFormat contains audio sample formats. + */ +[assert_size(4)] +enum PP_DecryptedSampleFormat { + PP_DECRYPTEDSAMPLEFORMAT_UNKNOWN = 0, + PP_DECRYPTEDSAMPLEFORMAT_U8 = 1, + PP_DECRYPTEDSAMPLEFORMAT_S16 = 2, + PP_DECRYPTEDSAMPLEFORMAT_S32 = 3, + PP_DECRYPTEDSAMPLEFORMAT_F32 = 4, + PP_DECRYPTEDSAMPLEFORMAT_PLANAR_S16 = 5, + PP_DECRYPTEDSAMPLEFORMAT_PLANAR_F32 = 6 +}; + +/** + * The PP_DecryptResult enum contains decryption and decoding + * result constants. + */ +[assert_size(4)] +enum PP_DecryptResult { + /** The decryption (and/or decoding) operation finished successfully. */ + PP_DECRYPTRESULT_SUCCESS = 0, + /** The decryptor did not have the necessary decryption key. */ + PP_DECRYPTRESULT_DECRYPT_NOKEY = 1, + /** The input was accepted by the decoder but no frame(s) can be produced. */ + PP_DECRYPTRESULT_NEEDMOREDATA = 2, + /** An unexpected error happened during decryption. */ + PP_DECRYPTRESULT_DECRYPT_ERROR = 3, + /** An unexpected error happened during decoding. */ + PP_DECRYPTRESULT_DECODE_ERROR = 4 +}; + +/** + * PP_DecryptedBlockInfo struct contains the decryption result and + * tracking info associated with the decrypted block. + */ +[assert_size(24)] +struct PP_DecryptedBlockInfo { + /** + * Result of the decryption (and/or decoding) operation. + */ + PP_DecryptResult result; + + /** + * Size in bytes of decrypted data, which may be less than the size of the + * corresponding buffer. + */ + uint32_t data_size; + + /** + * Information needed by the client to track the block to be decrypted. + */ + PP_DecryptTrackingInfo tracking_info; +}; + +/** + * PP_DecryptedFramePlanes provides YUV plane index values for + * accessing plane offsets stored in PP_DecryptedFrameInfo. + */ +[assert_size(4)] +enum PP_DecryptedFramePlanes { + PP_DECRYPTEDFRAMEPLANES_Y = 0, + PP_DECRYPTEDFRAMEPLANES_U = 1, + PP_DECRYPTEDFRAMEPLANES_V = 2 +}; + +/** + * PP_DecryptedFrameInfo contains the result of the + * decrypt and decode operation on the associated frame, information required + * to access the frame data in buffer, and tracking info. + */ +[assert_size(56)] +struct PP_DecryptedFrameInfo { + /** + * Result of the decrypt and decode operation. + */ + PP_DecryptResult result; + + /** + * Format of the decrypted frame. + */ + PP_DecryptedFrameFormat format; + + /** + * Offsets into the buffer resource for accessing video planes. + */ + int32_t[3] plane_offsets; + + /** + * Stride of each plane. + */ + int32_t[3] strides; + + /** + * Width of the video frame, in pixels. + */ + int32_t width; + + /** + * Height of the video frame, in pixels. + */ + int32_t height; + + /** + * Information needed by the client to track the decrypted frame. + */ + PP_DecryptTrackingInfo tracking_info; +}; + +/** + * PP_DecryptedSampleInfo contains the result of the + * decrypt and decode operation on the associated samples, information required + * to access the sample data in buffer, and tracking info. + */ +[assert_size(32)] +struct PP_DecryptedSampleInfo { + /** + * Result of the decrypt and decode operation. + */ + PP_DecryptResult result; + + /** + * Format of the decrypted samples. + */ + PP_DecryptedSampleFormat format; + + /** + * Size in bytes of decrypted samples. + */ + uint32_t data_size; + + /** + * 4-byte padding to make the size of PP_DecryptedSampleInfo + * a multiple of 8 bytes. The value of this field should not be used. + */ + uint32_t padding; + + /** + * Information needed by the client to track the decrypted samples. + */ + PP_DecryptTrackingInfo tracking_info; +}; + +/** + * PP_AudioCodec contains audio codec type constants. + */ +[assert_size(4)] +enum PP_AudioCodec { + PP_AUDIOCODEC_UNKNOWN = 0, + PP_AUDIOCODEC_VORBIS = 1, + PP_AUDIOCODEC_AAC = 2 +}; + +/** + * PP_AudioDecoderConfig contains audio decoder configuration + * information required to initialize audio decoders, and a request ID + * that allows clients to associate a decoder initialization request with a + * status response. Note: When codec requires extra data for + * initialization, the data is sent as a PP_Resource carried + * alongside PP_AudioDecoderConfig. + */ + [assert_size(20)] +struct PP_AudioDecoderConfig { + /** + * The audio codec to initialize. + */ + PP_AudioCodec codec; + + /** + * Number of audio channels. + */ + int32_t channel_count; + + /** + * Size of each audio channel. + */ + int32_t bits_per_channel; + + /** + * Audio sampling rate. + */ + int32_t samples_per_second; + + /** + * Client-specified identifier for the associated audio decoder initialization + * request. By using this value, the client can associate a decoder + * initialization status response with an initialization request. + */ + uint32_t request_id; +}; + +/** + * PP_VideoCodec contains video codec type constants. + */ +[assert_size(4)] +enum PP_VideoCodec { + PP_VIDEOCODEC_UNKNOWN = 0, + PP_VIDEOCODEC_VP8 = 1, + PP_VIDEOCODEC_H264 = 2, + PP_VIDEOCODEC_VP9 = 3 +}; + +/** + * PP_VideoCodecProfile contains video codec profile type + * constants required for video decoder configuration. + *. + */ +[assert_size(4)] +enum PP_VideoCodecProfile { + PP_VIDEOCODECPROFILE_UNKNOWN = 0, + PP_VIDEOCODECPROFILE_NOT_NEEDED = 1, + PP_VIDEOCODECPROFILE_H264_BASELINE = 2, + PP_VIDEOCODECPROFILE_H264_MAIN = 3, + PP_VIDEOCODECPROFILE_H264_EXTENDED = 4, + PP_VIDEOCODECPROFILE_H264_HIGH = 5, + PP_VIDEOCODECPROFILE_H264_HIGH_10 = 6, + PP_VIDEOCODECPROFILE_H264_HIGH_422 = 7, + PP_VIDEOCODECPROFILE_H264_HIGH_444_PREDICTIVE = 8 +}; + +/** + * PP_VideoDecoderConfig contains video decoder configuration + * information required to initialize video decoders, and a request ID + * that allows clients to associate a decoder initialization request with a + * status response. Note: When codec requires extra data for + * initialization, the data is sent as a PP_Resource carried + * alongside PP_VideoDecoderConfig. + */ +[assert_size(24)] +struct PP_VideoDecoderConfig { + /** + * The video codec to initialize. + */ + PP_VideoCodec codec; + + /** + * Profile to use when initializing the video codec. + */ + PP_VideoCodecProfile profile; + + /** + * Output video format. + */ + PP_DecryptedFrameFormat format; + + /** + * Width of decoded video frames, in pixels. + */ + int32_t width; + + /** + * Height of decoded video frames, in pixels. + */ + int32_t height; + + /** + * Client-specified identifier for the associated video decoder initialization + * request. By using this value, the client can associate a decoder + * initialization status response with an initialization request. + */ + uint32_t request_id; +}; + +/** + * PP_DecryptorStreamType contains stream type constants. + */ +[assert_size(4)] +enum PP_DecryptorStreamType { + PP_DECRYPTORSTREAMTYPE_AUDIO = 0, + PP_DECRYPTORSTREAMTYPE_VIDEO = 1 +}; + +/** + * PP_SessionType contains session type constants. + */ +[assert_size(4)] +enum PP_SessionType { + PP_SESSIONTYPE_TEMPORARY = 0, + PP_SESSIONTYPE_PERSISTENT_LICENSE = 1, + PP_SESSIONTYPE_PERSISTENT_RELEASE = 2 +}; + +/** + * PP_InitDataType contains Initialization Data Type constants. + */ +[assert_size(4)] +enum PP_InitDataType { + PP_INITDATATYPE_CENC = 0, + PP_INITDATATYPE_KEYIDS = 1, + PP_INITDATATYPE_WEBM = 2 +}; + +/** + * PP_CdmExceptionCode contains exception code constants. + */ +[assert_size(4)] +enum PP_CdmExceptionCode { + PP_CDMEXCEPTIONCODE_NOTSUPPORTEDERROR = 1, + PP_CDMEXCEPTIONCODE_INVALIDSTATEERROR = 2, + PP_CDMEXCEPTIONCODE_INVALIDACCESSERROR = 3, + PP_CDMEXCEPTIONCODE_QUOTAEXCEEDEDERROR = 4, + PP_CDMEXCEPTIONCODE_UNKNOWNERROR = 5, + PP_CDMEXCEPTIONCODE_CLIENTERROR = 6, + PP_CDMEXCEPTIONCODE_OUTPUTERROR = 7 +}; + +/** + * PP_CdmMessageType contains message type constants. + */ +[assert_size(4)] +enum PP_CdmMessageType { + PP_CDMMESSAGETYPE_LICENSE_REQUEST = 0, + PP_CDMMESSAGETYPE_LICENSE_RENEWAL = 1, + PP_CDMMESSAGETYPE_LICENSE_RELEASE = 2 +}; + +/** + * PP_CdmKeyStatus contains key status constants. + */ +[assert_size(4)] +enum PP_CdmKeyStatus { + PP_CDMKEYSTATUS_USABLE = 0, + PP_CDMKEYSTATUS_INVALID = 1, + PP_CDMKEYSTATUS_EXPIRED = 2, + PP_CDMKEYSTATUS_OUTPUTRESTRICTED = 3, + PP_CDMKEYSTATUS_OUTPUTDOWNSCALED = 4, + PP_CDMKEYSTATUS_STATUSPENDING = 5, + PP_CDMKEYSTATUS_RELEASED = 6 +}; + +/** + * The PP_KeyInformation struct contains information about a + * key used for decryption. + */ +[assert_size(524)] +struct PP_KeyInformation { + /** + * Key ID. + */ + uint8_t[512] key_id; + uint32_t key_id_size; + + /** + * Status of this key. + */ + PP_CdmKeyStatus key_status; + + /** + * Optional error code for keys that are not usable. + */ + uint32_t system_code; +}; diff --git a/browser/extensions/mortar/ppapi/api/private/pp_file_handle.idl b/browser/extensions/mortar/ppapi/api/private/pp_file_handle.idl new file mode 100644 index 000000000000..07bb74b7e826 --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/private/pp_file_handle.idl @@ -0,0 +1,22 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * This file provides support for native OS file handles. + */ + +#inline c + +#ifdef _WIN32 +#include +typedef HANDLE PP_FileHandle; +static const PP_FileHandle PP_kInvalidFileHandle = NULL; + +#else +typedef int PP_FileHandle; +static const PP_FileHandle PP_kInvalidFileHandle = -1; +#endif + +#endinl diff --git a/browser/extensions/mortar/ppapi/api/private/pp_private_font_charset.idl b/browser/extensions/mortar/ppapi/api/private/pp_private_font_charset.idl new file mode 100644 index 000000000000..36e605a021b7 --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/private/pp_private_font_charset.idl @@ -0,0 +1,27 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +[assert_size(4)] +enum PP_PrivateFontCharset { + PP_PRIVATEFONTCHARSET_ANSI = 0, + PP_PRIVATEFONTCHARSET_DEFAULT = 1, + PP_PRIVATEFONTCHARSET_SYMBOL = 2, + PP_PRIVATEFONTCHARSET_MAC = 77, + PP_PRIVATEFONTCHARSET_SHIFTJIS = 128, + PP_PRIVATEFONTCHARSET_HANGUL = 129, + PP_PRIVATEFONTCHARSET_JOHAB = 130, + PP_PRIVATEFONTCHARSET_GB2312 =134, + PP_PRIVATEFONTCHARSET_CHINESEBIG5 = 136, + PP_PRIVATEFONTCHARSET_GREEK = 161, + PP_PRIVATEFONTCHARSET_TURKISH = 162, + PP_PRIVATEFONTCHARSET_VIETNAMESE = 163, + PP_PRIVATEFONTCHARSET_HEBREW = 177, + PP_PRIVATEFONTCHARSET_ARABIC = 178, + PP_PRIVATEFONTCHARSET_BALTIC = 186, + PP_PRIVATEFONTCHARSET_RUSSIAN = 204, + PP_PRIVATEFONTCHARSET_THAI = 222, + PP_PRIVATEFONTCHARSET_EASTEUROPE = 238, + PP_PRIVATEFONTCHARSET_OEM = 255 +}; diff --git a/browser/extensions/mortar/ppapi/api/private/pp_video_capture_format.idl b/browser/extensions/mortar/ppapi/api/private/pp_video_capture_format.idl new file mode 100644 index 000000000000..e9345665ada1 --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/private/pp_video_capture_format.idl @@ -0,0 +1,29 @@ +/* Copyright 2015 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * This file defines the struct used to hold a video capture format. + */ + +label Chrome { + M42 = 0.1 +}; + +/** + * The PP_VideoCaptureFormat struct represents a video capture + * format. + */ +[assert_size(12)] +struct PP_VideoCaptureFormat { + /** + * Frame size in pixels. + */ + PP_Size frame_size; + + /** + * Frame rate in frames per second. + */ + float_t frame_rate; +}; diff --git a/browser/extensions/mortar/ppapi/api/private/pp_video_frame_private.idl b/browser/extensions/mortar/ppapi/api/private/pp_video_frame_private.idl new file mode 100644 index 000000000000..593f363a59fe --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/private/pp_video_frame_private.idl @@ -0,0 +1,36 @@ +/* Copyright (c) 2013 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * This file defines the struct used to hold a video frame. + */ + +/** + * The PP_VideoFrame_Private struct represents a video frame. + * Video sources and destinations use frames to transfer video to and from + * the browser. + */ +[assert_size(16)] +struct PP_VideoFrame_Private { + /** + * A timestamp placing the frame in a video stream. + */ + PP_TimeTicks timestamp; + + /** + * An image data resource to hold the video frame. + */ + PP_Resource image_data; + + /** + * Ensure that this struct is 16-bytes wide by padding the end. In some + * compilers, PP_TimeTicks is 8-byte aligned, so those compilers align this + * struct on 8-byte boundaries as well and pad it to 8 bytes even without this + * padding attribute. This padding makes its size consistent across + * compilers. + */ + int32_t padding; +}; + diff --git a/browser/extensions/mortar/ppapi/api/private/ppb_camera_capabilities_private.idl b/browser/extensions/mortar/ppapi/api/private/ppb_camera_capabilities_private.idl new file mode 100644 index 000000000000..fb480bfd5e81 --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/private/ppb_camera_capabilities_private.idl @@ -0,0 +1,55 @@ +/* Copyright 2014 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * This file defines the PPB_CameraCapabilities_Private interface for + * establishing an image capture configuration resource within the browser. + */ + +[generate_thunk] + +label Chrome { + M42 = 0.1 +}; + +/** + * The PPB_CameraCapabilities_Private interface contains pointers + * to several functions for getting the image capture capabilities within the + * browser. + */ +[version=0.1] +interface PPB_CameraCapabilities_Private { + /** + * IsCameraCapabilities() determines if the given resource is a + * PPB_CameraCapabilities_Private. + * + * @param[in] resource A PP_Resource corresponding to an image + * capture capabilities resource. + * + * @return A PP_Bool containing PP_TRUE if the given + * resource is an PP_CameraCapabilities_Private resource, + * otherwise PP_FALSE. + */ + PP_Bool IsCameraCapabilities( + [in] PP_Resource resource); + + /** + * GetSupportedVideoCaptureFormats() returns the supported video capture + * formats for the given PPB_CameraCapabilities_Private. + * + * @param[in] capabilities A PP_Resource corresponding to an + * image capture capabilities resource. + * @param[out] array_size The size of preview size array. + * @param[out] formats An array of PP_VideoCaptureFormat + * corresponding to the supported video capture formats. The ownership of the + * array belongs to PPB_CameraCapabilities_Private and the caller + * should not free it. When a PPB_CameraCapabilities_Private is deleted, the + * array returning from this is no longer valid. + */ + void GetSupportedVideoCaptureFormats( + [in] PP_Resource capabilities, + [out] uint32_t array_size, + [out, size_is(array_size)] PP_VideoCaptureFormat[] formats); +}; diff --git a/browser/extensions/mortar/ppapi/api/private/ppb_camera_device_private.idl b/browser/extensions/mortar/ppapi/api/private/ppb_camera_device_private.idl new file mode 100644 index 000000000000..d87ac2059a8e --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/private/ppb_camera_device_private.idl @@ -0,0 +1,96 @@ +/* Copyright 2014 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * Defines the PPB_CameraDevice_Private interface. Used for + * manipulating a camera device. + */ + +[generate_thunk] + +label Chrome { + M42 = 0.1 +}; + +/** + * To query camera capabilities: + * 1. Get a PPB_CameraDevice_Private object by Create(). + * 2. Open() camera device with track id of MediaStream video track. + * 3. Call GetCameraCapabilities() to get a + * PPB_CameraCapabilities_Private object, which can be used to + * query camera capabilities. + */ +interface PPB_CameraDevice_Private { + /** + * Creates a PPB_CameraDevice_Private resource. + * + * @param[in] instance A PP_Instance identifying one instance + * of a module. + * + * @return A PP_Resource corresponding to a + * PPB_CameraDevice_Private resource if successful, 0 if failed. + */ + PP_Resource Create([in] PP_Instance instance); + + /** + * Determines if a resource is a camera device resource. + * + * @param[in] resource The PP_Resource to test. + * + * @return A PP_Bool with PP_TRUE if the given + * resource is a camera device resource or PP_FALSE + * otherwise. + */ + PP_Bool IsCameraDevice([in] PP_Resource resource); + + /** + * Opens a camera device. + * + * @param[in] camera_device A PP_Resource corresponding to a + * camera device resource. + * @param[in] device_id A PP_Var identifying a camera device. The + * type is string. The ID can be obtained from MediaStreamTrack.getSources() + * or MediaStreamVideoTrack.id. + * @param[in] callback A PP_CompletionCallback to be called upon + * completion of Open(). + * + * @return An error code from pp_errors.h. + */ + int32_t Open( + [in] PP_Resource camera_device, + [in] PP_Var device_id, + [in] PP_CompletionCallback callback); + + /** + * Disconnects from the camera and cancels all pending requests. + * After this returns, no callbacks will be called. If + * PPB_CameraDevice_Private is destroyed and is not closed yet, this + * function will be automatically called. Calling this more than once has no + * effect. + * + * @param[in] camera_device A PP_Resource corresponding to a + * camera device resource. + */ + void Close([in] PP_Resource camera_device); + + /** + * Gets the camera capabilities. + * + * The camera capabilities do not change for a given camera source. + * + * @param[in] camera_device A PP_Resource corresponding to a + * camera device resource. + * @param[out] capabilities A PPB_CameraCapabilities_Private for + * storing the camera capabilities on success. Otherwise, the value will not + * be changed. + * @param[in] callback PP_CompletionCallback to be called upon + * completion of GetCameraCapabilities(). + * + * @return An int32_t containing a result code from pp_errors.h. + */ + int32_t GetCameraCapabilities([in] PP_Resource camera_device, + [out] PP_Resource capabilities, + [in] PP_CompletionCallback callback); +}; diff --git a/browser/extensions/mortar/ppapi/api/private/ppb_content_decryptor_private.idl b/browser/extensions/mortar/ppapi/api/private/ppb_content_decryptor_private.idl new file mode 100644 index 000000000000..602bf125e4c5 --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/private/ppb_content_decryptor_private.idl @@ -0,0 +1,315 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * This file defines the PPB_ContentDecryptor_Private + * interface. Note: This is a special interface, only to be used for Content + * Decryption Modules, not normal plugins. + */ + +[generate_thunk] + +label Chrome { + M44 = 0.14 +}; + +/** + * PPB_ContentDecryptor_Private structure contains the function + * pointers the browser must implement to support plugins implementing the + * PPP_ContentDecryptor_Private interface. This interface provides + * browser side support for the Content Decryption Module (CDM) for Encrypted + * Media Extensions: http://www.w3.org/TR/encrypted-media/ + */ +interface PPB_ContentDecryptor_Private { + /** + * A promise has been resolved by the CDM. + * + * @param[in] promise_id Identifies the promise that the CDM resolved. + */ + void PromiseResolved( + [in] PP_Instance instance, + [in] uint32_t promise_id); + + /** + * A promise that resulted in a new session has been resolved by the CDM. + * + * @param[in] promise_id Identifies the promise that the CDM resolved. + * + * @param[in] session_id A PP_Var of type + * PP_VARTYPE_STRING containing the session's ID attribute. + */ + void PromiseResolvedWithSession( + [in] PP_Instance instance, + [in] uint32_t promise_id, + [in] PP_Var session_id); + + + /** + * A promise has been rejected by the CDM due to an error. + * + * @param[in] promise_id Identifies the promise that the CDM rejected. + * + * @param[in] exception_code A PP_CdmExceptionCode containing + * the exception code. + * + * @param[in] system_code A system error code. + * + * @param[in] error_description A PP_Var of type + * PP_VARTYPE_STRING containing the error description. + */ + void PromiseRejected( + [in] PP_Instance instance, + [in] uint32_t promise_id, + [in] PP_CdmExceptionCode exception_code, + [in] uint32_t system_code, + [in] PP_Var error_description); + + /** + * A message or request has been generated for key_system in the CDM, and + * must be sent to the web application. + * + * For example, when the browser invokes CreateSession() + * on the PPP_ContentDecryptor_Private interface, the plugin + * must send a message containing the license request. + * + * Note that SessionMessage() can be used for purposes other than + * responses to CreateSession() calls. See also the text + * in the comment for SessionReady(), which describes a sequence + * of UpdateSession() and SessionMessage() calls + * required to prepare for decryption. + * + * @param[in] session_id A PP_Var of type + * PP_VARTYPE_STRING containing the ID of a session for + * which this message is intended. + * + * @param[in] message_type A PP_CdmMessageType containing the + * message type. + * + * @param[in] message A PP_Var of type + * PP_VARTYPE_ARRAY_BUFFER that contains the message. + * + * @param[in] legacy_destination_url A PP_Var of type + * PP_VARTYPE_STRING containing the destination URL for the + * message. + */ + void SessionMessage( + [in] PP_Instance instance, + [in] PP_Var session_id, + [in] PP_CdmMessageType message_type, + [in] PP_Var message, + [in] PP_Var legacy_destination_url); + + /** + * The keys for a session have changed. + * + * @param[in] session_id A PP_Var of type + * PP_VARTYPE_STRING containing the ID of the session that has + * a change in keys. + * + * @param[in] has_additional_usable_key A PP_Bool indicating if + * a new usable key has been added. + * + * @param[in] key_count The number of arguments contained in + * key_information + * + * @param[in] key_information An array of type PP_KeyInformation + * that are the session's key IDs and their status. + */ + void SessionKeysChange( + [in] PP_Instance instance, + [in] PP_Var session_id, + [in] PP_Bool has_additional_usable_key, + [in] uint32_t key_count, + [in, size_as=key_count] PP_KeyInformation[] key_information); + + /** + * The expiration time for a session has changed. + * + * @param[in] session_id A PP_Var of type + * PP_VARTYPE_STRING containing the ID of the session that has + * a new expiration time. + * + * @param[in] new_expiry_time A PP_Time indicating the new + * expiry time of the session. The value is defined as the number of seconds + * since the Epoch (00:00:00 UTC, January 1, 1970). + */ + void SessionExpirationChange( + [in] PP_Instance instance, + [in] PP_Var session_id, + [in] PP_Time new_expiry_time); + + /** + * The session has been closed as the result of a call to the + * ReleaseSession() method on the + * PPP_ContentDecryptor_Private interface, or due to other + * factors as determined by the CDM. + * + * @param[in] session_id A PP_Var of type + * PP_VARTYPE_STRING containing the session's ID attribute of + * the session that is now closed. + */ + void SessionClosed( + [in] PP_Instance instance, + [in] PP_Var session_id); + + /** + * An error occurred in a PPP_ContentDecryptor_Private method, + * or within the plugin implementing the interface. + * + * @param[in] session_id A PP_Var of type + * PP_VARTYPE_STRING containing the session's ID attribute of + * the session that caused the error. + * + * @param[in] exception_code A PP_CdmExceptionCode containing + * the exception code. + * + * @param[in] system_code A system error code. + * + * @param[in] error_description A PP_Var of type + * PP_VARTYPE_STRING containing the error description. + */ + void LegacySessionError( + [in] PP_Instance instance, + [in] PP_Var session_id, + [in] PP_CdmExceptionCode exception_code, + [in] uint32_t system_code, + [in] PP_Var error_description); + + /** + * Called after the Decrypt() method on the + * PPP_ContentDecryptor_Private interface completes to + * deliver decrypted_block to the browser for decoding and rendering. + * + * The plugin must not hold a reference to the encrypted buffer resource + * provided to Decrypt() when it calls this method. The browser + * will reuse the buffer in a subsequent Decrypt() call. + * + * @param[in] decrypted_block A PP_Resource corresponding to a + * PPB_Buffer_Dev resource that contains a decrypted data + * block. + * + * @param[in] decrypted_block_info A PP_DecryptedBlockInfo that + * contains the result code and tracking info associated with the + * decrypted_block. + */ + void DeliverBlock( + [in] PP_Instance instance, + [in] PP_Resource decrypted_block, + [in] PP_DecryptedBlockInfo decrypted_block_info); + + /** + * Called after the InitializeAudioDecoder() or + * InitializeVideoDecoder() method on the + * PPP_ContentDecryptor_Private interface completes to report + * decoder initialization status to the browser. + * + * @param[in] success A PP_Bool that is set to + * PP_TRUE when the decoder initialization request associated + * with request_id was successful. + * + * @param[in] decoder_type A PP_DecryptorStreamType identifying + * the decoder type for which this initialization status response was sent. + * + * @param[in] request_id The request_id value passed to + * InitializeAudioDecoder or InitializeVideoDecoder + * in PP_AudioDecoderConfig or + * PP_VideoDecoderConfig. + */ + void DecoderInitializeDone( + [in] PP_Instance instance, + [in] PP_DecryptorStreamType decoder_type, + [in] uint32_t request_id, + [in] PP_Bool success); + + /** + * Called after the DeinitializeDecoder() method on the + * PPP_ContentDecryptor_Private interface completes to report + * decoder de-initialization completion to the browser. + * + * @param[in] decoder_type The PP_DecryptorStreamType passed to + * DeinitializeDecoder(). + * + * @param[in] request_id The request_id value passed to + * DeinitializeDecoder(). + */ + void DecoderDeinitializeDone( + [in] PP_Instance instance, + [in] PP_DecryptorStreamType decoder_type, + [in] uint32_t request_id); + + /** + * Called after the ResetDecoder() method on the + * PPP_ContentDecryptor_Private interface completes to report + * decoder reset completion to the browser. + * + * @param[in] decoder_type The PP_DecryptorStreamType passed to + * ResetDecoder(). + * + * @param[in] request_id The request_id value passed to + * ResetDecoder(). + */ + void DecoderResetDone( + [in] PP_Instance instance, + [in] PP_DecryptorStreamType decoder_type, + [in] uint32_t request_id); + + /** + * Called after the DecryptAndDecode() method on the + * PPP_ContentDecryptor_Private interface completes to deliver + * a decrypted and decoded video frame to the browser for rendering. + * + * The plugin must not hold a reference to the encrypted buffer resource + * provided to DecryptAndDecode() when it calls this method. The + * browser will reuse the buffer in a subsequent + * DecryptAndDecode() call. + * + * @param[in] decrypted_frame A PP_Resource corresponding to a + * PPB_Buffer_Dev resource that contains a video frame. + * + * @param[in] decrypted_frame_info A PP_DecryptedFrameInfo that + * contains the result code, tracking info, and buffer format associated with + * decrypted_frame. + */ + void DeliverFrame( + [in] PP_Instance instance, + [in] PP_Resource decrypted_frame, + [in] PP_DecryptedFrameInfo decrypted_frame_info); + + /** + * Called after the DecryptAndDecode() method on the + * PPP_ContentDecryptor_Private interface completes to deliver + * a buffer of decrypted and decoded audio samples to the browser for + * rendering. + * + * The plugin must not hold a reference to the encrypted buffer resource + * provided to DecryptAndDecode() when it calls this method. The + * browser will reuse the buffer in a subsequent + * DecryptAndDecode() call. + * + * audio_frames can contain multiple audio output buffers. Each + * buffer is serialized in this format: + * + * |<------------------- serialized audio buffer ------------------->| + * | int64_t timestamp | int64_t length | length bytes of audio data | + * + * For example, with three audio output buffers, |audio_frames| will look + * like this: + * + * |<---------------- audio_frames ------------------>| + * | audio buffer 0 | audio buffer 1 | audio buffer 2 | + * + * @param[in] audio_frames A PP_Resource corresponding to a + * PPB_Buffer_Dev resource that contains a decrypted buffer + * of decoded audio samples. + * + * @param[in] decrypted_sample_info A PP_DecryptedSampleInfo that + * contains the tracking info and result code associated with the decrypted + * samples. + */ + void DeliverSamples( + [in] PP_Instance instance, + [in] PP_Resource audio_frames, + [in] PP_DecryptedSampleInfo decrypted_sample_info); +}; diff --git a/browser/extensions/mortar/ppapi/api/private/ppb_display_color_profile_private.idl b/browser/extensions/mortar/ppapi/api/private/ppb_display_color_profile_private.idl new file mode 100644 index 000000000000..41e484165917 --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/private/ppb_display_color_profile_private.idl @@ -0,0 +1,97 @@ +/* Copyright 2014 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * This file defines the PPB_DisplayColorProfile struct used for + * getting the color profile of the display. + */ + +[generate_thunk] + +label Chrome { + M33 = 0.1 +}; + +/** + * PPB_DisplayColorProfile_Private defines the methods for getting + * the display color profile and monitoring its changes. + * + * Setup: + * @code + * PP_ArrayOutput output = { MyAllocatorFunction, color_profile_data }; + * PP_Resource display_cp = display_cp_interface->Create(instance); + * display_cp_interface->GetColorProfile(display_cp, + * output, + * completion_callback); + * @endcode + */ +interface PPB_DisplayColorProfile_Private { + /** + * Create() creates a display color profile resource. + * + * @param[in] instance The module instance. + * @return A PP_Resource containing a display color profile + * resource. + */ + PP_Resource Create([in] PP_Instance instance); + + /** + * IsDisplayColorProfile() determines if the given resource is a valid + * DisplayColorProfile resource. + * + * @param[in] resource A DisplayColorProfile context resource. + * @return Returns: + * - PP_TRUE if the given resource is a valid + * DisplayColorProfile + * - PP_FALSE if it is an invalid resource or is a resource + * of another type. + */ + PP_Bool IsDisplayColorProfile([in] PP_Resource resource); + + /** + * GetColorProfile() enqueues a request for the current display color profile. + * + * This method is intended for getting the color profile data of the display + * on which the browser window resides. [However currently Chrome only + * considers the system's primary display color profile when doing its color + * management. For consistency this method will also return the color profile + * that Chrome uses for its browser window.] + * + * @param[in] display_color_profile_res The display color profile resource. + * @param[in] color_profile A PP_OutputArray which on success + * will receive a byte array containing the ICC color profile data (see + * www.color.org for a reference to the ICC color profile specification + * and versions). The returned color profile version is the one supported by + * the host system. + * @param[in] callback The completion callback to be called once the display + * color profile data is available. + * + * @return Returns an error code from pp_errors.h. + */ + int32_t GetColorProfile([in] PP_Resource display_color_profile_res, + [in] PP_ArrayOutput color_profile, + [in] PP_CompletionCallback callback); + + /** + * RegisterColorProfileChangeCallback() registers a callback to be called next + * time the color profile for the browser window in which the plugin resides + * changes. In order to get notifications for all color profile changes a call + * to RegisterColorProfileChangeCallback() function should be done when the + * previous notification was fired. + * + * There might be 2 scenarios in which the color profile for a window changes: + * a) The window is moved from one display to another; + * b) The user changes the display color space from the system settings. + * + * @param[in] display_color_profile_res The display color profile resource. + * @param[in] callback The callback to be invoked next time the display + * color profile changes. + * + * @return Returns an error code from pp_errors.h. + */ + int32_t RegisterColorProfileChangeCallback( + [in] PP_Resource display_color_profile_res, + [in] PP_CompletionCallback callback); +}; diff --git a/browser/extensions/mortar/ppapi/api/private/ppb_ext_crx_file_system_private.idl b/browser/extensions/mortar/ppapi/api/private/ppb_ext_crx_file_system_private.idl new file mode 100644 index 000000000000..5c46de726239 --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/private/ppb_ext_crx_file_system_private.idl @@ -0,0 +1,31 @@ +/* Copyright (c) 2013 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * This file contains the PPB_Ext_CrxFileSystem_Private interface. + */ +label Chrome { + M28 = 0.1 +}; + +/* PPB_Ext_CrxFileSystem_Private interface */ +interface PPB_Ext_CrxFileSystem_Private { + /** + * Open() opens the CRX file system for the current extension. It will fail + * when called from non-extension context. + * + * @param[in] crxfs A PP_Resource corresponding to a + * CrxFileSystem. + * @param[out] file_system An output PP_Resource corresponding + * to a PPB_FileSystem. + * @param[in] callback A PP_CompletionCallback to be called upon + * completion of Open. + * + * @return An int32_t containing an error code from pp_errors.h. + */ + int32_t Open([in] PP_Instance instance, + [out] PP_Resource file_system, + [in] PP_CompletionCallback callback); +}; diff --git a/browser/extensions/mortar/ppapi/api/private/ppb_file_io_private.idl b/browser/extensions/mortar/ppapi/api/private/ppb_file_io_private.idl new file mode 100644 index 000000000000..38b23393fd9f --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/private/ppb_file_io_private.idl @@ -0,0 +1,26 @@ +/* Copyright (c) 2013 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#inline c +#include "ppapi/c/private/pp_file_handle.h" +#endinl + +/* This file contains the PPB_FileIO_Private interface. */ +label Chrome { + M28 = 0.1 +}; + +/* PPB_FileIO_Private interface */ +interface PPB_FileIO_Private { + /** + * Returns a file handle corresponding to the given FileIO + * object. The FileIO object must have been opened with a + * successful call to FileIO::Open. The caller gets the ownership + * of the returned file handle and must close it. + */ + int32_t RequestOSFileHandle([in] PP_Resource file_io, + [out] PP_FileHandle handle, + [in] PP_CompletionCallback callback); +}; diff --git a/browser/extensions/mortar/ppapi/api/private/ppb_file_ref_private.idl b/browser/extensions/mortar/ppapi/api/private/ppb_file_ref_private.idl new file mode 100644 index 000000000000..e19e8ec71efe --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/private/ppb_file_ref_private.idl @@ -0,0 +1,24 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* This file contains the PPB_FileRefPrivate interface. */ +label Chrome { + M15 = 0.1 +}; + +/* PPB_FileRefPrivate interface */ +interface PPB_FileRefPrivate { + /** + * GetAbsolutePath() returns the absolute path of the file. + * + * @param[in] file_ref A PP_Resource corresponding to a file + * reference. + * + * @return A PP_Var containing the absolute path of the file. + */ + PP_Var GetAbsolutePath([in] PP_Resource file_ref); +}; + + diff --git a/browser/extensions/mortar/ppapi/api/private/ppb_find_private.idl b/browser/extensions/mortar/ppapi/api/private/ppb_find_private.idl new file mode 100644 index 000000000000..e6f7cfa72835 --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/private/ppb_find_private.idl @@ -0,0 +1,66 @@ +/* Copyright 2014 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * This file defines the PPB_Find_Private interface. + */ + +[generate_thunk] + +label Chrome { + M14 = 0.3 +}; + +/** + * This is a private interface for doing browser Find in the PDF plugin. + */ +interface PPB_Find_Private { + /** + * Sets the instance of this plugin as the mechanism that will be used to + * handle find requests in the renderer. This will only succeed if the plugin + * is embedded within the content of the top level frame. Note that this will + * result in the renderer handing over all responsibility for doing find to + * the plugin and content from the rest of the page will not be searched. + * + * + * In the case that the plugin is loaded directly as the top level document, + * this function does not need to be called. In that case the plugin is + * assumed to handle find requests. + * + * There can only be one plugin which handles find requests. If a plugin calls + * this while an existing plugin is registered, the existing plugin will be + * de-registered and will no longer receive any requests. + */ + void SetPluginToHandleFindRequests( + [in] PP_Instance instance); + + /** + * Updates the number of find results for the current search term. If + * there are no matches 0 should be passed in. Only when the plugin has + * finished searching should it pass in the final count with final_result set + * to PP_TRUE. + */ + void NumberOfFindResultsChanged( + [in] PP_Instance instance, + [in] int32_t total, + [in] PP_Bool final_result); + + /** + * Updates the index of the currently selected search item. + */ + void SelectedFindResultChanged( + [in] PP_Instance instance, + [in] int32_t index); + + /** + * Updates the tickmarks on the scrollbar for the find request. |tickmarks| + * contains |count| PP_Rects indicating the tickmark ranges. + */ + void SetTickmarks( + [in] PP_Instance instance, + [in, size_as=count] PP_Rect[] tickmarks, + [in] uint32_t count); +}; + diff --git a/browser/extensions/mortar/ppapi/api/private/ppb_flash.idl b/browser/extensions/mortar/ppapi/api/private/ppb_flash.idl new file mode 100644 index 000000000000..f16cbc9c2d12 --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/private/ppb_flash.idl @@ -0,0 +1,274 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * This file contains the PPB_Flash interface. + */ + +label Chrome { + M21 = 12.4, + M22 = 12.5, + M24_0 = 12.6, + M24_1 = 13.0 +}; + +[assert_size(4)] +enum PP_FlashLSORestrictions { + /** + * No restrictions on Flash LSOs. + */ + PP_FLASHLSORESTRICTIONS_NONE = 1, + + /** + * Don't allow access to Flash LSOs. + */ + PP_FLASHLSORESTRICTIONS_BLOCK = 2, + + /** + * Store Flash LSOs in memory only. + */ + PP_FLASHLSORESTRICTIONS_IN_MEMORY = 3 +}; + +[assert_size(4)] +enum PP_FlashSetting { + /** + * Specifies if the system likely supports 3D hardware acceleration. + * + * The result is a boolean PP_Var, depending on the supported nature of 3D + * acceleration. If querying this function returns true, the 3D system will + * normally use the native hardware for rendering which will be much faster. + * + * Having this set to true only means that 3D should be used to draw 2D and + * video elements. PP_FLASHSETTING_STAGE3D_ENABLED should be checked to + * determine if it's ok to use 3D for arbitrary content. + * + * In rare cases (depending on the platform) this value will be true but a + * created 3D context will use emulation because context initialization + * failed. + */ + PP_FLASHSETTING_3DENABLED = 1, + + /** + * Specifies if the given instance is in private/incognito/off-the-record mode + * (returns true) or "regular" mode (returns false). Returns an undefined + * PP_Var on invalid instance. + */ + PP_FLASHSETTING_INCOGNITO = 2, + + /** + * Specifies if arbitrary 3d commands are supported (returns true), or if 3d + * should only be used for drawing 2d and video (returns false). + * + * This should only be enabled if PP_FLASHSETTING_3DENABLED is true. + */ + PP_FLASHSETTING_STAGE3DENABLED = 3, + + /** + * Specifies the string for the language code of the UI of the browser. + * + * For example: "en-US" or "de". + * + * Returns an undefined PP_Var on invalid instance. + */ + PP_FLASHSETTING_LANGUAGE = 4, + + /** + * Specifies the number of CPU cores that are present on the system. + */ + PP_FLASHSETTING_NUMCORES = 5, + + /** + * Specifies restrictions on how flash should handle LSOs. The result is an + * int from PP_FlashLSORestrictions. + */ + PP_FLASHSETTING_LSORESTRICTIONS = 6, + + /** + * Specifies if the driver is reliable enough to use Shader Model 3 commands + * with it. + * + * This should only be enabled if PP_FLASHSETTING_STAGE3DENABLED is true. + */ + PP_FLASHSETTING_STAGE3DBASELINEENABLED = 7 +}; + +/** + * This enum provides keys for setting breakpad crash report data. + */ +[assert_size(4)] +enum PP_FlashCrashKey { + /** + * Specifies the document URL which contains the flash instance. + */ + PP_FLASHCRASHKEY_URL = 1, + + /** + * Specifies the URL of the current swf. + */ + PP_FLASHCRASHKEY_RESOURCE_URL = 2 +}; + +/** + * The PPB_Flash interface contains pointers to various functions + * that are only needed to support Pepper Flash. + */ +interface PPB_Flash { + /** + * Sets or clears the rendering hint that the given plugin instance is always + * on top of page content. Somewhat more optimized painting can be used in + * this case. + */ + void SetInstanceAlwaysOnTop( + [in] PP_Instance instance, + [in] PP_Bool on_top); + + /** + * Draws the given pre-laid-out text. It is almost equivalent to Windows' + * ExtTextOut with the addition of the transformation (a 3x3 matrix given the + * transform to apply before drawing). It also adds the allow_subpixel_aa + * flag which when true, will use subpixel antialiasing if enabled in the + * system settings. For this to work properly, the graphics layer that the + * text is being drawn into must be opaque. + */ + PP_Bool DrawGlyphs( + [in] PP_Instance instance, + [in] PP_Resource pp_image_data, + [in] PP_BrowserFont_Trusted_Description font_desc, + [in] uint32_t color, + [in] PP_Point position, + [in] PP_Rect clip, + [in] float_t[3][3] transformation, + [in] PP_Bool allow_subpixel_aa, + [in] uint32_t glyph_count, + [in, size_is(glyph_count)] uint16_t[] glyph_indices, + [in, size_is(glyph_count)] PP_Point[] glyph_advances); + + /** + * Retrieves the proxy that will be used for the given URL. The result will + * be a string in PAC format, or an undefined var on error. + */ + PP_Var GetProxyForURL( + [in] PP_Instance instance, + [in] str_t url); + + /** + * Navigate to the URL given by the given URLRequestInfo. (This supports GETs, + * POSTs, and javascript: URLs.) May open a new tab if target is not "_self". + */ + int32_t Navigate( + [in] PP_Resource request_info, + [in] str_t target, + [in] PP_Bool from_user_action); + + /** + * Deprecated. Does nothing. Use PPB_Flash_MessageLoop. + */ + [deprecate=13.0] + void RunMessageLoop( + [in] PP_Instance instance); + + /** + * Deprecated. Does nothing. Use PPB_Flash_MessageLoop. + */ + [deprecate=13.0] + void QuitMessageLoop( + [in] PP_Instance instance); + + /** + * Retrieves the local time zone offset from GM time for the given UTC time. + */ + double_t GetLocalTimeZoneOffset( + [in] PP_Instance instance, + [in] PP_Time t); + + /** + * Gets a (string) with "command-line" options for Flash; used to pass + * run-time debugging parameters, etc. + */ + PP_Var GetCommandLineArgs( + [in] PP_Module module); + + /** + * Loads the given font in a more privileged process on Windows. Call this if + * Windows is giving errors for font calls. See + * content/renderer/font_cache_dispatcher_win.cc + * + * The parameter is a pointer to a LOGFONTW structure. + * + * On non-Windows platforms, this function does nothing. + */ + void PreloadFontWin( + [in] mem_t logfontw); + + /** + * Returns whether the given rectangle (in the plugin) is topmost, i.e., above + * all other web content. + */ + PP_Bool IsRectTopmost( + [in] PP_Instance instance, + [in] PP_Rect rect); + + /** + * Deprecated. Does nothing. Use PPB_Flash_Print. + */ + [deprecate=13.0] + int32_t InvokePrinting( + [in] PP_Instance instance); + + /** + * Indicates that there's activity and, e.g., the screensaver shouldn't kick + * in. + */ + void UpdateActivity( + [in] PP_Instance instance); + + /** + * Deprecated. Does nothing. + */ + [deprecate=13.0] + PP_Var GetDeviceID([in] PP_Instance instance); + + /** + * Deprecated. Does nothing. See GetSetting(). + */ + [deprecate=13.0] + int32_t GetSettingInt([in] PP_Instance instance, + [in] PP_FlashSetting setting); + + /** + * Returns the value associated with the given setting. Invalid enums will + * result in an undefined PP_Var return value. + */ + PP_Var GetSetting(PP_Instance instance, PP_FlashSetting setting); + + /** + * Allows setting breakpad crash data which will be included in plugin crash + * reports. Returns PP_FALSE if crash data could not be set. + */ + [version=12.5] + PP_Bool SetCrashData([in] PP_Instance instance, + [in] PP_FlashCrashKey key, + [in] PP_Var value); + + /** + * Enumerates video capture devices. |video_capture| is a valid + * PPB_VideoCapture_Dev resource. Once the operation has completed + * successfully, |devices| will be set up with an array of + * PPB_DeviceRef_Dev resources. + * + * PP_OK is returned on success and different pepper error code on failure. + * The ref count of the returned |devices| has already been increased by 1 for + * the caller. + * + * NOTE: This method is a synchronous version of |EnumerateDevices| in + * PPB_VideoCapture_Dev. + */ + [version=12.6] + int32_t EnumerateVideoCaptureDevices( + [in] PP_Instance instance, + [in] PP_Resource video_capture, + [in] PP_ArrayOutput devices); +}; diff --git a/browser/extensions/mortar/ppapi/api/private/ppb_flash_clipboard.idl b/browser/extensions/mortar/ppapi/api/private/ppb_flash_clipboard.idl new file mode 100644 index 000000000000..d2fef48a074b --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/private/ppb_flash_clipboard.idl @@ -0,0 +1,157 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * This file defines the private PPB_Flash_Clipboard API used by + * Pepper Flash for reading and writing to the clipboard. + */ + +label Chrome { + M19 = 4.0, + M24 = 5.0, + M34 = 5.1 +}; + +/** + * This enumeration contains the types of clipboards that can be accessed. + * These types correspond to clipboard types in WebKit. + */ +[assert_size(4)] +enum PP_Flash_Clipboard_Type { + /** The standard clipboard. */ + PP_FLASH_CLIPBOARD_TYPE_STANDARD = 0, + /** The selection clipboard (e.g., on Linux). */ + PP_FLASH_CLIPBOARD_TYPE_SELECTION = 1 +}; + +/** + * This enumeration contains the predefined clipboard data formats. + */ +[assert_size(4)] +enum PP_Flash_Clipboard_Format { + /** Indicates an invalid or unsupported clipboard data format. */ + PP_FLASH_CLIPBOARD_FORMAT_INVALID = 0, + /** + * Indicates plaintext clipboard data. The format expected/returned is a + * PP_VARTYPE_STRING. + */ + PP_FLASH_CLIPBOARD_FORMAT_PLAINTEXT = 1, + /** + * Indicates HTML clipboard data. The format expected/returned is a + * PP_VARTYPE_STRING. + */ + PP_FLASH_CLIPBOARD_FORMAT_HTML = 2, + /** + * Indicates RTF clipboard data. The format expected/returned is a + * PP_VARTYPE_ARRAY_BUFFER. + */ + PP_FLASH_CLIPBOARD_FORMAT_RTF = 3 +}; + +/** + * The PPB_Flash_Clipboard interface contains pointers to functions + * used by Pepper Flash to access the clipboard. + * + */ +interface PPB_Flash_Clipboard { + /** + * Deprecated in 5.0. + */ + [version=4.0, deprecate=5.0] + PP_Bool IsFormatAvailable( + [in] PP_Instance instance_id, + [in] PP_Flash_Clipboard_Type clipboard_type, + [in] PP_Flash_Clipboard_Format format); + + /** + * Deprecated in 5.0. + */ + [version=4.0, deprecate=5.0] + PP_Var ReadData([in] PP_Instance instance_id, + [in] PP_Flash_Clipboard_Type clipboard_type, + [in] PP_Flash_Clipboard_Format format); + + /** + * Deprecated in 5.0. + */ + [version=4.0, deprecate=5.0] + int32_t WriteData([in] PP_Instance instance_id, + [in] PP_Flash_Clipboard_Type clipboard_type, + [in] uint32_t data_item_count, + [in, size_is(data_item_count)] PP_Flash_Clipboard_Format[] formats, + [in, size_is(data_item_count)] PP_Var[] data_items); + + /** + * Registers a custom clipboard format. The format is identified by a + * string. An id identifying the format will be returned if the format is + * successfully registered, which can be used to read/write data of that + * format. If the format has already been registered, the id associated with + * that format will be returned. If the format fails to be registered + * PP_FLASH_CLIPBOARD_FORMAT_INVALID will be returned. + * + * All custom data should be read/written as PP_Var array + * buffers. The clipboard format is pepper-specific meaning that although the + * data will be stored on the system clipboard, it can only be accessed in a + * sensible way by using the pepper API. Data stored in custom formats can + * be safely shared between different applications that use pepper. + */ + [version=5.0] + uint32_t RegisterCustomFormat( + [in] PP_Instance instance_id, + [in] str_t format_name); + + /** + * Checks whether a given data format is available from the given clipboard. + * Returns true if the given format is available from the given clipboard. + */ + [version=5.0] + PP_Bool IsFormatAvailable( + [in] PP_Instance instance_id, + [in] PP_Flash_Clipboard_Type clipboard_type, + [in] uint32_t format); + + /** + * Reads data in the given format from the clipboard. An + * undefined PP_Var is returned if there is an error in reading + * the clipboard data and a null PP_Var is returned if there is + * no data of the specified format to read. + */ + [version=5.0] + PP_Var ReadData([in] PP_Instance instance_id, + [in] PP_Flash_Clipboard_Type clipboard_type, + [in] uint32_t format); + + /** + * Writes the given array of data items to the clipboard. All existing + * clipboard data in any format is erased before writing this data. Thus, + * passing an array of size 0 has the effect of clearing the clipboard without + * writing any data. Each data item in the array should have a different + * PP_Flash_Clipboard_Format. If multiple data items have the + * same format, only the last item with that format will be written. + * If there is an error writing any of the items in the array to the + * clipboard, none will be written and an error code is returned. + * The error code will be PP_ERROR_NOSPACE if the value is + * too large to be written, PP_ERROR_BADARGUMENT if a PP_Var + * cannot be converted into the format supplied or PP_FAILED + * if the format is not supported. + */ + [version=5.0] + int32_t WriteData([in] PP_Instance instance_id, + [in] PP_Flash_Clipboard_Type clipboard_type, + [in] uint32_t data_item_count, + [in, size_is(data_item_count)] uint32_t[] formats, + [in, size_is(data_item_count)] PP_Var[] data_items); + + /** + * Gets a sequence number which uniquely identifies clipboard state. This can + * be used to version the data on the clipboard and determine whether it has + * changed. The sequence number will be placed in |sequence_number| and + * PP_TRUE returned if the sequence number was retrieved successfully. + */ + [version=5.1] + PP_Bool GetSequenceNumber([in] PP_Instance instance_id, + [in] PP_Flash_Clipboard_Type clipboard_type, + [out] uint64_t sequence_number); +}; diff --git a/browser/extensions/mortar/ppapi/api/private/ppb_flash_device_id.idl b/browser/extensions/mortar/ppapi/api/private/ppb_flash_device_id.idl new file mode 100644 index 000000000000..b4ba3ca935c8 --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/private/ppb_flash_device_id.idl @@ -0,0 +1,29 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * This file contains the PPB_Flash_DeviceID interface. + */ + +label Chrome { + M21 = 1.0 +}; + +// TODO(raymes): This is deprecated by the PPB_Flash_DRM interface. Remove this +// interface after a few versions of Chrome have passed. +interface PPB_Flash_DeviceID { + PP_Resource Create([in] PP_Instance instance); + + /** + * Asynchronously computes the device ID. When available, it will place the + * string in |*id| and will call the completion callback. On failure the + * given var will be PP_VARTYPE_UNDEFINED. + */ + [version=1.0] + int32_t GetDeviceID([in] PP_Resource device_id, + [out] PP_Var id, + [in] PP_CompletionCallback callback); +}; + diff --git a/browser/extensions/mortar/ppapi/api/private/ppb_flash_drm.idl b/browser/extensions/mortar/ppapi/api/private/ppb_flash_drm.idl new file mode 100644 index 000000000000..a5da9673d1bb --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/private/ppb_flash_drm.idl @@ -0,0 +1,65 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * This file contains the PPB_Flash_DRM interface. + */ + +[generate_thunk] + +label Chrome { + M29 = 1.0, + M33 = 1.1 +}; + +/** + * A resource for performing Flash DRM-related operations. + */ +interface PPB_Flash_DRM { + /** + * Creates a PPB_Flash_DRM resource for performing DRM-related operations in + * Flash. + */ + PP_Resource Create([in] PP_Instance instance); + + /** + * Asynchronously computes the device ID. When available, it will place the + * string in |*id| and will call the completion callback. On failure the + * given var will be PP_VARTYPE_UNDEFINED. + */ + int32_t GetDeviceID([in] PP_Resource drm, + [out] PP_Var id, + [in] PP_CompletionCallback callback); + + /** + * Windows and Mac only. Synchronously outputs the HMONITOR or + * CGDirectDisplayID corresponding to the monitor on which the plugin instance + * is displayed in |hmonitor|. This value is queried asynchronously and this + * will return PP_FALSE if the value is not yet available or an error + * occurred. PP_TRUE is returned on success. + */ + PP_Bool GetHmonitor([in] PP_Resource drm, + [out] int64_t hmonitor); + + /** + * Asynchronously returns a PPB_FileRef resource in |file_ref| which points to + * the Voucher file for performing DRM verification. |callback| will be called + * upon completion. + */ + int32_t GetVoucherFile([in] PP_Resource drm, + [out] PP_Resource file_ref, + [in] PP_CompletionCallback callback); + + /** + * Asynchronously returns a value indicating whether the monitor on which the + * plugin instance is displayed is external. |callback| will be called upon + * completion. + */ + [version=1.1] + int32_t MonitorIsExternal([in] PP_Resource drm, + [out] PP_Bool is_external, + [in] PP_CompletionCallback callback); +}; + diff --git a/browser/extensions/mortar/ppapi/api/private/ppb_flash_file.idl b/browser/extensions/mortar/ppapi/api/private/ppb_flash_file.idl new file mode 100644 index 000000000000..496962b77cc6 --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/private/ppb_flash_file.idl @@ -0,0 +1,126 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * This file contains the PPB_Flash_File_ModuleLocal and PPB_Flash_File_FileRef interfaces. + */ + +label Chrome { + M24 = 2.0, + M25 = 3.0 +}; + +struct PP_DirEntry_Dev { + str_t name; + PP_Bool is_dir; +}; + +/* Directory. */ +struct PP_DirContents_Dev { + int32_t count; + [size_is(count)] PP_DirEntry_Dev[] entries; +}; + +/* PPB_Flash_File_ModuleLocal */ +[version=3.0] +interface PPB_Flash_File_ModuleLocal { + /* Deprecated. Returns true. */ + PP_Bool CreateThreadAdapterForInstance( + [in] PP_Instance instance); + /* Deprecated. Does nothing. */ + void ClearThreadAdapterForInstance( + [in] PP_Instance instance); + + /* Opens a module-local file, returning a file descriptor (posix) or a HANDLE + * (win32) into file. Module-local file paths (here and below) are + * '/'-separated UTF-8 strings, relative to a module-specific root. The return + * value is the ppapi error, PP_OK if success, one of the PP_ERROR_* in case + * of failure + */ + int32_t OpenFile( + [in] PP_Instance instance, + [in] str_t path, + [in] int32_t mode, + [out] PP_FileHandle file); + + /* Renames a module-local file. The return value is the ppapi error, PP_OK if + * success, one of the PP_ERROR_* in case of failure. + */ + int32_t RenameFile( + [in] PP_Instance instance, + [in] str_t path_from, + [in] str_t path_to); + + /* Deletes a module-local file or directory. If recursive is set and the path + * points to a directory, deletes all the contents of the directory. The + * return value is the ppapi error, PP_OK if success, one of the PP_ERROR_* in + * case of failure. + */ + int32_t DeleteFileOrDir( + [in] PP_Instance instance, + [in] str_t path, + [in] PP_Bool recursive); + + /* Creates a module-local directory. The return value is the ppapi error, + * PP_OK if success, one of the PP_ERROR_* in case of failure. + */ + int32_t CreateDir( + [in] PP_Instance instance, + [in] str_t path); + + /* Queries information about a module-local file. The return value is the + * ppapi error, PP_OK if success, one of the PP_ERROR_* in case of failure. + */ + int32_t QueryFile( + [in] PP_Instance instance, + [in] str_t path, + [out] PP_FileInfo info); + + /* Gets the list of files contained in a module-local directory. The return + * value is the ppapi error, PP_OK if success, one of the PP_ERROR_* in case + * of failure. If non-NULL, the returned contents should be freed with + * FreeDirContents. + */ + int32_t GetDirContents( + [in] PP_Instance instance, + [in] str_t path, + [out] PP_DirContents_Dev contents); + + /* Frees the data allocated by GetDirContents. */ + void FreeDirContents( + [in] PP_Instance instance, + [in] PP_DirContents_Dev contents); + + /* Creates a temporary file. The file will be automatically deleted when all + * handles to it are closed. + * Returns PP_OK if successful, one of the PP_ERROR_* values in case of + * failure. + * If successful, |file| is set to a file descriptor (posix) or a HANDLE + * (win32) to the file. If failed, |file| is not touched. + */ + int32_t CreateTemporaryFile( + [in] PP_Instance instance, + [out] PP_FileHandle file); +}; + +/** + * This interface provides (for Flash) synchronous access to files whose paths + * are given by a Pepper FileRef. Such FileRefs are typically obtained via the + * Pepper file chooser. + */ +[version=2.0] +interface PPB_Flash_File_FileRef { + /* The functions below correspond exactly to their module-local counterparts + * (except in taking FileRefs instead of paths, of course). We omit the + * functionality which we do not provide for FileRefs. + */ + int32_t OpenFile( + [in] PP_Resource file_ref_id, + [in] int32_t mode, + [out] PP_FileHandle file); + int32_t QueryFile( + [in] PP_Resource file_ref_id, + [out] PP_FileInfo info); +}; diff --git a/browser/extensions/mortar/ppapi/api/private/ppb_flash_font_file.idl b/browser/extensions/mortar/ppapi/api/private/ppb_flash_font_file.idl new file mode 100644 index 000000000000..b921d1854ca9 --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/private/ppb_flash_font_file.idl @@ -0,0 +1,50 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * This file contains the PPB_Flash_FontFile interface. + */ + +[generate_thunk] + +label Chrome { + M24 = 0.1, + M48 = 0.2 +}; + +interface PPB_Flash_FontFile { + /* Returns a resource identifying a font file corresponding to the given font + * request after applying the browser-specific fallback. + */ + PP_Resource Create( + [in] PP_Instance instance, + [in] PP_BrowserFont_Trusted_Description description, + [in] PP_PrivateFontCharset charset); + + /* Determines if a given resource is Flash font file. + */ + PP_Bool IsFlashFontFile([in] PP_Resource resource); + + /* Returns the requested font table. + * |output_length| should pass in the size of |output|. And it will return + * the actual length of returned data. |output| could be NULL in order to + * query the size of the buffer size needed. In that case, the input value of + * |output_length| is ignored. + * Note: it is Linux only and fails directly on other platforms. + */ + PP_Bool GetFontTable( + [in] PP_Resource font_file, + [in] uint32_t table, + [out] mem_t output, + [out] uint32_t output_length); + + /** + * Returns whether PPB_Flash_FontFile is supported on Windows. + */ + [version=0.2] + PP_Bool IsSupportedForWindows(); + +}; + diff --git a/browser/extensions/mortar/ppapi/api/private/ppb_flash_fullscreen.idl b/browser/extensions/mortar/ppapi/api/private/ppb_flash_fullscreen.idl new file mode 100644 index 000000000000..11f94e4d402a --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/private/ppb_flash_fullscreen.idl @@ -0,0 +1,56 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + + +/** + * This file defines the PPB_FlashFullscreen interface. + */ + +label Chrome { + M16 = 0.1, + M23 = 1.0 +}; + +interface PPB_FlashFullscreen { + /** + * Checks whether the plugin instance is currently in fullscreen mode. + */ + PP_Bool IsFullscreen( + [in] PP_Instance instance); + + /* + * This older version required that graphics contexts be recreated after the + * transition. + */ + [version=0.1, deprecate=1.0] + PP_Bool SetFullscreen( + [in] PP_Instance instance, + [in] PP_Bool fullscreen); + + /** + * Switches the plugin instance to/from fullscreen mode. Returns PP_TRUE on + * success, PP_FALSE on failure. + * + * This does not unbind the current Graphics2D or Graphics3D. Pending flushes + * and swapbuffers will execute as if the resource was off-screen. The + * transition is asynchronous. During the transition, IsFullscreen will + * return PP_FALSE, and no Graphics2D or Graphics3D can be bound. The + * transition ends at the next DidChangeView when going into fullscreen mode. + * The transition out of fullscreen mode is synchronous. + */ + [version=1.0] + PP_Bool SetFullscreen( + [in] PP_Instance instance, + [in] PP_Bool fullscreen); + + /** + * Gets the size of the screen in pixels. When going fullscreen, the instance + * will be resized to that size. + */ + PP_Bool GetScreenSize( + [in] PP_Instance instance, + [out] PP_Size size); +}; + diff --git a/browser/extensions/mortar/ppapi/api/private/ppb_flash_menu.idl b/browser/extensions/mortar/ppapi/api/private/ppb_flash_menu.idl new file mode 100644 index 000000000000..253d8bd722f1 --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/private/ppb_flash_menu.idl @@ -0,0 +1,54 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * This file defines the PPB_Flash_Menu interface. + */ +label Chrome { + M14 = 0.2 +}; + +/* Menu item type. + * + * TODO(viettrungluu): Radio items not supported yet. Will also probably want + * special menu items tied to clipboard access. + */ +[assert_size(4)] +enum PP_Flash_MenuItem_Type { + PP_FLASH_MENUITEM_TYPE_NORMAL = 0, + PP_FLASH_MENUITEM_TYPE_CHECKBOX = 1, + PP_FLASH_MENUITEM_TYPE_SEPARATOR = 2, + PP_FLASH_MENUITEM_TYPE_SUBMENU = 3 +}; + +struct PP_Flash_MenuItem { + PP_Flash_MenuItem_Type type; + str_t name; + int32_t id; + PP_Bool enabled; + PP_Bool checked; + [ref] PP_Flash_Menu submenu; +}; + +struct PP_Flash_Menu { + uint32_t count; + [size_is(count)] PP_Flash_MenuItem[] items; +}; + +interface PPB_Flash_Menu { + PP_Resource Create([in] PP_Instance instance_id, + [in] PP_Flash_Menu menu_data); + PP_Bool IsFlashMenu(PP_Resource resource_id); + /* Display a context menu at the given location. If the user selects an item, + * |selected_id| will be set to its |id| and the callback called with |PP_OK|. + * If the user dismisses the menu without selecting an item, + * |PP_ERROR_USERCANCEL| will be indicated. + */ + int32_t Show([in] PP_Resource menu_id, + [in] PP_Point location, + [out] int32_t selected_id, + [in] PP_CompletionCallback callback); +}; + diff --git a/browser/extensions/mortar/ppapi/api/private/ppb_flash_message_loop.idl b/browser/extensions/mortar/ppapi/api/private/ppb_flash_message_loop.idl new file mode 100644 index 000000000000..48749072a507 --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/private/ppb_flash_message_loop.idl @@ -0,0 +1,73 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * This file contains the PPB_Flash_MessageLoop interface. + */ + +label Chrome { + M18 = 0.1 +}; + +/** + * The PPB_Flash_MessageLoop interface supports Pepper Flash to run + * nested message loops. + */ +interface PPB_Flash_MessageLoop { + /** + * Allocates a Flash message loop resource. + * + * @param[in] instance A PP_Instance identifying one instance + * of a module. + * + * @return A PP_Resource that can be used to run a nested message + * loop if successful; 0 if failed. + */ + PP_Resource Create([in] PP_Instance instance); + + /** + * Determines if a given resource is a Flash message loop. + * + * @param[in] resource A PP_Resource corresponding to a generic + * resource. + * + * @return A PP_Bool that is PP_TRUE if the given + * resource is a Flash message loop, otherwise PP_FALSE. + */ + PP_Bool IsFlashMessageLoop([in] PP_Resource resource); + + /** + * Runs a nested message loop. The plugin will be reentered from this call. + * This function is used in places where Flash would normally enter a nested + * message loop (e.g., when displaying context menus), but Pepper provides + * only an asynchronous call. After performing that asynchronous call, call + * Run(). In the callback, call Quit(). + * + * For a given message loop resource, only the first call to + * Run() will start a nested message loop. The subsequent calls + * will return PP_ERROR_FAILED immediately. + * + * @param[in] flash_message_loop The Flash message loop. + * + * @return PP_ERROR_ABORTED if the message loop quits because the + * resource is destroyed; PP_OK if the message loop quits because + * of other reasons (e.g., Quit() is called); + * PP_ERROR_FAILED if this is not the first call to + * Run(). + */ + int32_t Run([in] PP_Resource flash_message_loop); + + /** + * Signals to quit the outermost nested message loop. Use this to exit and + * return back to the caller after you call Run(). + * + * If Quit() is not called to balance the call to + * Run(), the outermost nested message loop will be quitted + * implicitly when the resource is destroyed. + * + * @param[in] flash_message_loop The Flash message loop. + */ + void Quit([in] PP_Resource flash_message_loop); +}; \ No newline at end of file diff --git a/browser/extensions/mortar/ppapi/api/private/ppb_flash_print.idl b/browser/extensions/mortar/ppapi/api/private/ppb_flash_print.idl new file mode 100644 index 000000000000..1961b8b8485b --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/private/ppb_flash_print.idl @@ -0,0 +1,23 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * This file contains the PPB_Flash_Print interface. + */ + +label Chrome { + M20 = 1.0 +}; + +/** + * The PPB_Flash_Print interface contains Flash-specific printing + * functionality. + */ +interface PPB_Flash_Print { + /** + * Invokes printing on the given plugin instance. + */ + void InvokePrinting([in] PP_Instance instance); +}; diff --git a/browser/extensions/mortar/ppapi/api/private/ppb_host_resolver_private.idl b/browser/extensions/mortar/ppapi/api/private/ppb_host_resolver_private.idl new file mode 100644 index 000000000000..f7b0e4a5c297 --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/private/ppb_host_resolver_private.idl @@ -0,0 +1,79 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * This file defines the PPB_HostResolver_Private interface. + */ + +label Chrome { + M19 = 0.1 +}; + +/** + * The PP_HostResolver_Flags is an enumeration of the + * different types of flags, that can be OR-ed and passed to host + * resolver. + */ +[assert_size(4)] +enum PP_HostResolver_Private_Flags { + /** + * AI_CANONNAME + */ + PP_HOST_RESOLVER_PRIVATE_FLAGS_CANONNAME = 1 << 0, + /** + * Hint to the resolver that only loopback addresses are configured. + */ + PP_HOST_RESOLVER_PRIVATE_FLAGS_LOOPBACK_ONLY = 1 << 1 +}; + +[assert_size(8)] +struct PP_HostResolver_Private_Hint { + PP_NetAddressFamily_Private family; + int32_t flags; +}; + +interface PPB_HostResolver_Private { + /** + * Allocates a Host Resolver resource. + */ + PP_Resource Create([in] PP_Instance instance); + + /** + * Determines if a given resource is a Host Resolver. + */ + PP_Bool IsHostResolver([in] PP_Resource resource); + + /** + * Creates a new request to Host Resolver. |callback| is invoked + * when request is processed and a list of network addresses is + * obtained. These addresses can be be used in Connect, Bind or + * Listen calls to connect to a given |host| and |port|. + */ + int32_t Resolve([in] PP_Resource host_resolver, + [in] str_t host, + [in] uint16_t port, + [in] PP_HostResolver_Private_Hint hint, + [in] PP_CompletionCallback callback); + + /** + * Returns canonical name of host. + */ + PP_Var GetCanonicalName([in] PP_Resource host_resolver); + + /** + * Returns number of network addresses obtained after Resolve call. + */ + uint32_t GetSize([in] PP_Resource host_resolver); + + /** + * Stores in the |addr| |index|-th network address. |addr| can't be + * NULL. Returns PP_TRUE if success or PP_FALSE if the given + * resource is not a Host Resolver or |index| exceeds number of + * available addresses. + */ + PP_Bool GetNetAddress([in] PP_Resource host_resolver, + [in] uint32_t index, + [out] PP_NetAddress_Private addr); +}; diff --git a/browser/extensions/mortar/ppapi/api/private/ppb_instance_private.idl b/browser/extensions/mortar/ppapi/api/private/ppb_instance_private.idl new file mode 100644 index 000000000000..2ba9df319fbb --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/private/ppb_instance_private.idl @@ -0,0 +1,80 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * This file defines the PPB_Instance_Private interface implemented by the + * browser and containing pointers to functions available only to trusted plugin + * instances. + */ + +[generate_thunk] + +label Chrome { + M13 = 0.1 +}; + +/** + * The PP_ExternalPluginResult enum contains result codes from + * launching an external plugin. + */ +[assert_size(4)] +enum PP_ExternalPluginResult { + /** Successful external plugin call */ + PP_EXTERNAL_PLUGIN_OK = 0, + /** Unspecified external plugin error */ + PP_EXTERNAL_PLUGIN_FAILED = 1, + /** Error creating the module */ + PP_EXTERNAL_PLUGIN_ERROR_MODULE = 2, + /** Error creating and initializing the instance */ + PP_EXTERNAL_PLUGIN_ERROR_INSTANCE = 3 +}; + + +/** + * The PPB_Instance_Private interface contains functions available only to + * trusted plugin instances. + * + */ +interface PPB_Instance_Private { + /** + * GetWindowObject is a pointer to a function that determines + * the DOM window containing this module instance. + * + * @param[in] instance A PP_Instance whose WindowObject should be retrieved. + * @return A PP_Var containing window object on success. + */ + PP_Var GetWindowObject([in] PP_Instance instance); + + /** + * GetOwnerElementObject is a pointer to a function that determines + * the DOM element containing this module instance. + * + * @param[in] instance A PP_Instance whose WindowObject should be retrieved. + * @return A PP_Var containing DOM element on success. + */ + PP_Var GetOwnerElementObject([in] PP_Instance instance); + + /** + * ExecuteScript is a pointer to a function that executes the given + * script in the context of the frame containing the module. + * + * The exception, if any, will be returned in *exception. As with the PPB_Var + * interface, the exception parameter, if non-NULL, must be initialized + * to a "void" var or the function will immediately return. On success, + * the exception parameter will be set to a "void" var. On failure, the + * return value will be a "void" var. + * + * @param[in] script A string containing the JavaScript to execute. + * @param[in/out] exception PP_Var containing the exception. Initialize + * this to NULL if you don't want exception info; initialize this to a void + * exception if want exception info. + * + * @return The result of the script execution, or a "void" var + * if execution failed. + */ + PP_Var ExecuteScript([in] PP_Instance instance, + [in] PP_Var script, + [out] PP_Var exception); +}; diff --git a/browser/extensions/mortar/ppapi/api/private/ppb_isolated_file_system_private.idl b/browser/extensions/mortar/ppapi/api/private/ppb_isolated_file_system_private.idl new file mode 100644 index 000000000000..c42d52012360 --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/private/ppb_isolated_file_system_private.idl @@ -0,0 +1,54 @@ +/* Copyright 2013 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +[generate_thunk,thunk_include="ppapi/thunk/ppb_isolated_file_system_private_api.h"] + +/** + * This file contains the PPB_IsolatedFileSystem_Private interface. + */ +label Chrome { + M33 = 0.2 +}; + + +/** + * The PP_IsolatedFileSystemType_Private values indicate the type + * of isolated file systems. + */ +[assert_size(4)] +enum PP_IsolatedFileSystemType_Private { + /** Type for invalid file systems */ + PP_ISOLATEDFILESYSTEMTYPE_PRIVATE_INVALID = 0, + /** Type for CRX file systems */ + PP_ISOLATEDFILESYSTEMTYPE_PRIVATE_CRX = 1, + /** Type for PluginPrivate file systems */ + PP_ISOLATEDFILESYSTEMTYPE_PRIVATE_PLUGINPRIVATE = 2 +}; + +/* PPB_IsolatedFileSystem_Private interface */ +interface PPB_IsolatedFileSystem_Private { + /** + * Open() opens a file system corresponding the given file system type. + * + * When opening the CRX file system, this should be called from an extension + * context, otherwise it will fail. + * + * @param[in] instance A PP_Instance identifying the instance + * with the file system. + * @param[in] type A file system type as defined by + * PP_IsolatedFileSystemType_Private enum. + * @param[out] file_system An output PP_Resource corresponding + * to a PPB_FileSystem. + * @param[in] callback A PP_CompletionCallback to be called upon + * completion of Open. + * + * @return An int32_t containing an error code from pp_errors.h. + */ + [singleton,api=PPB_IsolatedFileSystem_Private_API] + int32_t Open([in] PP_Instance instance, + [in] PP_IsolatedFileSystemType_Private type, + [out] PP_Resource file_system, + [in] PP_CompletionCallback callback); +}; diff --git a/browser/extensions/mortar/ppapi/api/private/ppb_net_address_private.idl b/browser/extensions/mortar/ppapi/api/private/ppb_net_address_private.idl new file mode 100644 index 000000000000..cc8045ddbd99 --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/private/ppb_net_address_private.idl @@ -0,0 +1,129 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * This file defines the PPB_NetAddress_Private interface. + */ + +label Chrome { + M13 = 0.0, + M17 = 0.1, + M19_0 = 1.0, + M19_1 = 1.1 +}; + +[assert_size(4)] +enum PP_NetAddressFamily_Private { + /** + * The address family is unspecified. + */ + PP_NETADDRESSFAMILY_PRIVATE_UNSPECIFIED = 0, + /** + * The Internet Protocol version 4 (IPv4) address family. + */ + PP_NETADDRESSFAMILY_PRIVATE_IPV4 = 1, + /** + * The Internet Protocol version 6 (IPv6) address family. + */ + PP_NETADDRESSFAMILY_PRIVATE_IPV6 = 2 +}; + +/** + * This is an opaque type holding a network address. Plugins must + * never access members of this struct directly. + */ +[assert_size(132)] +struct PP_NetAddress_Private { + uint32_t size; + int8_t[128] data; +}; + +/** + * The PPB_NetAddress_Private interface provides operations on + * network addresses. + */ +[version=0.1] interface PPB_NetAddress_Private { + /** + * Returns PP_TRUE if the two addresses are equal (host and port). + */ + PP_Bool AreEqual([in] PP_NetAddress_Private addr1, + [in] PP_NetAddress_Private addr2); + + /** + * Returns PP_TRUE if the two addresses refer to the same host. + */ + PP_Bool AreHostsEqual([in] PP_NetAddress_Private addr1, + [in] PP_NetAddress_Private addr2); + + /** + * Returns a human-readable description of the network address, optionally + * including the port (e.g., "192.168.0.1", "192.168.0.1:99", or "[::1]:80"), + * or an undefined var on failure. + */ + PP_Var Describe([in] PP_Module module, + [in] PP_NetAddress_Private addr, + [in] PP_Bool include_port); + + /** + * Replaces the port in the given source address. Returns PP_TRUE on success. + */ + PP_Bool ReplacePort([in] PP_NetAddress_Private src_addr, + [in] uint16_t port, + [out] PP_NetAddress_Private addr_out); + + /** + * Gets the "any" address (for IPv4 or IPv6); for use with UDP Bind. + */ + void GetAnyAddress([in] PP_Bool is_ipv6, + [out] PP_NetAddress_Private addr); + + /** + * Gets the address family. + */ + [version=1.0] + PP_NetAddressFamily_Private GetFamily([in] PP_NetAddress_Private addr); + + /** + * Gets the port. The port is returned in host byte order. + */ + [version=1.0] + uint16_t GetPort([in] PP_NetAddress_Private addr); + + /** + * Gets the address. The output, address, must be large enough for the + * current socket family. The output will be the binary representation of an + * address for the current socket family. For IPv4 and IPv6 the address is in + * network byte order. PP_TRUE is returned if the address was successfully + * retrieved. + */ + [version=1.0] + PP_Bool GetAddress([in] PP_NetAddress_Private addr, + [out] mem_t address, + [in] uint16_t address_size); + + /** + * Returns ScopeID for IPv6 addresses or 0 for IPv4. + */ + [version=1.1] + uint32_t GetScopeID([in] PP_NetAddress_Private addr); + + /** + * Creates NetAddress with the specified IPv4 address and port + * number. + */ + [version=1.1] + void CreateFromIPv4Address([in] uint8_t[4] ip, + [in] uint16_t port, + [out] PP_NetAddress_Private addr_out); + /** + * Creates NetAddress with the specified IPv6 address, scope_id and + * port number. + */ + [version=1.1] + void CreateFromIPv6Address([in] uint8_t[16] ip, + [in] uint32_t scope_id, + [in] uint16_t port, + [out] PP_NetAddress_Private addr_out); +}; diff --git a/browser/extensions/mortar/ppapi/api/private/ppb_output_protection_private.idl b/browser/extensions/mortar/ppapi/api/private/ppb_output_protection_private.idl new file mode 100644 index 000000000000..44a2585be05c --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/private/ppb_output_protection_private.idl @@ -0,0 +1,141 @@ +/* Copyright 2013 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * This file defines the API for output protection. Currently, it only supports + * Chrome OS. + */ + +[generate_thunk] + +label Chrome { + M31 = 0.1 +}; + +/** + * Content protection methods applied on video output link. + */ +[assert_size(4)] enum PP_OutputProtectionMethod_Private { + PP_OUTPUT_PROTECTION_METHOD_PRIVATE_NONE = 0, + PP_OUTPUT_PROTECTION_METHOD_PRIVATE_HDCP = 1 << 0 +}; + +/** + * Video output link types. + */ +[assert_size(4)] enum PP_OutputProtectionLinkType_Private { + PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_NONE = 0, + PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_UNKNOWN = 1 << 0, + PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_INTERNAL = 1 << 1, + PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_VGA = 1 << 2, + PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_HDMI = 1 << 3, + PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_DVI = 1 << 4, + PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_DISPLAYPORT = 1 << 5, + PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_NETWORK = 1 << 6 +}; + +/** + * The PPB_OutputProtection_Private interface allows controlling + * output protection. + * + * Example: + * + * @code + * op = output_protection->Create(instance); + * output_protection->QueryStatus(op, &link_mask, &protection_mask, + * done_callback); + * @endcode + * + * In this example, the plugin wants to enforce HDCP for HDMI link. + * @code + * if (link_mask & PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_HDMI) { + * output_protection->EnableProtection( + * op, PP_OUTPUT_PROTECTION_METHOD_PRIVATE_HDCP, done_callback); + * } + * @endcode + * + * After EnableProtection() completes, the plugin has to query protection + * status periodically to make sure the protection is enabled and remains + * enabled. + */ +interface PPB_OutputProtection_Private { + /** + * Create() creates a new PPB_OutputProtection_Private object. + * + * @pram[in] instance A PP_Instance identifying one instance of + * a module. + * + * @return A PP_Resource corresponding to a + * PPB_OutputProtection_Private if successful, 0 if creation + * failed. + */ + PP_Resource Create([in] PP_Instance instance); + + /** + * IsOutputProtection() determines if the provided resource is a + * PPB_OutputProtection_Private. + * + * @param[in] resource A PP_Resource corresponding to a + * PPB_OutputProtection_Private. + * + * @return PP_TRUE if the resource is a + * PPB_OutputProtection_Private, PP_FALSE if the + * resource is invalid or some type other than + * PPB_OutputProtection_Private. + */ + PP_Bool IsOutputProtection([in] PP_Resource resource); + + /** + * Query link status and protection status. + * Clients have to query status periodically in order to detect changes. + * + * @param[in] resource A PP_Resource corresponding to a + * PPB_OutputProtection_Private. + * @param[out] link_mask The type of connected output links, which is a + * bit-mask of the PP_OutputProtectionLinkType_Private values. + * @param[out] protection_mask Enabled protection methods, which is a + * bit-mask of the PP_OutputProtectionMethod_Private values. + * @param[in] callback A PP_CompletionCallback to run on + * asynchronous completion of QueryStatus(). This callback will only run if + * QueryStatus() returns PP_OK_COMPLETIONPENDING. + * + * @return An int32_t containing an error code from pp_errors.h. + */ + int32_t QueryStatus( + [in] PP_Resource resource, + [out] uint32_t link_mask, + [out] uint32_t protection_mask, + [in] PP_CompletionCallback callback); + + /** + * Set desired protection methods. + * + * When the desired protection method(s) have been applied to all applicable + * output links, the relevant bit(s) of the protection_mask returned by + * QueryStatus() will be set. Otherwise, the relevant bit(s) of + * protection_mask will not be set; there is no separate error code or + * callback. + * + * Protections will be disabled if no longer desired by all instances. + * + * @param[in] resource A PP_Resource corresponding to a + * PPB_OutputProtection_Private. + * @param[in] desired_protection_mask The desired protection methods, which + * is a bit-mask of the PP_OutputProtectionMethod_Private + * values. + * @param[in] callback A PP_CompletionCallback to be called with + * PP_OK when the protection request has been made. This may be + * before the protection have actually been applied. Call QueryStatus to get + * protection status. If it failed to make the protection request, the + * callback is called with PP_ERROR_FAILED and there is no need + * to call QueryStatus(). + * + * @return An int32_t containing an error code from pp_errors.h. + */ + int32_t EnableProtection( + [in] PP_Resource resource, + [in] uint32_t desired_protection_mask, + [in] PP_CompletionCallback callback); +}; diff --git a/browser/extensions/mortar/ppapi/api/private/ppb_pdf.idl b/browser/extensions/mortar/ppapi/api/private/ppb_pdf.idl new file mode 100644 index 000000000000..51088d906aa3 --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/private/ppb_pdf.idl @@ -0,0 +1,182 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* This file contains PPB_PDF interface. */ + +label Chrome { + M19 = 0.1 +}; + +enum PP_PDFFeature { + PP_PDFFEATURE_HIDPI = 0, + PP_PDFFEATURE_PRINTING = 1 +}; + +struct PP_PrivateFontFileDescription { + str_t face; + uint32_t weight; + PP_Bool italic; +}; + +struct PP_PrivateFindResult { + int32_t start_index; + int32_t length; +}; + +struct PP_PrivateAccessibilityViewportInfo { + double_t zoom; + PP_Point scroll; + PP_Point offset; +}; + +struct PP_PrivateAccessibilityDocInfo { + uint32_t page_count; + PP_Bool text_accessible; + PP_Bool text_copyable; +}; + +enum PP_PrivateDirection { + PP_PRIVATEDIRECTION_NONE = 0, + PP_PRIVATEDIRECTION_LTR = 1, + PP_PRIVATEDIRECTION_RTL = 2, + PP_PRIVATEDIRECTION_TTB = 3, + PP_PRIVATEDIRECTION_BTT = 4, + PP_PRIVATEDIRECTION_LAST = PP_PRIVATEDIRECTION_BTT +}; + +struct PP_PrivateAccessibilityPageInfo { + uint32_t page_index; + PP_Rect bounds; + uint32_t text_run_count; + uint32_t char_count; +}; + +struct PP_PrivateAccessibilityTextRunInfo { + uint32_t len; + double_t font_size; + PP_FloatRect bounds; + PP_PrivateDirection direction; +}; + +struct PP_PrivateAccessibilityCharInfo { + uint32_t unicode_character; + double_t char_width; +}; + +interface PPB_PDF { + /* Returns a resource identifying a font file corresponding to the given font + * request after applying the browser-specific fallback. + * + * Currently Linux-only. + */ + PP_Resource GetFontFileWithFallback( + [in] PP_Instance instance, + [in] PP_BrowserFont_Trusted_Description description, + [in] PP_PrivateFontCharset charset); + + /* Given a resource previously returned by GetFontFileWithFallback, returns + * a pointer to the requested font table. Linux only. + */ + PP_Bool GetFontTableForPrivateFontFile( + [in] PP_Resource font_file, + [in] uint32_t table, + [out] mem_t output, + [out] uint32_t output_length); + + /* Search the given string using ICU. Use PPB_Core's MemFree on results when + * done. + */ + void SearchString( + [in] PP_Instance instance, + [in] mem_t str, + [in] mem_t term, + [in] PP_Bool case_sensitive, + [out, size_is(count)] PP_PrivateFindResult[] results, + [out] int32_t count); + + /* Since WebFrame doesn't know about PPAPI requests, it'll think the page has + * finished loading even if there are outstanding requests by the plugin. + * Take this out once WebFrame knows about requests by PPAPI plugins. + */ + void DidStartLoading( + [in] PP_Instance instance); + void DidStopLoading( + [in] PP_Instance instance); + + /* Sets content restriction for a full-page plugin (i.e. can't copy/print). + * The value is a bitfield of ContentRestriction enums. + */ + void SetContentRestriction( + [in] PP_Instance instance, + [in] int32_t restrictions); + + /* Notifies the browser that the given action has been performed. */ + void UserMetricsRecordAction( + [in] PP_Instance instance, + [in] PP_Var action); + + /* Notifies the browser that the PDF has an unsupported feature. */ + void HasUnsupportedFeature( + [in] PP_Instance instance); + + /*Invoke SaveAs... dialog, similar to the right-click or wrench menu. */ + void SaveAs( + [in] PP_Instance instance); + + /* Invoke Print dialog for plugin. */ + void Print( + [in] PP_Instance instance); + + PP_Bool IsFeatureEnabled( + [in] PP_Instance instance, + [in] PP_PDFFeature feature); + + /* Sets the selected text of the plugin. If |selected_text| is empty, then no + * text is selected. */ + void SetSelectedText( + [in] PP_Instance instance, + [in] str_t selected_text); + + /* Sets the link under the cursor. If |url| is empty, then no link is under + * the cursor. */ + void SetLinkUnderCursor( + [in] PP_Instance instance, + [in] str_t url); + + /* Gets pointers to both the mmap'd V8 snapshot files and their sizes. + * This is needed when loading V8's initial snapshot from external files. */ + void GetV8ExternalSnapshotData( + [in] PP_Instance instance, + [out] mem_ptr_t natives_data_out, + [out] int32_t natives_size_out, + [out] mem_ptr_t snapshot_data_out, + [out] int32_t snapshot_size_out); + + /* Sends information about the viewport to the renderer for accessibility + * support. */ + void SetAccessibilityViewportInfo( + [in] PP_Instance instance, + [in] PP_PrivateAccessibilityViewportInfo viewport_info); + + /* Sends information about the PDF document to the renderer for accessibility + * support. */ + void SetAccessibilityDocInfo( + [in] PP_Instance instance, + [in] PP_PrivateAccessibilityDocInfo doc_info); + + /* Sends information about one page in a PDF document to the renderer for + * accessibility support. */ + void SetAccessibilityPageInfo( + [in] PP_Instance instance, + [in] PP_PrivateAccessibilityPageInfo page_info, + [in] PP_PrivateAccessibilityTextRunInfo[] text_runs, + [in] PP_PrivateAccessibilityCharInfo[] chars); + + /* Sends information about the PDF's URL and the embedder's URL. */ + void SetCrashData( + [in] PP_Instance instance, + [in] str_t pdf_url, + [in] str_t top_level_url); +}; diff --git a/browser/extensions/mortar/ppapi/api/private/ppb_platform_verification_private.idl b/browser/extensions/mortar/ppapi/api/private/ppb_platform_verification_private.idl new file mode 100644 index 000000000000..87df6af7e227 --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/private/ppb_platform_verification_private.idl @@ -0,0 +1,85 @@ +/* Copyright 2013 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * This file defines the API for platform verification. Currently, it only + * supports Chrome OS. + */ + +[generate_thunk] + +label Chrome { + M32 = 0.2 +}; + +/** + * The PPB_PlatformVerification_Private interface allows authorized + * services to verify that the underlying platform is trusted. An example of a + * trusted platform is a Chrome OS device in verified boot mode. + */ + +interface PPB_PlatformVerification_Private { + /** + * Create() creates a PPB_PlatformVerification_Private object. + * + * @pram[in] instance A PP_Instance identifying one instance of + * a module. + * + * @return A PP_Resource corresponding to a + * PPB_PlatformVerification_Private if successful, 0 if creation + * failed. + */ + PP_Resource Create([in] PP_Instance instance); + + /** + * IsPlatformVerification() determines if the provided resource is a + * PPB_PlatformVerification_Private. + * + * @param[in] resource A PP_Resource corresponding to a + * PPB_PlatformVerification_Private. + * + * @return PP_TRUE if the resource is a + * PPB_PlatformVerification_Private, PP_FALSE if the + * resource is invalid or some type other than + * PPB_PlatformVerification_Private. + */ + PP_Bool IsPlatformVerification([in] PP_Resource resource); + + /** + * Requests a platform challenge for a given service id. + * + * @param[in] service_id A PP_Var of type + * PP_VARTYPE_STRING containing the service_id for the challenge. + * + * @param[in] challenge A PP_Var of type + * PP_VARTYPE_ARRAY_BUFFER that contains the challenge data. + * + * @param[out] signed_data A PP_Var of type + * PP_VARTYPE_ARRAY_BUFFER that contains the data signed by the + * platform. + * + * @param[out] signed_data_signature A PP_Var of type + * PP_VARTYPE_ARRAY_BUFFER that contains the signature of the + * signed data block. + * + * @param[out] platform_key_certificate A PP_Var of type + * PP_VARTYPE_STRING that contains the device specific + * certificate for the requested service_id. + * + * @param[in] callback A PP_CompletionCallback to be called after + * the platform challenge has been completed. This callback will only run if + * the return code is PP_OK_COMPLETIONPENDING. + * + * @return An int32_t containing an error code from pp_errors.h. + */ + int32_t ChallengePlatform( + [in] PP_Resource instance, + [in] PP_Var service_id, + [in] PP_Var challenge, + [out] PP_Var signed_data, + [out] PP_Var signed_data_signature, + [out] PP_Var platform_key_certificate, + [in] PP_CompletionCallback callback); +}; diff --git a/browser/extensions/mortar/ppapi/api/private/ppb_tcp_server_socket_private.idl b/browser/extensions/mortar/ppapi/api/private/ppb_tcp_server_socket_private.idl new file mode 100644 index 000000000000..a9130ccd6c9d --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/private/ppb_tcp_server_socket_private.idl @@ -0,0 +1,71 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * This file defines the PPB_TCPServerSocket_Private interface. + */ + +label Chrome { + M18 = 0.1, + M28 = 0.2 +}; + +/** + * The PPB_TCPServerSocket_Private interface provides TCP + * server socket operations. + */ +interface PPB_TCPServerSocket_Private { + /** + * Allocates a TCP server socket resource. + */ + PP_Resource Create([in] PP_Instance instance); + + /** + * Determines if a given resource is TCP server socket. + */ + PP_Bool IsTCPServerSocket([in] PP_Resource resource); + + /** + * Binds |tcp_server_socket| to the address given by |addr| and + * starts listening. The |backlog| argument defines the maximum + * length to which the queue of pending connections may + * grow. |callback| is invoked when |tcp_server_socket| is ready to + * accept incoming connections or in the case of failure. Returns + * PP_ERROR_NOSPACE if socket can't be initialized, or + * PP_ERROR_FAILED in the case of Listen failure. Otherwise, returns + * PP_OK. + */ + int32_t Listen([in] PP_Resource tcp_server_socket, + [in] PP_NetAddress_Private addr, + [in] int32_t backlog, + [in] PP_CompletionCallback callback); + + /** + * Accepts single connection, creates instance of + * PPB_TCPSocket_Private and stores reference to it in + * |tcp_socket|. |callback| is invoked when connection is accepted + * or in the case of failure. This method can be called only after + * successful Listen call on |tcp_server_socket|. + */ + int32_t Accept([in] PP_Resource tcp_server_socket, + [out] PP_Resource tcp_socket, + [in] PP_CompletionCallback callback); + + /** + * Returns the current address to which the socket is bound, in the + * buffer pointed to by |addr|. This method can be called only after + * successful Listen() call and before StopListening() call. + */ + [version=0.2] + int32_t GetLocalAddress([in] PP_Resource tcp_server_socket, + [out] PP_NetAddress_Private addr); + + /** + * Cancels all pending callbacks reporting PP_ERROR_ABORTED and + * closes the socket. Note: this method is implicitly called when + * server socket is destroyed. + */ + void StopListening([in] PP_Resource tcp_server_socket); +}; diff --git a/browser/extensions/mortar/ppapi/api/private/ppb_tcp_socket_private.idl b/browser/extensions/mortar/ppapi/api/private/ppb_tcp_socket_private.idl new file mode 100644 index 000000000000..b9913bccfe84 --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/private/ppb_tcp_socket_private.idl @@ -0,0 +1,162 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * This file defines the PPB_TCPSocket_Private interface. + */ + +label Chrome { + M17 = 0.3, + M20 = 0.4, + M27 = 0.5 +}; + +[assert_size(4)] +enum PP_TCPSocketOption_Private { + // Special value used for testing. Guaranteed to fail SetOption(). + PP_TCPSOCKETOPTION_PRIVATE_INVALID = 0, + + // Disable coalescing of small writes to make TCP segments, and instead + // deliver data immediately. For SSL sockets, this option must be set before + // SSLHandshake() is called. Value type is PP_VARTYPE_BOOL. + PP_TCPSOCKETOPTION_PRIVATE_NO_DELAY = 1 +}; + +/** + * The PPB_TCPSocket_Private interface provides TCP socket + * operations. + */ +interface PPB_TCPSocket_Private { + /** + * Allocates a TCP socket resource. + */ + PP_Resource Create([in] PP_Instance instance); + + /** + * Determines if a given resource is TCP socket. + */ + PP_Bool IsTCPSocket([in] PP_Resource resource); + + /** + * Connects to a TCP port given as a host-port pair. + * When a proxy server is used, |host| and |port| refer to the proxy server + * instead of the destination server. + */ + int32_t Connect([in] PP_Resource tcp_socket, + [in] str_t host, + [in] uint16_t port, + [in] PP_CompletionCallback callback); + + /** + * Same as Connect(), but connecting to the address given by |addr|. A typical + * use-case would be for reconnections. + */ + int32_t ConnectWithNetAddress([in] PP_Resource tcp_socket, + [in] PP_NetAddress_Private addr, + [in] PP_CompletionCallback callback); + + /** + * Gets the local address of the socket, if it has been connected. + * Returns PP_TRUE on success. + */ + PP_Bool GetLocalAddress([in] PP_Resource tcp_socket, + [out] PP_NetAddress_Private local_addr); + + /** + * Gets the remote address of the socket, if it has been connected. + * Returns PP_TRUE on success. + */ + PP_Bool GetRemoteAddress([in] PP_Resource tcp_socket, + [out] PP_NetAddress_Private remote_addr); + + /** + * Does SSL handshake and moves to sending and receiving encrypted data. The + * socket must have been successfully connected. |server_name| will be + * compared with the name(s) in the server's certificate during the SSL + * handshake. |server_port| is only used to identify an SSL server in the SSL + * session cache. + * When a proxy server is used, |server_name| and |server_port| refer to the + * destination server. + * If the socket is not connected, or there are pending read/write requests, + * SSLHandshake() will fail without starting a handshake. Otherwise, any + * failure during the handshake process will cause the socket to be + * disconnected. + */ + int32_t SSLHandshake([in] PP_Resource tcp_socket, + [in] str_t server_name, + [in] uint16_t server_port, + [in] PP_CompletionCallback callback); + + /** + * Returns the server's PPB_X509Certificate_Private for a socket + * connection if an SSL connection has been established using + * SSLHandshake. If no SSL connection has been established, a + * null resource is returned. + */ + [version=0.4] + PP_Resource GetServerCertificate([in] PP_Resource tcp_socket); + + /** + * NOTE: This function is not implemented and will return + * PP_FALSE. + * Adds a trusted/untrusted chain building certificate to be used for this + * connection. The certificate must be a + * PPB_X509Certificate_Private. PP_TRUE is returned + * upon success. + */ + [version=0.4] + PP_Bool AddChainBuildingCertificate([in] PP_Resource tcp_socket, + [in] PP_Resource certificate, + [in] PP_Bool is_trusted); + + /** + * Reads data from the socket. The size of |buffer| must be at least as large + * as |bytes_to_read|. May perform a partial read. Returns the number of bytes + * read or an error code. If the return value is 0, then it indicates that + * end-of-file was reached. + * This method won't return more than 1 megabyte, so if |bytes_to_read| + * exceeds 1 megabyte, it will always perform a partial read. + * Multiple outstanding read requests are not supported. + */ + int32_t Read([in] PP_Resource tcp_socket, + [out] str_t buffer, + [in] int32_t bytes_to_read, + [in] PP_CompletionCallback callback); + + /** + * Writes data to the socket. May perform a partial write. Returns the number + * of bytes written or an error code. + * This method won't write more than 1 megabyte, so if |bytes_to_write| + * exceeds 1 megabyte, it will always perform a partial write. + * Multiple outstanding write requests are not supported. + */ + int32_t Write([in] PP_Resource tcp_socket, + [in] str_t buffer, + [in] int32_t bytes_to_write, + [in] PP_CompletionCallback callback); + + /** + * Cancels any IO that may be pending, and disconnects the socket. Any pending + * callbacks will still run, reporting PP_Error_Aborted if pending IO was + * interrupted. It is NOT valid to call Connect() again after a call to this + * method. Note: If the socket is destroyed when it is still connected, then + * it will be implicitly disconnected, so you are not required to call this + * method. + */ + void Disconnect([in] PP_Resource tcp_socket); + + /** + * Sets an option on |tcp_socket|. Supported |name| and |value| parameters + * are as described for PP_TCPSocketOption_Private. |callback| will be + * invoked with PP_OK if setting the option succeeds, or an error code + * otherwise. The socket must be connection before SetOption is called. + */ + [version=0.5] + int32_t SetOption([in] PP_Resource tcp_socket, + [in] PP_TCPSocketOption_Private name, + [in] PP_Var value, + [in] PP_CompletionCallback callback); + +}; diff --git a/browser/extensions/mortar/ppapi/api/private/ppb_testing_private.idl b/browser/extensions/mortar/ppapi/api/private/ppb_testing_private.idl new file mode 100644 index 000000000000..c2aed4176150 --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/private/ppb_testing_private.idl @@ -0,0 +1,153 @@ +/* Copyright 2013 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * This file contains interface functions used for unit testing. Do not use in + * production code. They are not guaranteed to be available in normal plugin + * environments so you should not depend on them. + */ + +label Chrome { + M33 = 1.0 +}; + +interface PPB_Testing_Private { + /** + * Reads the bitmap data out of the backing store for the given + * DeviceContext2D and into the given image. If the data was successfully + * read, it will return PP_TRUE. + * + * This function should not generally be necessary for normal plugin + * operation. If you want to update portions of a device, the expectation is + * that you will either regenerate the data, or maintain a backing store + * pushing updates to the device from your backing store via PaintImageData. + * Using this function will introduce an extra copy which will make your + * plugin slower. In some cases, this may be a very expensive operation (it + * may require slow cross-process transitions or graphics card readbacks). + * + * Data will be read into the image starting at |top_left| in the device + * context, and proceeding down and to the right for as many pixels as the + * image is large. If any part of the image bound would fall outside of the + * backing store of the device if positioned at |top_left|, this function + * will fail and return PP_FALSE. + * + * The image format must be of the format + * PPB_ImageData.GetNativeImageDataFormat() or this function will fail and + * return PP_FALSE. + * + * The returned image data will represent the current status of the backing + * store. This will not include any paint, scroll, or replace operations + * that have not yet been flushed; these operations are only reflected in + * the backing store (and hence ReadImageData) until after a Flush() + * operation has completed. + */ + PP_Bool ReadImageData([in] PP_Resource device_context_2d, + [in] PP_Resource image, + [in] PP_Point top_left); + + /** + * Runs a nested message loop. The plugin will be reentered from this call. + * This function is used for unit testing the API. The normal pattern is to + * issue some asynchronous call that has a callback. Then you call + * RunMessageLoop which will suspend the plugin and go back to processing + * messages, giving the asynchronous operation time to complete. In your + * callback, you save the data and call QuitMessageLoop, which will then + * pop back up and continue with the test. This avoids having to write a + * complicated state machine for simple tests for asynchronous APIs. + */ + void RunMessageLoop([in] PP_Instance instance); + + /** + * Posts a quit message for the outermost nested message loop. Use this to + * exit and return back to the caller after you call RunMessageLoop. + */ + void QuitMessageLoop([in] PP_Instance instance); + + /** + * Returns the number of live objects (resources + strings + objects) + * associated with this plugin instance. Used for detecting leaks. Returns + * (uint32_t)-1 on failure. + */ + uint32_t GetLiveObjectsForInstance([in] PP_Instance instance); + + /** + * Returns PP_TRUE if the plugin is running out-of-process, PP_FALSE + * otherwise. + */ + PP_Bool IsOutOfProcess(); + + /** + * Posts the plugin's current Power Saver status to JavaScript. The plugin + * itself does not recieve anything. This is not idiomatic for Pepper, + * but convenient for testing. + */ + void PostPowerSaverStatus([in] PP_Instance instance); + + /** + * Subscribes to changes to the plugin's Power Saver status. The status + * changes are not forwarded to the plugin itself, but posted to JavaScript. + * This is not idiomatic for Pepper, but conveienent for testing. + */ + void SubscribeToPowerSaverNotifications([in] PP_Instance instance); + + /** + * Passes the input event to the browser, which sends it back to the + * plugin. The plugin should implement PPP_InputEvent and register for + * the input event type. + * + * This method sends an input event through the browser just as if it had + * come from the user. If the browser determines that it is an event for the + * plugin, it will be sent to be handled by the plugin's PPP_InputEvent + * interface. When generating mouse events, make sure the position is within + * the plugin's area on the page. When generating a keyboard event, make sure + * the plugin is focused. + * + * Note that the browser may generate extra input events in order to + * maintain certain invariants, such as always having a "mouse enter" event + * before any other mouse event. Furthermore, the event the plugin receives + * after sending a simulated event will be slightly different from the + * original event. The browser may change the timestamp, add modifiers, and + * slightly alter the mouse position, due to coordinate transforms it + * performs. + */ + void SimulateInputEvent([in] PP_Instance instance, + [in] PP_Resource input_event); + + /** + * Returns the URL for the document. This is a safe way to retrieve + * window.location.href. + * If the canonicalized URL is valid, the method will parse the URL + * and fill in the components structure. This pointer may be NULL + * to specify that no component information is necessary. + */ + PP_Var GetDocumentURL([in] PP_Instance instance, + [out] PP_URLComponents_Dev components); + + /** + * Fetches up to |array_size| active PP_Vars in the tracker. Returns the + * number of vars in the tracker. The active vars are written to |live_vars| + * contiguously starting at index 0. The vars are not in any particular order. + * If the number of live vars is greater than |array_size|, then an arbitrary + * subset of |array_size| vars is written to |live_vars|. The reference count + * of the returned PP_Vars will *not* be affected by this call. + */ + uint32_t GetLiveVars([size_as=array_size] PP_Var[] live_vars, + [in] uint32_t array_size); + + /** + * Sets the threshold size at which point we switch from transmitting + * array buffers in IPC messages to using shared memory. This is only used + * for testing purposes where we need to transmit small buffers using shmem + * (in order to have fast tests). Passing a value of 0 resets the threshold + * to its default. The threshold is in bytes. + */ + void SetMinimumArrayBufferSizeForShmem([in] PP_Instance instance, + [in] uint32_t threshold); + + /** + * Run the V8 garbage collector for tests. + */ + void RunV8GC([in] PP_Instance instance); +}; diff --git a/browser/extensions/mortar/ppapi/api/private/ppb_udp_socket_private.idl b/browser/extensions/mortar/ppapi/api/private/ppb_udp_socket_private.idl new file mode 100644 index 000000000000..9888a548e995 --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/private/ppb_udp_socket_private.idl @@ -0,0 +1,98 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * This file defines the PPB_UDPSocket_Private interface. + */ + +label Chrome { + M17 = 0.2, + M19 = 0.3, + M23 = 0.4 +}; + +[assert_size(4)] +enum PP_UDPSocketFeature_Private { + // Allow the socket to share the local address to which socket will + // be bound with other processes. Value's type should be + // PP_VARTYPE_BOOL. + PP_UDPSOCKETFEATURE_PRIVATE_ADDRESS_REUSE = 0, + + // Allow sending and receiving packets sent to and from broadcast + // addresses. Value's type should be PP_VARTYPE_BOOL. + PP_UDPSOCKETFEATURE_PRIVATE_BROADCAST = 1, + + // Special value for counting the number of available + // features. Should not be passed to SetSocketFeature(). + PP_UDPSOCKETFEATURE_PRIVATE_COUNT = 2 +}; + +interface PPB_UDPSocket_Private { + /** + * Creates a UDP socket resource. + */ + PP_Resource Create([in] PP_Instance instance_id); + + /** + * Determines if a given resource is a UDP socket. + */ + PP_Bool IsUDPSocket([in] PP_Resource resource_id); + + /** + * Sets a socket feature to |udp_socket|. Should be called before + * Bind(). Possible values for |name|, |value| and |value|'s type + * are described in PP_UDPSocketFeature_Private description. If no + * error occurs, returns PP_OK. Otherwise, returns + * PP_ERROR_BADRESOURCE (if bad |udp_socket| provided), + * PP_ERROR_BADARGUMENT (if bad name/value/value's type provided) + * or PP_ERROR_FAILED in the case of internal errors. + */ + [version=0.4] + int32_t SetSocketFeature([in] PP_Resource udp_socket, + [in] PP_UDPSocketFeature_Private name, + [in] PP_Var value); + + /* Creates a socket and binds to the address given by |addr|. */ + int32_t Bind([in] PP_Resource udp_socket, + [in] PP_NetAddress_Private addr, + [in] PP_CompletionCallback callback); + + /* Returns the address that the socket has bound to. A successful + * call to Bind must be called first. Returns PP_FALSE if Bind + * fails, or if Close has been called. + */ + [version=0.3] + PP_Bool GetBoundAddress([in] PP_Resource udp_socket, + [out] PP_NetAddress_Private addr); + + /* Performs a non-blocking recvfrom call on socket. + * Bind must be called first. |callback| is invoked when recvfrom + * reads data. You must call GetRecvFromAddress to recover the + * address the data was retrieved from. + */ + int32_t RecvFrom([in] PP_Resource udp_socket, + [out] str_t buffer, + [in] int32_t num_bytes, + [in] PP_CompletionCallback callback); + + /* Upon successful completion of RecvFrom, the address that the data + * was received from is stored in |addr|. + */ + PP_Bool GetRecvFromAddress([in] PP_Resource udp_socket, + [out] PP_NetAddress_Private addr); + + /* Performs a non-blocking sendto call on the socket created and + * bound(has already called Bind). The callback |callback| is + * invoked when sendto completes. + */ + int32_t SendTo([in] PP_Resource udp_socket, + [in] str_t buffer, + [in] int32_t num_bytes, + [in] PP_NetAddress_Private addr, + [in] PP_CompletionCallback callback); + + /* Cancels all pending reads and writes, and closes the socket. */ + void Close([in] PP_Resource udp_socket); +}; diff --git a/browser/extensions/mortar/ppapi/api/private/ppb_uma_private.idl b/browser/extensions/mortar/ppapi/api/private/ppb_uma_private.idl new file mode 100644 index 000000000000..2d9b950fbba3 --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/private/ppb_uma_private.idl @@ -0,0 +1,67 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * This file defines the PPB_UMA_Private interface. + */ + +[generate_thunk,thunk_include="ppapi/thunk/ppb_uma_singleton_api.h"] + +label Chrome { + M35 = 0.3 +}; + +/** + * Contains functions for plugins to report UMA usage stats. + */ +interface PPB_UMA_Private { + /** + * HistogramCustomTimes is a pointer to a function which records a time + * sample given in milliseconds in the histogram given by |name|, possibly + * creating the histogram if it does not exist. + */ + [singleton,api=PPB_UMA_Singleton_API] + void HistogramCustomTimes([in] PP_Instance instance, + [in] PP_Var name, + [in] int64_t sample, + [in] int64_t min, + [in] int64_t max, + [in] uint32_t bucket_count); + + /** + * HistogramCustomCounts is a pointer to a function which records a sample + * in the histogram given by |name|, possibly creating the histogram if it + * does not exist. + */ + [singleton,api=PPB_UMA_Singleton_API] + void HistogramCustomCounts([in] PP_Instance instance, + [in] PP_Var name, + [in] int32_t sample, + [in] int32_t min, + [in] int32_t max, + [in] uint32_t bucket_count); + + /** + * HistogramEnumeration is a pointer to a function which records a sample + * in the histogram given by |name|, possibly creating the histogram if it + * does not exist. The sample represents a value in an enumeration bounded + * by |boundary_value|, that is, sample < boundary_value always. + */ + [singleton,api=PPB_UMA_Singleton_API] + void HistogramEnumeration([in] PP_Instance instance, + [in] PP_Var name, + [in] int32_t sample, + [in] int32_t boundary_value); + + /** + * IsCrashReportingEnabled returns PP_OK to the completion callback to + * indicate that the current user has opted-in to crash reporting, or + * PP_ERROR_* on failure or when a user has not opted-in. This can be used to + * gate other reporting processes such as analytics and crash reporting. + */ + [singleton,api=PPB_UMA_Singleton_API] + int32_t IsCrashReportingEnabled([in] PP_Instance instance, + [in] PP_CompletionCallback callback); +}; diff --git a/browser/extensions/mortar/ppapi/api/private/ppb_video_destination_private.idl b/browser/extensions/mortar/ppapi/api/private/ppb_video_destination_private.idl new file mode 100644 index 000000000000..a37cbd56ac87 --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/private/ppb_video_destination_private.idl @@ -0,0 +1,95 @@ +/* Copyright (c) 2013 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * This file defines the PPB_VideoDestination_Private interface + * for a video destination resource, which sends video frames to a MediaStream + * video track in the browser. + */ + + label Chrome { + M28 = 0.1 + }; + +/** + * The PPB_VideoDestination_Private interface contains pointers to + * several functions for creating video destination resources and using them to + * send video frames to a MediaStream video track in the browser. + */ +interface PPB_VideoDestination_Private { + /** + * Creates a video destination resource. + * + * @param[in] instance A PP_Instance identifying an instance of + * a module. + * + * @return A PP_Resource with a nonzero ID on success or zero on + * failure. Failure means the instance was invalid. + */ + PP_Resource Create([in] PP_Instance instance); + + /** + * Determines if a resource is a video destination resource. + * + * @param[in] resource The PP_Resource to test. + * + * @return A PP_Bool with PP_TRUE if the given + * resource is a video destination resource or PP_FALSE + * otherwise. + */ + PP_Bool IsVideoDestination([in] PP_Resource resource); + + /** + * Opens a video destination for putting frames. + * + * @param[in] destination A PP_Resource corresponding to a video + * destination resource. + * @param[in] stream_url A PP_Var string holding a URL + * identifying a MediaStream. + * @param[in] callback A PP_CompletionCallback to be called upon + * completion of Open(). + * + * @return An int32_t containing a result code from pp_errors.h. + * Returns PP_ERROR_BADRESOURCE if destination isn't a valid video + * destination. + * Returns PP_ERROR_INPROGRESS if destination is already open. + * Returns PP_ERROR_FAILED if the MediaStream doesn't exist or if there is + * some other browser error. + */ + int32_t Open([in] PP_Resource destination, + [in] PP_Var stream_url, + [in] PP_CompletionCallback callback); + + /** + * Puts a frame to the video destination. + * + * After this call, you should take care to release your references to the + * image embedded in the video frame. If you paint to the image after + * PutFame(), there is the possibility of artifacts because the browser may + * still be copying the frame to the stream. + * + * @param[in] destination A PP_Resource corresponding to a video + * destination resource. + * @param[in] frame A PP_VideoFrame_Private holding the video + * frame to send to the destination. + * + * @return An int32_t containing a result code from pp_errors.h. + * Returns PP_ERROR_BADRESOURCE if destination isn't a valid video + * destination. + * Returns PP_ERROR_FAILED if destination is not open, if the video frame has + * an invalid image data resource, or if some other browser error occurs. + */ + int32_t PutFrame([in] PP_Resource destination, + [in] PP_VideoFrame_Private frame); + + /** + * Closes the video destination. + * + * @param[in] destination A PP_Resource corresponding to a video + * destination. + */ + void Close([in] PP_Resource destination); +}; + diff --git a/browser/extensions/mortar/ppapi/api/private/ppb_video_source_private.idl b/browser/extensions/mortar/ppapi/api/private/ppb_video_source_private.idl new file mode 100644 index 000000000000..e57eedd08102 --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/private/ppb_video_source_private.idl @@ -0,0 +1,93 @@ +/* Copyright (c) 2013 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * This file defines the PPB_VideoSource_Private interface for a + * video source resource, which receives video frames from a MediaStream video + * track in the browser. + */ + + label Chrome { + M28 = 0.1 + }; + +/** + * The PPB_VideoSource_Private interface contains pointers to + * several functions for creating video source resources and using them to + * receive video frames from a MediaStream video track in the browser. + */ +interface PPB_VideoSource_Private { + /** + * Creates a video source resource. + * + * @param[in] instance A PP_Instance identifying an instance of + * a module. + * + * @return A PP_Resource with a nonzero ID on success or zero on + * failure. Failure means the instance was invalid. + */ + PP_Resource Create([in] PP_Instance instance); + + /** + * Determines if a resource is a video source resource. + * + * @param[in] resource The PP_Resource to test. + * + * @return A PP_Bool with PP_TRUE if the given + * resource is a video source resource or PP_FALSE otherwise. + */ + PP_Bool IsVideoSource([in] PP_Resource resource); + + /** + * Opens a video source for getting frames. + * + * @param[in] source A PP_Resource corresponding to a video + * source resource. + * @param[in] stream_url A PP_Var string holding a URL + * identifying a MediaStream. + * @param[in] callback A PP_CompletionCallback to be called upon + * completion of Open(). + * + * @return An int32_t containing a result code from pp_errors.h. + * Returns PP_ERROR_BADRESOURCE if source isn't a valid video source. + * Returns PP_ERROR_INPROGRESS if source is already open. + * Returns PP_ERROR_FAILED if the MediaStream doesn't exist or if there is + * some other browser error. + */ + int32_t Open([in] PP_Resource source, + [in] PP_Var stream_url, + [in] PP_CompletionCallback callback); + + /** + * Gets a frame from the video source. The returned image data is only valid + * until the next call to GetFrame. + * The image data resource inside the returned frame will have its reference + * count incremented by one and must be managed by the plugin. + * + * @param[in] source A PP_Resource corresponding to a video + * source resource. + * @param[out] frame A PP_VideoFrame_Private to hold a video + * frame from the source. + * @param[in] callback A PP_CompletionCallback to be called upon + * completion of GetNextFrame(). + * + * @return An int32_t containing a result code from pp_errors.h. + * Returns PP_ERROR_BADRESOURCE if source isn't a valid video source. + * Returns PP_ERROR_FAILED if the source is not open, or if some other + * browser error occurs. + */ + int32_t GetFrame([in] PP_Resource source, + [out] PP_VideoFrame_Private frame, + [in] PP_CompletionCallback callback); + + /** + * Closes the video source. + * + * @param[in] source A PP_Resource corresponding to a video + * source resource. + */ + void Close([in] PP_Resource source); +}; + diff --git a/browser/extensions/mortar/ppapi/api/private/ppb_x509_certificate_private.idl b/browser/extensions/mortar/ppapi/api/private/ppb_x509_certificate_private.idl new file mode 100644 index 000000000000..c58403e4d744 --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/private/ppb_x509_certificate_private.idl @@ -0,0 +1,173 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * This file defines the PPB_X509Certificate_Private interface for + * an X509 certificate. + */ + +label Chrome { + M19 = 0.1 +}; + +/** + * This enumeration corresponds to fields of an X509 certificate. Refer to + * PP_TRUE on success, PP_FALSE on failure. + */ + [version=1.2] + PP_Bool DeauthorizeContentLicenses([in] str_t plugin_data_path); + + /** + * Gets permission settings. callback will be called exactly once + * to return the settings. + * + * @param[in] plugin_data_path String containing the directory where the + * plugin settings are stored. + * @param[in] setting_type What type of setting to retrieve. + * @param[in] callback The callback to return retrieved data. + * @param[inout] user_data An opaque pointer that will be passed to + * callback. + */ + [version=1.2] + void GetPermissionSettings( + [in] str_t plugin_data_path, + [in] PP_Flash_BrowserOperations_SettingType setting_type, + [in] PPB_Flash_BrowserOperations_GetSettingsCallback callback, + [inout] mem_t user_data); + + /** + * Sets default permission. It applies to all sites except those with + * site-specific settings. + * + * @param[in] plugin_data_path String containing the directory where the + * plugin settings are stored. + * @param[in] setting_type What type of setting to set. + * @param[in] permission The default permission. + * @param[in] clear_site_specific Whether to remove all site-specific + * settings. + * + * @return PP_TRUE on success, PP_FALSE on failure. + */ + [version=1.2] + PP_Bool SetDefaultPermission( + [in] str_t plugin_data_path, + [in] PP_Flash_BrowserOperations_SettingType setting_type, + [in] PP_Flash_BrowserOperations_Permission permission, + [in] PP_Bool clear_site_specific); + + /** + * Sets site-specific permission. If a site has already got site-specific + * permission and it is not in sites, it won't be affected. + * + * @param[in] plugin_data_path String containing the directory where the + * plugin settings are stored. + * @param[in] setting_type What type of setting to set. + * @param[in] site_count How many items are there in sites. + * @param[in] sites The site-specific settings. If a site is specified with + * PP_FLASH_BROWSEROPERATIONS_PERMISSION_DEFAULT permission, it + * will be removed from the site-specific list. + * + * @return PP_TRUE on success, PP_FALSE on failure. + */ + [version=1.2] + PP_Bool SetSitePermission( + [in] str_t plugin_data_path, + [in] PP_Flash_BrowserOperations_SettingType setting_type, + [in] uint32_t site_count, + [in, size_is(site_count)] PP_Flash_BrowserOperations_SiteSetting[] sites); + + /** + * Returns a list of sites that have stored data, for use with the + * "Clear site data" feature. + * + * @param[in] plugin_data_path String containing the directory where the + * plugin data is stored. + * @param[out] sites A NULL-terminated array of sites that have stored data. + * Use FreeSiteList on the array when done. + * + * See also the NPP_GetSitesWithData function in NPAPI: + * https://wiki.mozilla.org/NPAPI:ClearSiteData + */ + [version=1.3] + void GetSitesWithData([in] str_t plugin_data_path, + [out] str_t[] sites); + + /** + * Frees the list of sites returned by GetSitesWithData. + * + * @param[in] sites A NULL-terminated array of strings. + */ + [version=1.3] + void FreeSiteList([inout] str_t[] sites); +}; diff --git a/browser/extensions/mortar/ppapi/api/private/ppp_instance_private.idl b/browser/extensions/mortar/ppapi/api/private/ppp_instance_private.idl new file mode 100644 index 000000000000..3756faf96f9e --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/private/ppp_instance_private.idl @@ -0,0 +1,37 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * This file defines the PPP_InstancePrivate structure; a series of functions + * that a trusted plugin may implement to provide capabilities only available + * to trusted plugins. + */ +label Chrome { + M18 = 0.1 +}; + +/** + * The PPP_Instance_Private interface contains pointers to a series of + * functions that may be implemented in a trusted plugin to provide capabilities + * that aren't possible in untrusted modules. + */ + +interface PPP_Instance_Private { + /** + * GetInstanceObject returns a PP_Var representing the scriptable object for + * the given instance. Normally this will be a PPP_Class_Deprecated object + * that exposes methods and properties to JavaScript. + * + * On Failure, the returned PP_Var should be a "void" var. + * + * The returned PP_Var should have a reference added for the caller, which + * will be responsible for Release()ing that reference. + * + * @param[in] instance A PP_Instance identifying the instance from which the + * instance object is being requested. + * @return A PP_Var containing scriptable object. + */ + PP_Var GetInstanceObject([in] PP_Instance instance); +}; diff --git a/browser/extensions/mortar/ppapi/api/private/ppp_pexe_stream_handler.idl b/browser/extensions/mortar/ppapi/api/private/ppp_pexe_stream_handler.idl new file mode 100644 index 000000000000..b199b18a9f28 --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/private/ppp_pexe_stream_handler.idl @@ -0,0 +1,46 @@ +/* Copyright 2014 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* This file contains NaCl private interfaces. This interface is not versioned + * and is for internal Chrome use. It may change without notice. */ + +#inline c +#include "ppapi/c/private/pp_file_handle.h" +#endinl + +label Chrome { + M25 = 1.0 +}; + +interface PPP_PexeStreamHandler { + /** + * Invoked as a result of a cache hit for a translated pexe. + */ + void DidCacheHit([inout] mem_t user_data, + [in] PP_FileHandle nexe_file_handle); + + /** + * Invoked as a result of a cache miss for a translated pexe. + * Provides the expected length of the pexe, as read from HTTP headers. + */ + void DidCacheMiss([inout] mem_t user_data, + [in] int64_t expected_total_length, + [in] PP_FileHandle temp_nexe_file); + + /** + * Invoked when a block of data has been downloaded. + * Only invoked after DidCacheMiss(). + */ + void DidStreamData([inout] mem_t user_data, + [in] mem_t data, + [in] int32_t length); + + /** + * Invoked when the stream has finished downloading, regardless of whether it + * succeeded. Not invoked if DidCacheHit() was called. + */ + void DidFinishStream([inout] mem_t user_data, + [in] int32_t pp_error); +}; diff --git a/browser/extensions/mortar/ppapi/api/trusted/ppb_broker_trusted.idl b/browser/extensions/mortar/ppapi/api/trusted/ppb_broker_trusted.idl new file mode 100644 index 000000000000..023d9fcff075 --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/trusted/ppb_broker_trusted.idl @@ -0,0 +1,77 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * This file defines the PPB_BrokerTrusted interface, which provides + * access to a trusted broker with greater privileges than the plugin. + */ + +label Chrome { + M14 = 0.2, + M25 = 0.3 +}; + +/** + * The PPB_BrokerTrusted interface provides access to a trusted broker + * with greater privileges than the plugin. The interface only supports + * out-of-process plugins and is to be used by proxy implementations. All + * functions should be called from the main thread only. + * + * A PPB_BrokerTrusted resource represents a connection to the broker. Its + * lifetime controls the lifetime of the broker, regardless of whether the + * handle is closed. The handle should be closed before the resource is + * released. + */ +[macro="PPB_BROKER_TRUSTED_INTERFACE"] +interface PPB_BrokerTrusted { + /** + * Returns a trusted broker resource. + */ + PP_Resource CreateTrusted([in] PP_Instance instance); + + /** + * Returns true if the resource is a trusted broker. + */ + PP_Bool IsBrokerTrusted([in] PP_Resource resource); + + /** + * Connects to the trusted broker. It may have already + * been launched by another instance. + * The plugin takes ownership of the handle once the callback has been called + * with a result of PP_OK. The plugin should immediately call GetHandle and + * begin managing it. If the result is not PP_OK, the browser still owns the + * handle. + * + * Returns PP_ERROR_WOULD_BLOCK on success, and invokes + * the |connect_callback| asynchronously to complete. + * As this function should always be invoked from the main thread, + * do not use the blocking variant of PP_CompletionCallback. + * Returns PP_ERROR_FAILED if called from an in-process plugin. + */ + int32_t Connect([in] PP_Resource broker, + [in] PP_CompletionCallback connect_callback); + + /** + * Gets the handle to the pipe. Use once Connect has completed. Each instance + * of this interface has its own pipe. + * + * Returns PP_OK on success, and places the result into the given output + * parameter. The handle is only set when returning PP_OK. Calling this + * before connect has completed will return PP_ERROR_FAILED. + */ + int32_t GetHandle([in] PP_Resource broker, [out] int32_t handle); + + /** + * Returns PP_TRUE if the plugin has permission to launch the broker. A user + * must explicitly grant permission to launch the broker for a particular + * website. This is done through an infobar that is displayed when |Connect| + * is called. This function returns PP_TRUE if the user has already granted + * permission to launch the broker for the website containing this plugin + * instance. Returns PP_FALSE otherwise. + */ + [version=0.3] + PP_Bool IsAllowed([in] PP_Resource broker); +}; + diff --git a/browser/extensions/mortar/ppapi/api/trusted/ppb_browser_font_trusted.idl b/browser/extensions/mortar/ppapi/api/trusted/ppb_browser_font_trusted.idl new file mode 100644 index 000000000000..7a79417efce0 --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/trusted/ppb_browser_font_trusted.idl @@ -0,0 +1,261 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * This file defines the PPB_BrowserFont_Trusted interface. + */ +label Chrome { + M19 = 1.0 +}; + +[assert_size(4)] +enum PP_BrowserFont_Trusted_Family { + /** + * Uses the user's default web page font (normally either the default serif + * or sans serif font). + */ + PP_BROWSERFONT_TRUSTED_FAMILY_DEFAULT = 0, + + /** + * These families will use the default web page font corresponding to the + * given family. + */ + PP_BROWSERFONT_TRUSTED_FAMILY_SERIF = 1, + PP_BROWSERFONT_TRUSTED_FAMILY_SANSSERIF = 2, + PP_BROWSERFONT_TRUSTED_FAMILY_MONOSPACE = 3 +}; + +/** + * Specifies the font weight. Normally users will only use NORMAL or BOLD. + */ +[assert_size(4)] +enum PP_BrowserFont_Trusted_Weight { + PP_BROWSERFONT_TRUSTED_WEIGHT_100 = 0, + PP_BROWSERFONT_TRUSTED_WEIGHT_200 = 1, + PP_BROWSERFONT_TRUSTED_WEIGHT_300 = 2, + PP_BROWSERFONT_TRUSTED_WEIGHT_400 = 3, + PP_BROWSERFONT_TRUSTED_WEIGHT_500 = 4, + PP_BROWSERFONT_TRUSTED_WEIGHT_600 = 5, + PP_BROWSERFONT_TRUSTED_WEIGHT_700 = 6, + PP_BROWSERFONT_TRUSTED_WEIGHT_800 = 7, + PP_BROWSERFONT_TRUSTED_WEIGHT_900 = 8, + PP_BROWSERFONT_TRUSTED_WEIGHT_NORMAL = + PP_BROWSERFONT_TRUSTED_WEIGHT_400, + PP_BROWSERFONT_TRUSTED_WEIGHT_BOLD = + PP_BROWSERFONT_TRUSTED_WEIGHT_700 +}; + +[assert_size(48)] +struct PP_BrowserFont_Trusted_Description { + /** + * Font face name as a string. This can also be an undefined var, in which + * case the generic family will be obeyed. If the face is not available on + * the system, the browser will attempt to do font fallback or pick a default + * font. + */ + PP_Var face; + + /** + * When Create()ing a font and the face is an undefined var, the family + * specifies the generic font family type to use. If the face is specified, + * this will be ignored. + * + * When Describe()ing a font, the family will be the value you passed in when + * the font was created. In other words, if you specify a face name, the + * family will not be updated to reflect whether the font name you requested + * is serif or sans serif. + */ + PP_BrowserFont_Trusted_Family family; + + /** + * Size in pixels. + * + * You can specify 0 to get the default font size. The default font size + * may vary depending on the requested font. The typical example is that + * the user may have a different font size for the default monospace font to + * give it a similar optical size to the proportionally spaced fonts. + */ + uint32_t size; + + /** + * Normally you will use either normal or bold. + */ + PP_BrowserFont_Trusted_Weight weight; + + PP_Bool italic; + PP_Bool small_caps; + + /** + * Adjustment to apply to letter and word spacing, respectively. Initialize + * to 0 to get normal spacing. Negative values bring letters/words closer + * together, positive values separate them. + */ + int32_t letter_spacing; + int32_t word_spacing; + + /** + * Ensure that this struct is 48-bytes wide by padding the end. In some + * compilers, PP_Var is 8-byte aligned, so those compilers align this struct + * on 8-byte boundaries as well and pad it to 16 bytes even without this + * padding attribute. This padding makes its size consistent across + * compilers. + */ + int32_t padding; +}; + +[assert_size(20)] +struct PP_BrowserFont_Trusted_Metrics { + int32_t height; + int32_t ascent; + int32_t descent; + int32_t line_spacing; + int32_t x_height; +}; + +[assert_size(24)] +struct PP_BrowserFont_Trusted_TextRun { + /** + * This var must either be a string or a null/undefined var (which will be + * treated as a 0-length string). + */ + PP_Var text; + + /** + * Set to PP_TRUE if the text is right-to-left. + */ + PP_Bool rtl; + + /** + * Set to PP_TRUE to force the directionality of the text regardless of + * content + */ + PP_Bool override_direction; +}; + +/** + * Provides an interface for native browser text rendering. + * + * This API is "trusted" not for security reasons, but because it can not be + * implemented efficiently when running out-of-process in Browser Client. In + * this case, WebKit is in another process and every text call would require a + * synchronous IPC to the renderer. It is, however, available to native + * (non-NaCl) out-of-process PPAPI plugins since WebKit is available in the + * plugin process. + */ +interface PPB_BrowserFont_Trusted { + /** + * Returns a list of all available font families on the system. You can use + * this list to decide whether to Create() a font. + * + * The return value will be a single string with null characters delimiting + * the end of each font name. For example: "Arial\0Courier\0Times\0". + * + * Returns an undefined var on failure (this typically means you passed an + * invalid instance). + */ + PP_Var GetFontFamilies( + [in] PP_Instance instance); + + /** + * Returns a font which best matches the given description. The return value + * will have a non-zero ID on success, or zero on failure. + */ + PP_Resource Create( + [in] PP_Instance instance, + [in] PP_BrowserFont_Trusted_Description description); + + /** + * Returns PP_TRUE if the given resource is a Font. Returns PP_FALSE if the + * resource is invalid or some type other than a Font. + */ + PP_Bool IsFont( + [in] PP_Resource resource); + + /** + * Loads the description and metrics of the font into the given structures. + * The description will be different than the description the font was + * created with since it will be filled with the real values from the font + * that was actually selected. + * + * The PP_Var in the description should be of type Void on input. On output, + * this will contain the string and will have a reference count of 1. The + * plugin is responsible for calling Release on this var. + * + * Returns PP_TRUE on success, PP_FALSE if the font is invalid or if the Var + * in the description isn't Null (to prevent leaks). + */ + PP_Bool Describe( + [in] PP_Resource font, + [out] PP_BrowserFont_Trusted_Description description, + [out] PP_BrowserFont_Trusted_Metrics metrics); + + /** + * Draws the text to the image buffer. + * + * The given point represents the baseline of the left edge of the font, + * regardless of whether it is left-to-right or right-to-left (in the case of + * RTL text, this will actually represent the logical end of the text). + * + * The clip is optional and may be NULL. In this case, the text will be + * clipped to the image. + * + * The image_data_is_opaque flag indicates whether subpixel antialiasing can + * be performed, if it is supported. When the image below the text is + * opaque, subpixel antialiasing is supported and you should set this to + * PP_TRUE to pick up the user's default preferences. If your plugin is + * partially transparent, then subpixel antialiasing is not possible and + * grayscale antialiasing will be used instead (assuming the user has + * antialiasing enabled at all). + */ + PP_Bool DrawTextAt( + [in] PP_Resource font, + [in] PP_Resource image_data, + [in] PP_BrowserFont_Trusted_TextRun text, + [in] PP_Point position, + [in] uint32_t color, + [in] PP_Rect clip, + [in] PP_Bool image_data_is_opaque); + + /** + * Returns the width of the given string. If the font is invalid or the var + * isn't a valid string, this will return -1. + * + * Note that this function handles complex scripts such as Arabic, combining + * accents, etc. so that adding the width of substrings won't necessarily + * produce the correct width of the entire string. + * + * Returns -1 on failure. + */ + int32_t MeasureText( + [in] PP_Resource font, + [in] PP_BrowserFont_Trusted_TextRun text); + + /** + * Returns the character at the given pixel X position from the beginning of + * the string. This handles complex scripts such as Arabic, where characters + * may be combined or replaced depending on the context. Returns (uint32)-1 + * on failure. + * + * TODO(brettw) this function may be broken. See the CharPosRTL test. It + * seems to tell you "insertion point" rather than painting position. This + * is useful but maybe not what we intended here. + */ + uint32_t CharacterOffsetForPixel( + [in] PP_Resource font, + [in] PP_BrowserFont_Trusted_TextRun text, + [in] int32_t pixel_position); + + /** + * Returns the horizontal advance to the given character if the string was + * placed at the given position. This handles complex scripts such as Arabic, + * where characters may be combined or replaced depending on context. Returns + * -1 on error. + */ + int32_t PixelOffsetForCharacter( + [in] PP_Resource font, + [in] PP_BrowserFont_Trusted_TextRun text, + [in] uint32_t char_offset); +}; + diff --git a/browser/extensions/mortar/ppapi/api/trusted/ppb_char_set_trusted.idl b/browser/extensions/mortar/ppapi/api/trusted/ppb_char_set_trusted.idl new file mode 100644 index 000000000000..61bd8d500d83 --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/trusted/ppb_char_set_trusted.idl @@ -0,0 +1,95 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* + * This file defines the PPB_CharSet_Trusted interface. + */ + +label Chrome { + M18 = 1.0 +}; + +[assert_size(4)] enum PP_CharSet_Trusted_ConversionError { + /** + * Causes the entire conversion to fail if an error is encountered. The + * conversion function will return NULL. + */ + PP_CHARSET_TRUSTED_CONVERSIONERROR_FAIL, + + /** + * Silently skips over errors. Unrepresentable characters and input encoding + * errors will be removed from the output. + */ + PP_CHARSET_TRUSTED_CONVERSIONERROR_SKIP, + + /** + * Replaces the error or unrepresentable character with a substitution + * character. When converting to a Unicode character set (UTF-8 or UTF-16) it + * will use the unicode "substitution character" U+FFFD. When converting to + * another character set, the character will be charset-specific. For many + * languages this will be the representation of the '?' character. + */ + PP_CHARSET_TRUSTED_CONVERSIONERROR_SUBSTITUTE +}; + +/** + * The PPB_CharSet_Trusted interface provides functions for + * converting between character sets. + * + * This inteface is provided for trusted plugins only since in Native Client it + * would require an expensive out-of-process IPC call for each conversion, + * which makes performance unacceptable. Native Client plugins should include + * ICU or some other library if they need this feature. + */ +interface PPB_CharSet_Trusted { + /** + * Converts the UTF-16 string pointed to by |*utf16| to an 8-bit string in + * the specified code page. |utf16_len| is measured in UTF-16 units, not + * bytes. This value may not be NULL. + * + * The given output buffer will be filled up to output_length bytes with the + * result. output_length will be updated with the number of bytes required + * for the given string. The output buffer may be null to just retrieve the + * required buffer length. + * + * This function will return PP_FALSE if there was an error converting the + * string and you requested PP_CHARSET_CONVERSIONERROR_FAIL, or the output + * character set was unknown. Otherwise, it will return PP_TRUE. + */ + PP_Bool UTF16ToCharSet([in, size_as=utf16_len] uint16_t[] utf16, + [in] uint32_t utf16_len, + [in] str_t output_char_set, + [in] PP_CharSet_Trusted_ConversionError on_error, + [out] str_t output_buffer, + [inout] uint32_t output_length); + + /** + * Same as UTF16ToCharSet except converts in the other direction. The input + * is in the given charset, and the |input_len| is the number of bytes in + * the |input| string. + * + * Note that the output_utf16_length is measured in UTF-16 characters. + * + * Since UTF16 can represent every Unicode character, the only time the + * replacement character will be used is if the encoding in the input string + * is incorrect. + */ + PP_Bool CharSetToUTF16([in] str_t input, + [in] uint32_t input_len, + [in] str_t input_char_set, + [in] PP_CharSet_Trusted_ConversionError on_error, + [out] uint16_t output_buffer, + [inout] uint32_t output_utf16_length); + + /** + * Returns a string var representing the current multi-byte character set of + * the current system. + * + * WARNING: You really shouldn't be using this function unless you're dealing + * with legacy data. You should be using UTF-8 or UTF-16 and you don't have + * to worry about the character sets. + */ + PP_Var GetDefaultCharSet([in] PP_Instance instance); +}; diff --git a/browser/extensions/mortar/ppapi/api/trusted/ppb_file_chooser_trusted.idl b/browser/extensions/mortar/ppapi/api/trusted/ppb_file_chooser_trusted.idl new file mode 100644 index 000000000000..0a0ae6bd98b7 --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/trusted/ppb_file_chooser_trusted.idl @@ -0,0 +1,71 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + + +/** + * This file defines the PPB_FileChooser_Trusted interface. + */ + +[generate_thunk] + +label Chrome { + M16 = 0.5, + M20 = 0.6 +}; + +[macro="PPB_FILECHOOSER_TRUSTED_INTERFACE"] +interface PPB_FileChooserTrusted { + /** + * This function displays a previously created file chooser resource as a + * dialog box, prompting the user to choose a file or files to open, or a + * single file for saving. The callback is called with PP_OK on successful + * completion with a file (or files) selected or PP_ERROR_USERCANCEL if the + * user selected no file. + * + * @param[in] chooser The file chooser resource. + * @param[in] save_as A PP_Bool value indicating if this dialog + * is choosing a file for saving. + * @param[in] suggested_file_name If saving, the suggested name for the + * file, otherwise, null or undefined. + * @param[in] callback A CompletionCallback to be called after + * the user has closed the file chooser dialog. + * + * @return PP_OK_COMPLETIONPENDING if request to show the dialog was + * successful, another error code from pp_errors.h on failure. + */ + [deprecate=0.6] + int32_t ShowWithoutUserGesture( + [in] PP_Resource chooser, + [in] PP_Bool save_as, + [in] PP_Var suggested_file_name, + [in] PP_CompletionCallback callback); + + /** + * This function displays a previously created file chooser resource as a + * dialog box, prompting the user to choose a file or files to open, or a + * single file for saving. The callback is called with PP_OK on successful + * completion with a file (or files) selected or PP_ERROR_USERCANCEL if the + * user selected no file. + * + * @param[in] chooser The file chooser resource. + * @param[in] save_as A PP_Bool value indicating if this dialog + * is choosing a file for saving. + * @param[in] suggested_file_name If saving, the suggested name for the + * file, otherwise, null or undefined. + * @param[in] callback A CompletionCallback to be called after + * the user has closed the file chooser dialog. + * + * @return PP_OK_COMPLETIONPENDING if request to show the dialog was + * successful, another error code from pp_errors.h on failure. + */ + [version=0.6] + int32_t ShowWithoutUserGesture( + [in] PP_Resource chooser, + [in] PP_Bool save_as, + [in] PP_Var suggested_file_name, + [in] PP_ArrayOutput output, + [in] PP_CompletionCallback callback); +}; + diff --git a/browser/extensions/mortar/ppapi/api/trusted/ppb_url_loader_trusted.idl b/browser/extensions/mortar/ppapi/api/trusted/ppb_url_loader_trusted.idl new file mode 100644 index 000000000000..bb602910f490 --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/trusted/ppb_url_loader_trusted.idl @@ -0,0 +1,51 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* URL loader trusted interfaces. */ + +[generate_thunk] + +label Chrome { + M14 = 0.3 +}; + +/** + * Callback that indicates the status of the download and upload for the + * given URLLoader resource. + */ +typedef void PP_URLLoaderTrusted_StatusCallback( + [in] PP_Instance pp_instance, + [in] PP_Resource pp_resource, + [in] int64_t bytes_sent, + [in] int64_t total_bytes_to_be_sent, + [in] int64_t bytes_received, + [in] int64_t total_bytes_to_be_received); + +/* Available only to trusted implementations. */ +interface PPB_URLLoaderTrusted { + /** + * Grant this URLLoader the capability to make unrestricted cross-origin + * requests. + */ + void GrantUniversalAccess([in] PP_Resource loader); + + /** + * Registers that the given function will be called when the upload or + * downloaded byte count has changed. This is not exposed on the untrusted + * interface because it can be quite chatty and encourages people to write + * feedback UIs that update as frequently as the progress updates. + * + * The other serious gotcha with this callback is that the callback must not + * mutate the URL loader or cause it to be destroyed. + * + * However, the proxy layer needs this information to push to the other + * process, so we expose it here. Only one callback can be set per URL + * Loader. Setting to a NULL callback will disable it. + */ + void RegisterStatusCallback( + [in] PP_Resource loader, + [in] PP_URLLoaderTrusted_StatusCallback cb); +}; + diff --git a/browser/extensions/mortar/ppapi/api/trusted/ppp_broker.idl b/browser/extensions/mortar/ppapi/api/trusted/ppp_broker.idl new file mode 100644 index 000000000000..a9dc4fabad3e --- /dev/null +++ b/browser/extensions/mortar/ppapi/api/trusted/ppp_broker.idl @@ -0,0 +1,94 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * This file defines functions that your module must implement to support a + * broker. + */ + +#inline c +// {PENDING: undefine PP_EXPORT?} + +#include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_stdint.h" + + +#if __GNUC__ >= 4 + +#define PP_EXPORT __attribute__ ((visibility("default"))) +#elif defined(_MSC_VER) +#define PP_EXPORT __declspec(dllexport) +#endif + + + +/* We don't want name mangling for these external functions. We only need + * 'extern "C"' if we're compiling with a C++ compiler. + */ +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @addtogroup Typedefs + * @{ + */ + +/** + * PP_ConnectInstance_Func defines the signature that you implement to + * receive notifications when a plugin instance connects to the broker. + * The broker should listen on the socket before returning. + * + * @param[in] instance The plugin instance connecting to the broker. + * @param[in] handle Handle to a socket the broker can use to communicate with + * the plugin. + * @return PP_OK on success. Any other value on failure. + */ +typedef int32_t (*PP_ConnectInstance_Func)(PP_Instance instance, + int32_t handle); +/** + * @} + */ + +/** + * @addtogroup Functions + * @{ + */ + +/** + * PPP_InitializeBroker() is the entry point for a broker and is + * called by the browser when your module loads. Your code must implement this + * function. + * + * Failure indicates to the browser that this broker can not be used. In this + * case, the broker will be unloaded. + * + * @param[out] connect_instance_func A pointer to a connect instance function. + * @return PP_OK on success. Any other value on failure. +*/ +PP_EXPORT int32_t PPP_InitializeBroker( + PP_ConnectInstance_Func* connect_instance_func); +/** + * @} + */ + +/** + * @addtogroup Functions + * @{ + */ + +/** PPP_ShutdownBroker() is called before the broker is unloaded. + */ +PP_EXPORT void PPP_ShutdownBroker(); +/** + * @} + */ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endinl + diff --git a/browser/extensions/mortar/ppapi/c/pp_graphics_3d.h b/browser/extensions/mortar/ppapi/c/pp_graphics_3d.h new file mode 100644 index 000000000000..b5e6ddb9fd16 --- /dev/null +++ b/browser/extensions/mortar/ppapi/c/pp_graphics_3d.h @@ -0,0 +1,3 @@ +// This file is empty on purpose since it is included in +// ppapi/api/ppb_graphics_3d.idl. And we would like to keep the differences +// small with chromium's idl. diff --git a/browser/extensions/mortar/ppapi/c/pp_instance.h b/browser/extensions/mortar/ppapi/c/pp_instance.h new file mode 100644 index 000000000000..7e6fd1ec6b83 --- /dev/null +++ b/browser/extensions/mortar/ppapi/c/pp_instance.h @@ -0,0 +1,3 @@ +// This file is empty on purpose since it is included in +// ppapi/api/trusted/ppp_broker.idl. And we would like to keep the differences +// small with chromium's idl. diff --git a/browser/extensions/mortar/ppapi/c/pp_module.h b/browser/extensions/mortar/ppapi/c/pp_module.h new file mode 100644 index 000000000000..31874722e4f6 --- /dev/null +++ b/browser/extensions/mortar/ppapi/c/pp_module.h @@ -0,0 +1,2 @@ +// This file is empty on purpose since it is included in ppapi/api/ppp.idl. +// And we would like to keep the differences small with chromium's idl. diff --git a/browser/extensions/mortar/ppapi/c/pp_resource.h b/browser/extensions/mortar/ppapi/c/pp_resource.h new file mode 100644 index 000000000000..cbaa7bfde93e --- /dev/null +++ b/browser/extensions/mortar/ppapi/c/pp_resource.h @@ -0,0 +1,3 @@ +// This file is empty on purpose since it is included in +// ppapi/api/dev/ppb_opengles2ext_dev.idl and ppapi/api/ppb_opengles2.idl. +// And we would like to keep the differences small with chromium's idl. diff --git a/browser/extensions/mortar/ppapi/c/pp_stdint.h b/browser/extensions/mortar/ppapi/c/pp_stdint.h new file mode 100644 index 000000000000..6b8fd7467f16 --- /dev/null +++ b/browser/extensions/mortar/ppapi/c/pp_stdint.h @@ -0,0 +1,3 @@ +// This file is empty on purpose since it is included in ppapi/api/ppp.idl and +// ppapi/api/trusted/ppp_broker.idl. And we would like to keep the differences +// small with chromium's idl. diff --git a/browser/extensions/mortar/ppapi/c/ppb.h b/browser/extensions/mortar/ppapi/c/ppb.h new file mode 100644 index 000000000000..31874722e4f6 --- /dev/null +++ b/browser/extensions/mortar/ppapi/c/ppb.h @@ -0,0 +1,2 @@ +// This file is empty on purpose since it is included in ppapi/api/ppp.idl. +// And we would like to keep the differences small with chromium's idl. diff --git a/browser/extensions/mortar/ppapi/c/ppb_opengles2.h b/browser/extensions/mortar/ppapi/c/ppb_opengles2.h new file mode 100644 index 000000000000..065420f0ba68 --- /dev/null +++ b/browser/extensions/mortar/ppapi/c/ppb_opengles2.h @@ -0,0 +1,3 @@ +// This file is empty on purpose since it is included in +// ppapi/api/dev/ppb_opengles2ext_dev.idl. And we would like to keep the +// differences small with chromium's idl. diff --git a/browser/extensions/mortar/ppapi/c/private/pp_file_handle.h b/browser/extensions/mortar/ppapi/c/private/pp_file_handle.h new file mode 100644 index 000000000000..575c4a926a16 --- /dev/null +++ b/browser/extensions/mortar/ppapi/c/private/pp_file_handle.h @@ -0,0 +1,4 @@ +// This file is empty on purpose since it is included in +// ppapi/api/private/ppb_file_io_private.idl and +// ppapi/api/private/ppp_pexe_stream_handler.idl. And we would like to keep the +// differences small with chromium's idl. diff --git a/browser/extensions/mortar/ppapi/generators/OWNERS b/browser/extensions/mortar/ppapi/generators/OWNERS new file mode 100644 index 000000000000..c3be9543d989 --- /dev/null +++ b/browser/extensions/mortar/ppapi/generators/OWNERS @@ -0,0 +1,5 @@ +yzshen@chromium.org +noelallen@chromium.org +noelallen@google.com +sehr@google.com +sehr@chromium.org diff --git a/browser/extensions/mortar/ppapi/generators/generator.py b/browser/extensions/mortar/ppapi/generators/generator.py new file mode 100755 index 000000000000..a71893c792b5 --- /dev/null +++ b/browser/extensions/mortar/ppapi/generators/generator.py @@ -0,0 +1,57 @@ +#!/usr/bin/env python +# Copyright (c) 2012 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import os +import sys +import traceback + +# Note: some of these files are imported to register cmdline options. +from idl_generator import Generator +from idl_option import ParseOptions +from idl_outfile import IDLOutFile +from idl_parser import ParseFiles +from idl_c_header import HGen +from idl_thunk import TGen +from idl_gen_pnacl import PnaclGen + + +def Main(args): + # If no arguments are provided, assume we are trying to rebuild the + # C headers with warnings off. + try: + if not args: + args = [ + '--wnone', '--cgen', '--range=start,end', + '--pnacl', '--pnaclshim', + '../native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c', + '--tgen', + ] + current_dir = os.path.abspath(os.getcwd()) + script_dir = os.path.abspath(os.path.dirname(__file__)) + if current_dir != script_dir: + print '\nIncorrect CWD, default run skipped.' + print 'When running with no arguments set CWD to the scripts directory:' + print '\t' + script_dir + '\n' + print 'This ensures correct default paths and behavior.\n' + return 1 + + filenames = ParseOptions(args) + ast = ParseFiles(filenames) + if ast.errors: + print 'Found %d errors. Aborting build.\n' % ast.errors + return 1 + return Generator.Run(ast) + except SystemExit, ec: + print 'Exiting with %d' % ec.code + sys.exit(ec.code) + + except: + typeinfo, value, tb = sys.exc_info() + traceback.print_exception(typeinfo, value, tb) + print 'Called with: ' + ' '.join(sys.argv) + + +if __name__ == '__main__': + sys.exit(Main(sys.argv[1:])) diff --git a/browser/extensions/mortar/ppapi/generators/idl_ast.py b/browser/extensions/mortar/ppapi/generators/idl_ast.py new file mode 100644 index 000000000000..515dbb0c128d --- /dev/null +++ b/browser/extensions/mortar/ppapi/generators/idl_ast.py @@ -0,0 +1,182 @@ +# Copyright (c) 2012 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +"""Nodes for PPAPI IDL AST.""" + +from idl_namespace import IDLNamespace +from idl_node import IDLNode +from idl_option import GetOption +from idl_visitor import IDLVisitor +from idl_release import IDLReleaseMap + +# +# IDLLabelResolver +# +# A specialized visitor which traverses the AST, building a mapping of +# Release names to Versions numbers and calculating a min version. +# The mapping is applied to the File nodes within the AST. +# +class IDLLabelResolver(IDLVisitor): + def Depart(self, node, ignore, childdata): + # Build list of Release=Version + if node.IsA('LabelItem'): + channel = node.GetProperty('channel') + if not channel: + channel = 'stable' + return (node.GetName(), node.GetProperty('VALUE'), channel) + + # On completion of the Label, apply to the parent File if the + # name of the label matches the generation label. + if node.IsA('Label') and node.GetName() == GetOption('label'): + try: + node.parent.release_map = IDLReleaseMap(childdata) + except Exception as err: + node.Error('Unable to build release map: %s' % str(err)) + + # For File objects, set the minimum version + if node.IsA('File'): + file_min, _ = node.release_map.GetReleaseRange() + node.SetMin(file_min) + + return None + + +# +# IDLNamespaceVersionResolver +# +# A specialized visitor which traverses the AST, building a namespace tree +# as it goes. The namespace tree is mapping from a name to a version list. +# Labels must already be resolved to use. +# +class IDLNamespaceVersionResolver(IDLVisitor): + NamespaceSet = set(['AST', 'Callspec', 'Interface', 'Member', 'Struct']) + # + # When we arrive at a node we must assign it a namespace and if the + # node is named, then place it in the appropriate namespace. + # + def Arrive(self, node, parent_namespace): + # If we are a File, grab the Min version and replease mapping + if node.IsA('File'): + self.rmin = node.GetMinMax()[0] + self.release_map = node.release_map + + # Set the min version on any non Label within the File + if not node.IsA('AST', 'File', 'Label', 'LabelItem'): + my_min, _ = node.GetMinMax() + if not my_min: + node.SetMin(self.rmin) + + # If this object is not a namespace aware object, use the parent's one + if node.cls not in self.NamespaceSet: + node.namespace = parent_namespace + else: + # otherwise create one. + node.namespace = IDLNamespace(parent_namespace) + + # If this node is named, place it in its parent's namespace + if parent_namespace and node.cls in IDLNode.NamedSet: + # Set version min and max based on properties + if self.release_map: + vmin = node.GetProperty('dev_version') + if vmin == None: + vmin = node.GetProperty('version') + vmax = node.GetProperty('deprecate') + # If no min is available, the use the parent File's min + if vmin == None: + rmin = self.rmin + else: + rmin = self.release_map.GetRelease(vmin) + rmax = self.release_map.GetRelease(vmax) + node.SetReleaseRange(rmin, rmax) + parent_namespace.AddNode(node) + + # Pass this namespace to each child in case they inherit it + return node.namespace + + +# +# IDLFileTypeRessolver +# +# A specialized visitor which traverses the AST and sets a FILE property +# on all file nodes. In addition, searches the namespace resolving all +# type references. The namespace tree must already have been populated +# before this visitor is used. +# +class IDLFileTypeResolver(IDLVisitor): + def VisitFilter(self, node, data): + return not node.IsA('Comment', 'Copyright') + + def Arrive(self, node, filenode): + # Track the file node to update errors + if node.IsA('File'): + node.SetProperty('FILE', node) + filenode = node + + if not node.IsA('AST'): + file_min, _ = filenode.release_map.GetReleaseRange() + if not file_min: + print 'Resetting min on %s to %s' % (node, file_min) + node.SetMinRange(file_min) + + # If this node has a TYPEREF, resolve it to a version list + typeref = node.GetPropertyLocal('TYPEREF') + if typeref: + node.typelist = node.parent.namespace.FindList(typeref) + if not node.typelist: + node.Error('Could not resolve %s.' % typeref) + else: + node.typelist = None + return filenode + +# +# IDLReleaseResolver +# +# A specialized visitor which will traverse the AST, and generate a mapping +# from any release to the first release in which that version of the object +# was generated. Types must already be resolved to use. +# +class IDLReleaseResolver(IDLVisitor): + def Arrive(self, node, releases): + node.BuildReleaseMap(releases) + return releases + + +# +# IDLAst +# +# A specialized version of the IDLNode for containing the whole of the +# AST. Construction of the AST object will cause resolution of the +# tree including versions, types, etc... Errors counts will be collected +# both per file, and on the AST itself. +# +class IDLAst(IDLNode): + def __init__(self, children): + IDLNode.__init__(self, 'AST', 'BuiltIn', 1, 0, children) + self.Resolve() + + def Resolve(self): + # Set the appropriate Release=Version mapping for each File + IDLLabelResolver().Visit(self, None) + + # Generate the Namesapce Tree + self.namespace = IDLNamespace(None) + IDLNamespaceVersionResolver().Visit(self, self.namespace) + + # Using the namespace, resolve type references + IDLFileTypeResolver().Visit(self, None) + + # Build an ordered list of all releases + releases = set() + for filenode in self.GetListOf('File'): + releases |= set(filenode.release_map.GetReleases()) + + # Generate a per node list of releases and release mapping + IDLReleaseResolver().Visit(self, sorted(releases)) + + for filenode in self.GetListOf('File'): + errors = filenode.GetProperty('ERRORS') + if errors: + self.errors += errors + + diff --git a/browser/extensions/mortar/ppapi/generators/idl_c_header.py b/browser/extensions/mortar/ppapi/generators/idl_c_header.py new file mode 100755 index 000000000000..b4b98227df4c --- /dev/null +++ b/browser/extensions/mortar/ppapi/generators/idl_c_header.py @@ -0,0 +1,374 @@ +#!/usr/bin/env python +# Copyright (c) 2012 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" Generator for C style prototypes and definitions """ + +import glob +import os +import re +import sys + +from idl_log import ErrOut, InfoOut, WarnOut +from idl_node import IDLAttribute, IDLNode +from idl_ast import IDLAst +from idl_option import GetOption, Option, ParseOptions +from idl_outfile import IDLOutFile +from idl_parser import ParseFiles +from idl_c_proto import CGen, GetNodeComments, CommentLines, Comment +from idl_generator import Generator, GeneratorByFile +from idl_visitor import IDLVisitor + +Option('dstroot', 'Base directory of output', default=os.path.join('..', 'c')) +Option('guard', 'Include guard prefix', default=os.path.join('ppapi', 'c')) + + +# +# PrototypeResolver +# +# A specialized visitor which traverses the AST, building a mapping of +# Release names to Versions numbers and calculating a min version. +# The mapping is applied to the File nodes within the AST. +# +class ProtoResolver(IDLVisitor): + def __init__(self): + IDLVisitor.__init__(self) + self.struct_map = {} + self.interface_map = {} + + def Arrive(self, node, ignore): + if node.IsA('Member') and node.GetProperty('ref'): + typeref = node.typelist.GetReleases()[0] + if typeref.IsA('Struct'): + nodelist = self.struct_map.get(typeref.GetName(), []) + nodelist.append(node) + self.struct_map[typeref.GetName()] = nodelist + + if node.IsA('Param'): + typeref = node.typelist.GetReleases()[0] + if typeref.IsA('Interface'): + nodelist = self.struct_map.get(typeref.GetName(), []) + nodelist.append(node) + self.interface_map[typeref.GetName()] = nodelist + + return None + + +def GetPathFromNode(filenode, relpath=None, ext=None): + path, name = os.path.split(filenode.GetProperty('NAME')) + if ext: name = os.path.splitext(name)[0] + ext + if path: name = os.path.join(path, name) + if relpath: name = os.path.join(relpath, name) + name = os.path.normpath(name) + return name + + +def GetHeaderFromNode(filenode, relpath=None): + return GetPathFromNode(filenode, relpath, ext='.h') + + +def WriteGroupMarker(out, node, last_group): + # If we are part of a group comment marker... + if last_group and last_group != node.cls: + pre = CommentLines(['*',' @}', '']) + '\n' + else: + pre = '\n' + + if node.cls in ['Typedef', 'Interface', 'Struct', 'Enum']: + if last_group != node.cls: + pre += CommentLines(['*',' @addtogroup %ss' % node.cls, ' @{', '']) + last_group = node.cls + else: + last_group = None + out.Write(pre) + return last_group + + +def GenerateHeader(out, filenode, releases): + cgen = CGen() + pref = '' + do_comments = True + + # Generate definitions. + last_group = None + top_types = ['Typedef', 'Interface', 'Struct', 'Enum', 'Inline'] + for node in filenode.GetListOf(*top_types): + # Skip if this node is not in this release + if not node.InReleases(releases): + print "Skiping %s" % node + continue + + # End/Start group marker + if do_comments: + last_group = WriteGroupMarker(out, node, last_group) + + if node.IsA('Inline'): + item = node.GetProperty('VALUE') + # If 'C++' use __cplusplus wrapper + if node.GetName() == 'cc': + item = '#ifdef __cplusplus\n%s\n#endif /* __cplusplus */\n\n' % item + # If not C++ or C, then skip it + elif not node.GetName() == 'c': + continue + if item: out.Write(item) + continue + + # + # Otherwise we are defining a file level object, so generate the + # correct document notation. + # + item = cgen.Define(node, releases, prefix=pref, comment=True) + if not item: continue + asize = node.GetProperty('assert_size()') + if asize: + name = '%s%s' % (pref, node.GetName()) + if node.IsA('Struct'): + form = 'PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(%s, %s);\n' + elif node.IsA('Enum'): + if node.GetProperty('notypedef'): + form = 'PP_COMPILE_ASSERT_ENUM_SIZE_IN_BYTES(%s, %s);\n' + else: + form = 'PP_COMPILE_ASSERT_SIZE_IN_BYTES(%s, %s);\n' + else: + form = 'PP_COMPILE_ASSERT_SIZE_IN_BYTES(%s, %s);\n' + item += form % (name, asize[0]) + + if item: out.Write(item) + if last_group: + out.Write(CommentLines(['*',' @}', '']) + '\n') + + +def CheckTypedefs(filenode, releases): + """Checks that typedefs don't specify callbacks that take some structs. + + See http://crbug.com/233439 for details. + """ + cgen = CGen() + for node in filenode.GetListOf('Typedef'): + build_list = node.GetUniqueReleases(releases) + callnode = node.GetOneOf('Callspec') + if callnode: + for param in callnode.GetListOf('Param'): + if param.GetListOf('Array'): + continue + if cgen.GetParamMode(param) != 'in': + continue + t = param.GetType(build_list[0]) + while t.IsA('Typedef'): + t = t.GetType(build_list[0]) + if t.IsA('Struct') and t.GetProperty('passByValue'): + raise Exception('%s is a struct in callback %s. ' + 'See http://crbug.com/233439' % + (t.GetName(), node.GetName())) + + +def CheckPassByValue(filenode, releases): + """Checks that new pass-by-value structs are not introduced. + + See http://crbug.com/233439 for details. + """ + cgen = CGen() + # DO NOT add any more entries to this whitelist. + # http://crbug.com/233439 + type_whitelist = ['PP_ArrayOutput', 'PP_CompletionCallback', + 'PP_Ext_EventListener', 'PP_FloatPoint', + 'PP_Point', 'PP_TouchPoint', 'PP_Var'] + nodes_to_check = filenode.GetListOf('Struct') + nodes_to_check.extend(filenode.GetListOf('Union')) + for node in nodes_to_check: + if node.GetName() in type_whitelist: + continue + build_list = node.GetUniqueReleases(releases) + if node.GetProperty('passByValue'): + raise Exception('%s is a new passByValue struct or union. ' + 'See http://crbug.com/233439' % node.GetName()) + if node.GetProperty('returnByValue'): + raise Exception('%s is a new returnByValue struct or union. ' + 'See http://crbug.com/233439' % node.GetName()) + + +class HGen(GeneratorByFile): + def __init__(self): + Generator.__init__(self, 'C Header', 'cgen', 'Generate the C headers.') + + def GenerateFile(self, filenode, releases, options): + CheckTypedefs(filenode, releases) + CheckPassByValue(filenode, releases) + savename = GetHeaderFromNode(filenode, GetOption('dstroot')) + my_min, my_max = filenode.GetMinMax(releases) + if my_min > releases[-1] or my_max < releases[0]: + if os.path.isfile(savename): + print "Removing stale %s for this range." % filenode.GetName() + os.remove(os.path.realpath(savename)) + return False + + out = IDLOutFile(savename) + self.GenerateHead(out, filenode, releases, options) + self.GenerateBody(out, filenode, releases, options) + self.GenerateTail(out, filenode, releases, options) + return out.Close() + + def GenerateHead(self, out, filenode, releases, options): + __pychecker__ = 'unusednames=options' + + proto = ProtoResolver() + proto.Visit(filenode, None) + + cgen = CGen() + gpath = GetOption('guard') + def_guard = GetHeaderFromNode(filenode, relpath=gpath) + def_guard = def_guard.replace(os.sep,'_').replace('.','_').upper() + '_' + + cright_node = filenode.GetChildren()[0] + assert(cright_node.IsA('Copyright')) + fileinfo = filenode.GetChildren()[1] + assert(fileinfo.IsA('Comment')) + + out.Write('%s\n' % cgen.Copyright(cright_node)) + + # Wrap the From ... modified ... comment if it would be >80 characters. + from_text = 'From %s' % GetPathFromNode(filenode).replace(os.sep, '/') + modified_text = 'modified %s.' % ( + filenode.GetProperty('DATETIME')) + if len(from_text) + len(modified_text) < 74: + out.Write('/* %s %s */\n\n' % (from_text, modified_text)) + else: + out.Write('/* %s,\n * %s\n */\n\n' % (from_text, modified_text)) + + out.Write('#ifndef %s\n#define %s\n\n' % (def_guard, def_guard)) + # Generate set of includes + + deps = set() + for release in releases: + deps |= filenode.GetDeps(release) + + includes = set([]) + for dep in deps: + depfile = dep.GetProperty('FILE') + if depfile: + includes.add(depfile) + includes = [GetHeaderFromNode( + include, relpath=gpath).replace(os.sep, '/') for include in includes] + includes.append('ppapi/c/pp_macros.h') + + # Assume we need stdint if we "include" C or C++ code + if filenode.GetListOf('Include'): + includes.append('ppapi/c/pp_stdint.h') + + includes = sorted(set(includes)) + cur_include = GetHeaderFromNode(filenode, + relpath=gpath).replace(os.sep, '/') + for include in includes: + if include == cur_include: continue + out.Write('#include "%s"\n' % include) + + # Generate Prototypes + if proto.struct_map: + out.Write('\n/* Struct prototypes */\n') + for struct in proto.struct_map: + out.Write('struct %s;\n' % struct) + + # Create a macro for the highest available release number. + if filenode.GetProperty('NAME').endswith('pp_macros.idl'): + releasestr = ' '.join(releases) + if releasestr: + release_numbers = re.findall('[\d\_]+', releasestr) + release = re.findall('\d+', release_numbers[-1])[0] + if release: + out.Write('\n#define PPAPI_RELEASE %s\n' % release) + + # Generate all interface defines + out.Write('\n') + for node in filenode.GetListOf('Interface'): + idefs = '' + macro = cgen.GetInterfaceMacro(node) + unique = node.GetUniqueReleases(releases) + + # Skip this interface if there are no matching versions + if not unique: continue + + # Skip this interface if it should have no interface string. + if node.GetProperty('no_interface_string'): continue + + last_stable_ver = None + last_dev_rel = None + for rel in unique: + channel = node.GetProperty('FILE').release_map.GetChannel(rel) + if channel == 'dev': + last_dev_rel = rel + + for rel in unique: + version = node.GetVersion(rel) + name = cgen.GetInterfaceString(node, version) + strver = str(version).replace('.', '_') + channel = node.GetProperty('FILE').release_map.GetChannel(rel) + if channel == 'dev': + # Skip dev channel interface versions that are + # Not the newest version, and + # Don't have an equivalent stable version. + if rel != last_dev_rel and not node.DevInterfaceMatchesStable(rel): + continue + value_string = '"%s" /* dev */' % name + else: + value_string = '"%s"' % name + last_stable_ver = strver + idefs += cgen.GetDefine('%s_%s' % (macro, strver), value_string) + if last_stable_ver: + idefs += cgen.GetDefine(macro, '%s_%s' % (macro, last_stable_ver)) + idefs += '\n' + + out.Write(idefs) + + # Generate the @file comment + out.Write('%s\n' % Comment(fileinfo, prefix='*\n @file')) + + def GenerateBody(self, out, filenode, releases, options): + __pychecker__ = 'unusednames=options' + GenerateHeader(out, filenode, releases) + + def GenerateTail(self, out, filenode, releases, options): + __pychecker__ = 'unusednames=options,releases' + gpath = GetOption('guard') + def_guard = GetPathFromNode(filenode, relpath=gpath, ext='.h') + def_guard = def_guard.replace(os.sep,'_').replace('.','_').upper() + '_' + out.Write('#endif /* %s */\n\n' % def_guard) + + +hgen = HGen() + +def main(args): + # Default invocation will verify the golden files are unchanged. + failed = 0 + if not args: + args = ['--wnone', '--diff', '--test', '--dstroot=.'] + + ParseOptions(args) + + idldir = os.path.split(sys.argv[0])[0] + idldir = os.path.join(idldir, 'test_cgen', '*.idl') + filenames = glob.glob(idldir) + ast = ParseFiles(filenames) + if hgen.GenerateRelease(ast, 'M14', {}): + print "Golden file for M14 failed." + failed = 1 + else: + print "Golden file for M14 passed." + + + idldir = os.path.split(sys.argv[0])[0] + idldir = os.path.join(idldir, 'test_cgen_range', '*.idl') + filenames = glob.glob(idldir) + + ast = ParseFiles(filenames) + if hgen.GenerateRange(ast, ['M13', 'M14', 'M15', 'M16', 'M17'], {}): + print "Golden file for M13-M17 failed." + failed =1 + else: + print "Golden file for M13-M17 passed." + + return failed + +if __name__ == '__main__': + sys.exit(main(sys.argv[1:])) + diff --git a/browser/extensions/mortar/ppapi/generators/idl_c_proto.py b/browser/extensions/mortar/ppapi/generators/idl_c_proto.py new file mode 100755 index 000000000000..60b83084806f --- /dev/null +++ b/browser/extensions/mortar/ppapi/generators/idl_c_proto.py @@ -0,0 +1,822 @@ +#!/usr/bin/env python +# Copyright (c) 2012 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" Generator for C style prototypes and definitions """ + +import glob +import os +import sys + +from idl_log import ErrOut, InfoOut, WarnOut +from idl_node import IDLNode +from idl_ast import IDLAst +from idl_option import GetOption, Option, ParseOptions +from idl_parser import ParseFiles + +Option('cgen_debug', 'Debug generate.') + +class CGenError(Exception): + def __init__(self, msg): + self.value = msg + + def __str__(self): + return repr(self.value) + + +def CommentLines(lines, tabs=0): + # Generate a C style comment block by prepending the block with '/*' + # and adding a ' *' per line. + tab = ' ' * tabs + + out = '%s/*' % tab + ('\n%s *' % tab).join(lines) + + # Add a terminating ' */' unless the last line is blank which would mean it + # already has ' *' + if not lines[-1]: + out += '/\n' + else: + out += ' */\n' + return out + +def Comment(node, prefix=None, tabs=0): + # Generate a comment block from the provided Comment node. + comment = node.GetName() + lines = comment.split('\n') + + # If an option prefix is provided, then prepend that to the comment + # for this node. + if prefix: + prefix_lines = prefix.split('\n') + # If both the prefix and comment start with a blank line ('*') remove + # the extra one. + if prefix_lines[0] == '*' and lines[0] == '*': + lines = prefix_lines + lines[1:] + else: + lines = prefix_lines + lines; + return CommentLines(lines, tabs) + +def GetNodeComments(node, tabs=0): + # Generate a comment block joining all comment nodes which are children of + # the provided node. + comment_txt = '' + for doc in node.GetListOf('Comment'): + comment_txt += Comment(doc, tabs=tabs) + return comment_txt + + +class CGen(object): + # TypeMap + # + # TypeMap modifies how an object is stored or passed, for example pointers + # are passed as 'const' if they are 'in' parameters, and structures are + # preceeded by the keyword 'struct' as well as using a pointer. + # + TypeMap = { + 'Array': { + 'in': 'const %s', + 'inout': '%s', + 'out': '%s*', + 'store': '%s', + 'return': '%s', + 'ref': '%s*' + }, + 'Callspec': { + 'in': '%s', + 'inout': '%s', + 'out': '%s', + 'store': '%s', + 'return': '%s' + }, + 'Enum': { + 'in': '%s', + 'inout': '%s*', + 'out': '%s*', + 'store': '%s', + 'return': '%s' + }, + 'Interface': { + 'in': 'const %s*', + 'inout': '%s*', + 'out': '%s**', + 'return': '%s*', + 'store': '%s*' + }, + 'Struct': { + 'in': 'const %s*', + 'inout': '%s*', + 'out': '%s*', + 'return': ' %s*', + 'store': '%s', + 'ref': '%s*' + }, + 'blob_t': { + 'in': 'const %s', + 'inout': '%s', + 'out': '%s', + 'return': '%s', + 'store': '%s' + }, + 'mem_t': { + 'in': 'const %s', + 'inout': '%s', + 'out': '%s', + 'return': '%s', + 'store': '%s' + }, + 'mem_ptr_t': { + 'in': 'const %s', + 'inout': '%s', + 'out': '%s', + 'return': '%s', + 'store': '%s' + }, + 'str_t': { + 'in': 'const %s', + 'inout': '%s', + 'out': '%s', + 'return': 'const %s', + 'store': '%s' + }, + 'cstr_t': { + 'in': '%s', + 'inout': '%s*', + 'out': '%s*', + 'return': '%s', + 'store': '%s' + }, + 'TypeValue': { + 'in': '%s', + 'constptr_in': 'const %s*', # So we can use const* for PP_Var sometimes. + 'inout': '%s*', + 'out': '%s*', + 'return': '%s', + 'store': '%s' + }, + } + + + # + # RemapName + # + # A diction array of PPAPI types that are converted to language specific + # types before being returned by by the C generator + # + RemapName = { + 'blob_t': 'void**', + 'float_t': 'float', + 'double_t': 'double', + 'handle_t': 'int', + 'mem_t': 'void*', + 'mem_ptr_t': 'void**', + 'str_t': 'char*', + 'cstr_t': 'const char*', + 'interface_t' : 'const void*' + } + + # Tell how to handle pointers to GL types. + for gltype in ['GLbitfield', 'GLboolean', 'GLbyte', 'GLclampf', + 'GLclampx', 'GLenum', 'GLfixed', 'GLfloat', 'GLint', + 'GLintptr', 'GLshort', 'GLsizei', 'GLsizeiptr', + 'GLubyte', 'GLuint', 'GLushort']: + ptrtype = gltype + '_ptr_t' + TypeMap[ptrtype] = { + 'in': 'const %s', + 'inout': '%s', + 'out': '%s', + 'return': 'const %s', + 'store': '%s' + } + RemapName[ptrtype] = '%s*' % gltype + + def __init__(self): + self.dbg_depth = 0 + + # + # Debug Logging functions + # + def Log(self, txt): + if not GetOption('cgen_debug'): return + tabs = ' ' * self.dbg_depth + print '%s%s' % (tabs, txt) + + def LogEnter(self, txt): + if txt: self.Log(txt) + self.dbg_depth += 1 + + def LogExit(self, txt): + self.dbg_depth -= 1 + if txt: self.Log(txt) + + + def GetDefine(self, name, value): + out = '#define %s %s' % (name, value) + if len(out) > 80: + out = '#define %s \\\n %s' % (name, value) + return '%s\n' % out + + # + # Interface strings + # + def GetMacroHelper(self, node): + macro = node.GetProperty('macro') + if macro: return macro + name = node.GetName() + name = name.upper() + return "%s_INTERFACE" % name + + def GetInterfaceMacro(self, node, version = None): + name = self.GetMacroHelper(node) + if version is None: + return name + return '%s_%s' % (name, str(version).replace('.', '_')) + + def GetInterfaceString(self, node, version = None): + # If an interface name is specified, use that + name = node.GetProperty('iname') + if not name: + # Otherwise, the interface name is the object's name + # With '_Dev' replaced by '(Dev)' if it's a Dev interface. + name = node.GetName() + if name.endswith('_Dev'): + name = '%s(Dev)' % name[:-4] + if version is None: + return name + return "%s;%s" % (name, version) + + + # + # Return the array specification of the object. + # + def GetArraySpec(self, node): + assert(node.cls == 'Array') + fixed = node.GetProperty('FIXED') + if fixed: + return '[%s]' % fixed + else: + return '[]' + + # + # GetTypeName + # + # For any valid 'typed' object such as Member or Typedef + # the typenode object contains the typename + # + # For a given node return the type name by passing mode. + # + def GetTypeName(self, node, release, prefix=''): + self.LogEnter('GetTypeName of %s rel=%s' % (node, release)) + + # For Members, Params, and Typedefs get the type it refers to otherwise + # the node in question is it's own type (struct, union etc...) + if node.IsA('Member', 'Param', 'Typedef'): + typeref = node.GetType(release) + else: + typeref = node + + if typeref is None: + node.Error('No type at release %s.' % release) + raise CGenError('No type for %s' % node) + + # If the type is a (BuiltIn) Type then return it's name + # remapping as needed + if typeref.IsA('Type'): + name = CGen.RemapName.get(typeref.GetName(), None) + if name is None: name = typeref.GetName() + name = '%s%s' % (prefix, name) + + # For Interfaces, use the name + version + elif typeref.IsA('Interface'): + rel = typeref.first_release[release] + name = 'struct %s%s' % (prefix, self.GetStructName(typeref, rel, True)) + + # For structures, preceed with 'struct' or 'union' as appropriate + elif typeref.IsA('Struct'): + if typeref.GetProperty('union'): + name = 'union %s%s' % (prefix, typeref.GetName()) + else: + name = 'struct %s%s' % (prefix, typeref.GetName()) + + # If it's an enum, or typedef then return the Enum's name + elif typeref.IsA('Enum', 'Typedef'): + if not typeref.LastRelease(release): + first = node.first_release[release] + ver = '_' + node.GetVersion(first).replace('.','_') + else: + ver = '' + # The enum may have skipped having a typedef, we need prefix with 'enum'. + if typeref.GetProperty('notypedef'): + name = 'enum %s%s%s' % (prefix, typeref.GetName(), ver) + else: + name = '%s%s%s' % (prefix, typeref.GetName(), ver) + + else: + raise RuntimeError('Getting name of non-type %s.' % node) + self.LogExit('GetTypeName %s is %s' % (node, name)) + return name + + + # + # GetRootType + # + # For a given node return basic type of that object. This is + # either a 'Type', 'Callspec', or 'Array' + # + def GetRootTypeMode(self, node, release, mode): + self.LogEnter('GetRootType of %s' % node) + # If it has an array spec, then treat it as an array regardless of type + if node.GetOneOf('Array'): + rootType = 'Array' + # Or if it has a callspec, treat it as a function + elif node.GetOneOf('Callspec'): + rootType, mode = self.GetRootTypeMode(node.GetType(release), release, + 'return') + + # If it's a plain typedef, try that object's root type + elif node.IsA('Member', 'Param', 'Typedef'): + rootType, mode = self.GetRootTypeMode(node.GetType(release), + release, mode) + + # If it's an Enum, then it's normal passing rules + elif node.IsA('Enum'): + rootType = node.cls + + # If it's an Interface or Struct, we may be passing by value + elif node.IsA('Interface', 'Struct'): + if mode == 'return': + if node.GetProperty('returnByValue'): + rootType = 'TypeValue' + else: + rootType = node.cls + else: + if node.GetProperty('passByValue'): + rootType = 'TypeValue' + else: + rootType = node.cls + + # If it's an Basic Type, check if it's a special type + elif node.IsA('Type'): + if node.GetName() in CGen.TypeMap: + rootType = node.GetName() + else: + rootType = 'TypeValue' + else: + raise RuntimeError('Getting root type of non-type %s.' % node) + self.LogExit('RootType is "%s"' % rootType) + return rootType, mode + + + def GetTypeByMode(self, node, release, mode): + self.LogEnter('GetTypeByMode of %s mode=%s release=%s' % + (node, mode, release)) + name = self.GetTypeName(node, release) + ntype, mode = self.GetRootTypeMode(node, release, mode) + out = CGen.TypeMap[ntype][mode] % name + self.LogExit('GetTypeByMode %s = %s' % (node, out)) + return out + + + # Get the passing mode of the object (in, out, inout). + def GetParamMode(self, node): + self.Log('GetParamMode for %s' % node) + if node.GetProperty('in'): return 'in' + if node.GetProperty('out'): return 'out' + if node.GetProperty('inout'): return 'inout' + if node.GetProperty('constptr_in'): return 'constptr_in' + return 'return' + + # + # GetComponents + # + # Returns the signature components of an object as a tuple of + # (rtype, name, arrays, callspec) where: + # rtype - The store or return type of the object. + # name - The name of the object. + # arrays - A list of array dimensions as [] or []. + # args - None if not a function, otherwise a list of parameters. + # + def GetComponents(self, node, release, mode): + self.LogEnter('GetComponents mode %s for %s %s' % (mode, node, release)) + + # Generate passing type by modifying root type + rtype = self.GetTypeByMode(node, release, mode) + # If this is an array output, change it from type* foo[] to type** foo. + # type* foo[] means an array of pointers to type, which is confusing. + arrayspec = [self.GetArraySpec(array) for array in node.GetListOf('Array')] + if mode == 'out' and len(arrayspec) == 1 and arrayspec[0] == '[]': + rtype += '*' + del arrayspec[0] + + if node.IsA('Enum', 'Interface', 'Struct'): + rname = node.GetName() + else: + rname = node.GetType(release).GetName() + + if rname in CGen.RemapName: + rname = CGen.RemapName[rname] + if '%' in rtype: + rtype = rtype % rname + name = node.GetName() + callnode = node.GetOneOf('Callspec') + if callnode: + callspec = [] + for param in callnode.GetListOf('Param'): + if not param.IsRelease(release): + continue + mode = self.GetParamMode(param) + ptype, pname, parray, pspec = self.GetComponents(param, release, mode) + if node.GetName() == 'GetDirContents' and pname == 'contents': + ptype += '*' + callspec.append((ptype, pname, parray, pspec)) + else: + callspec = None + + self.LogExit('GetComponents: %s, %s, %s, %s' % + (rtype, name, arrayspec, callspec)) + return (rtype, name, arrayspec, callspec) + + + def Compose(self, rtype, name, arrayspec, callspec, prefix, func_as_ptr, + include_name, unsized_as_ptr): + self.LogEnter('Compose: %s %s' % (rtype, name)) + arrayspec = ''.join(arrayspec) + + # Switch unsized array to a ptr. NOTE: Only last element can be unsized. + if unsized_as_ptr and arrayspec[-2:] == '[]': + prefix += '*' + arrayspec=arrayspec[:-2] + + if not include_name: + name = prefix + arrayspec + else: + name = prefix + name + arrayspec + if callspec is None: + out = '%s %s' % (rtype, name) + else: + params = [] + for ptype, pname, parray, pspec in callspec: + params.append(self.Compose(ptype, pname, parray, pspec, '', True, + include_name=True, + unsized_as_ptr=unsized_as_ptr)) + if func_as_ptr: + name = '(*%s)' % name + if not params: + params = ['void'] + out = '%s %s(%s)' % (rtype, name, ', '.join(params)) + self.LogExit('Exit Compose: %s' % out) + return out + + # + # GetSignature + # + # Returns the 'C' style signature of the object + # prefix - A prefix for the object's name + # func_as_ptr - Formats a function as a function pointer + # include_name - If true, include member name in the signature. + # If false, leave it out. In any case, prefix is always + # included. + # include_version - if True, include version in the member name + # + def GetSignature(self, node, release, mode, prefix='', func_as_ptr=True, + include_name=True, include_version=False): + self.LogEnter('GetSignature %s %s as func=%s' % + (node, mode, func_as_ptr)) + rtype, name, arrayspec, callspec = self.GetComponents(node, release, mode) + if include_version: + name = self.GetStructName(node, release, True) + + # If not a callspec (such as a struct) use a ptr instead of [] + unsized_as_ptr = not callspec + + out = self.Compose(rtype, name, arrayspec, callspec, prefix, + func_as_ptr, include_name, unsized_as_ptr) + + self.LogExit('Exit GetSignature: %s' % out) + return out + + # Define a Typedef. + def DefineTypedef(self, node, releases, prefix='', comment=False): + __pychecker__ = 'unusednames=comment' + build_list = node.GetUniqueReleases(releases) + + out = 'typedef %s;\n' % self.GetSignature(node, build_list[-1], 'return', + prefix, True, + include_version=False) + + # Version mangle any other versions + for index, rel in enumerate(build_list[:-1]): + out += '\n' + out += 'typedef %s;\n' % self.GetSignature(node, rel, 'return', + prefix, True, + include_version=True) + self.Log('DefineTypedef: %s' % out) + return out + + # Define an Enum. + def DefineEnum(self, node, releases, prefix='', comment=False): + __pychecker__ = 'unusednames=comment,releases' + self.LogEnter('DefineEnum %s' % node) + name = '%s%s' % (prefix, node.GetName()) + notypedef = node.GetProperty('notypedef') + unnamed = node.GetProperty('unnamed') + + if unnamed: + out = 'enum {' + elif notypedef: + out = 'enum %s {' % name + else: + out = 'typedef enum {' + enumlist = [] + for child in node.GetListOf('EnumItem'): + value = child.GetProperty('VALUE') + comment_txt = GetNodeComments(child, tabs=1) + if value: + item_txt = '%s%s = %s' % (prefix, child.GetName(), value) + else: + item_txt = '%s%s' % (prefix, child.GetName()) + enumlist.append('%s %s' % (comment_txt, item_txt)) + self.LogExit('Exit DefineEnum') + + if unnamed or notypedef: + out = '%s\n%s\n};\n' % (out, ',\n'.join(enumlist)) + else: + out = '%s\n%s\n} %s;\n' % (out, ',\n'.join(enumlist), name) + return out + + def DefineMember(self, node, releases, prefix='', comment=False): + __pychecker__ = 'unusednames=prefix,comment' + release = releases[0] + self.LogEnter('DefineMember %s' % node) + if node.GetProperty('ref'): + out = '%s;' % self.GetSignature(node, release, 'ref', '', True) + else: + out = '%s;' % self.GetSignature(node, release, 'store', '', True) + self.LogExit('Exit DefineMember') + return out + + def GetStructName(self, node, release, include_version=False): + suffix = '' + if include_version: + ver_num = node.GetVersion(release) + suffix = ('_%s' % ver_num).replace('.', '_') + return node.GetName() + suffix + + def DefineStructInternals(self, node, release, + include_version=False, comment=True): + channel = node.GetProperty('FILE').release_map.GetChannel(release) + if channel == 'dev': + channel_comment = ' /* dev */' + else: + channel_comment = '' + out = '' + if node.GetProperty('union'): + out += 'union %s {%s\n' % ( + self.GetStructName(node, release, include_version), channel_comment) + else: + out += 'struct %s {%s\n' % ( + self.GetStructName(node, release, include_version), channel_comment) + + channel = node.GetProperty('FILE').release_map.GetChannel(release) + # Generate Member Functions + members = [] + for child in node.GetListOf('Member'): + if channel == 'stable' and child.NodeIsDevOnly(): + continue + member = self.Define(child, [release], tabs=1, comment=comment) + if not member: + continue + members.append(member) + out += '%s\n};\n' % '\n'.join(members) + return out + + + def DefineUnversionedInterface(self, node, rel): + out = '\n' + if node.GetProperty('force_struct_namespace'): + # Duplicate the definition to put it in struct namespace. This + # attribute is only for legacy APIs like OpenGLES2 and new APIs + # must not use this. See http://crbug.com/411799 + out += self.DefineStructInternals(node, rel, + include_version=False, comment=True) + else: + # Define an unversioned typedef for the most recent version + out += 'typedef struct %s %s;\n' % ( + self.GetStructName(node, rel, include_version=True), + self.GetStructName(node, rel, include_version=False)) + return out + + + def DefineStruct(self, node, releases, prefix='', comment=False): + __pychecker__ = 'unusednames=comment,prefix' + self.LogEnter('DefineStruct %s' % node) + out = '' + build_list = node.GetUniqueReleases(releases) + + newest_stable = None + newest_dev = None + for rel in build_list: + channel = node.GetProperty('FILE').release_map.GetChannel(rel) + if channel == 'stable': + newest_stable = rel + if channel == 'dev': + newest_dev = rel + last_rel = build_list[-1] + + # TODO(noelallen) : Bug 157017 finish multiversion support + if node.IsA('Struct'): + if len(build_list) != 1: + node.Error('Can not support multiple versions of node.') + assert len(build_list) == 1 + # Build the most recent one versioned, with comments + out = self.DefineStructInternals(node, last_rel, + include_version=False, comment=True) + + if node.IsA('Interface'): + # Build the most recent one versioned, with comments + out = self.DefineStructInternals(node, last_rel, + include_version=True, comment=True) + if last_rel == newest_stable: + out += self.DefineUnversionedInterface(node, last_rel) + + # Build the rest without comments and with the version number appended + for rel in build_list[0:-1]: + channel = node.GetProperty('FILE').release_map.GetChannel(rel) + # Skip dev channel interface versions that are + # Not the newest version, and + # Don't have an equivalent stable version. + if channel == 'dev' and rel != newest_dev: + if not node.DevInterfaceMatchesStable(rel): + continue + out += '\n' + self.DefineStructInternals(node, rel, + include_version=True, + comment=False) + if rel == newest_stable: + out += self.DefineUnversionedInterface(node, rel) + + self.LogExit('Exit DefineStruct') + return out + + + # + # Copyright and Comment + # + # Generate a comment or copyright block + # + def Copyright(self, node, cpp_style=False): + lines = node.GetName().split('\n') + if cpp_style: + return '//' + '\n//'.join(filter(lambda f: f != '', lines)) + '\n' + return CommentLines(lines) + + + def Indent(self, data, tabs=0): + """Handles indentation and 80-column line wrapping.""" + tab = ' ' * tabs + lines = [] + for line in data.split('\n'): + # Add indentation + line = tab + line + space_break = line.rfind(' ', 0, 80) + if len(line) <= 80 or 'http://' in line: + # Ignore normal line and URLs permitted by the style guide. + lines.append(line.rstrip()) + elif not '(' in line and space_break >= 0: + # Break long typedefs on nearest space. + lines.append(line[0:space_break]) + lines.append(' ' + line[space_break + 1:]) + else: + left = line.rfind('(') + 1 + args = line[left:].split(',') + orig_args = args + orig_left = left + # Try to split on '(arg1)' or '(arg1, arg2)', not '()' + while args[0][0] == ')': + left = line.rfind('(', 0, left - 1) + 1 + if left == 0: # No more parens, take the original option + args = orig_args + left = orig_left + break + args = line[left:].split(',') + + line_max = 0 + for arg in args: + if len(arg) > line_max: line_max = len(arg) + + if left + line_max >= 80: + indent = '%s ' % tab + args = (',\n%s' % indent).join([arg.strip() for arg in args]) + lines.append('%s\n%s%s' % (line[:left], indent, args)) + else: + indent = ' ' * (left - 1) + args = (',\n%s' % indent).join(args) + lines.append('%s%s' % (line[:left], args)) + return '\n'.join(lines) + + + # Define a top level object. + def Define(self, node, releases, tabs=0, prefix='', comment=False): + # If this request does not match unique release, or if the release is not + # available (possibly deprecated) then skip. + unique = node.GetUniqueReleases(releases) + if not unique or not node.InReleases(releases): + return '' + + self.LogEnter('Define %s tab=%d prefix="%s"' % (node,tabs,prefix)) + declmap = dict({ + 'Enum': CGen.DefineEnum, + 'Function': CGen.DefineMember, + 'Interface': CGen.DefineStruct, + 'Member': CGen.DefineMember, + 'Struct': CGen.DefineStruct, + 'Typedef': CGen.DefineTypedef + }) + + out = '' + func = declmap.get(node.cls, None) + if not func: + ErrOut.Log('Failed to define %s named %s' % (node.cls, node.GetName())) + define_txt = func(self, node, releases, prefix=prefix, comment=comment) + + comment_txt = GetNodeComments(node, tabs=0) + if comment_txt and comment: + out += comment_txt + out += define_txt + + indented_out = self.Indent(out, tabs) + self.LogExit('Exit Define') + return indented_out + + +# Clean a string representing an object definition and return then string +# as a single space delimited set of tokens. +def CleanString(instr): + instr = instr.strip() + instr = instr.split() + return ' '.join(instr) + + +# Test a file, by comparing all it's objects, with their comments. +def TestFile(filenode): + cgen = CGen() + + errors = 0 + for node in filenode.GetChildren()[2:]: + instr = node.GetOneOf('Comment') + if not instr: continue + instr.Dump() + instr = CleanString(instr.GetName()) + + outstr = cgen.Define(node, releases=['M14']) + if GetOption('verbose'): + print outstr + '\n' + outstr = CleanString(outstr) + + if instr != outstr: + ErrOut.Log('Failed match of\n>>%s<<\nto:\n>>%s<<\nFor:\n' % + (instr, outstr)) + node.Dump(1, comments=True) + errors += 1 + return errors + + +# Build and resolve the AST and compare each file individual. +def TestFiles(filenames): + if not filenames: + idldir = os.path.split(sys.argv[0])[0] + idldir = os.path.join(idldir, 'test_cgen', '*.idl') + filenames = glob.glob(idldir) + + filenames = sorted(filenames) + ast = ParseFiles(filenames) + + total_errs = 0 + for filenode in ast.GetListOf('File'): + errs = TestFile(filenode) + if errs: + ErrOut.Log('%s test failed with %d error(s).' % + (filenode.GetName(), errs)) + total_errs += errs + + if total_errs: + ErrOut.Log('Failed generator test.') + else: + InfoOut.Log('Passed generator test.') + return total_errs + +def main(args): + filenames = ParseOptions(args) + if GetOption('test'): + return TestFiles(filenames) + ast = ParseFiles(filenames) + cgen = CGen() + for f in ast.GetListOf('File'): + if f.GetProperty('ERRORS') > 0: + print 'Skipping %s' % f.GetName() + continue + for node in f.GetChildren()[2:]: + print cgen.Define(node, ast.releases, comment=True, prefix='tst_') + + +if __name__ == '__main__': + sys.exit(main(sys.argv[1:])) diff --git a/browser/extensions/mortar/ppapi/generators/idl_diff.py b/browser/extensions/mortar/ppapi/generators/idl_diff.py new file mode 100755 index 000000000000..0d15fe83e847 --- /dev/null +++ b/browser/extensions/mortar/ppapi/generators/idl_diff.py @@ -0,0 +1,354 @@ +#!/usr/bin/env python +# Copyright (c) 2012 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import glob +import os +import subprocess +import sys + +from idl_option import GetOption, Option, ParseOptions +from idl_outfile import IDLOutFile +# +# IDLDiff +# +# IDLDiff is a tool for comparing sets of IDL generated header files +# with the standard checked in headers. It does this by capturing the +# output of the standard diff tool, parsing it into separate changes, then +# ignoring changes that are know to be safe, such as adding or removing +# blank lines, etc... +# + +Option('gen', 'IDL generated files', default='hdir') +Option('src', 'Original ".h" files', default='../c') +Option('halt', 'Stop if a difference is found') +Option('diff', 'Directory holding acceptable diffs', default='diff') +Option('ok', 'Write out the diff file.') +# Change +# +# A Change object contains the previous lines, new news and change type. +# +class Change(object): + def __init__(self, mode, was, now): + self.mode = mode + self.was = was + self.now = now + + def Dump(self): + if not self.was: + print 'Adding %s' % self.mode + elif not self.now: + print 'Missing %s' % self.mode + else: + print 'Modifying %s' % self.mode + + for line in self.was: + print 'src: >>%s<<' % line + for line in self.now: + print 'gen: >>%s<<' % line + print + +# +# IsCopyright +# +# Return True if this change is only a one line change in the copyright notice +# such as non-matching years. +# +def IsCopyright(change): + if len(change.now) != 1 or len(change.was) != 1: return False + if 'Copyright (c)' not in change.now[0]: return False + if 'Copyright (c)' not in change.was[0]: return False + return True + +# +# IsBlankComment +# +# Return True if this change only removes a blank line from a comment +# +def IsBlankComment(change): + if change.now: return False + if len(change.was) != 1: return False + if change.was[0].strip() != '*': return False + return True + +# +# IsBlank +# +# Return True if this change only adds or removes blank lines +# +def IsBlank(change): + for line in change.now: + if line: return False + for line in change.was: + if line: return False + return True + + +# +# IsCppComment +# +# Return True if this change only going from C++ to C style +# +def IsToCppComment(change): + if not len(change.now) or len(change.now) != len(change.was): + return False + for index in range(len(change.now)): + was = change.was[index].strip() + if was[:2] != '//': + return False + was = was[2:].strip() + now = change.now[index].strip() + if now[:2] != '/*': + return False + now = now[2:-2].strip() + if now != was: + return False + return True + + + return True + +def IsMergeComment(change): + if len(change.was) != 1: return False + if change.was[0].strip() != '*': return False + for line in change.now: + stripped = line.strip() + if stripped != '*' and stripped[:2] != '/*' and stripped[-2:] != '*/': + return False + return True +# +# IsSpacing +# +# Return True if this change is only different in the way 'words' are spaced +# such as in an enum: +# ENUM_XXX = 1, +# ENUM_XYY_Y = 2, +# vs +# ENUM_XXX = 1, +# ENUM_XYY_Y = 2, +# +def IsSpacing(change): + if len(change.now) != len(change.was): return False + for i in range(len(change.now)): + # Also ignore right side comments + line = change.was[i] + offs = line.find('//') + if offs == -1: + offs = line.find('/*') + if offs >-1: + line = line[:offs-1] + + words1 = change.now[i].split() + words2 = line.split() + if words1 != words2: return False + return True + +# +# IsInclude +# +# Return True if change has extra includes +# +def IsInclude(change): + for line in change.was: + if line.strip().find('struct'): return False + for line in change.now: + if line and '#include' not in line: return False + return True + +# +# IsCppComment +# +# Return True if the change is only missing C++ comments +# +def IsCppComment(change): + if len(change.now): return False + for line in change.was: + line = line.strip() + if line[:2] != '//': return False + return True +# +# ValidChange +# +# Return True if none of the changes does not patch an above "bogus" change. +# +def ValidChange(change): + if IsToCppComment(change): return False + if IsCopyright(change): return False + if IsBlankComment(change): return False + if IsMergeComment(change): return False + if IsBlank(change): return False + if IsSpacing(change): return False + if IsInclude(change): return False + if IsCppComment(change): return False + return True + + +# +# Swapped +# +# Check if the combination of last + next change signals they are both +# invalid such as swap of line around an invalid block. +# +def Swapped(last, next): + if not last.now and not next.was and len(last.was) == len(next.now): + cnt = len(last.was) + for i in range(cnt): + match = True + for j in range(cnt): + if last.was[j] != next.now[(i + j) % cnt]: + match = False + break; + if match: return True + if not last.was and not next.now and len(last.now) == len(next.was): + cnt = len(last.now) + for i in range(cnt): + match = True + for j in range(cnt): + if last.now[i] != next.was[(i + j) % cnt]: + match = False + break; + if match: return True + return False + + +def FilterLinesIn(output): + was = [] + now = [] + filter = [] + for index in range(len(output)): + filter.append(False) + line = output[index] + if len(line) < 2: continue + if line[0] == '<': + if line[2:].strip() == '': continue + was.append((index, line[2:])) + elif line[0] == '>': + if line[2:].strip() == '': continue + now.append((index, line[2:])) + for windex, wline in was: + for nindex, nline in now: + if filter[nindex]: continue + if filter[windex]: continue + if wline == nline: + filter[nindex] = True + filter[windex] = True + if GetOption('verbose'): + print "Found %d, %d >>%s<<" % (windex + 1, nindex + 1, wline) + out = [] + for index in range(len(output)): + if not filter[index]: + out.append(output[index]) + + return out +# +# GetChanges +# +# Parse the output into discrete change blocks. +# +def GetChanges(output): + # Split on lines, adding an END marker to simply add logic + lines = output.split('\n') + lines = FilterLinesIn(lines) + lines.append('END') + + changes = [] + was = [] + now = [] + mode = '' + last = None + + for line in lines: +# print "LINE=%s" % line + if not line: continue + + elif line[0] == '<': + if line[2:].strip() == '': continue + # Ignore prototypes + if len(line) > 10: + words = line[2:].split() + if len(words) == 2 and words[1][-1] == ';': + if words[0] == 'struct' or words[0] == 'union': + continue + was.append(line[2:]) + elif line[0] == '>': + if line[2:].strip() == '': continue + if line[2:10] == '#include': continue + now.append(line[2:]) + elif line[0] == '-': + continue + else: + change = Change(line, was, now) + was = [] + now = [] + if ValidChange(change): + changes.append(change) + if line == 'END': + break + + return FilterChanges(changes) + +def FilterChanges(changes): + if len(changes) < 2: return changes + out = [] + filter = [False for change in changes] + for cur in range(len(changes)): + for cmp in range(cur+1, len(changes)): + if filter[cmp]: + continue + if Swapped(changes[cur], changes[cmp]): + filter[cur] = True + filter[cmp] = True + for cur in range(len(changes)): + if filter[cur]: continue + out.append(changes[cur]) + return out + +def Main(args): + filenames = ParseOptions(args) + if not filenames: + gendir = os.path.join(GetOption('gen'), '*.h') + filenames = sorted(glob.glob(gendir)) + srcdir = os.path.join(GetOption('src'), '*.h') + srcs = sorted(glob.glob(srcdir)) + for name in srcs: + name = os.path.split(name)[1] + name = os.path.join(GetOption('gen'), name) + if name not in filenames: + print 'Missing: %s' % name + + for filename in filenames: + gen = filename + filename = filename[len(GetOption('gen')) + 1:] + src = os.path.join(GetOption('src'), filename) + diff = os.path.join(GetOption('diff'), filename) + p = subprocess.Popen(['diff', src, gen], stdout=subprocess.PIPE) + output, errors = p.communicate() + + try: + input = open(diff, 'rt').read() + except: + input = '' + + if input != output: + changes = GetChanges(output) + else: + changes = [] + + if changes: + print "\n\nDelta between:\n src=%s\n gen=%s\n" % (src, gen) + for change in changes: + change.Dump() + print 'Done with %s\n\n' % src + if GetOption('ok'): + open(diff, 'wt').write(output) + if GetOption('halt'): + return 1 + else: + print "\nSAME:\n src=%s\n gen=%s" % (src, gen) + if input: print ' ** Matched expected diff. **' + print '\n' + + +if __name__ == '__main__': + sys.exit(Main(sys.argv[1:])) diff --git a/browser/extensions/mortar/ppapi/generators/idl_gen_pnacl.py b/browser/extensions/mortar/ppapi/generators/idl_gen_pnacl.py new file mode 100755 index 000000000000..dd1ce0cd9eb7 --- /dev/null +++ b/browser/extensions/mortar/ppapi/generators/idl_gen_pnacl.py @@ -0,0 +1,284 @@ +#!/usr/bin/env python +# Copyright (c) 2012 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +"""Generator for Pnacl Shim functions that bridges the calling conventions +between GCC and PNaCl. """ + +from datetime import datetime +import difflib +import glob +import os +import sys + +from idl_c_proto import CGen +from idl_gen_wrapper import Interface, WrapperGen +from idl_log import ErrOut, InfoOut, WarnOut +from idl_option import GetOption, Option, ParseOptions +from idl_parser import ParseFiles + +Option('pnaclshim', 'Name of the pnacl shim file.', + default='temp_pnacl_shim.c') + +Option('disable_pnacl_opt', 'Turn off optimization of pnacl shim.') + + +class PnaclGen(WrapperGen): + """PnaclGen generates shim code to bridge the Gcc ABI with PNaCl. + + This subclass of WrapperGenerator takes the IDL sources and + generates shim methods for bridging the calling conventions between GCC + and PNaCl (LLVM). Some of the PPAPI methods do not need shimming, so + this will also detect those situations and provide direct access to the + original PPAPI methods (rather than the shim methods). + """ + + def __init__(self): + WrapperGen.__init__(self, + 'Pnacl', + 'Pnacl Shim Gen', + 'pnacl', + 'Generate the PNaCl shim.') + self.cgen = CGen() + self._skip_opt = False + + ############################################################ + + def OwnHeaderFile(self): + """Return the header file that specifies the API of this wrapper. + We do not generate the header files. """ + return 'ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.h' + + + def InterfaceVersionNeedsWrapping(self, iface, version): + """Return true if the interface+version has ANY methods that + need wrapping. + """ + if self._skip_opt: + return True + if iface.GetName().endswith('Trusted'): + return False + # TODO(dmichael): We have no way to wrap PPP_ interfaces without an + # interface string. If any ever need wrapping, we'll need to figure out a + # way to get the plugin-side of the Pepper proxy (within the IRT) to access + # and use the wrapper. + if iface.GetProperty("no_interface_string"): + return False + for member in iface.GetListOf('Member'): + release = member.GetRelease(version) + if self.MemberNeedsWrapping(member, release): + return True + return False + + + def MemberNeedsWrapping(self, member, release): + """Return true if a particular member function at a particular + release needs wrapping. + """ + if self._skip_opt: + return True + if not member.InReleases([release]): + return False + ret, name, array, args_spec = self.cgen.GetComponents(member, + release, + 'store') + return self.TypeNeedsWrapping(ret, []) or self.ArgsNeedWrapping(args_spec) + + + def ArgsNeedWrapping(self, args): + """Return true if any parameter in the list needs wrapping. + """ + for arg in args: + (type_str, name, array_dims, more_args) = arg + if self.TypeNeedsWrapping(type_str, array_dims): + return True + return False + + + def TypeNeedsWrapping(self, type_node, array_dims): + """Return true if a parameter type needs wrapping. + Currently, this is true for byval aggregates. + """ + is_aggregate = type_node.startswith('struct') or \ + type_node.startswith('union') + is_reference = (type_node.find('*') != -1 or array_dims != []) + return is_aggregate and not is_reference + + ############################################################ + + + def ConvertByValueReturnType(self, ret, args_spec): + if self.TypeNeedsWrapping(ret, array_dims=[]): + args_spec = [(ret, '_struct_result', [], None)] + args_spec + ret2 = 'void' + wrap_return = True + else: + ret2 = ret + wrap_return = False + return wrap_return, ret2, args_spec + + + def ConvertByValueArguments(self, args_spec): + args = [] + for type_str, name, array_dims, more_args in args_spec: + if self.TypeNeedsWrapping(type_str, array_dims): + type_str += '*' + args.append((type_str, name, array_dims, more_args)) + return args + + + def FormatArgs(self, c_operator, args_spec): + args = [] + for type_str, name, array_dims, more_args in args_spec: + if self.TypeNeedsWrapping(type_str, array_dims): + args.append(c_operator + name) + else: + args.append(name) + return ', '.join(args) + + + def GenerateWrapperForPPBMethod(self, iface, member): + result = [] + func_prefix = self.WrapperMethodPrefix(iface.node, iface.release) + ret, name, array, cspec = self.cgen.GetComponents(member, + iface.release, + 'store') + wrap_return, ret2, cspec2 = self.ConvertByValueReturnType(ret, cspec) + cspec2 = self.ConvertByValueArguments(cspec2) + sig = self.cgen.Compose(ret2, name, array, cspec2, + prefix=func_prefix, + func_as_ptr=False, + include_name=True, + unsized_as_ptr=False) + result.append('static %s {\n' % sig) + result.append(' const struct %s *iface = %s.real_iface;\n' % + (iface.struct_name, self.GetWrapperInfoName(iface))) + + return_prefix = '' + if wrap_return: + return_prefix = '*_struct_result = ' + elif ret != 'void': + return_prefix = 'return ' + + result.append(' %siface->%s(%s);\n}\n\n' % (return_prefix, + member.GetName(), + self.FormatArgs('*', cspec))) + return result + + + def GenerateWrapperForPPPMethod(self, iface, member): + result = [] + func_prefix = self.WrapperMethodPrefix(iface.node, iface.release) + sig = self.cgen.GetSignature(member, iface.release, 'store', + func_prefix, False) + result.append('static %s {\n' % sig) + result.append(' const struct %s *iface = %s.real_iface;\n' % + (iface.struct_name, self.GetWrapperInfoName(iface))) + ret, name, array, cspec = self.cgen.GetComponents(member, + iface.release, + 'store') + wrap_return, ret2, cspec = self.ConvertByValueReturnType(ret, cspec) + cspec2 = self.ConvertByValueArguments(cspec) + temp_fp = self.cgen.Compose(ret2, name, array, cspec2, + prefix='temp_fp', + func_as_ptr=True, + include_name=False, + unsized_as_ptr=False) + cast = self.cgen.Compose(ret2, name, array, cspec2, + prefix='', + func_as_ptr=True, + include_name=False, + unsized_as_ptr=False) + result.append(' %s =\n ((%s)iface->%s);\n' % (temp_fp, + cast, + member.GetName())) + return_prefix = '' + if wrap_return: + result.append(' %s _struct_result;\n' % ret) + elif ret != 'void': + return_prefix = 'return ' + + result.append(' %stemp_fp(%s);\n' % (return_prefix, + self.FormatArgs('&', cspec))) + if wrap_return: + result.append(' return _struct_result;\n') + result.append('}\n\n') + return result + + + def GenerateRange(self, ast, releases, options): + """Generate shim code for a range of releases. + """ + self._skip_opt = GetOption('disable_pnacl_opt') + self.SetOutputFile(GetOption('pnaclshim')) + return WrapperGen.GenerateRange(self, ast, releases, options) + +pnaclgen = PnaclGen() + +###################################################################### +# Tests. + +# Clean a string representing an object definition and return then string +# as a single space delimited set of tokens. +def CleanString(instr): + instr = instr.strip() + instr = instr.split() + return ' '.join(instr) + + +def PrintErrorDiff(old, new): + oldlines = old.split(';') + newlines = new.split(';') + d = difflib.Differ() + diff = d.compare(oldlines, newlines) + ErrOut.Log('Diff is:\n%s' % '\n'.join(diff)) + + +def GetOldTestOutput(ast): + # Scan the top-level comments in the IDL file for comparison. + old = [] + for filenode in ast.GetListOf('File'): + for node in filenode.GetChildren(): + instr = node.GetOneOf('Comment') + if not instr: continue + instr.Dump() + old.append(instr.GetName()) + return CleanString(''.join(old)) + + +def TestFiles(filenames, test_releases): + ast = ParseFiles(filenames) + iface_releases = pnaclgen.DetermineInterfaces(ast, test_releases) + new_output = CleanString(pnaclgen.GenerateWrapperForMethods( + iface_releases, comments=False)) + old_output = GetOldTestOutput(ast) + if new_output != old_output: + PrintErrorDiff(old_output, new_output) + ErrOut.Log('Failed pnacl generator test.') + return 1 + else: + InfoOut.Log('Passed pnacl generator test.') + return 0 + + +def Main(args): + filenames = ParseOptions(args) + test_releases = ['M13', 'M14', 'M15'] + if not filenames: + idldir = os.path.split(sys.argv[0])[0] + idldir = os.path.join(idldir, 'test_gen_pnacl', '*.idl') + filenames = glob.glob(idldir) + filenames = sorted(filenames) + if GetOption('test'): + # Run the tests. + return TestFiles(filenames, test_releases) + + # Otherwise, generate the output file (for potential use as golden file). + ast = ParseFiles(filenames) + return pnaclgen.GenerateRange(ast, test_releases, filenames) + + +if __name__ == '__main__': + retval = Main(sys.argv[1:]) + sys.exit(retval) diff --git a/browser/extensions/mortar/ppapi/generators/idl_gen_rpc.py b/browser/extensions/mortar/ppapi/generators/idl_gen_rpc.py new file mode 100755 index 000000000000..cd71c6cae926 --- /dev/null +++ b/browser/extensions/mortar/ppapi/generators/idl_gen_rpc.py @@ -0,0 +1,669 @@ +#!/usr/bin/env python +# Copyright (c) 2012 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" Generator for C style prototypes and definitions """ + +import glob +import os +import re +import sys + +from idl_log import ErrOut, InfoOut, WarnOut +from idl_node import IDLNode +from idl_ast import IDLAst +from idl_option import GetOption, Option, ParseOptions +from idl_parser import ParseFiles +from idl_c_proto import CGen +from idl_c_header import GetHeaderFromNode, GenerateHeader +from idl_outfile import IDLOutFile + +Option('debug', 'Debug generate.') + +#API = namedtuple('API', ['interface', 'member', 'param']) + +customAPIs = { + ('PPB_CharSet_Dev', 'CharSetToUTF16', 'input'): { 'array': True, 'arrayType': 'uint8_t', 'arraySize': 'input_len' }, + ('PPB_CharSet_Dev', 'CharSetToUTF16', 'rval'): { 'convert': ' size_t length = iterator.expectArrayAndGotoFirstItem();\n rval = new uint16_t[length];\n for (size_t i = 0; i < length; ++i) {\n FromJSON_uint16_t(iterator, rval[i]);\n }\n' }, + ('PPB_Core', 'IsMainThread', None): { 'maybeNonMainThread': True }, + ('PPB_Core', 'CallOnMainThread', None): { 'maybeNonMainThread': True }, + ('PPB_Flash_MessageLoop', 'Quit', None): { 'maybeNonMainThread': True }, + ('PPB_Graphics3D', 'Create', 'attrib_list'): { 'arraySentinel': 'PP_GRAPHICS3DATTRIB_NONE' }, + ('PPB_MediaStreamAudioTrack', 'Configure', 'attrib_list'): { 'arraySentinel': 'PP_MEDIASTREAMAUDIOTRACK_ATTRIB_NONE' }, + ('PPB_OpenGLES2', 'DeleteBuffers', 'buffers'): { 'array': True, 'arrayType': 'GLuint', 'arraySize': 'n' }, + ('PPB_OpenGLES2', 'DeleteFramebuffers', 'framebuffers'): { 'array': True, 'arrayType': 'GLuint', 'arraySize': 'n' }, + ('PPB_OpenGLES2', 'DeleteRenderbuffers', 'renderbuffers'): { 'array': True, 'arrayType': 'GLuint', 'arraySize': 'n' }, + ('PPB_OpenGLES2', 'DeleteTextures', 'textures'): { 'array': True, 'arrayType': 'GLuint', 'arraySize': 'n' }, + ('PPB_OpenGLES2', 'GenBuffers', 'buffers'): { 'array': True, 'arrayType': 'GLuint', 'arraySize': 'n', 'create': False }, + ('PPB_OpenGLES2', 'GenTextures', 'textures'): { 'array': True, 'arrayType': 'GLuint', 'arraySize': 'n', 'create': False }, + ('PPB_OpenGLES2', 'ShaderSource', 'str'): { 'array': True, 'arrayType': 'str_t', 'arraySize': 'count', 'mode': 'in' }, + ('PPB_OpenGLES2', 'UniformMatrix3fv', 'value'): { 'array': True, 'arrayType': 'GLfloat', 'arraySize': 'count * 9', 'mode': 'in' }, + ('PPB_PDF', 'SearchString', 'results'): { 'arraySize': None }, + ('PPB_PDF', 'SetAccessibilityPageInfo', 'text_runs'): { 'arraySize': 'page_info->text_run_count' }, + ('PPB_PDF', 'SetAccessibilityPageInfo', 'chars'): { 'arraySize': 'page_info->char_count' }, + ('PPB_TCPSocket_Private', 'Write', 'buffer'): { 'array': True, 'arrayType': 'uint8_t', 'arraySize': 'bytes_to_write' }, +} +def getCustom(interface, member, param): + def matches(pattern, value): + return pattern == value or pattern == '*' + custom = list(v for (i, m, p), v in customAPIs.iteritems() if matches(interface, i) and matches(m, member) and matches(p, param)) + assert len(custom) <= 1 + return custom[0] if len(custom) == 1 else dict() + +class RPCGen(object): + def __init__(self): + self.cgen = CGen() + self.interfaceStructs = [] + self.pppInterfaceGetters = [] + + def AddProp(self, release, s, prefix, member, isOutParam=False, callnode=None, derefSizeIs=True): + out = '' + key = member.GetName() + if not member.InReleases([release]): + out += '/* skipping %s */\n' % key + return + type = member.GetType(release).GetName() + array = member.GetOneOf('Array') + interfaceMember = member.parent + interface = interfaceMember.parent.parent + customSerializer = getCustom(interface.GetName(), interfaceMember.GetName(), member.GetName()) + array = customSerializer.get('array', array) + isOutParam = customSerializer.get('isOutParam', isOutParam) + if isOutParam: + out += ' AddProp(' + s + ', "' + key + '", PointerToString(' + prefix + key + '));\n' + elif array: + if customSerializer: + type = customSerializer.get('arrayType', type) + count = array.GetProperty('FIXED') if isinstance(array, IDLNode) else None + if not count: + size_is = member.GetProperty('size_is()') + if size_is: + size_is = size_is[0] + count = prefix + size_is + if callnode: + for param in callnode.GetListOf('Param'): + if param.GetName() == size_is: + if self.cgen.GetParamMode(param) == 'out' and derefSizeIs: + count = '*' + count + break + else: + size_as = member.GetProperty('size_as') + count = size_as + if customSerializer: + count = customSerializer.get('arraySize', count) + out += ' {\n' + out += ' BeginProp(' + s + ', "' + key + '");\n' + out += ' BeginElements(' + s + ');\n' + out += ' for (uint32_t _n = 0; ' + if count: + out += '_n < ' + count + else: + sentinel = customSerializer.get('arraySentinel', '0') + out += prefix + key + '[_n] != ' + sentinel + out += '; ++_n) {\n' + out += ' AddElement(' + s + ', ToString_' + type + '(' + prefix + key + '[_n]));\n' + out += ' }\n' + out += ' EndElements(' + s + ');\n' + out += ' }\n' + else: + out += ' AddProp(' + s + ', "' + key + '", ToString_' + type + '(' + prefix + key + '));\n' + return out + + def FromJSON(self, release, prefix, outvalue, node, create, callnode=None): + out = '' + type = node.GetType(release).GetName() + array = node.GetOneOf('Array') + interfaceMember = node.parent + interface = interfaceMember.parent.parent + customParser = getCustom(interface.GetName(), interfaceMember.GetName(), node.GetName()) + array = customParser.get('array', array) + create = customParser.get('create', create) + name = node.GetName() + outvalue = prefix + outvalue + if array: + if customParser: + type = customParser.get('arrayType', type) + fixed = array.GetProperty('FIXED') if isinstance(array, IDLNode) else None + count = fixed + if type == 'char': + assert count > 0 + out += ' FromJSON_charArray(iterator, ' + outvalue + ', ' + str(count) + ');\n' + else: + if not count: + size_is = node.GetProperty('size_is()') + if size_is: + size_is = size_is[0] + count = prefix + size_is + if callnode: + for param in callnode.GetListOf('Param'): + if param.GetName() == size_is: + if self.cgen.GetParamMode(param) == 'out': + count = '*' + count + break + else: + size_as = node.GetProperty('size_as') + count = size_as + if customParser: + count = customParser.get('arraySize', count) + out += '\n' + out += ' {\n' + out += ' size_t children = iterator.expectArrayAndGotoFirstItem();\n' + if count: + out += ' if (children > ' + count + ') {\n' + out += ' Fail("Too many items in array\\n", "");\n' + out += ' }\n' + if create and not fixed: + if not count: + count = 'children' + out += ' ' + outvalue + ' = new ' + self.cgen.GetTypeByMode(node, release, 'store') + '[' + count + '];\n' + out += ' for (uint32_t _n = 0; _n < children; ++_n) {\n' + out += ' FromJSON_' + type + '(iterator, (' + outvalue + ')[_n]);\n' + out += ' }\n' + out += ' // FIXME Null out remaining items?\n' + out += ' }\n' + else: + out += ' FromJSON_' + type + '(iterator, ' + outvalue + ');\n' + return out + + def MemberFromJSON(self, release, prefix, member, create): + key = member.GetName() + if not member.InReleases([release]): + return '/* skipping %s */\n' % key + return self.FromJSON(release, prefix, key, member, create) + + DerefOutType = { + 'Array': { 'out': '*' }, + 'Enum': '*', + 'Struct': '*', + 'cstr_t': '*', + 'TypeValue': '*', + } + + def DefineInterfaceMethodSerializer(self, iface, releases, node, release): + customSerializer = getCustom(iface.GetName(), node.GetName(), None) + if not node.InReleases([release]): + return '/* skipping %s */\n' % node.GetName() + if customSerializer and customSerializer.get('skip', False): + return self.cgen.GetSignature(node, release, 'ref', '', func_as_ptr=False, include_version=True) + ";\n" + out = '' + out += 'static ' + out += self.cgen.GetSignature(node, release, 'ref', '', func_as_ptr=False, include_version=True) + out += ' {\n' + out += ' stringstream ss;\n' + out += ' BeginProps(ss);\n' + out += ' AddProp(ss, "__interface", "\\"' + iface.GetName() + '\\"");\n' + out += ' AddProp(ss, "__version", "\\"' + iface.GetVersion(release) + '\\"");\n' + out += ' AddProp(ss, "__method", "\\"' + node.GetName() + '\\"");\n' + callnode = node.GetOneOf('Callspec') + hasOutParams = False + if callnode: + for param in callnode.GetListOf('Param'): + mode = self.cgen.GetParamMode(param) + ntype, mode = self.cgen.GetRootTypeMode(param, release, mode) + mode = getCustom(param.parent.parent.parent.GetName(), param.parent.GetName(), param.GetName()).get('mode', mode) + if mode == "out" or mode == "inout": + hasOutParams = hasOutParams or not (ntype == 'mem_t' and mode == "inout") + out += self.AddProp(release, 'ss', '', param, mode == "out", callnode) + out += ' EndProps(ss);\n' + if node.GetProperty('ref'): + mode = 'ref' + else: + mode = 'store' + rtype = self.cgen.GetTypeByMode(node.GetType(release), release, 'store') + out += '#ifndef INTERPOSE\n' + out += ' ' + if rtype != 'void' or hasOutParams: + out += 'string json = RPCWithResult' + else: + out += 'RPC' + if customSerializer and customSerializer.get('maybeNonMainThread', False): + out += '' + else: + out += '' + out += '(ss);\n' + if rtype != 'void' or hasOutParams: + if rtype != 'void': + out += ' ' + rtype + ' rval;\n' + out += ' JSONIterator iterator(json);\n' + out += ' iterator.expectArrayAndGotoFirstItem();\n' + if hasOutParams: + out += ' iterator.expectArrayAndGotoFirstItem();\n' + if rtype != 'void': + customRval = getCustom(iface.GetName(), node.GetName(), "rval").get('convert') + if customRval: + out += customRval + else: + out += ' FromJSON_' + node.GetType(release).GetName() + '(iterator, rval);\n' + if hasOutParams: + out += ' iterator.expectObjectAndGotoFirstProperty();\n' + for param in callnode.GetListOf('Param'): + mode = self.cgen.GetParamMode(param) + ntype, mode = self.cgen.GetRootTypeMode(param, release, mode) + mode = getCustom(param.parent.parent.parent.GetName(), param.parent.GetName(), param.GetName()).get('mode', mode) + if mode == "out" or mode == "inout": + if ntype == 'mem_t' and mode == "inout": + continue; + if ntype == 'Struct' and mode == 'out': + out += ' if (!!' + param.GetName() + ') {\n' + to_indent = ' iterator.skip();\n' + deref = self.DerefOutType.get(ntype, '') + if isinstance(deref, dict): + deref = deref.get(mode, '') + to_indent += self.FromJSON(release, '', deref + param.GetName(), param, mode == 'out', callnode) + if ntype == 'Struct' and mode == 'out': + out += re.sub(r"(^|\n)(?!(\n|$))", r'\1' + (2 * ' '), to_indent) + out += ' }\n' + else: + out += to_indent + if rtype != 'void': + out += ' return rval;\n' + out += '#else // !INTERPOSE\n' + out += ' printf("%s\\n", ss.str().c_str());\n' + #out += ' printf("Calling: %p\\n", RealGetInterface("' + self.cgen.GetInterfaceString(iface, iface.GetVersion(release)) + '"));\n' + #out += ' printf(" -> %p\\n", ((' + self.cgen.GetStructName(iface, release, include_version=True) + '*)RealGetInterface("' + self.cgen.GetInterfaceString(iface, iface.GetVersion(release)) + '"))->' + node.GetName() + ');\n' + out += ' ' + rtype = self.cgen.GetTypeByMode(node.GetType(release), release, 'return') + params = [] + for param in callnode.GetListOf('Param'): + mode = self.cgen.GetParamMode(param) + ntype, mode = self.cgen.GetRootTypeMode(param, release, mode) + if mode == "in" and param.GetType(release).GetName() == 'PP_CompletionCallback': + out += 'PP_CompletionCallback logging_' + param.GetName() + ';\n' + out += ' logging_' + param.GetName() + '.func = &Logging_PP_CompletionCallback;\n' + out += ' logging_' + param.GetName() + '.user_data = new PP_CompletionCallback(' + param.GetName() + ');\n' + out += ' logging_' + param.GetName() + '.flags = ' + param.GetName() + '.flags;\n' + out += ' ' + params.append('logging_' + param.GetName()) + elif mode == "in" and param.GetType(release).GetName() == 'PPP_Class_Deprecated': + out += 'Logging_PPP_Class_Deprecated_holder* logging_' + param.GetName() + ' = new Logging_PPP_Class_Deprecated_holder();\n' + out += ' logging_' + param.GetName() + '->_real_PPP_Class_Deprecated = ' + param.GetName() + ';\n' + out += ' logging_' + param.GetName() + '->object = object_data;\n' + out += ' object_data = logging_' + param.GetName() + ';\n' + out += ' ' + params.append('&_interpose_PPP_Class_Deprecated_1_0') + elif mode == "return" and param.GetType(release).GetName() == 'PPB_Audio_Callback' and param.GetVersion(release) == "1.0": + out += 'Logging_PPB_Audio_Callback_1_0_holder* ' + param.GetName() + '_holder = new Logging_PPB_Audio_Callback_1_0_holder();\n' + out += ' ' + param.GetName() + '_holder->func = ' + param.GetName() + ';\n' + out += ' ' + param.GetName() + '_holder->user_data = user_data;\n' + out += ' user_data = ' + param.GetName() + '_holder;\n' + out += ' ' + params.append('Logging_PPB_Audio_Callback_1_0') + else: + params.append(param.GetName()) + if rtype != 'void': + out += rtype + ' rval = ' + out += '((' + self.cgen.GetStructName(iface, release, include_version=True) + '*)RealGetInterface("' + self.cgen.GetInterfaceString(iface, iface.GetVersion(release)) + '"))->' + node.GetName() + '(' + ', '.join(params) + ');\n' + if rtype != 'void' or hasOutParams: + out += ' printf("RPC response: [");\n' + if hasOutParams: + out += ' printf("[");\n' + if rtype != 'void': + out += ' printf("%s", ToString_' + node.GetType(release).GetName() + '(rval).c_str());\n' + if hasOutParams: + if rtype != 'void': + out += ' printf(",");\n' + out += ' std::stringstream os;\n' + out += ' BeginProps(os);\n' + for param in callnode.GetListOf('Param'): + mode = self.cgen.GetParamMode(param) + ntype, mode = self.cgen.GetRootTypeMode(param, release, mode) + if mode == "out" or mode == "inout": + if mode == "out" and (ntype == 'Struct' or ntype == 'TypeValue'): + out += ' if (!!' + param.GetName() + ') {\n' + out += self.AddProp(release, 'os', '', param, False, callnode) + if mode == "out" and (ntype == 'Struct' or ntype == 'TypeValue'): + out += ' }\n' + out += ' EndProps(os);\n' + out += ' printf("%s]", os.str().c_str());\n' + out += ' printf("]\\n");\n' + if rtype != 'void': + out += ' return rval;\n' + out += '#endif // !INTERPOSE\n' + out += '}\n' + return out + + def DefineInterfaceMethodParser(self, iface, releases, node, release): + if not node.InReleases([release]): + return '/* skipping %s */\n' % node.GetName() + version = self.GetNodeName(iface, release, releases) + out = '' + out += 'char* Call_%s_%s(const %s* _interface, JSONIterator& iterator) {\n' % (iface.GetName(), node.GetName(), version) + callnode = node.GetOneOf('Callspec') + params = [] + hasOutParams = False + for param in callnode.GetListOf('Param'): + mode = self.cgen.GetParamMode(param) + ptype, pname, parray, pspec = self.cgen.GetComponents(param, release, "store") + out += ' ' + self.cgen.Compose(ptype, pname, parray, pspec, '', func_as_ptr=True, + include_name=True, unsized_as_ptr=True) + ';\n' + if mode == 'out': + if len(parray) > 0: + out += ' iterator.skip();\n' + out += ' PointerValueFromJSON(iterator, ' + pname + ');\n' + else: + out += ' iterator.skip();\n' + out += self.FromJSON(release, '', pname, param, True, callnode) + hasOutParams = hasOutParams or mode == "out" or mode == "inout" + if node.GetProperty('ref'): + mode = 'ref' + else: + mode = 'store' + rtype = self.cgen.GetTypeByMode(node.GetType(release), release, 'store') + out += ' ' + if rtype != 'void': + out += rtype + ' rval;\n' + out += ' rval = ' + params = [] + for param in callnode.GetListOf('Param'): + mode = self.cgen.GetParamMode(param) + ntype, mode = self.cgen.GetRootTypeMode(param, release, mode) + ptype, pname, parray, pspec = self.cgen.GetComponents(param, release, mode) + if mode == 'out' or ntype == 'Struct' or (mode == 'constptr_in' and ntype == 'TypeValue'): + pname = '&' + pname + pname = '(' + self.cgen.Compose(ptype, pname, parray, pspec, '', func_as_ptr=True, + include_name=False, unsized_as_ptr=True) + ')' + pname + params.append(pname) + out += '_interface->' + node.GetName() + '(' + ", ".join(params) + ');\n' + if rtype != 'void' or hasOutParams: + typeref = node.GetType(release) + if hasOutParams: + out += ' stringstream os;\n' + out += ' BeginElements(os);\n' + if rtype != 'void': + out += ' AddElement(os, ToString_' + typeref.GetName() + '(rval).c_str());\n' + out += ' BeginElement(os);\n' + out += ' BeginProps(os);\n' + for param in callnode.GetListOf('Param'): + mode = self.cgen.GetParamMode(param) + ntype, mode = self.cgen.GetRootTypeMode(param, release, mode) + ptype, pname, parray, pspec = self.cgen.GetComponents(param, release, mode) + if mode == 'out' or mode == 'inout': + out += self.AddProp(release, 'os', '', param, False, callnode, derefSizeIs=False) + out += ' EndProps(os);\n' + out += ' EndElements(os);\n' + out += ' return strdup(os.str().c_str());\n' + else: + out += ' return strdup(ToString_' + typeref.GetName() + '(rval).c_str());\n' + else: + out += ' return nullptr;\n' + out += '}\n' + return out + + def DefineInterface(self, node, releases, declareOnly): + out = '' + if node.GetName() == "PPB_NaCl_Private": + # skip + return out + isPPP = node.GetName()[0:4] == "PPP_" + build_list = node.GetUniqueReleases(releases) + for release in build_list: + name = self.cgen.GetStructName(node, release, include_version=True) + if declareOnly: + out += '#ifdef INTERPOSE\n' + out += 'static ' + name + ' *_real_' + name + ';\n' + out += '#endif // INTERPOSE\n' + if isPPP: + version = self.GetNodeName(node, release, build_list) + if declareOnly: + out += 'static char* Call_%s(void* _interface, JSONIterator& iterator);\n' % (version) + continue + members = node.GetListOf('Member') + for member in members: + out += self.DefineInterfaceMethodParser(node, build_list, member, release) + out += 'char* Call_%s(const void* _interface, JSONIterator& iterator) {\n' % (version) + out += ' iterator.skip();\n' + out += ' const Token& member = iterator.getCurrentStringAndGotoNext();\n' + out += ' string memberName = member.value();\n' + for member in members: + if not member.InReleases([release]): + out += '/* skipping %s */\n' % member.GetName() + continue + out += ' if (!memberName.compare("' + member.GetName() + '")) {\n' + out += ' return Call_' + node.GetName() + '_' + member.GetName() + '((const ' + version + '*)_interface, iterator);\n' + out += ' }\n' + out += ' return nullptr;\n' + out += '}\n' + self.pppInterfaceGetters.append((self.cgen.GetInterfaceString(node, node.GetVersion(release)), 'Call_' + version)) + continue + version = self.cgen.GetStructName(node, release, include_version=True) + if declareOnly: + out += 'const string ToString_%s(const %s *v);\n' % (node.GetName(), version) + continue + ns = 'ns_' + version + out += 'namespace ' + ns + ' {\n' + members = node.GetListOf('Member') + for member in members: + out += self.DefineInterfaceMethodSerializer(node, releases, member, release) + out += '}\n' + self.interfaceStructs.append((self.cgen.GetInterfaceString(node, node.GetVersion(release)), '_' + name)) + out += 'static ' + name + ' _' + name + ' = {\n' + for member in members: + if not member.InReleases([release]): + continue + memberName = self.cgen.GetStructName(member, release, True) + out += ' ' + ns + '::' + memberName + ',\n' + out += '};\n' + out += 'const string ToString_%s(const %s *v) {\n' % (node.GetName(), version) + out += ' stringstream s;\n' + out += ' s << v;\n' + out += ' return s.str();\n' + out += '}\n' + return out + + def GetNodeName(self, node, release, build_list): + return self.cgen.GetStructName(node, release, include_version=(release != build_list[-1])) + + @staticmethod + def SerializerAndParserSignatures(typename, type): + s = ('const string ToString_%s(const %s *v)', + 'const string ToString_%s(const %s &v)', + 'void FromJSON_%s(JSONIterator& iterator, %s &value)') + return (sig % (typename, type) for sig in s) + + def DefineTypedefSerializerAndParser(self, node, releases, declareOnly): + out = '' + build_list = node.GetUniqueReleases(releases) + for release in build_list: + type = self.GetNodeName(node, release, build_list) + typeref = node.GetType(release) + (toStringFromPointer, toStringFromRef, fromJSONToRef) = self.SerializerAndParserSignatures(node.GetName(), type) + isFuncPtr = node.GetOneOf('Callspec') + if declareOnly: + if not isFuncPtr: + out += toStringFromPointer + ";\n" + out += toStringFromRef + ";\n" + out += fromJSONToRef + ";\n" + continue + if not isFuncPtr: + out += toStringFromPointer + ' {\n' + out += ' return ToString_%s(v);\n' % (typeref.GetName()) + out += '}\n' + out += toStringFromRef + ' {\n' + if isFuncPtr: + out += ' return PointerToString(v);\n' + else: + out += ' return ToString_%s(&v);\n' % (node.GetName()) + out += '}\n' + out += fromJSONToRef + ' {\n' + if isFuncPtr: + out += ' PointerValueFromJSON(iterator, value);\n' + else: + out += ' FromJSON_%s(iterator, value);\n' % (typeref.GetName()) + out += '}\n' + return out + + def DefineStructSerializerAndParser(self, node, releases, declareOnly): + out = '' + build_list = node.GetUniqueReleases(releases) + for release in build_list: + name = node.GetName() + version = self.GetNodeName(node, release, build_list) + (toStringFromPointer, toStringFromRef, fromJSONToRef) = self.SerializerAndParserSignatures(name, version) + if declareOnly: + out += toStringFromPointer + ";\n" + out += toStringFromRef + ";\n" + out += fromJSONToRef + ";\n" + continue + out += toStringFromPointer + ' {\n' + out += ' if (!v) {\n' + out += ' return "null";\n' + out += ' }\n' + out += ' return ToString_%s(*v);\n' % (name) + out += '}\n' + out += toStringFromRef + ' {\n' + out += ' stringstream x;\n' + out += ' BeginProps(x);\n' + members = node.GetListOf('Member') + for member in members: + out += self.AddProp(release, 'x', 'v.', member) + out += ' EndProps(x);\n' + out += ' return x.str();\n' + out += '}\n' + out += fromJSONToRef + ' {\n' + out += ' const JSON::Token& current = iterator.getCurrentAndGotoNext();\n' + # FIXME Should we warn here somehow? It might be ok to return null in + # error conditions, so maybe not. + out += ' if (current.isPrimitive() && !current.value().compare("null")) {\n' + out += ' return;\n' + out += ' }\n' + out += ' if (!current.isObject()) {\n' + out += ' Fail("Expected object!", "");\n' + out += ' }\n' + if node.GetProperty('union'): + out += ' string name = iterator.getCurrentStringAndGotoNext().value();\n' + out += " else ".join(map(lambda m: ' if (!name.compare(\"' + m.GetName() + '\")) {\n ' + self.MemberFromJSON(release, 'value.', m, False) + ' }', members)) + "\n" + else: + for member in members: + typeref = member.GetType(release) + out += ' iterator.skip();\n' + out += self.MemberFromJSON(release, 'value.', member, False) + out += '}\n' + return out + + def DefineEnumSerializerAndParser(self, node, releases, declareOnly): + if node.GetProperty('unnamed'): + return '' + out = '' + name = node.GetName() + (toStringFromPointer, toStringFromRef, fromJSONToRef) = self.SerializerAndParserSignatures(name, name) + if declareOnly: + out += toStringFromPointer + ";\n" + out += toStringFromRef + ";\n" + out += fromJSONToRef + ";\n" + return out + out += toStringFromPointer + ' {\n' + out += ' switch (*v) {\n' + next = 0 + emitted = set() + for child in node.GetListOf('EnumItem'): + value = child.GetName() + label = child.GetProperty('VALUE') + if not label: + label = str(next) + next = next + 1 + if label in emitted: + continue + emitted.add(label) + emitted.add(value) + out += ' case ' + label + ':\n' + out += ' return "\\"' + value + '\\"";\n' + out += ' default:\n' + out += ' return "\\"???\\"";\n' + out += ' }\n' + out += '}\n' + out += toStringFromRef + ' {\n' + out += ' return ToString_%s(&v);\n' % (name) + out += '}\n' + out += fromJSONToRef + ' {\n' + out += ' long int v;\n' + out += ' FromJSON_int(iterator, v);\n' + out += ' value = %s(v);\n' % (name) + out += '}\n' + return out + + def Define(self, node, releases, declareOnly): + # Skip if this node is not in this release + if not node.InReleases(releases): + return "/* skipping %s */\n" % node + if node.IsA('Typedef'): + return self.DefineTypedefSerializerAndParser(node, releases, declareOnly) + if node.IsA('Struct'): + return self.DefineStructSerializerAndParser(node, releases, declareOnly) + if node.IsA('Enum'): + return self.DefineEnumSerializerAndParser(node, releases, declareOnly) + if node.IsA('Interface'): + return self.DefineInterface(node, releases, declareOnly) + return '' + +def GetIncludes(f, releases): + deps = set() + for release in releases: + deps |= f.GetDeps(release) + includes = set([]) + for dep in deps: + depfile = dep.GetProperty('FILE') + if depfile: + includes.add(depfile) + return includes + +def GenerateDep(outfile, emitted, f, releases): + includes = GetIncludes(f, releases) + for include in includes: + if include in emitted: + continue + emitted.add(include) + GenerateDep(outfile, emitted, include, releases) + outfile.Write('/* ' + include.GetName() + ' */') + GenerateHeader(outfile, include, releases) + +def main(args): + filenames = ParseOptions(args) + ast = ParseFiles(filenames) + rpcgen = RPCGen() + files = ast.GetListOf('File') + outname = GetOption('out') + if outname == '': + outname = 'out.cc' + outfile = IDLOutFile(outname) + emitted = set() + for f in files: + if f.GetName() == 'pp_macros.idl': + GenerateDep(outfile, emitted, f, ast.releases) + for f in files: + GenerateDep(outfile, emitted, f, ast.releases) + out = '' + out += '#include "host/rpc.h"\n' + out += '#include "json/json.cpp"\n' + out += 'using namespace std;\n' + out += 'using namespace JSON;\n' + for declareOnly in [True,False]: + for f in files: + if f.GetProperty('ERRORS') > 0: + print 'Skipping %s' % f.GetName() + continue + for node in f.GetChildren()[2:]: + out += rpcgen.Define(node, ast.releases, declareOnly) + out += 'static map gInterfaces;\n' + out += '\n' + out += 'typedef char* (*InterfaceMemberCallFunc)(const void*, JSONIterator&);\n' + out += 'static map gInterfaceMemberCallers;\n' + out += '\n' + out += 'void InitializeInterfaceList() {\n' + for (interfaceString, interfaceStruct) in rpcgen.interfaceStructs: + if interfaceString == "PPB_Flash_File_FileRef;2.0": + interfaceString = "PPB_Flash_File_FileRef;2" + elif interfaceString == "PPB_Flash_File_ModuleLocal;3.0": + interfaceString = "PPB_Flash_File_ModuleLocal;3" + elif interfaceString == "PPB_PDF;0.1": + interfaceString = "PPB_PDF;1" + out += ' gInterfaces.insert(pair("' + interfaceString + '", &' + interfaceStruct + '));\n' + for (interfaceString, caller) in rpcgen.pppInterfaceGetters: + out += ' gInterfaceMemberCallers.insert(pair("' + interfaceString + '", ' + caller + '));\n' + out += '};\n' + out += '\n' + outfile.Write(out); + outfile.Close() + +if __name__ == '__main__': + sys.exit(main(sys.argv[1:])) diff --git a/browser/extensions/mortar/ppapi/generators/idl_gen_wrapper.py b/browser/extensions/mortar/ppapi/generators/idl_gen_wrapper.py new file mode 100644 index 000000000000..5d38eff8c9a9 --- /dev/null +++ b/browser/extensions/mortar/ppapi/generators/idl_gen_wrapper.py @@ -0,0 +1,438 @@ +# Copyright (c) 2012 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +"""Base class for generating wrapper functions for PPAPI methods. +""" + +from datetime import datetime +import os +import sys + +from idl_c_proto import CGen +from idl_generator import Generator +from idl_log import ErrOut, InfoOut, WarnOut +from idl_option import GetOption +from idl_outfile import IDLOutFile + + +class PPKind(object): + @staticmethod + def ChoosePPFunc(iface, ppb_func, ppp_func): + name = iface.node.GetName() + if name.startswith("PPP"): + return ppp_func + elif name.startswith("PPB"): + return ppb_func + else: + raise Exception('Unknown PPKind for ' + name) + + +class Interface(object): + """Tracks information about a particular interface version. + + - struct_name: the struct type used by the ppapi headers to hold the + method pointers (the vtable). + - needs_wrapping: True if a method in the interface needs wrapping. + - header_file: the name of the header file that defined this interface. + """ + def __init__(self, interface_node, release, version, + struct_name, needs_wrapping, header_file): + self.node = interface_node + self.release = release + self.version = version + self.struct_name = struct_name + # We may want finer grained filtering (method level), but it is not + # yet clear how to actually do that. + self.needs_wrapping = needs_wrapping + self.header_file = header_file + + +class WrapperGen(Generator): + """WrapperGen - An abstract class that generates wrappers for PPAPI methods. + + This generates a wrapper PPB and PPP GetInterface, which directs users + to wrapper PPAPI methods. Wrapper PPAPI methods may perform arbitrary + work before invoking the real PPAPI method (supplied by the original + GetInterface functions). + + Subclasses must implement GenerateWrapperForPPBMethod (and PPP). + """ + + def __init__(self, wrapper_prefix, s1, s2, s3): + Generator.__init__(self, s1, s2, s3) + self.wrapper_prefix = wrapper_prefix + self._skip_opt = False + self.output_file = None + self.cgen = CGen() + + def SetOutputFile(self, fname): + self.output_file = fname + + + def GenerateRelease(self, ast, release, options): + return self.GenerateRange(ast, [release], options) + + + @staticmethod + def GetHeaderName(name): + """Get the corresponding ppapi .h file from each IDL filename. + """ + name = os.path.splitext(name)[0] + '.h' + name = name.replace(os.sep, '/') + return 'ppapi/c/' + name + + + def WriteCopyright(self, out): + now = datetime.now() + c = """/* Copyright (c) %s The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* NOTE: this is auto-generated from IDL */ +""" % now.year + out.Write(c) + + def GetWrapperMetadataName(self): + return '__%sWrapperInfo' % self.wrapper_prefix + + + def GenerateHelperFunctions(self, out): + """Generate helper functions to avoid dependencies on libc. + """ + out.Write("""/* Use local strcmp to avoid dependency on libc. */ +static int mystrcmp(const char* s1, const char *s2) { + while (1) { + if (*s1 == 0) break; + if (*s2 == 0) break; + if (*s1 != *s2) break; + ++s1; + ++s2; + } + return (int)(*s1) - (int)(*s2); +}\n +""") + + + def GenerateFixedFunctions(self, out): + """Write out the set of constant functions (those that do not depend on + the current Pepper IDL). + """ + out.Write(""" + +static PPB_GetInterface __real_PPBGetInterface; +static PPP_GetInterface_Type __real_PPPGetInterface; + +void __set_real_%(wrapper_prefix)s_PPBGetInterface(PPB_GetInterface real) { + __real_PPBGetInterface = real; +} + +void __set_real_%(wrapper_prefix)s_PPPGetInterface(PPP_GetInterface_Type real) { + __real_PPPGetInterface = real; +} + +/* Map interface string -> wrapper metadata */ +static struct %(wrapper_struct)s *%(wrapper_prefix)sPPBShimIface( + const char *name) { + struct %(wrapper_struct)s **next = s_ppb_wrappers; + while (*next != NULL) { + if (mystrcmp(name, (*next)->iface_macro) == 0) return *next; + ++next; + } + return NULL; +} + +/* Map interface string -> wrapper metadata */ +static struct %(wrapper_struct)s *%(wrapper_prefix)sPPPShimIface( + const char *name) { + struct %(wrapper_struct)s **next = s_ppp_wrappers; + while (*next != NULL) { + if (mystrcmp(name, (*next)->iface_macro) == 0) return *next; + ++next; + } + return NULL; +} + +const void *__%(wrapper_prefix)s_PPBGetInterface(const char *name) { + struct %(wrapper_struct)s *wrapper = %(wrapper_prefix)sPPBShimIface(name); + if (wrapper == NULL) { + /* We did not generate a wrapper for this, so return the real interface. */ + return (*__real_PPBGetInterface)(name); + } + + /* Initialize the real_iface if it hasn't been. The wrapper depends on it. */ + if (wrapper->real_iface == NULL) { + const void *iface = (*__real_PPBGetInterface)(name); + if (NULL == iface) return NULL; + wrapper->real_iface = iface; + } + + return wrapper->wrapped_iface; +} + +const void *__%(wrapper_prefix)s_PPPGetInterface(const char *name) { + struct %(wrapper_struct)s *wrapper = %(wrapper_prefix)sPPPShimIface(name); + if (wrapper == NULL) { + /* We did not generate a wrapper for this, so return the real interface. */ + return (*__real_PPPGetInterface)(name); + } + + /* Initialize the real_iface if it hasn't been. The wrapper depends on it. */ + if (wrapper->real_iface == NULL) { + const void *iface = (*__real_PPPGetInterface)(name); + if (NULL == iface) return NULL; + wrapper->real_iface = iface; + } + + return wrapper->wrapped_iface; +} +""" % { 'wrapper_struct' : self.GetWrapperMetadataName(), + 'wrapper_prefix' : self.wrapper_prefix, + } ) + + + ############################################################ + + def OwnHeaderFile(self): + """Return the header file that specifies the API of this wrapper. + We do not generate the header files. """ + raise Exception('Child class must implement this') + + + ############################################################ + + def DetermineInterfaces(self, ast, releases): + """Get a list of interfaces along with whatever metadata we need. + """ + iface_releases = [] + for filenode in ast.GetListOf('File'): + # If this file has errors, skip it + if filenode in self.skip_list: + if GetOption('verbose'): + InfoOut.Log('WrapperGen: Skipping %s due to errors\n' % + filenode.GetName()) + continue + + file_name = self.GetHeaderName(filenode.GetName()) + ifaces = filenode.GetListOf('Interface') + for iface in ifaces: + releases_for_iface = iface.GetUniqueReleases(releases) + for release in releases_for_iface: + version = iface.GetVersion(release) + struct_name = self.cgen.GetStructName(iface, release, + include_version=True) + needs_wrap = self.InterfaceVersionNeedsWrapping(iface, version) + if not needs_wrap: + if GetOption('verbose'): + InfoOut.Log('Interface %s ver %s does not need wrapping' % + (struct_name, version)) + iface_releases.append( + Interface(iface, release, version, + struct_name, needs_wrap, file_name)) + return iface_releases + + + def GenerateIncludes(self, iface_releases, out): + """Generate the list of #include that define the original interfaces. + """ + self.WriteCopyright(out) + # First include own header. + out.Write('#include "%s"\n\n' % self.OwnHeaderFile()) + + # Get typedefs for PPB_GetInterface. + out.Write('#include "%s"\n' % self.GetHeaderName('ppb.h')) + + # Only include headers where *some* interface needs wrapping. + header_files = set() + for iface in iface_releases: + if iface.needs_wrapping: + header_files.add(iface.header_file) + for header in sorted(header_files): + out.Write('#include "%s"\n' % header) + out.Write('\n') + + + def WrapperMethodPrefix(self, iface, release): + return '%s_%s_%s_' % (self.wrapper_prefix, release, iface.GetName()) + + + def GenerateWrapperForPPBMethod(self, iface, member): + result = [] + func_prefix = self.WrapperMethodPrefix(iface.node, iface.release) + sig = self.cgen.GetSignature(member, iface.release, 'store', + func_prefix, False) + result.append('static %s {\n' % sig) + result.append(' while(1) { /* Not implemented */ } \n') + result.append('}\n') + return result + + + def GenerateWrapperForPPPMethod(self, iface, member): + result = [] + func_prefix = self.WrapperMethodPrefix(iface.node, iface.release) + sig = self.cgen.GetSignature(member, iface.release, 'store', + func_prefix, False) + result.append('static %s {\n' % sig) + result.append(' while(1) { /* Not implemented */ } \n') + result.append('}\n') + return result + + + def GenerateWrapperForMethods(self, iface_releases, comments=True): + """Return a string representing the code for each wrapper method + (using a string rather than writing to the file directly for testing.) + """ + result = [] + for iface in iface_releases: + if not iface.needs_wrapping: + if comments: + result.append('/* Not generating wrapper methods for %s */\n\n' % + iface.struct_name) + continue + if comments: + result.append('/* Begin wrapper methods for %s */\n\n' % + iface.struct_name) + generator = PPKind.ChoosePPFunc(iface, + self.GenerateWrapperForPPBMethod, + self.GenerateWrapperForPPPMethod) + for member in iface.node.GetListOf('Member'): + # Skip the method if it's not actually in the release. + if not member.InReleases([iface.release]): + continue + result.extend(generator(iface, member)) + if comments: + result.append('/* End wrapper methods for %s */\n\n' % + iface.struct_name) + return ''.join(result) + + + def GenerateWrapperInterfaces(self, iface_releases, out): + for iface in iface_releases: + if not iface.needs_wrapping: + out.Write('/* Not generating wrapper interface for %s */\n\n' % + iface.struct_name) + continue + + out.Write('static const struct %s %s_Wrappers_%s = {\n' % ( + iface.struct_name, self.wrapper_prefix, iface.struct_name)) + methods = [] + for member in iface.node.GetListOf('Member'): + # Skip the method if it's not actually in the release. + if not member.InReleases([iface.release]): + continue + prefix = self.WrapperMethodPrefix(iface.node, iface.release) + # Casts are necessary for the PPB_* wrappers because we must + # cast away "__attribute__((pnaclcall))". The PPP_* wrappers + # must match the default calling conventions and so don't have + # the attribute, so omitting casts for them provides a little + # extra type checking. + if iface.node.GetName().startswith('PPB_'): + cast = '(%s)' % self.cgen.GetSignature( + member, iface.release, 'return', + prefix='', + func_as_ptr=True, + include_name=False) + else: + cast = '' + methods.append(' .%s = %s&%s%s' % (member.GetName(), + cast, + prefix, + member.GetName())) + out.Write(' ' + ',\n '.join(methods) + '\n') + out.Write('};\n\n') + + + def GetWrapperInfoName(self, iface): + return '%s_WrapperInfo_%s' % (self.wrapper_prefix, iface.struct_name) + + + def GenerateWrapperInfoAndCollection(self, iface_releases, out): + for iface in iface_releases: + iface_macro = self.cgen.GetInterfaceMacro(iface.node, iface.version) + if iface.needs_wrapping: + wrap_iface = '(const void *) &%s_Wrappers_%s' % (self.wrapper_prefix, + iface.struct_name) + out.Write("""static struct %s %s = { + .iface_macro = %s, + .wrapped_iface = %s, + .real_iface = NULL +};\n\n""" % (self.GetWrapperMetadataName(), + self.GetWrapperInfoName(iface), + iface_macro, + wrap_iface)) + + # Now generate NULL terminated arrays of the above wrapper infos. + ppb_wrapper_infos = [] + ppp_wrapper_infos = [] + for iface in iface_releases: + if iface.needs_wrapping: + appender = PPKind.ChoosePPFunc(iface, + ppb_wrapper_infos.append, + ppp_wrapper_infos.append) + appender(' &%s' % self.GetWrapperInfoName(iface)) + ppb_wrapper_infos.append(' NULL') + ppp_wrapper_infos.append(' NULL') + out.Write( + 'static struct %s *s_ppb_wrappers[] = {\n%s\n};\n\n' % + (self.GetWrapperMetadataName(), ',\n'.join(ppb_wrapper_infos))) + out.Write( + 'static struct %s *s_ppp_wrappers[] = {\n%s\n};\n\n' % + (self.GetWrapperMetadataName(), ',\n'.join(ppp_wrapper_infos))) + + + def DeclareWrapperInfos(self, iface_releases, out): + """The wrapper methods usually need access to the real_iface, so we must + declare these wrapper infos ahead of time (there is a circular dependency). + """ + out.Write('/* BEGIN Declarations for all Wrapper Infos */\n\n') + for iface in iface_releases: + if iface.needs_wrapping: + out.Write('static struct %s %s;\n' % + (self.GetWrapperMetadataName(), + self.GetWrapperInfoName(iface))) + out.Write('/* END Declarations for all Wrapper Infos. */\n\n') + + + def GenerateRange(self, ast, releases, options): + """Generate shim code for a range of releases. + """ + + # Remember to set the output filename before running this. + out_filename = self.output_file + if out_filename is None: + ErrOut.Log('Did not set filename for writing out wrapper\n') + return 1 + + InfoOut.Log("Generating %s for %s" % (out_filename, self.wrapper_prefix)) + + out = IDLOutFile(out_filename) + + # Get a list of all the interfaces along with metadata. + iface_releases = self.DetermineInterfaces(ast, releases) + + # Generate the includes. + self.GenerateIncludes(iface_releases, out) + + # Write out static helper functions (mystrcmp). + self.GenerateHelperFunctions(out) + + # Declare list of WrapperInfo before actual wrapper methods, since + # they reference each other. + self.DeclareWrapperInfos(iface_releases, out) + + # Generate wrapper functions for each wrapped method in the interfaces. + result = self.GenerateWrapperForMethods(iface_releases) + out.Write(result) + + # Collect all the wrapper functions into interface structs. + self.GenerateWrapperInterfaces(iface_releases, out) + + # Generate a table of the wrapped interface structs that can be looked up. + self.GenerateWrapperInfoAndCollection(iface_releases, out) + + # Write out the IDL-invariant functions. + self.GenerateFixedFunctions(out) + + out.Close() + return 0 diff --git a/browser/extensions/mortar/ppapi/generators/idl_generator.py b/browser/extensions/mortar/ppapi/generators/idl_generator.py new file mode 100755 index 000000000000..028a233435b9 --- /dev/null +++ b/browser/extensions/mortar/ppapi/generators/idl_generator.py @@ -0,0 +1,277 @@ +#!/usr/bin/env python +# Copyright (c) 2012 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import sys + +from idl_log import ErrOut, InfoOut, WarnOut +from idl_option import GetOption, Option, ParseOptions +from idl_parser import ParseFiles + +GeneratorList = [] + +Option('out', 'List of output files', default='') +Option('release', 'Which release to generate.', default='') +Option('range', 'Which ranges in the form of MIN,MAX.', default='start,end') + +class Generator(object): + """Base class for generators. + + This class provides a mechanism for adding new generator objects to the IDL + driver. To use this class override the GenerateRelease and GenerateRange + members, and instantiate one copy of the class in the same module which + defines it to register the generator. After the AST is generated, call the + static Run member which will check every registered generator to see which + ones have been enabled through command-line options. To enable a generator + use the switches: + -- : To enable with defaults + --_opt= : To enable with generator specific options. + + NOTE: Generators still have access to global options + """ + + def __init__(self, name, sname, desc): + self.name = name + self.run_switch = Option(sname, desc) + self.opt_switch = Option(sname + '_opt', 'Options for %s.' % sname, + default='') + GeneratorList.append(self) + self.errors = 0 + self.skip_list = [] + + def Error(self, msg): + ErrOut.Log('Error %s : %s' % (self.name, msg)) + self.errors += 1 + + def GetRunOptions(self): + options = {} + option_list = self.opt_switch.Get() + if option_list: + option_list = option_list.split(',') + for opt in option_list: + offs = opt.find('=') + if offs > 0: + options[opt[:offs]] = opt[offs+1:] + else: + options[opt] = True + return options + if self.run_switch.Get(): + return options + return None + + def Generate(self, ast, options): + self.errors = 0 + + rangestr = GetOption('range') + releasestr = GetOption('release') + + print "Found releases: %s" % ast.releases + + # Generate list of files to ignore due to errors + for filenode in ast.GetListOf('File'): + # If this file has errors, skip it + if filenode.GetProperty('ERRORS') > 0: + self.skip_list.append(filenode) + continue + + # Check for a range option which over-rides a release option + if not releasestr and rangestr: + range_list = rangestr.split(',') + if len(range_list) != 2: + self.Error('Failed to generate for %s, incorrect range: "%s"' % + (self.name, rangestr)) + else: + vmin = range_list[0] + vmax = range_list[1] + + # Generate 'start' and 'end' represent first and last found. + if vmin == 'start': + vmin = ast.releases[0] + if vmax == 'end': + vmax = ast.releases[-1] + + vmin = ast.releases.index(vmin) + vmax = ast.releases.index(vmax) + 1 + releases = ast.releases[vmin:vmax] + InfoOut.Log('Generate range %s of %s.' % (rangestr, self.name)) + ret = self.GenerateRange(ast, releases, options) + if ret < 0: + self.Error('Failed to generate range %s : %s.' %(vmin, vmax)) + else: + InfoOut.Log('%s wrote %d files.' % (self.name, ret)) + # Otherwise this should be a single release generation + else: + if releasestr == 'start': + releasestr = ast.releases[0] + if releasestr == 'end': + releasestr = ast.releases[-1] + + if releasestr > ast.releases[-1]: + InfoOut.Log('There is no unique release for %s, using last release.' % + releasestr) + releasestr = ast.releases[-1] + + if releasestr not in ast.releases: + self.Error('Release %s not in [%s].' % + (releasestr, ', '.join(ast.releases))) + + if releasestr: + InfoOut.Log('Generate release %s of %s.' % (releasestr, self.name)) + ret = self.GenerateRelease(ast, releasestr, options) + if ret < 0: + self.Error('Failed to generate release %s.' % releasestr) + else: + InfoOut.Log('%s wrote %d files.' % (self.name, ret)) + + else: + self.Error('No range or release specified for %s.' % releasestr) + return self.errors + + def GenerateRelease(self, ast, release, options): + __pychecker__ = 'unusednames=ast,release,options' + self.Error("Undefined release generator.") + return 0 + + def GenerateRange(self, ast, releases, options): + __pychecker__ = 'unusednames=ast,releases,options' + self.Error("Undefined range generator.") + return 0 + + @staticmethod + def Run(ast): + fail_count = 0 + + # Check all registered generators if they should run. + for gen in GeneratorList: + options = gen.GetRunOptions() + if options is not None: + if gen.Generate(ast, options): + fail_count += 1 + return fail_count + + +class GeneratorByFile(Generator): + """A simplified generator that generates one output file per IDL source file. + + A subclass of Generator for use of generators which have a one to one + mapping between IDL sources and output files. + + Derived classes should define GenerateFile. + """ + + def GenerateFile(self, filenode, releases, options): + """Generates an output file from the IDL source. + + Returns true if the generated file is different than the previously + generated file. + """ + __pychecker__ = 'unusednames=filenode,releases,options' + self.Error("Undefined release generator.") + return 0 + + def GenerateRelease(self, ast, release, options): + return self.GenerateRange(ast, [release], options) + + def GenerateRange(self, ast, releases, options): + # Get list of out files + outlist = GetOption('out') + if outlist: outlist = outlist.split(',') + + skipList = [] + cnt = 0 + for filenode in ast.GetListOf('File'): + # Ignore files with errors + if filenode in self.skip_list: + continue + + # Skip this file if not required + if outlist and filenode.GetName() not in outlist: + continue + + # Create the output file and increment out count if there was a delta + if self.GenerateFile(filenode, releases, options): + cnt = cnt + 1 + + for filenode in skipList: + errcnt = filenode.GetProperty('ERRORS') + ErrOut.Log('%s : Skipped because of %d errors.' % ( + filenode.GetName(), errcnt)) + + if skipList: + return -len(skipList) + + if GetOption('diff'): + return -cnt + return cnt + + +check_release = 0 +check_range = 0 + +class GeneratorReleaseTest(Generator): + def GenerateRelease(self, ast, release, options = {}): + __pychecker__ = 'unusednames=ast,release,options' + global check_release + check_map = { + 'so_long': True, + 'MyOpt': 'XYZ', + 'goodbye': True + } + check_release = 1 + for item in check_map: + check_item = check_map[item] + option_item = options.get(item, None) + if check_item != option_item: + print 'Option %s is %s, expecting %s' % (item, option_item, check_item) + check_release = 0 + + if release != 'M14': + check_release = 0 + return check_release == 1 + + def GenerateRange(self, ast, releases, options): + __pychecker__ = 'unusednames=ast,releases,options' + global check_range + check_range = 1 + return True + +def Test(): + __pychecker__ = 'unusednames=args' + global check_release + global check_range + + ParseOptions(['--testgen_opt=so_long,MyOpt=XYZ,goodbye']) + if Generator.Run('AST') != 0: + print 'Generate release: Failed.\n' + return -1 + + if check_release != 1 or check_range != 0: + print 'Gererate release: Failed to run.\n' + return -1 + + check_release = 0 + ParseOptions(['--testgen_opt="HELLO"', '--range=M14,M16']) + if Generator.Run('AST') != 0: + print 'Generate range: Failed.\n' + return -1 + + if check_release != 0 or check_range != 1: + print 'Gererate range: Failed to run.\n' + return -1 + + print 'Generator test: Pass' + return 0 + + +def Main(args): + if not args: return Test() + filenames = ParseOptions(args) + ast = ParseFiles(filenames) + + return Generator.Run(ast) + + +if __name__ == '__main__': + GeneratorReleaseTest('Test Gen', 'testgen', 'Generator Class Test.') + sys.exit(Main(sys.argv[1:])) diff --git a/browser/extensions/mortar/ppapi/generators/idl_lexer.py b/browser/extensions/mortar/ppapi/generators/idl_lexer.py new file mode 100755 index 000000000000..47d64a243b3e --- /dev/null +++ b/browser/extensions/mortar/ppapi/generators/idl_lexer.py @@ -0,0 +1,352 @@ +#!/usr/bin/env python +# Copyright (c) 2012 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" Lexer for PPAPI IDL """ + +# +# IDL Lexer +# +# The lexer is uses the PLY lex library to build a tokenizer which understands +# WebIDL tokens. +# +# WebIDL, and WebIDL regular expressions can be found at: +# http://dev.w3.org/2006/webapi/WebIDL/ +# PLY can be found at: +# http://www.dabeaz.com/ply/ + +import os.path +import re +import sys + +# +# Try to load the ply module, if not, then assume it is in the third_party +# directory, relative to ppapi +# +try: + from ply import lex +except: + module_path, module_name = os.path.split(__file__) + third_party = os.path.join(module_path, '..', '..', 'third_party') + sys.path.append(third_party) + from ply import lex + +from idl_option import GetOption, Option, ParseOptions + + +Option('output', 'Generate output.') + +# +# IDL Lexer +# +class IDLLexer(object): + # 'tokens' is a value required by lex which specifies the complete list + # of valid token types. + tokens = [ + # Symbol and keywords types + 'COMMENT', + 'DESCRIBE', + 'ENUM', + 'LABEL', + 'SYMBOL', + 'INLINE', + 'INTERFACE', + 'STRUCT', + 'TYPEDEF', + 'OR', + + # Extra WebIDL keywords + 'CALLBACK', + 'DICTIONARY', + 'OPTIONAL', + 'STATIC', + + # Invented for apps use + 'NAMESPACE', + + # Data types + 'FLOAT', + 'OCT', + 'INT', + 'HEX', + 'STRING', + + # Operators + 'LSHIFT', + 'RSHIFT' + ] + + # 'keywords' is a map of string to token type. All SYMBOL tokens are + # matched against keywords, to determine if the token is actually a keyword. + keywords = { + 'describe' : 'DESCRIBE', + 'enum' : 'ENUM', + 'label' : 'LABEL', + 'interface' : 'INTERFACE', + 'readonly' : 'READONLY', + 'struct' : 'STRUCT', + 'typedef' : 'TYPEDEF', + + 'callback' : 'CALLBACK', + 'dictionary' : 'DICTIONARY', + 'optional' : 'OPTIONAL', + 'static' : 'STATIC', + 'namespace' : 'NAMESPACE', + + 'or' : 'OR', + } + + # 'literals' is a value expected by lex which specifies a list of valid + # literal tokens, meaning the token type and token value are identical. + literals = '"*.(){}[],;:=+-/~|&^?' + + # Token definitions + # + # Lex assumes any value or function in the form of 't_' represents a + # regular expression where a match will emit a token of type . In the + # case of a function, the function is called when a match is made. These + # definitions come from WebIDL. + + # 't_ignore' is a special match of items to ignore + t_ignore = ' \t' + + # Constant values + t_FLOAT = r'-?(\d+\.\d*|\d*\.\d+)([Ee][+-]?\d+)?|-?\d+[Ee][+-]?\d+' + t_INT = r'-?[0-9]+[uU]?' + t_OCT = r'-?0[0-7]+' + t_HEX = r'-?0[Xx][0-9A-Fa-f]+' + t_LSHIFT = r'<<' + t_RSHIFT = r'>>' + + # A line ending '\n', we use this to increment the line number + def t_LINE_END(self, t): + r'\n+' + self.AddLines(len(t.value)) + + # We do not process escapes in the IDL strings. Strings are exclusively + # used for attributes, and not used as typical 'C' constants. + def t_STRING(self, t): + r'"[^"]*"' + t.value = t.value[1:-1] + self.AddLines(t.value.count('\n')) + return t + + # A C or C++ style comment: /* xxx */ or // + def t_COMMENT(self, t): + r'(/\*(.|\n)*?\*/)|(//.*(\n[ \t]*//.*)*)' + self.AddLines(t.value.count('\n')) + return t + + # Return a "preprocessor" inline block + def t_INLINE(self, t): + r'\#inline (.|\n)*?\#endinl.*' + self.AddLines(t.value.count('\n')) + return t + + # A symbol or keyword. + def t_KEYWORD_SYMBOL(self, t): + r'_?[A-Za-z][A-Za-z_0-9]*' + + # All non-keywords are assumed to be symbols + t.type = self.keywords.get(t.value, 'SYMBOL') + + # We strip leading underscores so that you can specify symbols with the same + # value as a keywords (E.g. a dictionary named 'interface'). + if t.value[0] == '_': + t.value = t.value[1:] + return t + + def t_ANY_error(self, t): + msg = "Unrecognized input" + line = self.lexobj.lineno + + # If that line has not been accounted for, then we must have hit + # EoF, so compute the beginning of the line that caused the problem. + if line >= len(self.index): + # Find the offset in the line of the first word causing the issue + word = t.value.split()[0] + offs = self.lines[line - 1].find(word) + # Add the computed line's starting position + self.index.append(self.lexobj.lexpos - offs) + msg = "Unexpected EoF reached after" + + pos = self.lexobj.lexpos - self.index[line] + file = self.lexobj.filename + out = self.ErrorMessage(file, line, pos, msg) + sys.stderr.write(out + '\n') + self.lex_errors += 1 + + + def AddLines(self, count): + # Set the lexer position for the beginning of the next line. In the case + # of multiple lines, tokens can not exist on any of the lines except the + # last one, so the recorded value for previous lines are unused. We still + # fill the array however, to make sure the line count is correct. + self.lexobj.lineno += count + for i in range(count): + self.index.append(self.lexobj.lexpos) + + def FileLineMsg(self, file, line, msg): + if file: return "%s(%d) : %s" % (file, line + 1, msg) + return " : %s" % msg + + def SourceLine(self, file, line, pos): + caret = '\t^'.expandtabs(pos) + # We decrement the line number since the array is 0 based while the + # line numbers are 1 based. + return "%s\n%s" % (self.lines[line - 1], caret) + + def ErrorMessage(self, file, line, pos, msg): + return "\n%s\n%s" % ( + self.FileLineMsg(file, line, msg), + self.SourceLine(file, line, pos)) + + def SetData(self, filename, data): + # Start with line 1, not zero + self.lexobj.lineno = 1 + self.lexobj.filename = filename + self.lines = data.split('\n') + self.index = [0] + self.lexobj.input(data) + self.lex_errors = 0 + + def __init__(self): + self.lexobj = lex.lex(object=self, lextab=None, optimize=0) + + + +# +# FilesToTokens +# +# From a set of source file names, generate a list of tokens. +# +def FilesToTokens(filenames, verbose=False): + lexer = IDLLexer() + outlist = [] + for filename in filenames: + data = open(filename).read() + lexer.SetData(filename, data) + if verbose: sys.stdout.write(' Loaded %s...\n' % filename) + while 1: + t = lexer.lexobj.token() + if t is None: break + outlist.append(t) + return outlist + + +def TokensFromText(text): + lexer = IDLLexer() + lexer.SetData('unknown', text) + outlist = [] + while 1: + t = lexer.lexobj.token() + if t is None: break + outlist.append(t.value) + return outlist + +# +# TextToTokens +# +# From a block of text, generate a list of tokens +# +def TextToTokens(source): + lexer = IDLLexer() + outlist = [] + lexer.SetData('AUTO', source) + while 1: + t = lexer.lexobj.token() + if t is None: break + outlist.append(t.value) + return outlist + + +# +# TestSame +# +# From a set of token values, generate a new source text by joining with a +# single space. The new source is then tokenized and compared against the +# old set. +# +def TestSame(values1): + # Recreate the source from the tokens. We use newline instead of whitespace + # since the '//' and #inline regex are line sensitive. + text = '\n'.join(values1) + values2 = TextToTokens(text) + + count1 = len(values1) + count2 = len(values2) + if count1 != count2: + print "Size mismatch original %d vs %d\n" % (count1, count2) + if count1 > count2: count1 = count2 + + for i in range(count1): + if values1[i] != values2[i]: + print "%d >>%s<< >>%s<<" % (i, values1[i], values2[i]) + + if GetOption('output'): + sys.stdout.write('Generating original.txt and tokenized.txt\n') + open('original.txt', 'w').write(src1) + open('tokenized.txt', 'w').write(src2) + + if values1 == values2: + sys.stdout.write('Same: Pass\n') + return 0 + + print "****************\n%s\n%s***************\n" % (src1, src2) + sys.stdout.write('Same: Failed\n') + return -1 + + +# +# TestExpect +# +# From a set of tokens pairs, verify the type field of the second matches +# the value of the first, so that: +# INT 123 FLOAT 1.1 +# will generate a passing test, where the first token is the SYMBOL INT, +# and the second token is the INT 123, third token is the SYMBOL FLOAT and +# the fourth is the FLOAT 1.1, etc... +def TestExpect(tokens): + count = len(tokens) + index = 0 + errors = 0 + while index < count: + type = tokens[index].value + token = tokens[index + 1] + index += 2 + + if type != token.type: + sys.stderr.write('Mismatch: Expected %s, but got %s = %s.\n' % + (type, token.type, token.value)) + errors += 1 + + if not errors: + sys.stdout.write('Expect: Pass\n') + return 0 + + sys.stdout.write('Expect: Failed\n') + return -1 + + +def Main(args): + filenames = ParseOptions(args) + + try: + tokens = FilesToTokens(filenames, GetOption('verbose')) + values = [tok.value for tok in tokens] + if GetOption('output'): sys.stdout.write(' <> '.join(values) + '\n') + if GetOption('test'): + if TestSame(values): + return -1 + if TestExpect(tokens): + return -1 + return 0 + + except lex.LexError as le: + sys.stderr.write('%s\n' % str(le)) + return -1 + + +if __name__ == '__main__': + sys.exit(Main(sys.argv[1:])) diff --git a/browser/extensions/mortar/ppapi/generators/idl_lint.py b/browser/extensions/mortar/ppapi/generators/idl_lint.py new file mode 100644 index 000000000000..d60f7e32b8e6 --- /dev/null +++ b/browser/extensions/mortar/ppapi/generators/idl_lint.py @@ -0,0 +1,122 @@ +# Copyright (c) 2012 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" Lint for IDL """ + +import os +import sys + +from idl_log import ErrOut, InfoOut, WarnOut +from idl_node import IDLAttribute, IDLNode +from idl_ast import IDLAst +from idl_option import GetOption, Option, ParseOptions +from idl_outfile import IDLOutFile +from idl_visitor import IDLVisitor + + +Option('wcomment', 'Disable warning for missing comment.') +Option('wenum', 'Disable warning for missing enum value.') +Option('winline', 'Disable warning for inline blocks.') +Option('wname', 'Disable warning for inconsistent interface name.') +Option('wnone', 'Disable all warnings.') +Option('wparam', 'Disable warning for missing [in|out|inout] on param.') +Option('wpass', 'Disable warning for mixed passByValue and returnByValue.') + +# +# IDLLinter +# +# Once the AST is build, we need to resolve the namespace and version +# information. +# +class IDLLinter(IDLVisitor): + def VisitFilter(self, node, data): + __pychecker__ = 'unusednames=node,data' + return not node.IsA('Comment', 'Copyright') + + def Arrive(self, node, errors): + __pychecker__ = 'unusednames=node,errors' + warnings = 0 + if node.IsA('Interface', 'Member', 'Struct', 'Enum', 'EnumItem', 'Typedef'): + comments = node.GetListOf('Comment') + if not comments and not node.GetProperty('wcomment'): + node.Warning('Expecting a comment.') + warnings += 1 + + if node.IsA('File'): + labels = node.GetListOf('Label') + interfaces = node.GetListOf('Interface') + if interfaces and not labels: + node.Warning('Expecting a label in a file containing interfaces.') + + if node.IsA('Struct', 'Typedef') and not node.GetProperty('wpass'): + if node.GetProperty('passByValue'): + pbv = 'is' + else: + pbv = 'is not' + if node.GetProperty('returnByValue'): + ret = 'is' + else: + ret = 'is not' + if pbv != ret: + node.Warning('%s passByValue but %s returnByValue.' % (pbv, ret)) + warnings += 1 + + if node.IsA('EnumItem'): + if not node.GetProperty('VALUE') and not node.GetProperty('wenum'): + node.Warning('Expecting value for enumeration.') + warnings += 1 + + if node.IsA('Interface'): + macro = node.GetProperty('macro') + if macro and not node.GetProperty('wname'): + node.Warning('Interface name inconsistent: %s' % macro) + warnings += 1 + + if node.IsA('Inline') and not node.GetProperty('winline'): + inline_type = node.GetProperty('NAME') + node.parent.Warning('Requires an inline %s block.' % inline_type) + warnings += 1 + + if node.IsA('Callspec') and not node.GetProperty('wparam'): + out = False + for arg in node.GetListOf('Param'): + if arg.GetProperty('out'): + out = True + if arg.GetProperty('in') and out: + arg.Warning('[in] parameter after [out] parameter') + warnings += 1 + + if node.IsA('Param') and not node.GetProperty('wparam'): + found = False; + for form in ['in', 'inout', 'out']: + if node.GetProperty(form): found = True + if not found: + node.Warning('Missing argument type: [in|out|inout]') + warnings += 1 + + return warnings + + def Depart(self, node, warnings, childdata): + __pychecker__ = 'unusednames=node' + for child in childdata: + warnings += child + return warnings + +def Lint(ast): + options = ['wcomment', 'wenum', 'winline', 'wparam', 'wpass', 'wname'] + wnone = GetOption('wnone') + for opt in options: + if wnone or GetOption(opt): ast.SetProperty(opt, True) + + skipList = [] + for filenode in ast.GetListOf('File'): + name = filenode.GetProperty('NAME') + if filenode.GetProperty('ERRORS') > 0: + ErrOut.Log('%s : Skipped due to errors.' % name) + skipList.append(filenode) + continue + warnings = IDLLinter().Visit(filenode, 0) + if warnings: + WarnOut.Log('%s warning(s) for %s\n' % (warnings, name)) + return skipList diff --git a/browser/extensions/mortar/ppapi/generators/idl_log.py b/browser/extensions/mortar/ppapi/generators/idl_log.py new file mode 100644 index 000000000000..f5b103e751c4 --- /dev/null +++ b/browser/extensions/mortar/ppapi/generators/idl_log.py @@ -0,0 +1,54 @@ +# Copyright (c) 2012 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" Error and information logging for IDL """ + +import sys + + +class IDLLog(object): + """Captures and routes logging output. + + Caputres logging output and/or sends out via a file handle, typically + stdout or stderr. + """ + def __init__(self, name, out): + if name: + self._name = '%s : ' % name + else: + self._name = '' + + self._out = out + self._capture = False + self._console = True + self._log = [] + + def Log(self, msg): + if self._console: + line = "%s\n" % (msg) + self._out.write(line) + if self._capture: + self._log.append(msg) + + def LogLine(self, filename, lineno, pos, msg): + if self._console: + line = "%s(%d) : %s%s\n" % (filename, lineno, self._name, msg) + self._out.write(line) + if self._capture: + self._log.append(msg) + + def SetConsole(self, enable): + self._console = enable + + def SetCapture(self, enable): + self._capture = enable + + def DrainLog(self): + out = self._log + self._log = [] + return out + +ErrOut = IDLLog('Error', sys.stderr) +WarnOut = IDLLog('Warning', sys.stdout) +InfoOut = IDLLog('', sys.stdout) diff --git a/browser/extensions/mortar/ppapi/generators/idl_namespace.py b/browser/extensions/mortar/ppapi/generators/idl_namespace.py new file mode 100755 index 000000000000..b81411e68dd6 --- /dev/null +++ b/browser/extensions/mortar/ppapi/generators/idl_namespace.py @@ -0,0 +1,249 @@ +#!/usr/bin/env python +# Copyright (c) 2012 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +IDLNamespace for PPAPI + +This file defines the behavior of the AST namespace which allows for resolving +a symbol as one or more AST nodes given a release or range of releases. +""" + +import sys + +from idl_option import GetOption, Option, ParseOptions +from idl_log import ErrOut, InfoOut, WarnOut +from idl_release import IDLRelease, IDLReleaseList + +Option('label', 'Use the specifed label blocks.', default='Chrome') +Option('namespace_debug', 'Use the specified release') + + +# +# IDLNamespace +# +# IDLNamespace provides a mapping between a symbol name and an IDLReleaseList +# which contains IDLRelease objects. It provides an interface for fetching +# one or more IDLNodes based on a release or range of releases. +# +class IDLNamespace(object): + def __init__(self, parent): + self._name_to_releases = {} + self._parent = parent + + def Dump(self): + for name in self._name_to_releases: + InfoOut.Log('NAME=%s' % name) + for cver in self._name_to_releases[name].GetReleases(): + InfoOut.Log(' %s' % cver) + InfoOut.Log('') + + def FindRelease(self, name, release): + verlist = self._name_to_releases.get(name, None) + if verlist == None: + if self._parent: + return self._parent.FindRelease(name, release) + else: + return None + return verlist.FindRelease(release) + + def FindRange(self, name, rmin, rmax): + verlist = self._name_to_releases.get(name, None) + if verlist == None: + if self._parent: + return self._parent.FindRange(name, rmin, rmax) + else: + return [] + return verlist.FindRange(rmin, rmax) + + def FindList(self, name): + verlist = self._name_to_releases.get(name, None) + if verlist == None: + if self._parent: + return self._parent.FindList(name) + return verlist + + def AddNode(self, node): + name = node.GetName() + verlist = self._name_to_releases.setdefault(name,IDLReleaseList()) + if GetOption('namespace_debug'): + print "Adding to namespace: %s" % node + return verlist.AddNode(node) + + +# +# Testing Code +# + +# +# MockNode +# +# Mocks the IDLNode to support error, warning handling, and string functions. +# +class MockNode(IDLRelease): + def __init__(self, name, rmin, rmax): + self.name = name + self.rmin = rmin + self.rmax = rmax + self.errors = [] + self.warns = [] + self.properties = { + 'NAME': name, + 'release': rmin, + 'deprecate' : rmax + } + + def __str__(self): + return '%s (%s : %s)' % (self.name, self.rmin, self.rmax) + + def GetName(self): + return self.name + + def Error(self, msg): + if GetOption('release_debug'): print 'Error: %s' % msg + self.errors.append(msg) + + def Warn(self, msg): + if GetOption('release_debug'): print 'Warn: %s' % msg + self.warns.append(msg) + + def GetProperty(self, name): + return self.properties.get(name, None) + +errors = 0 +# +# DumpFailure +# +# Dumps all the information relevant to an add failure. +def DumpFailure(namespace, node, msg): + global errors + print '\n******************************' + print 'Failure: %s %s' % (node, msg) + for warn in node.warns: + print ' WARN: %s' % warn + for err in node.errors: + print ' ERROR: %s' % err + print '\n' + namespace.Dump() + print '******************************\n' + errors += 1 + +# Add expecting no errors or warnings +def AddOkay(namespace, node): + okay = namespace.AddNode(node) + if not okay or node.errors or node.warns: + DumpFailure(namespace, node, 'Expected success') + +# Add expecting a specific warning +def AddWarn(namespace, node, msg): + okay = namespace.AddNode(node) + if not okay or node.errors or not node.warns: + DumpFailure(namespace, node, 'Expected warnings') + if msg not in node.warns: + DumpFailure(namespace, node, 'Expected warning: %s' % msg) + +# Add expecting a specific error any any number of warnings +def AddError(namespace, node, msg): + okay = namespace.AddNode(node) + if okay or not node.errors: + DumpFailure(namespace, node, 'Expected errors') + if msg not in node.errors: + DumpFailure(namespace, node, 'Expected error: %s' % msg) + print ">>%s<<\n>>%s<<\n" % (node.errors[0], msg) + +# Verify that a FindRelease call on the namespace returns the expected node. +def VerifyFindOne(namespace, name, release, node): + global errors + if (namespace.FindRelease(name, release) != node): + print "Failed to find %s as release %f of %s" % (node, release, name) + namespace.Dump() + print "\n" + errors += 1 + +# Verify that a FindRage call on the namespace returns a set of expected nodes. +def VerifyFindAll(namespace, name, rmin, rmax, nodes): + global errors + out = namespace.FindRange(name, rmin, rmax) + if (out != nodes): + print "Found [%s] instead of[%s] for releases %f to %f of %s" % ( + ' '.join([str(x) for x in out]), + ' '.join([str(x) for x in nodes]), + rmin, + rmax, + name) + namespace.Dump() + print "\n" + errors += 1 + +def Main(args): + global errors + ParseOptions(args) + + InfoOut.SetConsole(True) + + namespace = IDLNamespace(None) + + FooXX = MockNode('foo', None, None) + Foo1X = MockNode('foo', 1.0, None) + Foo2X = MockNode('foo', 2.0, None) + Foo3X = MockNode('foo', 3.0, None) + + # Verify we succeed with undeprecated adds + AddOkay(namespace, FooXX) + AddOkay(namespace, Foo1X) + AddOkay(namespace, Foo3X) + # Verify we fail to add a node between undeprecated releases + AddError(namespace, Foo2X, + 'Overlap in releases: 3.0 vs 2.0 when adding foo (2.0 : None)') + + BarXX = MockNode('bar', None, None) + Bar12 = MockNode('bar', 1.0, 2.0) + Bar23 = MockNode('bar', 2.0, 3.0) + Bar34 = MockNode('bar', 3.0, 4.0) + + + # Verify we succeed with fully qualified releases + namespace = IDLNamespace(namespace) + AddOkay(namespace, BarXX) + AddOkay(namespace, Bar12) + # Verify we warn when detecting a gap + AddWarn(namespace, Bar34, 'Gap in release numbers.') + # Verify we fail when inserting into this gap + # (NOTE: while this could be legal, it is sloppy so we disallow it) + AddError(namespace, Bar23, 'Declarations out of order.') + + # Verify local namespace + VerifyFindOne(namespace, 'bar', 0.0, BarXX) + VerifyFindAll(namespace, 'bar', 0.5, 1.5, [BarXX, Bar12]) + + # Verify the correct release of the object is found recursively + VerifyFindOne(namespace, 'foo', 0.0, FooXX) + VerifyFindOne(namespace, 'foo', 0.5, FooXX) + VerifyFindOne(namespace, 'foo', 1.0, Foo1X) + VerifyFindOne(namespace, 'foo', 1.5, Foo1X) + VerifyFindOne(namespace, 'foo', 3.0, Foo3X) + VerifyFindOne(namespace, 'foo', 100.0, Foo3X) + + # Verify the correct range of objects is found + VerifyFindAll(namespace, 'foo', 0.0, 1.0, [FooXX]) + VerifyFindAll(namespace, 'foo', 0.5, 1.0, [FooXX]) + VerifyFindAll(namespace, 'foo', 1.0, 1.1, [Foo1X]) + VerifyFindAll(namespace, 'foo', 0.5, 1.5, [FooXX, Foo1X]) + VerifyFindAll(namespace, 'foo', 0.0, 3.0, [FooXX, Foo1X]) + VerifyFindAll(namespace, 'foo', 3.0, 100.0, [Foo3X]) + + FooBar = MockNode('foobar', 1.0, 2.0) + namespace = IDLNamespace(namespace) + AddOkay(namespace, FooBar) + + if errors: + print 'Test failed with %d errors.' % errors + else: + print 'Passed.' + return errors + + +if __name__ == '__main__': + sys.exit(Main(sys.argv[1:])) + diff --git a/browser/extensions/mortar/ppapi/generators/idl_node.py b/browser/extensions/mortar/ppapi/generators/idl_node.py new file mode 100755 index 000000000000..b50ba597c13d --- /dev/null +++ b/browser/extensions/mortar/ppapi/generators/idl_node.py @@ -0,0 +1,447 @@ +#!/usr/bin/env python +# Copyright (c) 2012 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +"""Nodes for PPAPI IDL AST""" + +# +# IDL Node +# +# IDL Node defines the IDLAttribute and IDLNode objects which are constructed +# by the parser as it processes the various 'productions'. The IDLAttribute +# objects are assigned to the IDLNode's property dictionary instead of being +# applied as children of The IDLNodes, so they do not exist in the final tree. +# The AST of IDLNodes is the output from the parsing state and will be used +# as the source data by the various generators. +# + +import sys + +from idl_log import ErrOut, InfoOut, WarnOut +from idl_propertynode import IDLPropertyNode +from idl_release import IDLRelease, IDLReleaseMap + + +# IDLAttribute +# +# A temporary object used by the parsing process to hold an Extended Attribute +# which will be passed as a child to a standard IDLNode. +# +class IDLAttribute(object): + def __init__(self, name, value): + self.cls = 'ExtAttribute' + self.name = name + self.value = value + + def __str__(self): + return '%s=%s' % (self.name, self.value) + +# +# IDLNode +# +# This class implements the AST tree, providing the associations between +# parents and children. It also contains a namepsace and propertynode to +# allow for look-ups. IDLNode is derived from IDLRelease, so it is +# version aware. +# +class IDLNode(IDLRelease): + + # Set of object IDLNode types which have a name and belong in the namespace. + NamedSet = set(['Enum', 'EnumItem', 'File', 'Function', 'Interface', + 'Member', 'Param', 'Struct', 'Type', 'Typedef']) + + def __init__(self, cls, filename, lineno, pos, children=None): + # Initialize with no starting or ending Version + IDLRelease.__init__(self, None, None) + + self.cls = cls + self.lineno = lineno + self.pos = pos + self._filename = filename + self._deps = {} + self.errors = 0 + self.namespace = None + self.typelist = None + self.parent = None + self._property_node = IDLPropertyNode() + self._unique_releases = None + + # A list of unique releases for this node + self.releases = None + + # A map from any release, to the first unique release + self.first_release = None + + # self._children is a list of children ordered as defined + self._children = [] + # Process the passed in list of children, placing ExtAttributes into the + # property dictionary, and nodes into the local child list in order. In + # addition, add nodes to the namespace if the class is in the NamedSet. + if children: + for child in children: + if child.cls == 'ExtAttribute': + self.SetProperty(child.name, child.value) + else: + self.AddChild(child) + + def __str__(self): + name = self.GetName() + if name is None: + name = '' + return '%s(%s)' % (self.cls, name) + + def Location(self): + """Return a file and line number for where this node was defined.""" + return '%s(%d)' % (self._filename, self.lineno) + + def Error(self, msg): + """Log an error for this object.""" + self.errors += 1 + ErrOut.LogLine(self._filename, self.lineno, 0, ' %s %s' % + (str(self), msg)) + filenode = self.GetProperty('FILE') + if filenode: + errcnt = filenode.GetProperty('ERRORS') + if not errcnt: + errcnt = 0 + filenode.SetProperty('ERRORS', errcnt + 1) + + def Warning(self, msg): + """Log a warning for this object.""" + WarnOut.LogLine(self._filename, self.lineno, 0, ' %s %s' % + (str(self), msg)) + + def GetName(self): + return self.GetProperty('NAME') + + def Dump(self, depth=0, comments=False, out=sys.stdout): + """Dump this object and its children""" + if self.cls in ['Comment', 'Copyright']: + is_comment = True + else: + is_comment = False + + # Skip this node if it's a comment, and we are not printing comments + if not comments and is_comment: + return + + tab = ''.rjust(depth * 2) + if is_comment: + out.write('%sComment\n' % tab) + for line in self.GetName().split('\n'): + out.write('%s "%s"\n' % (tab, line)) + else: + ver = IDLRelease.__str__(self) + if self.releases: + release_list = ': ' # + ' '.join(self.releases) + else: + release_list = ': undefined' + out.write('%s%s%s%s\n' % (tab, self, ver, release_list)) + if self.typelist: + out.write('%s Typelist: %s\n' % (tab, self.typelist.GetReleases()[0])) + properties = self._property_node.GetPropertyList() + if properties: + out.write('%s Properties\n' % tab) + for p in properties: + if is_comment and p == 'NAME': + # Skip printing the name for comments, since we printed above already + continue + out.write('%s %s : %s\n' % (tab, p, self.GetProperty(p))) + for child in self._children: + child.Dump(depth+1, comments=comments, out=out) + + def IsA(self, *typelist): + """Check if node is of a given type.""" + return self.cls in typelist + + def GetListOf(self, *keys): + """Get a list of objects for the given key(s).""" + out = [] + for child in self._children: + if child.cls in keys: + out.append(child) + return out + + def GetOneOf(self, *keys): + """Get an object for the given key(s).""" + out = self.GetListOf(*keys) + if out: + return out[0] + return None + + def SetParent(self, parent): + self._property_node.AddParent(parent) + self.parent = parent + + def AddChild(self, node): + node.SetParent(self) + self._children.append(node) + + # Get a list of all children + def GetChildren(self): + return self._children + + def GetType(self, release): + if not self.typelist: + return None + return self.typelist.FindRelease(release) + + def GetDeps(self, release, visited=None): + visited = visited or set() + + # If this release is not valid for this object, then done. + if not self.IsRelease(release) or self.IsA('Comment', 'Copyright'): + return set([]) + + # If we have cached the info for this release, return the cached value + deps = self._deps.get(release, None) + if deps is not None: + return deps + + # If we are already visited, then return + if self in visited: + return set([self]) + + # Otherwise, build the dependency list + visited |= set([self]) + deps = set([self]) + + # Get child deps + for child in self.GetChildren(): + deps |= child.GetDeps(release, visited) + visited |= set(deps) + + # Get type deps + typeref = self.GetType(release) + if typeref: + deps |= typeref.GetDeps(release, visited) + + self._deps[release] = deps + return deps + + def GetVersion(self, release): + filenode = self.GetProperty('FILE') + if not filenode: + return None + return filenode.release_map.GetVersion(release) + + def GetUniqueReleases(self, releases): + """Return the unique set of first releases corresponding to input + + Since we are returning the corresponding 'first' version for a + release, we may return a release version prior to the one in the list.""" + my_min, my_max = self.GetMinMax(releases) + if my_min > releases[-1] or my_max < releases[0]: + return [] + + out = set() + for rel in releases: + remapped = self.first_release[rel] + if not remapped: + continue + out |= set([remapped]) + + # Cache the most recent set of unique_releases + self._unique_releases = sorted(out) + return self._unique_releases + + def LastRelease(self, release): + # Get the most recent release from the most recently generated set of + # cached unique releases. + if self._unique_releases and self._unique_releases[-1] > release: + return False + return True + + def GetRelease(self, version): + filenode = self.GetProperty('FILE') + if not filenode: + return None + return filenode.release_map.GetRelease(version) + + def _GetReleaseList(self, releases, visited=None): + visited = visited or set() + if not self.releases: + # If we are unversionable, then return first available release + if self.IsA('Comment', 'Copyright', 'Label'): + self.releases = [] + return self.releases + + # Generate the first and if deprecated within this subset, the + # last release for this node + my_min, my_max = self.GetMinMax(releases) + + if my_max != releases[-1]: + my_releases = set([my_min, my_max]) + else: + my_releases = set([my_min]) + + r = self.GetRelease(self.GetProperty('version')) + if not r in my_releases: + my_releases |= set([r]) + + # Break cycle if we reference ourselves + if self in visited: + return [my_min] + + visited |= set([self]) + + # Files inherit all their releases from items in the file + if self.IsA('AST', 'File'): + my_releases = set() + + # Visit all children + child_releases = set() + + # Exclude sibling results from parent visited set + cur_visits = visited + + for child in self._children: + child_releases |= set(child._GetReleaseList(releases, cur_visits)) + visited |= set(child_releases) + + # Visit my type + type_releases = set() + if self.typelist: + type_list = self.typelist.GetReleases() + for typenode in type_list: + type_releases |= set(typenode._GetReleaseList(releases, cur_visits)) + + type_release_list = sorted(type_releases) + if my_min < type_release_list[0]: + type_node = type_list[0] + self.Error('requires %s in %s which is undefined at %s.' % ( + type_node, type_node._filename, my_min)) + + for rel in child_releases | type_releases: + if rel >= my_min and rel <= my_max: + my_releases |= set([rel]) + + self.releases = sorted(my_releases) + return self.releases + + def BuildReleaseMap(self, releases): + unique_list = self._GetReleaseList(releases) + _, my_max = self.GetMinMax(releases) + + self.first_release = {} + last_rel = None + for rel in releases: + if rel in unique_list: + last_rel = rel + self.first_release[rel] = last_rel + if rel == my_max: + last_rel = None + + def SetProperty(self, name, val): + self._property_node.SetProperty(name, val) + + def GetProperty(self, name): + return self._property_node.GetProperty(name) + + def GetPropertyLocal(self, name): + return self._property_node.GetPropertyLocal(name) + + def NodeIsDevOnly(self): + """Returns true iff a node is only in dev channel.""" + return self.GetProperty('dev_version') and not self.GetProperty('version') + + def DevInterfaceMatchesStable(self, release): + """Returns true if an interface has an equivalent stable version.""" + assert(self.IsA('Interface')) + for child in self.GetListOf('Member'): + unique = child.GetUniqueReleases([release]) + if not unique or not child.InReleases([release]): + continue + if child.NodeIsDevOnly(): + return False + return True + + +# +# IDLFile +# +# A specialized version of IDLNode which tracks errors and warnings. +# +class IDLFile(IDLNode): + def __init__(self, name, children, errors=0): + attrs = [IDLAttribute('NAME', name), + IDLAttribute('ERRORS', errors)] + if not children: + children = [] + IDLNode.__init__(self, 'File', name, 1, 0, attrs + children) + # TODO(teravest): Why do we set release map like this here? This looks + # suspicious... + self.release_map = IDLReleaseMap([('M13', 1.0, 'stable')]) + + +# +# Tests +# +def StringTest(): + errors = 0 + name_str = 'MyName' + text_str = 'MyNode(%s)' % name_str + name_node = IDLAttribute('NAME', name_str) + node = IDLNode('MyNode', 'no file', 1, 0, [name_node]) + if node.GetName() != name_str: + ErrOut.Log('GetName returned >%s< not >%s<' % (node.GetName(), name_str)) + errors += 1 + if node.GetProperty('NAME') != name_str: + ErrOut.Log('Failed to get name property.') + errors += 1 + if str(node) != text_str: + ErrOut.Log('str() returned >%s< not >%s<' % (str(node), text_str)) + errors += 1 + if not errors: + InfoOut.Log('Passed StringTest') + return errors + + +def ChildTest(): + errors = 0 + child = IDLNode('child', 'no file', 1, 0) + parent = IDLNode('parent', 'no file', 1, 0, [child]) + + if child.parent != parent: + ErrOut.Log('Failed to connect parent.') + errors += 1 + + if [child] != parent.GetChildren(): + ErrOut.Log('Failed GetChildren.') + errors += 1 + + if child != parent.GetOneOf('child'): + ErrOut.Log('Failed GetOneOf(child)') + errors += 1 + + if parent.GetOneOf('bogus'): + ErrOut.Log('Failed GetOneOf(bogus)') + errors += 1 + + if not parent.IsA('parent'): + ErrOut.Log('Expecting parent type') + errors += 1 + + parent = IDLNode('parent', 'no file', 1, 0, [child, child]) + if [child, child] != parent.GetChildren(): + ErrOut.Log('Failed GetChildren2.') + errors += 1 + + if not errors: + InfoOut.Log('Passed ChildTest') + return errors + + +def Main(): + errors = StringTest() + errors += ChildTest() + + if errors: + ErrOut.Log('IDLNode failed with %d errors.' % errors) + return -1 + return 0 + +if __name__ == '__main__': + sys.exit(Main()) + diff --git a/browser/extensions/mortar/ppapi/generators/idl_option.py b/browser/extensions/mortar/ppapi/generators/idl_option.py new file mode 100644 index 000000000000..54ac4cf25fce --- /dev/null +++ b/browser/extensions/mortar/ppapi/generators/idl_option.py @@ -0,0 +1,108 @@ +# Copyright (c) 2012 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import getopt +import sys + +from idl_log import ErrOut, InfoOut, WarnOut + +OptionMap = { } + + +def GetOption(name): + if name not in OptionMap: + raise RuntimeError('Could not find option "%s".' % name) + return OptionMap[name].Get() + +class Option(object): + def __init__(self, name, desc, default = None, callfunc = None, + testfunc = None, cookie = None): + + # Verify this option is not a duplicate + if name in OptionMap: + raise RuntimeError('Option "%s" already exists.' % name) + self.name = name + self.desc = desc + self.default = default + self.value = default + self.callfunc = callfunc + self.testfunc = testfunc + self.cookie = cookie + OptionMap[name] = self + + def Set(self, value): + if self.testfunc: + if not self.testfunc(self, value): return False + # If this is a boolean option, set it to true + if self.default is None: + self.value = True + else: + self.value = value + if self.callfunc: + self.callfunc(self) + return True + + def Get(self): + return self.value + + +def DumpOption(option): + if len(option.name) > 1: + out = ' --%-15.15s\t%s' % (option.name, option.desc) + else: + out = ' -%-15.15s\t%s' % (option.name, option.desc) + if option.default: + out = '%s\n\t\t\t(Default: %s)\n' % (out, option.default) + InfoOut.Log(out) + +def DumpHelp(option=None): + InfoOut.Log('Usage:') + for opt in sorted(OptionMap.keys()): + DumpOption(OptionMap[opt]) + sys.exit(0) + +# +# Default IDL options +# +# -h : Help, prints options +# --verbose : use verbose output +# --test : test this module +# +Option('h', 'Help', callfunc=DumpHelp) +Option('help', 'Help', callfunc=DumpHelp) +Option('verbose', 'Verbose') +Option('test', 'Test the IDL scripts') + +def ParseOptions(args): + short_opts= "" + long_opts = [] + + # Build short and long option lists + for name in sorted(OptionMap.keys()): + option = OptionMap[name] + if len(name) > 1: + if option.default is None: + long_opts.append('%s' % name) + else: + long_opts.append('%s=' % name) + else: + if option.default is None: + short_opts += name + else: + short_opts += '%s:' % name + + try: + opts, filenames = getopt.getopt(args, short_opts, long_opts) + + for opt, val in opts: + if len(opt) == 2: opt = opt[1:] + if opt[0:2] == '--': opt = opt[2:] + OptionMap[opt].Set(val) + + except getopt.error, e: + ErrOut.Log('Illegal option: %s\n' % str(e)) + DumpHelp() + sys.exit(-1) + + return filenames diff --git a/browser/extensions/mortar/ppapi/generators/idl_outfile.py b/browser/extensions/mortar/ppapi/generators/idl_outfile.py new file mode 100755 index 000000000000..053cf3ea05b9 --- /dev/null +++ b/browser/extensions/mortar/ppapi/generators/idl_outfile.py @@ -0,0 +1,205 @@ +#!/usr/bin/env python +# Copyright (c) 2012 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" Output file objects for generator. """ + +import difflib +import os +import time +import subprocess +import sys + +from idl_log import ErrOut, InfoOut, WarnOut +from idl_option import GetOption, Option, ParseOptions +from stat import * + +Option('diff', 'Generate a DIFF when saving the file.') + + +# +# IDLOutFile +# +# IDLOutFile provides a temporary output file. By default, the object will +# not write the output if the file already exists, and matches what will be +# written. This prevents the timestamp from changing to optimize cases where +# the output files are used by a timestamp dependent build system +# +class IDLOutFile(object): + def __init__(self, filename, always_write = False, create_dir = True): + self.filename = filename + self.always_write = always_write + self.create_dir = create_dir + self.outlist = [] + self.open = True + + # Compare the old text to the current list of output lines. + def IsEquivalent_(self, oldtext): + if not oldtext: return False + + oldlines = oldtext.split('\n') + curlines = (''.join(self.outlist)).split('\n') + + # If number of lines don't match, it's a mismatch + if len(oldlines) != len(curlines): + return False + + for index in range(len(oldlines)): + oldline = oldlines[index] + curline = curlines[index] + + if oldline == curline: continue + + curwords = curline.split() + oldwords = oldline.split() + + # Unmatched lines must be the same length + if len(curwords) != len(oldwords): + return False + + # If it's not a comment then it's a mismatch + if curwords[0] not in ['*', '/*', '//']: + return False + + # Ignore changes to the Copyright year which is autogenerated + # /* Copyright (c) 2011 The Chromium Authors. All rights reserved. + if len(curwords) > 4 and curwords[1] == 'Copyright': + if curwords[4:] == oldwords[4:]: continue + + # Ignore changes to auto generation timestamp when line unwrapped + # // From FILENAME.idl modified DAY MON DATE TIME YEAR. + # /* From FILENAME.idl modified DAY MON DATE TIME YEAR. */ + if len(curwords) > 8 and curwords[1] == 'From': + if curwords[0:4] == oldwords[0:4]: continue + + # Ignore changes to auto generation timestamp when line is wrapped + # * modified DAY MON DATE TIME YEAR. + if len(curwords) > 6 and curwords[1] == 'modified': + continue + + return False + return True + + # Return the file name + def Filename(self): + return self.filename + + # Append to the output if the file is still open + def Write(self, string): + if not self.open: + raise RuntimeError('Could not write to closed file %s.' % self.filename) + self.outlist.append(string) + + # Run clang-format on the buffered file contents. + def ClangFormat(self): + clang_format = subprocess.Popen(['clang-format', '-style=Chromium'], + stdin=subprocess.PIPE, + stdout=subprocess.PIPE) + new_output = clang_format.communicate("".join(self.outlist))[0] + self.outlist = [new_output] + + # Close the file, flushing it to disk + def Close(self): + filename = os.path.realpath(self.filename) + self.open = False + outtext = ''.join(self.outlist) + oldtext = '' + + if not self.always_write: + if os.path.isfile(filename): + oldtext = open(filename, 'rb').read() + if self.IsEquivalent_(oldtext): + if GetOption('verbose'): + InfoOut.Log('Output %s unchanged.' % self.filename) + return False + + if GetOption('diff'): + for line in difflib.unified_diff(oldtext.split('\n'), outtext.split('\n'), + 'OLD ' + self.filename, + 'NEW ' + self.filename, + n=1, lineterm=''): + ErrOut.Log(line) + + try: + # If the directory does not exit, try to create it, if we fail, we + # still get the exception when the file is openned. + basepath, leafname = os.path.split(filename) + if basepath and not os.path.isdir(basepath) and self.create_dir: + InfoOut.Log('Creating directory: %s\n' % basepath) + os.makedirs(basepath) + + if not GetOption('test'): + outfile = open(filename, 'wb') + outfile.write(outtext) + outfile.close(); + InfoOut.Log('Output %s written.' % self.filename) + return True + + except IOError as (errno, strerror): + ErrOut.Log("I/O error(%d): %s" % (errno, strerror)) + except: + ErrOut.Log("Unexpected error: %s" % sys.exc_info()[0]) + raise + + return False + + +def TestFile(name, stringlist, force, update): + errors = 0 + + # Get the old timestamp + if os.path.exists(name): + old_time = os.stat(filename)[ST_MTIME] + else: + old_time = 'NONE' + + # Create the file and write to it + out = IDLOutFile(filename, force) + for item in stringlist: + out.Write(item) + + # We wait for flush to force the timestamp to change + time.sleep(2) + + wrote = out.Close() + cur_time = os.stat(filename)[ST_MTIME] + if update: + if not wrote: + ErrOut.Log('Failed to write output %s.' % filename) + return 1 + if cur_time == old_time: + ErrOut.Log('Failed to update timestamp for %s.' % filename) + return 1 + else: + if wrote: + ErrOut.Log('Should not have writen output %s.' % filename) + return 1 + if cur_time != old_time: + ErrOut.Log('Should not have modified timestamp for %s.' % filename) + return 1 + return 0 + + +def main(): + errors = 0 + stringlist = ['Test', 'Testing\n', 'Test'] + filename = 'outtest.txt' + + # Test forcibly writing a file + errors += TestFile(filename, stringlist, force=True, update=True) + + # Test conditionally writing the file skipping + errors += TestFile(filename, stringlist, force=False, update=False) + + # Test conditionally writing the file updating + errors += TestFile(filename, stringlist + ['X'], force=False, update=True) + + # Clean up file + os.remove(filename) + if not errors: InfoOut.Log('All tests pass.') + return errors + + +if __name__ == '__main__': + sys.exit(main()) diff --git a/browser/extensions/mortar/ppapi/generators/idl_parser.py b/browser/extensions/mortar/ppapi/generators/idl_parser.py new file mode 100755 index 000000000000..51941d7cd9c9 --- /dev/null +++ b/browser/extensions/mortar/ppapi/generators/idl_parser.py @@ -0,0 +1,1296 @@ +#!/usr/bin/env python +# Copyright (c) 2012 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" Parser for PPAPI IDL """ + +# +# IDL Parser +# +# The parser is uses the PLY yacc library to build a set of parsing rules based +# on WebIDL. +# +# WebIDL, and WebIDL regular expressions can be found at: +# http://dev.w3.org/2006/webapi/WebIDL/ +# PLY can be found at: +# http://www.dabeaz.com/ply/ +# +# The parser generates a tree by recursively matching sets of items against +# defined patterns. When a match is made, that set of items is reduced +# to a new item. The new item can provide a match for parent patterns. +# In this way an AST is built (reduced) depth first. + + +import getopt +import glob +import os.path +import re +import sys +import time + +from idl_ast import IDLAst +from idl_log import ErrOut, InfoOut, WarnOut +from idl_lexer import IDLLexer +from idl_node import IDLAttribute, IDLFile, IDLNode +from idl_option import GetOption, Option, ParseOptions +from idl_lint import Lint + +from ply import lex +from ply import yacc + +Option('build_debug', 'Debug tree building.') +Option('parse_debug', 'Debug parse reduction steps.') +Option('token_debug', 'Debug token generation.') +Option('dump_tree', 'Dump the tree.') +Option('srcroot', 'Working directory.', default=os.path.join('..', 'api')) +Option('include_private', 'Include private IDL directory in default API paths.') + +# +# ERROR_REMAP +# +# Maps the standard error formula into a more friendly error message. +# +ERROR_REMAP = { + 'Unexpected ")" after "(".' : 'Empty argument list.', + 'Unexpected ")" after ",".' : 'Missing argument.', + 'Unexpected "}" after ",".' : 'Trailing comma in block.', + 'Unexpected "}" after "{".' : 'Unexpected empty block.', + 'Unexpected comment after "}".' : 'Unexpected trailing comment.', + 'Unexpected "{" after keyword "enum".' : 'Enum missing name.', + 'Unexpected "{" after keyword "struct".' : 'Struct missing name.', + 'Unexpected "{" after keyword "interface".' : 'Interface missing name.', +} + +# DumpReduction +# +# Prints out the set of items which matched a particular pattern and the +# new item or set it was reduced to. +def DumpReduction(cls, p): + if p[0] is None: + InfoOut.Log("OBJ: %s(%d) - None\n" % (cls, len(p))) + InfoOut.Log(" [%s]\n" % [str(x) for x in p[1:]]) + else: + out = "" + for index in range(len(p) - 1): + out += " >%s< " % str(p[index + 1]) + InfoOut.Log("OBJ: %s(%d) - %s : %s\n" % (cls, len(p), str(p[0]), out)) + + +# CopyToList +# +# Takes an input item, list, or None, and returns a new list of that set. +def CopyToList(item): + # If the item is 'Empty' make it an empty list + if not item: item = [] + + # If the item is not a list + if type(item) is not type([]): item = [item] + + # Make a copy we can modify + return list(item) + + + +# ListFromConcat +# +# Generate a new List by joining of two sets of inputs which can be an +# individual item, a list of items, or None. +def ListFromConcat(*items): + itemsout = [] + for item in items: + itemlist = CopyToList(item) + itemsout.extend(itemlist) + + return itemsout + + +# TokenTypeName +# +# Generate a string which has the type and value of the token. +def TokenTypeName(t): + if t.type == 'SYMBOL': return 'symbol %s' % t.value + if t.type in ['HEX', 'INT', 'OCT', 'FLOAT']: + return 'value %s' % t.value + if t.type == 'STRING' : return 'string "%s"' % t.value + if t.type == 'COMMENT' : return 'comment' + if t.type == t.value: return '"%s"' % t.value + return 'keyword "%s"' % t.value + + +# +# IDL Parser +# +# The Parser inherits the from the Lexer to provide PLY with the tokenizing +# definitions. Parsing patterns are encoded as function where p_ is +# is called any time a patern matching the function documentation is found. +# Paterns are expressed in the form of: +# """ : .... +# | ....""" +# +# Where new item is the result of a match against one or more sets of items +# separated by the "|". +# +# The function is called with an object 'p' where p[0] is the output object +# and p[n] is the set of inputs for positive values of 'n'. Len(p) can be +# used to distinguish between multiple item sets in the pattern. +# +# For more details on parsing refer to the PLY documentation at +# http://www.dabeaz.com/ply/ +# +# +# The parser uses the following conventions: +# a _block defines a block of definitions in the form of: +# [comment] [ext_attr_block] '{' _list '}' ';' +# A block is reduced by returning an object of with a name of +# which in turn has _list as children. +# +# A [comment] is a optional C style comment block enclosed in /* ... */ which +# is appended to the adjacent node as a child. +# +# A [ext_attr_block] is an optional list of Extended Attributes which is +# appended to the adjacent node as a child. +# +# a _list defines a list of items which will be passed as a +# list of children to the parent pattern. A list is in the form of: +# [comment] [ext_attr_block] <...DEF...> ';' _list | (empty) +# or +# [comment] [ext_attr_block] <...DEF...> _cont +# +# In the first form, the list is reduced recursively, where the right side +# _list is first reduced then joined with pattern currently being +# matched. The list is terminated with the (empty) pattern is matched. +# +# In the second form the list is reduced recursively, where the right side +# _cont is first reduced then joined with the pattern currently being +# matched. The type_ is in the form of: +# ',' _list | (empty) +# The _cont form is used to consume the ',' which only occurs when +# there is more than one object in the list. The _cont also provides +# the terminating (empty) definition. +# + + +class IDLParser(IDLLexer): +# TOP +# +# This pattern defines the top of the parse tree. The parse tree is in the +# the form of: +# +# top +# *modifiers +# *comments +# *ext_attr_block +# ext_attr_list +# attr_arg_list +# *integer, value +# *param_list +# *typeref +# +# top_list +# describe_block +# describe_list +# enum_block +# enum_item +# interface_block +# member +# label_block +# label_item +# struct_block +# member +# typedef_decl +# typedef_data +# typedef_func +# +# (* sub matches found at multiple levels and are not truly children of top) +# +# We force all input files to start with two comments. The first comment is a +# Copyright notice followed by a set of file wide Extended Attributes, followed +# by the file comment and finally by file level patterns. +# + # Find the Copyright, File comment, and optional file wide attributes. We + # use a match with COMMENT instead of comments to force the token to be + # present. The extended attributes and the top_list become siblings which + # in turn are children of the file object created from the results of top. + def p_top(self, p): + """top : COMMENT COMMENT ext_attr_block top_list""" + + Copyright = self.BuildComment('Copyright', p, 1) + Filedoc = self.BuildComment('Comment', p, 2) + + p[0] = ListFromConcat(Copyright, Filedoc, p[3], p[4]) + if self.parse_debug: DumpReduction('top', p) + + def p_top_short(self, p): + """top : COMMENT ext_attr_block top_list""" + Copyright = self.BuildComment('Copyright', p, 1) + Filedoc = IDLNode('Comment', self.lexobj.filename, p.lineno(2)-1, + p.lexpos(2)-1, [self.BuildAttribute('NAME', ''), + self.BuildAttribute('FORM', 'cc')]) + p[0] = ListFromConcat(Copyright, Filedoc, p[2], p[3]) + if self.parse_debug: DumpReduction('top', p) + + # Build a list of top level items. + def p_top_list(self, p): + """top_list : callback_decl top_list + | describe_block top_list + | dictionary_block top_list + | enum_block top_list + | inline top_list + | interface_block top_list + | label_block top_list + | namespace top_list + | struct_block top_list + | typedef_decl top_list + | bad_decl top_list + | """ + if len(p) > 2: + p[0] = ListFromConcat(p[1], p[2]) + if self.parse_debug: DumpReduction('top_list', p) + + # Recover from error and continue parsing at the next top match. + def p_top_error(self, p): + """top_list : error top_list""" + p[0] = p[2] + + # Recover from error and continue parsing at the next top match. + def p_bad_decl(self, p): + """bad_decl : modifiers SYMBOL error '}' ';'""" + p[0] = [] + +# +# Modifier List +# +# + def p_modifiers(self, p): + """modifiers : comments ext_attr_block""" + p[0] = ListFromConcat(p[1], p[2]) + if self.parse_debug: DumpReduction('modifiers', p) + +# +# Scoped name is a name with an optional scope. +# +# Used for types and namespace names. eg. foo_bar.hello_world, or +# foo_bar.hello_world.SomeType. +# + def p_scoped_name(self, p): + """scoped_name : SYMBOL scoped_name_rest""" + p[0] = ''.join(p[1:]) + if self.parse_debug: DumpReduction('scoped_name', p) + + def p_scoped_name_rest(self, p): + """scoped_name_rest : '.' scoped_name + |""" + p[0] = ''.join(p[1:]) + if self.parse_debug: DumpReduction('scoped_name_rest', p) + +# +# Type reference +# +# + def p_typeref(self, p): + """typeref : scoped_name""" + p[0] = p[1] + if self.parse_debug: DumpReduction('typeref', p) + + +# +# Comments +# +# Comments are optional list of C style comment objects. Comments are returned +# as a list or None. +# + def p_comments(self, p): + """comments : COMMENT comments + | """ + if len(p) > 1: + child = self.BuildComment('Comment', p, 1) + p[0] = ListFromConcat(child, p[2]) + if self.parse_debug: DumpReduction('comments', p) + else: + if self.parse_debug: DumpReduction('no comments', p) + + +# +# Namespace +# +# A namespace provides a named scope to an enclosed top_list. +# + def p_namespace(self, p): + """namespace : modifiers NAMESPACE namespace_name '{' top_list '}' ';'""" + children = ListFromConcat(p[1], p[5]) + p[0] = self.BuildNamed('Namespace', p, 3, children) + + # We allow namespace names of the form foo.bar.baz. + def p_namespace_name(self, p): + """namespace_name : scoped_name""" + p[0] = p[1] + + +# +# Dictionary +# +# A dictionary is a named list of optional and required members. +# + def p_dictionary_block(self, p): + """dictionary_block : modifiers DICTIONARY SYMBOL '{' struct_list '}' ';'""" + p[0] = self.BuildNamed('Dictionary', p, 3, ListFromConcat(p[1], p[5])) + + def p_dictionary_errorA(self, p): + """dictionary_block : modifiers DICTIONARY error ';'""" + p[0] = [] + + def p_dictionary_errorB(self, p): + """dictionary_block : modifiers DICTIONARY error '{' struct_list '}' ';'""" + p[0] = [] + +# +# Callback +# +# A callback is essentially a single function declaration (outside of an +# Interface). +# + def p_callback_decl(self, p): + """callback_decl : modifiers CALLBACK SYMBOL '=' SYMBOL param_list ';'""" + children = ListFromConcat(p[1], p[6]) + p[0] = self.BuildNamed('Callback', p, 3, children) + + +# +# Inline +# +# Inline blocks define option code to be emitted based on language tag, +# in the form of: +# #inline +# +# #endinl +# + def p_inline(self, p): + """inline : modifiers INLINE""" + words = p[2].split() + name = self.BuildAttribute('NAME', words[1]) + lines = p[2].split('\n') + value = self.BuildAttribute('VALUE', '\n'.join(lines[1:-1]) + '\n') + children = ListFromConcat(name, value, p[1]) + p[0] = self.BuildProduction('Inline', p, 2, children) + if self.parse_debug: DumpReduction('inline', p) + +# Extended Attributes +# +# Extended Attributes denote properties which will be applied to a node in the +# AST. A list of extended attributes are denoted by a brackets '[' ... ']' +# enclosing a comma separated list of extended attributes in the form of: +# +# Name +# Name=HEX | INT | OCT | FLOAT +# Name="STRING" +# Name=Function(arg ...) +# TODO(noelallen) -Not currently supported: +# ** Name(arg ...) ... +# ** Name=Scope::Value +# +# Extended Attributes are returned as a list or None. + + def p_ext_attr_block(self, p): + """ext_attr_block : '[' ext_attr_list ']' + | """ + if len(p) > 1: + p[0] = p[2] + if self.parse_debug: DumpReduction('ext_attr_block', p) + else: + if self.parse_debug: DumpReduction('no ext_attr_block', p) + + def p_ext_attr_list(self, p): + """ext_attr_list : SYMBOL '=' SYMBOL ext_attr_cont + | SYMBOL '=' value ext_attr_cont + | SYMBOL '=' SYMBOL param_list ext_attr_cont + | SYMBOL ext_attr_cont""" + # If there are 4 tokens plus a return slot, this must be in the form + # SYMBOL = SYMBOL|value ext_attr_cont + if len(p) == 5: + p[0] = ListFromConcat(self.BuildAttribute(p[1], p[3]), p[4]) + # If there are 5 tokens plus a return slot, this must be in the form + # SYMBOL = SYMBOL (param_list) ext_attr_cont + elif len(p) == 6: + member = self.BuildNamed('Member', p, 3, [p[4]]) + p[0] = ListFromConcat(self.BuildAttribute(p[1], member), p[5]) + # Otherwise, this must be: SYMBOL ext_attr_cont + else: + p[0] = ListFromConcat(self.BuildAttribute(p[1], 'True'), p[2]) + if self.parse_debug: DumpReduction('ext_attribute_list', p) + + def p_ext_attr_list_values(self, p): + """ext_attr_list : SYMBOL '=' '(' values ')' ext_attr_cont + | SYMBOL '=' '(' symbols ')' ext_attr_cont""" + p[0] = ListFromConcat(self.BuildAttribute(p[1], p[4]), p[6]) + + def p_values(self, p): + """values : value values_cont""" + p[0] = ListFromConcat(p[1], p[2]) + + def p_symbols(self, p): + """symbols : SYMBOL symbols_cont""" + p[0] = ListFromConcat(p[1], p[2]) + + def p_symbols_cont(self, p): + """symbols_cont : ',' SYMBOL symbols_cont + | """ + if len(p) > 1: p[0] = ListFromConcat(p[2], p[3]) + + def p_values_cont(self, p): + """values_cont : ',' value values_cont + | """ + if len(p) > 1: p[0] = ListFromConcat(p[2], p[3]) + + def p_ext_attr_cont(self, p): + """ext_attr_cont : ',' ext_attr_list + |""" + if len(p) > 1: p[0] = p[2] + if self.parse_debug: DumpReduction('ext_attribute_cont', p) + + def p_ext_attr_func(self, p): + """ext_attr_list : SYMBOL '(' attr_arg_list ')' ext_attr_cont""" + p[0] = ListFromConcat(self.BuildAttribute(p[1] + '()', p[3]), p[5]) + if self.parse_debug: DumpReduction('attr_arg_func', p) + + def p_ext_attr_arg_list(self, p): + """attr_arg_list : SYMBOL attr_arg_cont + | value attr_arg_cont""" + p[0] = ListFromConcat(p[1], p[2]) + + def p_attr_arg_cont(self, p): + """attr_arg_cont : ',' attr_arg_list + | """ + if self.parse_debug: DumpReduction('attr_arg_cont', p) + if len(p) > 1: p[0] = p[2] + + def p_attr_arg_error(self, p): + """attr_arg_cont : error attr_arg_cont""" + p[0] = p[2] + if self.parse_debug: DumpReduction('attr_arg_error', p) + + +# +# Describe +# +# A describe block is defined at the top level. It provides a mechanism for +# attributing a group of ext_attr to a describe_list. Members of the +# describe list are language specific 'Type' declarations +# + def p_describe_block(self, p): + """describe_block : modifiers DESCRIBE '{' describe_list '}' ';'""" + children = ListFromConcat(p[1], p[4]) + p[0] = self.BuildProduction('Describe', p, 2, children) + if self.parse_debug: DumpReduction('describe_block', p) + + # Recover from describe error and continue parsing at the next top match. + def p_describe_error(self, p): + """describe_list : error describe_list""" + p[0] = [] + + def p_describe_list(self, p): + """describe_list : modifiers SYMBOL ';' describe_list + | modifiers ENUM ';' describe_list + | modifiers STRUCT ';' describe_list + | modifiers TYPEDEF ';' describe_list + | """ + if len(p) > 1: + Type = self.BuildNamed('Type', p, 2, p[1]) + p[0] = ListFromConcat(Type, p[4]) + +# +# Constant Values (integer, value) +# +# Constant values can be found at various levels. A Constant value is returns +# as the string value after validated against a FLOAT, HEX, INT, OCT or +# STRING pattern as appropriate. +# + def p_value(self, p): + """value : FLOAT + | HEX + | INT + | OCT + | STRING""" + p[0] = p[1] + if self.parse_debug: DumpReduction('value', p) + + def p_value_lshift(self, p): + """value : integer LSHIFT INT""" + p[0] = "%s << %s" % (p[1], p[3]) + if self.parse_debug: DumpReduction('value', p) + +# Integers are numbers which may not be floats used in cases like array sizes. + def p_integer(self, p): + """integer : HEX + | INT + | OCT""" + p[0] = p[1] + if self.parse_debug: DumpReduction('integer', p) + +# +# Expression +# +# A simple arithmetic expression. +# + precedence = ( + ('left','|','&','^'), + ('left','LSHIFT','RSHIFT'), + ('left','+','-'), + ('left','*','/'), + ('right','UMINUS','~'), + ) + + def p_expression_binop(self, p): + """expression : expression LSHIFT expression + | expression RSHIFT expression + | expression '|' expression + | expression '&' expression + | expression '^' expression + | expression '+' expression + | expression '-' expression + | expression '*' expression + | expression '/' expression""" + p[0] = "%s %s %s" % (str(p[1]), str(p[2]), str(p[3])) + if self.parse_debug: DumpReduction('expression_binop', p) + + def p_expression_unop(self, p): + """expression : '-' expression %prec UMINUS + | '~' expression %prec '~'""" + p[0] = "%s%s" % (str(p[1]), str(p[2])) + if self.parse_debug: DumpReduction('expression_unop', p) + + def p_expression_term(self, p): + """expression : '(' expression ')'""" + p[0] = "%s%s%s" % (str(p[1]), str(p[2]), str(p[3])) + if self.parse_debug: DumpReduction('expression_term', p) + + def p_expression_symbol(self, p): + """expression : SYMBOL""" + p[0] = p[1] + if self.parse_debug: DumpReduction('expression_symbol', p) + + def p_expression_integer(self, p): + """expression : integer""" + p[0] = p[1] + if self.parse_debug: DumpReduction('expression_integer', p) + +# +# Array List +# +# Defined a list of array sizes (if any). +# + def p_arrays(self, p): + """arrays : '[' ']' arrays + | '[' integer ']' arrays + | """ + # If there are 3 tokens plus a return slot it is an unsized array + if len(p) == 4: + array = self.BuildProduction('Array', p, 1) + p[0] = ListFromConcat(array, p[3]) + # If there are 4 tokens plus a return slot it is a fixed array + elif len(p) == 5: + count = self.BuildAttribute('FIXED', p[2]) + array = self.BuildProduction('Array', p, 2, [count]) + p[0] = ListFromConcat(array, p[4]) + # If there is only a return slot, do not fill it for this terminator. + elif len(p) == 1: return + if self.parse_debug: DumpReduction('arrays', p) + + +# An identifier is a legal value for a parameter or attribute name. Lots of +# existing IDL files use "callback" as a parameter/attribute name, so we allow +# a SYMBOL or the CALLBACK keyword. + def p_identifier(self, p): + """identifier : SYMBOL + | CALLBACK""" + p[0] = p[1] + # Save the line number of the underlying token (otherwise it gets + # discarded), since we use it in the productions with an identifier in + # them. + p.set_lineno(0, p.lineno(1)) + + +# +# Union +# +# A union allows multiple choices of types for a parameter or member. +# + + def p_union_option(self, p): + """union_option : modifiers SYMBOL arrays""" + typeref = self.BuildAttribute('TYPEREF', p[2]) + children = ListFromConcat(p[1], typeref, p[3]) + p[0] = self.BuildProduction('Option', p, 2, children) + + def p_union_list(self, p): + """union_list : union_option OR union_list + | union_option""" + if len(p) > 2: + p[0] = ListFromConcat(p[1], p[3]) + else: + p[0] = p[1] + +# +# Parameter List +# +# A parameter list is a collection of arguments which are passed to a +# function. +# + def p_param_list(self, p): + """param_list : '(' param_item param_cont ')' + | '(' ')' """ + if len(p) > 3: + args = ListFromConcat(p[2], p[3]) + else: + args = [] + p[0] = self.BuildProduction('Callspec', p, 1, args) + if self.parse_debug: DumpReduction('param_list', p) + + def p_param_item(self, p): + """param_item : modifiers optional typeref arrays identifier""" + typeref = self.BuildAttribute('TYPEREF', p[3]) + children = ListFromConcat(p[1], p[2], typeref, p[4]) + p[0] = self.BuildNamed('Param', p, 5, children) + if self.parse_debug: DumpReduction('param_item', p) + + def p_param_item_union(self, p): + """param_item : modifiers optional '(' union_list ')' identifier""" + union = self.BuildAttribute('Union', True) + children = ListFromConcat(p[1], p[2], p[4], union) + p[0] = self.BuildNamed('Param', p, 6, children) + if self.parse_debug: DumpReduction('param_item', p) + + def p_optional(self, p): + """optional : OPTIONAL + | """ + if len(p) == 2: + p[0] = self.BuildAttribute('OPTIONAL', True) + + + def p_param_cont(self, p): + """param_cont : ',' param_item param_cont + | """ + if len(p) > 1: + p[0] = ListFromConcat(p[2], p[3]) + if self.parse_debug: DumpReduction('param_cont', p) + + def p_param_error(self, p): + """param_cont : error param_cont""" + p[0] = p[2] + + +# +# Typedef +# +# A typedef creates a new referencable type. The typedef can specify an array +# definition as well as a function declaration. +# + def p_typedef_data(self, p): + """typedef_decl : modifiers TYPEDEF SYMBOL SYMBOL ';' """ + typeref = self.BuildAttribute('TYPEREF', p[3]) + children = ListFromConcat(p[1], typeref) + p[0] = self.BuildNamed('Typedef', p, 4, children) + if self.parse_debug: DumpReduction('typedef_data', p) + + def p_typedef_array(self, p): + """typedef_decl : modifiers TYPEDEF SYMBOL arrays SYMBOL ';' """ + typeref = self.BuildAttribute('TYPEREF', p[3]) + children = ListFromConcat(p[1], typeref, p[4]) + p[0] = self.BuildNamed('Typedef', p, 5, children) + if self.parse_debug: DumpReduction('typedef_array', p) + + def p_typedef_func(self, p): + """typedef_decl : modifiers TYPEDEF SYMBOL SYMBOL param_list ';' """ + typeref = self.BuildAttribute('TYPEREF', p[3]) + children = ListFromConcat(p[1], typeref, p[5]) + p[0] = self.BuildNamed('Typedef', p, 4, children) + if self.parse_debug: DumpReduction('typedef_func', p) + +# +# Enumeration +# +# An enumeration is a set of named integer constants. An enumeration +# is valid type which can be referenced in other definitions. +# + def p_enum_block(self, p): + """enum_block : modifiers ENUM SYMBOL '{' enum_list '}' ';'""" + p[0] = self.BuildNamed('Enum', p, 3, ListFromConcat(p[1], p[5])) + if self.parse_debug: DumpReduction('enum_block', p) + + # Recover from enum error and continue parsing at the next top match. + def p_enum_errorA(self, p): + """enum_block : modifiers ENUM error '{' enum_list '}' ';'""" + p[0] = [] + + def p_enum_errorB(self, p): + """enum_block : modifiers ENUM error ';'""" + p[0] = [] + + def p_enum_list(self, p): + """enum_list : modifiers SYMBOL '=' expression enum_cont + | modifiers SYMBOL enum_cont""" + if len(p) > 4: + val = self.BuildAttribute('VALUE', p[4]) + enum = self.BuildNamed('EnumItem', p, 2, ListFromConcat(val, p[1])) + p[0] = ListFromConcat(enum, p[5]) + else: + enum = self.BuildNamed('EnumItem', p, 2, p[1]) + p[0] = ListFromConcat(enum, p[3]) + if self.parse_debug: DumpReduction('enum_list', p) + + def p_enum_cont(self, p): + """enum_cont : ',' enum_list + |""" + if len(p) > 1: p[0] = p[2] + if self.parse_debug: DumpReduction('enum_cont', p) + + def p_enum_cont_error(self, p): + """enum_cont : error enum_cont""" + p[0] = p[2] + if self.parse_debug: DumpReduction('enum_error', p) + + +# +# Label +# +# A label is a special kind of enumeration which allows us to go from a +# set of labels +# + def p_label_block(self, p): + """label_block : modifiers LABEL SYMBOL '{' label_list '}' ';'""" + p[0] = self.BuildNamed('Label', p, 3, ListFromConcat(p[1], p[5])) + if self.parse_debug: DumpReduction('label_block', p) + + def p_label_list(self, p): + """label_list : modifiers SYMBOL '=' FLOAT label_cont""" + val = self.BuildAttribute('VALUE', p[4]) + label = self.BuildNamed('LabelItem', p, 2, ListFromConcat(val, p[1])) + p[0] = ListFromConcat(label, p[5]) + if self.parse_debug: DumpReduction('label_list', p) + + def p_label_cont(self, p): + """label_cont : ',' label_list + |""" + if len(p) > 1: p[0] = p[2] + if self.parse_debug: DumpReduction('label_cont', p) + + def p_label_cont_error(self, p): + """label_cont : error label_cont""" + p[0] = p[2] + if self.parse_debug: DumpReduction('label_error', p) + + +# +# Members +# +# A member attribute or function of a struct or interface. +# + def p_member_attribute(self, p): + """member_attribute : modifiers typeref arrays questionmark identifier""" + typeref = self.BuildAttribute('TYPEREF', p[2]) + children = ListFromConcat(p[1], typeref, p[3], p[4]) + p[0] = self.BuildNamed('Member', p, 5, children) + if self.parse_debug: DumpReduction('attribute', p) + + def p_member_attribute_union(self, p): + """member_attribute : modifiers '(' union_list ')' questionmark identifier""" + union = self.BuildAttribute('Union', True) + children = ListFromConcat(p[1], p[3], p[5], union) + p[0] = self.BuildNamed('Member', p, 6, children) + if self.parse_debug: DumpReduction('attribute', p) + + def p_member_function(self, p): + """member_function : modifiers static typeref arrays SYMBOL param_list""" + typeref = self.BuildAttribute('TYPEREF', p[3]) + children = ListFromConcat(p[1], p[2], typeref, p[4], p[6]) + p[0] = self.BuildNamed('Member', p, 5, children) + if self.parse_debug: DumpReduction('function', p) + + def p_static(self, p): + """static : STATIC + | """ + if len(p) == 2: + p[0] = self.BuildAttribute('STATIC', True) + + def p_questionmark(self, p): + """questionmark : '?' + | """ + if len(p) == 2: + p[0] = self.BuildAttribute('OPTIONAL', True) + +# +# Interface +# +# An interface is a named collection of functions. +# + def p_interface_block(self, p): + """interface_block : modifiers INTERFACE SYMBOL '{' interface_list '}' ';'""" + p[0] = self.BuildNamed('Interface', p, 3, ListFromConcat(p[1], p[5])) + if self.parse_debug: DumpReduction('interface_block', p) + + def p_interface_error(self, p): + """interface_block : modifiers INTERFACE error '{' interface_list '}' ';'""" + p[0] = [] + + def p_interface_list(self, p): + """interface_list : member_function ';' interface_list + | """ + if len(p) > 1 : + p[0] = ListFromConcat(p[1], p[3]) + if self.parse_debug: DumpReduction('interface_list', p) + + +# +# Struct +# +# A struct is a named collection of members which in turn reference other +# types. The struct is a referencable type. +# + def p_struct_block(self, p): + """struct_block : modifiers STRUCT SYMBOL '{' struct_list '}' ';'""" + children = ListFromConcat(p[1], p[5]) + p[0] = self.BuildNamed('Struct', p, 3, children) + if self.parse_debug: DumpReduction('struct_block', p) + + # Recover from struct error and continue parsing at the next top match. + def p_struct_error(self, p): + """enum_block : modifiers STRUCT error '{' struct_list '}' ';'""" + p[0] = [] + + def p_struct_list(self, p): + """struct_list : member_attribute ';' struct_list + | member_function ';' struct_list + |""" + if len(p) > 1: p[0] = ListFromConcat(p[1], p[3]) + + +# +# Parser Errors +# +# p_error is called whenever the parser can not find a pattern match for +# a set of items from the current state. The p_error function defined here +# is triggered logging an error, and parsing recover happens as the +# p__error functions defined above are called. This allows the parser +# to continue so as to capture more than one error per file. +# + def p_error(self, t): + filename = self.lexobj.filename + self.parse_errors += 1 + if t: + lineno = t.lineno + pos = t.lexpos + prev = self.yaccobj.symstack[-1] + if type(prev) == lex.LexToken: + msg = "Unexpected %s after %s." % ( + TokenTypeName(t), TokenTypeName(prev)) + else: + msg = "Unexpected %s." % (t.value) + else: + lineno = self.last.lineno + pos = self.last.lexpos + msg = "Unexpected end of file after %s." % TokenTypeName(self.last) + self.yaccobj.restart() + + # Attempt to remap the error to a friendlier form + if msg in ERROR_REMAP: + msg = ERROR_REMAP[msg] + + # Log the error + ErrOut.LogLine(filename, lineno, pos, msg) + + def Warn(self, node, msg): + WarnOut.LogLine(node.filename, node.lineno, node.pos, msg) + self.parse_warnings += 1 + + def __init__(self): + IDLLexer.__init__(self) + self.yaccobj = yacc.yacc(module=self, tabmodule=None, debug=False, + optimize=0, write_tables=0) + + self.build_debug = GetOption('build_debug') + self.parse_debug = GetOption('parse_debug') + self.token_debug = GetOption('token_debug') + self.verbose = GetOption('verbose') + self.parse_errors = 0 + +# +# Tokenizer +# +# The token function returns the next token provided by IDLLexer for matching +# against the leaf paterns. +# + def token(self): + tok = self.lexobj.token() + if tok: + self.last = tok + if self.token_debug: + InfoOut.Log("TOKEN %s(%s)" % (tok.type, tok.value)) + return tok + +# +# BuildProduction +# +# Production is the set of items sent to a grammar rule resulting in a new +# item being returned. +# +# p - Is the Yacc production object containing the stack of items +# index - Index into the production of the name for the item being produced. +# cls - The type of item being producted +# childlist - The children of the new item + def BuildProduction(self, cls, p, index, childlist=None): + if not childlist: childlist = [] + filename = self.lexobj.filename + lineno = p.lineno(index) + pos = p.lexpos(index) + out = IDLNode(cls, filename, lineno, pos, childlist) + if self.build_debug: + InfoOut.Log("Building %s" % out) + return out + + def BuildNamed(self, cls, p, index, childlist=None): + if not childlist: childlist = [] + childlist.append(self.BuildAttribute('NAME', p[index])) + return self.BuildProduction(cls, p, index, childlist) + + def BuildComment(self, cls, p, index): + name = p[index] + + # Remove comment markers + lines = [] + if name[:2] == '//': + # For C++ style, remove any leading whitespace and the '//' marker from + # each line. + form = 'cc' + for line in name.split('\n'): + start = line.find('//') + lines.append(line[start+2:]) + else: + # For C style, remove ending '*/'' + form = 'c' + for line in name[:-2].split('\n'): + # Remove characters until start marker for this line '*' if found + # otherwise it should be blank. + offs = line.find('*') + if offs >= 0: + line = line[offs + 1:].rstrip() + else: + line = '' + lines.append(line) + name = '\n'.join(lines) + + childlist = [self.BuildAttribute('NAME', name), + self.BuildAttribute('FORM', form)] + return self.BuildProduction(cls, p, index, childlist) + +# +# BuildAttribute +# +# An ExtendedAttribute is a special production that results in a property +# which is applied to the adjacent item. Attributes have no children and +# instead represent key/value pairs. +# + def BuildAttribute(self, key, val): + return IDLAttribute(key, val) + + +# +# ParseData +# +# Attempts to parse the current data loaded in the lexer. +# + def ParseData(self, data, filename=''): + self.SetData(filename, data) + try: + self.parse_errors = 0 + self.parse_warnings = 0 + return self.yaccobj.parse(lexer=self) + + except lex.LexError as le: + ErrOut.Log(str(le)) + return [] + +# +# ParseFile +# +# Loads a new file into the lexer and attemps to parse it. +# + def ParseFile(self, filename): + date = time.ctime(os.path.getmtime(filename)) + data = open(filename).read() + if self.verbose: + InfoOut.Log("Parsing %s" % filename) + try: + out = self.ParseData(data, filename) + + # If we have a src root specified, remove it from the path + srcroot = GetOption('srcroot') + if srcroot and filename.find(srcroot) == 0: + filename = filename[len(srcroot) + 1:] + filenode = IDLFile(filename, out, self.parse_errors + self.lex_errors) + filenode.SetProperty('DATETIME', date) + return filenode + + except Exception as e: + ErrOut.LogLine(filename, self.last.lineno, self.last.lexpos, + 'Internal parsing error - %s.' % str(e)) + raise + + + +# +# Flatten Tree +# +# Flattens the tree of IDLNodes for use in testing. +# +def FlattenTree(node): + add_self = False + out = [] + for child in node.GetChildren(): + if child.IsA('Comment'): + add_self = True + else: + out.extend(FlattenTree(child)) + + if add_self: + out = [str(node)] + out + return out + + +def TestErrors(filename, filenode): + nodelist = filenode.GetChildren() + + lexer = IDLLexer() + data = open(filename).read() + lexer.SetData(filename, data) + + pass_comments = [] + fail_comments = [] + while True: + tok = lexer.lexobj.token() + if tok == None: break + if tok.type == 'COMMENT': + args = tok.value[3:-3].split() + if args[0] == 'OK': + pass_comments.append((tok.lineno, ' '.join(args[1:]))) + else: + if args[0] == 'FAIL': + fail_comments.append((tok.lineno, ' '.join(args[1:]))) + obj_list = [] + for node in nodelist: + obj_list.extend(FlattenTree(node)) + + errors = 0 + + # + # Check for expected successes + # + obj_cnt = len(obj_list) + pass_cnt = len(pass_comments) + if obj_cnt != pass_cnt: + InfoOut.Log("Mismatched pass (%d) vs. nodes built (%d)." + % (pass_cnt, obj_cnt)) + InfoOut.Log("PASS: %s" % [x[1] for x in pass_comments]) + InfoOut.Log("OBJS: %s" % obj_list) + errors += 1 + if pass_cnt > obj_cnt: pass_cnt = obj_cnt + + for i in range(pass_cnt): + line, comment = pass_comments[i] + if obj_list[i] != comment: + ErrOut.LogLine(filename, line, None, "OBJ %s : EXPECTED %s\n" % + (obj_list[i], comment)) + errors += 1 + + # + # Check for expected errors + # + err_list = ErrOut.DrainLog() + err_cnt = len(err_list) + fail_cnt = len(fail_comments) + if err_cnt != fail_cnt: + InfoOut.Log("Mismatched fail (%d) vs. errors seen (%d)." + % (fail_cnt, err_cnt)) + InfoOut.Log("FAIL: %s" % [x[1] for x in fail_comments]) + InfoOut.Log("ERRS: %s" % err_list) + errors += 1 + if fail_cnt > err_cnt: fail_cnt = err_cnt + + for i in range(fail_cnt): + line, comment = fail_comments[i] + err = err_list[i].strip() + + if err_list[i] != comment: + ErrOut.Log("%s(%d) Error\n\tERROR : %s\n\tEXPECT: %s" % ( + filename, line, err_list[i], comment)) + errors += 1 + + # Clear the error list for the next run + err_list = [] + return errors + + +def TestFile(parser, filename): + # Capture errors instead of reporting them so we can compare them + # with the expected errors. + ErrOut.SetConsole(False) + ErrOut.SetCapture(True) + + filenode = parser.ParseFile(filename) + + # Renable output + ErrOut.SetConsole(True) + ErrOut.SetCapture(False) + + # Compare captured errors + return TestErrors(filename, filenode) + + +def TestErrorFiles(filter): + idldir = os.path.split(sys.argv[0])[0] + idldir = os.path.join(idldir, 'test_parser', '*.idl') + filenames = glob.glob(idldir) + parser = IDLParser() + total_errs = 0 + for filename in filenames: + if filter and filename not in filter: continue + errs = TestFile(parser, filename) + if errs: + ErrOut.Log("%s test failed with %d error(s)." % (filename, errs)) + total_errs += errs + + if total_errs: + ErrOut.Log("Failed parsing test.") + else: + InfoOut.Log("Passed parsing test.") + return total_errs + + +def TestNamespaceFiles(filter): + idldir = os.path.split(sys.argv[0])[0] + idldir = os.path.join(idldir, 'test_namespace', '*.idl') + filenames = glob.glob(idldir) + testnames = [] + + for filename in filenames: + if filter and filename not in filter: continue + testnames.append(filename) + + # If we have no files to test, then skip this test + if not testnames: + InfoOut.Log('No files to test for namespace.') + return 0 + + InfoOut.SetConsole(False) + ast = ParseFiles(testnames) + InfoOut.SetConsole(True) + + errs = ast.GetProperty('ERRORS') + if errs: + ErrOut.Log("Failed namespace test.") + else: + InfoOut.Log("Passed namespace test.") + return errs + + + +def FindVersionError(releases, node): + err_cnt = 0 + if node.IsA('Interface', 'Struct'): + comment_list = [] + comment = node.GetOneOf('Comment') + if comment and comment.GetName()[:4] == 'REL:': + comment_list = comment.GetName()[5:].strip().split(' ') + + first_list = [node.first_release[rel] for rel in releases] + first_list = sorted(set(first_list)) + if first_list != comment_list: + node.Error("Mismatch in releases: %s vs %s." % ( + comment_list, first_list)) + err_cnt += 1 + + for child in node.GetChildren(): + err_cnt += FindVersionError(releases, child) + return err_cnt + + +def TestVersionFiles(filter): + idldir = os.path.split(sys.argv[0])[0] + idldir = os.path.join(idldir, 'test_version', '*.idl') + filenames = glob.glob(idldir) + testnames = [] + + for filename in filenames: + if filter and filename not in filter: continue + testnames.append(filename) + + # If we have no files to test, then skip this test + if not testnames: + InfoOut.Log('No files to test for version.') + return 0 + + ast = ParseFiles(testnames) + errs = FindVersionError(ast.releases, ast) + errs += ast.errors + + if errs: + ErrOut.Log("Failed version test.") + else: + InfoOut.Log("Passed version test.") + return errs + + +default_dirs = ['.', 'trusted', 'dev', 'private'] +def ParseFiles(filenames): + parser = IDLParser() + filenodes = [] + + if not filenames: + filenames = [] + srcroot = GetOption('srcroot') + dirs = default_dirs + if GetOption('include_private'): + dirs += ['private'] + for dirname in dirs: + srcdir = os.path.join(srcroot, dirname, '*.idl') + srcdir = os.path.normpath(srcdir) + filenames += sorted(glob.glob(srcdir)) + + if not filenames: + ErrOut.Log('No sources provided.') + + for filename in filenames: + filenode = parser.ParseFile(filename) + filenodes.append(filenode) + + ast = IDLAst(filenodes) + if GetOption('dump_tree'): ast.Dump(0) + + Lint(ast) + return ast + + +def Main(args): + filenames = ParseOptions(args) + + # If testing... + if GetOption('test'): + errs = TestErrorFiles(filenames) + errs = TestNamespaceFiles(filenames) + errs = TestVersionFiles(filenames) + if errs: + ErrOut.Log("Parser failed with %d errors." % errs) + return -1 + return 0 + + # Otherwise, build the AST + ast = ParseFiles(filenames) + errs = ast.GetProperty('ERRORS') + if errs: + ErrOut.Log('Found %d error(s).' % errs); + InfoOut.Log("%d files processed." % len(filenames)) + return errs + + +if __name__ == '__main__': + sys.exit(Main(sys.argv[1:])) + diff --git a/browser/extensions/mortar/ppapi/generators/idl_propertynode.py b/browser/extensions/mortar/ppapi/generators/idl_propertynode.py new file mode 100755 index 000000000000..e15354ad0a4d --- /dev/null +++ b/browser/extensions/mortar/ppapi/generators/idl_propertynode.py @@ -0,0 +1,114 @@ +#!/usr/bin/env python +# Copyright (c) 2012 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" Hierarchical property system for IDL AST """ +import re +import sys + +from idl_log import ErrOut, InfoOut, WarnOut + +# +# IDLPropertyNode +# +# A property node is a hierarchically aware system for mapping +# keys to values, such that a local dictionary is search first, +# followed by parent dictionaries in order. +# +class IDLPropertyNode(object): + def __init__(self): + self.parents = [] + self.property_map = {} + + def AddParent(self, parent): + assert parent + self.parents.append(parent) + + def SetProperty(self, name, val): + self.property_map[name] = val + + def GetProperty(self, name): + # Check locally for the property, and return it if found. + prop = self.property_map.get(name, None) + if prop is not None: + return prop + # If not, seach parents in order + for parent in self.parents: + prop = parent.GetProperty(name) + if prop is not None: + return prop + # Otherwise, it can not be found. + return None + + def GetPropertyLocal(self, name): + # Search for the property, but only locally. + return self.property_map.get(name, None) + + def GetPropertyList(self): + return self.property_map.keys() + +# +# Testing functions +# + +# Build a property node, setting the properties including a name, and +# associate the children with this new node. +# +def BuildNode(name, props, children=None, parents=None): + node = IDLPropertyNode() + node.SetProperty('NAME', name) + for prop in props: + toks = prop.split('=') + node.SetProperty(toks[0], toks[1]) + if children: + for child in children: + child.AddParent(node) + if parents: + for parent in parents: + node.AddParent(parent) + return node + +def ExpectProp(node, name, val): + found = node.GetProperty(name) + if found != val: + ErrOut.Log('Got property %s expecting %s' % (found, val)) + return 1 + return 0 + +# +# Verify property inheritance +# +def PropertyTest(): + errors = 0 + left = BuildNode('Left', ['Left=Left']) + right = BuildNode('Right', ['Right=Right']) + top = BuildNode('Top', ['Left=Top', 'Right=Top'], [left, right]) + + errors += ExpectProp(top, 'Left', 'Top') + errors += ExpectProp(top, 'Right', 'Top') + + errors += ExpectProp(left, 'Left', 'Left') + errors += ExpectProp(left, 'Right', 'Top') + + errors += ExpectProp(right, 'Left', 'Top') + errors += ExpectProp(right, 'Right', 'Right') + + if not errors: + InfoOut.Log('Passed PropertyTest') + return errors + + +def Main(): + errors = 0 + errors += PropertyTest() + + if errors: + ErrOut.Log('IDLNode failed with %d errors.' % errors) + return -1 + return 0 + + +if __name__ == '__main__': + sys.exit(Main()) + diff --git a/browser/extensions/mortar/ppapi/generators/idl_release.py b/browser/extensions/mortar/ppapi/generators/idl_release.py new file mode 100755 index 000000000000..ff4aa01db04e --- /dev/null +++ b/browser/extensions/mortar/ppapi/generators/idl_release.py @@ -0,0 +1,356 @@ +#!/usr/bin/env python +# Copyright (c) 2012 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +IDLRelease for PPAPI + +This file defines the behavior of the AST namespace which allows for resolving +a symbol as one or more AST nodes given a Release or range of Releases. +""" + +import sys + +from idl_log import ErrOut, InfoOut, WarnOut +from idl_option import GetOption, Option, ParseOptions + +Option('release_debug', 'Debug Release data') +Option('wgap', 'Ignore Release gap warning') + + +# +# Module level functions and data used for testing. +# +error = None +warning = None +def ReportReleaseError(msg): + global error + error = msg + +def ReportReleaseWarning(msg): + global warning + warning = msg + +def ReportClear(): + global error, warning + error = None + warning = None + +# +# IDLRelease +# +# IDLRelease is an object which stores the association of a given symbol +# name, with an AST node for a range of Releases for that object. +# +# A vmin value of None indicates that the object begins at the earliest +# available Release number. The value of vmin is always inclusive. + +# A vmax value of None indicates that the object is never deprecated, so +# it exists until it is overloaded or until the latest available Release. +# The value of vmax is always exclusive, representing the first Release +# on which the object is no longer valid. +class IDLRelease(object): + def __init__(self, rmin, rmax): + self.rmin = rmin + self.rmax = rmax + + def __str__(self): + if not self.rmin: + rmin = '0' + else: + rmin = str(self.rmin) + if not self.rmax: + rmax = '+oo' + else: + rmax = str(self.rmax) + return '[%s,%s)' % (rmin, rmax) + + def SetReleaseRange(self, rmin, rmax): + self.rmin = rmin + self.rmax = rmax + + # True, if Release falls within the interval [self.vmin, self.vmax) + def IsRelease(self, release): + if self.rmax and self.rmax <= release: + return False + if self.rmin and self.rmin > release: + return False + if GetOption('release_debug'): + InfoOut.Log('%f is in %s' % (release, self)) + return True + + # True, if Release falls within the interval [self.vmin, self.vmax) + def InReleases(self, releases): + if not releases: return False + + # Check last release first, since InRange does not match last item + if self.IsRelease(releases[-1]): return True + if len(releases) > 1: + return self.InRange(releases[0], releases[-1]) + return False + + # True, if interval [vmin, vmax) overlaps interval [self.vmin, self.vmax) + def InRange(self, rmin, rmax): + assert (rmin == None) or rmin < rmax + + # An min of None always passes a min bound test + # An max of None always passes a max bound test + if rmin is not None and self.rmax is not None: + if self.rmax <= rmin: + return False + if rmax is not None and self.rmin is not None: + if self.rmin >= rmax: + return False + + if GetOption('release_debug'): + InfoOut.Log('%f to %f is in %s' % (rmin, rmax, self)) + return True + + def GetMinMax(self, releases = None): + if not releases: + return self.rmin, self.rmax + + if not self.rmin: + rmin = releases[0] + else: + rmin = str(self.rmin) + if not self.rmax: + rmax = releases[-1] + else: + rmax = str(self.rmax) + return (rmin, rmax) + + def SetMin(self, release): + assert not self.rmin + self.rmin = release + + def Error(self, msg): + ReportReleaseError(msg) + + def Warn(self, msg): + ReportReleaseWarning(msg) + + +# +# IDLReleaseList +# +# IDLReleaseList is a list based container for holding IDLRelease +# objects in order. The IDLReleaseList can be added to, and searched by +# range. Objects are stored in order, and must be added in order. +# +class IDLReleaseList(object): + def __init__(self): + self._nodes = [] + + def GetReleases(self): + return self._nodes + + def FindRelease(self, release): + for node in self._nodes: + if node.IsRelease(release): + return node + return None + + def FindRange(self, rmin, rmax): + assert (rmin == None) or rmin != rmax + + out = [] + for node in self._nodes: + if node.InRange(rmin, rmax): + out.append(node) + return out + + def AddNode(self, node): + if GetOption('release_debug'): + InfoOut.Log('\nAdding %s %s' % (node.Location(), node)) + last = None + + # Check current releases in that namespace + for cver in self._nodes: + if GetOption('release_debug'): InfoOut.Log(' Checking %s' % cver) + + # We should only be missing a 'release' tag for the first item. + if not node.rmin: + node.Error('Missing release on overload of previous %s.' % + cver.Location()) + return False + + # If the node has no max, then set it to this one + if not cver.rmax: + cver.rmax = node.rmin + if GetOption('release_debug'): InfoOut.Log(' Update %s' % cver) + + # if the max and min overlap, than's an error + if cver.rmax > node.rmin: + if node.rmax and cver.rmin >= node.rmax: + node.Error('Declarations out of order.') + else: + node.Error('Overlap in releases: %s vs %s when adding %s' % + (cver.rmax, node.rmin, node)) + return False + last = cver + + # Otherwise, the previous max and current min should match + # unless this is the unlikely case of something being only + # temporarily deprecated. + if last and last.rmax != node.rmin: + node.Warn('Gap in release numbers.') + + # If we made it here, this new node must be the 'newest' + # and does not overlap with anything previously added, so + # we can add it to the end of the list. + if GetOption('release_debug'): InfoOut.Log('Done %s' % node) + self._nodes.append(node) + return True + +# +# IDLReleaseMap +# +# A release map, can map from an float interface release, to a global +# release string. +# +class IDLReleaseMap(object): + def __init__(self, release_info): + self.version_to_release = {} + self.release_to_version = {} + self.release_to_channel = {} + for release, version, channel in release_info: + self.version_to_release[version] = release + self.release_to_version[release] = version + self.release_to_channel[release] = channel + self.releases = sorted(self.release_to_version.keys()) + self.versions = sorted(self.version_to_release.keys()) + + def GetVersion(self, release): + return self.release_to_version.get(release, None) + + def GetVersions(self): + return self.versions + + def GetRelease(self, version): + return self.version_to_release.get(version, None) + + def GetReleases(self): + return self.releases + + def GetReleaseRange(self): + return (self.releases[0], self.releases[-1]) + + def GetVersionRange(self): + return (self.versions[0], self.version[-1]) + + def GetChannel(self, release): + return self.release_to_channel.get(release, None) + +# +# Test Code +# +def TestReleaseNode(): + FooXX = IDLRelease(None, None) + Foo1X = IDLRelease('M14', None) + Foo23 = IDLRelease('M15', 'M16') + + assert FooXX.IsRelease('M13') + assert FooXX.IsRelease('M14') + assert FooXX.InRange('M13', 'M13A') + assert FooXX.InRange('M14','M15') + + assert not Foo1X.IsRelease('M13') + assert Foo1X.IsRelease('M14') + assert Foo1X.IsRelease('M15') + + assert not Foo1X.InRange('M13', 'M14') + assert not Foo1X.InRange('M13A', 'M14') + assert Foo1X.InRange('M14', 'M15') + assert Foo1X.InRange('M15', 'M16') + + assert not Foo23.InRange('M13', 'M14') + assert not Foo23.InRange('M13A', 'M14') + assert not Foo23.InRange('M14', 'M15') + assert Foo23.InRange('M15', 'M16') + assert Foo23.InRange('M14', 'M15A') + assert Foo23.InRange('M15B', 'M17') + assert not Foo23.InRange('M16', 'M17') + print "TestReleaseNode - Passed" + + +def TestReleaseListWarning(): + FooXX = IDLRelease(None, None) + Foo1X = IDLRelease('M14', None) + Foo23 = IDLRelease('M15', 'M16') + Foo45 = IDLRelease('M17', 'M18') + + # Add nodes out of order should fail + ReportClear() + releases = IDLReleaseList() + assert releases.AddNode(Foo23) + assert releases.AddNode(Foo45) + assert warning + print "TestReleaseListWarning - Passed" + + +def TestReleaseListError(): + FooXX = IDLRelease(None, None) + Foo1X = IDLRelease('M14', None) + Foo23 = IDLRelease('M15', 'M16') + Foo45 = IDLRelease('M17', 'M18') + + # Add nodes out of order should fail + ReportClear() + releases = IDLReleaseList() + assert releases.AddNode(FooXX) + assert releases.AddNode(Foo23) + assert not releases.AddNode(Foo1X) + assert error + print "TestReleaseListError - Passed" + + +def TestReleaseListOK(): + FooXX = IDLRelease(None, None) + Foo1X = IDLRelease('M14', None) + Foo23 = IDLRelease('M15', 'M16') + Foo45 = IDLRelease('M17', 'M18') + + # Add nodes in order should work + ReportClear() + releases = IDLReleaseList() + assert releases.AddNode(FooXX) + assert releases.AddNode(Foo1X) + assert releases.AddNode(Foo23) + assert not error and not warning + assert releases.AddNode(Foo45) + assert warning + + assert releases.FindRelease('M13') == FooXX + assert releases.FindRelease('M14') == Foo1X + assert releases.FindRelease('M15') == Foo23 + assert releases.FindRelease('M16') == None + assert releases.FindRelease('M17') == Foo45 + assert releases.FindRelease('M18') == None + + assert releases.FindRange('M13','M14') == [FooXX] + assert releases.FindRange('M13','M17') == [FooXX, Foo1X, Foo23] + assert releases.FindRange('M16','M17') == [] + assert releases.FindRange(None, None) == [FooXX, Foo1X, Foo23, Foo45] + + # Verify we can find the correct versions + print "TestReleaseListOK - Passed" + + +def TestReleaseMap(): + print "TestReleaseMap- Passed" + + +def Main(args): + TestReleaseNode() + TestReleaseListWarning() + TestReleaseListError() + TestReleaseListOK() + print "Passed" + return 0 + + +if __name__ == '__main__': + sys.exit(Main(sys.argv[1:])) + diff --git a/browser/extensions/mortar/ppapi/generators/idl_tests.py b/browser/extensions/mortar/ppapi/generators/idl_tests.py new file mode 100755 index 000000000000..bf6d8a1570cc --- /dev/null +++ b/browser/extensions/mortar/ppapi/generators/idl_tests.py @@ -0,0 +1,45 @@ +#!/usr/bin/env python +# Copyright (c) 2012 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" Test runner for IDL Generator changes """ + +import subprocess +import sys + +def TestIDL(testname, args): + print '\nRunning unit tests for %s.' % testname + try: + args = [sys.executable, testname] + args + subprocess.check_call(args) + return 0 + except subprocess.CalledProcessError as err: + print 'Failed with %s.' % str(err) + return 1 + +def main(args): + errors = 0 + errors += TestIDL('idl_lexer.py', ['--test']) + assert errors == 0 + errors += TestIDL('idl_parser.py', ['--test']) + assert errors == 0 + errors += TestIDL('idl_c_header.py', []) + assert errors == 0 + errors += TestIDL('idl_c_proto.py', ['--wnone', '--test']) + assert errors == 0 + errors += TestIDL('idl_gen_pnacl.py', ['--wnone', '--test']) + assert errors == 0 + errors += TestIDL('idl_namespace.py', []) + assert errors == 0 + errors += TestIDL('idl_node.py', []) + assert errors == 0 + + if errors: + print '\nFailed tests.' + return errors + + +if __name__ == '__main__': + sys.exit(main(sys.argv[1:])) + diff --git a/browser/extensions/mortar/ppapi/generators/idl_thunk.py b/browser/extensions/mortar/ppapi/generators/idl_thunk.py new file mode 100755 index 000000000000..5e037a221298 --- /dev/null +++ b/browser/extensions/mortar/ppapi/generators/idl_thunk.py @@ -0,0 +1,581 @@ +#!/usr/bin/env python +# Copyright (c) 2012 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" Generator for C++ style thunks """ + +import glob +import os +import re +import sys + +from idl_log import ErrOut, InfoOut, WarnOut +from idl_node import IDLAttribute, IDLNode +from idl_ast import IDLAst +from idl_option import GetOption, Option, ParseOptions +from idl_outfile import IDLOutFile +from idl_parser import ParseFiles +from idl_c_proto import CGen, GetNodeComments, CommentLines, Comment +from idl_generator import Generator, GeneratorByFile + +Option('thunkroot', 'Base directory of output', + default=os.path.join('..', 'thunk')) + + +class TGenError(Exception): + def __init__(self, msg): + self.value = msg + + def __str__(self): + return repr(self.value) + + +class ThunkBodyMetadata(object): + """Metadata about thunk body. Used for selecting which headers to emit.""" + def __init__(self): + self._apis = set() + self._builtin_includes = set() + self._includes = set() + + def AddApi(self, api): + self._apis.add(api) + + def Apis(self): + return self._apis + + def AddInclude(self, include): + self._includes.add(include) + + def Includes(self): + return self._includes + + def AddBuiltinInclude(self, include): + self._builtin_includes.add(include) + + def BuiltinIncludes(self): + return self._builtin_includes + + +def _GetBaseFileName(filenode): + """Returns the base name for output files, given the filenode. + + Examples: + 'dev/ppb_find_dev.h' -> 'ppb_find_dev' + 'trusted/ppb_buffer_trusted.h' -> 'ppb_buffer_trusted' + """ + path, name = os.path.split(filenode.GetProperty('NAME')) + name = os.path.splitext(name)[0] + return name + + +def _GetHeaderFileName(filenode): + """Returns the name for the header for this file.""" + path, name = os.path.split(filenode.GetProperty('NAME')) + name = os.path.splitext(name)[0] + if path: + header = "ppapi/c/%s/%s.h" % (path, name) + else: + header = "ppapi/c/%s.h" % name + return header + + +def _GetThunkFileName(filenode, relpath): + """Returns the thunk file name.""" + path = os.path.split(filenode.GetProperty('NAME'))[0] + name = _GetBaseFileName(filenode) + # We don't reattach the path for thunk. + if relpath: name = os.path.join(relpath, name) + name = '%s%s' % (name, '_thunk.cc') + return name + + +def _StripFileName(filenode): + """Strips path and dev, trusted, and private suffixes from the file name.""" + api_basename = _GetBaseFileName(filenode) + if api_basename.endswith('_dev'): + api_basename = api_basename[:-len('_dev')] + if api_basename.endswith('_trusted'): + api_basename = api_basename[:-len('_trusted')] + if api_basename.endswith('_private'): + api_basename = api_basename[:-len('_private')] + return api_basename + + +def _StripApiName(api_name): + """Strips Dev, Private, and Trusted suffixes from the API name.""" + if api_name.endswith('Trusted'): + api_name = api_name[:-len('Trusted')] + if api_name.endswith('_Dev'): + api_name = api_name[:-len('_Dev')] + if api_name.endswith('_Private'): + api_name = api_name[:-len('_Private')] + return api_name + + +def _MakeEnterLine(filenode, interface, member, arg, handle_errors, callback, + meta): + """Returns an EnterInstance/EnterResource string for a function.""" + api_name = _StripApiName(interface.GetName()) + '_API' + if member.GetProperty('api'): # Override API name. + manually_provided_api = True + # TODO(teravest): Automatically guess the API header file. + api_name = member.GetProperty('api') + else: + manually_provided_api = False + + if arg[0] == 'PP_Instance': + if callback is None: + arg_string = arg[1] + else: + arg_string = '%s, %s' % (arg[1], callback) + if interface.GetProperty('singleton') or member.GetProperty('singleton'): + if not manually_provided_api: + meta.AddApi('ppapi/thunk/%s_api.h' % _StripFileName(filenode)) + return 'EnterInstanceAPI<%s> enter(%s);' % (api_name, arg_string) + else: + return 'EnterInstance enter(%s);' % arg_string + elif arg[0] == 'PP_Resource': + enter_type = 'EnterResource<%s>' % api_name + if not manually_provided_api: + meta.AddApi('ppapi/thunk/%s_api.h' % _StripFileName(filenode)) + if callback is None: + return '%s enter(%s, %s);' % (enter_type, arg[1], + str(handle_errors).lower()) + else: + return '%s enter(%s, %s, %s);' % (enter_type, arg[1], + callback, + str(handle_errors).lower()) + else: + raise TGenError("Unknown type for _MakeEnterLine: %s" % arg[0]) + + +def _GetShortName(interface, filter_suffixes): + """Return a shorter interface name that matches Is* and Create* functions.""" + parts = interface.GetName().split('_')[1:] + tail = parts[len(parts) - 1] + if tail in filter_suffixes: + parts = parts[:-1] + return ''.join(parts) + + +def _IsTypeCheck(interface, node, args): + """Returns true if node represents a type-checking function.""" + if len(args) == 0 or args[0][0] != 'PP_Resource': + return False + return node.GetName() == 'Is%s' % _GetShortName(interface, ['Dev', 'Private']) + + +def _GetCreateFuncName(interface): + """Returns the creation function name for an interface.""" + return 'Create%s' % _GetShortName(interface, ['Dev']) + + +def _GetDefaultFailureValue(t): + """Returns the default failure value for a given type. + + Returns None if no default failure value exists for the type. + """ + values = { + 'PP_Bool': 'PP_FALSE', + 'PP_Resource': '0', + 'struct PP_Var': 'PP_MakeUndefined()', + 'float': '0.0f', + 'int32_t': 'enter.retval()', + 'uint16_t': '0', + 'uint32_t': '0', + 'uint64_t': '0', + 'void*': 'NULL' + } + if t in values: + return values[t] + return None + + +def _MakeCreateMemberBody(interface, member, args): + """Returns the body of a Create() function. + + Args: + interface - IDLNode for the interface + member - IDLNode for member function + args - List of arguments for the Create() function + """ + if args[0][0] == 'PP_Resource': + body = 'Resource* object =\n' + body += ' PpapiGlobals::Get()->GetResourceTracker()->' + body += 'GetResource(%s);\n' % args[0][1] + body += 'if (!object)\n' + body += ' return 0;\n' + body += 'EnterResourceCreation enter(object->pp_instance());\n' + elif args[0][0] == 'PP_Instance': + body = 'EnterResourceCreation enter(%s);\n' % args[0][1] + else: + raise TGenError('Unknown arg type for Create(): %s' % args[0][0]) + + body += 'if (enter.failed())\n' + body += ' return 0;\n' + arg_list = ', '.join([a[1] for a in args]) + if member.GetProperty('create_func'): + create_func = member.GetProperty('create_func') + else: + create_func = _GetCreateFuncName(interface) + body += 'return enter.functions()->%s(%s);' % (create_func, + arg_list) + return body + + +def _GetOutputParams(member, release): + """Returns output parameters (and their types) for a member function. + + Args: + member - IDLNode for the member function + release - Release to get output parameters for + Returns: + A list of name strings for all output parameters of the member + function. + """ + out_params = [] + callnode = member.GetOneOf('Callspec') + if callnode: + cgen = CGen() + for param in callnode.GetListOf('Param'): + mode = cgen.GetParamMode(param) + if mode == 'out': + # We use the 'store' mode when getting the parameter type, since we + # need to call sizeof() for memset(). + _, pname, _, _ = cgen.GetComponents(param, release, 'store') + out_params.append(pname) + return out_params + + +def _MakeNormalMemberBody(filenode, release, node, member, rtype, args, + include_version, meta): + """Returns the body of a typical function. + + Args: + filenode - IDLNode for the file + release - release to generate body for + node - IDLNode for the interface + member - IDLNode for the member function + rtype - Return type for the member function + args - List of 4-tuple arguments for the member function + include_version - whether to include the version in the invocation + meta - ThunkBodyMetadata for header hints + """ + if len(args) == 0: + # Calling into the "Shared" code for the interface seems like a reasonable + # heuristic when we don't have any arguments; some thunk code follows this + # convention today. + meta.AddApi('ppapi/shared_impl/%s_shared.h' % _StripFileName(filenode)) + return 'return %s::%s();' % (_StripApiName(node.GetName()) + '_Shared', + member.GetName()) + + is_callback_func = args[len(args) - 1][0] == 'struct PP_CompletionCallback' + + if is_callback_func: + call_args = args[:-1] + [('', 'enter.callback()', '', '')] + meta.AddInclude('ppapi/c/pp_completion_callback.h') + else: + call_args = args + + if args[0][0] == 'PP_Instance': + call_arglist = ', '.join(a[1] for a in call_args) + function_container = 'functions' + elif args[0][0] == 'PP_Resource': + call_arglist = ', '.join(a[1] for a in call_args[1:]) + function_container = 'object' + else: + # Calling into the "Shared" code for the interface seems like a reasonable + # heuristic when the first argument isn't a PP_Instance or a PP_Resource; + # some thunk code follows this convention today. + meta.AddApi('ppapi/shared_impl/%s_shared.h' % _StripFileName(filenode)) + return 'return %s::%s(%s);' % (_StripApiName(node.GetName()) + '_Shared', + member.GetName(), + ', '.join(a[1] for a in args)) + + function_name = member.GetName() + if include_version: + version = node.GetVersion(release).replace('.', '_') + function_name += version + + invocation = 'enter.%s()->%s(%s)' % (function_container, + function_name, + call_arglist) + + handle_errors = not (member.GetProperty('report_errors') == 'False') + out_params = _GetOutputParams(member, release) + if is_callback_func: + body = '%s\n' % _MakeEnterLine(filenode, node, member, args[0], + handle_errors, args[len(args) - 1][1], meta) + failure_value = member.GetProperty('on_failure') + if failure_value is None: + failure_value = 'enter.retval()' + failure_return = 'return %s;' % failure_value + success_return = 'return enter.SetResult(%s);' % invocation + elif rtype == 'void': + body = '%s\n' % _MakeEnterLine(filenode, node, member, args[0], + handle_errors, None, meta) + failure_return = 'return;' + success_return = '%s;' % invocation # We don't return anything for void. + else: + body = '%s\n' % _MakeEnterLine(filenode, node, member, args[0], + handle_errors, None, meta) + failure_value = member.GetProperty('on_failure') + if failure_value is None: + failure_value = _GetDefaultFailureValue(rtype) + if failure_value is None: + raise TGenError('There is no default value for rtype %s. ' + 'Maybe you should provide an on_failure attribute ' + 'in the IDL file.' % rtype) + failure_return = 'return %s;' % failure_value + success_return = 'return %s;' % invocation + + if member.GetProperty('always_set_output_parameters'): + body += 'if (enter.failed()) {\n' + for param in out_params: + body += ' memset(%s, 0, sizeof(*%s));\n' % (param, param) + body += ' %s\n' % failure_return + body += '}\n' + body += '%s' % success_return + meta.AddBuiltinInclude('string.h') + else: + body += 'if (enter.failed())\n' + body += ' %s\n' % failure_return + body += '%s' % success_return + return body + + +def DefineMember(filenode, node, member, release, include_version, meta): + """Returns a definition for a member function of an interface. + + Args: + filenode - IDLNode for the file + node - IDLNode for the interface + member - IDLNode for the member function + release - release to generate + include_version - include the version in emitted function name. + meta - ThunkMetadata for header hints + Returns: + A string with the member definition. + """ + cgen = CGen() + rtype, name, arrays, args = cgen.GetComponents(member, release, 'return') + log_body = '\"%s::%s()\";' % (node.GetName(), member.GetName()) + if len(log_body) > 69: # Prevent lines over 80 characters. + body = 'VLOG(4) <<\n' + body += ' %s\n' % log_body + else: + body = 'VLOG(4) << %s\n' % log_body + + if _IsTypeCheck(node, member, args): + body += '%s\n' % _MakeEnterLine(filenode, node, member, args[0], False, + None, meta) + body += 'return PP_FromBool(enter.succeeded());' + elif member.GetName() == 'Create' or member.GetName() == 'CreateTrusted': + body += _MakeCreateMemberBody(node, member, args) + else: + body += _MakeNormalMemberBody(filenode, release, node, member, rtype, args, + include_version, meta) + + signature = cgen.GetSignature(member, release, 'return', func_as_ptr=False, + include_version=include_version) + return '%s\n%s\n}' % (cgen.Indent('%s {' % signature, tabs=0), + cgen.Indent(body, tabs=1)) + + +def _IsNewestMember(member, members, releases): + """Returns true if member is the newest node with its name in members. + + Currently, every node in the AST only has one version. This means that we + will have two sibling nodes with the same name to represent different + versions. + See http://crbug.com/157017 . + + Special handling is required for nodes which share their name with others, + but aren't the newest version in the IDL. + + Args: + member - The member which is checked if it's newest + members - The list of members to inspect + releases - The set of releases to check for versions in. + """ + build_list = member.GetUniqueReleases(releases) + release = build_list[0] # Pick the oldest release. + same_name_siblings = filter( + lambda n: str(n) == str(member) and n != member, members) + + for s in same_name_siblings: + sibling_build_list = s.GetUniqueReleases(releases) + sibling_release = sibling_build_list[0] + if sibling_release > release: + return False + return True + + +class TGen(GeneratorByFile): + def __init__(self): + Generator.__init__(self, 'Thunk', 'tgen', 'Generate the C++ thunk.') + + def GenerateFile(self, filenode, releases, options): + savename = _GetThunkFileName(filenode, GetOption('thunkroot')) + my_min, my_max = filenode.GetMinMax(releases) + if my_min > releases[-1] or my_max < releases[0]: + if os.path.isfile(savename): + print "Removing stale %s for this range." % filenode.GetName() + os.remove(os.path.realpath(savename)) + return False + do_generate = filenode.GetProperty('generate_thunk') + if not do_generate: + return False + + thunk_out = IDLOutFile(savename) + body, meta = self.GenerateBody(thunk_out, filenode, releases, options) + # TODO(teravest): How do we handle repeated values? + if filenode.GetProperty('thunk_include'): + meta.AddInclude(filenode.GetProperty('thunk_include')) + self.WriteHead(thunk_out, filenode, releases, options, meta) + thunk_out.Write('\n\n'.join(body)) + self.WriteTail(thunk_out, filenode, releases, options) + thunk_out.ClangFormat() + return thunk_out.Close() + + def WriteHead(self, out, filenode, releases, options, meta): + __pychecker__ = 'unusednames=options' + cgen = CGen() + + cright_node = filenode.GetChildren()[0] + assert(cright_node.IsA('Copyright')) + out.Write('%s\n' % cgen.Copyright(cright_node, cpp_style=True)) + + from_text = 'From %s' % ( + filenode.GetProperty('NAME').replace(os.sep,'/')) + modified_text = 'modified %s.' % ( + filenode.GetProperty('DATETIME')) + out.Write('// %s %s\n\n' % (from_text, modified_text)) + + if meta.BuiltinIncludes(): + for include in sorted(meta.BuiltinIncludes()): + out.Write('#include <%s>\n' % include) + out.Write('\n') + + # TODO(teravest): Don't emit includes we don't need. + includes = ['ppapi/c/pp_errors.h', + 'ppapi/shared_impl/tracked_callback.h', + 'ppapi/thunk/enter.h', + 'ppapi/thunk/ppapi_thunk_export.h'] + includes.append(_GetHeaderFileName(filenode)) + for api in meta.Apis(): + includes.append('%s' % api.lower()) + for i in meta.Includes(): + includes.append(i) + for include in sorted(includes): + out.Write('#include "%s"\n' % include) + out.Write('\n') + out.Write('namespace ppapi {\n') + out.Write('namespace thunk {\n') + out.Write('\n') + out.Write('namespace {\n') + out.Write('\n') + + def GenerateBody(self, out, filenode, releases, options): + """Generates a member function lines to be written and metadata. + + Returns a tuple of (body, meta) where: + body - a list of lines with member function bodies + meta - a ThunkMetadata instance for hinting which headers are needed. + """ + __pychecker__ = 'unusednames=options' + out_members = [] + meta = ThunkBodyMetadata() + for node in filenode.GetListOf('Interface'): + # Skip if this node is not in this release + if not node.InReleases(releases): + print "Skipping %s" % node + continue + + # Generate Member functions + if node.IsA('Interface'): + members = node.GetListOf('Member') + for child in members: + build_list = child.GetUniqueReleases(releases) + # We have to filter out releases this node isn't in. + build_list = filter(lambda r: child.InReleases([r]), build_list) + if len(build_list) == 0: + continue + release = build_list[-1] + include_version = not _IsNewestMember(child, members, releases) + member = DefineMember(filenode, node, child, release, include_version, + meta) + if not member: + continue + out_members.append(member) + return (out_members, meta) + + def WriteTail(self, out, filenode, releases, options): + __pychecker__ = 'unusednames=options' + cgen = CGen() + + version_list = [] + out.Write('\n\n') + for node in filenode.GetListOf('Interface'): + build_list = node.GetUniqueReleases(releases) + for build in build_list: + version = node.GetVersion(build).replace('.', '_') + thunk_name = 'g_' + node.GetName().lower() + '_thunk_' + \ + version + thunk_type = '_'.join((node.GetName(), version)) + version_list.append((thunk_type, thunk_name)) + + out.Write('const %s %s = {\n' % (thunk_type, thunk_name)) + generated_functions = [] + members = node.GetListOf('Member') + for child in members: + rtype, name, arrays, args = cgen.GetComponents( + child, build, 'return') + if child.InReleases([build]): + if not _IsNewestMember(child, members, releases): + version = child.GetVersion( + child.first_release[build]).replace('.', '_') + name += '_' + version + generated_functions.append(name) + out.Write(',\n'.join([' &%s' % f for f in generated_functions])) + out.Write('\n};\n\n') + + out.Write('} // namespace\n') + out.Write('\n') + for thunk_type, thunk_name in version_list: + out.Write('PPAPI_THUNK_EXPORT const %s* Get%s_Thunk() {\n' % + (thunk_type, thunk_type)) + out.Write(' return &%s;\n' % thunk_name) + out.Write('}\n') + out.Write('\n') + out.Write('} // namespace thunk\n') + out.Write('} // namespace ppapi\n') + + +tgen = TGen() + + +def Main(args): + # Default invocation will verify the golden files are unchanged. + failed = 0 + if not args: + args = ['--wnone', '--diff', '--test', '--thunkroot=.'] + + ParseOptions(args) + + idldir = os.path.split(sys.argv[0])[0] + idldir = os.path.join(idldir, 'test_thunk', '*.idl') + filenames = glob.glob(idldir) + ast = ParseFiles(filenames) + if tgen.GenerateRange(ast, ['M13', 'M14', 'M15'], {}): + print "Golden file for M13-M15 failed." + failed = 1 + else: + print "Golden file for M13-M15 passed." + + return failed + + +if __name__ == '__main__': + sys.exit(Main(sys.argv[1:])) diff --git a/browser/extensions/mortar/ppapi/generators/idl_visitor.py b/browser/extensions/mortar/ppapi/generators/idl_visitor.py new file mode 100644 index 000000000000..7945f613dc9a --- /dev/null +++ b/browser/extensions/mortar/ppapi/generators/idl_visitor.py @@ -0,0 +1,45 @@ +# Copyright (c) 2012 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" Visitor Object for traversing AST """ + +# +# IDLVisitor +# +# The IDLVisitor class will traverse an AST truncating portions of the tree +# when 'VisitFilter' returns false. After the filter returns true, for each +# node, the visitor will call the 'Arrive' member passing in the node and +# and generic data object from the parent call. The returned value is then +# passed to all children who's results are aggregated into a list. The child +# results along with the original Arrive result are passed to the Depart +# function which returns the final result of the Visit. By default this is +# the exact value that was return from the original arrive. +# + +class IDLVisitor(object): + def __init__(self): + pass + + # Return TRUE if the node should be visited + def VisitFilter(self, node, data): + return True + + def Visit(self, node, data): + if not self.VisitFilter(node, data): return None + + childdata = [] + newdata = self.Arrive(node, data) + for child in node.GetChildren(): + ret = self.Visit(child, newdata) + if ret is not None: + childdata.append(ret) + return self.Depart(node, newdata, childdata) + + def Arrive(self, node, data): + __pychecker__ = 'unusednames=node' + return data + + def Depart(self, node, data, childdata): + __pychecker__ = 'unusednames=node,childdata' + return data diff --git a/browser/extensions/mortar/ppapi/generators/test_cgen/enum_typedef.h b/browser/extensions/mortar/ppapi/generators/test_cgen/enum_typedef.h new file mode 100644 index 000000000000..6eb1a0c8fc38 --- /dev/null +++ b/browser/extensions/mortar/ppapi/generators/test_cgen/enum_typedef.h @@ -0,0 +1,69 @@ +/* + * Copyright (c) 2011 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From test_cgen/enum_typedef.idl modified Wed Dec 5 13:08:05 2012. */ + +#ifndef PPAPI_C_TEST_CGEN_ENUM_TYPEDEF_H_ +#define PPAPI_C_TEST_CGEN_ENUM_TYPEDEF_H_ + +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/test_cgen/stdint.h" + +/** + * @file + * This file will test that the IDL snippet matches the comment. + */ + + +/** + * @addtogroup Enums + * @{ + */ +/* typedef enum { A = 1, B = 2, C = 3, D = A + B, E = ~D } et1; */ +typedef enum { + A = 1, + B = 2, + C = 3, + D = A + B, + E = ~D +} et1; +/** + * @} + */ + +/** + * @addtogroup Typedefs + * @{ + */ +/* typedef int32_t i; */ +typedef int32_t i; + +/* typedef int32_t i2[3]; */ +typedef int32_t i2[3]; + +/* typedef int32_t (*i_func)(void); */ +typedef int32_t (*i_func)(void); + +/* typedef int32_t (*i_func_i)(int32_t i); */ +typedef int32_t (*i_func_i)(int32_t i); + +/* typedef et1 et4[4]; */ +typedef et1 et4[4]; + +/* + * typedef int8_t (*PPB_Audio_Callback)(const void* sample_buffer, + * uint32_t buffer_size_in_bytes, + * const void* user_data); + */ +typedef int8_t (*PPB_Audio_Callback)(const void* sample_buffer, + uint32_t buffer_size_in_bytes, + const void* user_data); +/** + * @} + */ + +#endif /* PPAPI_C_TEST_CGEN_ENUM_TYPEDEF_H_ */ + diff --git a/browser/extensions/mortar/ppapi/generators/test_cgen/enum_typedef.idl b/browser/extensions/mortar/ppapi/generators/test_cgen/enum_typedef.idl new file mode 100644 index 000000000000..60d0a6729d48 --- /dev/null +++ b/browser/extensions/mortar/ppapi/generators/test_cgen/enum_typedef.idl @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2011 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * This file will test that the IDL snippet matches the comment. + */ + +/* typedef enum { A = 1, B = 2, C = 3, D = A + B, E = ~D } et1; */ +enum et1 { A=1, B=2, C=3, D=A+B, E=~D }; + +/* typedef int32_t i; */ +typedef int32_t i; + +/* typedef int32_t i2[3]; */ +typedef int32_t[3] i2; + +/* typedef int32_t (*i_func)(void); */ +typedef int32_t i_func(); + +/* typedef int32_t (*i_func_i)(int32_t i); */ +typedef int32_t i_func_i([in] int32_t i); + +/* typedef et1 et4[4]; */ +typedef et1[4] et4; + +/* + * typedef int8_t (*PPB_Audio_Callback)(const void* sample_buffer, + * uint32_t buffer_size_in_bytes, + * const void* user_data); + */ +typedef int8_t PPB_Audio_Callback([in] mem_t sample_buffer, + [in] uint32_t buffer_size_in_bytes, + [in] mem_t user_data); + diff --git a/browser/extensions/mortar/ppapi/generators/test_cgen/interface.h b/browser/extensions/mortar/ppapi/generators/test_cgen/interface.h new file mode 100644 index 000000000000..7288830ea53a --- /dev/null +++ b/browser/extensions/mortar/ppapi/generators/test_cgen/interface.h @@ -0,0 +1,91 @@ +/* + * Copyright (c) 2011 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From test_cgen/interface.idl modified Wed Nov 21 14:22:50 2012. */ + +#ifndef PPAPI_C_TEST_CGEN_INTERFACE_H_ +#define PPAPI_C_TEST_CGEN_INTERFACE_H_ + +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/test_cgen/stdint.h" + +#define IFACEFOO_INTERFACE_1_0 "ifaceFoo;1.0" +#define IFACEFOO_INTERFACE IFACEFOO_INTERFACE_1_0 + +#define IFACEBAR_INTERFACE_1_0 "ifaceBar;1.0" +#define IFACEBAR_INTERFACE IFACEBAR_INTERFACE_1_0 + +/** + * @file + * This file will test that the IDL snippet matches the comment. + */ + + +/** + * @addtogroup Structs + * @{ + */ +/* struct ist { void* X; }; */ +struct ist { + void* X; +}; +/** + * @} + */ + +/** + * @addtogroup Interfaces + * @{ + */ +/* + * struct ifaceFoo_1_0 { + * int8_t (*mem1)(int16_t x, int32_t y); + * int32_t (*mem2)(const struct ist* a); + * int32_t (*mem3)(struct ist* b); + * int32_t (*mem4)(const void** ptr); + * int32_t (*mem5)(void** ptr); + * }; + * typedef struct ifaceFoo_1_0 ifaceFoo; + */ +struct ifaceFoo_1_0 { + int8_t (*mem1)(int16_t x, int32_t y); + int32_t (*mem2)(const struct ist* a); + int32_t (*mem3)(struct ist* b); + int32_t (*mem4)(const void** ptr); + int32_t (*mem5)(void** ptr); +}; + +typedef struct ifaceFoo_1_0 ifaceFoo; + +struct ifaceBar_1_0 { + int8_t (*testIface)(const struct ifaceFoo_1_0* foo, int32_t y); + struct ifaceFoo_1_0* (*createIface)(const char* name); +}; + +typedef struct ifaceBar_1_0 ifaceBar; + +struct ifaceNoString_1_0 { + void (*mem)(void); +}; + +typedef struct ifaceNoString_1_0 ifaceNoString; +/** + * @} + */ + +/** + * @addtogroup Structs + * @{ + */ +struct struct2 { + struct ifaceBar_1_0* bar; +}; +/** + * @} + */ + +#endif /* PPAPI_C_TEST_CGEN_INTERFACE_H_ */ + diff --git a/browser/extensions/mortar/ppapi/generators/test_cgen/interface.idl b/browser/extensions/mortar/ppapi/generators/test_cgen/interface.idl new file mode 100644 index 000000000000..202a73a0dacb --- /dev/null +++ b/browser/extensions/mortar/ppapi/generators/test_cgen/interface.idl @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2011 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * This file will test that the IDL snippet matches the comment. + */ + +label Chrome { + M14 = 1.0, + M15 = 2.0 +}; +/* struct ist { void* X; }; */ +struct ist { + mem_t X; +}; + +/* + * struct ifaceFoo_1_0 { + * int8_t (*mem1)(int16_t x, int32_t y); + * int32_t (*mem2)(const struct ist* a); + * int32_t (*mem3)(struct ist* b); + * int32_t (*mem4)(const void** ptr); + * int32_t (*mem5)(void** ptr); + * }; + * typedef struct ifaceFoo_1_0 ifaceFoo; + */ +interface ifaceFoo { + int8_t mem1([in] int16_t x, [in] int32_t y); + int32_t mem2([in] ist a); + int32_t mem3([out] ist b); + int32_t mem4([in] blob_t ptr); + int32_t mem5([out] blob_t ptr); + [version=2.0] int32_t mem6([inout] blob_t ptr); +}; + +interface ifaceBar { + int8_t testIface([in] ifaceFoo foo, [in] int32_t y); + ifaceFoo createIface([in] str_t name); +}; + +[no_interface_string] +interface ifaceNoString { + void mem(); +}; + +struct struct2 { + ifaceBar bar; +}; + diff --git a/browser/extensions/mortar/ppapi/generators/test_cgen/stdint.h b/browser/extensions/mortar/ppapi/generators/test_cgen/stdint.h new file mode 100644 index 000000000000..e49f0c0b9474 --- /dev/null +++ b/browser/extensions/mortar/ppapi/generators/test_cgen/stdint.h @@ -0,0 +1,21 @@ +/* Copyright (c) 2011 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From test_cgen/stdint.idl modified Thu Aug 18 16:20:46 2011. */ + +#ifndef PPAPI_C_TEST_CGEN_STDINT_H_ +#define PPAPI_C_TEST_CGEN_STDINT_H_ + +#include "ppapi/c/pp_macros.h" + +/** + * @file + * This file provides a definition of C99 sized types + * for Microsoft compilers. These definitions only apply + * for trusted modules. + */ + +#endif /* PPAPI_C_TEST_CGEN_STDINT_H_ */ + diff --git a/browser/extensions/mortar/ppapi/generators/test_cgen/stdint.idl b/browser/extensions/mortar/ppapi/generators/test_cgen/stdint.idl new file mode 100644 index 000000000000..f63a66a46ed3 --- /dev/null +++ b/browser/extensions/mortar/ppapi/generators/test_cgen/stdint.idl @@ -0,0 +1,54 @@ +/* Copyright (c) 2011 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * This file provides a definition of C99 sized types + * for Microsoft compilers. These definitions only apply + * for trusted modules. + */ + +label Chrome { + M13 = 0.0, + M14 = 1.0, + M15 = 2.0 +}; + +[version=0.0] +describe { + /** Standard Ints. */ + int8_t; + int16_t; + int32_t; + int64_t; + uint8_t; + uint16_t; + uint32_t; + uint64_t; + /** Small and large floats. */ + double_t; + float_t; + + /** Native file handle (int). */ + handle_t; + + /** Interface object (void *). */ + interface_t; + + /** Used for padding, should be (u)int8_t */ + char; + + /** Pointer to memory (void *). */ + mem_t; + + /** Pointer to null terminated string (char *). */ + str_t; + + /** No return value. */ + void; + + /** Pointer to pointer to memory (void **). */ + blob_t; +}; + diff --git a/browser/extensions/mortar/ppapi/generators/test_cgen/structs.h b/browser/extensions/mortar/ppapi/generators/test_cgen/structs.h new file mode 100644 index 000000000000..352e08e890c7 --- /dev/null +++ b/browser/extensions/mortar/ppapi/generators/test_cgen/structs.h @@ -0,0 +1,94 @@ +/* + * Copyright (c) 2011 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From test_cgen/structs.idl modified Wed Nov 21 11:02:50 2012. */ + +#ifndef PPAPI_C_TEST_CGEN_STRUCTS_H_ +#define PPAPI_C_TEST_CGEN_STRUCTS_H_ + +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/test_cgen/stdint.h" + +/** + * @file + * This file will test that the IDL snippet matches the comment. + */ + + +/** + * @addtogroup Typedefs + * @{ + */ +/* typedef uint8_t s_array[3]; */ +typedef uint8_t s_array[3]; +/** + * @} + */ + +/** + * @addtogroup Enums + * @{ + */ +/* typedef enum { esv1 = 1, esv2 = 2 } senum; */ +typedef enum { + esv1 = 1, + esv2 = 2 +} senum; +/** + * @} + */ + +/** + * @addtogroup Structs + * @{ + */ +/* struct st1 { int32_t i; senum j; }; */ +struct st1 { + int32_t i; + senum j; +}; + +/* struct st2 { s_array pixels[640][480]; }; */ +struct st2 { + s_array pixels[640][480]; +}; +/** + * @} + */ + +/** + * @addtogroup Typedefs + * @{ + */ +/* typedef float (*func_t)(const s_array data); */ +typedef float (*func_t)(const s_array data); + +/* typedef func_t (*findfunc_t)(const char* x); */ +typedef func_t (*findfunc_t)(const char* x); +/** + * @} + */ + +/** + * @addtogroup Structs + * @{ + */ +/* + * struct sfoo { + * s_array screen[480][640]; + * findfunc_t myfunc; + * }; + */ +struct sfoo { + s_array screen[480][640]; + findfunc_t myfunc; +}; +/** + * @} + */ + +#endif /* PPAPI_C_TEST_CGEN_STRUCTS_H_ */ + diff --git a/browser/extensions/mortar/ppapi/generators/test_cgen/structs.idl b/browser/extensions/mortar/ppapi/generators/test_cgen/structs.idl new file mode 100644 index 000000000000..b91949c61aa5 --- /dev/null +++ b/browser/extensions/mortar/ppapi/generators/test_cgen/structs.idl @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2011 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * This file will test that the IDL snippet matches the comment. + */ + +label Chrome { + M14=1.0 +}; + +/* typedef uint8_t s_array[3]; */ +typedef uint8_t[3] s_array; + +/* typedef enum { esv1 = 1, esv2 = 2 } senum; */ +enum senum { + esv1=1, + esv2=2 +}; + +/* struct st1 { int32_t i; senum j; }; */ +struct st1 { + int32_t i; + senum j; +}; + +/* struct st2 { s_array pixels[640][480]; }; */ +struct st2 { + s_array[640][480] pixels; +}; + +/* typedef float (*func_t)(const s_array data); */ +typedef float_t func_t([in] s_array data); + +/* typedef func_t (*findfunc_t)(const char* x); */ +typedef func_t findfunc_t([in] str_t x); + +/* + * struct sfoo { + * s_array screen[480][640]; + * findfunc_t myfunc; + * }; + */ +struct sfoo { + s_array[480][640] screen; + findfunc_t myfunc; +}; diff --git a/browser/extensions/mortar/ppapi/generators/test_cgen_range/dev_channel_interface.h b/browser/extensions/mortar/ppapi/generators/test_cgen_range/dev_channel_interface.h new file mode 100644 index 000000000000..325a770a765a --- /dev/null +++ b/browser/extensions/mortar/ppapi/generators/test_cgen_range/dev_channel_interface.h @@ -0,0 +1,101 @@ +/* Copyright 2013 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From test_cgen_range/dev_channel_interface.idl, + * modified Tue Dec 3 14:58:15 2013. + */ + +#ifndef PPAPI_C_TEST_CGEN_RANGE_DEV_CHANNEL_INTERFACE_H_ +#define PPAPI_C_TEST_CGEN_RANGE_DEV_CHANNEL_INTERFACE_H_ + +#include "ppapi/c/pp_macros.h" + +#define TESTDEV_INTERFACE_1_0 "TestDev;1.0" +#define TESTDEV_INTERFACE_1_2 "TestDev;1.2" +#define TESTDEV_INTERFACE_1_3 "TestDev;1.3" /* dev */ +#define TESTDEV_INTERFACE TESTDEV_INTERFACE_1_2 + +#define TESTDEVTOSTABLE_INTERFACE_1_0 "TestDevToStable;1.0" +#define TESTDEVTOSTABLE_INTERFACE_1_1 "TestDevToStable;1.1" /* dev */ +#define TESTDEVTOSTABLE_INTERFACE_1_2 "TestDevToStable;1.2" +#define TESTDEVTOSTABLE_INTERFACE TESTDEVTOSTABLE_INTERFACE_1_2 + +/** + * @file + */ + + +/** + * @addtogroup Interfaces + * @{ + */ +/** + * TestDev + */ +struct TestDev_1_3 { /* dev */ + /** + * TestDev1() + */ + void (*TestDev1)(void); + /** + * TestDev2() + */ + void (*TestDev2)(void); + /** + * TestDev3() + */ + void (*TestDev3)(void); + /** + * TestDev4() + */ + void (*TestDev4)(void); +}; + +struct TestDev_1_0 { + void (*TestDev1)(void); +}; + +struct TestDev_1_2 { + void (*TestDev1)(void); + void (*TestDev3)(void); +}; + +typedef struct TestDev_1_2 TestDev; + +/** + * TestDevToStable + */ +struct TestDevToStable_1_2 { + /** + * Foo() comment. + */ + void (*Foo)(int32_t x); + /** + * Bar() comment. + */ + void (*Bar)(int32_t x); + /** + * Baz() comment. + */ + void (*Baz)(int32_t x); +}; + +typedef struct TestDevToStable_1_2 TestDevToStable; + +struct TestDevToStable_1_0 { + void (*Foo)(int32_t x); +}; + +struct TestDevToStable_1_1 { /* dev */ + void (*Foo)(int32_t x); + void (*Bar)(int32_t x); + void (*Baz)(int32_t x); +}; +/** + * @} + */ + +#endif /* PPAPI_C_TEST_CGEN_RANGE_DEV_CHANNEL_INTERFACE_H_ */ + diff --git a/browser/extensions/mortar/ppapi/generators/test_cgen_range/dev_channel_interface.idl b/browser/extensions/mortar/ppapi/generators/test_cgen_range/dev_channel_interface.idl new file mode 100644 index 000000000000..d3ae0ec4d81f --- /dev/null +++ b/browser/extensions/mortar/ppapi/generators/test_cgen_range/dev_channel_interface.idl @@ -0,0 +1,67 @@ +/* Copyright 2013 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +label Chrome { + M13 = 1.0, + [channel=dev] M14 = 1.1, + M15 = 1.2, + [channel=dev] M16 = 1.3, + M17 = 1.4 +}; + +describe { + int32_t; + void; +}; + +/** + * TestDev + */ +interface TestDev { + /** + * TestDev1() + */ + void TestDev1(); + + /** + * TestDev2() + */ + [dev_version=1.1] + void TestDev2(); + + /** + * TestDev3() + */ + [version=1.2] + void TestDev3(); + + /** + * TestDev4() + */ + [dev_version=1.3] + void TestDev4(); +}; + +/** + * TestDevToStable + */ +interface TestDevToStable { + /** + * Foo() comment. + */ + void Foo([in] int32_t x); + + /** + * Bar() comment. + */ + [dev_version=1.1, version=1.2] + void Bar([in] int32_t x); + + /** + * Baz() comment. + */ + [dev_version=1.1, version=1.2] + void Baz([in] int32_t x); +}; diff --git a/browser/extensions/mortar/ppapi/generators/test_cgen_range/versions.h b/browser/extensions/mortar/ppapi/generators/test_cgen_range/versions.h new file mode 100644 index 000000000000..9d837db872da --- /dev/null +++ b/browser/extensions/mortar/ppapi/generators/test_cgen_range/versions.h @@ -0,0 +1,50 @@ +/* Copyright (c) 2011 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From test_cgen_range/versions.idl modified Wed Nov 21 15:18:23 2012. */ + +#ifndef PPAPI_C_TEST_CGEN_RANGE_VERSIONS_H_ +#define PPAPI_C_TEST_CGEN_RANGE_VERSIONS_H_ + +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/test_cgen_range/dev_channel_interface.h" + +#define FOO_INTERFACE_0_0 "Foo;0.0" +#define FOO_INTERFACE_1_0 "Foo;1.0" +#define FOO_INTERFACE_2_0 "Foo;2.0" +#define FOO_INTERFACE FOO_INTERFACE_2_0 + +/** + * @file + * File Comment. */ + + +/** + * @addtogroup Interfaces + * @{ + */ +/* Bogus Interface Foo */ +struct Foo_2_0 { + /** + * Comment for function x,y,z + */ + int32_t (*Bar)(int32_t x, int32_t y, int32_t z); +}; + +typedef struct Foo_2_0 Foo; + +struct Foo_0_0 { + int32_t (*Bar)(int32_t x); +}; + +struct Foo_1_0 { + int32_t (*Bar)(int32_t x, int32_t y); +}; +/** + * @} + */ + +#endif /* PPAPI_C_TEST_CGEN_RANGE_VERSIONS_H_ */ + diff --git a/browser/extensions/mortar/ppapi/generators/test_cgen_range/versions.idl b/browser/extensions/mortar/ppapi/generators/test_cgen_range/versions.idl new file mode 100644 index 000000000000..e00686e654f6 --- /dev/null +++ b/browser/extensions/mortar/ppapi/generators/test_cgen_range/versions.idl @@ -0,0 +1,32 @@ +/* Copyright (c) 2011 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* File Comment. */ + +label Chrome { + M13 = 0.0, + M14 = 1.0, + M15 = 2.0, + M16 = 3.0, + M17 = 4.0 +}; + +/* Bogus Interface Foo */ +[version=0.0] +interface Foo { + /** + * Comment for function x + */ + [version=0.0] int32_t Bar(int32_t x); + /** + * Comment for function x,y + */ + [version=1.0] int32_t Bar(int32_t x, int32_t y); + /** + * Comment for function x,y,z + */ + [version=2.0] int32_t Bar(int32_t x, int32_t y, int32_t z); +}; + diff --git a/browser/extensions/mortar/ppapi/generators/test_gen_pnacl/test_interfaces.idl b/browser/extensions/mortar/ppapi/generators/test_gen_pnacl/test_interfaces.idl new file mode 100644 index 000000000000..0abe79934a7c --- /dev/null +++ b/browser/extensions/mortar/ppapi/generators/test_gen_pnacl/test_interfaces.idl @@ -0,0 +1,161 @@ +/* + * Copyright (c) 2011 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * This file will test that the pnacl-generated wrapper functions match + * the comments in this IDL. + */ + +label Chrome { + M13 = 0.0, + M14 = 1.0, + M15 = 2.0 +}; + +describe { + void; + mem_t; + int32_t; +}; + +[passByValue, returnByValue] struct some_struct { + mem_t X; + int32_t Y; +}; + +struct some_struct2 { + mem_t X; + int32_t Y; +}; + +[union, passByValue, returnByValue] struct some_union { + mem_t X; + int32_t Y; +}; + +/* + * static int32_t + * Pnacl_M15_PPB_Iface_struct_wrap_foo1(int32_t a, struct some_struct* b) { + * const struct PPB_Iface_struct_wrap_2_0 *iface = + * Pnacl_WrapperInfo_PPB_Iface_struct_wrap_2_0.real_iface; + * return iface->foo1(a, *b); + * } + */ +[version=2.0] +interface PPB_Iface_struct_wrap { + int32_t foo1(int32_t a, [in] some_struct b); +}; + +/* + * static int32_t + * Pnacl_M15_PPB_Iface_union_wrap_foo1(int32_t a, union some_union* b) { + * const struct PPB_Iface_union_wrap_2_0 *iface = + * Pnacl_WrapperInfo_PPB_Iface_union_wrap_2_0.real_iface; + * return iface->foo1(a, *b); + * } + */ +[version=2.0] +interface PPB_Iface_union_wrap { + int32_t foo1(int32_t a, [in] some_union b); +}; + + +[version=2.0] +interface PPB_Iface_nowrap { + int32_t foo1(int32_t a, [in] some_struct2 b); +}; + + +/* + * static + * int32_t Pnacl_M13_PPB_SomeWrap_foo1(struct some_struct* a) { + * const struct PPB_SomeWrap_0_0 *iface = + * Pnacl_WrapperInfo_PPB_SomeWrap_0_0.real_iface; + * return iface->foo1(*a); + * } + * + * static + * void Pnacl_M13_PPB_SomeWrap_foo2(struct some_struct* _struct_result, + * int32_t a) { + * const struct PPB_SomeWrap_0_0 *iface = + * Pnacl_WrapperInfo_PPB_SomeWrap_0_0.real_iface; + * *_struct_result = iface->foo2(a); + * } + */ +[version=0.0] +interface PPB_SomeWrap { + int32_t foo1([in] some_struct a); + some_struct foo2([in] int32_t a); + + /* Not generating wrapper methods for PPB_SomeWrap_1_0 */ + [version=1.0] + int32_t foo1([in] some_struct[] a); + [version=1.0] + void foo2([in] int32_t a, [out] some_struct b); + + /* Not generating wrapper methods for PPB_SomeWrap */ + [version=2.0] + int32_t foo1([in] some_struct2 a); +}; + + +/* + * static int32_t Pnacl_M13_PPP_SomeWrap_foo1(struct some_struct a) { + * const struct PPP_SomeWrap_0_0 *iface = + * Pnacl_WrapperInfo_PPP_SomeWrap_0_0.real_iface; + * int32_t (*temp_fp)(struct some_struct* a) = + * ((int32_t (*)(struct some_struct* a))iface->foo1); + * return temp_fp(&a); + * } + * + * static struct some_struct Pnacl_M13_PPP_SomeWrap_foo2(int32_t a) { + * const struct PPP_SomeWrap_0_0 *iface = + * Pnacl_WrapperInfo_PPP_SomeWrap_0_0.real_iface; + * void (*temp_fp)(struct some_struct* _struct_result, int32_t a) = + * ((void (*)(struct some_struct* _struct_result, int32_t a))iface->foo2); + * struct some_struct _struct_result; + * temp_fp(&_struct_result, a); + * return _struct_result; + * } + * + * static struct some_struct Pnacl_M14_PPP_SomeWrap_foo2(int32_t a) { + * const struct PPP_SomeWrap_1_0 *iface = + * Pnacl_WrapperInfo_PPP_SomeWrap_1_0.real_iface; + * void (*temp_fp)(struct some_struct* _struct_result, int32_t a) = + * ((void (*)(struct some_struct* _struct_result, int32_t a))iface->foo2); + * struct some_struct _struct_result; + * temp_fp(&_struct_result, a); + * return _struct_result; + * } + * + * static int32_t Pnacl_M14_PPP_SomeWrap_foo1(const struct some_struct a[]) { + * const struct PPP_SomeWrap_1_0 *iface = + * Pnacl_WrapperInfo_PPP_SomeWrap_1_0.real_iface; + * int32_t (*temp_fp)(const struct some_struct a[]) = + * ((int32_t (*)(const struct some_struct a[]))iface->foo1); + * return temp_fp(a); + * } + */ +[version=0.0] +interface PPP_SomeWrap { + int32_t foo1([in] some_struct a); + some_struct foo2([in] int32_t a); + + [version=1.0] + int32_t foo1([in] some_struct[] a); + + /* Not generating wrapper interface for PPP_SomeWrap */ + [version=2.0] + int32_t foo1([in] some_struct2 a); + [version=2.0] + void foo2([in] int32_t a); +}; + +[no_interface_string] +interface PPP_NoIFString { + int32_t Dummy([in] some_struct a); +}; + diff --git a/browser/extensions/mortar/ppapi/generators/test_namespace/bar.idl b/browser/extensions/mortar/ppapi/generators/test_namespace/bar.idl new file mode 100644 index 000000000000..0e1d76ba17d7 --- /dev/null +++ b/browser/extensions/mortar/ppapi/generators/test_namespace/bar.idl @@ -0,0 +1,33 @@ +/* Copyright (c) 2011 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* This file tests the namespace functions in the parser. */ + +label Chrome { + M14 = 1.0 +}; + +/* PPAPI ID */ +typedef int32_t PP_Instance; + +/* PPAPI ID */ +typedef int32_t PP_Resource; + +/* Interface test */ +interface PPB_Bar_0_3 { + /* Face create */ + PP_Resource Create( + [in] PP_Instance instance, + [in] PP_Size size, + [in] PP_Bool is_always_opaque); + + /* Returns PP_TRUE if the given resource is a valid Graphics2D, PP_FALSE if it + * is an invalid resource or is a resource of another type. + */ + PP_Bool IsGraphics2D( + [in] PP_Resource resource); +}; + + diff --git a/browser/extensions/mortar/ppapi/generators/test_namespace/foo.idl b/browser/extensions/mortar/ppapi/generators/test_namespace/foo.idl new file mode 100644 index 000000000000..a027b93a9228 --- /dev/null +++ b/browser/extensions/mortar/ppapi/generators/test_namespace/foo.idl @@ -0,0 +1,26 @@ +/* Copyright (c) 2011 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* File Comment */ + +describe { + int32_t; +}; + +/* PPAPI Structure */ +struct PP_Size { + /* This value represents the width of the rectangle. */ + int32_t width; + /* This value represents the height of the rectangle. */ + int32_t height; +}; + +/* PPAPI Enum */ +enum PP_Bool { + /* Decalare False */ + PP_FALSE = 0, + /* Decalare True */ + PP_TRUE = 1 +}; diff --git a/browser/extensions/mortar/ppapi/generators/test_parser/dictionary.idl b/browser/extensions/mortar/ppapi/generators/test_parser/dictionary.idl new file mode 100644 index 000000000000..1035cd1c3553 --- /dev/null +++ b/browser/extensions/mortar/ppapi/generators/test_parser/dictionary.idl @@ -0,0 +1,17 @@ +/* Copyright 2013 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +dictionary MyDict { + /* OK Member(setString) */ + DOMString setString; + /* OK Member(unsetLong) */ + long unsetLong; +}; + +/* FAIL Unexpected "}" after symbol unsetLong. */ +dictionary MyDict { + DOMString setString; + long unsetLong +}; diff --git a/browser/extensions/mortar/ppapi/generators/test_parser/enum.idl b/browser/extensions/mortar/ppapi/generators/test_parser/enum.idl new file mode 100644 index 000000000000..7048d4f562c5 --- /dev/null +++ b/browser/extensions/mortar/ppapi/generators/test_parser/enum.idl @@ -0,0 +1,108 @@ +/* Copyright (c) 2011 The Chromium Authors. All rights reserved. + Use of this source code is governed by a BSD-style license that can be + found in the LICENSE file. */ + +/* This file tests parsing of enumerations under different conditions */ + +/* OK Enum(Es1) */ +enum Es1 { + /* OK EnumItem(E1) */ + E1 = 1, + /* OK EnumItem(E2) */ + E2 = 2 +}; + +/* FAIL Enum missing name. */ +enum { + E3 = 3, + E4 = 4 +}; + +/* OK Enum(Es3) */ +enum Es3 { + E5 = 1 << 1, + E6 = 3 << 2 +}; + +/* FAIL Unexpected empty block. */ +enum Es4 { +}; + +/* OK Enum(Es5) */ +enum Es5 { + /* OK EnumItem(E9) */ + E9 = 9, + /* OK EnumItem(E10) */ + /* FAIL Trailing comma in block. */ + E10 = 10, +}; + +/* FAIL Unexpected trailing comment. */ +enum Es6 { + E5 = 11, + E6 = 12 +} + +/* Bad comment because of Es6 */ +enum Es7 { + E11 = 11 +}; + + +/* OK Enum(Es8) */ +enum Es8 { + /* OK EnumItem(E12) */ + E12 = 12, + /* OK EnumItem(E13) */ + /* FAIL Unexpected value 13.0 after "=". */ + E13 = 13.0, + /* FAIL Unexpected string "hello" after "=". */ + /* OK EnumItem(E14) */ + E14 = "hello", + /* OK EnumItem(E15) */ + E15 = 0x400 +}; + +/* OK Enum(Es9) */ +enum Es9 { + /* OK EnumItem(Es9_1) */ + Es9_1 = 0, + /* OK EnumItem(Es9_2) */ + Es9_2 = Es9_1, + /* OK EnumItem(Es9_3) */ + Es9_3 = Es9_1 << Es9_2, + /* OK EnumItem(Es9_3a) */ + /* FAIL Unexpected symbol Es9_2 after symbol Es9_1. */ + Es9_3a = Es9_1 Es9_2, + /* OK EnumItem(Es9_4) */ + Es9_4 = Es9_1 >> Es9_2, + /* OK EnumItem(Es9_5) */ + Es9_5 = Es9_1 | Es9_2, + /* OK EnumItem(Es9_6) */ + Es9_6 = Es9_1 & Es9_2, + /* OK EnumItem(Es9_7) */ + Es9_7 = Es9_1 ^ Es9_2, + /* OK EnumItem(Es9_8) */ + Es9_8 = Es9_1 + Es9_2, + /* OK EnumItem(Es9_9) */ + Es9_9 = Es9_1 - Es9_2, + /* OK EnumItem(Es9_10) */ + Es9_10 = Es9_1 * Es9_2, + /* OK EnumItem(Es9_11) */ + Es9_11 = Es9_1 / Es9_2, + /* OK EnumItem(Es9_12) */ + Es9_12 = -Es9_1, + /* OK EnumItem(Es9_13) */ + Es9_13 = ~Es9_1, + /* OK EnumItem(Es9_14) */ + Es9_14 = (Es9_1), + /* OK EnumItem(Es9_14a) */ + /* FAIL Unexpected ,. */ + Es9_14a = (Es9_1, + /* OK EnumItem(Es9_15) */ + Es9_15 = (Es9_1 + Es9_2) << Es9_3 + 1, + /* OK EnumItem(Es9_16) */ + Es9_16 = Es9_1 + -Es9_2 +}; + + diff --git a/browser/extensions/mortar/ppapi/generators/test_parser/interface.idl b/browser/extensions/mortar/ppapi/generators/test_parser/interface.idl new file mode 100644 index 000000000000..712027a88d8b --- /dev/null +++ b/browser/extensions/mortar/ppapi/generators/test_parser/interface.idl @@ -0,0 +1,59 @@ +/* Copyright (c) 2011 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* Tests for interface */ + +/* OK Interface(Interface1) */ +interface Interface1 { + /* OK Member(OneParam) */ + PP_Bool OneParam( + /* OK Param(resource) */ + [in] PP_Resource resource); + + /* OK Member(TwoParam) */ + PP_Resource TwoParam( + /* OK Param(instance) */ + [in] PP_Instance instance, + /* OK Param(size) */ + [in] PP_Size size); + + /* OK Member(ThreeParam) */ + PP_Bool ThreeParam( + /* OK Param(graphics_2d) */ + [in] PP_Resource graphics_2d, + /* OK Param(size) */ + [out] PP_Size size, + /* OK Param(is_always_opaque) */ + [out] PP_Bool is_always_opaque); + + /* OK Member(ReturnArray) */ + PP_Resource[] ReturnArray(); +}; + + +/* OK Interface(Interface2) */ +interface Interface2 { + /* OK Member(OneParam) */ + PP_Bool OneParam( + /* OK Param(resource) */ + [in] PP_Resource resource); + + /* OK Member(TwoParam) */ + PP_Resource TwoParam( + /* OK Param(instance) */ + [in] PP_Instance instance, + /* OK Param(size) */ + /* FAIL Missing argument. */ + [in] PP_Size size, ); + + /* OK Member(ThreeParam) */ + PP_Bool ThreeParam( + /* OK Param(graphics_2d) */ + [in] PP_Resource graphics_2d, + /* FAIL Unexpected "," after symbol PP_Size. */ + [out] PP_Size, + /* OK Param(is_always_opaque) */ + [out] PP_Bool is_always_opaque); +}; diff --git a/browser/extensions/mortar/ppapi/generators/test_parser/struct.idl b/browser/extensions/mortar/ppapi/generators/test_parser/struct.idl new file mode 100644 index 000000000000..22fc40ff9a36 --- /dev/null +++ b/browser/extensions/mortar/ppapi/generators/test_parser/struct.idl @@ -0,0 +1,34 @@ +/* Copyright (c) 2011 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* Tests for structures */ + +/* OK Struct(S1) */ +struct S1 { + /* OK Member(Mem1) */ + PP_Bool Mem1; + /* OK Member(Mem2) */ + PP_Resource Mem2; +}; + +typedef int func([in] int x, [in] int y); + +/* OK Struct(S2) */ +struct S2 { + /* OK Member(Mem1) */ + PP_Bool Mem1; + /* OK Member(Mem2) */ + PP_Resource Mem2; + /* OK Member(Mem3) */ + [attr1, attr2] PP_Resource Mem3; + /* OK Member(foo) */ + FuncFoo foo; +}; + +/* FAIL Struct missing name. */ +struct { + PP_Bool Mem1; + PP_Resource Mem2; +}; \ No newline at end of file diff --git a/browser/extensions/mortar/ppapi/generators/test_parser/typedef.idl b/browser/extensions/mortar/ppapi/generators/test_parser/typedef.idl new file mode 100644 index 000000000000..88389cea19ec --- /dev/null +++ b/browser/extensions/mortar/ppapi/generators/test_parser/typedef.idl @@ -0,0 +1,46 @@ +/* Copyright (c) 2011 The Chromium Authors. All rights reserved. + Use of this source code is governed by a BSD-style license that can be + found in the LICENSE file. */ + +/* This file tests parsing of typedefs under different conditions */ + +/* OK Typedef(T1) */ +typedef int32_t T1; + +/* FAIL Unexpected comment after symbol T2. */ +typedef int32_t T2 + +/* OK Typedef(T3) */ +typedef int32_t[] T3; + +/* OK Typedef(T4) */ +typedef int32_t[][4] T4; + +/* FAIL Unexpected "(" after symbol T5. */ +typedef int32_t[4] T5(); + +/* OK Typedef(T6) */ +typedef int32_t T6([in] int32_t x); + +/* OK Typedef(T7) */ +typedef int32_t T7( + /* OK Param(x) */ + [in] int32_t x, + /* OK Param(y) */ + [in] int32_t y); + +/* OK Typedef(T8) */ +typedef T3 T8( + /* OK Param(x) */ + [in] int x, + /* OK Param(y) */ + [in] int y, + /* OK Param(z) */ + /* FAIL Missing argument. */ + [in] int z,); + +/* FAIL Unexpected keyword "enum" after symbol int32_t. */ +typedef int32_t enum; + +/* FAIL Unexpected ";" after symbol foo. */ +typedef foo; diff --git a/browser/extensions/mortar/ppapi/generators/test_thunk/basic_test_types.idl b/browser/extensions/mortar/ppapi/generators/test_thunk/basic_test_types.idl new file mode 100644 index 000000000000..0f424668b0a7 --- /dev/null +++ b/browser/extensions/mortar/ppapi/generators/test_thunk/basic_test_types.idl @@ -0,0 +1,58 @@ +/* Copyright (c) 2011 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/** + * This file defines some basic types for use in testing. + */ + +label Chrome { + M13 = 0.0, + M14 = 1.0, + M15 = 2.0 +}; + +[version=0.0] +describe { + /** Standard Ints. */ + int8_t; + int16_t; + int32_t; + int64_t; + uint8_t; + uint16_t; + uint32_t; + uint64_t; + /** Small and large floats. */ + double_t; + float_t; + + /** Native file handle (int). */ + handle_t; + + /** Interface object (void *). */ + interface_t; + + /** Used for padding, should be (u)int8_t */ + char; + + /** Pointer to memory (void *). */ + mem_t; + + /** Pointer to null terminated string (char *). */ + str_t; + + /** No return value. */ + void; + + /** Pointer to pointer to memory (void **). */ + blob_t; + + /** Pepper types */ + PP_Bool; + PP_Instance; + PP_Resource; + PP_Var; +}; + diff --git a/browser/extensions/mortar/ppapi/generators/test_thunk/simple.idl b/browser/extensions/mortar/ppapi/generators/test_thunk/simple.idl new file mode 100644 index 000000000000..c4ce7b9f4a99 --- /dev/null +++ b/browser/extensions/mortar/ppapi/generators/test_thunk/simple.idl @@ -0,0 +1,39 @@ +/* Copyright (c) 2012 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +[generate_thunk] + +/** + * This file defines the PPB_Simple interface. + */ + +label Chrome { + M13 = 0.5, + M14 = 1.0, + M15 = 1.5 +}; + +interface PPB_Simple { + PP_Resource Create([in] PP_Instance instance); + + PP_Bool IsSimple([in] PP_Resource resource); + + [deprecate=1.0] + void PostMessage([in] PP_Instance instance, [in] PP_Var message); + + uint32_t DoUint32Instance([in] PP_Instance instance); + + [version=1.5] + uint32_t DoUint32Instance([in] PP_Instance instance, + [in] PP_Resource resource); + + uint32_t DoUint32Resource([in] PP_Resource instance); + + [report_errors=False] + uint32_t DoUint32ResourceNoErrors([in] PP_Resource instance); + + [version=1.0, on_failure="12"] + int32_t OnFailure12([in] PP_Instance instance); +}; diff --git a/browser/extensions/mortar/ppapi/generators/test_thunk/simple_thunk.cc b/browser/extensions/mortar/ppapi/generators/test_thunk/simple_thunk.cc new file mode 100644 index 000000000000..8fc2ba26aba2 --- /dev/null +++ b/browser/extensions/mortar/ppapi/generators/test_thunk/simple_thunk.cc @@ -0,0 +1,125 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// From ../test_thunk/simple.idl modified Fri Nov 16 11:26:06 2012. + +#include "ppapi/c/../test_thunk/simple.h" +#include "ppapi/c/pp_errors.h" +#include "ppapi/shared_impl/tracked_callback.h" +#include "ppapi/thunk/enter.h" +#include "ppapi/thunk/ppb_instance_api.h" +#include "ppapi/thunk/resource_creation_api.h" +#include "ppapi/thunk/simple_api.h" +#include "ppapi/thunk/thunk.h" + +namespace ppapi { +namespace thunk { + +namespace { + +PP_Resource Create(PP_Instance instance) { + VLOG(4) << "PPB_Simple::Create()"; + EnterResourceCreation enter(instance); + if (enter.failed()) + return 0; + return enter.functions()->CreateSimple(instance); +} + +PP_Bool IsSimple(PP_Resource resource) { + VLOG(4) << "PPB_Simple::IsSimple()"; + EnterResource enter(resource, false); + return PP_FromBool(enter.succeeded()); +} + +void PostMessage(PP_Instance instance, PP_Var message) { + VLOG(4) << "PPB_Simple::PostMessage()"; + EnterInstance enter(instance); + if (enter.failed()) + return; + enter.functions()->PostMessage(instance, message); +} + +uint32_t DoUint32Instance_0_5(PP_Instance instance) { + VLOG(4) << "PPB_Simple::DoUint32Instance()"; + EnterInstance enter(instance); + if (enter.failed()) + return 0; + return enter.functions()->DoUint32Instance0_5(instance); +} + +uint32_t DoUint32Instance(PP_Instance instance, PP_Resource resource) { + VLOG(4) << "PPB_Simple::DoUint32Instance()"; + EnterInstance enter(instance); + if (enter.failed()) + return 0; + return enter.functions()->DoUint32Instance(instance, resource); +} + +uint32_t DoUint32Resource(PP_Resource instance) { + VLOG(4) << "PPB_Simple::DoUint32Resource()"; + EnterResource enter(instance, true); + if (enter.failed()) + return 0; + return enter.object()->DoUint32Resource(); +} + +uint32_t DoUint32ResourceNoErrors(PP_Resource instance) { + VLOG(4) << "PPB_Simple::DoUint32ResourceNoErrors()"; + EnterResource enter(instance, false); + if (enter.failed()) + return 0; + return enter.object()->DoUint32ResourceNoErrors(); +} + +int32_t OnFailure12(PP_Instance instance) { + VLOG(4) << "PPB_Simple::OnFailure12()"; + EnterInstance enter(instance); + if (enter.failed()) + return 12; + return enter.functions()->OnFailure12(instance); +} + +const PPB_Simple_0_5 g_ppb_simple_thunk_0_5 = { + &Create, + &IsSimple, + &PostMessage, + &DoUint32Instance_0_5, + &DoUint32Resource, + &DoUint32ResourceNoErrors +}; + +const PPB_Simple_1_0 g_ppb_simple_thunk_1_0 = { + &Create, + &IsSimple, + &DoUint32Instance_0_5, + &DoUint32Resource, + &DoUint32ResourceNoErrors, + &OnFailure12 +}; + +const PPB_Simple_1_5 g_ppb_simple_thunk_1_5 = { + &Create, + &IsSimple, + &DoUint32Instance, + &DoUint32Resource, + &DoUint32ResourceNoErrors, + &OnFailure12 +}; + +} // namespace + +const PPB_Simple_0_5* GetPPB_Simple_0_5_Thunk() { + return &g_ppb_simple_thunk_0_5; +} + +const PPB_Simple_1_0* GetPPB_Simple_1_0_Thunk() { + return &g_ppb_simple_thunk_1_0; +} + +const PPB_Simple_1_5* GetPPB_Simple_1_5_Thunk() { + return &g_ppb_simple_thunk_1_5; +} + +} // namespace thunk +} // namespace ppapi diff --git a/browser/extensions/mortar/ppapi/generators/test_version/versions.idl b/browser/extensions/mortar/ppapi/generators/test_version/versions.idl new file mode 100644 index 000000000000..4d1a42fc13d2 --- /dev/null +++ b/browser/extensions/mortar/ppapi/generators/test_version/versions.idl @@ -0,0 +1,66 @@ +/* Copyright (c) 2011 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* File Comment. */ + +label Chrome { + M13 = 0.0, + M14 = 1.0, + M15 = 2.0 +}; + +describe { + int32_t; +}; + +/*REL: M13 M15 */ +[version=0.0] +interface iFoo { + /** + * Comment for function x + */ + [version=0.0] int32_t Bar([in] int32_t x); + /** + * Comment for function x,y,z + */ + [version=2.0] int32_t Bar([in] int32_t x, [in] int32_t y, [in] int32_t z); +}; + + +/*REL: M13 M15 */ +[version=0.0] +struct iBar { + /** + * Comment for function x + */ + [version=0.0] iFoo x; +}; + +/*REL: M13 M14 M15 */ +[version=0.0] +struct iX { + /** + * Comment for function x + */ + [version=0.0] iFoo x; + /** + * Comment for member y + */ + [version=1.0] int32_t y; +}; + + +/** + * Typedef to generate M13-M14, M15 + */ +typedef int32_t callback_t([in] int32_t x, [in, version=2.0] int32_t y); + +/*REL: M13 M14 M15 */ +interface iFooX { + /** + * Comment for function Bar + */ + int32_t Bar([in, version=1.0] callback_t cb); +}; \ No newline at end of file diff --git a/browser/extensions/mortar/ppapi/out/rpc.cc b/browser/extensions/mortar/ppapi/out/rpc.cc new file mode 100644 index 000000000000..62f11010114d --- /dev/null +++ b/browser/extensions/mortar/ppapi/out/rpc.cc @@ -0,0 +1,61332 @@ +/* + * DO NOT EDIT. THIS FILE IS GENERATED. + */ + +/* pp_macros.idl */ + +/* + * @addtogroup PP + * @{ + */ + +/* Use PP_INLINE to tell the compiler to inline functions. The main purpose of + * inline functions in ppapi is to allow us to define convenience functions in + * the ppapi header files, without requiring clients or implementers to link a + * PPAPI C library. The "inline" keyword is not supported by pre-C99 C + * compilers (such as MS Visual Studio 2008 and older versions of GCC). MSVS + * supports __forceinline and GCC supports __inline__. Use of the static + * keyword ensures (in C) that the function is not compiled on its own, which + * could cause multiple definition errors. + * http://msdn.microsoft.com/en-us/library/z8y1yy88.aspx + * http://gcc.gnu.org/onlinedocs/gcc/Inline.html + */ +#if defined(__cplusplus) +/* The inline keyword is part of C++ and guarantees we won't get multiple + * definition errors. + */ +# define PP_INLINE inline +#else +# if defined(_MSC_VER) +# define PP_INLINE static __forceinline +# else +# define PP_INLINE static __inline__ +# endif +#endif + +/* This is a compile-time assertion useful for ensuring that a given type is + a given number of bytes wide. The size of the array is designed to be 1 + (which should always be valid) if the enum's size is SIZE, and otherwise the + size of the array will be -1 (which all/most compilers should flag as an + error). This is wrapped inside a struct, because if it is a simple global + we get multiple definition errors at link time. + + NAME is the name of the type without any spaces or the struct or enum + keywords. + + CTYPENAME is the typename required by C. I.e., for a struct or enum, the + appropriate keyword must be included. + + SIZE is the expected size in bytes. + */ +#define PP_COMPILE_ASSERT_SIZE_IN_BYTES_IMPL(NAME, CTYPENAME, SIZE) \ +struct PP_Dummy_Struct_For_##NAME { \ +char _COMPILE_ASSERT_FAILED_The_type_named_ \ +## NAME ## _is_not_ ## SIZE ## \ +_bytes_wide[(sizeof(CTYPENAME) == SIZE) ? 1 : -1]; } + +/* PP_COMPILE_ASSERT_SIZE_IN_BYTES is for typenames that contain no spaces. + E.g.: + PP_COMPILE_ASSERT_SIZE_IN_BYTES(int, 4); + typedef struct { int a; } Foo; + PP_COMPILE_ASSERT_SIZE_IN_BYTES(Foo, 4); + */ +#define PP_COMPILE_ASSERT_SIZE_IN_BYTES(NAME, SIZE) \ +PP_COMPILE_ASSERT_SIZE_IN_BYTES_IMPL(NAME, NAME, SIZE) + +/* PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES is for typenames that contain 'struct' + in C. That is, struct names that are not typedefs. + E.g.: + struct Foo { int a; }; + PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(Foo, 4); + */ +#define PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(NAME, SIZE) \ +PP_COMPILE_ASSERT_SIZE_IN_BYTES_IMPL(NAME, struct NAME, SIZE) + +/* PP_COMPILE_ASSERT_ENUM_SIZE_IN_BYTES is for typenames that contain 'enum' + in C. That is, enum names that are not typedefs. + E.g.: + enum Bar { A = 0, B = 1 }; + PP_COMPILE_ASSERT_ENUM_SIZE_IN_BYTES(Foo, 4); + */ +#define PP_COMPILE_ASSERT_ENUM_SIZE_IN_BYTES(NAME, SIZE) \ +PP_COMPILE_ASSERT_SIZE_IN_BYTES_IMPL(NAME, enum NAME, SIZE) + +/** + * @} + * End of addtogroup PP + */ + +/* pp_stdint.idl */ + +/** + * + * @addtogroup Typedefs + * @{ + */ +#if defined(_MSC_VER) + +/** This value represents a guaranteed unsigned 8 bit integer. */ +typedef unsigned char uint8_t; + +/** This value represents a guaranteed signed 8 bit integer. */ +typedef signed char int8_t; + +/** This value represents a guaranteed unsigned 16 bit short. */ +typedef unsigned short uint16_t; + +/** This value represents a guaranteed signed 16 bit short. */ +typedef short int16_t; + +/** This value represents a guaranteed unsigned 32 bit integer. */ +typedef unsigned int uint32_t; + +/** This value represents a guaranteed signed 32 bit integer. */ +typedef int int32_t; + +/** This value represents a guaranteed signed 64 bit integer. */ +typedef __int64 int64_t; + +/** This value represents a guaranteed unsigned 64 bit integer. */ +typedef unsigned __int64 uint64_t; + +#else +#include +#endif +/** + * @} + */ + +/* pp_array_output.idl */ +/** + * @addtogroup Typedefs + * @{ + */ +typedef void* (*PP_ArrayOutput_GetDataBuffer)(void* user_data, + uint32_t element_count, + uint32_t element_size); +/** + * @} + */ + +/** + * @addtogroup Structs + * @{ + */ +/** + * A structure that defines a way for the browser to return arrays of data + * to the plugin. The browser can not allocate memory on behalf of the plugin + * because the plugin and browser may have different allocators. + * + * Array output works by having the browser call to the plugin to allocate a + * buffer, and then the browser will copy the contents of the array into that + * buffer. + * + * In C, you would typically implement this as follows: + * + * @code + * struct MyArrayOutput { + * void* data; + * int element_count; + * }; + * void* MyGetDataBuffer(void* user_data, uint32_t count, uint32_t size) { + * MyArrayOutput* output = (MyArrayOutput*)user_data; + * output->element_count = count; + * if (size) { + * output->data = malloc(count * size); + * if (!output->data) // Be careful to set size properly on malloc failure. + * output->element_count = 0; + * } else { + * output->data = NULL; + * } + * return output->data; + * } + * void MyFunction() { + * MyArrayOutput array = { NULL, 0 }; + * PP_ArrayOutput output = { &MyGetDataBuffer, &array }; + * ppb_foo->GetData(&output); + * } + * @endcode + */ +struct PP_ArrayOutput { + /** + * A pointer to the allocation function that the browser will call. + */ + PP_ArrayOutput_GetDataBuffer GetDataBuffer; + /** + * Data that is passed to the allocation function. Typically, this is used + * to communicate how the data should be stored. + */ + void* user_data; +}; +/** + * @} + */ + +/* pp_bool.idl */ +/** + * @addtogroup Enums + * @{ + */ +/** + * The PP_Bool enum is a boolean value for use in PPAPI C headers. + * The standard bool type is not available to pre-C99 compilers, and is not + * guaranteed to be compatible between C and C++, whereas the PPAPI C headers + * can be included from C or C++ code. + */ +typedef enum { + PP_FALSE = 0, + PP_TRUE = 1 +} PP_Bool; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_Bool, 4); +/** + * @} + */ + +#ifdef __cplusplus +/** + * Converts a C++ "bool" type to a PP_Bool. + * + * @param[in] b A C++ "bool" type. + * + * @return A PP_Bool. + */ +inline PP_Bool PP_FromBool(bool b) { + return b ? PP_TRUE : PP_FALSE; +} + +/** + * Converts a PP_Bool to a C++ "bool" type. + * + * @param[in] b A PP_Bool. + * + * @return A C++ "bool" type. + */ +inline bool PP_ToBool(PP_Bool b) { + return (b != PP_FALSE); +} + +#endif /* __cplusplus */ + +/* pp_point.idl */ +/** + * @addtogroup Structs + * @{ + */ +/** + * The PP_Point structure defines the integer x and y coordinates of a point. + */ +struct PP_Point { + /** + * This value represents the horizontal coordinate of a point, starting with 0 + * as the left-most coordinate. + */ + int32_t x; + /** + * This value represents the vertical coordinate of a point, starting with 0 + * as the top-most coordinate. + */ + int32_t y; +}; +PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_Point, 8); + +/** + * The PP_FloatPoint structure defines the floating-point x and y coordinates + * of a point. + */ +struct PP_FloatPoint { + float x; + float y; +}; +PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_FloatPoint, 8); +/** + * @} + */ + +/** + * @addtogroup Functions + * @{ + */ + +/** + * PP_MakePoint() creates a PP_Point given the x and y coordinates + * as int32_t values. + * + * @param[in] x An int32_t value representing a horizontal coordinate of a + * point, starting with 0 as the left-most coordinate. + * @param[in] y An int32_t value representing a vertical coordinate of a point, + * starting with 0 as the top-most coordinate. + * + * @return A PP_Point structure. + */ +PP_INLINE struct PP_Point PP_MakePoint(int32_t x, int32_t y) { + struct PP_Point ret; + ret.x = x; + ret.y = y; + return ret; +} + +PP_INLINE struct PP_FloatPoint PP_MakeFloatPoint(float x, float y) { + struct PP_FloatPoint ret; + ret.x = x; + ret.y = y; + return ret; +} +/** + * @} + */ + +/* pp_size.idl */ +/** + * @addtogroup Structs + * @{ + */ +/** + * The PP_Size struct contains the size of a 2D rectangle. + */ +struct PP_Size { + /** This value represents the width of the rectangle. */ + int32_t width; + /** This value represents the height of the rectangle. */ + int32_t height; +}; +PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_Size, 8); + +/** + * The PP_FloatSize struct contains the size of a 2D rectangle. + */ +struct PP_FloatSize { + /** This value represents the width of the rectangle. */ + float width; + /** This value represents the height of the rectangle. */ + float height; +}; +/** + * @} + */ + +/** + * @addtogroup Functions + * @{ + */ + +/** + * PP_MakeSize() creates a PP_Size given a width and height as + * int32_t values. + * + * @param[in] w An int32_t value representing a width. + * @param[in] h An int32_t value representing a height. + * + * @return A PP_Size structure. + */ +PP_INLINE struct PP_Size PP_MakeSize(int32_t w, int32_t h) { + struct PP_Size ret; + ret.width = w; + ret.height = h; + return ret; +} + +/** + * PP_MakeFloatSize() creates a PP_FloatSize given a + * width and height as float values. + * + * @param[in] w An float value representing a width. + * @param[in] h An float value representing a height. + * + * @return A PP_FloatSize structure. + */ +PP_INLINE struct PP_FloatSize PP_MakeFloatSize(float w, float h) { + struct PP_FloatSize ret; + ret.width = w; + ret.height = h; + return ret; +} +/** + * @} + */ +/* pp_rect.idl */ +/** + * @addtogroup Structs + * @{ + */ +/** + * The PP_Rect struct contains the size and location of a 2D + * rectangle. + */ +struct PP_Rect { + /** + * This value represents the x and y coordinates of the upper-left corner of + * the rectangle. + */ + struct PP_Point point; + /** This value represents the width and height of the rectangle. */ + struct PP_Size size; +}; +PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_Rect, 16); + +/** + * The PP_FloatRect struct contains the size and location of a 2D + * rectangle. + */ +struct PP_FloatRect { + /** + * This value represents the x and y coordinates of the upper-left corner of + * the rectangle. + */ + struct PP_FloatPoint point; + /** This value represents the width and height of the rectangle. */ + struct PP_FloatSize size; +}; +/** + * @} + */ + + +/** + * @addtogroup Functions + * @{ + */ + +/** + * PP_MakeRectFromXYWH() creates a PP_Rect given x and y + * coordinates and width and height dimensions as int32_t values. + * + * @param[in] x An int32_t value representing a horizontal coordinate of a + * point, starting with 0 as the left-most coordinate. + * @param[in] y An int32_t value representing a vertical coordinate of a point, + * starting with 0 as the top-most coordinate. + * @param[in] w An int32_t value representing a width. + * @param[in] h An int32_t value representing a height. + * + * @return A PP_Rect structure. + */ +PP_INLINE struct PP_Rect PP_MakeRectFromXYWH(int32_t x, int32_t y, + int32_t w, int32_t h) { + struct PP_Rect ret; + ret.point.x = x; + ret.point.y = y; + ret.size.width = w; + ret.size.height = h; + return ret; +} + +/** + * PP_MakeFloatRectFromXYWH() creates a PP_FloatRect given x and y + * coordinates and width and height dimensions as float values. + * + * @param[in] x An float value representing a horizontal coordinate of a + * point, starting with 0 as the left-most coordinate. + * @param[in] y An float value representing a vertical coordinate of a point, + * starting with 0 as the top-most coordinate. + * @param[in] w An float value representing a width. + * @param[in] h An float value representing a height. + * + * @return A PP_FloatRect structure. + */ +PP_INLINE struct PP_FloatRect PP_MakeFloatRectFromXYWH(float x, float y, + float w, float h) { + struct PP_FloatRect ret; + ret.point.x = x; + ret.point.y = y; + ret.size.width = w; + ret.size.height = h; + return ret; +} + +/** + * @} + */ + +/* pp_codecs.idl */ +/** + * @addtogroup Enums + * @{ + */ +typedef enum { + PP_VIDEOPROFILE_H264BASELINE = 0, + PP_VIDEOPROFILE_H264MAIN = 1, + PP_VIDEOPROFILE_H264EXTENDED = 2, + PP_VIDEOPROFILE_H264HIGH = 3, + PP_VIDEOPROFILE_H264HIGH10PROFILE = 4, + PP_VIDEOPROFILE_H264HIGH422PROFILE = 5, + PP_VIDEOPROFILE_H264HIGH444PREDICTIVEPROFILE = 6, + PP_VIDEOPROFILE_H264SCALABLEBASELINE = 7, + PP_VIDEOPROFILE_H264SCALABLEHIGH = 8, + PP_VIDEOPROFILE_H264STEREOHIGH = 9, + PP_VIDEOPROFILE_H264MULTIVIEWHIGH = 10, + PP_VIDEOPROFILE_VP8_ANY = 11, + PP_VIDEOPROFILE_VP9_ANY = 12, + PP_VIDEOPROFILE_MAX = PP_VIDEOPROFILE_VP9_ANY +} PP_VideoProfile; + +/** + * Audio profiles. + */ +typedef enum { + PP_AUDIOPROFILE_OPUS = 0, + PP_AUDIOPROFILE_MAX = PP_AUDIOPROFILE_OPUS +} PP_AudioProfile; + +/** + * Hardware acceleration options. + */ +typedef enum { + /** Create a hardware accelerated resource only. */ + PP_HARDWAREACCELERATION_ONLY = 0, + /** + * Create a hardware accelerated resource if possible. Otherwise, fall back + * to the software implementation. + */ + PP_HARDWAREACCELERATION_WITHFALLBACK = 1, + /** Create the software implementation only. */ + PP_HARDWAREACCELERATION_NONE = 2, + PP_HARDWAREACCELERATION_LAST = PP_HARDWAREACCELERATION_NONE +} PP_HardwareAcceleration; +/** + * @} + */ + +/** + * @addtogroup Structs + * @{ + */ +/** + * Struct describing a decoded video picture. The decoded picture data is stored + * in the GL texture corresponding to |texture_id|. The plugin can determine + * which Decode call generated the picture using |decode_id|. + */ +struct PP_VideoPicture { + /** + * |decode_id| parameter of the Decode call which generated this picture. + * See the PPB_VideoDecoder function Decode() for more details. + */ + uint32_t decode_id; + /** + * Texture ID in the plugin's GL context. The plugin can use this to render + * the decoded picture. + */ + uint32_t texture_id; + /** + * The GL texture target for the decoded picture. Possible values are: + * GL_TEXTURE_2D + * GL_TEXTURE_RECTANGLE_ARB + * GL_TEXTURE_EXTERNAL_OES + * + * The pixel format of the texture is GL_RGBA. + */ + uint32_t texture_target; + /** + * Dimensions of the texture holding the decoded picture. + */ + struct PP_Size texture_size; + /** + * The visible subrectangle of the picture. The plugin should display only + * this part of the picture. + */ + struct PP_Rect visible_rect; +}; + +/** + * Struct describing a decoded video picture. The decoded picture data is stored + * in the GL texture corresponding to |texture_id|. The plugin can determine + * which Decode call generated the picture using |decode_id|. + */ +struct PP_VideoPicture_0_1 { + /** + * |decode_id| parameter of the Decode call which generated this picture. + * See the PPB_VideoDecoder function Decode() for more details. + */ + uint32_t decode_id; + /** + * Texture ID in the plugin's GL context. The plugin can use this to render + * the decoded picture. + */ + uint32_t texture_id; + /** + * The GL texture target for the decoded picture. Possible values are: + * GL_TEXTURE_2D + * GL_TEXTURE_RECTANGLE_ARB + * GL_TEXTURE_EXTERNAL_OES + * + * The pixel format of the texture is GL_RGBA. + */ + uint32_t texture_target; + /** + * Dimensions of the texture holding the decoded picture. + */ + struct PP_Size texture_size; +}; + +/** + * Supported video profile information. See the PPB_VideoEncoder function + * GetSupportedProfiles() for more details. + */ +struct PP_VideoProfileDescription { + /** + * The codec profile. + */ + PP_VideoProfile profile; + /** + * Dimensions of the maximum resolution of video frames, in pixels. + */ + struct PP_Size max_resolution; + /** + * The numerator of the maximum frame rate. + */ + uint32_t max_framerate_numerator; + /** + * The denominator of the maximum frame rate. + */ + uint32_t max_framerate_denominator; + /** + * Whether the profile is hardware accelerated. + */ + PP_Bool hardware_accelerated; +}; + +/** + * Supported video profile information. See the PPB_VideoEncoder function + * GetSupportedProfiles() for more details. + */ +struct PP_VideoProfileDescription_0_1 { + /** + * The codec profile. + */ + PP_VideoProfile profile; + /** + * Dimensions of the maximum resolution of video frames, in pixels. + */ + struct PP_Size max_resolution; + /** + * The numerator of the maximum frame rate. + */ + uint32_t max_framerate_numerator; + /** + * The denominator of the maximum frame rate. + */ + uint32_t max_framerate_denominator; + /** + * A value indicating if the profile is available in hardware, software, or + * both. + */ + PP_HardwareAcceleration acceleration; +}; + +/** + * Supported audio profile information. See the PPB_AudioEncoder function + * GetSupportedProfiles() for more details. + */ +struct PP_AudioProfileDescription { + /** + * The codec profile. + */ + PP_AudioProfile profile; + /** + * Maximum number of channels that can be encoded. + */ + uint32_t max_channels; + /** + * Sample size. + */ + uint32_t sample_size; + /** + * Sampling rate that can be encoded + */ + uint32_t sample_rate; + /** + * Whether the profile is hardware accelerated. + */ + PP_Bool hardware_accelerated; +}; + +/** + * Struct describing a bitstream buffer. + */ +struct PP_BitstreamBuffer { + /** + * The size, in bytes, of the bitstream data. + */ + uint32_t size; + /** + * The base address of the bitstream data. + */ + void* buffer; + /** + * Whether the buffer represents a key frame. + */ + PP_Bool key_frame; +}; + +/** + * Struct describing an audio bitstream buffer. + */ +struct PP_AudioBitstreamBuffer { + /** + * The size, in bytes, of the bitstream data. + */ + uint32_t size; + /** + * The base address of the bitstream data. + */ + void* buffer; +}; +/** + * @} + */ + +/* pp_completion_callback.idl */ +/** + * @addtogroup Typedefs + * @{ + */ +/** + * This typedef defines the signature that you implement to receive callbacks + * on asynchronous completion of an operation. + * + * @param[in] user_data A pointer to user data passed to a callback function. + * @param[in] result If result is 0 (PP_OK), the operation succeeded. Negative + * values (other than -1 or PP_OK_COMPLETE) indicate error and are specified + * in pp_errors.h. Positive values for result usually indicate success and have + * some operation-dependent meaning (such as bytes read). + */ +typedef void (*PP_CompletionCallback_Func)(void* user_data, int32_t result); +/** + * @} + */ + +/** + * @addtogroup Enums + * @{ + */ +/** + * This enumeration contains flags used to control how non-NULL callbacks are + * scheduled by asynchronous methods. + */ +typedef enum { + /** + * By default any non-NULL callback will always invoked asynchronously, + * on success or error, even if the operation could complete synchronously + * without blocking. + * + * The method taking such callback will always return PP_OK_COMPLETIONPENDING. + * The callback will be invoked on the same thread on which the method was + * invoked. + * + * NOTE: If the method taking the callback is invoked on a background + * thread that has no valid PPB_MessageLoop resource attached, the system has + * no way to run the callback on the correct thread. In this case, a log + * message will be emitted and the plugin will be made to crash. + */ + PP_COMPLETIONCALLBACK_FLAG_NONE = 0 << 0, + /** + * This flag allows any method taking such callback to complete synchronously + * and not call the callback if the operation would not block. This is useful + * when performance is an issue, and the operation bandwidth should not be + * limited to the processing speed of the message loop. + * + * On synchronous method completion, the completion result will be returned + * by the method itself. Otherwise, the method will return + * PP_OK_COMPLETIONPENDING, and the callback will be invoked asynchronously on + * the same thread on which the method was invoked. If there is no valid + * PPB_MessageLoop attached to that thread, and the callback would normally + * run asynchronously, the invoked method will return + * PP_ERROR_NO_MESSAGE_LOOP. + */ + PP_COMPLETIONCALLBACK_FLAG_OPTIONAL = 1 << 0 +} PP_CompletionCallback_Flag; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_CompletionCallback_Flag, 4); +/** + * @} + */ + +/** + * @addtogroup Structs + * @{ + */ +/** + * PP_CompletionCallback is a common mechanism for supporting + * potentially asynchronous calls in browser interfaces. Any method that takes a + * PP_CompletionCallback can be used in one of three different + * ways: + * - Required: The callback will always be invoked asynchronously on the + * thread where the associated PPB method was invoked. The method + * will always return PP_OK_COMPLETIONPENDING when a required + * callback, and the callback will be invoked later (barring + * system or thread shutdown; see PPB_MessageLoop for details). + * Required callbacks are the default. + *

+ * NOTE: If you use a required callback on a background thread, + * you must have created and attached a PPB_MessageLoop. + * Otherwise, the system can not run your callback on that thread, + * and will instead emit a log message and crash your plugin to + * make the problem more obvious. + * + * - Optional: The callback may be invoked asynchronously, or the PPB method + * may complete synchronously if it can do so without blocking. + * If the method will complete asynchronously, it will return + * PP_OK_COMPLETIONPENDING. Otherwise, it will complete + * synchronously and return an appropriate code (see below for + * more information on the return code). Optional callbacks are + * generally more difficult to use correctly than Required + * callbacks, but can provide better performance for some APIs + * (especially APIs with buffered reads, such as PPB_URLLoader or + * PPB_FileIO). + *

+ * NOTE: If you use an optional callback on a background thread, + * and you have not created and attached a PPB_MessageLoop, then + * the method you invoke will fail without running and return + * PP_ERROR_NO_MESSAGE_LOOP. + * + * - Blocking: In this case, the callback's function pointer is NULL, and the + * invoked method must complete synchronously. The method will + * run to completion and return an appropriate code when finished + * (see below for more information). Blocking completion + * callbacks are only supported on background threads. + *

+ * PP_BlockUntilComplete() provides a convenient way + * to specify blocking behavior. Refer to + * PP_BlockUntilComplete for more information. + * + * When the callback is run asynchronously, the result parameter passed to + * func is an int32_t that, if negative indicates an error code + * whose meaning is specific to the calling method (refer to + * pp_error.h for further information). A positive or 0 value is a + * return result indicating success whose meaning depends on the calling method + * (e.g. number of bytes read). + */ +struct PP_CompletionCallback { + /** + * This value is a callback function that will be called, or NULL if this is + * a blocking completion callback. + */ + PP_CompletionCallback_Func func; + /** + * This value is a pointer to user data passed to a callback function. + */ + void* user_data; + /** + * Flags used to control how non-NULL callbacks are scheduled by + * asynchronous methods. + */ + int32_t flags; +}; +/** + * @} + */ + +#include + +/** + * @addtogroup Functions + * @{ + */ +/** + * PP_MakeCompletionCallback() is used to create a + * PP_CompletionCallback. + * + * Example, creating a Required callback: + * + * @code + * struct PP_CompletionCallback cc = PP_MakeCompletionCallback(Foo, NULL); + * @endcode + * + * Example, creating an Optional callback: + * + * @code + * struct PP_CompletionCallback cc = PP_MakeCompletionCallback(Foo, NULL); + * cc.flags = cc.flags | PP_COMPLETIONCALLBACK_FLAG_OPTIONAL; + * @endcode + * + * @param[in] func A PP_CompletionCallback_Func that will be + * called. + * @param[in] user_data A pointer to user data passed to your callback + * function. This is optional and is typically used to help track state + * when you may have multiple callbacks pending. + * + * @return A PP_CompletionCallback structure. + */ +PP_INLINE struct PP_CompletionCallback PP_MakeCompletionCallback( + PP_CompletionCallback_Func func, + void* user_data) { + struct PP_CompletionCallback cc; + cc.func = func; + cc.user_data = user_data; + cc.flags = PP_COMPLETIONCALLBACK_FLAG_NONE; + return cc; +} + +/** + * PP_MakeOptionalCompletionCallback() is used to create a PP_CompletionCallback + * with PP_COMPLETIONCALLBACK_FLAG_OPTIONAL set. + * + * @param[in] func A PP_CompletionCallback_Func to be called on completion. + * @param[in] user_data A pointer to user data passed to be passed to the + * callback function. This is optional and is typically used to help track state + * in case of multiple pending callbacks. + * + * @return A PP_CompletionCallback structure. + */ +PP_INLINE struct PP_CompletionCallback PP_MakeOptionalCompletionCallback( + PP_CompletionCallback_Func func, + void* user_data) { + struct PP_CompletionCallback cc = PP_MakeCompletionCallback(func, user_data); + cc.flags = cc.flags | PP_COMPLETIONCALLBACK_FLAG_OPTIONAL; + return cc; +} +/** + * @} + */ + +/** + * @addtogroup Functions + * @{ + */ + +/** + * PP_RunCompletionCallback() is used to run a callback. It invokes + * the callback function passing it user data specified on creation and + * completion |result|. + * + * @param[in] cc A pointer to a PP_CompletionCallback that will be + * run. + * @param[in] result The result of the operation. Non-positive values correspond + * to the error codes from pp_errors.h (excluding PP_OK_COMPLETIONPENDING). + * Positive values indicate additional information such as bytes read. + */ +PP_INLINE void PP_RunCompletionCallback(struct PP_CompletionCallback* cc, + int32_t result) { + cc->func(cc->user_data, result); +} + +/** + * @} + */ + +/** + * @addtogroup Functions + * @{ + */ + + /** + * PP_BlockUntilComplete() is used in place of an actual completion callback + * to request blocking behavior. If specified, the calling thread will block + * until the function completes. Blocking completion callbacks are only allowed + * from background threads. + * + * @return A PP_CompletionCallback structure. + */ +PP_INLINE struct PP_CompletionCallback PP_BlockUntilComplete(void) { + return PP_MakeCompletionCallback(NULL, NULL); +} + +/** + * PP_RunAndClearCompletionCallback() runs a callback and clears the reference + * to that callback. + * + * This function is used when the null-ness of a completion callback is used as + * a signal for whether a completion callback has been registered. In this + * case, after the execution of the callback, it should be cleared. However, + * this introduces a conflict if the completion callback wants to schedule more + * work that involves the same completion callback again (for example, when + * reading data from an URLLoader, one would typically queue up another read + * callback). As a result, this function clears the pointer + * before the provided callback is executed. + */ +PP_INLINE void PP_RunAndClearCompletionCallback( + struct PP_CompletionCallback* cc, + int32_t res) { + struct PP_CompletionCallback temp = *cc; + *cc = PP_BlockUntilComplete(); + PP_RunCompletionCallback(&temp, res); +} +/** + * @} + */ + +/* pp_time.idl */ +/** + * @addtogroup Typedefs + * @{ + */ +/** + * The PP_Time type represents the "wall clock time" according + * to the browser and is defined as the number of seconds since the Epoch + * (00:00:00 UTC, January 1, 1970). + */ +typedef double PP_Time; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_Time, 8); + +/** + * A PP_TimeTicks value represents time ticks which are measured + * in seconds and are used for indicating the time that certain messages were + * received. In contrast to PP_Time, PP_TimeTicks + * does not correspond to any actual wall clock time and will not change + * discontinuously if the user changes their computer clock. + * + * The units are in seconds, but are not measured relative to any particular + * epoch, so the most you can do is compare two values. + */ +typedef double PP_TimeTicks; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_TimeTicks, 8); + +/** + * A PP_TimeDelta value represents a duration of time which is + * measured in seconds. + */ +typedef double PP_TimeDelta; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_TimeDelta, 8); +/** + * @} + */ + +/* pp_file_info.idl */ +/** + * @addtogroup Enums + * @{ + */ +/** + * The PP_FileType enum contains file type constants. + */ +typedef enum { + /** A regular file type */ + PP_FILETYPE_REGULAR = 0, + /** A directory */ + PP_FILETYPE_DIRECTORY = 1, + /** A catch-all for unidentified types */ + PP_FILETYPE_OTHER = 2 +} PP_FileType; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_FileType, 4); + +/** + * The PP_FileSystemType enum contains file system type constants. + */ +typedef enum { + /** For identified invalid return values */ + PP_FILESYSTEMTYPE_INVALID = 0, + /** For external file system types */ + PP_FILESYSTEMTYPE_EXTERNAL = 1, + /** For local persistent file system types */ + PP_FILESYSTEMTYPE_LOCALPERSISTENT = 2, + /** For local temporary file system types */ + PP_FILESYSTEMTYPE_LOCALTEMPORARY = 3, + /** For isolated file system types */ + PP_FILESYSTEMTYPE_ISOLATED = 4 +} PP_FileSystemType; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_FileSystemType, 4); +/** + * @} + */ + +/** + * @addtogroup Structs + * @{ + */ +/** + * The PP_FileInfo struct represents all information about a file, + * such as size, type, and creation time. + */ +struct PP_FileInfo { + /** This value represents the size of the file measured in bytes */ + int64_t size; + /** + * This value represents the type of file as defined by the + * PP_FileType enum + */ + PP_FileType type; + /** + * This value represents the file system type of the file as defined by the + * PP_FileSystemType enum. + */ + PP_FileSystemType system_type; + /** + * This value represents the creation time of the file. + */ + PP_Time creation_time; + /** + * This value represents the last time the file was accessed. + */ + PP_Time last_access_time; + /** + * This value represents the last time the file was modified. + */ + PP_Time last_modified_time; +}; +PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_FileInfo, 40); +/** + * @} + */ + +/* pp_resource.idl */ +/** + * @addtogroup Typedefs + * @{ + */ +/** + * This typedef represents an opaque handle assigned by the browser to the + * resource. The handle is guaranteed never to be 0 for a valid resource, so a + * module can initialize it to 0 to indicate a "NULL handle." Some interfaces + * may return a NULL resource to indicate failure. + * + * While a Var represents something callable to JS or from the module to + * the DOM, a resource has no meaning or visibility outside of the module + * interface. + * + * Resources are reference counted. Use AddRefResource() + * and ReleaseResource() in ppb_core.h to manage the + * reference count of a resource. The data will be automatically destroyed when + * the internal reference count reaches 0. + */ +typedef int32_t PP_Resource; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_Resource, 4); +/** + * @} + */ + +/* pp_directory_entry.idl */ +/** + * @addtogroup Structs + * @{ + */ +struct PP_DirectoryEntry { + PP_Resource file_ref; + PP_FileType file_type; +}; +PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_DirectoryEntry, 8); +/** + * @} + */ + +/* pp_errors.idl */ +/** + * @addtogroup Enums + * @{ + */ +/** + * This enumeration contains enumerators of all PPAPI error codes. + * + * Errors are negative valued. Callers should treat all negative values as a + * failure, even if it's not in the list, since the possible errors are likely + * to expand and change over time. + */ +enum { + /** + * This value is returned by a function on successful synchronous completion + * or is passed as a result to a PP_CompletionCallback_Func on successful + * asynchronous completion. + */ + PP_OK = 0, + /** + * This value is returned by a function that accepts a PP_CompletionCallback + * and cannot complete synchronously. This code indicates that the given + * callback will be asynchronously notified of the final result once it is + * available. + */ + PP_OK_COMPLETIONPENDING = -1, + /**This value indicates failure for unspecified reasons. */ + PP_ERROR_FAILED = -2, + /** + * This value indicates failure due to an asynchronous operation being + * interrupted. The most common cause of this error code is destroying a + * resource that still has a callback pending. All callbacks are guaranteed + * to execute, so any callbacks pending on a destroyed resource will be + * issued with PP_ERROR_ABORTED. + * + * If you get an aborted notification that you aren't expecting, check to + * make sure that the resource you're using is still in scope. A common + * mistake is to create a resource on the stack, which will destroy the + * resource as soon as the function returns. + */ + PP_ERROR_ABORTED = -3, + /** This value indicates failure due to an invalid argument. */ + PP_ERROR_BADARGUMENT = -4, + /** This value indicates failure due to an invalid PP_Resource. */ + PP_ERROR_BADRESOURCE = -5, + /** This value indicates failure due to an unavailable PPAPI interface. */ + PP_ERROR_NOINTERFACE = -6, + /** This value indicates failure due to insufficient privileges. */ + PP_ERROR_NOACCESS = -7, + /** This value indicates failure due to insufficient memory. */ + PP_ERROR_NOMEMORY = -8, + /** This value indicates failure due to insufficient storage space. */ + PP_ERROR_NOSPACE = -9, + /** This value indicates failure due to insufficient storage quota. */ + PP_ERROR_NOQUOTA = -10, + /** + * This value indicates failure due to an action already being in + * progress. + */ + PP_ERROR_INPROGRESS = -11, + /** + * The requested command is not supported by the browser. + */ + PP_ERROR_NOTSUPPORTED = -12, + /** + * Returned if you try to use a null completion callback to "block until + * complete" on the main thread. Blocking the main thread is not permitted + * to keep the browser responsive (otherwise, you may not be able to handle + * input events, and there are reentrancy and deadlock issues). + */ + PP_ERROR_BLOCKS_MAIN_THREAD = -13, + /** + * This value indicates that the plugin sent bad input data to a resource, + * leaving it in an invalid state. The resource can't be used after returning + * this error and should be released. + */ + PP_ERROR_MALFORMED_INPUT = -14, + /** + * This value indicates that a resource has failed. The resource can't be + * used after returning this error and should be released. + */ + PP_ERROR_RESOURCE_FAILED = -15, + /** This value indicates failure due to a file that does not exist. */ + PP_ERROR_FILENOTFOUND = -20, + /** This value indicates failure due to a file that already exists. */ + PP_ERROR_FILEEXISTS = -21, + /** This value indicates failure due to a file that is too big. */ + PP_ERROR_FILETOOBIG = -22, + /** + * This value indicates failure due to a file having been modified + * unexpectedly. + */ + PP_ERROR_FILECHANGED = -23, + /** This value indicates that the pathname does not reference a file. */ + PP_ERROR_NOTAFILE = -24, + /** This value indicates failure due to a time limit being exceeded. */ + PP_ERROR_TIMEDOUT = -30, + /** + * This value indicates that the user cancelled rather than providing + * expected input. + */ + PP_ERROR_USERCANCEL = -40, + /** + * This value indicates failure due to lack of a user gesture such as a + * mouse click or key input event. Examples of actions requiring a user + * gesture are showing the file chooser dialog and going into fullscreen + * mode. + */ + PP_ERROR_NO_USER_GESTURE = -41, + /** + * This value indicates that the graphics context was lost due to a + * power management event. + */ + PP_ERROR_CONTEXT_LOST = -50, + /** + * Indicates an attempt to make a PPAPI call on a thread without previously + * registering a message loop via PPB_MessageLoop.AttachToCurrentThread. + * Without this registration step, no PPAPI calls are supported. + */ + PP_ERROR_NO_MESSAGE_LOOP = -51, + /** + * Indicates that the requested operation is not permitted on the current + * thread. + */ + PP_ERROR_WRONG_THREAD = -52, + /** + * Indicates that a null completion callback was used on a thread handling a + * blocking message from JavaScript. Null completion callbacks "block until + * complete", which could cause the main JavaScript thread to be blocked + * excessively. + */ + PP_ERROR_WOULD_BLOCK_THREAD = -53, + /** + * This value indicates that the connection was closed. For TCP sockets, it + * corresponds to a TCP FIN. + */ + PP_ERROR_CONNECTION_CLOSED = -100, + /** + * This value indicates that the connection was reset. For TCP sockets, it + * corresponds to a TCP RST. + */ + PP_ERROR_CONNECTION_RESET = -101, + /** + * This value indicates that the connection attempt was refused. + */ + PP_ERROR_CONNECTION_REFUSED = -102, + /** + * This value indicates that the connection was aborted. For TCP sockets, it + * means the connection timed out as a result of not receiving an ACK for data + * sent. This can include a FIN packet that did not get ACK'd. + */ + PP_ERROR_CONNECTION_ABORTED = -103, + /** + * This value indicates that the connection attempt failed. + */ + PP_ERROR_CONNECTION_FAILED = -104, + /** + * This value indicates that the connection attempt timed out. + */ + PP_ERROR_CONNECTION_TIMEDOUT = -105, + /** + * This value indicates that the IP address or port number is invalid. + */ + PP_ERROR_ADDRESS_INVALID = -106, + /** + * This value indicates that the IP address is unreachable. This usually means + * that there is no route to the specified host or network. + */ + PP_ERROR_ADDRESS_UNREACHABLE = -107, + /** + * This value is returned when attempting to bind an address that is already + * in use. + */ + PP_ERROR_ADDRESS_IN_USE = -108, + /** + * This value indicates that the message was too large for the transport. + */ + PP_ERROR_MESSAGE_TOO_BIG = -109, + /** + * This value indicates that the host name could not be resolved. + */ + PP_ERROR_NAME_NOT_RESOLVED = -110 +}; +/** + * @} + */ + +/* pp_graphics_3d.idl */ +/** + * @addtogroup Enums + * @{ + */ +typedef enum { + /** + * Bits of Alpha in the color buffer. + */ + PP_GRAPHICS3DATTRIB_ALPHA_SIZE = 0x3021, + /** + * Bits of Blue in the color buffer. + */ + PP_GRAPHICS3DATTRIB_BLUE_SIZE = 0x3022, + /** + * Bits of Green in the color buffer. + */ + PP_GRAPHICS3DATTRIB_GREEN_SIZE = 0x3023, + /** + * Bits of Red in the color buffer. + */ + PP_GRAPHICS3DATTRIB_RED_SIZE = 0x3024, + /** + * Bits of Z in the depth buffer. + */ + PP_GRAPHICS3DATTRIB_DEPTH_SIZE = 0x3025, + /** + * Bits of Stencil in the stencil buffer. + */ + PP_GRAPHICS3DATTRIB_STENCIL_SIZE = 0x3026, + /** + * Number of samples per pixel. + */ + PP_GRAPHICS3DATTRIB_SAMPLES = 0x3031, + /** + * Number of multisample buffers. + */ + PP_GRAPHICS3DATTRIB_SAMPLE_BUFFERS = 0x3032, + /** + * Attrib list terminator. + */ + PP_GRAPHICS3DATTRIB_NONE = 0x3038, + /** + * Height of surface in pixels. + */ + PP_GRAPHICS3DATTRIB_HEIGHT = 0x3056, + /** + * Width of surface in pixels. + */ + PP_GRAPHICS3DATTRIB_WIDTH = 0x3057, + /** + * Specifies the effect on the color buffer of posting a surface + * with SwapBuffers. The initial value is chosen by the implementation. + */ + PP_GRAPHICS3DATTRIB_SWAP_BEHAVIOR = 0x3093, + /** + * Indicates that color buffer contents are unaffected. + */ + PP_GRAPHICS3DATTRIB_BUFFER_PRESERVED = 0x3094, + /** + * Indicates that color buffer contents may be destroyed or changed. + */ + PP_GRAPHICS3DATTRIB_BUFFER_DESTROYED = 0x3095, + /** + * Specifies whether the context is intended to be low-power or + * high-performance. The initial value is + * PP_GRAPHICS3DATTRIB_GPU_PREFERENCE_PERFORMANCE. + */ + PP_GRAPHICS3DATTRIB_GPU_PREFERENCE = 0x11000, + /** + * The context should be low-power, and may be created on an integrated gpu. + */ + PP_GRAPHICS3DATTRIB_GPU_PREFERENCE_LOW_POWER = 0x11001, + /** + * The context may be high-power and may be created on a discrete gpu. + */ + PP_GRAPHICS3DATTRIB_GPU_PREFERENCE_PERFORMANCE = 0x11002 +} PP_Graphics3DAttrib; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_Graphics3DAttrib, 4); +/** + * @} + */ + +/* pp_var.idl */ +/** + * @addtogroup Enums + * @{ + */ +/** + * The PP_VarType is an enumeration of the different types that + * can be contained within a PP_Var structure. + */ +typedef enum { + /** + * An undefined value. + */ + PP_VARTYPE_UNDEFINED = 0, + /** + * A NULL value. This is similar to undefined, but JavaScript differentiates + * the two so it is exposed here as well. + */ + PP_VARTYPE_NULL = 1, + /** + * A boolean value, use the as_bool member of the var. + */ + PP_VARTYPE_BOOL = 2, + /** + * A 32-bit integer value. Use the as_int member of the var. + */ + PP_VARTYPE_INT32 = 3, + /** + * A double-precision floating point value. Use the as_double + * member of the var. + */ + PP_VARTYPE_DOUBLE = 4, + /** + * The Var represents a string. The as_id field is used to + * identify the string, which may be created and retrieved from the + * PPB_Var interface. These objects are reference counted, so + * AddRef() and Release() must be used properly to avoid memory leaks. + */ + PP_VARTYPE_STRING = 5, + /** + * Represents a JavaScript object. This vartype is not currently usable + * from modules, although it is used internally for some tasks. These objects + * are reference counted, so AddRef() and Release() must be used properly to + * avoid memory leaks. + */ + PP_VARTYPE_OBJECT = 6, + /** + * Represents an array of Vars. The as_id field is used to + * identify the array, which may be created and manipulated from the + * PPB_VarArray interface. These objects are reference counted, + * so AddRef() and Release() must be used properly to avoid memory leaks. + */ + PP_VARTYPE_ARRAY = 7, + /** + * Represents a mapping from strings to Vars. The as_id field is + * used to identify the dictionary, which may be created and manipulated from + * the PPB_VarDictionary interface. These objects are reference + * counted, so AddRef() and Release() must be used properly to avoid memory + * leaks. + */ + PP_VARTYPE_DICTIONARY = 8, + /** + * ArrayBuffer represents a JavaScript ArrayBuffer. This is the type which + * represents Typed Arrays in JavaScript. Unlike JavaScript 'Array', it is + * only meant to contain basic numeric types, and is always stored + * contiguously. See PPB_VarArrayBuffer_Dev for functions special to + * ArrayBuffer vars. These objects are reference counted, so AddRef() and + * Release() must be used properly to avoid memory leaks. + */ + PP_VARTYPE_ARRAY_BUFFER = 9, + /** + * This type allows the PP_Var to wrap a PP_Resource + * . This can be useful for sending or receiving some types of + * PP_Resource using PPB_Messaging or + * PPP_Messaging. + * + * These objects are reference counted, so AddRef() and Release() must be used + * properly to avoid memory leaks. Under normal circumstances, the + * PP_Var will implicitly hold a reference count on the + * PP_Resource on your behalf. For example, if you call + * VarFromResource(), it implicitly calls PPB_Core::AddRefResource() on the + * PP_Resource. Likewise, PPB_Var::Release() on a Resource + * PP_Var will invoke PPB_Core::ReleaseResource() when the Var + * reference count goes to zero. + */ + PP_VARTYPE_RESOURCE = 10 +} PP_VarType; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_VarType, 4); +/** + * @} + */ + +/** + * @addtogroup Structs + * @{ + */ +/** + * The PP_VarValue union stores the data for any one of the types listed + * in the PP_VarType enum. + */ +union PP_VarValue { + /** + * If type is PP_VARTYPE_BOOL, + * as_bool represents the value of this PP_Var as + * PP_Bool. + */ + PP_Bool as_bool; + /** + * If type is PP_VARTYPE_INT32, + * as_int represents the value of this PP_Var as + * int32_t. + */ + int32_t as_int; + /** + * If type is PP_VARTYPE_DOUBLE, + * as_double represents the value of this PP_Var + * as double. + */ + double as_double; + /** + * If type is PP_VARTYPE_STRING, + * PP_VARTYPE_OBJECT, PP_VARTYPE_ARRAY, + * PP_VARTYPE_DICTIONARY, PP_VARTYPE_ARRAY_BUFFER, + * or PP_VARTYPE_RESOURCE, as_id represents the + * value of this PP_Var as an opaque handle assigned by the + * browser. This handle is guaranteed never to be 0, so a module can + * initialize this ID to 0 to indicate a "NULL handle." + */ + int64_t as_id; +}; + +/** + * The PP_VAR struct is a variant data type and can contain any + * value of one of the types named in the PP_VarType enum. This + * structure is for passing data between native code which can be strongly + * typed and the browser (JavaScript) which isn't strongly typed. + * + * JavaScript has a "number" type for holding a number, and does not + * differentiate between floating point and integer numbers. The + * JavaScript operations will try to optimize operations by using + * integers when possible, but could end up with doubles. Therefore, + * you can't assume a numeric PP_Var will be the type you expect. + * Your code should be capable of handling either int32_t or double for numeric + * PP_Vars sent from JavaScript. + */ +struct PP_Var { + PP_VarType type; + /** + * The padding ensures value is aligned on an + * 8-byte boundary relative to the start of the struct. Some compilers + * align doubles on 8-byte boundaries for 32-bit x86, and some align on + * 4-byte boundaries. + */ + int32_t padding; + /** + * This value represents the contents of the PP_Var. Only one of + * the fields of value is valid at a time based upon + * type. + */ + union PP_VarValue value; +}; +PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_Var, 16); +/** + * @} + */ + +/** + * @addtogroup Functions + * @{ + */ + +/** + * PP_MakeUndefined() is used to wrap an undefined value into a + * PP_Var struct for passing to the browser. + * + * @return A PP_Var structure. + */ +PP_INLINE struct PP_Var PP_MakeUndefined(void) { + struct PP_Var result = { PP_VARTYPE_UNDEFINED, 0, {PP_FALSE} }; + return result; +} + +/** + * PP_MakeNull() is used to wrap a null value into a + * PP_Var struct for passing to the browser. + * + * @return A PP_Var structure, + */ +PP_INLINE struct PP_Var PP_MakeNull(void) { + struct PP_Var result = { PP_VARTYPE_NULL, 0, {PP_FALSE} }; + return result; +} + +/** + * PP_MakeBool() is used to wrap a boolean value into a + * PP_Var struct for passing to the browser. + * + * @param[in] value A PP_Bool enumeration to + * wrap. + * + * @return A PP_Var structure. + */ +PP_INLINE struct PP_Var PP_MakeBool(PP_Bool value) { + struct PP_Var result = { PP_VARTYPE_BOOL, 0, {PP_FALSE} }; + result.value.as_bool = value; + return result; +} + +/** + * PP_MakeInt32() is used to wrap a 32 bit integer value + * into a PP_Var struct for passing to the browser. + * + * @param[in] value An int32 to wrap. + * + * @return A PP_Var structure. + */ +PP_INLINE struct PP_Var PP_MakeInt32(int32_t value) { + struct PP_Var result = { PP_VARTYPE_INT32, 0, {PP_FALSE} }; + result.value.as_int = value; + return result; +} + +/** + * PP_MakeDouble() is used to wrap a double value into a + * PP_Var struct for passing to the browser. + * + * @param[in] value A double to wrap. + * + * @return A PP_Var structure. + */ +PP_INLINE struct PP_Var PP_MakeDouble(double value) { + struct PP_Var result = { PP_VARTYPE_DOUBLE, 0, {PP_FALSE} }; + result.value.as_double = value; + return result; +} +/** + * @} + */ + +/* pp_touch_point.idl */ +/** + * @addtogroup Structs + * @{ + */ +/** + * The PP_TouchPoint struct represents all information about a + * single touch point, such as position, id, rotation angle, and pressure. + */ +struct PP_TouchPoint { + /** + * This value represents the identifier for this TouchPoint. The id + * corresponds to the order in which the points were pressed. For example, + * the first point to be pressed has an id of 0, the second has an id of 1, + * and so on. An id can be reused when a touch point is released. For + * example, if two fingers are down, with id 0 and 1, and finger 0 releases, + * the next finger to be pressed can be assigned to id 0. + */ + uint32_t id; + /** + * This value represents the x and y pixel position of this TouchPoint + * relative to the upper-left of the module instance receiving the event. + */ + struct PP_FloatPoint position; + /** + * This value represents the elliptical radii, in screen pixels, in the x + * and y direction of this TouchPoint. + */ + struct PP_FloatPoint radius; + /** + * This value represents the angle of rotation in degrees of the elliptical + * model of this TouchPoint clockwise from "up." + */ + float rotation_angle; + /** + * This value represents the pressure applied to this TouchPoint. This value + * is typically between 0 and 1, with 0 indicating no pressure and 1 + * indicating some maximum pressure. Scaling differs depending on the + * hardware and the value is not guaranteed to stay within that range. + */ + float pressure; +}; +PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_TouchPoint, 28); +/** + * @} + */ + +/** + * @addtogroup Functions + * @{ + */ + +/** + * PP_MakeTouchPoint() creates a PP_TouchPoint. + * + * @return A PP_TouchPoint structure. + */ +PP_INLINE struct PP_TouchPoint PP_MakeTouchPoint(void) { + struct PP_TouchPoint result = { 0, {0, 0}, {0, 0}, 0, 0 }; + return result; +} +/** + * @} + */ + +/* pp_instance.idl */ +/** + * @addtogroup Typedefs + * @{ + */ +/** + * The PP_Instance value uniquely identifies one instance of a + * module (.nexe/PP_Module). There will be one module instance for every + * \ tag on a page. + * + * This identifier is an opaque handle assigned by the browser to the module. + * It is guaranteed never to be 0, so a module can initialize it to 0 to + * indicate a "NULL handle." + */ +typedef int32_t PP_Instance; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_Instance, 4); +/** + * @} + */ + +/* ppb_input_event.idl */ +/** + * @addtogroup Enums + * @{ + */ +/** + * This enumeration contains the types of input events. + */ +typedef enum { + PP_INPUTEVENT_TYPE_UNDEFINED = -1, + /** + * Notification that a mouse button was pressed. + * + * Register for this event using the PP_INPUTEVENT_CLASS_MOUSE class. + */ + PP_INPUTEVENT_TYPE_MOUSEDOWN = 0, + /** + * Notification that a mouse button was released. + * + * Register for this event using the PP_INPUTEVENT_CLASS_MOUSE class. + */ + PP_INPUTEVENT_TYPE_MOUSEUP = 1, + /** + * Notification that a mouse button was moved when it is over the instance + * or dragged out of it. + * + * Register for this event using the PP_INPUTEVENT_CLASS_MOUSE class. + */ + PP_INPUTEVENT_TYPE_MOUSEMOVE = 2, + /** + * Notification that the mouse entered the instance's bounds. + * + * Register for this event using the PP_INPUTEVENT_CLASS_MOUSE class. + */ + PP_INPUTEVENT_TYPE_MOUSEENTER = 3, + /** + * Notification that a mouse left the instance's bounds. + * + * Register for this event using the PP_INPUTEVENT_CLASS_MOUSE class. + */ + PP_INPUTEVENT_TYPE_MOUSELEAVE = 4, + /** + * Notification that the scroll wheel was used. + * + * Register for this event using the PP_INPUTEVENT_CLASS_WHEEL class. + */ + PP_INPUTEVENT_TYPE_WHEEL = 5, + /** + * Notification that a key transitioned from "up" to "down". + * + * Register for this event using the PP_INPUTEVENT_CLASS_KEYBOARD class. + */ + PP_INPUTEVENT_TYPE_RAWKEYDOWN = 6, + /** + * Notification that a key was pressed. This does not necessarily correspond + * to a character depending on the key and language. Use the + * PP_INPUTEVENT_TYPE_CHAR for character input. + * + * Register for this event using the PP_INPUTEVENT_CLASS_KEYBOARD class. + */ + PP_INPUTEVENT_TYPE_KEYDOWN = 7, + /** + * Notification that a key was released. + * + * Register for this event using the PP_INPUTEVENT_CLASS_KEYBOARD class. + */ + PP_INPUTEVENT_TYPE_KEYUP = 8, + /** + * Notification that a character was typed. Use this for text input. Key + * down events may generate 0, 1, or more than one character event depending + * on the key, locale, and operating system. + * + * Register for this event using the PP_INPUTEVENT_CLASS_KEYBOARD class. + */ + PP_INPUTEVENT_TYPE_CHAR = 9, + /** + * Notification that a context menu should be shown. + * + * This message will be sent when the user right-clicks or performs another + * OS-specific mouse command that should open a context menu. When this event + * is delivered depends on the system, on some systems (Mac) it will + * delivered after the mouse down event, and on others (Windows) it will be + * delivered after the mouse up event. + * + * You will always get the normal mouse events. For example, you may see + * MOUSEDOWN,CONTEXTMENU,MOUSEUP or MOUSEDOWN,MOUSEUP,CONTEXTMENU. + * + * The return value from the event handler determines if the context menu + * event will be passed to the page when you are using filtered input events + * (via RequestFilteringInputEvents()). In non-filtering mode the event will + * never be propagated and no context menu will be displayed. If you are + * handling mouse events in filtering mode, you may want to return true from + * this event even if you do not support a context menu to suppress the + * default one. + * + * Register for this event using the PP_INPUTEVENT_CLASS_MOUSE class. + */ + PP_INPUTEVENT_TYPE_CONTEXTMENU = 10, + /** + * Notification that an input method composition process has just started. + * + * Register for this event using the PP_INPUTEVENT_CLASS_IME class. + */ + PP_INPUTEVENT_TYPE_IME_COMPOSITION_START = 11, + /** + * Notification that the input method composition string is updated. + * + * Register for this event using the PP_INPUTEVENT_CLASS_IME class. + */ + PP_INPUTEVENT_TYPE_IME_COMPOSITION_UPDATE = 12, + /** + * Notification that an input method composition process has completed. + * + * Register for this event using the PP_INPUTEVENT_CLASS_IME class. + */ + PP_INPUTEVENT_TYPE_IME_COMPOSITION_END = 13, + /** + * Notification that an input method committed a string. + * + * Register for this event using the PP_INPUTEVENT_CLASS_IME class. + */ + PP_INPUTEVENT_TYPE_IME_TEXT = 14, + /** + * Notification that a finger was placed on a touch-enabled device. + * + * Register for this event using the PP_INPUTEVENT_CLASS_TOUCH class. + */ + PP_INPUTEVENT_TYPE_TOUCHSTART = 15, + /** + * Notification that a finger was moved on a touch-enabled device. + * + * Register for this event using the PP_INPUTEVENT_CLASS_TOUCH class. + */ + PP_INPUTEVENT_TYPE_TOUCHMOVE = 16, + /** + * Notification that a finger was released on a touch-enabled device. + * + * Register for this event using the PP_INPUTEVENT_CLASS_TOUCH class. + */ + PP_INPUTEVENT_TYPE_TOUCHEND = 17, + /** + * Notification that a touch event was canceled. + * + * Register for this event using the PP_INPUTEVENT_CLASS_TOUCH class. + */ + PP_INPUTEVENT_TYPE_TOUCHCANCEL = 18 +} PP_InputEvent_Type; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_InputEvent_Type, 4); + +/** + * This enumeration contains event modifier constants. Each modifier is one + * bit. Retrieve the modifiers from an input event using the GetEventModifiers + * function on PPB_InputEvent. + */ +typedef enum { + PP_INPUTEVENT_MODIFIER_SHIFTKEY = 1 << 0, + PP_INPUTEVENT_MODIFIER_CONTROLKEY = 1 << 1, + PP_INPUTEVENT_MODIFIER_ALTKEY = 1 << 2, + PP_INPUTEVENT_MODIFIER_METAKEY = 1 << 3, + PP_INPUTEVENT_MODIFIER_ISKEYPAD = 1 << 4, + PP_INPUTEVENT_MODIFIER_ISAUTOREPEAT = 1 << 5, + PP_INPUTEVENT_MODIFIER_LEFTBUTTONDOWN = 1 << 6, + PP_INPUTEVENT_MODIFIER_MIDDLEBUTTONDOWN = 1 << 7, + PP_INPUTEVENT_MODIFIER_RIGHTBUTTONDOWN = 1 << 8, + PP_INPUTEVENT_MODIFIER_CAPSLOCKKEY = 1 << 9, + PP_INPUTEVENT_MODIFIER_NUMLOCKKEY = 1 << 10, + PP_INPUTEVENT_MODIFIER_ISLEFT = 1 << 11, + PP_INPUTEVENT_MODIFIER_ISRIGHT = 1 << 12, + PP_INPUTEVENT_MODIFIER_ISPEN = 1 << 13, + PP_INPUTEVENT_MODIFIER_ISERASER = 1 << 14 +} PP_InputEvent_Modifier; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_InputEvent_Modifier, 4); + +/** + * This enumeration contains constants representing each mouse button. To get + * the mouse button for a mouse down or up event, use GetMouseButton on + * PPB_InputEvent. + */ +typedef enum { + PP_INPUTEVENT_MOUSEBUTTON_NONE = -1, + PP_INPUTEVENT_MOUSEBUTTON_LEFT = 0, + PP_INPUTEVENT_MOUSEBUTTON_MIDDLE = 1, + PP_INPUTEVENT_MOUSEBUTTON_RIGHT = 2 +} PP_InputEvent_MouseButton; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_InputEvent_MouseButton, 4); + +typedef enum { + /** + * Request mouse input events. + * + * Normally you will request mouse events by calling RequestInputEvents(). + * The only use case for filtered events (via RequestFilteringInputEvents()) + * is for instances that have irregular outlines and you want to perform hit + * testing, which is very uncommon. Requesting non-filtered mouse events will + * lead to higher performance. + */ + PP_INPUTEVENT_CLASS_MOUSE = 1 << 0, + /** + * Requests keyboard events. Often you will want to request filtered mode + * (via RequestFilteringInputEvents) for keyboard events so you can pass on + * events (by returning false) that you don't handle. For example, if you + * don't request filtered mode and the user pressed "Page Down" when your + * instance has focus, the page won't scroll which will be a poor experience. + * + * A small number of tab and window management commands like Alt-F4 are never + * sent to the page. You can not request these keyboard commands since it + * would allow pages to trap users on a page. + */ + PP_INPUTEVENT_CLASS_KEYBOARD = 1 << 1, + /** + * Identifies scroll wheel input event. Wheel events must be requested in + * filtering mode via RequestFilteringInputEvents(). This is because many + * wheel commands should be forwarded to the page. + * + * Most instances will not need this event. Consuming wheel events by + * returning true from your filtered event handler will prevent the user from + * scrolling the page when the mouse is over the instance which can be very + * annoying. + * + * If you handle wheel events (for example, you have a document viewer which + * the user can scroll), the recommended behavior is to return false only if + * the wheel event actually causes your document to scroll. When the user + * reaches the end of the document, return false to indicating that the event + * was not handled. This will then forward the event to the containing page + * for scrolling, producing the nested scrolling behavior users expect from + * frames in a page. + */ + PP_INPUTEVENT_CLASS_WHEEL = 1 << 2, + /** + * Identifies touch input events. + * + * Request touch events only if you intend to handle them. If the browser + * knows you do not need to handle touch events, it can handle them at a + * higher level and achieve higher performance. If the plugin does not + * register for touch-events, then it will receive synthetic mouse events that + * are generated from the touch events (e.g. mouse-down for touch-start, + * mouse-move for touch-move (with left-button down), and mouse-up for + * touch-end. If the plugin does register for touch events, then the synthetic + * mouse events are not created. + */ + PP_INPUTEVENT_CLASS_TOUCH = 1 << 3, + /** + * Identifies IME composition input events. + * + * Request this input event class if you allow on-the-spot IME input. + */ + PP_INPUTEVENT_CLASS_IME = 1 << 4 +} PP_InputEvent_Class; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_InputEvent_Class, 4); +/** + * @} + */ + +/** + * @addtogroup Interfaces + * @{ + */ +/** + * The PPB_InputEvent interface contains pointers to several + * functions related to generic input events on the browser. + */ +struct PPB_InputEvent_1_0 { + /** + * RequestInputEvent() requests that input events corresponding to the given + * input events are delivered to the instance. + * + * It's recommended that you use RequestFilteringInputEvents() for keyboard + * events instead of this function so that you don't interfere with normal + * browser accelerators. + * + * By default, no input events are delivered. Call this function with the + * classes of events you are interested in to have them be delivered to + * the instance. Calling this function will override any previous setting for + * each specified class of input events (for example, if you previously + * called RequestFilteringInputEvents(), this function will set those events + * to non-filtering mode). + * + * Input events may have high overhead, so you should only request input + * events that your plugin will actually handle. For example, the browser may + * do optimizations for scroll or touch events that can be processed + * substantially faster if it knows there are no non-default receivers for + * that message. Requesting that such messages be delivered, even if they are + * processed very quickly, may have a noticeable effect on the performance of + * the page. + * + * Note that synthetic mouse events will be generated from touch events if + * (and only if) you do not request touch events. + * + * When requesting input events through this function, the events will be + * delivered and not bubbled to the default handlers. + * + * Example: + * @code + * RequestInputEvents(instance, PP_INPUTEVENT_CLASS_MOUSE); + * RequestFilteringInputEvents(instance, + * PP_INPUTEVENT_CLASS_WHEEL | PP_INPUTEVENT_CLASS_KEYBOARD); + * @endcode + * + * @param instance The PP_Instance of the instance requesting + * the given events. + * + * @param event_classes A combination of flags from + * PP_InputEvent_Class that identifies the classes of events the + * instance is requesting. The flags are combined by logically ORing their + * values. + * + * @return PP_OK if the operation succeeded, + * PP_ERROR_BADARGUMENT if instance is invalid, or + * PP_ERROR_NOTSUPPORTED if one of the event class bits were + * illegal. In the case of an invalid bit, all valid bits will be applied + * and only the illegal bits will be ignored. The most common cause of a + * PP_ERROR_NOTSUPPORTED return value is requesting keyboard + * events, these must use RequestFilteringInputEvents(). + */ + int32_t (*RequestInputEvents)(PP_Instance instance, uint32_t event_classes); + /** + * RequestFilteringInputEvents() requests that input events corresponding to + * the given input events are delivered to the instance for filtering. + * + * By default, no input events are delivered. In most cases you would + * register to receive events by calling RequestInputEvents(). In some cases, + * however, you may wish to filter events such that they can be bubbled up + * to the default handlers. In this case, register for those classes of + * events using this function instead of RequestInputEvents(). + * + * Filtering input events requires significantly more overhead than just + * delivering them to the instance. As such, you should only request + * filtering in those cases where it's absolutely necessary. The reason is + * that it requires the browser to stop and block for the instance to handle + * the input event, rather than sending the input event asynchronously. This + * can have significant overhead. + * + * Example: + * @code + * RequestInputEvents(instance, PP_INPUTEVENT_CLASS_MOUSE); + * RequestFilteringInputEvents(instance, + * PP_INPUTEVENT_CLASS_WHEEL | PP_INPUTEVENT_CLASS_KEYBOARD); + * @endcode + * + * @return PP_OK if the operation succeeded, + * PP_ERROR_BADARGUMENT if instance is invalid, or + * PP_ERROR_NOTSUPPORTED if one of the event class bits were + * illegal. In the case of an invalid bit, all valid bits will be applied + * and only the illegal bits will be ignored. + */ + int32_t (*RequestFilteringInputEvents)(PP_Instance instance, + uint32_t event_classes); + /** + * ClearInputEventRequest() requests that input events corresponding to the + * given input classes no longer be delivered to the instance. + * + * By default, no input events are delivered. If you have previously + * requested input events via RequestInputEvents() or + * RequestFilteringInputEvents(), this function will unregister handling + * for the given instance. This will allow greater browser performance for + * those events. + * + * Note that you may still get some input events after clearing the flag if + * they were dispatched before the request was cleared. For example, if + * there are 3 mouse move events waiting to be delivered, and you clear the + * mouse event class during the processing of the first one, you'll still + * receive the next two. You just won't get more events generated. + * + * @param instance The PP_Instance of the instance requesting + * to no longer receive the given events. + * + * @param event_classes A combination of flags from + * PP_InputEvent_Class that identify the classes of events the + * instance is no longer interested in. + */ + void (*ClearInputEventRequest)(PP_Instance instance, uint32_t event_classes); + /** + * IsInputEvent() returns true if the given resource is a valid input event + * resource. + * + * @param[in] resource A PP_Resource corresponding to a generic + * resource. + * + * @return PP_TRUE if the given resource is a valid input event + * resource. + */ + PP_Bool (*IsInputEvent)(PP_Resource resource); + /** + * GetType() returns the type of input event for the given input event + * resource. + * + * @param[in] resource A PP_Resource corresponding to an input + * event. + * + * @return A PP_InputEvent_Type if its a valid input event or + * PP_INPUTEVENT_TYPE_UNDEFINED if the resource is invalid. + */ + PP_InputEvent_Type (*GetType)(PP_Resource event); + /** + * GetTimeStamp() Returns the time that the event was generated. This will be + * before the current time since processing and dispatching the event has + * some overhead. Use this value to compare the times the user generated two + * events without being sensitive to variable processing time. + * + * @param[in] resource A PP_Resource corresponding to the event. + * + * @return The return value is in time ticks, which is a monotonically + * increasing clock not related to the wall clock time. It will not change + * if the user changes their clock or daylight savings time starts, so can + * be reliably used to compare events. This means, however, that you can't + * correlate event times to a particular time of day on the system clock. + */ + PP_TimeTicks (*GetTimeStamp)(PP_Resource event); + /** + * GetModifiers() returns a bitfield indicating which modifiers were down + * at the time of the event. This is a combination of the flags in the + * PP_InputEvent_Modifier enum. + * + * @param[in] resource A PP_Resource corresponding to an input + * event. + * + * @return The modifiers associated with the event, or 0 if the given + * resource is not a valid event resource. + */ + uint32_t (*GetModifiers)(PP_Resource event); +}; + +typedef struct PPB_InputEvent_1_0 PPB_InputEvent; + +/** + * The PPB_MouseInputEvent interface contains pointers to several + * functions related to mouse input events. + */ +struct PPB_MouseInputEvent_1_1 { + /** + * Create() creates a mouse input event with the given parameters. Normally + * you will get a mouse event passed through the + * HandleInputEvent and will not need to create them, but some + * applications may want to create their own for internal use. The type must + * be one of the mouse event types. + * + * @param[in] instance The instance for which this event occurred. + * + * @param[in] type A PP_InputEvent_Type identifying the type of + * input event. + * + * @param[in] time_stamp A PP_TimeTicks indicating the time + * when the event occurred. + * + * @param[in] modifiers A bit field combination of the + * PP_InputEvent_Modifier flags. + * + * @param[in] mouse_button The button that changed for mouse down or up + * events. This value will be PP_EVENT_MOUSEBUTTON_NONE for + * mouse move, enter, and leave events. + * + * @param[in] mouse_position A Point containing the x and y + * position of the mouse when the event occurred. + * + * @param[in] mouse_movement The change in position of the mouse. + * + * @return A PP_Resource containing the new mouse input event. + */ + PP_Resource (*Create)(PP_Instance instance, + PP_InputEvent_Type type, + PP_TimeTicks time_stamp, + uint32_t modifiers, + PP_InputEvent_MouseButton mouse_button, + const struct PP_Point* mouse_position, + int32_t click_count, + const struct PP_Point* mouse_movement); + /** + * IsMouseInputEvent() determines if a resource is a mouse event. + * + * @param[in] resource A PP_Resource corresponding to an event. + * + * @return PP_TRUE if the given resource is a valid mouse input + * event, otherwise PP_FALSE. + */ + PP_Bool (*IsMouseInputEvent)(PP_Resource resource); + /** + * GetButton() returns the mouse button that generated a mouse down or up + * event. + * + * @param[in] mouse_event A PP_Resource corresponding to a + * mouse event. + * + * @return The mouse button associated with mouse down and up events. This + * value will be PP_EVENT_MOUSEBUTTON_NONE for mouse move, + * enter, and leave events, and for all non-mouse events. + */ + PP_InputEvent_MouseButton (*GetButton)(PP_Resource mouse_event); + /** + * GetPosition() returns the pixel location of a mouse input event. When + * the mouse is locked, it returns the last known mouse position just as + * mouse lock was entered. + * + * @param[in] mouse_event A PP_Resource corresponding to a + * mouse event. + * + * @return The point associated with the mouse event, relative to the upper- + * left of the instance receiving the event. These values can be negative for + * mouse drags. The return value will be (0, 0) for non-mouse events. + */ + struct PP_Point (*GetPosition)(PP_Resource mouse_event); + int32_t (*GetClickCount)(PP_Resource mouse_event); + /** + * Returns the change in position of the mouse. When the mouse is locked, + * although the mouse position doesn't actually change, this function + * still provides movement information, which indicates what the change in + * position would be had the mouse not been locked. + * + * @param[in] mouse_event A PP_Resource corresponding to a + * mouse event. + * + * @return The change in position of the mouse, relative to the previous + * position. + */ + struct PP_Point (*GetMovement)(PP_Resource mouse_event); +}; + +typedef struct PPB_MouseInputEvent_1_1 PPB_MouseInputEvent; + +struct PPB_MouseInputEvent_1_0 { + PP_Resource (*Create)(PP_Instance instance, + PP_InputEvent_Type type, + PP_TimeTicks time_stamp, + uint32_t modifiers, + PP_InputEvent_MouseButton mouse_button, + const struct PP_Point* mouse_position, + int32_t click_count); + PP_Bool (*IsMouseInputEvent)(PP_Resource resource); + PP_InputEvent_MouseButton (*GetButton)(PP_Resource mouse_event); + struct PP_Point (*GetPosition)(PP_Resource mouse_event); + int32_t (*GetClickCount)(PP_Resource mouse_event); +}; + +/** + * The PPB_WheelIputEvent interface contains pointers to several + * functions related to wheel input events. + */ +struct PPB_WheelInputEvent_1_0 { + /** + * Create() creates a wheel input event with the given parameters. Normally + * you will get a wheel event passed through the + * HandleInputEvent and will not need to create them, but some + * applications may want to create their own for internal use. + * + * @param[in] instance The instance for which this event occurred. + * + * @param[in] time_stamp A PP_TimeTicks indicating the time + * when the event occurred. + * + * @param[in] modifiers A bit field combination of the + * PP_InputEvent_Modifier flags. + * + * @param[in] wheel_delta The scroll wheel's horizontal and vertical scroll + * amounts. + * + * @param[in] wheel_ticks The number of "clicks" of the scroll wheel that + * have produced the event. + * + * @param[in] scroll_by_page When true, the user is requesting to scroll + * by pages. When false, the user is requesting to scroll by lines. + * + * @return A PP_Resource containing the new wheel input event. + */ + PP_Resource (*Create)(PP_Instance instance, + PP_TimeTicks time_stamp, + uint32_t modifiers, + const struct PP_FloatPoint* wheel_delta, + const struct PP_FloatPoint* wheel_ticks, + PP_Bool scroll_by_page); + /** + * IsWheelInputEvent() determines if a resource is a wheel event. + * + * @param[in] wheel_event A PP_Resource corresponding to an + * event. + * + * @return PP_TRUE if the given resource is a valid wheel input + * event. + */ + PP_Bool (*IsWheelInputEvent)(PP_Resource resource); + /** + * GetDelta() returns the amount vertically and horizontally the user has + * requested to scroll by with their mouse wheel. A scroll down or to the + * right (where the content moves up or left) is represented as positive + * values, and a scroll up or to the left (where the content moves down or + * right) is represented as negative values. + * + * This amount is system dependent and will take into account the user's + * preferred scroll sensitivity and potentially also nonlinear acceleration + * based on the speed of the scrolling. + * + * Devices will be of varying resolution. Some mice with large detents will + * only generate integer scroll amounts. But fractional values are also + * possible, for example, on some trackpads and newer mice that don't have + * "clicks". + * + * @param[in] wheel_event A PP_Resource corresponding to a wheel + * event. + * + * @return The vertical and horizontal scroll values. The units are either in + * pixels (when scroll_by_page is false) or pages (when scroll_by_page is + * true). For example, y = -3 means scroll up 3 pixels when scroll_by_page + * is false, and scroll up 3 pages when scroll_by_page is true. + */ + struct PP_FloatPoint (*GetDelta)(PP_Resource wheel_event); + /** + * GetTicks() returns the number of "clicks" of the scroll wheel + * that have produced the event. The value may have system-specific + * acceleration applied to it, depending on the device. The positive and + * negative meanings are the same as for GetDelta(). + * + * If you are scrolling, you probably want to use the delta values. These + * tick events can be useful if you aren't doing actual scrolling and don't + * want or pixel values. An example may be cycling between different items in + * a game. + * + * @param[in] wheel_event A PP_Resource corresponding to a wheel + * event. + * + * @return The number of "clicks" of the scroll wheel. You may receive + * fractional values for the wheel ticks if the mouse wheel is high + * resolution or doesn't have "clicks". If your program wants discrete + * events (as in the "picking items" example) you should accumulate + * fractional click values from multiple messages until the total value + * reaches positive or negative one. This should represent a similar amount + * of scrolling as for a mouse that has a discrete mouse wheel. + */ + struct PP_FloatPoint (*GetTicks)(PP_Resource wheel_event); + /** + * GetScrollByPage() indicates if the scroll delta x/y indicates pages or + * lines to scroll by. + * + * @param[in] wheel_event A PP_Resource corresponding to a wheel + * event. + * + * @return PP_TRUE if the event is a wheel event and the user is + * scrolling by pages. PP_FALSE if not or if the resource is not + * a wheel event. + */ + PP_Bool (*GetScrollByPage)(PP_Resource wheel_event); +}; + +typedef struct PPB_WheelInputEvent_1_0 PPB_WheelInputEvent; + +/** + * The PPB_KeyboardInputEvent interface contains pointers to + * several functions related to keyboard input events. + */ +struct PPB_KeyboardInputEvent_1_2 { + /** + * Creates a keyboard input event with the given parameters. Normally you + * will get a keyboard event passed through the HandleInputEvent and will not + * need to create them, but some applications may want to create their own + * for internal use. The type must be one of the keyboard event types. + * + * @param[in] instance The instance for which this event occurred. + * + * @param[in] type A PP_InputEvent_Type identifying the type of + * input event. + * + * @param[in] time_stamp A PP_TimeTicks indicating the time + * when the event occurred. + * + * @param[in] modifiers A bit field combination of the + * PP_InputEvent_Modifier flags. + * + * @param[in] key_code This value reflects the DOM KeyboardEvent + * keyCode field, which is the Windows-style Virtual Key + * code of the key. + * + * @param[in] character_text This value represents the typed character as a + * UTF-8 string. + * + * @param[in] code This value represents the DOM3 |code| string that + * corresponds to the physical key being pressed. + * + * @return A PP_Resource containing the new keyboard input + * event. + */ + PP_Resource (*Create)(PP_Instance instance, + PP_InputEvent_Type type, + PP_TimeTicks time_stamp, + uint32_t modifiers, + uint32_t key_code, + struct PP_Var character_text, + struct PP_Var code); + /** + * IsKeyboardInputEvent() determines if a resource is a keyboard event. + * + * @param[in] resource A PP_Resource corresponding to an event. + * + * @return PP_TRUE if the given resource is a valid input event. + */ + PP_Bool (*IsKeyboardInputEvent)(PP_Resource resource); + /** + * GetKeyCode() returns the DOM keyCode field for the keyboard event. + * Chrome populates this with the Windows-style Virtual Key code of the key. + * + * @param[in] key_event A PP_Resource corresponding to a + * keyboard event. + * + * @return The DOM keyCode field for the keyboard event. + */ + uint32_t (*GetKeyCode)(PP_Resource key_event); + /** + * GetCharacterText() returns the typed character as a UTF-8 string for the + * given character event. + * + * @param[in] character_event A PP_Resource corresponding to a + * keyboard event. + * + * @return A string var representing a single typed character for character + * input events. For non-character input events the return value will be an + * undefined var. + */ + struct PP_Var (*GetCharacterText)(PP_Resource character_event); + /** + * GetCode() returns the DOM |code| field for this keyboard event, as + * defined in the DOM3 Events spec: + * http://www.w3.org/TR/DOM-Level-3-Events/ + * + * @param[in] key_event The key event for which to return the key code. + * + * @return The string that contains the DOM |code| for the keyboard event. + */ + struct PP_Var (*GetCode)(PP_Resource key_event); +}; + +typedef struct PPB_KeyboardInputEvent_1_2 PPB_KeyboardInputEvent; + +struct PPB_KeyboardInputEvent_1_0 { + PP_Resource (*Create)(PP_Instance instance, + PP_InputEvent_Type type, + PP_TimeTicks time_stamp, + uint32_t modifiers, + uint32_t key_code, + struct PP_Var character_text); + PP_Bool (*IsKeyboardInputEvent)(PP_Resource resource); + uint32_t (*GetKeyCode)(PP_Resource key_event); + struct PP_Var (*GetCharacterText)(PP_Resource character_event); +}; +/** + * @} + */ + +/** + * @addtogroup Enums + * @{ + */ +typedef enum { + /** + * The list of all TouchPoints which are currently down. + */ + PP_TOUCHLIST_TYPE_TOUCHES = 0, + /** + * The list of all TouchPoints whose state has changed since the last + * TouchInputEvent. + */ + PP_TOUCHLIST_TYPE_CHANGEDTOUCHES = 1, + /** + * The list of all TouchPoints which are targeting this plugin. This is a + * subset of Touches. + */ + PP_TOUCHLIST_TYPE_TARGETTOUCHES = 2 +} PP_TouchListType; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_TouchListType, 4); +/** + * @} + */ + +/** + * @addtogroup Interfaces + * @{ + */ +/** + * The PPB_TouchInputEvent interface contains pointers to several + * functions related to touch events. + */ +struct PPB_TouchInputEvent_1_0 { + /** + * Creates a touch input event with the given parameters. Normally you + * will get a touch event passed through the HandleInputEvent and will not + * need to create them, but some applications may want to create their own + * for internal use. The type must be one of the touch event types. + * This newly created touch input event does not have any touch point in any + * of the touch-point lists. AddTouchPoint should be called to + * add the touch-points. + * + * @param[in] instance The instance for which this event occurred. + * + * @param[in] type A PP_InputEvent_Type identifying the type of + * input event. + * + * @param[in] time_stamp A PP_TimeTicks indicating the time + * when the event occurred. + * + * @param[in] modifiers A bit field combination of the + * PP_InputEvent_Modifier flags. + * + * @return A PP_Resource containing the new touch input event. + */ + PP_Resource (*Create)(PP_Instance instance, + PP_InputEvent_Type type, + PP_TimeTicks time_stamp, + uint32_t modifiers); + /** + * Adds a touch point to the touch event in the specified touch-list. + * + * @param[in] touch_event A PP_Resource corresponding to a touch + * event. + * + * @param[in] list The list to add the touch point to. + * + * @param[in] point The point to add to the list. + */ + void (*AddTouchPoint)(PP_Resource touch_event, + PP_TouchListType list, + const struct PP_TouchPoint* point); + /** + * IsTouchInputEvent() determines if a resource is a touch event. + * + * @param[in] resource A PP_Resource corresponding to an event. + * + * @return PP_TRUE if the given resource is a valid touch input + * event, otherwise PP_FALSE. + */ + PP_Bool (*IsTouchInputEvent)(PP_Resource resource); + /** + * Returns the number of touch-points in the specified list. + * + * @param[in] resource A PP_Resource corresponding to a touch + * event. + * + * @param[in] list The list. + * + * @return The number of touch-points in the specified list. + */ + uint32_t (*GetTouchCount)(PP_Resource resource, PP_TouchListType list); + /** + * Returns the touch-point at the specified index from the specified list. + * + * @param[in] resource A PP_Resource corresponding to a touch + * event. + * + * @param[in] list The list. + * + * @param[in] index The index. + * + * @return A PP_TouchPoint representing the touch-point. + */ + struct PP_TouchPoint (*GetTouchByIndex)(PP_Resource resource, + PP_TouchListType list, + uint32_t index); + /** + * Returns the touch-point with the specified touch-id in the specified list. + * + * @param[in] resource A PP_Resource corresponding to a touch + * event. + * + * @param[in] list The list. + * + * @param[in] touch_id The id of the touch-point. + * + * @return A PP_TouchPoint representing the touch-point. + */ + struct PP_TouchPoint (*GetTouchById)(PP_Resource resource, + PP_TouchListType list, + uint32_t touch_id); +}; + +typedef struct PPB_TouchInputEvent_1_0 PPB_TouchInputEvent; + +struct PPB_IMEInputEvent_1_0 { + /** + * Create() creates an IME input event with the given parameters. Normally + * you will get an IME event passed through the HandleInputEvent + * and will not need to create them, but some applications may want to create + * their own for internal use. + * + * @param[in] instance The instance for which this event occurred. + * + * @param[in] type A PP_InputEvent_Type identifying the type of + * input event. The type must be one of the IME event types. + * + * @param[in] time_stamp A PP_TimeTicks indicating the time + * when the event occurred. + * + * @param[in] text The string returned by GetText. + * + * @param[in] segment_number The number returned by + * GetSegmentNumber. + * + * @param[in] segment_offsets The array of numbers returned by + * GetSegmentOffset. If segment_number is zero, + * the number of elements of the array should be zero. If + * segment_number is non-zero, the length of the array must be + * segment_number + 1. + * + * @param[in] target_segment The number returned by + * GetTargetSegment. + * + * @param[in] selection_start The start index returned by + * GetSelection. + * + * @param[in] selection_end The end index returned by + * GetSelection. + * + * @return A PP_Resource containing the new IME input event. + */ + PP_Resource (*Create)(PP_Instance instance, + PP_InputEvent_Type type, + PP_TimeTicks time_stamp, + struct PP_Var text, + uint32_t segment_number, + const uint32_t segment_offsets[], + int32_t target_segment, + uint32_t selection_start, + uint32_t selection_end); + /** + * IsIMEInputEvent() determines if a resource is an IME event. + * + * @param[in] resource A PP_Resource corresponding to an event. + * + * @return PP_TRUE if the given resource is a valid input event. + */ + PP_Bool (*IsIMEInputEvent)(PP_Resource resource); + /** + * GetText() returns the composition text as a UTF-8 string for the given IME + * event. + * + * @param[in] ime_event A PP_Resource corresponding to an IME + * event. + * + * @return A string var representing the composition text. For non-IME input + * events the return value will be an undefined var. + */ + struct PP_Var (*GetText)(PP_Resource ime_event); + /** + * GetSegmentNumber() returns the number of segments in the composition text. + * + * @param[in] ime_event A PP_Resource corresponding to an IME + * event. + * + * @return The number of segments. For events other than COMPOSITION_UPDATE, + * returns 0. + */ + uint32_t (*GetSegmentNumber)(PP_Resource ime_event); + /** + * GetSegmentOffset() returns the position of the index-th segmentation point + * in the composition text. The position is given by a byte-offset (not a + * character-offset) of the string returned by GetText(). It always satisfies + * 0=GetSegmentOffset(0) < ... < GetSegmentOffset(i) < GetSegmentOffset(i+1) + * < ... < GetSegmentOffset(GetSegmentNumber())=(byte-length of GetText()). + * Note that [GetSegmentOffset(i), GetSegmentOffset(i+1)) represents the range + * of the i-th segment, and hence GetSegmentNumber() can be a valid argument + * to this function instead of an off-by-1 error. + * + * @param[in] ime_event A PP_Resource corresponding to an IME + * event. + * + * @param[in] index An integer indicating a segment. + * + * @return The byte-offset of the segmentation point. If the event is not + * COMPOSITION_UPDATE or index is out of range, returns 0. + */ + uint32_t (*GetSegmentOffset)(PP_Resource ime_event, uint32_t index); + /** + * GetTargetSegment() returns the index of the current target segment of + * composition. + * + * @param[in] ime_event A PP_Resource corresponding to an IME + * event. + * + * @return An integer indicating the index of the target segment. When there + * is no active target segment, or the event is not COMPOSITION_UPDATE, + * returns -1. + */ + int32_t (*GetTargetSegment)(PP_Resource ime_event); + /** + * GetSelection() returns the range selected by caret in the composition text. + * + * @param[in] ime_event A PP_Resource corresponding to an IME + * event. + * + * @param[out] start The start position of the current selection. + * + * @param[out] end The end position of the current selection. + */ + void (*GetSelection)(PP_Resource ime_event, uint32_t* start, uint32_t* end); +}; + +typedef struct PPB_IMEInputEvent_1_0 PPB_IMEInputEvent; +/** + * @} + */ + +/* pp_input_event.idl */ +/** + * @addtogroup Structs + * @{ + */ +/** + * The PP_InputEvent_Key struct represents a key up or key down + * event. + * + * Key up and key down events correspond to physical keys on the keyboard. The + * actual character that the user typed (if any) will be delivered in a + * "character" event. + * + * If the user loses focus on the module while a key is down, a key up + * event might not occur. For example, if the module has focus and the user + * presses and holds the shift key, the module will see a "shift down" message. + * Then if the user clicks elsewhere on the web page, the module's focus will + * be lost and no more input events will be delivered. + * + * If your module depends on receiving key up events, it should also handle + * "lost focus" as the equivalent of "all keys up." + */ +struct PP_InputEvent_Key { + /** This value is a bit field combination of the EVENT_MODIFIER flags. */ + uint32_t modifier; + /** + * This value reflects the DOM KeyboardEvent keyCode field. + * Chrome populates this with the Windows-style Virtual Key code of the key. + */ + uint32_t key_code; +}; +PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_InputEvent_Key, 8); + +/** + * The PP_InputEvent_Character struct represents a typed character + * event. + * + * Normally, the program will receive a key down event, followed by a character + * event, followed by a key up event. The character event will have any + * modifier keys applied. Obvious examples are symbols, where Shift-5 gives you + * a '%'. The key down and up events will give you the scan code for the "5" + * key, and the character event will give you the '%' character. + * + * You may not get a character event for all key down events if the key doesn't + * generate a character. Likewise, you may actually get multiple character + * events in a row. For example, some locales have an accent key that modifies + * the next character typed. You might get this stream of events: accent down, + * accent up (it didn't generate a character), letter key down, letter with + * accent character event (it was modified by the previous accent key), letter + * key up. If the letter can't be combined with the accent, like an umlaut and + * an 'R', the system might send umlaut down, umlaut up, 'R' key down, umlaut + * character (can't combine it with 'R', so just send the raw umlaut so it + * isn't lost"), 'R' character event, 'R' key up. + */ +struct PP_InputEvent_Character { + /** A combination of the PP_InputEvent_Modifier flags. */ + uint32_t modifier; + /** + * This value represents the typed character as a single null-terminated UTF-8 + * character. Any unused bytes will be filled with null bytes. Since the + * maximum UTF-8 character is 4 bytes, there will always be at least one null + * at the end so you can treat this as a null-terminated UTF-8 string. + */ + int8_t text[5]; +}; +PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_InputEvent_Character, 12); + +/** + * The PP_InputEvent_Mouse struct represents all mouse events + * except mouse wheel events. + */ +struct PP_InputEvent_Mouse { + /** + * This value is a bit field combination of the + * PP_InputEvent_Modifier flags. + */ + uint32_t modifier; + /** + * This value represents the button that changed for mouse down or up events. + * This value will be PP_EVENT_MOUSEBUTTON_NONE for mouse move, + * enter, and leave events. + */ + PP_InputEvent_MouseButton button; + /** + * This values represents the x coordinate of the mouse when the event + * occurred. + * + * In most, but not all, cases these coordinates will just be integers. + * For example, the plugin element might be arbitrarily scaled or transformed + * in the DOM, and translating a mouse event into the coordinate space of the + * plugin will give non-integer values. + */ + float x; + /** + * This values represents the y coordinate of the mouse when the event + * occurred. + * + * In most, but not all, cases these coordinates will just be integers. + * For example, the plugin element might be arbitrarily scaled or transformed + * in the DOM, and translating a mouse event into the coordinate space of the + * plugin will give non-integer values. + */ + float y; + int32_t click_count; +}; +PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_InputEvent_Mouse, 20); + +/** + * The PP_InputEvent_Wheel struct represents all mouse wheel + * events. + */ +struct PP_InputEvent_Wheel { + /** + * This value represents a combination of the EVENT_MODIFIER + * flags. + */ + uint32_t modifier; + /** + * The mouse wheel's horizontal scroll amount. A scroll to the right + * (where the content moves left) is represented as positive values, + * and a scroll to the left (where the content moves right) is + * represented as negative values. + * + * The units are either in pixels (when scroll_by_page is false) or pages + * (when scroll_by_page is true). For example, delta_y = -3 means scroll up 3 + * pixels when scroll_by_page is false, and scroll up 3 pages when + * scroll_by_page is true. + * + * This amount is system dependent and will take into account the user's + * preferred scroll sensitivity and potentially also nonlinear acceleration + * based on the speed of the scrolling. + * + * Devices will be of varying resolution. Some mice with large detents will + * only generate integer scroll amounts. But fractional values are also + * possible, for example, on some trackpads and newer mice that don't have + * "clicks". + */ + float delta_x; + /** + * The mouse wheel's vertical scroll amount. A scroll down (where the + * content moves up) is represented as positive values, and a scroll up + * (where the content moves down) is represented as negative values. + * + * The units are either in pixels (when scroll_by_page is false) or pages + * (when scroll_by_page is true). For example, delta_y = -3 means scroll up 3 + * pixels when scroll_by_page is false, and scroll up 3 pages when + * scroll_by_page is true. + * + * This amount is system dependent and will take into account the user's + * preferred scroll sensitivity and potentially also nonlinear acceleration + * based on the speed of the scrolling. + * + * Devices will be of varying resolution. Some mice with large detents will + * only generate integer scroll amounts. But fractional values are also + * possible, for example, on some trackpads and newer mice that don't have + * "clicks". + */ + float delta_y; + /** + * The number of "clicks" of the scroll wheel that have produced the + * event. The value may have system-specific acceleration applied to it, + * depending on the device. The positive and negative meanings are the same + * as for delta_x and delta_y. + * + * If you are scrolling, you probably want to use the delta values above. + * These tick events can be useful if you aren't doing actual scrolling and + * don't want or pixel values. An example may be cycling between different + * items in a game. + * + * You may receive fractional values for the wheel ticks if the mouse wheel + * is high resolution or doesn't have "clicks". If your program wants + * discrete events (as in the "picking items" example) you should accumulate + * fractional click values from multiple messages until the total value + * reaches positive or negative one. This should represent a similar amount + * of scrolling as for a mouse that has a discrete mouse wheel. + */ + float wheel_ticks_x; + /** This value represents */ + float wheel_ticks_y; + /** + * Indicates if the scroll delta_x/delta_y + * indicates pages or lines to scroll by. When true, the user is requesting + * to scroll by pages. + */ + PP_Bool scroll_by_page; +}; +PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_InputEvent_Wheel, 24); +/** + * @} + */ + +/* pp_module.idl */ +/** + * @addtogroup Typedefs + * @{ + */ +/** + * The PP_Module value uniquely identifies the module or .nexe. + * + * This identifier is an opaque handle assigned by the browser to the module. It + * is guaranteed never to be 0, so a module can initialize it to 0 to + * indicate a "NULL handle." + */ +typedef int32_t PP_Module; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_Module, 4); +/** + * @} + */ + +/* ppb.idl */ +/** + * @addtogroup Typedefs + * @{ + */ +/** + * This function pointer type defines the signature for the + * PPB_GetInterface function. A generic + * PPB_GetInterface pointer is passed to + * PPP_InitializedModule when your module is loaded. You can use + * this pointer to request a pointer to a specific browser interface. Browser + * interface names are ASCII strings and are generally defined in the header + * file for the interface, such as PPB_AUDIO_INTERFACE found in + * ppb.audio.h or + * PPB_GRAPHICS_2D_INTERFACE in ppb_graphics_2d.h. + * Click + *
here for a complete list of interface + * names. + * + * This value will be NULL if the interface is not supported on the browser. + */ +typedef const void* (*PPB_GetInterface)(const char* interface_name); +/** + * @} + */ + +/* ppb_audio.idl */ +/** + * @addtogroup Typedefs + * @{ + */ +/** + * PPB_Audio_Callback defines the type of an audio callback + * function used to fill the audio buffer with data. Please see the + * Create() function in the PPB_Audio interface for + * more details on this callback. + * + * @param[in] sample_buffer A buffer to fill with audio data. + * @param[in] buffer_size_in_bytes The size of the buffer in bytes. + * @param[in] latency How long before the audio data is to be presented. + * @param[inout] user_data An opaque pointer that was passed into + * PPB_Audio.Create(). + */ +typedef void (*PPB_Audio_Callback)(void* sample_buffer, + uint32_t buffer_size_in_bytes, + PP_TimeDelta latency, + void* user_data); + +typedef void (*PPB_Audio_Callback_1_0)(void* sample_buffer, + uint32_t buffer_size_in_bytes, + void* user_data); +/** + * @} + */ + +/** + * @addtogroup Interfaces + * @{ + */ +/** + * The PPB_Audio interface contains pointers to several functions + * for handling audio resources. Refer to the + * Audio + * chapter in the Developer's Guide for information on using this interface. + * Please see descriptions for each PPB_Audio and + * PPB_AudioConfig function for more details. A C example using + * PPB_Audio and PPB_AudioConfig follows. + * + * Example: + * + * @code + * void audio_callback(void* sample_buffer, + * uint32_t buffer_size_in_bytes, + * void* user_data) { + * ... quickly fill in the buffer with samples and return to caller ... + * } + * + * ...Assume the application has cached the audio configuration interface in + * audio_config_interface and the audio interface in + * audio_interface... + * + * uint32_t count = audio_config_interface->RecommendSampleFrameCount( + * PP_AUDIOSAMPLERATE_44100, 4096); + * PP_Resource pp_audio_config = audio_config_interface->CreateStereo16Bit( + * pp_instance, PP_AUDIOSAMPLERATE_44100, count); + * PP_Resource pp_audio = audio_interface->Create(pp_instance, pp_audio_config, + * audio_callback, NULL); + * audio_interface->StartPlayback(pp_audio); + * + * ...audio_callback() will now be periodically invoked on a separate thread... + * @endcode + */ +struct PPB_Audio_1_1 { + /** + * Create() creates an audio resource. No sound will be heard until + * StartPlayback() is called. The callback is called with the buffer address + * and given user data whenever the buffer needs to be filled. From within the + * callback, you should not call PPB_Audio functions. The + * callback will be called on a different thread than the one which created + * the interface. For performance-critical applications (i.e. low-latency + * audio), the callback should avoid blocking or calling functions that can + * obtain locks, such as malloc. The layout and the size of the buffer passed + * to the audio callback will be determined by the device configuration and is + * specified in the AudioConfig documentation. + * + * @param[in] instance A PP_Instance identifying one instance + * of a module. + * @param[in] config A PP_Resource corresponding to an audio + * config resource. + * @param[in] audio_callback A PPB_Audio_Callback callback + * function that the browser calls when it needs more samples to play. + * @param[in] user_data A pointer to user data used in the callback function. + * + * @return A PP_Resource containing the audio resource if + * successful or 0 if the configuration cannot be honored or the callback is + * null. + */ + PP_Resource (*Create)(PP_Instance instance, + PP_Resource config, + PPB_Audio_Callback audio_callback, + void* user_data); + /** + * IsAudio() determines if the provided resource is an audio resource. + * + * @param[in] resource A PP_Resource corresponding to a generic + * resource. + * + * @return A PP_Bool containing containing PP_TRUE + * if the given resource is an Audio resource, otherwise + * PP_FALSE. + */ + PP_Bool (*IsAudio)(PP_Resource resource); + /** + * GetCurrrentConfig() returns an audio config resource for the given audio + * resource. + * + * @param[in] config A PP_Resource corresponding to an audio + * resource. + * + * @return A PP_Resource containing the audio config resource if + * successful. + */ + PP_Resource (*GetCurrentConfig)(PP_Resource audio); + /** + * StartPlayback() starts the playback of the audio resource and begins + * periodically calling the callback. + * + * @param[in] config A PP_Resource corresponding to an audio + * resource. + * + * @return A PP_Bool containing PP_TRUE if + * successful, otherwise PP_FALSE. Also returns + * PP_TRUE (and be a no-op) if called while playback is already + * in progress. + */ + PP_Bool (*StartPlayback)(PP_Resource audio); + /** + * StopPlayback() stops the playback of the audio resource. + * + * @param[in] config A PP_Resource corresponding to an audio + * resource. + * + * @return A PP_Bool containing PP_TRUE if + * successful, otherwise PP_FALSE. Also returns + * PP_TRUE (and is a no-op) if called while playback is already + * stopped. If a callback is in progress, StopPlayback() will block until the + * callback completes. + */ + PP_Bool (*StopPlayback)(PP_Resource audio); +}; + +typedef struct PPB_Audio_1_1 PPB_Audio; + +struct PPB_Audio_1_0 { + PP_Resource (*Create)(PP_Instance instance, + PP_Resource config, + PPB_Audio_Callback_1_0 audio_callback, + void* user_data); + PP_Bool (*IsAudio)(PP_Resource resource); + PP_Resource (*GetCurrentConfig)(PP_Resource audio); + PP_Bool (*StartPlayback)(PP_Resource audio); + PP_Bool (*StopPlayback)(PP_Resource audio); +}; +/** + * @} + */ + +/* ppb_audio_buffer.idl */ +/** + * @addtogroup Enums + * @{ + */ +/** + * PP_AudioBuffer_SampleRate is an enumeration of the different audio sample + * rates. + */ +typedef enum { + PP_AUDIOBUFFER_SAMPLERATE_UNKNOWN = 0, + PP_AUDIOBUFFER_SAMPLERATE_8000 = 8000, + PP_AUDIOBUFFER_SAMPLERATE_16000 = 16000, + PP_AUDIOBUFFER_SAMPLERATE_22050 = 22050, + PP_AUDIOBUFFER_SAMPLERATE_32000 = 32000, + PP_AUDIOBUFFER_SAMPLERATE_44100 = 44100, + PP_AUDIOBUFFER_SAMPLERATE_48000 = 48000, + PP_AUDIOBUFFER_SAMPLERATE_96000 = 96000, + PP_AUDIOBUFFER_SAMPLERATE_192000 = 192000 +} PP_AudioBuffer_SampleRate; + +/** + * PP_AudioBuffer_SampleSize is an enumeration of the different audio sample + * sizes. + */ +typedef enum { + PP_AUDIOBUFFER_SAMPLESIZE_UNKNOWN = 0, + PP_AUDIOBUFFER_SAMPLESIZE_16_BITS = 2 +} PP_AudioBuffer_SampleSize; +/** + * @} + */ + +/** + * @addtogroup Interfaces + * @{ + */ +struct PPB_AudioBuffer_0_1 { + /** + * Determines if a resource is an AudioBuffer resource. + * + * @param[in] resource The PP_Resource to test. + * + * @return A PP_Bool with PP_TRUE if the given + * resource is an AudioBuffer resource or PP_FALSE otherwise. + */ + PP_Bool (*IsAudioBuffer)(PP_Resource resource); + /** + * Gets the timestamp of the audio buffer. + * + * @param[in] buffer A PP_Resource corresponding to an audio + * buffer resource. + * + * @return A PP_TimeDelta containing the timestamp of the audio + * buffer. Given in seconds since the start of the containing audio stream. + */ + PP_TimeDelta (*GetTimestamp)(PP_Resource buffer); + /** + * Sets the timestamp of the audio buffer. + * + * @param[in] buffer A PP_Resource corresponding to an audio + * buffer resource. + * @param[in] timestamp A PP_TimeDelta containing the timestamp + * of the audio buffer. Given in seconds since the start of the containing + * audio stream. + */ + void (*SetTimestamp)(PP_Resource buffer, PP_TimeDelta timestamp); + /** + * Gets the sample rate of the audio buffer. + * + * @param[in] buffer A PP_Resource corresponding to an audio + * buffer resource. + * + * @return The sample rate of the audio buffer. + */ + PP_AudioBuffer_SampleRate (*GetSampleRate)(PP_Resource buffer); + /** + * Gets the sample size of the audio buffer. + * + * @param[in] buffer A PP_Resource corresponding to an audio + * buffer resource. + * + * @return The sample size of the audio buffer. + */ + PP_AudioBuffer_SampleSize (*GetSampleSize)(PP_Resource buffer); + /** + * Gets the number of channels in the audio buffer. + * + * @param[in] buffer A PP_Resource corresponding to an audio + * buffer resource. + * + * @return The number of channels in the audio buffer. + */ + uint32_t (*GetNumberOfChannels)(PP_Resource buffer); + /** + * Gets the number of samples in the audio buffer. + * + * @param[in] buffer A PP_Resource corresponding to an audio + * buffer resource. + * + * @return The number of samples in the audio buffer. + * For example, at a sampling rate of 44,100 Hz in stereo audio, a buffer + * containing 4410 * 2 samples would have a duration of 100 milliseconds. + */ + uint32_t (*GetNumberOfSamples)(PP_Resource buffer); + /** + * Gets the data buffer containing the audio samples. + * + * @param[in] buffer A PP_Resource corresponding to an audio + * buffer resource. + * + * @return A pointer to the beginning of the data buffer. + */ + void* (*GetDataBuffer)(PP_Resource buffer); + /** + * Gets the size of the data buffer in bytes. + * + * @param[in] buffer A PP_Resource corresponding to an audio + * buffer resource. + * + * @return The size of the data buffer in bytes. + */ + uint32_t (*GetDataBufferSize)(PP_Resource buffer); +}; + +typedef struct PPB_AudioBuffer_0_1 PPB_AudioBuffer; +/** + * @} + */ + +/* ppb_audio_config.idl */ +/** + * @addtogroup Enums + * @{ + */ +/** + * This enumeration contains audio frame count constants. + * PP_AUDIOMINSAMPLEFRAMECOUNT is the minimum possible frame + * count. PP_AUDIOMAXSAMPLEFRAMECOUNT is the maximum possible + * frame count. + */ +enum { + PP_AUDIOMINSAMPLEFRAMECOUNT = 64, + PP_AUDIOMAXSAMPLEFRAMECOUNT = 32768 +}; + +/** + * PP_AudioSampleRate is an enumeration of the different audio sampling rates. + * PP_AUDIOSAMPLERATE_44100 is the sample rate used on CDs and + * PP_AUDIOSAMPLERATE_48000 is the sample rate used on DVDs and + * Digital Audio Tapes. + */ +typedef enum { + PP_AUDIOSAMPLERATE_NONE = 0, + PP_AUDIOSAMPLERATE_44100 = 44100, + PP_AUDIOSAMPLERATE_48000 = 48000 +} PP_AudioSampleRate; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_AudioSampleRate, 4); +/** + * @} + */ + +/** + * @addtogroup Interfaces + * @{ + */ +/** + * The PPB_AudioConfig interface contains pointers to several + * functions for establishing your audio configuration within the browser. + * This interface only supports 16-bit stereo output. + * + * Refer to the + * Audio + * chapter in the Developer's Guide for information on using this + * interface. + */ +struct PPB_AudioConfig_1_1 { + /** + * CreateStereo16bit() creates a 16 bit audio configuration resource. The + * sample_rate should be the result of calling + * RecommendSampleRate and sample_frame_count should + * be the result of calling RecommendSampleFrameCount. If the + * sample frame count or bit rate isn't supported, this function will fail and + * return a null resource. + * + * A single sample frame on a stereo device means one value for the left + * channel and one value for the right channel. + * + * Buffer layout for a stereo int16 configuration: + * int16_t *buffer16; + * buffer16[0] is the first left channel sample. + * buffer16[1] is the first right channel sample. + * buffer16[2] is the second left channel sample. + * buffer16[3] is the second right channel sample. + * ... + * buffer16[2 * (sample_frame_count - 1)] is the last left + * channel sample. + * buffer16[2 * (sample_frame_count - 1) + 1] is the last + * right channel sample. + * Data will always be in the native endian format of the platform. + * + * @param[in] instance A PP_Instance identifying one instance + * of a module. + * @param[in] sample_rate A PP_AudioSampleRate which is either + * PP_AUDIOSAMPLERATE_44100 or + * PP_AUDIOSAMPLERATE_48000. + * @param[in] sample_frame_count A uint32_t frame count returned + * from the RecommendSampleFrameCount function. + * + * @return A PP_Resource containing the + * PPB_Audio_Config if successful or a null resource if the + * sample frame count or bit rate are not supported. + */ + PP_Resource (*CreateStereo16Bit)(PP_Instance instance, + PP_AudioSampleRate sample_rate, + uint32_t sample_frame_count); + /** + * RecommendSampleFrameCount() returns the supported sample frame count + * closest to the requested count. The sample frame count determines the + * overall latency of audio. Since one "frame" is always buffered in advance, + * smaller frame counts will yield lower latency, but higher CPU utilization. + * + * Supported sample frame counts will vary by hardware and system (consider + * that the local system might be anywhere from a cell phone or a high-end + * audio workstation). Sample counts less than + * PP_AUDIOMINSAMPLEFRAMECOUNT and greater than + * PP_AUDIOMAXSAMPLEFRAMECOUNT are never supported on any + * system, but values in between aren't necessarily valid. This function + * will return a supported count closest to the requested frame count. + * + * RecommendSampleFrameCount() result is intended for audio output devices. + * + * @param[in] instance + * @param[in] sample_rate A PP_AudioSampleRate which is either + * PP_AUDIOSAMPLERATE_44100 or + * PP_AUDIOSAMPLERATE_48000. + * @param[in] requested_sample_frame_count A uint_32t requested + * frame count. + * + * @return A uint32_t containing the recommended sample frame + * count if successful. + */ + uint32_t (*RecommendSampleFrameCount)( + PP_Instance instance, + PP_AudioSampleRate sample_rate, + uint32_t requested_sample_frame_count); + /** + * IsAudioConfig() determines if the given resource is a + * PPB_Audio_Config. + * + * @param[in] resource A PP_Resource corresponding to an audio + * config resource. + * + * @return A PP_Bool containing PP_TRUE if the given + * resource is an AudioConfig resource, otherwise + * PP_FALSE. + */ + PP_Bool (*IsAudioConfig)(PP_Resource resource); + /** + * GetSampleRate() returns the sample rate for the given + * PPB_Audio_Config. + * + * @param[in] config A PP_Resource corresponding to a + * PPB_Audio_Config. + * + * @return A PP_AudioSampleRate containing sample rate or + * PP_AUDIOSAMPLERATE_NONE if the resource is invalid. + */ + PP_AudioSampleRate (*GetSampleRate)(PP_Resource config); + /** + * GetSampleFrameCount() returns the sample frame count for the given + * PPB_Audio_Config. + * + * @param[in] config A PP_Resource corresponding to an audio + * config resource. + * + * @return A uint32_t containing sample frame count or + * 0 if the resource is invalid. Refer to + * RecommendSampleFrameCount() for more on sample frame counts. + */ + uint32_t (*GetSampleFrameCount)(PP_Resource config); + /** + * RecommendSampleRate() returns the native sample rate that the browser + * is using in the backend. Applications that use the recommended sample + * rate will have potentially better latency and fidelity. The return value + * is intended for audio output devices. If the output sample rate cannot be + * determined, this function can return PP_AUDIOSAMPLERATE_NONE. + * + * @param[in] instance + * + * @return A uint32_t containing the recommended sample frame + * count if successful. + */ + PP_AudioSampleRate (*RecommendSampleRate)(PP_Instance instance); +}; + +typedef struct PPB_AudioConfig_1_1 PPB_AudioConfig; + +struct PPB_AudioConfig_1_0 { + PP_Resource (*CreateStereo16Bit)(PP_Instance instance, + PP_AudioSampleRate sample_rate, + uint32_t sample_frame_count); + uint32_t (*RecommendSampleFrameCount)( + PP_AudioSampleRate sample_rate, + uint32_t requested_sample_frame_count); + PP_Bool (*IsAudioConfig)(PP_Resource resource); + PP_AudioSampleRate (*GetSampleRate)(PP_Resource config); + uint32_t (*GetSampleFrameCount)(PP_Resource config); +}; +/** + * @} + */ + +/* ppb_audio_encoder.idl */ +/** + * @addtogroup Interfaces + * @{ + */ +/** + * Audio encoder interface. + * + * Typical usage: + * - Call Create() to create a new audio encoder resource. + * - Call GetSupportedProfiles() to determine which codecs and profiles are + * available. + * - Call Initialize() to initialize the encoder for a supported profile. + * - Call GetBuffer() to get an empty buffer and fill it in, or get an audio + * buffer from another resource, e.g. PPB_MediaStreamAudioTrack. + * - Call Encode() to push the audio buffer to the encoder. If an external + * buffer is pushed, wait for completion to recycle the buffer. + * - Call GetBitstreamBuffer() continuously (waiting for each previous call to + * complete) to pull encoded buffers from the encoder. + * - Call RecycleBitstreamBuffer() after consuming the data in the bitstream + * buffer. + * - To destroy the encoder, the plugin should release all of its references to + * it. Any pending callbacks will abort before the encoder is destroyed. + * + * Available audio codecs vary by platform. + * All: opus. + */ +struct PPB_AudioEncoder_0_1 { /* dev */ + /** + * Creates a new audio encoder resource. + * + * @param[in] instance A PP_Instance identifying the instance + * with the audio encoder. + * + * @return A PP_Resource corresponding to an audio encoder if + * successful or 0 otherwise. + */ + PP_Resource (*Create)(PP_Instance instance); + /** + * Determines if the given resource is an audio encoder. + * + * @param[in] resource A PP_Resource identifying a resource. + * + * @return PP_TRUE if the resource is a + * PPB_AudioEncoder, PP_FALSE if the resource is + * invalid or some other type. + */ + PP_Bool (*IsAudioEncoder)(PP_Resource resource); + /** + * Gets an array of supported audio encoder profiles. + * These can be used to choose a profile before calling Initialize(). + * + * @param[in] audio_encoder A PP_Resource identifying the audio + * encoder. + * @param[in] output A PP_ArrayOutput to receive the supported + * PP_AudioProfileDescription structs. + * @param[in] callback A PP_CompletionCallback to be called upon + * completion. + * + * @return If >= 0, the number of supported profiles returned, otherwise an + * error code from pp_errors.h. + */ + int32_t (*GetSupportedProfiles)(PP_Resource audio_encoder, + struct PP_ArrayOutput output, + struct PP_CompletionCallback callback); + /** + * Initializes an audio encoder resource. The plugin should call Initialize() + * successfully before calling any of the functions below. + * + * @param[in] audio_encoder A PP_Resource identifying the audio + * encoder. + * @param[in] channels The number of audio channels to encode. + * @param[in] input_sampling_rate The sampling rate of the input audio buffer. + * @param[in] input_sample_size The sample size of the input audio buffer. + * @param[in] output_profile A PP_AudioProfile specifying the + * codec profile of the encoded output stream. + * @param[in] initial_bitrate The initial bitrate for the encoder. + * @param[in] acceleration A PP_HardwareAcceleration specifying + * whether to use a hardware accelerated or a software implementation. + * @param[in] callback A PP_CompletionCallback to be called upon + * completion. + * + * @return An int32_t containing an error code from pp_errors.h. + * Returns PP_ERROR_NOTSUPPORTED if audio encoding is not available, or the + * requested codec profile is not supported. + */ + int32_t (*Initialize)(PP_Resource audio_encoder, + uint32_t channels, + PP_AudioBuffer_SampleRate input_sample_rate, + PP_AudioBuffer_SampleSize input_sample_size, + PP_AudioProfile output_profile, + uint32_t initial_bitrate, + PP_HardwareAcceleration acceleration, + struct PP_CompletionCallback callback); + /** + * Gets the number of audio samples per channel that audio buffers must + * contain in order to be processed by the encoder. This will be the number of + * samples per channels contained in buffers returned by GetBuffer(). + * + * @param[in] audio_encoder A PP_Resource identifying the audio + * encoder. + * @return An int32_t containing the number of samples required, or an error + * code from pp_errors.h. + * Returns PP_ERROR_FAILED if Initialize() has not successfully completed. + */ + int32_t (*GetNumberOfSamples)(PP_Resource audio_encoder); + /** + * Gets a blank audio buffer (with metadata given by the Initialize() + * call) which can be filled with audio data and passed to the encoder. + * + * @param[in] audio_encoder A PP_Resource identifying the audio + * encoder. + * @param[out] audio_buffer A blank PPB_AudioBuffer resource. + * @param[in] callback A PP_CompletionCallback to be called upon + * completion. + * + * @return An int32_t containing an error code from pp_errors.h. + * Returns PP_ERROR_FAILED if Initialize() has not successfully completed. + */ + int32_t (*GetBuffer)(PP_Resource audio_encoder, + PP_Resource* audio_buffer, + struct PP_CompletionCallback callback); + /** + * Encodes an audio buffer. + * + * @param[in] audio_encoder A PP_Resource identifying the audio + * encoder. + * @param[in] audio_buffer The PPB_AudioBuffer to be encoded. + * @param[in] callback A PP_CompletionCallback to be called upon + * completion. Plugins that pass PPB_AudioBuffer resources owned + * by other resources should wait for completion before reusing them. + * + * @return An int32_t containing an error code from pp_errors.h. + * Returns PP_ERROR_FAILED if Initialize() has not successfully completed. + */ + int32_t (*Encode)(PP_Resource audio_encoder, + PP_Resource audio_buffer, + struct PP_CompletionCallback callback); + /** + * Gets the next encoded bitstream buffer from the encoder. + * + * @param[in] audio_encoder A PP_Resource identifying the audio + * encoder. + * @param[out] bitstream_buffer A PP_BitstreamBuffer containing + * encoded audio data. + * @param[in] callback A PP_CompletionCallback to be called upon + * completion. The plugin can call GetBitstreamBuffer from the callback in + * order to continuously "pull" bitstream buffers from the encoder. + * + * @return An int32_t containing an error code from pp_errors.h. + * Returns PP_ERROR_FAILED if Initialize() has not successfully completed. + * Returns PP_ERROR_INPROGRESS if a prior call to GetBitstreamBuffer() has + * not completed. + */ + int32_t (*GetBitstreamBuffer)( + PP_Resource audio_encoder, + struct PP_AudioBitstreamBuffer* bitstream_buffer, + struct PP_CompletionCallback callback); + /** + * Recycles a bitstream buffer back to the encoder. + * + * @param[in] audio_encoder A PP_Resource identifying the audio + * encoder. + * @param[in] bitstream_buffer A PP_BitstreamBuffer that is no + * longer needed by the plugin. + */ + void (*RecycleBitstreamBuffer)( + PP_Resource audio_encoder, + const struct PP_AudioBitstreamBuffer* bitstream_buffer); + /** + * Requests a change to the encoding bitrate. This is only a request, + * fulfilled on a best-effort basis. + * + * @param[in] audio_encoder A PP_Resource identifying the audio + * encoder. + * @param[in] bitrate The requested new bitrate, in bits per second. + */ + void (*RequestBitrateChange)(PP_Resource audio_encoder, uint32_t bitrate); + /** + * Closes the audio encoder, and cancels any pending encodes. Any pending + * callbacks will still run, reporting PP_ERROR_ABORTED . It is + * not valid to call any encoder functions after a call to this method. + * Note: Destroying the audio encoder closes it implicitly, + * so you are not required to call Close(). + * + * @param[in] audio_encoder A PP_Resource identifying the audio + * encoder. + */ + void (*Close)(PP_Resource audio_encoder); +}; +/** + * @} + */ + +/* ppb_compositor.idl */ +/** + * @addtogroup Interfaces + * @{ + */ +/** + * Defines the PPB_Compositor interface. Used for setting + * PPB_CompositorLayer layers to the Chromium compositor for + * compositing. This allows a plugin to combine different sources of visual + * data efficiently, such as PPB_ImageData images and + * OpenGL textures. See also PPB_CompositorLayer for more + * information. + * This interface is still in development (Dev API status) and may change, + * so is only supported on Dev channel and Canary currently. + * + * Example usage from plugin code: + * + * Setup: + * @code + * PP_Resource compositor; + * compositor = compositor_if->Create(instance); + * instance_if->BindGraphics(instance, compositor); + * @endcode + * + * Setup layer stack: + * @code + * PP_Resource color_layer = compositor_if->AddLayer(compositor); + * PP_Resource texture_layer = compositor_if->AddLayer(compositor); + * @endcode + * + * Present one frame: + * layer_if->SetColor(color_layer, 255, 255, 0, 255, PP_MakeSize(400, 400)); + * PP_CompletionCallback release_callback = { + * TextureReleasedCallback, 0, PP_COMPLETIONCALLBACK_FLAG_NONE, + * }; + * layer_if->SetTexture(texture_layer, graphics3d, texture_id, + * PP_MakeSize(300, 300), release_callback); + * + * PP_CompletionCallback callback = { + * DidFinishCommitLayersCallback, + * (void*) texture_id, + * PP_COMPLETIONCALLBACK_FLAG_NONE, + * }; + * compositor_if->CommitLayers(compositor, callback); + * @endcode + * + * release callback + * void ReleaseCallback(int32_t result, void* user_data) { + * if (result == PP_OK) { + * uint32_t texture_id = (uint32_t) user_data; + * // reuse the texture or delete it. + * } + * } + * + * Shutdown: + * @code + * core->ReleaseResource(color_layer); + * core->ReleaseResource(texture_layer); + * core->ReleaseResource(compositor); + * @endcode + */ +struct PPB_Compositor_0_1 { /* dev */ + /** + * Determines if a resource is a compositor resource. + * + * @param[in] resource The PP_Resource to test. + * + * @return A PP_Bool with PP_TRUE if the given + * resource is a compositor resource or PP_FALSE otherwise. + */ + PP_Bool (*IsCompositor)(PP_Resource resource); + /** + * Creates a Compositor resource. + * + * @param[in] instance A PP_Instance identifying one instance + * of a module. + * + * @return A PP_Resource containing the compositor resource if + * successful or 0 otherwise. + */ + PP_Resource (*Create)(PP_Instance instance); + /** + * Creates a new PPB_CompositorLayer and adds it to the end + * of the layer stack. A PP_Resource containing the layer is + * returned. It is uninitialized, SetColor(), + * SetTexture or SetImage should be used to + * initialize it. The layer will appear above other pre-existing layers. + * If ResetLayers is called or the PPB_Compositor is + * released, the returned layer will be invalidated, and any further calls on + * the layer will return PP_ERROR_BADRESOURCE. + * + * param[in] compositor A PP_Resource corresponding to + * a compositor layer resource. + * + * @return A PP_Resource containing the compositor layer + * resource if successful or 0 otherwise. + */ + PP_Resource (*AddLayer)(PP_Resource compositor); + /** + * Commits layers added by AddLayer() to the chromium compositor. + * + * param[in] compositor A PP_Resource corresponding to + * a compositor layer resource. + * @param[in] cc A PP_CompletionCallback to be called when + * layers have been represented on screen. + * + * @return An int32_t containing a result code from pp_errors.h. + */ + int32_t (*CommitLayers)(PP_Resource compositor, + struct PP_CompletionCallback cc); + /** + * Resets layers added by AddLayer(). + * + * param[in] compositor A PP_Resource corresponding to + * a compositor layer resource. + * + * @return An int32_t containing a result code from pp_errors.h. + */ + int32_t (*ResetLayers)(PP_Resource compositor); +}; +/** + * @} + */ + +/* ppb_compositor_layer.idl */ +/** + * @addtogroup Enums + * @{ + */ +/** + * This enumeration contains blend modes used for computing the result pixels + * based on the source RGBA values in layers with the RGBA values that are + * already in the destination framebuffer. + * alpha_src, color_src: source alpha and color. + * alpha_dst, color_dst: destination alpha and color (before compositing). + * Below descriptions of the blend modes assume the colors are pre-multiplied. + * This interface is still in development (Dev API status) and may change, + * so is only supported on Dev channel and Canary currently. + */ +typedef enum { + /** + * No blending, copy source to the destination directly. + */ + PP_BLENDMODE_NONE, + /** + * Source is placed over the destination. + * Resulting alpha = alpha_src + alpha_dst - alpha_src * alpha_dst + * Resulting color = color_src + color_dst * (1 - alpha_src) + */ + PP_BLENDMODE_SRC_OVER, + /** + * The last blend mode. + */ + PP_BLENDMODE_LAST = PP_BLENDMODE_SRC_OVER +} PP_BlendMode; +/** + * @} + */ + +/** + * @addtogroup Interfaces + * @{ + */ +/** + * Defines the PPB_CompositorLayer interface. It is used by + * PPB_Compositor. + */ +struct PPB_CompositorLayer_0_2 { /* dev */ + /** + * Determines if a resource is a compositor layer resource. + * + * @param[in] resource The PP_Resource to test. + * + * @return A PP_Bool with PP_TRUE if the given + * resource is a compositor layer resource or PP_FALSE + * otherwise. + */ + PP_Bool (*IsCompositorLayer)(PP_Resource resource); + /** + * Sets the color of a solid color layer. If the layer is uninitialized, + * it will initialize the layer first, and then set its color. + * If the layer has been initialized to another kind of layer, the layer will + * not be changed, and PP_ERROR_BADARGUMENT will be returned. + * + * param[in] layer A PP_Resource corresponding to a compositor + * layer resource. + * param[in] red A float for the red color component. It will be + * clamped to [0, 1]. + * param[in] green A float for the green color component. It will + * be clamped to [0, 1]. + * param[in] blue A float for the blue color component. It will + * be clamped to [0, 1]. + * param[in] alpha A float for the alpha color component. It will + * be clamped to [0, 1]. + * param[in] size A PP_Size for the size of the layer before + * transform. + * + * @return An int32_t containing a result code from pp_errors.h. + */ + int32_t (*SetColor)(PP_Resource layer, + float red, + float green, + float blue, + float alpha, + const struct PP_Size* size); + /** + * Sets the texture of a texture layer. If the layer is uninitialized, + * it will initialize the layer first, and then set its texture. + * The source rect will be set to ((0, 0), (1, 1)). If the layer has been + * initialized to another kind of layer, the layer will not be changed, + * and PP_ERROR_BADARGUMENT will be returned. + * + * param[in] layer A PP_Resource corresponding to a compositor + * layer resource. + * param[in] context A PP_Resource corresponding to a graphics + * 3d resource which owns the GL texture. + * param[in] target GL texture target (GL_TEXTURE_2D, etc). + * param[in] texture A GL texture object id. + * param[in] size A PP_Size for the size of the layer before + * transform. + * param[in] cc A PP_CompletionCallback to be called when + * the texture is released by Chromium compositor. + * + * @return An int32_t containing a result code from pp_errors.h. + */ + int32_t (*SetTexture)(PP_Resource layer, + PP_Resource context, + uint32_t target, + uint32_t texture, + const struct PP_Size* size, + struct PP_CompletionCallback cc); + /** + * Sets the image of an image layer. If the layer is uninitialized, + * it will initialize the layer first, and then set its image. + * The layer size will be set to the image's size. The source rect will be set + * to the full image. If the layer has been initialized to another kind of + * layer, the layer will not be changed, and PP_ERROR_BADARGUMENT + * will be returned. + * + * param[in] layer A PP_Resource corresponding to a compositor + * layer resource. + * param[in] image_data A PP_Resource corresponding to + * an image data resource. + * param[in] size A PP_Size for the size of the layer before + * transform. If NULL, the image's size will be used. + * param[in] cc A PP_CompletionCallback to be called when + * the image data is released by Chromium compositor. + * + * @return An int32_t containing a result code from pp_errors.h. + */ + int32_t (*SetImage)(PP_Resource layer, + PP_Resource image_data, + const struct PP_Size* size, + struct PP_CompletionCallback cc); + /** + * Sets a clip rectangle for a compositor layer. The Chromium compositor + * applies a transform matrix on the layer first, and then clips the layer + * with the rectangle. + * + * param[in] layer A PP_Resource corresponding to a compositor + * layer resource. + * param[in] rect The clip rectangle. The origin is top-left corner of + * the plugin. + * + * @return An int32_t containing a result code from pp_errors.h. + */ + int32_t (*SetClipRect)(PP_Resource layer, const struct PP_Rect* rect); + /** + * Sets a transform matrix which is used to composite the layer. + * + * param[in] layer A PP_Resource corresponding to a compositor + * layer resource. + * param[in] matrix A float array with 16 elements. The matrix is + * column major. The default transform matrix is an identity matrix. + * + * @return An int32_t containing a result code from pp_errors.h. + */ + int32_t (*SetTransform)(PP_Resource layer, const float matrix[16]); + /** + * Sets the opacity value which will be applied to the layer. The effective + * value of each pixel is computed as: + * + * if (premult_alpha) + * pixel.rgb = pixel.rgb * opacity; + * pixel.a = pixel.a * opactiy; + * + * param[in] layer A PP_Resource corresponding to a compositor + * layer resource. + * param[in] opacity A float for the opacity value, The default + * value is 1.0f. + * + * @return An int32_t containing a result code from pp_errors.h. + */ + int32_t (*SetOpacity)(PP_Resource layer, float opacity); + /** + * Sets the blend mode which is used to composite the layer. + * + * param[in] layer A PP_Resource corresponding to a compositor + * layer resource. + * param[in] mode A PP_BlendMode. The default mode is + * PP_BLENDMODE_SRC_OVER. + * + * @return An int32_t containing a result code from pp_errors.h. + */ + int32_t (*SetBlendMode)(PP_Resource layer, PP_BlendMode mode); + /** + * Sets a source rectangle for a texture layer or an image layer. + * + * param[in] layer A PP_Resource corresponding to a compositor + * layer resource. + * param[in] rect A PP_FloatRect for an area of the source to + * consider. For a texture layer, rect is in uv coordinates. For an image + * layer, rect is in pixels. If the rect is beyond the dimensions of the + * texture or image, PP_ERROR_BADARGUMENT will be returned. + * If the layer size does not match the source rect size, bilinear scaling + * will be used. + * + * @return An int32_t containing a result code from pp_errors.h. + */ + int32_t (*SetSourceRect)(PP_Resource layer, const struct PP_FloatRect* rect); + /** + * Sets the premultiplied alpha for an texture layer. + * + * param[in] layer A PP_Resource corresponding to a compositor + * layer resource. + * param[in] premult A PP_Bool with PP_TRUE if + * pre-multiplied alpha is used. + * + * @return An int32_t containing a result code from pp_errors.h. + */ + int32_t (*SetPremultipliedAlpha)(PP_Resource layer, PP_Bool premult); +}; + +struct PPB_CompositorLayer_0_1 { /* dev */ + PP_Bool (*IsCompositorLayer)(PP_Resource resource); + int32_t (*SetColor)(PP_Resource layer, + float red, + float green, + float blue, + float alpha, + const struct PP_Size* size); + int32_t (*SetTexture)(PP_Resource layer, + PP_Resource context, + uint32_t texture, + const struct PP_Size* size, + struct PP_CompletionCallback cc); + int32_t (*SetImage)(PP_Resource layer, + PP_Resource image_data, + const struct PP_Size* size, + struct PP_CompletionCallback cc); + int32_t (*SetClipRect)(PP_Resource layer, const struct PP_Rect* rect); + int32_t (*SetTransform)(PP_Resource layer, const float matrix[16]); + int32_t (*SetOpacity)(PP_Resource layer, float opacity); + int32_t (*SetBlendMode)(PP_Resource layer, PP_BlendMode mode); + int32_t (*SetSourceRect)(PP_Resource layer, const struct PP_FloatRect* rect); + int32_t (*SetPremultipliedAlpha)(PP_Resource layer, PP_Bool premult); +}; +/** + * @} + */ + +/* ppb_console.idl */ +/** + * @addtogroup Enums + * @{ + */ +typedef enum { + PP_LOGLEVEL_TIP = 0, + PP_LOGLEVEL_LOG = 1, + PP_LOGLEVEL_WARNING = 2, + PP_LOGLEVEL_ERROR = 3 +} PP_LogLevel; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_LogLevel, 4); +/** + * @} + */ + +/** + * @addtogroup Interfaces + * @{ + */ +struct PPB_Console_1_0 { + /** + * Logs the given message to the JavaScript console associated with the + * given plugin instance with the given logging level. The name of the plugin + * issuing the log message will be automatically prepended to the message. + * The value may be any type of Var. + */ + void (*Log)(PP_Instance instance, PP_LogLevel level, struct PP_Var value); + /** + * Logs a message to the console with the given source information rather + * than using the internal PPAPI plugin name. The name must be a string var. + * + * The regular log function will automatically prepend the name of your + * plugin to the message as the "source" of the message. Some plugins may + * wish to override this. For example, if your plugin is a Python + * interpreter, you would want log messages to contain the source .py file + * doing the log statement rather than have "python" show up in the console. + */ + void (*LogWithSource)(PP_Instance instance, + PP_LogLevel level, + struct PP_Var source, + struct PP_Var value); +}; + +typedef struct PPB_Console_1_0 PPB_Console; +/** + * @} + */ + +/* ppb_core.idl */ +/** + * @addtogroup Interfaces + * @{ + */ +/** + * The PPB_Core interface contains pointers to functions related + * to memory management, time, and threads on the browser. + * + */ +struct PPB_Core_1_0 { + /** + * + * AddRefResource() adds a reference to a resource. + * + * @param[in] config A PP_Resource corresponding to a + * resource. + */ + void (*AddRefResource)(PP_Resource resource); + /** + * ReleaseResource() removes a reference from a resource. + * + * @param[in] config A PP_Resource corresponding to a + * resource. + */ + void (*ReleaseResource)(PP_Resource resource); + /** + * GetTime() returns the "wall clock time" according to the + * browser. + * + * @return A PP_Time containing the "wall clock time" according + * to the browser. + */ + PP_Time (*GetTime)(void); + /** + * GetTimeTicks() returns the "tick time" according to the browser. + * This clock is used by the browser when passing some event times to the + * module (e.g. using the PP_InputEvent::time_stamp_seconds + * field). It is not correlated to any actual wall clock time + * (like GetTime()). Because of this, it will not run change if the user + * changes their computer clock. + * + * @return A PP_TimeTicks containing the "tick time" according + * to the browser. + */ + PP_TimeTicks (*GetTimeTicks)(void); + /** + * CallOnMainThread() schedules work to be executed on the main module thread + * after the specified delay. The delay may be 0 to specify a call back as + * soon as possible. + * + * The result parameter will just be passed as the second + * argument to the callback. Many applications won't need this, but it allows + * a module to emulate calls of some callbacks which do use this value. + * + * Note: CallOnMainThread, even when used from the main + * thread with a delay of 0 milliseconds, will never directly invoke the + * callback. Even in this case, the callback will be scheduled + * asynchronously. + * + * Note: If the browser is shutting down or if the module + * has no instances, then the callback function may not be called. + * + * @param[in] delay_in_milliseconds An int32_t delay in milliseconds. + * @param[in] callback A PP_CompletionCallback callback function + * that the browser will call after the specified delay. + * @param[in] result An int32_t that the browser will pass to the given + * PP_CompletionCallback. + */ + void (*CallOnMainThread)(int32_t delay_in_milliseconds, + struct PP_CompletionCallback callback, + int32_t result); + /** + * IsMainThread() returns true if the current thread is the main pepper + * thread. + * + * This function is useful for implementing sanity checks, and deciding if + * dispatching using CallOnMainThread() is required. + * + * @return A PP_Bool containing PP_TRUE if the + * current thread is the main pepper thread, otherwise PP_FALSE. + */ + PP_Bool (*IsMainThread)(void); +}; + +typedef struct PPB_Core_1_0 PPB_Core; +/** + * @} + */ + +/* ppb_file_io.idl */ +/** + * @addtogroup Enums + * @{ + */ +/** + * The PP_FileOpenFlags enum contains file open constants. + */ +typedef enum { + /** Requests read access to a file. */ + PP_FILEOPENFLAG_READ = 1 << 0, + /** + * Requests write access to a file. May be combined with + * PP_FILEOPENFLAG_READ to request read and write access. + */ + PP_FILEOPENFLAG_WRITE = 1 << 1, + /** + * Requests that the file be created if it does not exist. If the file + * already exists, then this flag is ignored unless + * PP_FILEOPENFLAG_EXCLUSIVE was also specified, in which case + * FileIO::Open() will fail. + */ + PP_FILEOPENFLAG_CREATE = 1 << 2, + /** + * Requests that the file be truncated to length 0 if it exists and is a + * regular file. PP_FILEOPENFLAG_WRITE must also be specified. + */ + PP_FILEOPENFLAG_TRUNCATE = 1 << 3, + /** + * Requests that the file is created when this flag is combined with + * PP_FILEOPENFLAG_CREATE. If this flag is specified, and the + * file already exists, then the FileIO::Open() call will fail. + */ + PP_FILEOPENFLAG_EXCLUSIVE = 1 << 4, + /** + * Requests write access to a file, but writes will always occur at the end of + * the file. Mututally exclusive with PP_FILEOPENFLAG_WRITE. + * + * This is only supported in version 1.2 (Chrome 29) and later. + */ + PP_FILEOPENFLAG_APPEND = 1 << 5 +} PP_FileOpenFlags; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_FileOpenFlags, 4); +/** + * @} + */ + +/** + * @addtogroup Interfaces + * @{ + */ +/** + * The PPB_FileIO struct is used to operate on a regular file + * (PP_FileType_Regular). + */ +struct PPB_FileIO_1_1 { + /** + * Create() creates a new FileIO object. + * + * @param[in] instance A PP_Instance identifying the instance + * with the file. + * + * @return A PP_Resource corresponding to a FileIO if + * successful or 0 if the module is invalid. + */ + PP_Resource (*Create)(PP_Instance instance); + /** + * IsFileIO() determines if the provided resource is a FileIO. + * + * @param[in] resource A PP_Resource corresponding to a FileIO. + * + * @return PP_TRUE if the resource is a + * PPB_FileIO, PP_FALSE if the resource is + * invalid or some type other than PPB_FileIO. + */ + PP_Bool (*IsFileIO)(PP_Resource resource); + /** + * Open() opens the specified regular file for I/O according to the given + * open flags, which is a bit-mask of the PP_FileOpenFlags + * values. Upon success, the corresponding file is classified as "in use" + * by this FileIO object until such time as the FileIO object is closed + * or destroyed. + * + * @param[in] file_io A PP_Resource corresponding to a + * FileIO. + * @param[in] file_ref A PP_Resource corresponding to a file + * reference. + * @param[in] open_flags A bit-mask of the PP_FileOpenFlags + * values. + * @param[in] callback A PP_CompletionCallback to be called upon + * completion of Open(). + * + * @return An int32_t containing an error code from pp_errors.h. + */ + int32_t (*Open)(PP_Resource file_io, + PP_Resource file_ref, + int32_t open_flags, + struct PP_CompletionCallback callback); + /** + * Query() queries info about the file opened by this FileIO object. The + * FileIO object must be opened, and there must be no other operations + * pending. + * + * @param[in] file_io A PP_Resource corresponding to a + * FileIO. + * @param[out] info The PP_FileInfo structure representing all + * information about the file. + * @param[in] callback A PP_CompletionCallback to be called upon + * completion of Query(). info must remain valid until after the + * callback runs. If you pass a blocking callback, info must + * remain valid until after Query() returns. + * + * @return An int32_t containing an error code from pp_errors.h. + * PP_ERROR_FAILED will be returned if the file isn't opened, and + * PP_ERROR_INPROGRESS will be returned if there is another operation pending. + */ + int32_t (*Query)(PP_Resource file_io, + struct PP_FileInfo* info, + struct PP_CompletionCallback callback); + /** + * Touch() Updates time stamps for the file opened by this FileIO object. + * This function will fail if the FileIO object has not been opened. The + * FileIO object must be opened, and there must be no other operations + * pending. + * + * @param[in] file_io A PP_Resource corresponding to a file + * FileIO. + * @param[in] last_access_time The last time the FileIO was accessed. + * @param[in] last_modified_time The last time the FileIO was modified. + * @param[in] callback A PP_CompletionCallback to be called upon + * completion of Touch(). + * + * @return An int32_t containing an error code from pp_errors.h. + * PP_ERROR_FAILED will be returned if the file isn't opened, and + * PP_ERROR_INPROGRESS will be returned if there is another operation pending. + */ + int32_t (*Touch)(PP_Resource file_io, + PP_Time last_access_time, + PP_Time last_modified_time, + struct PP_CompletionCallback callback); + /** + * Read() reads from an offset in the file. The size of the buffer must be + * large enough to hold the specified number of bytes to read. This function + * might perform a partial read, meaning all the requested bytes + * might not be returned, even if the end of the file has not been reached. + * The FileIO object must have been opened with read access. + * + * ReadToArray() is preferred to Read() when doing asynchronous operations. + * + * @param[in] file_io A PP_Resource corresponding to a file + * FileIO. + * @param[in] offset The offset into the file. + * @param[in] buffer The buffer to hold the specified number of bytes read. + * @param[in] bytes_to_read The number of bytes to read from + * offset. + * @param[in] callback A PP_CompletionCallback to be called upon + * completion of Read(). buffer must remain valid until after + * the callback runs. If you pass a blocking callback, buffer + * must remain valid until after Read() returns. + * + * @return The number of bytes read or an error code from + * pp_errors.h. If the return value is 0, then end-of-file was + * reached. It is valid to call Read() multiple times with a completion + * callback to queue up parallel reads from the file, but pending reads + * cannot be interleaved with other operations. + */ + int32_t (*Read)(PP_Resource file_io, + int64_t offset, + char* buffer, + int32_t bytes_to_read, + struct PP_CompletionCallback callback); + /** + * Write() writes to an offset in the file. This function might perform a + * partial write. The FileIO object must have been opened with write access. + * + * @param[in] file_io A PP_Resource corresponding to a file + * FileIO. + * @param[in] offset The offset into the file. + * @param[in] buffer The buffer to hold the specified number of bytes read. + * @param[in] bytes_to_write The number of bytes to write to + * offset. + * @param[in] callback A PP_CompletionCallback to be called upon + * completion of Write(). + * + * @return The number of bytes written or an error code from + * pp_errors.h. If the return value is 0, then end-of-file was + * reached. It is valid to call Write() multiple times with a completion + * callback to queue up parallel writes to the file, but pending writes + * cannot be interleaved with other operations. + */ + int32_t (*Write)(PP_Resource file_io, + int64_t offset, + const char* buffer, + int32_t bytes_to_write, + struct PP_CompletionCallback callback); + /** + * SetLength() sets the length of the file. If the file size is extended, + * then the extended area of the file is zero-filled. The FileIO object must + * have been opened with write access and there must be no other operations + * pending. + * + * @param[in] file_io A PP_Resource corresponding to a file + * FileIO. + * @param[in] length The length of the file to be set. + * @param[in] callback A PP_CompletionCallback to be called upon + * completion of SetLength(). + * + * @return An int32_t containing an error code from pp_errors.h. + * PP_ERROR_FAILED will be returned if the file isn't opened, and + * PP_ERROR_INPROGRESS will be returned if there is another operation pending. + */ + int32_t (*SetLength)(PP_Resource file_io, + int64_t length, + struct PP_CompletionCallback callback); + /** + * Flush() flushes changes to disk. This call can be very expensive! The + * FileIO object must have been opened with write access and there must be no + * other operations pending. + * + * @param[in] file_io A PP_Resource corresponding to a file + * FileIO. + * @param[in] callback A PP_CompletionCallback to be called upon + * completion of Flush(). + * + * @return An int32_t containing an error code from pp_errors.h. + * PP_ERROR_FAILED will be returned if the file isn't opened, and + * PP_ERROR_INPROGRESS will be returned if there is another operation pending. + */ + int32_t (*Flush)(PP_Resource file_io, struct PP_CompletionCallback callback); + /** + * Close() cancels any IO that may be pending, and closes the FileIO object. + * Any pending callbacks will still run, reporting + * PP_ERROR_ABORTED if pending IO was interrupted. It is not + * valid to call Open() again after a call to this method. + * Note: If the FileIO object is destroyed, and it is still + * open, then it will be implicitly closed, so you are not required to call + * Close(). + * + * @param[in] file_io A PP_Resource corresponding to a file + * FileIO. + */ + void (*Close)(PP_Resource file_io); + /** + * ReadToArray() reads from an offset in the file. A PP_ArrayOutput must be + * provided so that output will be stored in its allocated buffer. This + * function might perform a partial read. The FileIO object must have been + * opened with read access. + * + * @param[in] file_io A PP_Resource corresponding to a file + * FileIO. + * @param[in] offset The offset into the file. + * @param[in] max_read_length The maximum number of bytes to read from + * offset. + * @param[in] output A PP_ArrayOutput to hold the output data. + * @param[in] callback A PP_CompletionCallback to be called upon + * completion of ReadToArray(). + * + * @return The number of bytes read or an error code from + * pp_errors.h. If the return value is 0, then end-of-file was + * reached. It is valid to call ReadToArray() multiple times with a completion + * callback to queue up parallel reads from the file, but pending reads + * cannot be interleaved with other operations. + */ + int32_t (*ReadToArray)(PP_Resource file_io, + int64_t offset, + int32_t max_read_length, + struct PP_ArrayOutput* output, + struct PP_CompletionCallback callback); +}; + +typedef struct PPB_FileIO_1_1 PPB_FileIO; + +struct PPB_FileIO_1_0 { + PP_Resource (*Create)(PP_Instance instance); + PP_Bool (*IsFileIO)(PP_Resource resource); + int32_t (*Open)(PP_Resource file_io, + PP_Resource file_ref, + int32_t open_flags, + struct PP_CompletionCallback callback); + int32_t (*Query)(PP_Resource file_io, + struct PP_FileInfo* info, + struct PP_CompletionCallback callback); + int32_t (*Touch)(PP_Resource file_io, + PP_Time last_access_time, + PP_Time last_modified_time, + struct PP_CompletionCallback callback); + int32_t (*Read)(PP_Resource file_io, + int64_t offset, + char* buffer, + int32_t bytes_to_read, + struct PP_CompletionCallback callback); + int32_t (*Write)(PP_Resource file_io, + int64_t offset, + const char* buffer, + int32_t bytes_to_write, + struct PP_CompletionCallback callback); + int32_t (*SetLength)(PP_Resource file_io, + int64_t length, + struct PP_CompletionCallback callback); + int32_t (*Flush)(PP_Resource file_io, struct PP_CompletionCallback callback); + void (*Close)(PP_Resource file_io); +}; +/** + * @} + */ + +/* ppb_file_ref.idl */ +/** + * @addtogroup Enums + * @{ + */ +/** + * The PP_MakeDirectoryFlags enum contains flags used to control + * behavior of PPB_FileRef.MakeDirectory(). + */ +typedef enum { + PP_MAKEDIRECTORYFLAG_NONE = 0 << 0, + /** Requests that ancestor directories are created if they do not exist. */ + PP_MAKEDIRECTORYFLAG_WITH_ANCESTORS = 1 << 0, + /** + * Requests that the PPB_FileRef.MakeDirectory() call fails if the directory + * already exists. + */ + PP_MAKEDIRECTORYFLAG_EXCLUSIVE = 1 << 1 +} PP_MakeDirectoryFlags; +/** + * @} + */ + +/** + * @addtogroup Interfaces + * @{ + */ +/** + * The PPB_FileRef struct represents a "weak pointer" to a file in + * a file system. This struct contains a PP_FileSystemType + * identifier and a file path string. + */ +struct PPB_FileRef_1_2 { + /** + * Create() creates a weak pointer to a file in the given file system. File + * paths are POSIX style. + * + * @param[in] resource A PP_Resource corresponding to a file + * system. + * @param[in] path A path to the file. Must begin with a '/' character. + * + * @return A PP_Resource corresponding to a file reference if + * successful or 0 if the path is malformed. + */ + PP_Resource (*Create)(PP_Resource file_system, const char* path); + /** + * IsFileRef() determines if the provided resource is a file reference. + * + * @param[in] resource A PP_Resource corresponding to a file + * reference. + * + * @return PP_TRUE if the resource is a + * PPB_FileRef, PP_FALSE if the resource is + * invalid or some type other than PPB_FileRef. + */ + PP_Bool (*IsFileRef)(PP_Resource resource); + /** + * GetFileSystemType() returns the type of the file system. + * + * @param[in] file_ref A PP_Resource corresponding to a file + * reference. + * + * @return A PP_FileSystemType with the file system type if + * valid or PP_FILESYSTEMTYPE_INVALID if the provided resource + * is not a valid file reference. + */ + PP_FileSystemType (*GetFileSystemType)(PP_Resource file_ref); + /** + * GetName() returns the name of the file. + * + * @param[in] file_ref A PP_Resource corresponding to a file + * reference. + * + * @return A PP_Var containing the name of the file. The value + * returned by this function does not include any path components (such as + * the name of the parent directory, for example). It is just the name of the + * file. Use GetPath() to get the full file path. + */ + struct PP_Var (*GetName)(PP_Resource file_ref); + /** + * GetPath() returns the absolute path of the file. + * + * @param[in] file_ref A PP_Resource corresponding to a file + * reference. + * + * @return A PP_Var containing the absolute path of the file. + * This function fails if the file system type is + * PP_FileSystemType_External. + */ + struct PP_Var (*GetPath)(PP_Resource file_ref); + /** + * GetParent() returns the parent directory of this file. If + * file_ref points to the root of the filesystem, then the root + * is returned. + * + * @param[in] file_ref A PP_Resource corresponding to a file + * reference. + * + * @return A PP_Resource containing the parent directory of the + * file. This function fails if the file system type is + * PP_FileSystemType_External. + */ + PP_Resource (*GetParent)(PP_Resource file_ref); + /** + * MakeDirectory() makes a new directory in the file system according to the + * given make_directory_flags, which is a bit-mask of the + * PP_MakeDirectoryFlags values. It is not valid to make a + * directory in the external file system. + * + * @param[in] file_ref A PP_Resource corresponding to a file + * reference. + * @param[in] make_directory_flags A bit-mask of the + * PP_MakeDirectoryFlags values. + * @param[in] callback A PP_CompletionCallback to be called upon + * completion of MakeDirectory(). + * + * @return An int32_t containing an error code from pp_errors.h. + */ + int32_t (*MakeDirectory)(PP_Resource directory_ref, + int32_t make_directory_flags, + struct PP_CompletionCallback callback); + /** + * Touch() Updates time stamps for a file. You must have write access to the + * file if it exists in the external filesystem. + * + * @param[in] file_ref A PP_Resource corresponding to a file + * reference. + * @param[in] last_access_time The last time the file was accessed. + * @param[in] last_modified_time The last time the file was modified. + * @param[in] callback A PP_CompletionCallback to be called upon + * completion of Touch(). + * + * @return An int32_t containing an error code from pp_errors.h. + */ + int32_t (*Touch)(PP_Resource file_ref, + PP_Time last_access_time, + PP_Time last_modified_time, + struct PP_CompletionCallback callback); + /** + * Delete() deletes a file or directory. If file_ref refers to + * a directory, then the directory must be empty. It is an error to delete a + * file or directory that is in use. It is not valid to delete a file in + * the external file system. + * + * @param[in] file_ref A PP_Resource corresponding to a file + * reference. + * @param[in] callback A PP_CompletionCallback to be called upon + * completion of Delete(). + * + * @return An int32_t containing an error code from pp_errors.h. + */ + int32_t (*Delete)(PP_Resource file_ref, + struct PP_CompletionCallback callback); + /** + * Rename() renames a file or directory. Arguments file_ref and + * new_file_ref must both refer to files in the same file + * system. It is an error to rename a file or directory that is in use. It + * is not valid to rename a file in the external file system. + * + * @param[in] file_ref A PP_Resource corresponding to a file + * reference. + * @param[in] new_file_ref A PP_Resource corresponding to a new + * file reference. + * @param[in] callback A PP_CompletionCallback to be called upon + * completion of Rename(). + * + * @return An int32_t containing an error code from pp_errors.h. + */ + int32_t (*Rename)(PP_Resource file_ref, + PP_Resource new_file_ref, + struct PP_CompletionCallback callback); + /** + * Query() queries info about a file or directory. You must have access to + * read this file or directory if it exists in the external filesystem. + * + * @param[in] file_ref A PP_Resource corresponding to a file + * reference. + * @param[out] info A pointer to a PP_FileInfo which will be + * populated with information about the file or directory. + * @param[in] callback A PP_CompletionCallback to be called upon + * completion of Query(). + * + * @return An int32_t containing an error code from pp_errors.h. + */ + int32_t (*Query)(PP_Resource file_ref, + struct PP_FileInfo* info, + struct PP_CompletionCallback callback); + /** + * ReadDirectoryEntries() reads all entries in a directory. + * + * @param[in] file_ref A PP_Resource corresponding to a directory + * reference. + * @param[in] output An output array which will receive + * PP_DirectoryEntry objects on success. + * @param[in] callback A PP_CompletionCallback to run on + * completion. + * + * @return An int32_t containing an error code from pp_errors.h. + */ + int32_t (*ReadDirectoryEntries)(PP_Resource file_ref, + struct PP_ArrayOutput output, + struct PP_CompletionCallback callback); +}; + +typedef struct PPB_FileRef_1_2 PPB_FileRef; + +struct PPB_FileRef_1_0 { + PP_Resource (*Create)(PP_Resource file_system, const char* path); + PP_Bool (*IsFileRef)(PP_Resource resource); + PP_FileSystemType (*GetFileSystemType)(PP_Resource file_ref); + struct PP_Var (*GetName)(PP_Resource file_ref); + struct PP_Var (*GetPath)(PP_Resource file_ref); + PP_Resource (*GetParent)(PP_Resource file_ref); + int32_t (*MakeDirectory)(PP_Resource directory_ref, + PP_Bool make_ancestors, + struct PP_CompletionCallback callback); + int32_t (*Touch)(PP_Resource file_ref, + PP_Time last_access_time, + PP_Time last_modified_time, + struct PP_CompletionCallback callback); + int32_t (*Delete)(PP_Resource file_ref, + struct PP_CompletionCallback callback); + int32_t (*Rename)(PP_Resource file_ref, + PP_Resource new_file_ref, + struct PP_CompletionCallback callback); +}; + +struct PPB_FileRef_1_1 { + PP_Resource (*Create)(PP_Resource file_system, const char* path); + PP_Bool (*IsFileRef)(PP_Resource resource); + PP_FileSystemType (*GetFileSystemType)(PP_Resource file_ref); + struct PP_Var (*GetName)(PP_Resource file_ref); + struct PP_Var (*GetPath)(PP_Resource file_ref); + PP_Resource (*GetParent)(PP_Resource file_ref); + int32_t (*MakeDirectory)(PP_Resource directory_ref, + PP_Bool make_ancestors, + struct PP_CompletionCallback callback); + int32_t (*Touch)(PP_Resource file_ref, + PP_Time last_access_time, + PP_Time last_modified_time, + struct PP_CompletionCallback callback); + int32_t (*Delete)(PP_Resource file_ref, + struct PP_CompletionCallback callback); + int32_t (*Rename)(PP_Resource file_ref, + PP_Resource new_file_ref, + struct PP_CompletionCallback callback); + int32_t (*Query)(PP_Resource file_ref, + struct PP_FileInfo* info, + struct PP_CompletionCallback callback); + int32_t (*ReadDirectoryEntries)(PP_Resource file_ref, + struct PP_ArrayOutput output, + struct PP_CompletionCallback callback); +}; +/** + * @} + */ + +/* ppb_file_system.idl */ +/** + * @addtogroup Interfaces + * @{ + */ +/** + * The PPB_FileSystem struct identifies the file system type + * associated with a file. + */ +struct PPB_FileSystem_1_0 { + /** Create() creates a file system object of the given type. + * + * @param[in] instance A PP_Instance identifying the instance + * with the file. + * @param[in] type A file system type as defined by + * PP_FileSystemType enum (except PP_FILESYSTEMTYPE_ISOLATED, + * which is currently not supported). + * @return A PP_Resource corresponding to a file system if + * successful. + */ + PP_Resource (*Create)(PP_Instance instance, PP_FileSystemType type); + /** + * IsFileSystem() determines if the provided resource is a file system. + * + * @param[in] resource A PP_Resource corresponding to a file + * system. + * + * @return PP_TRUE if the resource is a + * PPB_FileSystem, PP_FALSE if the resource is + * invalid or some type other than PPB_FileSystem. + */ + PP_Bool (*IsFileSystem)(PP_Resource resource); + /** + * Open() opens the file system. A file system must be opened before running + * any other operation on it. + * + * @param[in] file_system A PP_Resource corresponding to a file + * system. + * + * @param[in] expected_size The expected size of the file system. Note that + * this does not request quota; to do that, you must either invoke + * requestQuota from JavaScript: + * http://www.html5rocks.com/en/tutorials/file/filesystem/#toc-requesting-quota + * or set the unlimitedStorage permission for Chrome Web Store apps: + * http://code.google.com/chrome/extensions/manifest.html#permissions + * + * @param[in] callback A PP_CompletionCallback to be called upon + * completion of Open(). + * + * @return An int32_t containing an error code from pp_errors.h. + */ + int32_t (*Open)(PP_Resource file_system, + int64_t expected_size, + struct PP_CompletionCallback callback); + /** + * GetType() returns the type of the provided file system. + * + * @param[in] file_system A PP_Resource corresponding to a file + * system. + * + * @return A PP_FileSystemType with the file system type if + * valid or PP_FILESYSTEMTYPE_INVALID if the provided resource + * is not a valid file system. It is valid to call this function even before + * Open() completes. + */ + PP_FileSystemType (*GetType)(PP_Resource file_system); +}; + +typedef struct PPB_FileSystem_1_0 PPB_FileSystem; +/** + * @} + */ + +/* ppb_fullscreen.idl */ +/** + * @addtogroup Interfaces + * @{ + */ +/** + * The PPB_Fullscreen interface is implemented by the browser. + * This interface provides a way of checking the current screen mode and + * toggling fullscreen mode. + */ +struct PPB_Fullscreen_1_0 { + /** + * IsFullscreen() checks whether the module instance is currently in + * fullscreen mode. + * + * @param[in] instance A PP_Instance identifying one instance + * of a module. + * + * @return PP_TRUE if the module instance is in fullscreen mode, + * PP_FALSE if the module instance is not in fullscreen mode. + */ + PP_Bool (*IsFullscreen)(PP_Instance instance); + /** + * SetFullscreen() switches the module instance to and from fullscreen + * mode. + * + * The transition to and from fullscreen mode is asynchronous. During the + * transition, IsFullscreen() will return the previous value and + * no 2D or 3D device can be bound. The transition ends at DidChangeView() + * when IsFullscreen() returns the new value. You might receive other + * DidChangeView() calls while in transition. + * + * The transition to fullscreen mode can only occur while the browser is + * processing a user gesture, even if PP_TRUE is returned. + * + * @param[in] instance A PP_Instance identifying one instance + * of a module. + * @param[in] fullscreen PP_TRUE to enter fullscreen mode, or + * PP_FALSE to exit fullscreen mode. + * + * @return PP_TRUE on success or PP_FALSE on + * failure. + */ + PP_Bool (*SetFullscreen)(PP_Instance instance, PP_Bool fullscreen); + /** + * GetScreenSize() gets the size of the screen in pixels. The module instance + * will be resized to this size when SetFullscreen() is called to enter + * fullscreen mode. + * + * @param[in] instance A PP_Instance identifying one instance + * of a module. + * @param[out] size The size of the entire screen in pixels. + * + * @return PP_TRUE on success or PP_FALSE on + * failure. + */ + PP_Bool (*GetScreenSize)(PP_Instance instance, struct PP_Size* size); +}; + +typedef struct PPB_Fullscreen_1_0 PPB_Fullscreen; +/** + * @} + */ + +/* ppb_gamepad.idl */ +/** + * @addtogroup Structs + * @{ + */ +/** + * The data for one gamepad device. + */ +struct PP_GamepadSampleData { + /** + * Number of valid elements in the |axes| array. + */ + uint32_t axes_length; + /** + * Normalized values for the axes, indices valid up to |axes_length|-1. Axis + * values range from -1..1, and are in order of "importance". + */ + float axes[16]; + /** + * Number of valid elements in the |buttons| array. + */ + uint32_t buttons_length; + /** + * Normalized values for the buttons, indices valid up to |buttons_length| + * - 1. Button values range from 0..1, and are in order of importance. + */ + float buttons[32]; + /** + * Monotonically increasing value that is incremented when the data have + * been updated. + */ + double timestamp; + /** + * Identifier for the type of device/manufacturer. + */ + uint16_t id[128]; + /** + * Is there a gamepad connected at this index? If this is false, no other + * data in this structure is valid. + */ + PP_Bool connected; + /* Padding to make the struct the same size between 64 and 32. */ + int8_t unused_pad_[4]; +}; +PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_GamepadSampleData, 472); + +/** + * The data for all gamepads connected to the system. + */ +struct PP_GamepadsSampleData { + /** + * Number of valid elements in the |items| array. + */ + uint32_t length; + /* Padding to make the struct the same size between 64 and 32. */ + int8_t unused_pad_[4]; + /** + * Data for an individual gamepad device connected to the system. + */ + struct PP_GamepadSampleData items[4]; +}; +PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_GamepadsSampleData, 1896); +/** + * @} + */ + +/** + * @addtogroup Interfaces + * @{ + */ +/** + * The PPB_Gamepad interface allows retrieving data from + * gamepad/joystick devices that are connected to the system. + */ +struct PPB_Gamepad_1_0 { + /** + * Samples the current state of the available gamepads. + */ + void (*Sample)(PP_Instance instance, struct PP_GamepadsSampleData* data); +}; + +typedef struct PPB_Gamepad_1_0 PPB_Gamepad; +/** + * @} + */ + +/* ppb_graphics_2d.idl */ +/** + * @addtogroup Interfaces + * @{ + */ +/** + * PPB_Graphics2D defines the interface for a 2D graphics context. + */ +struct PPB_Graphics2D_1_2 { + /** + * Create() creates a 2D graphics context. The returned graphics context will + * not be bound to the module instance on creation (call BindGraphics() on + * the module instance to bind the returned graphics context to the module + * instance). + * + * @param[in] instance The module instance. + * @param[in] size The size of the graphic context. + * @param[in] is_always_opaque Set the is_always_opaque flag to + * PP_TRUE if you know that you will be painting only opaque + * data to this context. This option will disable blending when compositing + * the module with the web page, which might give higher performance on some + * computers. + * + * If you set is_always_opaque, your alpha channel should always + * be set to 0xFF or there may be painting artifacts. The alpha values + * overwrite the destination alpha values without blending when + * is_always_opaque is true. + * + * @return A PP_Resource containing the 2D graphics context if + * successful or 0 if unsuccessful. + */ + PP_Resource (*Create)(PP_Instance instance, + const struct PP_Size* size, + PP_Bool is_always_opaque); + /** + * IsGraphics2D() determines if the given resource is a valid + * Graphics2D. + * + * @param[in] resource A Graphics2D context resource. + * + * @return PP_TRUE if the given resource is a valid Graphics2D, + * PP_FALSE if it is an invalid resource or is a resource of + * another type. + */ + PP_Bool (*IsGraphics2D)(PP_Resource resource); + /** + * Describe() retrieves the configuration for the given graphics context, + * filling the given values (which must not be NULL). + * + * @param[in] resource The 2D Graphics resource. + * @param[in,out] size The size of the 2D graphics context in the browser. + * @param[in,out] is_always_opaque Identifies whether only opaque data + * will be painted. + * + * @return Returns PP_TRUE on success or PP_FALSE if + * the resource is invalid. The output parameters will be set to 0 on a + * PP_FALSE. + */ + PP_Bool (*Describe)(PP_Resource graphics_2d, + struct PP_Size* size, + PP_Bool* is_always_opaque); + /** + * PaintImageData() enqueues a paint of the given image into the context. + * This function has no effect until you call Flush() As a result, what + * counts is the contents of the bitmap when you call Flush(), not when + * you call this function. + * + * The provided image will be placed at top_left from the top + * left of the context's internal backing store. Then the pixels contained + * in src_rect will be copied into the backing store. This + * means that the rectangle being painted will be at src_rect + * offset by top_left. + * + * The src_rect is specified in the coordinate system of the + * image being painted, not the context. For the common case of copying the + * entire image, you may specify an empty src_rect. + * + * The painted area of the source bitmap must fall entirely within the + * context. Attempting to paint outside of the context will result in an + * error. However, the source bitmap may fall outside the context, as long + * as the src_rect subset of it falls entirely within the + * context. + * + * There are two methods most modules will use for painting. The first + * method is to generate a new ImageData and then paint it. In + * this case, you'll set the location of your painting to + * top_left and set src_rect to NULL. + * The second is that you're generating small invalid regions out of a larger + * bitmap representing your entire instance. In this case, you would set the + * location of your image to (0,0) and then set src_rect to the + * pixels you changed. + * + * @param[in] resource The 2D Graphics resource. + * @param[in] image The ImageData to be painted. + * @param[in] top_left A Point representing the + * top_left location where the ImageData will be + * painted. + * @param[in] src_rect The rectangular area where the ImageData + * will be painted. + */ + void (*PaintImageData)(PP_Resource graphics_2d, + PP_Resource image_data, + const struct PP_Point* top_left, + const struct PP_Rect* src_rect); + /** + * Scroll() enqueues a scroll of the context's backing store. This + * function has no effect until you call Flush(). The data within the + * provided clipping rectangle will be shifted by (dx, dy) pixels. + * + * This function will result in some exposed region which will have undefined + * contents. The module should call PaintImageData() on these exposed regions + * to give the correct contents. + * + * The scroll can be larger than the area of the clipping rectangle, which + * means the current image will be scrolled out of the rectangle. This + * scenario is not an error but will result in a no-op. + * + * @param[in] graphics_2d The 2D Graphics resource. + * @param[in] clip The clipping rectangle. + * @param[in] amount The amount the area in the clipping rectangle will + * shifted. + */ + void (*Scroll)(PP_Resource graphics_2d, + const struct PP_Rect* clip_rect, + const struct PP_Point* amount); + /** + * ReplaceContents() provides a slightly more efficient way to paint the + * entire module's image. Normally, calling PaintImageData() requires that + * the browser copy the pixels out of the image and into the graphics + * context's backing store. This function replaces the graphics context's + * backing store with the given image, avoiding the copy. + * + * The new image must be the exact same size as this graphics context. If the + * new image uses a different image format than the browser's native bitmap + * format (use PPB_ImageData.GetNativeImageDataFormat() to + * retrieve the format), then a conversion will be done inside the browser + * which may slow the performance a little bit. + * + * Note: The new image will not be painted until you call + * Flush(). + * + * After this call, you should take care to release your references to the + * image. If you paint to the image after ReplaceContents(), there is the + * possibility of significant painting artifacts because the page might use + * partially-rendered data when copying out of the backing store. + * + * In the case of an animation, you will want to allocate a new image for the + * next frame. It is best if you wait until the flush callback has executed + * before allocating this bitmap. This gives the browser the option of + * caching the previous backing store and handing it back to you (assuming + * the sizes match). In the optimal case, this means no bitmaps are allocated + * during the animation, and the backing store and "front buffer" (which the + * plugin is painting into) are just being swapped back and forth. + * + * @param[in] graphics_2d The 2D Graphics resource. + * @param[in] image The ImageData to be painted. + */ + void (*ReplaceContents)(PP_Resource graphics_2d, PP_Resource image_data); + /** + * Flush() flushes any enqueued paint, scroll, and replace commands to the + * backing store. This function actually executes the updates, and causes a + * repaint of the webpage, assuming this graphics context is bound to a module + * instance. + * + * Flush() runs in asynchronous mode. Specify a callback function and the + * argument for that callback function. The callback function will be + * executed on the calling thread when the image has been painted to the + * screen. While you are waiting for a flush callback, additional calls to + * Flush() will fail. + * + * Because the callback is executed (or thread unblocked) only when the + * instance's image is actually on the screen, this function provides + * a way to rate limit animations. By waiting until the image is on the + * screen before painting the next frame, you can ensure you're not + * flushing 2D graphics faster than the screen can be updated. + * + * Unbound contexts + * If the context is not bound to a module instance, you will + * still get a callback. The callback will execute after Flush() returns + * to avoid reentrancy. The callback will not wait until anything is + * painted to the screen because there will be nothing on the screen. The + * timing of this callback is not guaranteed and may be deprioritized by + * the browser because it is not affecting the user experience. + * + * Off-screen instances + * If the context is bound to an instance that is currently not visible (for + * example, scrolled out of view) it will behave like the "unbound context" + * case. + * + * Detaching a context + * If you detach a context from a module instance, any pending flush + * callbacks will be converted into the "unbound context" case. + * + * Released contexts + * A callback may or may not get called even if you have released all + * of your references to the context. This scenario can occur if there are + * internal references to the context suggesting it has not been internally + * destroyed (for example, if it is still bound to an instance) or due to + * other implementation details. As a result, you should be careful to + * check that flush callbacks are for the context you expect and that + * you're capable of handling callbacks for unreferenced contexts. + * + * Shutdown + * If a module instance is removed when a flush is pending, the + * callback will not be executed. + * + * @param[in] graphics_2d The 2D Graphics resource. + * @param[in] callback A CompletionCallback to be called when + * the image has been painted on the screen. + * + * @return Returns PP_OK on success or + * PP_ERROR_BADRESOURCE if the graphics context is invalid, + * PP_ERROR_BADARGUMENT if the callback is null and flush is + * being called from the main thread of the module, or + * PP_ERROR_INPROGRESS if a flush is already pending that has + * not issued its callback yet. In the failure case, nothing will be updated + * and no callback will be scheduled. + */ + int32_t (*Flush)(PP_Resource graphics_2d, + struct PP_CompletionCallback callback); + /** + * SetScale() sets the scale factor that will be applied when painting the + * graphics context onto the output device. Typically, if rendering at device + * resolution is desired, the context would be created with the width and + * height scaled up by the view's GetDeviceScale and SetScale called with a + * scale of 1.0 / GetDeviceScale(). For example, if the view resource passed + * to DidChangeView has a rectangle of (w=200, h=100) and a device scale of + * 2.0, one would call Create with a size of (w=400, h=200) and then call + * SetScale with 0.5. One would then treat each pixel in the context as a + * single device pixel. + * + * @param[in] resource A Graphics2D context resource. + * @param[in] scale The scale to apply when painting. + * + * @return Returns PP_TRUE on success or PP_FALSE if + * the resource is invalid or the scale factor is 0 or less. + */ + PP_Bool (*SetScale)(PP_Resource resource, float scale); + /*** + * GetScale() gets the scale factor that will be applied when painting the + * graphics context onto the output device. + * + * @param[in] resource A Graphics2D context resource. + * + * @return Returns the scale factor for the graphics context. If the resource + * is not a valid Graphics2D context, this will return 0.0. + */ + float (*GetScale)(PP_Resource resource); + /** + * SetLayerTransform() sets a transformation factor that will be applied for + * the current graphics context displayed on the output device. If both + * SetScale and SetLayerTransform will be used, they are going to get combined + * for the final result. + * + * This function has no effect until you call Flush(). + * + * @param[in] scale The scale to be applied. + * @param[in] origin The origin of the scale. + * @param[in] translate The translation to be applied. + * + * @return Returns PP_TRUE on success or PP_FALSE + * if the resource is invalid or the scale factor is 0 or less. + */ + PP_Bool (*SetLayerTransform)(PP_Resource resource, + float scale, + const struct PP_Point* origin, + const struct PP_Point* translate); +}; + +typedef struct PPB_Graphics2D_1_2 PPB_Graphics2D; + +struct PPB_Graphics2D_1_0 { + PP_Resource (*Create)(PP_Instance instance, + const struct PP_Size* size, + PP_Bool is_always_opaque); + PP_Bool (*IsGraphics2D)(PP_Resource resource); + PP_Bool (*Describe)(PP_Resource graphics_2d, + struct PP_Size* size, + PP_Bool* is_always_opaque); + void (*PaintImageData)(PP_Resource graphics_2d, + PP_Resource image_data, + const struct PP_Point* top_left, + const struct PP_Rect* src_rect); + void (*Scroll)(PP_Resource graphics_2d, + const struct PP_Rect* clip_rect, + const struct PP_Point* amount); + void (*ReplaceContents)(PP_Resource graphics_2d, PP_Resource image_data); + int32_t (*Flush)(PP_Resource graphics_2d, + struct PP_CompletionCallback callback); +}; + +struct PPB_Graphics2D_1_1 { + PP_Resource (*Create)(PP_Instance instance, + const struct PP_Size* size, + PP_Bool is_always_opaque); + PP_Bool (*IsGraphics2D)(PP_Resource resource); + PP_Bool (*Describe)(PP_Resource graphics_2d, + struct PP_Size* size, + PP_Bool* is_always_opaque); + void (*PaintImageData)(PP_Resource graphics_2d, + PP_Resource image_data, + const struct PP_Point* top_left, + const struct PP_Rect* src_rect); + void (*Scroll)(PP_Resource graphics_2d, + const struct PP_Rect* clip_rect, + const struct PP_Point* amount); + void (*ReplaceContents)(PP_Resource graphics_2d, PP_Resource image_data); + int32_t (*Flush)(PP_Resource graphics_2d, + struct PP_CompletionCallback callback); + PP_Bool (*SetScale)(PP_Resource resource, float scale); + float (*GetScale)(PP_Resource resource); +}; +/** + * @} + */ + +/* ppb_graphics_3d.idl */ +/* Add 3D graphics enums */ +#include "ppapi/c/pp_graphics_3d.h" + +/** + * @addtogroup Interfaces + * @{ + */ +/** + * PPB_Graphics3D defines the interface for a 3D graphics context. + * Example usage from plugin code: + * + * Setup: + * @code + * PP_Resource context; + * int32_t attribs[] = {PP_GRAPHICS3DATTRIB_WIDTH, 800, + * PP_GRAPHICS3DATTRIB_HEIGHT, 800, + * PP_GRAPHICS3DATTRIB_NONE}; + * context = g3d->Create(instance, 0, attribs); + * inst->BindGraphics(instance, context); + * @endcode + * + * Present one frame: + * @code + * PP_CompletionCallback callback = { + * DidFinishSwappingBuffers, 0, PP_COMPLETIONCALLBACK_FLAG_NONE, + * }; + * gles2->Clear(context, GL_COLOR_BUFFER_BIT); + * g3d->SwapBuffers(context, callback); + * @endcode + * + * Shutdown: + * @code + * core->ReleaseResource(context); + * @endcode + */ +struct PPB_Graphics3D_1_0 { + /** + * GetAttribMaxValue() retrieves the maximum supported value for the + * given attribute. This function may be used to check if a particular + * attribute value is supported before attempting to create a context. + * + * @param[in] instance The module instance. + * @param[in] attribute The attribute for which maximum value is queried. + * Attributes that can be queried for include: + * - PP_GRAPHICS3DATTRIB_ALPHA_SIZE + * - PP_GRAPHICS3DATTRIB_BLUE_SIZE + * - PP_GRAPHICS3DATTRIB_GREEN_SIZE + * - PP_GRAPHICS3DATTRIB_RED_SIZE + * - PP_GRAPHICS3DATTRIB_DEPTH_SIZE + * - PP_GRAPHICS3DATTRIB_STENCIL_SIZE + * - PP_GRAPHICS3DATTRIB_SAMPLES + * - PP_GRAPHICS3DATTRIB_SAMPLE_BUFFERS + * - PP_GRAPHICS3DATTRIB_WIDTH + * - PP_GRAPHICS3DATTRIB_HEIGHT + * @param[out] value The maximum supported value for attribute + * + * @return Returns PP_TRUE on success or the following on error: + * - PP_ERROR_BADRESOURCE if instance is invalid + * - PP_ERROR_BADARGUMENT if attribute is invalid + * or value is 0 + */ + int32_t (*GetAttribMaxValue)(PP_Resource instance, + int32_t attribute, + int32_t* value); + /** + * Create() creates and initializes a 3D rendering context. + * The returned context is off-screen to start with. It must be attached to + * a plugin instance using PPB_Instance::BindGraphics to draw + * on the web page. + * + * @param[in] instance The module instance. + * + * @param[in] share_context The 3D context with which the created context + * would share resources. If share_context is not 0, then all + * shareable data, as defined by the client API (note that for OpenGL and + * OpenGL ES, shareable data excludes texture objects named 0) will be shared + * by share_context, all other contexts share_context + * already shares with, and the newly created context. An arbitrary number of + * PPB_Graphics3D can share data in this fashion. + * + * @param[in] attrib_list specifies a list of attributes for the context. + * It is a list of attribute name-value pairs in which each attribute is + * immediately followed by the corresponding desired value. The list is + * terminated with PP_GRAPHICS3DATTRIB_NONE. + * The attrib_list may be 0 or empty (first attribute is + * PP_GRAPHICS3DATTRIB_NONE). If an attribute is not + * specified in attrib_list, then the default value is used + * (it is said to be specified implicitly). + * Attributes for the context are chosen according to an attribute-specific + * criteria. Attributes can be classified into two categories: + * - AtLeast: The attribute value in the returned context meets or exceeds + * the value specified in attrib_list. + * - Exact: The attribute value in the returned context is equal to + * the value specified in attrib_list. + * + * Attributes that can be specified in attrib_list include: + * - PP_GRAPHICS3DATTRIB_ALPHA_SIZE: + * Category: AtLeast Default: 0. + * - PP_GRAPHICS3DATTRIB_BLUE_SIZE: + * Category: AtLeast Default: 0. + * - PP_GRAPHICS3DATTRIB_GREEN_SIZE: + * Category: AtLeast Default: 0. + * - PP_GRAPHICS3DATTRIB_RED_SIZE: + * Category: AtLeast Default: 0. + * - PP_GRAPHICS3DATTRIB_DEPTH_SIZE: + * Category: AtLeast Default: 0. + * - PP_GRAPHICS3DATTRIB_STENCIL_SIZE: + * Category: AtLeast Default: 0. + * - PP_GRAPHICS3DATTRIB_SAMPLES: + * Category: AtLeast Default: 0. + * - PP_GRAPHICS3DATTRIB_SAMPLE_BUFFERS: + * Category: AtLeast Default: 0. + * - PP_GRAPHICS3DATTRIB_WIDTH: + * Category: Exact Default: 0. + * - PP_GRAPHICS3DATTRIB_HEIGHT: + * Category: Exact Default: 0. + * - PP_GRAPHICS3DATTRIB_SWAP_BEHAVIOR: + * Category: Exact Default: Implementation defined. + * + * @return A PP_Resource containing the 3D graphics context if + * successful or 0 if unsuccessful. + */ + PP_Resource (*Create)(PP_Instance instance, + PP_Resource share_context, + const int32_t attrib_list[]); + /** + * IsGraphics3D() determines if the given resource is a valid + * Graphics3D context. + * + * @param[in] resource A Graphics3D context resource. + * + * @return PP_TRUE if the given resource is a valid Graphics3D, + * PP_FALSE if it is an invalid resource or is a resource of + * another type. + */ + PP_Bool (*IsGraphics3D)(PP_Resource resource); + /** + * GetAttribs() retrieves the value for each attribute in + * attrib_list. + * + * @param[in] context The 3D graphics context. + * @param[in,out] attrib_list The list of attributes that are queried. + * attrib_list has the same structure as described for + * PPB_Graphics3D::Create. It is both input and output + * structure for this function. All attributes specified in + * PPB_Graphics3D::Create can be queried for. + * + * @return Returns PP_OK on success or: + * - PP_ERROR_BADRESOURCE if context is invalid + * - PP_ERROR_BADARGUMENT if attrib_list is 0 or any attribute + * in the attrib_list is not a valid attribute. + * + * Example usage: To get the values for rgb bits in the + * color buffer, this function must be called as following: + * @code + * int attrib_list[] = {PP_GRAPHICS3DATTRIB_RED_SIZE, 0, + * PP_GRAPHICS3DATTRIB_GREEN_SIZE, 0, + * PP_GRAPHICS3DATTRIB_BLUE_SIZE, 0, + * PP_GRAPHICS3DATTRIB_NONE}; + * GetAttribs(context, attrib_list); + * int red_bits = attrib_list[1]; + * int green_bits = attrib_list[3]; + * int blue_bits = attrib_list[5]; + * @endcode + */ + int32_t (*GetAttribs)(PP_Resource context, int32_t attrib_list[]); + /** + * SetAttribs() sets the values for each attribute in + * attrib_list. + * + * @param[in] context The 3D graphics context. + * @param[in] attrib_list The list of attributes whose values need to be set. + * attrib_list has the same structure as described for + * PPB_Graphics3D::Create. + * Attributes that can be specified are: + * - PP_GRAPHICS3DATTRIB_SWAP_BEHAVIOR + * + * @return Returns PP_OK on success or: + * - PP_ERROR_BADRESOURCE if context is invalid. + * - PP_ERROR_BADARGUMENT if attrib_list is 0 or + * any attribute in the attrib_list is not a valid attribute. + */ + int32_t (*SetAttribs)(PP_Resource context, const int32_t attrib_list[]); + /** + * GetError() returns the current state of the given 3D context. + * + * The recoverable error conditions that have no side effect are + * detected and returned immediately by all functions in this interface. + * In addition the implementation may get into a fatal state while + * processing a command. In this case the application must destroy the + * context and reinitialize client API state and objects to continue + * rendering. + * + * Note that the same error code is also returned in the SwapBuffers callback. + * It is recommended to handle error in the SwapBuffers callback because + * GetError is synchronous. This function may be useful in rare cases where + * drawing a frame is expensive and you want to verify the result of + * ResizeBuffers before attempting to draw a frame. + * + * @param[in] The 3D graphics context. + * @return Returns: + * - PP_OK if no error + * - PP_ERROR_NOMEMORY + * - PP_ERROR_CONTEXT_LOST + */ + int32_t (*GetError)(PP_Resource context); + /** + * ResizeBuffers() resizes the backing surface for context. + * + * If the surface could not be resized due to insufficient resources, + * PP_ERROR_NOMEMORY error is returned on the next + * SwapBuffers callback. + * + * @param[in] context The 3D graphics context. + * @param[in] width The width of the backing surface. + * @param[in] height The height of the backing surface. + * @return Returns PP_OK on success or: + * - PP_ERROR_BADRESOURCE if context is invalid. + * - PP_ERROR_BADARGUMENT if the value specified for + * width or height is less than zero. + */ + int32_t (*ResizeBuffers)(PP_Resource context, int32_t width, int32_t height); + /** + * SwapBuffers() makes the contents of the color buffer available for + * compositing. This function has no effect on off-screen surfaces - ones not + * bound to any plugin instance. The contents of ancillary buffers are always + * undefined after calling SwapBuffers. The contents of the color + * buffer are undefined if the value of the + * PP_GRAPHICS3DATTRIB_SWAP_BEHAVIOR attribute of context is not + * PP_GRAPHICS3DATTRIB_BUFFER_PRESERVED. + * + * SwapBuffers runs in asynchronous mode. Specify a callback + * function and the argument for that callback function. The callback function + * will be executed on the calling thread after the color buffer has been + * composited with rest of the html page. While you are waiting for a + * SwapBuffers callback, additional calls to SwapBuffers will fail. + * + * Because the callback is executed (or thread unblocked) only when the + * plugin's current state is actually on the screen, this function provides a + * way to rate limit animations. By waiting until the image is on the screen + * before painting the next frame, you can ensure you're not generating + * updates faster than the screen can be updated. + * + * SwapBuffers performs an implicit flush operation on context. + * If the context gets into an unrecoverable error condition while + * processing a command, the error code will be returned as the argument + * for the callback. The callback may return the following error codes: + * - PP_ERROR_NOMEMORY + * - PP_ERROR_CONTEXT_LOST + * Note that the same error code may also be obtained by calling GetError. + * + * @param[in] context The 3D graphics context. + * @param[in] callback The callback that will executed when + * SwapBuffers completes. + * + * @return Returns PP_OK on success or: + * - PP_ERROR_BADRESOURCE if context is invalid. + * - PP_ERROR_BADARGUMENT if callback is invalid. + * + */ + int32_t (*SwapBuffers)(PP_Resource context, + struct PP_CompletionCallback callback); +}; + +typedef struct PPB_Graphics3D_1_0 PPB_Graphics3D; +/** + * @} + */ + +/* ppb_net_address.idl */ +/** + * @addtogroup Enums + * @{ + */ +/** + * Network address family types. + */ +typedef enum { + /** + * The address family is unspecified. + */ + PP_NETADDRESS_FAMILY_UNSPECIFIED = 0, + /** + * The Internet Protocol version 4 (IPv4) address family. + */ + PP_NETADDRESS_FAMILY_IPV4 = 1, + /** + * The Internet Protocol version 6 (IPv6) address family. + */ + PP_NETADDRESS_FAMILY_IPV6 = 2 +} PP_NetAddress_Family; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_NetAddress_Family, 4); +/** + * @} + */ + +/** + * @addtogroup Structs + * @{ + */ +/** + * All members are expressed in network byte order. + */ +struct PP_NetAddress_IPv4 { + /** + * Port number. + */ + uint16_t port; + /** + * IPv4 address. + */ + uint8_t addr[4]; +}; +PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_NetAddress_IPv4, 6); + +/** + * All members are expressed in network byte order. + */ +struct PP_NetAddress_IPv6 { + /** + * Port number. + */ + uint16_t port; + /** + * IPv6 address. + */ + uint8_t addr[16]; +}; +PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_NetAddress_IPv6, 18); +/** + * @} + */ + +/** + * @addtogroup Interfaces + * @{ + */ +/** + * The PPB_NetAddress interface provides operations on network + * addresses. + */ +struct PPB_NetAddress_1_0 { + /** + * Creates a PPB_NetAddress resource with the specified IPv4 + * address. + * + * @param[in] instance A PP_Instance identifying one instance of + * a module. + * @param[in] ipv4_addr An IPv4 address. + * + * @return A PP_Resource representing the same address as + * ipv4_addr or 0 on failure. + */ + PP_Resource (*CreateFromIPv4Address)( + PP_Instance instance, + const struct PP_NetAddress_IPv4* ipv4_addr); + /** + * Creates a PPB_NetAddress resource with the specified IPv6 + * address. + * + * @param[in] instance A PP_Instance identifying one instance of + * a module. + * @param[in] ipv6_addr An IPv6 address. + * + * @return A PP_Resource representing the same address as + * ipv6_addr or 0 on failure. + */ + PP_Resource (*CreateFromIPv6Address)( + PP_Instance instance, + const struct PP_NetAddress_IPv6* ipv6_addr); + /** + * Determines if a given resource is a network address. + * + * @param[in] resource A PP_Resource to check. + * + * @return PP_TRUE if the input is a PPB_NetAddress + * resource; PP_FALSE otherwise. + */ + PP_Bool (*IsNetAddress)(PP_Resource resource); + /** + * Gets the address family. + * + * @param[in] addr A PP_Resource corresponding to a network + * address. + * + * @return The address family on success; + * PP_NETADDRESS_FAMILY_UNSPECIFIED on failure. + */ + PP_NetAddress_Family (*GetFamily)(PP_Resource addr); + /** + * Returns a human-readable description of the network address. The + * description is in the form of host [ ":" port ] and conforms to + * http://tools.ietf.org/html/rfc3986#section-3.2 for IPv4 and IPv6 addresses + * (e.g., "192.168.0.1", "192.168.0.1:99", or "[::1]:80"). + * + * @param[in] addr A PP_Resource corresponding to a network + * address. + * @param[in] include_port Whether to include the port number in the + * description. + * + * @return A string PP_Var on success; an undefined + * PP_Var on failure. + */ + struct PP_Var (*DescribeAsString)(PP_Resource addr, PP_Bool include_port); + /** + * Fills a PP_NetAddress_IPv4 structure if the network address is + * of PP_NETADDRESS_FAMILY_IPV4 address family. + * Note that passing a network address of + * PP_NETADDRESS_FAMILY_IPV6 address family will fail even if the + * address is an IPv4-mapped IPv6 address. + * + * @param[in] addr A PP_Resource corresponding to a network + * address. + * @param[out] ipv4_addr A PP_NetAddress_IPv4 structure to store + * the result. + * + * @return A PP_Bool value indicating whether the operation + * succeeded. + */ + PP_Bool (*DescribeAsIPv4Address)(PP_Resource addr, + struct PP_NetAddress_IPv4* ipv4_addr); + /** + * Fills a PP_NetAddress_IPv6 structure if the network address is + * of PP_NETADDRESS_FAMILY_IPV6 address family. + * Note that passing a network address of + * PP_NETADDRESS_FAMILY_IPV4 address family will fail - this + * method doesn't map it to an IPv6 address. + * + * @param[in] addr A PP_Resource corresponding to a network + * address. + * @param[out] ipv6_addr A PP_NetAddress_IPv6 structure to store + * the result. + * + * @return A PP_Bool value indicating whether the operation + * succeeded. + */ + PP_Bool (*DescribeAsIPv6Address)(PP_Resource addr, + struct PP_NetAddress_IPv6* ipv6_addr); +}; + +typedef struct PPB_NetAddress_1_0 PPB_NetAddress; +/** + * @} + */ + +/* ppb_host_resolver.idl */ +/** + * @addtogroup Enums + * @{ + */ +/** + * PP_HostResolver_Flag is an enumeration of flags which can be + * OR-ed and passed to the host resolver. Currently there is only one flag + * defined. + */ +typedef enum { + /** + * Hint to request the canonical name of the host, which can be retrieved by + * GetCanonicalName(). + */ + PP_HOSTRESOLVER_FLAG_CANONNAME = 1 << 0 +} PP_HostResolver_Flag; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_HostResolver_Flag, 4); +/** + * @} + */ + +/** + * @addtogroup Structs + * @{ + */ +/** + * PP_HostResolver_Hint represents hints for host resolution. + */ +struct PP_HostResolver_Hint { + /** + * Network address family. + */ + PP_NetAddress_Family family; + /** + * Combination of flags from PP_HostResolver_Flag. + */ + int32_t flags; +}; +PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_HostResolver_Hint, 8); +/** + * @} + */ + +/** + * @addtogroup Interfaces + * @{ + */ +/** + * The PPB_HostResolver interface supports host name + * resolution. + * + * Permissions: In order to run Resolve(), apps permission + * socket with subrule resolve-host is required. + * For more details about network communication permissions, please see: + * http://developer.chrome.com/apps/app_network.html + */ +struct PPB_HostResolver_1_0 { + /** + * Creates a host resolver resource. + * + * @param[in] instance A PP_Instance identifying one instance of + * a module. + * + * @return A PP_Resource corresponding to a host reslover or 0 + * on failure. + */ + PP_Resource (*Create)(PP_Instance instance); + /** + * Determines if a given resource is a host resolver. + * + * @param[in] resource A PP_Resource to check. + * + * @return PP_TRUE if the input is a + * PPB_HostResolver resource; PP_FALSE otherwise. + */ + PP_Bool (*IsHostResolver)(PP_Resource resource); + /** + * Requests resolution of a host name. If the call completes successfully, the + * results can be retrieved by GetCanonicalName(), + * GetNetAddressCount() and GetNetAddress(). + * + * @param[in] host_resolver A PP_Resource corresponding to a host + * resolver. + * @param[in] host The host name (or IP address literal) to resolve. + * @param[in] port The port number to be set in the resulting network + * addresses. + * @param[in] hint A PP_HostResolver_Hint structure providing + * hints for host resolution. + * @param[in] callback A PP_CompletionCallback to be called upon + * completion. + * + * @return An int32_t containing an error code from pp_errors.h. + * PP_ERROR_NOACCESS will be returned if the caller doesn't have + * required permissions. PP_ERROR_NAME_NOT_RESOLVED will be + * returned if the host name couldn't be resolved. + */ + int32_t (*Resolve)(PP_Resource host_resolver, + const char* host, + uint16_t port, + const struct PP_HostResolver_Hint* hint, + struct PP_CompletionCallback callback); + /** + * Gets the canonical name of the host. + * + * @param[in] host_resolver A PP_Resource corresponding to a host + * resolver. + * + * @return A string PP_Var on success, which is an empty string + * if PP_HOSTRESOLVER_FLAG_CANONNAME is not set in the hint flags + * when calling Resolve(); an undefined PP_Var if + * there is a pending Resolve() call or the previous + * Resolve() call failed. + */ + struct PP_Var (*GetCanonicalName)(PP_Resource host_resolver); + /** + * Gets the number of network addresses. + * + * @param[in] host_resolver A PP_Resource corresponding to a host + * resolver. + * + * @return The number of available network addresses on success; 0 if there is + * a pending Resolve() call or the previous + * Resolve() call failed. + */ + uint32_t (*GetNetAddressCount)(PP_Resource host_resolver); + /** + * Gets a network address. + * + * @param[in] host_resolver A PP_Resource corresponding to a host + * resolver. + * @param[in] index An index indicating which address to return. + * + * @return A PPB_NetAddress resource on success; 0 if there is a + * pending Resolve() call or the previous Resolve() + * call failed, or the specified index is out of range. + */ + PP_Resource (*GetNetAddress)(PP_Resource host_resolver, uint32_t index); +}; + +typedef struct PPB_HostResolver_1_0 PPB_HostResolver; +/** + * @} + */ + +/* ppb_image_data.idl */ +/** + * @addtogroup Enums + * @{ + */ +/** + * PP_ImageDataFormat is an enumeration of the different types of + * image data formats. + * + * The third part of each enumeration value describes the memory layout from + * the lowest address to the highest. For example, BGRA means the B component + * is stored in the lowest address, no matter what endianness the platform is + * using. + * + * The PREMUL suffix implies pre-multiplied alpha is used. In this mode, the + * red, green and blue color components of the pixel data supplied to an image + * data should be pre-multiplied by their alpha value. For example: starting + * with floating point color components, here is how to convert them to 8-bit + * premultiplied components for image data: + * + * ...components of a pixel, floats ranging from 0 to 1... + * float red = 1.0f; + * float green = 0.50f; + * float blue = 0.0f; + * float alpha = 0.75f; + * ...components for image data are 8-bit values ranging from 0 to 255... + * uint8_t image_data_red_premul = (uint8_t)(red * alpha * 255.0f); + * + * uint8_t image_data_green_premul = (uint8_t)(green * alpha * 255.0f); + * + * uint8_t image_data_blue_premul = (uint8_t)(blue * alpha * 255.0f); + * + * uint8_t image_data_alpha_premul = (uint8_t)(alpha * 255.0f); + * + * Note: The resulting pre-multiplied red, green and blue + * components should not be greater than the alpha value. + */ +typedef enum { + PP_IMAGEDATAFORMAT_BGRA_PREMUL, + PP_IMAGEDATAFORMAT_RGBA_PREMUL +} PP_ImageDataFormat; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_ImageDataFormat, 4); +/** + * @} + */ + +/** + * @addtogroup Structs + * @{ + */ +/** + * The PP_ImageDataDesc structure represents a description of + * image data. + */ +struct PP_ImageDataDesc { + /** + * This value represents one of the image data types in the + * PP_ImageDataFormat enum. + */ + PP_ImageDataFormat format; + /** This value represents the size of the bitmap in pixels. */ + struct PP_Size size; + /** + * This value represents the row width in bytes. This may be different than + * width * 4 since there may be padding at the end of the lines. + */ + int32_t stride; +}; +PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_ImageDataDesc, 16); +/** + * @} + */ + +/** + * @addtogroup Interfaces + * @{ + */ +/** + * The PPB_ImageData interface contains pointers to several + * functions for determining the browser's treatment of image data. + */ +struct PPB_ImageData_1_0 { + /** + * GetNativeImageDataFormat() returns the browser's preferred format for + * image data. The browser uses this format internally for painting. Other + * formats may require internal conversions to paint or may have additional + * restrictions depending on the function. + * + * @return A PP_ImageDataFormat containing the preferred format. + */ + PP_ImageDataFormat (*GetNativeImageDataFormat)(void); + /** + * IsImageDataFormatSupported() determines if the given image data format is + * supported by the browser. Note: PP_IMAGEDATAFORMAT_BGRA_PREMUL + * and PP_IMAGEDATAFORMAT_RGBA_PREMUL formats are always + * supported. Other image formats do not make this guarantee, and should be + * checked first with IsImageDataFormatSupported() before using. + * + * @param[in] format The image data format. + * + * @return A PP_Bool with PP_TRUE if the given + * image data format is supported by the browser. + */ + PP_Bool (*IsImageDataFormatSupported)(PP_ImageDataFormat format); + /** + * Create() allocates an image data resource with the given format and size. + * + * For security reasons, if uninitialized, the bitmap will not contain random + * memory, but may contain data from a previous image produced by the same + * module if the bitmap was cached and re-used. + * + * @param[in] instance A PP_Instance identifying one instance + * of a module. + * @param[in] format The desired image data format. + * @param[in] size A pointer to a PP_Size containing the image + * size. + * @param[in] init_to_zero A PP_Bool to determine transparency + * at creation. + * Set the init_to_zero flag if you want the bitmap initialized + * to transparent during the creation process. If this flag is not set, the + * current contents of the bitmap will be undefined, and the module should + * be sure to set all the pixels. + * + * @return A PP_Resource with a nonzero ID on success or zero on + * failure. Failure means the instance, image size, or format was invalid. + */ + PP_Resource (*Create)(PP_Instance instance, + PP_ImageDataFormat format, + const struct PP_Size* size, + PP_Bool init_to_zero); + /** + * IsImageData() determines if a given resource is image data. + * + * @param[in] image_data A PP_Resource corresponding to image + * data. + * + * @return A PP_Bool with PP_TRUE if the given + * resource is an image data or PP_FALSE if the resource is + * invalid or some type other than image data. + */ + PP_Bool (*IsImageData)(PP_Resource image_data); + /** + * Describe() computes the description of the + * image data. + * + * @param[in] image_data A PP_Resource corresponding to image + * data. + * @param[in,out] desc A pointer to a PP_ImageDataDesc + * containing the description. + * + * @return A PP_Bool with PP_TRUE on success or + * PP_FALSE if the resource is not an image data. On + * PP_FALSE, the desc structure will be filled + * with 0. + */ + PP_Bool (*Describe)(PP_Resource image_data, struct PP_ImageDataDesc* desc); + /** + * Map() maps an image data into the module address space. + * + * @param[in] image_data A PP_Resource corresponding to image + * data. + * + * @return A pointer to the beginning of the data. + */ + void* (*Map)(PP_Resource image_data); + /** + * Unmap is a pointer to a function that unmaps an image data from the module + * address space. + * + * @param[in] image_data A PP_Resource corresponding to image + * data. + */ + void (*Unmap)(PP_Resource image_data); +}; + +typedef struct PPB_ImageData_1_0 PPB_ImageData; +/** + * @} + */ + +/* ppb_instance.idl */ +/** + * @addtogroup Interfaces + * @{ + */ +/** + * The PPB_Instance interface contains pointers to functions + * related to the module instance on a web page. + */ +struct PPB_Instance_1_0 { + /** + * BindGraphics() binds the given graphics as the current display surface. + * The contents of this device is what will be displayed in the instance's + * area on the web page. The device must be a 2D or a 3D device. + * + * You can pass a NULL resource as the device parameter to + * unbind all devices from the given instance. The instance will then appear + * transparent. Re-binding the same device will return PP_TRUE + * and will do nothing. + * + * Any previously-bound device will be released. It is an error to bind + * a device when it is already bound to another instance. If you want + * to move a device between instances, first unbind it from the old one, and + * then rebind it to the new one. + * + * Binding a device will invalidate that portion of the web page to flush the + * contents of the new device to the screen. + * + * @param[in] instance A PP_Instance identifying one instance of a module. + * @param[in] device A PP_Resource corresponding to a graphics device. + * + * @return PP_Bool containing PP_TRUE if bind was + * successful or PP_FALSE if the device was not the correct + * type. On success, a reference to the device will be held by the + * instance, so the caller can release its reference if it chooses. + */ + PP_Bool (*BindGraphics)(PP_Instance instance, PP_Resource device); + /** + * IsFullFrame() determines if the instance is full-frame. Such an instance + * represents the entire document in a frame rather than an embedded + * resource. This can happen if the user does a top-level navigation or the + * page specifies an iframe to a resource with a MIME type registered by the + * module. + * + * @param[in] instance A PP_Instance identifying one instance + * of a module. + * + * @return A PP_Bool containing PP_TRUE if the + * instance is full-frame. + */ + PP_Bool (*IsFullFrame)(PP_Instance instance); +}; + +typedef struct PPB_Instance_1_0 PPB_Instance; +/** + * @} + */ + +/* ppb_media_stream_audio_track.idl */ +/** + * @addtogroup Enums + * @{ + */ +/** + * This enumeration contains audio track attributes which are used by + * Configure(). + */ +typedef enum { + /** + * Attribute list terminator. + */ + PP_MEDIASTREAMAUDIOTRACK_ATTRIB_NONE = 0, + /** + * The maximum number of buffers to hold audio samples. + * Note: this is only used as advisory; the browser may allocate more or fewer + * based on available resources. How many buffers depends on usage - + * request at least 2 to make sure latency doesn't cause lost samples. If + * the plugin expects to hold on to more than one buffer at a time (e.g. to do + * multi-buffer processing), it should request that many more. + */ + PP_MEDIASTREAMAUDIOTRACK_ATTRIB_BUFFERS = 1, + /** + * The sample rate of audio data in buffers. The attribute value is a + * PP_AudioBuffer_SampleRate. + */ + PP_MEDIASTREAMAUDIOTRACK_ATTRIB_SAMPLE_RATE = 2, + /** + * The sample size of audio data in buffers in bytes. The attribute value is a + * PP_AudioBuffer_SampleSize. + */ + PP_MEDIASTREAMAUDIOTRACK_ATTRIB_SAMPLE_SIZE = 3, + /** + * The number of channels in audio buffers. + * + * Supported values: 1, 2 + */ + PP_MEDIASTREAMAUDIOTRACK_ATTRIB_CHANNELS = 4, + /** + * The duration of an audio buffer in milliseconds. + * + * Valid range: 10 to 10000 + */ + PP_MEDIASTREAMAUDIOTRACK_ATTRIB_DURATION = 5 +} PP_MediaStreamAudioTrack_Attrib; +/** + * @} + */ + +/** + * @addtogroup Interfaces + * @{ + */ +struct PPB_MediaStreamAudioTrack_0_1 { + /** + * Determines if a resource is a MediaStream audio track resource. + * + * @param[in] resource The PP_Resource to test. + * + * @return A PP_Bool with PP_TRUE if the given + * resource is a Mediastream audio track resource or PP_FALSE + * otherwise. + */ + PP_Bool (*IsMediaStreamAudioTrack)(PP_Resource resource); + /** + * Configures underlying buffers for incoming audio samples. + * If the application doesn't want to drop samples, then the + * PP_MEDIASTREAMAUDIOTRACK_ATTRIB_BUFFERS should be + * chosen such that inter-buffer processing time variability won't overrun all + * the input buffers. If all buffers are filled, then samples will be + * dropped. The application can detect this by examining the timestamp on + * returned buffers. If Configure() is not called, default + * settings will be used. Calls to Configure while the plugin holds + * buffers will fail. + * Example usage from plugin code: + * @code + * int32_t attribs[] = { + * PP_MEDIASTREAMAUDIOTRACK_ATTRIB_BUFFERS, 4, + * PP_MEDIASTREAMAUDIOTRACK_ATTRIB_DURATION, 10, + * PP_MEDIASTREAMAUDIOTRACK_ATTRIB_NONE}; + * track_if->Configure(track, attribs, callback); + * @endcode + * + * @param[in] audio_track A PP_Resource corresponding to an audio + * resource. + * @param[in] attrib_list A list of attribute name-value pairs in which each + * attribute is immediately followed by the corresponding desired value. + * The list is terminated by + * PP_MEDIASTREAMAUDIOTRACK_ATTRIB_NONE. + * @param[in] callback A PP_CompletionCallback to be called upon + * completion of Configure(). + * + * @return An int32_t containing a result code from pp_errors.h. + */ + int32_t (*Configure)(PP_Resource audio_track, + const int32_t attrib_list[], + struct PP_CompletionCallback callback); + /** + * Gets attribute value for a given attribute name. + * + * @param[in] audio_track A PP_Resource corresponding to an audio + * resource. + * @param[in] attrib A PP_MediaStreamAudioTrack_Attrib for + * querying. + * @param[out] value A int32_t for storing the attribute value on success. + * Otherwise, the value will not be changed. + * + * @return An int32_t containing a result code from pp_errors.h. + */ + int32_t (*GetAttrib)(PP_Resource audio_track, + PP_MediaStreamAudioTrack_Attrib attrib, + int32_t* value); + /** + * Returns the track ID of the underlying MediaStream audio track. + * + * @param[in] audio_track The PP_Resource to check. + * + * @return A PP_Var containing the MediaStream track ID as + * a string. + */ + struct PP_Var (*GetId)(PP_Resource audio_track); + /** + * Checks whether the underlying MediaStream track has ended. + * Calls to GetBuffer while the track has ended are safe to make and will + * complete, but will fail. + * + * @param[in] audio_track The PP_Resource to check. + * + * @return A PP_Bool with PP_TRUE if the given + * MediaStream track has ended or PP_FALSE otherwise. + */ + PP_Bool (*HasEnded)(PP_Resource audio_track); + /** + * Gets the next audio buffer from the MediaStream track. + * If internal processing is slower than the incoming buffer rate, new buffers + * will be dropped from the incoming stream. Once all buffers are full, + * audio samples will be dropped until RecycleBuffer() is called + * to free a slot for another buffer. + * If there are no audio data in the input buffer, + * PP_OK_COMPLETIONPENDING will be returned immediately and the + * callback will be called, when a new buffer of audio samples + * is received or an error happens. + * + * @param[in] audio_track A PP_Resource corresponding to an audio + * resource. + * @param[out] buffer A PP_Resource corresponding to + * an AudioBuffer resource. + * @param[in] callback A PP_CompletionCallback to be called upon + * completion of GetBuffer(). + * + * @return An int32_t containing a result code from pp_errors.h. + */ + int32_t (*GetBuffer)(PP_Resource audio_track, + PP_Resource* buffer, + struct PP_CompletionCallback callback); + /** + * Recycles a buffer returned by GetBuffer(), so the track can + * reuse the buffer. And the buffer will become invalid. The caller should + * release all references it holds to buffer and not use it + * anymore. + * + * @param[in] audio_track A PP_Resource corresponding to an audio + * resource. + * @param[in] buffer A PP_Resource corresponding to + * an AudioBuffer resource returned by GetBuffer(). + * + * @return An int32_t containing a result code from pp_errors.h. + */ + int32_t (*RecycleBuffer)(PP_Resource audio_track, PP_Resource buffer); + /** + * Closes the MediaStream audio track and disconnects it from the audio + * source. After calling Close(), no new buffers will be + * received. + * + * @param[in] audio_track A PP_Resource corresponding to a + * MediaStream audio track resource. + */ + void (*Close)(PP_Resource audio_track); +}; + +typedef struct PPB_MediaStreamAudioTrack_0_1 PPB_MediaStreamAudioTrack; +/** + * @} + */ + +/* ppb_media_stream_video_track.idl */ +/** + * @addtogroup Enums + * @{ + */ +/** + * This enumeration contains video track attributes which are used by + * Configure(). + */ +typedef enum { + /** + * Attribute list terminator. + */ + PP_MEDIASTREAMVIDEOTRACK_ATTRIB_NONE = 0, + /** + * The maximum number of frames to hold in the input buffer. + * Note: this is only used as advisory; the browser may allocate more or fewer + * based on available resources. How many frames to buffer depends on usage - + * request at least 2 to make sure latency doesn't cause lost frames. If + * the plugin expects to hold on to more than one frame at a time (e.g. to do + * multi-frame processing), it should request that many more. + * If this attribute is not specified or value 0 is specified for this + * attribute, the default value will be used. + */ + PP_MEDIASTREAMVIDEOTRACK_ATTRIB_BUFFERED_FRAMES = 1, + /** + * The width of video frames in pixels. It should be a multiple of 4. + * If the specified size is different from the video source (webcam), + * frames will be scaled to specified size. + * If this attribute is not specified or value 0 is specified, the original + * frame size of the video track will be used. + * + * Maximum value: 4096 (4K resolution). + */ + PP_MEDIASTREAMVIDEOTRACK_ATTRIB_WIDTH = 2, + /** + * The height of video frames in pixels. It should be a multiple of 4. + * If the specified size is different from the video source (webcam), + * frames will be scaled to specified size. + * If this attribute is not specified or value 0 is specified, the original + * frame size of the video track will be used. + * + * Maximum value: 4096 (4K resolution). + */ + PP_MEDIASTREAMVIDEOTRACK_ATTRIB_HEIGHT = 3, + /** + * The format of video frames. The attribute value is + * a PP_VideoFrame_Format. If the specified format is different + * from the video source (webcam), frames will be converted to specified + * format. + * If this attribute is not specified or value + * PP_VIDEOFRAME_FORMAT_UNKNOWN is specified, the orignal frame + * format of the video track will be used. + */ + PP_MEDIASTREAMVIDEOTRACK_ATTRIB_FORMAT = 4 +} PP_MediaStreamVideoTrack_Attrib; +/** + * @} + */ + +/** + * @addtogroup Interfaces + * @{ + */ +struct PPB_MediaStreamVideoTrack_1_0 { /* dev */ + /** + * Creates a PPB_MediaStreamVideoTrack resource for video output. Call this + * when you will be creating frames and putting them to the track. + * + * @param[in] instance A PP_Instance identifying one instance of + * a module. + * + * @return A PP_Resource corresponding to a + * PPB_MediaStreamVideoTrack resource if successful, 0 if failed. + */ + PP_Resource (*Create)(PP_Instance instance); + /** + * Determines if a resource is a MediaStream video track resource. + * + * @param[in] resource The PP_Resource to test. + * + * @return A PP_Bool with PP_TRUE if the given + * resource is a Mediastream video track resource or PP_FALSE + * otherwise. + */ + PP_Bool (*IsMediaStreamVideoTrack)(PP_Resource resource); + /** + * Configures underlying frame buffers for incoming frames. + * If the application doesn't want to drop frames, then the + * PP_MEDIASTREAMVIDEOTRACK_ATTRIB_BUFFERED_FRAMES should be + * chosen such that inter-frame processing time variability won't overrun the + * input buffer. If the buffer is overfilled, then frames will be dropped. + * The application can detect this by examining the timestamp on returned + * frames. If some attributes are not specified, default values will be used + * for those unspecified attributes. If Configure() is not + * called, default settings will be used. + * Example usage from plugin code: + * @code + * int32_t attribs[] = { + * PP_MEDIASTREAMVIDEOTRACK_ATTRIB_BUFFERED_FRAMES, 4, + * PP_MEDIASTREAMVIDEOTRACK_ATTRIB_NONE}; + * track_if->Configure(track, attribs, callback); + * @endcode + * + * @param[in] video_track A PP_Resource corresponding to a video + * resource. + * @param[in] attrib_list A list of attribute name-value pairs in which each + * attribute is immediately followed by the corresponding desired value. + * The list is terminated by + * PP_MEDIASTREAMVIDEOTRACK_ATTRIB_NONE. + * @param[in] callback PP_CompletionCallback to be called upon + * completion of Configure(). + * + * @return An int32_t containing a result code from pp_errors.h. + * Returns PP_ERROR_INPROGRESS if there is a pending call of + * Configure() or GetFrame(), or the plugin + * holds some frames which are not recycled with RecycleFrame(). + * If an error is returned, all attributes and the underlying buffer will not + * be changed. + */ + int32_t (*Configure)(PP_Resource video_track, + const int32_t attrib_list[], + struct PP_CompletionCallback callback); + /** + * Gets attribute value for a given attribute name. + * + * @param[in] video_track A PP_Resource corresponding to a video + * resource. + * @param[in] attrib A PP_MediaStreamVideoTrack_Attrib for + * querying. + * @param[out] value A int32_t for storing the attribute value on success. + * Otherwise, the value will not be changed. + * + * @return An int32_t containing a result code from pp_errors.h. + */ + int32_t (*GetAttrib)(PP_Resource video_track, + PP_MediaStreamVideoTrack_Attrib attrib, + int32_t* value); + /** + * Returns the track ID of the underlying MediaStream video track. + * + * @param[in] video_track The PP_Resource to check. + * + * @return A PP_Var containing the MediaStream track ID as + * a string. + */ + struct PP_Var (*GetId)(PP_Resource video_track); + /** + * Checks whether the underlying MediaStream track has ended. + * Calls to GetFrame while the track has ended are safe to make and will + * complete, but will fail. + * + * @param[in] video_track The PP_Resource to check. + * + * @return A PP_Bool with PP_TRUE if the given + * MediaStream track has ended or PP_FALSE otherwise. + */ + PP_Bool (*HasEnded)(PP_Resource video_track); + /** + * Gets the next video frame from the MediaStream track. + * If internal processing is slower than the incoming frame rate, new frames + * will be dropped from the incoming stream. Once the input buffer is full, + * frames will be dropped until RecycleFrame() is called to free + * a spot for another frame to be buffered. + * If there are no frames in the input buffer, + * PP_OK_COMPLETIONPENDING will be returned immediately and the + * callback will be called when a new frame is received or an + * error happens. + * + * @param[in] video_track A PP_Resource corresponding to a video + * resource. + * @param[out] frame A PP_Resource corresponding to a VideoFrame + * resource. + * @param[in] callback A PP_CompletionCallback to be called upon + * completion of GetFrame(). + * + * @return An int32_t containing a result code from pp_errors.h. + * Returns PP_ERROR_NOMEMORY if max_buffered_frames frames buffer + * was not allocated successfully. + */ + int32_t (*GetFrame)(PP_Resource video_track, + PP_Resource* frame, + struct PP_CompletionCallback callback); + /** + * Recycles a frame returned by GetFrame(), so the track can + * reuse the underlying buffer of this frame. And the frame will become + * invalid. The caller should release all references it holds to + * frame and not use it anymore. + * + * @param[in] video_track A PP_Resource corresponding to a video + * resource. + * @param[in] frame A PP_Resource corresponding to a VideoFrame + * resource returned by GetFrame(). + * + * @return An int32_t containing a result code from pp_errors.h. + */ + int32_t (*RecycleFrame)(PP_Resource video_track, PP_Resource frame); + /** + * Closes the MediaStream video track and disconnects it from video source. + * After calling Close(), no new frames will be received. + * + * @param[in] video_track A PP_Resource corresponding to a + * MediaStream video track resource. + */ + void (*Close)(PP_Resource video_track); + /** + * Gets a free frame for output. The frame is allocated by + * Configure(). The caller should fill it with frame data, and + * then use |PutFrame()| to send the frame back. + */ + int32_t (*GetEmptyFrame)(PP_Resource video_track, + PP_Resource* frame, + struct PP_CompletionCallback callback); + /** + * Sends a frame returned by |GetEmptyFrame()| to the output track. + * After this function, the |frame| should not be used anymore and the + * caller should release the reference that it holds. + */ + int32_t (*PutFrame)(PP_Resource video_track, PP_Resource frame); +}; + +struct PPB_MediaStreamVideoTrack_0_1 { + PP_Bool (*IsMediaStreamVideoTrack)(PP_Resource resource); + int32_t (*Configure)(PP_Resource video_track, + const int32_t attrib_list[], + struct PP_CompletionCallback callback); + int32_t (*GetAttrib)(PP_Resource video_track, + PP_MediaStreamVideoTrack_Attrib attrib, + int32_t* value); + struct PP_Var (*GetId)(PP_Resource video_track); + PP_Bool (*HasEnded)(PP_Resource video_track); + int32_t (*GetFrame)(PP_Resource video_track, + PP_Resource* frame, + struct PP_CompletionCallback callback); + int32_t (*RecycleFrame)(PP_Resource video_track, PP_Resource frame); + void (*Close)(PP_Resource video_track); +}; + +typedef struct PPB_MediaStreamVideoTrack_0_1 PPB_MediaStreamVideoTrack; +/** + * @} + */ + +/* ppb_message_loop.idl */ +/** + * @addtogroup Interfaces + * @{ + */ +/** + * A message loop allows PPAPI calls to be issued on a thread. You may not + * issue any API calls on a thread without creating a message loop. It also + * allows you to post work to the message loop for a thread. + * + * To process work posted to the message loop, as well as completion callbacks + * for asynchronous operations, you must run the message loop via Run(). + * + * Note the system manages the lifetime of the instance (and all associated + * resources). If the instance is deleted from the page, background threads may + * suddenly see their PP_Resource handles become invalid. In this case, calls + * will fail with PP_ERROR_BADRESOURCE. If you need to access data associated + * with your instance, you will probably want to create some kind of threadsafe + * proxy object that can handle asynchronous destruction of the instance object. + * + * Typical usage: + * On the main thread: + * - Create the thread yourself (using pthreads). + * - Create the message loop resource. + * - Pass the message loop resource to your thread's main function. + * - Call PostWork() on the message loop to run functions on the thread. + * + * From the background thread's main function: + * - Call AttachToCurrentThread() with the message loop resource. + * - Call Run() with the message loop resource. + * + * Your callbacks should look like this: + * @code + * void DoMyWork(void* user_data, int32_t status) { + * if (status != PP_OK) { + * Cleanup(); // e.g. free user_data. + * return; + * } + * ... do your work... + * } + * @endcode + * For a C++ example, see ppapi/utility/threading/simple_thread.h + * + * (You can also create the message loop resource on the background thread, + * but then the main thread will have no reference to it should you want to + * call PostWork()). + * + * + * THREAD HANDLING + * + * The main thread has an implicitly created message loop. The main thread is + * the thread where PPP_InitializeModule and PPP_Instance functions are called. + * You can retrieve a reference to this message loop by calling + * GetForMainThread() or, if your code is on the main thread, GetCurrent() will + * also work. + * + * Some special threads created by the system can not have message loops. In + * particular, the background thread created for audio processing has this + * requirement because it's intended to be highly responsive to keep up with + * the realtime requirements of audio processing. You can not make PPAPI calls + * from these threads. + * + * Once you associate a message loop with a thread, you don't have to keep a + * reference to it. The system will hold a reference to the message loop for as + * long as the thread is running. The current message loop can be retrieved + * using the GetCurrent() function. + * + * It is legal to create threads in your plugin without message loops, but + * PPAPI calls will fail unless explicitly noted in the documentation. + * + * You can create a message loop object on a thread and never actually run the + * message loop. This will allow you to call blocking PPAPI calls (via + * PP_BlockUntilComplete()). If you make any asynchronous calls, the callbacks + * from those calls will be queued in the message loop and never run. The same + * thing will happen if work is scheduled after the message loop exits and + * the message loop is not run again. + * + * + * DESTRUCTION AND ERROR HANDLING + * + * Often, your application will associate memory with completion callbacks. For + * example, the C++ CompletionCallbackFactory has a small amount of + * heap-allocated memory for each callback. This memory will be leaked if the + * callback is never run. To avoid this memory leak, you need to be careful + * about error handling and shutdown. + * + * There are a number of cases where posted callbacks will never be run: + * + * - You tear down the thread (via pthreads) without "destroying" the message + * loop (via PostQuit with should_destroy = PP_TRUE). In this case, any + * tasks in the message queue will be lost. + * + * - You create a message loop, post callbacks to it, and never run it. + * + * - You quit the message loop via PostQuit with should_destroy set to + * PP_FALSE. In this case, the system will assume the message loop will be + * run again later and keep your tasks. + * + * To do proper shutdown, call PostQuit with should_destroy = PP_TRUE. This + * will prohibit future work from being posted, and will allow the message loop + * to run until all pending tasks are run. + * + * If you post a callback to a message loop that's been destroyed, or to an + * invalid message loop, PostWork will return an error and will not run the + * callback. This is true even for callbacks with the "required" flag set, + * since the system may not even know what thread to issue the error callback + * on. + * + * Therefore, you should check for errors from PostWork and destroy any + * associated memory to avoid leaks. If you're using the C++ + * CompletionCallbackFactory, use the following pattern: + * @code + * pp::CompletionCallback callback = factory_.NewOptionalCallback(...); + * int32_t result = message_loop.PostWork(callback); + * if (result != PP_OK) + * callback.Run(result); + * @endcode + * This will run the callback with an error value, and assumes that the + * implementation of your callback checks the "result" argument and returns + * immediately on error. + */ +struct PPB_MessageLoop_1_0 { + /** + * Creates a message loop resource. + * + * This may be called from any thread. After your thread starts but before + * issuing any other PPAPI calls on it, you must associate it with a message + * loop by calling AttachToCurrentThread. + */ + PP_Resource (*Create)(PP_Instance instance); + /** + * Returns a resource identifying the message loop for the main thread. The + * main thread always has a message loop created by the system. + */ + PP_Resource (*GetForMainThread)(void); + /** + * Returns a reference to the PPB_MessageLoop object attached to the current + * thread. If there is no attached message loop, the return value will be 0. + */ + PP_Resource (*GetCurrent)(void); + /** + * Sets the given message loop resource as being the associated message loop + * for the currently running thread. + * + * You must call this function exactly once on a thread before making any + * PPAPI calls. A message loop can only be attached to one thread, and the + * message loop can not be changed later. The message loop will be attached + * as long as the thread is running or until you quit with should_destroy + * set to PP_TRUE. + * + * If this function fails, attempting to run the message loop will fail. + * Note that you can still post work to the message loop: it will get queued + * up should the message loop eventually be successfully attached and run. + * + * @return + * - PP_OK: The message loop was successfully attached to the thread and is + * ready to use. + * - PP_ERROR_BADRESOURCE: The given message loop resource is invalid. + * - PP_ERROR_INPROGRESS: The current thread already has a message loop + * attached. This will always be the case for the main thread, which has + * an implicit system-created message loop attached. + * - PP_ERROR_WRONG_THREAD: The current thread type can not have a message + * loop attached to it. See the interface level discussion about these + * special threads, which include realtime audio threads. + */ + int32_t (*AttachToCurrentThread)(PP_Resource message_loop); + /** + * Runs the thread message loop. Running the message loop is required for you + * to get issued completion callbacks on the thread. + * + * The message loop identified by the argument must have been previously + * successfully attached to the current thread. + * + * You may not run nested message loops. Since the main thread has an + * implicit message loop that the system runs, you may not call Run on the + * main thread. + * + * @return + * - PP_OK: The message loop was successfully run. Note that on + * success, the message loop will only exit when you call PostQuit(). + * - PP_ERROR_BADRESOURCE: The given message loop resource is invalid. + * - PP_ERROR_WRONG_THREAD: You are attempting to run a message loop that + * has not been successfully attached to the current thread. Call + * AttachToCurrentThread(). + * - PP_ERROR_INPROGRESS: You are attempting to call Run in a nested + * fashion (Run is already on the stack). This will occur if you attempt + * to call run on the main thread's message loop (see above). + */ + int32_t (*Run)(PP_Resource message_loop); + /** + * Schedules work to run on the given message loop. This may be called from + * any thread. Posted work will be executed in the order it was posted when + * the message loop is Run(). + * + * @param message_loop The message loop resource. + * + * @param callback The completion callback to execute from the message loop. + * + * @param delay_ms The number of milliseconds to delay execution of the given + * completion callback. Passing 0 means it will get queued normally and + * executed in order. + * + * + * The completion callback will be called with PP_OK as the "result" parameter + * if it is run normally. It is good practice to check for PP_OK and return + * early otherwise. + * + * The "required" flag on the completion callback is ignored. If there is an + * error posting your callback, the error will be returned from PostWork and + * the callback will never be run (because there is no appropriate place to + * run your callback with an error without causing unexpected threading + * problems). If you associate memory with the completion callback (for + * example, you're using the C++ CompletionCallbackFactory), you will need to + * free this or manually run the callback. See "Destruction and error + * handling" above. + * + * + * You can call this function before the message loop has started and the + * work will get queued until the message loop is run. You can also post + * work after the message loop has exited as long as should_destroy was + * PP_FALSE. It will be queued until the next invocation of Run(). + * + * @return + * - PP_OK: The work was posted to the message loop's queue. As described + * above, this does not mean that the work has been or will be executed + * (if you never run the message loop after posting). + * - PP_ERROR_BADRESOURCE: The given message loop resource is invalid. + * - PP_ERROR_BADARGUMENT: The function pointer for the completion callback + * is null (this will be the case if you pass PP_BlockUntilComplete()). + * - PP_ERROR_FAILED: The message loop has been destroyed. + */ + int32_t (*PostWork)(PP_Resource message_loop, + struct PP_CompletionCallback callback, + int64_t delay_ms); + /** + * Posts a quit message to the given message loop's work queue. Work posted + * before that point will be processed before quitting. + * + * This may be called on the message loop registered for the current thread, + * or it may be called on the message loop registered for another thread. It + * is an error to attempt to PostQuit() the main thread loop. + * + * @param should_destroy Marks the message loop as being in a destroyed state + * and prevents further posting of messages. + * + * If you quit a message loop without setting should_destroy, it will still + * be attached to the thread and you can still run it again by calling Run() + * again. If you destroy it, it will be detached from the current thread. + * + * @return + * - PP_OK: The request to quit was successfully posted. + * - PP_ERROR_BADRESOURCE: The message loop was invalid. + * - PP_ERROR_WRONG_THREAD: You are attempting to quit the main thread. + * The main thread's message loop is managed by the system and can't be + * quit. + */ + int32_t (*PostQuit)(PP_Resource message_loop, PP_Bool should_destroy); +}; + +typedef struct PPB_MessageLoop_1_0 PPB_MessageLoop; +/** + * @} + */ + +/* ppp_message_handler.idl */ +/** + * @addtogroup Interfaces + * @{ + */ +/** + * The PPP_MessageHandler interface is implemented by the plugin + * if the plugin wants to receive messages from a thread other than the main + * Pepper thread, or if the plugin wants to handle blocking messages which + * JavaScript may send via postMessageAndAwaitResponse(). + * + * This interface struct should not be returned by PPP_GetInterface; instead it + * must be passed as a parameter to PPB_Messaging::RegisterMessageHandler. + */ +struct PPP_MessageHandler_0_2 { + /** + * Invoked as a result of JavaScript invoking postMessage() on the plugin's + * DOM element. + * + * @param[in] instance A PP_Instance identifying one instance + * of a module. + * @param[in] user_data is the same pointer which was provided by a call to + * RegisterMessageHandler(). + * @param[in] message A copy of the parameter that JavaScript provided to + * postMessage(). + */ + void (*HandleMessage)(PP_Instance instance, + void* user_data, + const struct PP_Var* message); + /** + * Invoked as a result of JavaScript invoking postMessageAndAwaitResponse() + * on the plugin's DOM element. + * + * NOTE: JavaScript execution is blocked during the duration of this call. + * Hence, the plugin should respond as quickly as possible. For this reason, + * blocking completion callbacks are disallowed while handling a blocking + * message. + * + * @param[in] instance A PP_Instance identifying one instance + * of a module. + * @param[in] user_data is the same pointer which was provided by a call to + * RegisterMessageHandler(). + * @param[in] message is a copy of the parameter that JavaScript provided + * to postMessageAndAwaitResponse(). + * @param[out] response will be copied to a JavaScript object which is + * returned as the result of postMessageAndAwaitResponse() to the invoking + * + */ + void (*HandleBlockingMessage)(PP_Instance instance, + void* user_data, + const struct PP_Var* message, + struct PP_Var* response); + /** + * Invoked when the handler object is no longer needed. After this, no more + * calls will be made which pass this same value for instance + * and user_data. + * + * @param[in] instance A PP_Instance identifying one instance + * of a module. + * @param[in] user_data is the same pointer which was provided by a call to + * RegisterMessageHandler. + */ + void (*Destroy)(PP_Instance instance, void* user_data); +}; + +typedef struct PPP_MessageHandler_0_2 PPP_MessageHandler; +/** + * @} + */ + +/* ppb_messaging.idl */ +/** + * @addtogroup Interfaces + * @{ + */ +/** + * The PPB_Messaging interface is implemented by the browser + * and is related to sending messages to JavaScript message event listeners on + * the DOM element associated with specific module instance. + */ +struct PPB_Messaging_1_2 { + /** + * PostMessage() asynchronously invokes any listeners for message events on + * the DOM element for the given module instance. A call to PostMessage() + * will not block while the message is processed. + * + * @param[in] instance A PP_Instance identifying one instance + * of a module. + * @param[in] message A PP_Var containing the data to be sent to + * JavaScript. + * message can be any PP_Var type except + * PP_VARTYPE_OBJECT. Array/Dictionary types are supported from + * Chrome M29 onward. All var types are copied when passing them to + * JavaScript. + * + * When passing array or dictionary PP_Vars, the entire reference + * graph will be converted and transferred. If the reference graph has cycles, + * the message will not be sent and an error will be logged to the console. + * + * Listeners for message events in JavaScript code will receive an object + * conforming to the HTML 5 MessageEvent interface. + * Specifically, the value of message will be contained as a property called + * data in the received MessageEvent. + * + * This messaging system is similar to the system used for listening for + * messages from Web Workers. Refer to + * http://www.whatwg.org/specs/web-workers/current-work/ for + * further information. + * + * Example: + * + * @code + * + * + * + * + * + * + * @endcode + * + * The module instance then invokes PostMessage() as follows: + * + * @code + * + * char hello_world[] = "Hello world!"; + * PP_Var hello_var = ppb_var_interface->VarFromUtf8(instance, + * hello_world, + * sizeof(hello_world)); + * ppb_messaging_interface->PostMessage(instance, hello_var); // Copies var. + * ppb_var_interface->Release(hello_var); + * + * @endcode + * + * The browser will pop-up an alert saying "Hello world!" + */ + void (*PostMessage)(PP_Instance instance, struct PP_Var message); + /** + * Registers a handler for receiving messages from JavaScript. If a handler + * is registered this way, it will replace PPP_Messaging, and all messages + * sent from JavaScript via postMessage and postMessageAndAwaitResponse will + * be dispatched to handler. + * + * The function calls will be dispatched via message_loop. This + * means that the functions will be invoked on the thread to which + * message_loop is attached, when message_loop is + * run. It is illegal to pass the main thread message loop; + * RegisterMessageHandler will return PP_ERROR_WRONG_THREAD in that case. + * If you quit message_loop before calling Unregister(), + * the browser will not be able to call functions in the plugin's message + * handler any more. That could mean missing some messages or could cause a + * leak if you depend on Destroy() to free hander data. So you should, + * whenever possible, Unregister() the handler prior to quitting its event + * loop. + * + * Attempting to register a message handler when one is already registered + * will cause the current MessageHandler to be unregistered and replaced. In + * that case, no messages will be sent to the "default" message handler + * (PPP_Messaging). Messages will stop arriving at the prior message handler + * and will begin to be dispatched at the new message handler. + * + * @param[in] instance A PP_Instance identifying one instance + * of a module. + * @param[in] user_data A pointer the plugin may choose to use when handling + * calls to functions within PPP_MessageHandler. The browser will pass this + * same pointer when invoking functions within PPP_MessageHandler. + * @param[in] handler The plugin-provided set of functions for handling + * messages. + * @param[in] message_loop Represents the message loop on which + * PPP_MessageHandler functions should be invoked. + * @return PP_OK on success, or an error from pp_errors.h. + */ + int32_t (*RegisterMessageHandler)( + PP_Instance instance, + void* user_data, + const struct PPP_MessageHandler_0_2* handler, + PP_Resource message_loop); + /** + * Unregisters the current message handler for instance if one + * is registered. After this call, the message handler (if one was + * registered) will have "Destroy" called on it and will receive no further + * messages after that point. After that point, all messages sent from + * JavaScript using postMessage() will be dispatched to PPP_Messaging (if + * the plugin supports PPP_MESSAGING_INTERFACE). Attempts to call + * postMessageAndAwaitResponse() from JavaScript will fail. + * + * Attempting to unregister a message handler when none is registered has no + * effect. + * + * @param[in] instance A PP_Instance identifying one instance + * of a module. + */ + void (*UnregisterMessageHandler)(PP_Instance instance); +}; + +typedef struct PPB_Messaging_1_2 PPB_Messaging; + +struct PPB_Messaging_1_0 { + void (*PostMessage)(PP_Instance instance, struct PP_Var message); +}; +/** + * @} + */ + +/* ppb_mouse_cursor.idl */ +/** + * @addtogroup Enums + * @{ + */ +/** + * The PP_MouseCursor_Type enumeration lists the available stock + * cursor types. + */ +enum PP_MouseCursor_Type { + PP_MOUSECURSOR_TYPE_CUSTOM = -1, + PP_MOUSECURSOR_TYPE_POINTER = 0, + PP_MOUSECURSOR_TYPE_CROSS = 1, + PP_MOUSECURSOR_TYPE_HAND = 2, + PP_MOUSECURSOR_TYPE_IBEAM = 3, + PP_MOUSECURSOR_TYPE_WAIT = 4, + PP_MOUSECURSOR_TYPE_HELP = 5, + PP_MOUSECURSOR_TYPE_EASTRESIZE = 6, + PP_MOUSECURSOR_TYPE_NORTHRESIZE = 7, + PP_MOUSECURSOR_TYPE_NORTHEASTRESIZE = 8, + PP_MOUSECURSOR_TYPE_NORTHWESTRESIZE = 9, + PP_MOUSECURSOR_TYPE_SOUTHRESIZE = 10, + PP_MOUSECURSOR_TYPE_SOUTHEASTRESIZE = 11, + PP_MOUSECURSOR_TYPE_SOUTHWESTRESIZE = 12, + PP_MOUSECURSOR_TYPE_WESTRESIZE = 13, + PP_MOUSECURSOR_TYPE_NORTHSOUTHRESIZE = 14, + PP_MOUSECURSOR_TYPE_EASTWESTRESIZE = 15, + PP_MOUSECURSOR_TYPE_NORTHEASTSOUTHWESTRESIZE = 16, + PP_MOUSECURSOR_TYPE_NORTHWESTSOUTHEASTRESIZE = 17, + PP_MOUSECURSOR_TYPE_COLUMNRESIZE = 18, + PP_MOUSECURSOR_TYPE_ROWRESIZE = 19, + PP_MOUSECURSOR_TYPE_MIDDLEPANNING = 20, + PP_MOUSECURSOR_TYPE_EASTPANNING = 21, + PP_MOUSECURSOR_TYPE_NORTHPANNING = 22, + PP_MOUSECURSOR_TYPE_NORTHEASTPANNING = 23, + PP_MOUSECURSOR_TYPE_NORTHWESTPANNING = 24, + PP_MOUSECURSOR_TYPE_SOUTHPANNING = 25, + PP_MOUSECURSOR_TYPE_SOUTHEASTPANNING = 26, + PP_MOUSECURSOR_TYPE_SOUTHWESTPANNING = 27, + PP_MOUSECURSOR_TYPE_WESTPANNING = 28, + PP_MOUSECURSOR_TYPE_MOVE = 29, + PP_MOUSECURSOR_TYPE_VERTICALTEXT = 30, + PP_MOUSECURSOR_TYPE_CELL = 31, + PP_MOUSECURSOR_TYPE_CONTEXTMENU = 32, + PP_MOUSECURSOR_TYPE_ALIAS = 33, + PP_MOUSECURSOR_TYPE_PROGRESS = 34, + PP_MOUSECURSOR_TYPE_NODROP = 35, + PP_MOUSECURSOR_TYPE_COPY = 36, + PP_MOUSECURSOR_TYPE_NONE = 37, + PP_MOUSECURSOR_TYPE_NOTALLOWED = 38, + PP_MOUSECURSOR_TYPE_ZOOMIN = 39, + PP_MOUSECURSOR_TYPE_ZOOMOUT = 40, + PP_MOUSECURSOR_TYPE_GRAB = 41, + PP_MOUSECURSOR_TYPE_GRABBING = 42 +}; +PP_COMPILE_ASSERT_ENUM_SIZE_IN_BYTES(PP_MouseCursor_Type, 4); +/** + * @} + */ + +/** + * @addtogroup Interfaces + * @{ + */ +/** + * The PPB_MouseCursor allows setting the mouse cursor. + */ +struct PPB_MouseCursor_1_0 { + /** + * Sets the given mouse cursor. The mouse cursor will be in effect whenever + * the mouse is over the given instance until it is set again by another + * call. Note that you can hide the mouse cursor by setting it to the + * PP_MOUSECURSOR_TYPE_NONE type. + * + * This function allows setting both system defined mouse cursors and + * custom cursors. To set a system-defined cursor, pass the type you want + * and set the custom image to 0 and the hot spot to NULL. To set a custom + * cursor, set the type to PP_MOUSECURSOR_TYPE_CUSTOM and + * specify your image and hot spot. + * + * @param[in] instance A PP_Instance identifying the instance + * that the mouse cursor will affect. + * + * @param[in] type A PP_MouseCursor_Type identifying the type of + * mouse cursor to show. + * + * @param[in] image A PPB_ImageData resource identifying the + * custom image to set when the type is + * PP_MOUSECURSOR_TYPE_CUSTOM. The image must be less than 32 + * pixels in each direction and must be of the system's native image format. + * When you are specifying a predefined cursor, this parameter must be 0. + * + * @param[in] hot_spot When setting a custom cursor, this identifies the + * pixel position within the given image of the "hot spot" of the cursor. + * When specifying a stock cursor, this parameter is ignored. + * + * @return PP_TRUE on success, or PP_FALSE if the instance or cursor type + * is invalid, or if the image is too large. + */ + PP_Bool (*SetCursor)(PP_Instance instance, + enum PP_MouseCursor_Type type, + PP_Resource image, + const struct PP_Point* hot_spot); +}; + +typedef struct PPB_MouseCursor_1_0 PPB_MouseCursor; +/** + * @} + */ + +/* ppb_mouse_lock.idl */ +/** + * @addtogroup Interfaces + * @{ + */ +/** + * The PPB_MouseLock interface is implemented by the browser. + * This interface provides a way of locking the target of mouse events to a + * single module instance and removing the cursor from view. This mode is + * useful for certain classes of applications, especially first-person + * perspective 3D applications and 3D modeling software. + */ +struct PPB_MouseLock_1_0 { + /** + * LockMouse() requests the mouse to be locked. + * + * While the mouse is locked, the cursor is implicitly hidden from the user. + * Any movement of the mouse will generate a + * PP_INPUTEVENT_TYPE_MOUSEMOVE event. The + * GetPosition() function in the PPB_MouseInputEvent + * interface reports the last known mouse position just as mouse lock was + * entered. The GetMovement() function provides relative movement + * information indicating what the change in position of the mouse would be + * had it not been locked. + * + * The browser may revoke the mouse lock for reasons including (but not + * limited to) the user pressing the ESC key, the user activating another + * program using a reserved keystroke (e.g. ALT+TAB), or some other system + * event. + * + * @param[in] instance A PP_Instance identifying one instance + * of a module. + * @param[in] callback A PP_CompletionCallback to be called upon + * completion. + * + * @return An int32_t containing an error code from pp_errors.h. + */ + int32_t (*LockMouse)(PP_Instance instance, + struct PP_CompletionCallback callback); + /** + * UnlockMouse() causes the mouse to be unlocked, allowing it to track user + * movement again. This is an asynchronous operation. The module instance + * will be notified using the PPP_MouseLock interface when it + * has lost the mouse lock. + * + * @param[in] instance A PP_Instance identifying one instance + * of a module. + */ + void (*UnlockMouse)(PP_Instance instance); +}; + +typedef struct PPB_MouseLock_1_0 PPB_MouseLock; +/** + * @} + */ + +/* ppb_network_list.idl */ +/** + * @addtogroup Enums + * @{ + */ +/** + * Type of a network interface. + */ +typedef enum { + /** + * Type of the network interface is not known. + */ + PP_NETWORKLIST_TYPE_UNKNOWN = 0, + /** + * Wired Ethernet network. + */ + PP_NETWORKLIST_TYPE_ETHERNET = 1, + /** + * Wireless Wi-Fi network. + */ + PP_NETWORKLIST_TYPE_WIFI = 2, + /** + * Cellular network (e.g. LTE). + */ + PP_NETWORKLIST_TYPE_CELLULAR = 3 +} PP_NetworkList_Type; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_NetworkList_Type, 4); + +/** + * State of a network interface. + */ +typedef enum { + /** + * Network interface is down. + */ + PP_NETWORKLIST_STATE_DOWN = 0, + /** + * Network interface is up. + */ + PP_NETWORKLIST_STATE_UP = 1 +} PP_NetworkList_State; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_NetworkList_State, 4); +/** + * @} + */ + +/** + * @addtogroup Interfaces + * @{ + */ +/** + * The PPB_NetworkList is used to represent a list of + * network interfaces and their configuration. The content of the list + * is immutable. The current networks configuration can be received + * using the PPB_NetworkMonitor interface. + */ +struct PPB_NetworkList_1_0 { + /** + * Determines if the specified resource is a + * NetworkList object. + * + * @param[in] resource A PP_Resource resource. + * + * @return Returns PP_TRUE if resource is + * a PPB_NetworkList, PP_FALSE + * otherwise. + */ + PP_Bool (*IsNetworkList)(PP_Resource resource); + /** + * Gets number of interfaces in the list. + * + * @param[in] resource A PP_Resource corresponding to a + * network list. + * + * @return Returns number of available network interfaces or 0 if + * the list has never been updated. + */ + uint32_t (*GetCount)(PP_Resource resource); + /** + * Gets name of a network interface. + * + * @param[in] resource A PP_Resource corresponding to a + * network list. + * @param[in] index Index of the network interface. + * + * @return Returns name for the network interface with the specified + * index. + */ + struct PP_Var (*GetName)(PP_Resource resource, uint32_t index); + /** + * Gets type of a network interface. + * + * @param[in] resource A PP_Resource corresponding to a + * network list. + * @param[in] index Index of the network interface. + * + * @return Returns type of the network interface with the specified + * index. + */ + PP_NetworkList_Type (*GetType)(PP_Resource resource, uint32_t index); + /** + * Gets state of a network interface. + * + * @param[in] resource A PP_Resource corresponding to a + * network list. + * @param[in] index Index of the network interface. + * + * @return Returns current state of the network interface with the + * specified index. + */ + PP_NetworkList_State (*GetState)(PP_Resource resource, uint32_t index); + /** + * Gets list of IP addresses for a network interface. + * + * @param[in] resource A PP_Resource corresponding to a + * network list. + * @param[in] index Index of the network interface. + * @param[in] output An output array which will receive + * PPB_NetAddress resources on success. Please note that the + * ref count of those resources has already been increased by 1 for the + * caller. + * + * @return An error code from pp_errors.h. + */ + int32_t (*GetIpAddresses)(PP_Resource resource, + uint32_t index, + struct PP_ArrayOutput output); + /** + * Gets display name of a network interface. + * + * @param[in] resource A PP_Resource corresponding to a + * network list. + * @param[in] index Index of the network interface. + * + * @return Returns display name for the network interface with the + * specified index. + */ + struct PP_Var (*GetDisplayName)(PP_Resource resource, uint32_t index); + /** + * Gets MTU (Maximum Transmission Unit) of a network interface. + * + * @param[in] resource A PP_Resource corresponding to a + * network list. + * @param[in] index Index of the network interface. + * + * @return Returns MTU for the network interface with the specified + * index or 0 if MTU is unknown. + */ + uint32_t (*GetMTU)(PP_Resource resource, uint32_t index); +}; + +typedef struct PPB_NetworkList_1_0 PPB_NetworkList; +/** + * @} + */ + +/* ppb_network_monitor.idl */ +/** + * @addtogroup Interfaces + * @{ + */ +/** + * The PPB_NetworkMonitor allows to get network interfaces + * configuration and monitor network configuration changes. + * + * Permissions: Apps permission socket with subrule + * network-state is required for UpdateNetworkList(). + * For more details about network communication permissions, please see: + * http://developer.chrome.com/apps/app_network.html + */ +struct PPB_NetworkMonitor_1_0 { + /** + * Creates a Network Monitor resource. + * + * @param[in] instance A PP_Instance identifying one instance of + * a module. + * + * @return A PP_Resource corresponding to a network monitor or 0 + * on failure. + */ + PP_Resource (*Create)(PP_Instance instance); + /** + * Gets current network configuration. When called for the first time, + * completes as soon as the current network configuration is received from + * the browser. Each consequent call will wait for network list changes, + * returning a new PPB_NetworkList resource every time. + * + * @param[in] network_monitor A PP_Resource corresponding to a + * network monitor. + * @param[out] network_list The PPB_NetworkList resource with the + * current state of network interfaces. + * @param[in] callback A PP_CompletionCallback to be called upon + * completion. + * + * @return An int32_t containing an error code from pp_errors.h. + * PP_ERROR_NOACCESS will be returned if the caller doesn't have + * required permissions. + */ + int32_t (*UpdateNetworkList)(PP_Resource network_monitor, + PP_Resource* network_list, + struct PP_CompletionCallback callback); + /** + * Determines if the specified resource is a + * NetworkMonitor object. + * + * @param[in] resource A PP_Resource resource. + * + * @return Returns PP_TRUE if resource is a + * PPB_NetworkMonitor, PP_FALSE otherwise. + */ + PP_Bool (*IsNetworkMonitor)(PP_Resource resource); +}; + +typedef struct PPB_NetworkMonitor_1_0 PPB_NetworkMonitor; +/** + * @} + */ + +/* ppb_network_proxy.idl */ +/** + * @addtogroup Interfaces + * @{ + */ +/** + * This interface provides a way to determine the appropriate proxy settings + * for a given URL. + * + * Permissions: Apps permission socket with subrule + * resolve-proxy is required for using this API. + * For more details about network communication permissions, please see: + * http://developer.chrome.com/apps/app_network.html + */ +struct PPB_NetworkProxy_1_0 { + /** + * Retrieves the proxy that will be used for the given URL. The result will + * be a string in PAC format. For more details about PAC format, please see + * http://en.wikipedia.org/wiki/Proxy_auto-config + * + * @param[in] instance A PP_Instance identifying one instance + * of a module. + * + * @param[in] url A string PP_Var containing a URL. + * + * @param[out] proxy_string A PP_Var that GetProxyForURL will + * set upon successful completion. If the call fails, proxy_string + * will be unchanged. Otherwise, it will be set to a string + * PP_Var containing the appropriate PAC string for url. + * If set, proxy_string will have a reference count of 1 which + * the plugin must manage. + * + * @param[in] callback A PP_CompletionCallback to be called upon + * completion. + * + * @return An int32_t containing an error code from pp_errors.h. + */ + int32_t (*GetProxyForURL)(PP_Instance instance, + struct PP_Var url, + struct PP_Var* proxy_string, + struct PP_CompletionCallback callback); +}; + +typedef struct PPB_NetworkProxy_1_0 PPB_NetworkProxy; +/** + * @} + */ + +/* ppb_opengles2.idl */ +#include "ppapi/c/pp_resource.h" + +#ifndef __gl2_h_ +typedef void GLvoid; +typedef int GLsizei; +typedef unsigned short GLushort; +typedef short GLshort; +typedef unsigned char GLubyte; +typedef unsigned int GLenum; +typedef int GLint; +typedef unsigned char GLboolean; +typedef unsigned int GLbitfield; +typedef float GLfloat; +typedef float GLclampf; +typedef signed char GLbyte; +typedef unsigned int GLuint; +typedef int GLfixed; +typedef int GLclampx; +#ifdef _WIN64 +typedef long long int GLintptr; +typedef long long int GLsizeiptr; +#else +typedef long int GLintptr; +typedef long int GLsizeiptr; +#endif // _WIN64 +#endif // __gl2_h_ + + +/** + * @addtogroup Interfaces + * @{ + */ +struct PPB_OpenGLES2_1_0 { + void (*ActiveTexture)(PP_Resource context, GLenum texture); + void (*AttachShader)(PP_Resource context, GLuint program, GLuint shader); + void (*BindAttribLocation)(PP_Resource context, + GLuint program, + GLuint index, + const char* name); + void (*BindBuffer)(PP_Resource context, GLenum target, GLuint buffer); + void (*BindFramebuffer)(PP_Resource context, + GLenum target, + GLuint framebuffer); + void (*BindRenderbuffer)(PP_Resource context, + GLenum target, + GLuint renderbuffer); + void (*BindTexture)(PP_Resource context, GLenum target, GLuint texture); + void (*BlendColor)(PP_Resource context, + GLclampf red, + GLclampf green, + GLclampf blue, + GLclampf alpha); + void (*BlendEquation)(PP_Resource context, GLenum mode); + void (*BlendEquationSeparate)(PP_Resource context, + GLenum modeRGB, + GLenum modeAlpha); + void (*BlendFunc)(PP_Resource context, GLenum sfactor, GLenum dfactor); + void (*BlendFuncSeparate)(PP_Resource context, + GLenum srcRGB, + GLenum dstRGB, + GLenum srcAlpha, + GLenum dstAlpha); + void (*BufferData)(PP_Resource context, + GLenum target, + GLsizeiptr size, + const void* data, + GLenum usage); + void (*BufferSubData)(PP_Resource context, + GLenum target, + GLintptr offset, + GLsizeiptr size, + const void* data); + GLenum (*CheckFramebufferStatus)(PP_Resource context, GLenum target); + void (*Clear)(PP_Resource context, GLbitfield mask); + void (*ClearColor)(PP_Resource context, + GLclampf red, + GLclampf green, + GLclampf blue, + GLclampf alpha); + void (*ClearDepthf)(PP_Resource context, GLclampf depth); + void (*ClearStencil)(PP_Resource context, GLint s); + void (*ColorMask)(PP_Resource context, + GLboolean red, + GLboolean green, + GLboolean blue, + GLboolean alpha); + void (*CompileShader)(PP_Resource context, GLuint shader); + void (*CompressedTexImage2D)(PP_Resource context, + GLenum target, + GLint level, + GLenum internalformat, + GLsizei width, + GLsizei height, + GLint border, + GLsizei imageSize, + const void* data); + void (*CompressedTexSubImage2D)(PP_Resource context, + GLenum target, + GLint level, + GLint xoffset, + GLint yoffset, + GLsizei width, + GLsizei height, + GLenum format, + GLsizei imageSize, + const void* data); + void (*CopyTexImage2D)(PP_Resource context, + GLenum target, + GLint level, + GLenum internalformat, + GLint x, + GLint y, + GLsizei width, + GLsizei height, + GLint border); + void (*CopyTexSubImage2D)(PP_Resource context, + GLenum target, + GLint level, + GLint xoffset, + GLint yoffset, + GLint x, + GLint y, + GLsizei width, + GLsizei height); + GLuint (*CreateProgram)(PP_Resource context); + GLuint (*CreateShader)(PP_Resource context, GLenum type); + void (*CullFace)(PP_Resource context, GLenum mode); + void (*DeleteBuffers)(PP_Resource context, GLsizei n, const GLuint* buffers); + void (*DeleteFramebuffers)(PP_Resource context, + GLsizei n, + const GLuint* framebuffers); + void (*DeleteProgram)(PP_Resource context, GLuint program); + void (*DeleteRenderbuffers)(PP_Resource context, + GLsizei n, + const GLuint* renderbuffers); + void (*DeleteShader)(PP_Resource context, GLuint shader); + void (*DeleteTextures)(PP_Resource context, + GLsizei n, + const GLuint* textures); + void (*DepthFunc)(PP_Resource context, GLenum func); + void (*DepthMask)(PP_Resource context, GLboolean flag); + void (*DepthRangef)(PP_Resource context, GLclampf zNear, GLclampf zFar); + void (*DetachShader)(PP_Resource context, GLuint program, GLuint shader); + void (*Disable)(PP_Resource context, GLenum cap); + void (*DisableVertexAttribArray)(PP_Resource context, GLuint index); + void (*DrawArrays)(PP_Resource context, + GLenum mode, + GLint first, + GLsizei count); + void (*DrawElements)(PP_Resource context, + GLenum mode, + GLsizei count, + GLenum type, + const void* indices); + void (*Enable)(PP_Resource context, GLenum cap); + void (*EnableVertexAttribArray)(PP_Resource context, GLuint index); + void (*Finish)(PP_Resource context); + void (*Flush)(PP_Resource context); + void (*FramebufferRenderbuffer)(PP_Resource context, + GLenum target, + GLenum attachment, + GLenum renderbuffertarget, + GLuint renderbuffer); + void (*FramebufferTexture2D)(PP_Resource context, + GLenum target, + GLenum attachment, + GLenum textarget, + GLuint texture, + GLint level); + void (*FrontFace)(PP_Resource context, GLenum mode); + void (*GenBuffers)(PP_Resource context, GLsizei n, GLuint* buffers); + void (*GenerateMipmap)(PP_Resource context, GLenum target); + void (*GenFramebuffers)(PP_Resource context, GLsizei n, GLuint* framebuffers); + void (*GenRenderbuffers)(PP_Resource context, + GLsizei n, + GLuint* renderbuffers); + void (*GenTextures)(PP_Resource context, GLsizei n, GLuint* textures); + void (*GetActiveAttrib)(PP_Resource context, + GLuint program, + GLuint index, + GLsizei bufsize, + GLsizei* length, + GLint* size, + GLenum* type, + char* name); + void (*GetActiveUniform)(PP_Resource context, + GLuint program, + GLuint index, + GLsizei bufsize, + GLsizei* length, + GLint* size, + GLenum* type, + char* name); + void (*GetAttachedShaders)(PP_Resource context, + GLuint program, + GLsizei maxcount, + GLsizei* count, + GLuint* shaders); + GLint (*GetAttribLocation)(PP_Resource context, + GLuint program, + const char* name); + void (*GetBooleanv)(PP_Resource context, GLenum pname, GLboolean* params); + void (*GetBufferParameteriv)(PP_Resource context, + GLenum target, + GLenum pname, + GLint* params); + GLenum (*GetError)(PP_Resource context); + void (*GetFloatv)(PP_Resource context, GLenum pname, GLfloat* params); + void (*GetFramebufferAttachmentParameteriv)(PP_Resource context, + GLenum target, + GLenum attachment, + GLenum pname, + GLint* params); + void (*GetIntegerv)(PP_Resource context, GLenum pname, GLint* params); + void (*GetProgramiv)(PP_Resource context, + GLuint program, + GLenum pname, + GLint* params); + void (*GetProgramInfoLog)(PP_Resource context, + GLuint program, + GLsizei bufsize, + GLsizei* length, + char* infolog); + void (*GetRenderbufferParameteriv)(PP_Resource context, + GLenum target, + GLenum pname, + GLint* params); + void (*GetShaderiv)(PP_Resource context, + GLuint shader, + GLenum pname, + GLint* params); + void (*GetShaderInfoLog)(PP_Resource context, + GLuint shader, + GLsizei bufsize, + GLsizei* length, + char* infolog); + void (*GetShaderPrecisionFormat)(PP_Resource context, + GLenum shadertype, + GLenum precisiontype, + GLint* range, + GLint* precision); + void (*GetShaderSource)(PP_Resource context, + GLuint shader, + GLsizei bufsize, + GLsizei* length, + char* source); + const GLubyte* (*GetString)(PP_Resource context, GLenum name); + void (*GetTexParameterfv)(PP_Resource context, + GLenum target, + GLenum pname, + GLfloat* params); + void (*GetTexParameteriv)(PP_Resource context, + GLenum target, + GLenum pname, + GLint* params); + void (*GetUniformfv)(PP_Resource context, + GLuint program, + GLint location, + GLfloat* params); + void (*GetUniformiv)(PP_Resource context, + GLuint program, + GLint location, + GLint* params); + GLint (*GetUniformLocation)(PP_Resource context, + GLuint program, + const char* name); + void (*GetVertexAttribfv)(PP_Resource context, + GLuint index, + GLenum pname, + GLfloat* params); + void (*GetVertexAttribiv)(PP_Resource context, + GLuint index, + GLenum pname, + GLint* params); + void (*GetVertexAttribPointerv)(PP_Resource context, + GLuint index, + GLenum pname, + void** pointer); + void (*Hint)(PP_Resource context, GLenum target, GLenum mode); + GLboolean (*IsBuffer)(PP_Resource context, GLuint buffer); + GLboolean (*IsEnabled)(PP_Resource context, GLenum cap); + GLboolean (*IsFramebuffer)(PP_Resource context, GLuint framebuffer); + GLboolean (*IsProgram)(PP_Resource context, GLuint program); + GLboolean (*IsRenderbuffer)(PP_Resource context, GLuint renderbuffer); + GLboolean (*IsShader)(PP_Resource context, GLuint shader); + GLboolean (*IsTexture)(PP_Resource context, GLuint texture); + void (*LineWidth)(PP_Resource context, GLfloat width); + void (*LinkProgram)(PP_Resource context, GLuint program); + void (*PixelStorei)(PP_Resource context, GLenum pname, GLint param); + void (*PolygonOffset)(PP_Resource context, GLfloat factor, GLfloat units); + void (*ReadPixels)(PP_Resource context, + GLint x, + GLint y, + GLsizei width, + GLsizei height, + GLenum format, + GLenum type, + void* pixels); + void (*ReleaseShaderCompiler)(PP_Resource context); + void (*RenderbufferStorage)(PP_Resource context, + GLenum target, + GLenum internalformat, + GLsizei width, + GLsizei height); + void (*SampleCoverage)(PP_Resource context, GLclampf value, GLboolean invert); + void (*Scissor)(PP_Resource context, + GLint x, + GLint y, + GLsizei width, + GLsizei height); + void (*ShaderBinary)(PP_Resource context, + GLsizei n, + const GLuint* shaders, + GLenum binaryformat, + const void* binary, + GLsizei length); + void (*ShaderSource)(PP_Resource context, + GLuint shader, + GLsizei count, + const char** str, + const GLint* length); + void (*StencilFunc)(PP_Resource context, GLenum func, GLint ref, GLuint mask); + void (*StencilFuncSeparate)(PP_Resource context, + GLenum face, + GLenum func, + GLint ref, + GLuint mask); + void (*StencilMask)(PP_Resource context, GLuint mask); + void (*StencilMaskSeparate)(PP_Resource context, GLenum face, GLuint mask); + void (*StencilOp)(PP_Resource context, + GLenum fail, + GLenum zfail, + GLenum zpass); + void (*StencilOpSeparate)(PP_Resource context, + GLenum face, + GLenum fail, + GLenum zfail, + GLenum zpass); + void (*TexImage2D)(PP_Resource context, + GLenum target, + GLint level, + GLint internalformat, + GLsizei width, + GLsizei height, + GLint border, + GLenum format, + GLenum type, + const void* pixels); + void (*TexParameterf)(PP_Resource context, + GLenum target, + GLenum pname, + GLfloat param); + void (*TexParameterfv)(PP_Resource context, + GLenum target, + GLenum pname, + const GLfloat* params); + void (*TexParameteri)(PP_Resource context, + GLenum target, + GLenum pname, + GLint param); + void (*TexParameteriv)(PP_Resource context, + GLenum target, + GLenum pname, + const GLint* params); + void (*TexSubImage2D)(PP_Resource context, + GLenum target, + GLint level, + GLint xoffset, + GLint yoffset, + GLsizei width, + GLsizei height, + GLenum format, + GLenum type, + const void* pixels); + void (*Uniform1f)(PP_Resource context, GLint location, GLfloat x); + void (*Uniform1fv)(PP_Resource context, + GLint location, + GLsizei count, + const GLfloat* v); + void (*Uniform1i)(PP_Resource context, GLint location, GLint x); + void (*Uniform1iv)(PP_Resource context, + GLint location, + GLsizei count, + const GLint* v); + void (*Uniform2f)(PP_Resource context, GLint location, GLfloat x, GLfloat y); + void (*Uniform2fv)(PP_Resource context, + GLint location, + GLsizei count, + const GLfloat* v); + void (*Uniform2i)(PP_Resource context, GLint location, GLint x, GLint y); + void (*Uniform2iv)(PP_Resource context, + GLint location, + GLsizei count, + const GLint* v); + void (*Uniform3f)(PP_Resource context, + GLint location, + GLfloat x, + GLfloat y, + GLfloat z); + void (*Uniform3fv)(PP_Resource context, + GLint location, + GLsizei count, + const GLfloat* v); + void (*Uniform3i)(PP_Resource context, + GLint location, + GLint x, + GLint y, + GLint z); + void (*Uniform3iv)(PP_Resource context, + GLint location, + GLsizei count, + const GLint* v); + void (*Uniform4f)(PP_Resource context, + GLint location, + GLfloat x, + GLfloat y, + GLfloat z, + GLfloat w); + void (*Uniform4fv)(PP_Resource context, + GLint location, + GLsizei count, + const GLfloat* v); + void (*Uniform4i)(PP_Resource context, + GLint location, + GLint x, + GLint y, + GLint z, + GLint w); + void (*Uniform4iv)(PP_Resource context, + GLint location, + GLsizei count, + const GLint* v); + void (*UniformMatrix2fv)(PP_Resource context, + GLint location, + GLsizei count, + GLboolean transpose, + const GLfloat* value); + void (*UniformMatrix3fv)(PP_Resource context, + GLint location, + GLsizei count, + GLboolean transpose, + const GLfloat* value); + void (*UniformMatrix4fv)(PP_Resource context, + GLint location, + GLsizei count, + GLboolean transpose, + const GLfloat* value); + void (*UseProgram)(PP_Resource context, GLuint program); + void (*ValidateProgram)(PP_Resource context, GLuint program); + void (*VertexAttrib1f)(PP_Resource context, GLuint indx, GLfloat x); + void (*VertexAttrib1fv)(PP_Resource context, + GLuint indx, + const GLfloat* values); + void (*VertexAttrib2f)(PP_Resource context, + GLuint indx, + GLfloat x, + GLfloat y); + void (*VertexAttrib2fv)(PP_Resource context, + GLuint indx, + const GLfloat* values); + void (*VertexAttrib3f)(PP_Resource context, + GLuint indx, + GLfloat x, + GLfloat y, + GLfloat z); + void (*VertexAttrib3fv)(PP_Resource context, + GLuint indx, + const GLfloat* values); + void (*VertexAttrib4f)(PP_Resource context, + GLuint indx, + GLfloat x, + GLfloat y, + GLfloat z, + GLfloat w); + void (*VertexAttrib4fv)(PP_Resource context, + GLuint indx, + const GLfloat* values); + void (*VertexAttribPointer)(PP_Resource context, + GLuint indx, + GLint size, + GLenum type, + GLboolean normalized, + GLsizei stride, + const void* ptr); + void (*Viewport)(PP_Resource context, + GLint x, + GLint y, + GLsizei width, + GLsizei height); +}; + +struct PPB_OpenGLES2 { + void (*ActiveTexture)(PP_Resource context, GLenum texture); + void (*AttachShader)(PP_Resource context, GLuint program, GLuint shader); + void (*BindAttribLocation)(PP_Resource context, + GLuint program, + GLuint index, + const char* name); + void (*BindBuffer)(PP_Resource context, GLenum target, GLuint buffer); + void (*BindFramebuffer)(PP_Resource context, + GLenum target, + GLuint framebuffer); + void (*BindRenderbuffer)(PP_Resource context, + GLenum target, + GLuint renderbuffer); + void (*BindTexture)(PP_Resource context, GLenum target, GLuint texture); + void (*BlendColor)(PP_Resource context, + GLclampf red, + GLclampf green, + GLclampf blue, + GLclampf alpha); + void (*BlendEquation)(PP_Resource context, GLenum mode); + void (*BlendEquationSeparate)(PP_Resource context, + GLenum modeRGB, + GLenum modeAlpha); + void (*BlendFunc)(PP_Resource context, GLenum sfactor, GLenum dfactor); + void (*BlendFuncSeparate)(PP_Resource context, + GLenum srcRGB, + GLenum dstRGB, + GLenum srcAlpha, + GLenum dstAlpha); + void (*BufferData)(PP_Resource context, + GLenum target, + GLsizeiptr size, + const void* data, + GLenum usage); + void (*BufferSubData)(PP_Resource context, + GLenum target, + GLintptr offset, + GLsizeiptr size, + const void* data); + GLenum (*CheckFramebufferStatus)(PP_Resource context, GLenum target); + void (*Clear)(PP_Resource context, GLbitfield mask); + void (*ClearColor)(PP_Resource context, + GLclampf red, + GLclampf green, + GLclampf blue, + GLclampf alpha); + void (*ClearDepthf)(PP_Resource context, GLclampf depth); + void (*ClearStencil)(PP_Resource context, GLint s); + void (*ColorMask)(PP_Resource context, + GLboolean red, + GLboolean green, + GLboolean blue, + GLboolean alpha); + void (*CompileShader)(PP_Resource context, GLuint shader); + void (*CompressedTexImage2D)(PP_Resource context, + GLenum target, + GLint level, + GLenum internalformat, + GLsizei width, + GLsizei height, + GLint border, + GLsizei imageSize, + const void* data); + void (*CompressedTexSubImage2D)(PP_Resource context, + GLenum target, + GLint level, + GLint xoffset, + GLint yoffset, + GLsizei width, + GLsizei height, + GLenum format, + GLsizei imageSize, + const void* data); + void (*CopyTexImage2D)(PP_Resource context, + GLenum target, + GLint level, + GLenum internalformat, + GLint x, + GLint y, + GLsizei width, + GLsizei height, + GLint border); + void (*CopyTexSubImage2D)(PP_Resource context, + GLenum target, + GLint level, + GLint xoffset, + GLint yoffset, + GLint x, + GLint y, + GLsizei width, + GLsizei height); + GLuint (*CreateProgram)(PP_Resource context); + GLuint (*CreateShader)(PP_Resource context, GLenum type); + void (*CullFace)(PP_Resource context, GLenum mode); + void (*DeleteBuffers)(PP_Resource context, GLsizei n, const GLuint* buffers); + void (*DeleteFramebuffers)(PP_Resource context, + GLsizei n, + const GLuint* framebuffers); + void (*DeleteProgram)(PP_Resource context, GLuint program); + void (*DeleteRenderbuffers)(PP_Resource context, + GLsizei n, + const GLuint* renderbuffers); + void (*DeleteShader)(PP_Resource context, GLuint shader); + void (*DeleteTextures)(PP_Resource context, + GLsizei n, + const GLuint* textures); + void (*DepthFunc)(PP_Resource context, GLenum func); + void (*DepthMask)(PP_Resource context, GLboolean flag); + void (*DepthRangef)(PP_Resource context, GLclampf zNear, GLclampf zFar); + void (*DetachShader)(PP_Resource context, GLuint program, GLuint shader); + void (*Disable)(PP_Resource context, GLenum cap); + void (*DisableVertexAttribArray)(PP_Resource context, GLuint index); + void (*DrawArrays)(PP_Resource context, + GLenum mode, + GLint first, + GLsizei count); + void (*DrawElements)(PP_Resource context, + GLenum mode, + GLsizei count, + GLenum type, + const void* indices); + void (*Enable)(PP_Resource context, GLenum cap); + void (*EnableVertexAttribArray)(PP_Resource context, GLuint index); + void (*Finish)(PP_Resource context); + void (*Flush)(PP_Resource context); + void (*FramebufferRenderbuffer)(PP_Resource context, + GLenum target, + GLenum attachment, + GLenum renderbuffertarget, + GLuint renderbuffer); + void (*FramebufferTexture2D)(PP_Resource context, + GLenum target, + GLenum attachment, + GLenum textarget, + GLuint texture, + GLint level); + void (*FrontFace)(PP_Resource context, GLenum mode); + void (*GenBuffers)(PP_Resource context, GLsizei n, GLuint* buffers); + void (*GenerateMipmap)(PP_Resource context, GLenum target); + void (*GenFramebuffers)(PP_Resource context, GLsizei n, GLuint* framebuffers); + void (*GenRenderbuffers)(PP_Resource context, + GLsizei n, + GLuint* renderbuffers); + void (*GenTextures)(PP_Resource context, GLsizei n, GLuint* textures); + void (*GetActiveAttrib)(PP_Resource context, + GLuint program, + GLuint index, + GLsizei bufsize, + GLsizei* length, + GLint* size, + GLenum* type, + char* name); + void (*GetActiveUniform)(PP_Resource context, + GLuint program, + GLuint index, + GLsizei bufsize, + GLsizei* length, + GLint* size, + GLenum* type, + char* name); + void (*GetAttachedShaders)(PP_Resource context, + GLuint program, + GLsizei maxcount, + GLsizei* count, + GLuint* shaders); + GLint (*GetAttribLocation)(PP_Resource context, + GLuint program, + const char* name); + void (*GetBooleanv)(PP_Resource context, GLenum pname, GLboolean* params); + void (*GetBufferParameteriv)(PP_Resource context, + GLenum target, + GLenum pname, + GLint* params); + GLenum (*GetError)(PP_Resource context); + void (*GetFloatv)(PP_Resource context, GLenum pname, GLfloat* params); + void (*GetFramebufferAttachmentParameteriv)(PP_Resource context, + GLenum target, + GLenum attachment, + GLenum pname, + GLint* params); + void (*GetIntegerv)(PP_Resource context, GLenum pname, GLint* params); + void (*GetProgramiv)(PP_Resource context, + GLuint program, + GLenum pname, + GLint* params); + void (*GetProgramInfoLog)(PP_Resource context, + GLuint program, + GLsizei bufsize, + GLsizei* length, + char* infolog); + void (*GetRenderbufferParameteriv)(PP_Resource context, + GLenum target, + GLenum pname, + GLint* params); + void (*GetShaderiv)(PP_Resource context, + GLuint shader, + GLenum pname, + GLint* params); + void (*GetShaderInfoLog)(PP_Resource context, + GLuint shader, + GLsizei bufsize, + GLsizei* length, + char* infolog); + void (*GetShaderPrecisionFormat)(PP_Resource context, + GLenum shadertype, + GLenum precisiontype, + GLint* range, + GLint* precision); + void (*GetShaderSource)(PP_Resource context, + GLuint shader, + GLsizei bufsize, + GLsizei* length, + char* source); + const GLubyte* (*GetString)(PP_Resource context, GLenum name); + void (*GetTexParameterfv)(PP_Resource context, + GLenum target, + GLenum pname, + GLfloat* params); + void (*GetTexParameteriv)(PP_Resource context, + GLenum target, + GLenum pname, + GLint* params); + void (*GetUniformfv)(PP_Resource context, + GLuint program, + GLint location, + GLfloat* params); + void (*GetUniformiv)(PP_Resource context, + GLuint program, + GLint location, + GLint* params); + GLint (*GetUniformLocation)(PP_Resource context, + GLuint program, + const char* name); + void (*GetVertexAttribfv)(PP_Resource context, + GLuint index, + GLenum pname, + GLfloat* params); + void (*GetVertexAttribiv)(PP_Resource context, + GLuint index, + GLenum pname, + GLint* params); + void (*GetVertexAttribPointerv)(PP_Resource context, + GLuint index, + GLenum pname, + void** pointer); + void (*Hint)(PP_Resource context, GLenum target, GLenum mode); + GLboolean (*IsBuffer)(PP_Resource context, GLuint buffer); + GLboolean (*IsEnabled)(PP_Resource context, GLenum cap); + GLboolean (*IsFramebuffer)(PP_Resource context, GLuint framebuffer); + GLboolean (*IsProgram)(PP_Resource context, GLuint program); + GLboolean (*IsRenderbuffer)(PP_Resource context, GLuint renderbuffer); + GLboolean (*IsShader)(PP_Resource context, GLuint shader); + GLboolean (*IsTexture)(PP_Resource context, GLuint texture); + void (*LineWidth)(PP_Resource context, GLfloat width); + void (*LinkProgram)(PP_Resource context, GLuint program); + void (*PixelStorei)(PP_Resource context, GLenum pname, GLint param); + void (*PolygonOffset)(PP_Resource context, GLfloat factor, GLfloat units); + void (*ReadPixels)(PP_Resource context, + GLint x, + GLint y, + GLsizei width, + GLsizei height, + GLenum format, + GLenum type, + void* pixels); + void (*ReleaseShaderCompiler)(PP_Resource context); + void (*RenderbufferStorage)(PP_Resource context, + GLenum target, + GLenum internalformat, + GLsizei width, + GLsizei height); + void (*SampleCoverage)(PP_Resource context, GLclampf value, GLboolean invert); + void (*Scissor)(PP_Resource context, + GLint x, + GLint y, + GLsizei width, + GLsizei height); + void (*ShaderBinary)(PP_Resource context, + GLsizei n, + const GLuint* shaders, + GLenum binaryformat, + const void* binary, + GLsizei length); + void (*ShaderSource)(PP_Resource context, + GLuint shader, + GLsizei count, + const char** str, + const GLint* length); + void (*StencilFunc)(PP_Resource context, GLenum func, GLint ref, GLuint mask); + void (*StencilFuncSeparate)(PP_Resource context, + GLenum face, + GLenum func, + GLint ref, + GLuint mask); + void (*StencilMask)(PP_Resource context, GLuint mask); + void (*StencilMaskSeparate)(PP_Resource context, GLenum face, GLuint mask); + void (*StencilOp)(PP_Resource context, + GLenum fail, + GLenum zfail, + GLenum zpass); + void (*StencilOpSeparate)(PP_Resource context, + GLenum face, + GLenum fail, + GLenum zfail, + GLenum zpass); + void (*TexImage2D)(PP_Resource context, + GLenum target, + GLint level, + GLint internalformat, + GLsizei width, + GLsizei height, + GLint border, + GLenum format, + GLenum type, + const void* pixels); + void (*TexParameterf)(PP_Resource context, + GLenum target, + GLenum pname, + GLfloat param); + void (*TexParameterfv)(PP_Resource context, + GLenum target, + GLenum pname, + const GLfloat* params); + void (*TexParameteri)(PP_Resource context, + GLenum target, + GLenum pname, + GLint param); + void (*TexParameteriv)(PP_Resource context, + GLenum target, + GLenum pname, + const GLint* params); + void (*TexSubImage2D)(PP_Resource context, + GLenum target, + GLint level, + GLint xoffset, + GLint yoffset, + GLsizei width, + GLsizei height, + GLenum format, + GLenum type, + const void* pixels); + void (*Uniform1f)(PP_Resource context, GLint location, GLfloat x); + void (*Uniform1fv)(PP_Resource context, + GLint location, + GLsizei count, + const GLfloat* v); + void (*Uniform1i)(PP_Resource context, GLint location, GLint x); + void (*Uniform1iv)(PP_Resource context, + GLint location, + GLsizei count, + const GLint* v); + void (*Uniform2f)(PP_Resource context, GLint location, GLfloat x, GLfloat y); + void (*Uniform2fv)(PP_Resource context, + GLint location, + GLsizei count, + const GLfloat* v); + void (*Uniform2i)(PP_Resource context, GLint location, GLint x, GLint y); + void (*Uniform2iv)(PP_Resource context, + GLint location, + GLsizei count, + const GLint* v); + void (*Uniform3f)(PP_Resource context, + GLint location, + GLfloat x, + GLfloat y, + GLfloat z); + void (*Uniform3fv)(PP_Resource context, + GLint location, + GLsizei count, + const GLfloat* v); + void (*Uniform3i)(PP_Resource context, + GLint location, + GLint x, + GLint y, + GLint z); + void (*Uniform3iv)(PP_Resource context, + GLint location, + GLsizei count, + const GLint* v); + void (*Uniform4f)(PP_Resource context, + GLint location, + GLfloat x, + GLfloat y, + GLfloat z, + GLfloat w); + void (*Uniform4fv)(PP_Resource context, + GLint location, + GLsizei count, + const GLfloat* v); + void (*Uniform4i)(PP_Resource context, + GLint location, + GLint x, + GLint y, + GLint z, + GLint w); + void (*Uniform4iv)(PP_Resource context, + GLint location, + GLsizei count, + const GLint* v); + void (*UniformMatrix2fv)(PP_Resource context, + GLint location, + GLsizei count, + GLboolean transpose, + const GLfloat* value); + void (*UniformMatrix3fv)(PP_Resource context, + GLint location, + GLsizei count, + GLboolean transpose, + const GLfloat* value); + void (*UniformMatrix4fv)(PP_Resource context, + GLint location, + GLsizei count, + GLboolean transpose, + const GLfloat* value); + void (*UseProgram)(PP_Resource context, GLuint program); + void (*ValidateProgram)(PP_Resource context, GLuint program); + void (*VertexAttrib1f)(PP_Resource context, GLuint indx, GLfloat x); + void (*VertexAttrib1fv)(PP_Resource context, + GLuint indx, + const GLfloat* values); + void (*VertexAttrib2f)(PP_Resource context, + GLuint indx, + GLfloat x, + GLfloat y); + void (*VertexAttrib2fv)(PP_Resource context, + GLuint indx, + const GLfloat* values); + void (*VertexAttrib3f)(PP_Resource context, + GLuint indx, + GLfloat x, + GLfloat y, + GLfloat z); + void (*VertexAttrib3fv)(PP_Resource context, + GLuint indx, + const GLfloat* values); + void (*VertexAttrib4f)(PP_Resource context, + GLuint indx, + GLfloat x, + GLfloat y, + GLfloat z, + GLfloat w); + void (*VertexAttrib4fv)(PP_Resource context, + GLuint indx, + const GLfloat* values); + void (*VertexAttribPointer)(PP_Resource context, + GLuint indx, + GLint size, + GLenum type, + GLboolean normalized, + GLsizei stride, + const void* ptr); + void (*Viewport)(PP_Resource context, + GLint x, + GLint y, + GLsizei width, + GLsizei height); +}; + +struct PPB_OpenGLES2InstancedArrays_1_0 { + void (*DrawArraysInstancedANGLE)(PP_Resource context, + GLenum mode, + GLint first, + GLsizei count, + GLsizei primcount); + void (*DrawElementsInstancedANGLE)(PP_Resource context, + GLenum mode, + GLsizei count, + GLenum type, + const void* indices, + GLsizei primcount); + void (*VertexAttribDivisorANGLE)(PP_Resource context, + GLuint index, + GLuint divisor); +}; + +struct PPB_OpenGLES2InstancedArrays { + void (*DrawArraysInstancedANGLE)(PP_Resource context, + GLenum mode, + GLint first, + GLsizei count, + GLsizei primcount); + void (*DrawElementsInstancedANGLE)(PP_Resource context, + GLenum mode, + GLsizei count, + GLenum type, + const void* indices, + GLsizei primcount); + void (*VertexAttribDivisorANGLE)(PP_Resource context, + GLuint index, + GLuint divisor); +}; + +struct PPB_OpenGLES2FramebufferBlit_1_0 { + void (*BlitFramebufferEXT)(PP_Resource context, + GLint srcX0, + GLint srcY0, + GLint srcX1, + GLint srcY1, + GLint dstX0, + GLint dstY0, + GLint dstX1, + GLint dstY1, + GLbitfield mask, + GLenum filter); +}; + +struct PPB_OpenGLES2FramebufferBlit { + void (*BlitFramebufferEXT)(PP_Resource context, + GLint srcX0, + GLint srcY0, + GLint srcX1, + GLint srcY1, + GLint dstX0, + GLint dstY0, + GLint dstX1, + GLint dstY1, + GLbitfield mask, + GLenum filter); +}; + +struct PPB_OpenGLES2FramebufferMultisample_1_0 { + void (*RenderbufferStorageMultisampleEXT)(PP_Resource context, + GLenum target, + GLsizei samples, + GLenum internalformat, + GLsizei width, + GLsizei height); +}; + +struct PPB_OpenGLES2FramebufferMultisample { + void (*RenderbufferStorageMultisampleEXT)(PP_Resource context, + GLenum target, + GLsizei samples, + GLenum internalformat, + GLsizei width, + GLsizei height); +}; + +struct PPB_OpenGLES2ChromiumEnableFeature_1_0 { + GLboolean (*EnableFeatureCHROMIUM)(PP_Resource context, const char* feature); +}; + +struct PPB_OpenGLES2ChromiumEnableFeature { + GLboolean (*EnableFeatureCHROMIUM)(PP_Resource context, const char* feature); +}; + +struct PPB_OpenGLES2ChromiumMapSub_1_0 { + void* (*MapBufferSubDataCHROMIUM)(PP_Resource context, + GLuint target, + GLintptr offset, + GLsizeiptr size, + GLenum access); + void (*UnmapBufferSubDataCHROMIUM)(PP_Resource context, const void* mem); + void* (*MapTexSubImage2DCHROMIUM)(PP_Resource context, + GLenum target, + GLint level, + GLint xoffset, + GLint yoffset, + GLsizei width, + GLsizei height, + GLenum format, + GLenum type, + GLenum access); + void (*UnmapTexSubImage2DCHROMIUM)(PP_Resource context, const void* mem); +}; + +struct PPB_OpenGLES2ChromiumMapSub { + void* (*MapBufferSubDataCHROMIUM)(PP_Resource context, + GLuint target, + GLintptr offset, + GLsizeiptr size, + GLenum access); + void (*UnmapBufferSubDataCHROMIUM)(PP_Resource context, const void* mem); + void* (*MapTexSubImage2DCHROMIUM)(PP_Resource context, + GLenum target, + GLint level, + GLint xoffset, + GLint yoffset, + GLsizei width, + GLsizei height, + GLenum format, + GLenum type, + GLenum access); + void (*UnmapTexSubImage2DCHROMIUM)(PP_Resource context, const void* mem); +}; + +struct PPB_OpenGLES2Query_1_0 { + void (*GenQueriesEXT)(PP_Resource context, GLsizei n, GLuint* queries); + void (*DeleteQueriesEXT)(PP_Resource context, + GLsizei n, + const GLuint* queries); + GLboolean (*IsQueryEXT)(PP_Resource context, GLuint id); + void (*BeginQueryEXT)(PP_Resource context, GLenum target, GLuint id); + void (*EndQueryEXT)(PP_Resource context, GLenum target); + void (*GetQueryivEXT)(PP_Resource context, + GLenum target, + GLenum pname, + GLint* params); + void (*GetQueryObjectuivEXT)(PP_Resource context, + GLuint id, + GLenum pname, + GLuint* params); +}; + +struct PPB_OpenGLES2Query { + void (*GenQueriesEXT)(PP_Resource context, GLsizei n, GLuint* queries); + void (*DeleteQueriesEXT)(PP_Resource context, + GLsizei n, + const GLuint* queries); + GLboolean (*IsQueryEXT)(PP_Resource context, GLuint id); + void (*BeginQueryEXT)(PP_Resource context, GLenum target, GLuint id); + void (*EndQueryEXT)(PP_Resource context, GLenum target); + void (*GetQueryivEXT)(PP_Resource context, + GLenum target, + GLenum pname, + GLint* params); + void (*GetQueryObjectuivEXT)(PP_Resource context, + GLuint id, + GLenum pname, + GLuint* params); +}; + +struct PPB_OpenGLES2VertexArrayObject_1_0 { + void (*GenVertexArraysOES)(PP_Resource context, GLsizei n, GLuint* arrays); + void (*DeleteVertexArraysOES)(PP_Resource context, + GLsizei n, + const GLuint* arrays); + GLboolean (*IsVertexArrayOES)(PP_Resource context, GLuint array); + void (*BindVertexArrayOES)(PP_Resource context, GLuint array); +}; + +struct PPB_OpenGLES2VertexArrayObject { + void (*GenVertexArraysOES)(PP_Resource context, GLsizei n, GLuint* arrays); + void (*DeleteVertexArraysOES)(PP_Resource context, + GLsizei n, + const GLuint* arrays); + GLboolean (*IsVertexArrayOES)(PP_Resource context, GLuint array); + void (*BindVertexArrayOES)(PP_Resource context, GLuint array); +}; +/** + * @} + */ + +/* ppb_tcp_socket.idl */ +/** + * @addtogroup Enums + * @{ + */ +/** + * Option names used by SetOption(). + */ +typedef enum { + /** + * Disables coalescing of small writes to make TCP segments, and instead + * delivers data immediately. Value's type is PP_VARTYPE_BOOL. + * On version 1.1 or earlier, this option can only be set after a successful + * Connect() call. On version 1.2 or later, there is no such + * limitation. + */ + PP_TCPSOCKET_OPTION_NO_DELAY = 0, + /** + * Specifies the total per-socket buffer space reserved for sends. Value's + * type should be PP_VARTYPE_INT32. + * On version 1.1 or earlier, this option can only be set after a successful + * Connect() call. On version 1.2 or later, there is no such + * limitation. + * + * Note: This is only treated as a hint for the browser to set the buffer + * size. Even if SetOption() succeeds, the browser doesn't + * guarantee it will conform to the size. + */ + PP_TCPSOCKET_OPTION_SEND_BUFFER_SIZE = 1, + /** + * Specifies the total per-socket buffer space reserved for receives. Value's + * type should be PP_VARTYPE_INT32. + * On version 1.1 or earlier, this option can only be set after a successful + * Connect() call. On version 1.2 or later, there is no such + * limitation. + * + * Note: This is only treated as a hint for the browser to set the buffer + * size. Even if SetOption() succeeds, the browser doesn't + * guarantee it will conform to the size. + */ + PP_TCPSOCKET_OPTION_RECV_BUFFER_SIZE = 2 +} PP_TCPSocket_Option; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_TCPSocket_Option, 4); +/** + * @} + */ + +/** + * @addtogroup Interfaces + * @{ + */ +/** + * The PPB_TCPSocket interface provides TCP socket operations. + * + * Permissions: Apps permission socket with subrule + * tcp-connect is required for Connect(); subrule + * tcp-listen is required for Listen(). + * For more details about network communication permissions, please see: + * http://developer.chrome.com/apps/app_network.html + */ +struct PPB_TCPSocket_1_2 { + /** + * Creates a TCP socket resource. + * + * @param[in] instance A PP_Instance identifying one instance of + * a module. + * + * @return A PP_Resource corresponding to a TCP socket or 0 + * on failure. + */ + PP_Resource (*Create)(PP_Instance instance); + /** + * Determines if a given resource is a TCP socket. + * + * @param[in] resource A PP_Resource to check. + * + * @return PP_TRUE if the input is a + * PPB_TCPSocket resource; PP_FALSE otherwise. + */ + PP_Bool (*IsTCPSocket)(PP_Resource resource); + /** + * Binds the socket to the given address. The socket must not be bound. + * + * @param[in] tcp_socket A PP_Resource corresponding to a TCP + * socket. + * @param[in] addr A PPB_NetAddress resource. + * @param[in] callback A PP_CompletionCallback to be called upon + * completion. + * + * @return An int32_t containing an error code from pp_errors.h, + * including (but not limited to): + * - PP_ERROR_ADDRESS_IN_USE: the address is already in use. + * - PP_ERROR_ADDRESS_INVALID: the address is invalid. + */ + int32_t (*Bind)(PP_Resource tcp_socket, + PP_Resource addr, + struct PP_CompletionCallback callback); + /** + * Connects the socket to the given address. The socket must not be listening. + * Binding the socket beforehand is optional. + * + * @param[in] tcp_socket A PP_Resource corresponding to a TCP + * socket. + * @param[in] addr A PPB_NetAddress resource. + * @param[in] callback A PP_CompletionCallback to be called upon + * completion. + * + * @return An int32_t containing an error code from pp_errors.h, + * including (but not limited to): + * - PP_ERROR_NOACCESS: the caller doesn't have required + * permissions. + * - PP_ERROR_ADDRESS_UNREACHABLE: addr is + * unreachable. + * - PP_ERROR_CONNECTION_REFUSED: the connection attempt was + * refused. + * - PP_ERROR_CONNECTION_FAILED: the connection attempt failed. + * - PP_ERROR_CONNECTION_TIMEDOUT: the connection attempt timed + * out. + * + * Since version 1.1, if the socket is listening/connected or has a pending + * listen/connect request, Connect() will fail without starting a + * connection attempt; otherwise, any failure during the connection attempt + * will cause the socket to be closed. + */ + int32_t (*Connect)(PP_Resource tcp_socket, + PP_Resource addr, + struct PP_CompletionCallback callback); + /** + * Gets the local address of the socket, if it is bound. + * + * @param[in] tcp_socket A PP_Resource corresponding to a TCP + * socket. + * + * @return A PPB_NetAddress resource on success or 0 on failure. + */ + PP_Resource (*GetLocalAddress)(PP_Resource tcp_socket); + /** + * Gets the remote address of the socket, if it is connected. + * + * @param[in] tcp_socket A PP_Resource corresponding to a TCP + * socket. + * + * @return A PPB_NetAddress resource on success or 0 on failure. + */ + PP_Resource (*GetRemoteAddress)(PP_Resource tcp_socket); + /** + * Reads data from the socket. The socket must be connected. It may perform a + * partial read. + * + * @param[in] tcp_socket A PP_Resource corresponding to a TCP + * socket. + * @param[out] buffer The buffer to store the received data on success. It + * must be at least as large as bytes_to_read. + * @param[in] bytes_to_read The number of bytes to read. + * @param[in] callback A PP_CompletionCallback to be called upon + * completion. + * + * @return A non-negative number on success to indicate how many bytes have + * been read, 0 means that end-of-file was reached; otherwise, an error code + * from pp_errors.h. + */ + int32_t (*Read)(PP_Resource tcp_socket, + char* buffer, + int32_t bytes_to_read, + struct PP_CompletionCallback callback); + /** + * Writes data to the socket. The socket must be connected. It may perform a + * partial write. + * + * @param[in] tcp_socket A PP_Resource corresponding to a TCP + * socket. + * @param[in] buffer The buffer containing the data to write. + * @param[in] bytes_to_write The number of bytes to write. + * @param[in] callback A PP_CompletionCallback to be called upon + * completion. + * + * @return A non-negative number on success to indicate how many bytes have + * been written; otherwise, an error code from pp_errors.h. + */ + int32_t (*Write)(PP_Resource tcp_socket, + const char* buffer, + int32_t bytes_to_write, + struct PP_CompletionCallback callback); + /** + * Starts listening. The socket must be bound and not connected. + * + * @param[in] tcp_socket A PP_Resource corresponding to a TCP + * socket. + * @param[in] backlog A hint to determine the maximum length to which the + * queue of pending connections may grow. + * @param[in] callback A PP_CompletionCallback to be called upon + * completion. + * + * @return An int32_t containing an error code from pp_errors.h, + * including (but not limited to): + * - PP_ERROR_NOACCESS: the caller doesn't have required + * permissions. + * - PP_ERROR_ADDRESS_IN_USE: Another socket is already listening + * on the same port. + */ + int32_t (*Listen)(PP_Resource tcp_socket, + int32_t backlog, + struct PP_CompletionCallback callback); + /** + * Accepts a connection. The socket must be listening. + * + * @param[in] tcp_socket A PP_Resource corresponding to a TCP + * socket. + * @param[out] accepted_tcp_socket Stores the accepted TCP socket on success. + * @param[in] callback A PP_CompletionCallback to be called upon + * completion. + * + * @return An int32_t containing an error code from pp_errors.h, + * including (but not limited to): + * - PP_ERROR_CONNECTION_ABORTED: A connection has been aborted. + */ + int32_t (*Accept)(PP_Resource tcp_socket, + PP_Resource* accepted_tcp_socket, + struct PP_CompletionCallback callback); + /** + * Cancels all pending operations and closes the socket. Any pending callbacks + * will still run, reporting PP_ERROR_ABORTED if pending IO was + * interrupted. After a call to this method, no output buffer pointers passed + * into previous Read() or Accept() calls will be + * accessed. It is not valid to call Connect() or + * Listen() again. + * + * The socket is implicitly closed if it is destroyed, so you are not required + * to call this method. + * + * @param[in] tcp_socket A PP_Resource corresponding to a TCP + * socket. + */ + void (*Close)(PP_Resource tcp_socket); + /** + * Sets a socket option on the TCP socket. + * Please see the PP_TCPSocket_Option description for option + * names, value types and allowed values. + * + * @param[in] tcp_socket A PP_Resource corresponding to a TCP + * socket. + * @param[in] name The option to set. + * @param[in] value The option value to set. + * @param[in] callback A PP_CompletionCallback to be called upon + * completion. + * + * @return An int32_t containing an error code from pp_errors.h. + */ + int32_t (*SetOption)(PP_Resource tcp_socket, + PP_TCPSocket_Option name, + struct PP_Var value, + struct PP_CompletionCallback callback); +}; + +typedef struct PPB_TCPSocket_1_2 PPB_TCPSocket; + +struct PPB_TCPSocket_1_0 { + PP_Resource (*Create)(PP_Instance instance); + PP_Bool (*IsTCPSocket)(PP_Resource resource); + int32_t (*Connect)(PP_Resource tcp_socket, + PP_Resource addr, + struct PP_CompletionCallback callback); + PP_Resource (*GetLocalAddress)(PP_Resource tcp_socket); + PP_Resource (*GetRemoteAddress)(PP_Resource tcp_socket); + int32_t (*Read)(PP_Resource tcp_socket, + char* buffer, + int32_t bytes_to_read, + struct PP_CompletionCallback callback); + int32_t (*Write)(PP_Resource tcp_socket, + const char* buffer, + int32_t bytes_to_write, + struct PP_CompletionCallback callback); + void (*Close)(PP_Resource tcp_socket); + int32_t (*SetOption)(PP_Resource tcp_socket, + PP_TCPSocket_Option name, + struct PP_Var value, + struct PP_CompletionCallback callback); +}; + +struct PPB_TCPSocket_1_1 { + PP_Resource (*Create)(PP_Instance instance); + PP_Bool (*IsTCPSocket)(PP_Resource resource); + int32_t (*Bind)(PP_Resource tcp_socket, + PP_Resource addr, + struct PP_CompletionCallback callback); + int32_t (*Connect)(PP_Resource tcp_socket, + PP_Resource addr, + struct PP_CompletionCallback callback); + PP_Resource (*GetLocalAddress)(PP_Resource tcp_socket); + PP_Resource (*GetRemoteAddress)(PP_Resource tcp_socket); + int32_t (*Read)(PP_Resource tcp_socket, + char* buffer, + int32_t bytes_to_read, + struct PP_CompletionCallback callback); + int32_t (*Write)(PP_Resource tcp_socket, + const char* buffer, + int32_t bytes_to_write, + struct PP_CompletionCallback callback); + int32_t (*Listen)(PP_Resource tcp_socket, + int32_t backlog, + struct PP_CompletionCallback callback); + int32_t (*Accept)(PP_Resource tcp_socket, + PP_Resource* accepted_tcp_socket, + struct PP_CompletionCallback callback); + void (*Close)(PP_Resource tcp_socket); + int32_t (*SetOption)(PP_Resource tcp_socket, + PP_TCPSocket_Option name, + struct PP_Var value, + struct PP_CompletionCallback callback); +}; +/** + * @} + */ + +/* ppb_text_input_controller.idl */ +/** + * @addtogroup Enums + * @{ + */ +/** + * PP_TextInput_Type is used to indicate the status of a plugin in regard to + * text input. + */ +typedef enum { + /** + * Input caret is not in an editable mode, no input method shall be used. + */ + PP_TEXTINPUT_TYPE_NONE = 0, + /** + * Input caret is in a normal editable mode, any input method can be used. + */ + PP_TEXTINPUT_TYPE_TEXT = 1, + /** + * Input caret is in a password box, an input method may be used only if + * it's suitable for password input. + */ + PP_TEXTINPUT_TYPE_PASSWORD = 2, + PP_TEXTINPUT_TYPE_SEARCH = 3, + PP_TEXTINPUT_TYPE_EMAIL = 4, + PP_TEXTINPUT_TYPE_NUMBER = 5, + PP_TEXTINPUT_TYPE_TELEPHONE = 6, + PP_TEXTINPUT_TYPE_URL = 7 +} PP_TextInput_Type; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_TextInput_Type, 4); +/** + * @} + */ + +/** + * @addtogroup Interfaces + * @{ + */ +/** + * PPB_TextInputController provides a set of functions for giving + * hints to the browser about the text input status of plugins, and functions + * for controlling input method editors (IMEs). + */ +struct PPB_TextInputController_1_0 { + /** + * Informs the browser about the current text input mode of the plugin. + * Typical use of this information in the browser is to properly + * display/suppress tools for supporting text inputs (such as virtual + * keyboards in touch screen based devices, or input method editors often + * used for composing East Asian characters). + */ + void (*SetTextInputType)(PP_Instance instance, PP_TextInput_Type type); + /** + * Informs the browser about the coordinates of the text input caret area. + * Typical use of this information in the browser is to layout IME windows + * etc. + */ + void (*UpdateCaretPosition)(PP_Instance instance, + const struct PP_Rect* caret); + /** + * Cancels the current composition in IME. + */ + void (*CancelCompositionText)(PP_Instance instance); + /** + * Informs the browser about the current text selection and surrounding + * text. text is a UTF-8 string that contains the current range + * of text selection in the plugin. caret is the byte-index of + * the caret position within text. anchor is the + * byte-index of the anchor position (i.e., if a range of text is selected, + * it is the other edge of selection different from caret. If + * there are no selection, anchor is equal to caret. + * + * Typical use of this information in the browser is to enable "reconversion" + * features of IME that puts back the already committed text into the + * pre-commit composition state. Another use is to improve the precision + * of suggestion of IME by taking the context into account (e.g., if the caret + * looks to be on the beginning of a sentence, suggest capital letters in a + * virtual keyboard). + * + * When the focus is not on text, call this function setting text + * to an empty string and caret and anchor to zero. + * Also, the plugin should send the empty text when it does not want to reveal + * the selection to IME (e.g., when the surrounding text is containing + * password text). + */ + void (*UpdateSurroundingText)(PP_Instance instance, + struct PP_Var text, + uint32_t caret, + uint32_t anchor); +}; + +typedef struct PPB_TextInputController_1_0 PPB_TextInputController; +/** + * @} + */ + +/* ppb_udp_socket.idl */ +/** + * @addtogroup Enums + * @{ + */ +/** + * Option names used by SetOption(). + */ +typedef enum { + /** + * Allows the socket to share the local address to which it will be bound with + * other processes. Value's type should be PP_VARTYPE_BOOL. + * This option can only be set before calling Bind(). + */ + PP_UDPSOCKET_OPTION_ADDRESS_REUSE = 0, + /** + * Allows sending and receiving packets to and from broadcast addresses. + * Value's type should be PP_VARTYPE_BOOL. + * On version 1.0, this option can only be set before calling + * Bind(). On version 1.1 or later, there is no such limitation. + */ + PP_UDPSOCKET_OPTION_BROADCAST = 1, + /** + * Specifies the total per-socket buffer space reserved for sends. Value's + * type should be PP_VARTYPE_INT32. + * On version 1.0, this option can only be set after a successful + * Bind() call. On version 1.1 or later, there is no such + * limitation. + * + * Note: This is only treated as a hint for the browser to set the buffer + * size. Even if SetOption() succeeds, the browser doesn't + * guarantee it will conform to the size. + */ + PP_UDPSOCKET_OPTION_SEND_BUFFER_SIZE = 2, + /** + * Specifies the total per-socket buffer space reserved for receives. Value's + * type should be PP_VARTYPE_INT32. + * On version 1.0, this option can only be set after a successful + * Bind() call. On version 1.1 or later, there is no such + * limitation. + * + * Note: This is only treated as a hint for the browser to set the buffer + * size. Even if SetOption() succeeds, the browser doesn't + * guarantee it will conform to the size. + */ + PP_UDPSOCKET_OPTION_RECV_BUFFER_SIZE = 3, + /** + * Specifies whether the packets sent from the host to the multicast group + * should be looped back to the host or not. Value's type should be + * PP_VARTYPE_BOOL. + * This option can only be set before calling Bind(). + * + * This is only supported in version 1.2 of the API (Chrome 43) and later. + */ + PP_UDPSOCKET_OPTION_MULTICAST_LOOP = 4, + /** + * Specifies the time-to-live for packets sent to the multicast group. The + * value should be within 0 to 255 range. The default value is 1 and means + * that packets will not be routed beyond the local network. Value's type + * should be PP_VARTYPE_INT32. + * This option can only be set before calling Bind(). + * + * This is only supported in version 1.2 of the API (Chrome 43) and later. + */ + PP_UDPSOCKET_OPTION_MULTICAST_TTL = 5 +} PP_UDPSocket_Option; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_UDPSocket_Option, 4); +/** + * @} + */ + +/** + * @addtogroup Interfaces + * @{ + */ +/** + * The PPB_UDPSocket interface provides UDP socket operations. + * + * Permissions: Apps permission socket with subrule + * udp-bind is required for Bind(); subrule + * udp-send-to is required for SendTo(). + * For more details about network communication permissions, please see: + * http://developer.chrome.com/apps/app_network.html + */ +struct PPB_UDPSocket_1_2 { + /** + * Creates a UDP socket resource. + * + * @param[in] instance A PP_Instance identifying one instance of + * a module. + * + * @return A PP_Resource corresponding to a UDP socket or 0 + * on failure. + */ + PP_Resource (*Create)(PP_Instance instance); + /** + * Determines if a given resource is a UDP socket. + * + * @param[in] resource A PP_Resource to check. + * + * @return PP_TRUE if the input is a PPB_UDPSocket + * resource; PP_FALSE otherwise. + */ + PP_Bool (*IsUDPSocket)(PP_Resource resource); + /** + * Binds the socket to the given address. + * + * @param[in] udp_socket A PP_Resource corresponding to a UDP + * socket. + * @param[in] addr A PPB_NetAddress resource. + * @param[in] callback A PP_CompletionCallback to be called upon + * completion. + * + * @return An int32_t containing an error code from pp_errors.h. + * PP_ERROR_NOACCESS will be returned if the caller doesn't have + * required permissions. PP_ERROR_ADDRESS_IN_USE will be returned + * if the address is already in use. + */ + int32_t (*Bind)(PP_Resource udp_socket, + PP_Resource addr, + struct PP_CompletionCallback callback); + /** + * Gets the address that the socket is bound to. The socket must be bound. + * + * @param[in] udp_socket A PP_Resource corresponding to a UDP + * socket. + * + * @return A PPB_NetAddress resource on success or 0 on failure. + */ + PP_Resource (*GetBoundAddress)(PP_Resource udp_socket); + /** + * Receives data from the socket and stores the source address. The socket + * must be bound. + * + * @param[in] udp_socket A PP_Resource corresponding to a UDP + * socket. + * @param[out] buffer The buffer to store the received data on success. It + * must be at least as large as num_bytes. + * @param[in] num_bytes The number of bytes to receive. + * @param[out] addr A PPB_NetAddress resource to store the source + * address on success. + * @param[in] callback A PP_CompletionCallback to be called upon + * completion. + * + * @return A non-negative number on success to indicate how many bytes have + * been received; otherwise, an error code from pp_errors.h. + */ + int32_t (*RecvFrom)(PP_Resource udp_socket, + char* buffer, + int32_t num_bytes, + PP_Resource* addr, + struct PP_CompletionCallback callback); + /** + * Sends data to a specific destination. The socket must be bound. + * + * @param[in] udp_socket A PP_Resource corresponding to a UDP + * socket. + * @param[in] buffer The buffer containing the data to send. + * @param[in] num_bytes The number of bytes to send. + * @param[in] addr A PPB_NetAddress resource holding the + * destination address. + * @param[in] callback A PP_CompletionCallback to be called upon + * completion. + * + * @return A non-negative number on success to indicate how many bytes have + * been sent; otherwise, an error code from pp_errors.h. + * PP_ERROR_NOACCESS will be returned if the caller doesn't have + * required permissions. + * PP_ERROR_INPROGRESS will be returned if the socket is busy + * sending. The caller should wait until a pending send completes before + * retrying. + */ + int32_t (*SendTo)(PP_Resource udp_socket, + const char* buffer, + int32_t num_bytes, + PP_Resource addr, + struct PP_CompletionCallback callback); + /** + * Cancels all pending reads and writes, and closes the socket. Any pending + * callbacks will still run, reporting PP_ERROR_ABORTED if + * pending IO was interrupted. After a call to this method, no output + * parameters passed into previous RecvFrom() calls will be + * accessed. It is not valid to call Bind() again. + * + * The socket is implicitly closed if it is destroyed, so you are not + * required to call this method. + * + * @param[in] udp_socket A PP_Resource corresponding to a UDP + * socket. + */ + void (*Close)(PP_Resource udp_socket); + /** + * Sets a socket option on the UDP socket. + * Please see the PP_UDPSocket_Option description for option + * names, value types and allowed values. + * + * @param[in] udp_socket A PP_Resource corresponding to a UDP + * socket. + * @param[in] name The option to set. + * @param[in] value The option value to set. + * @param[in] callback A PP_CompletionCallback to be called upon + * completion. + * + * @return An int32_t containing an error code from pp_errors.h. + */ + int32_t (*SetOption)(PP_Resource udp_socket, + PP_UDPSocket_Option name, + struct PP_Var value, + struct PP_CompletionCallback callback); + /** + * Joins the multicast group with address specified by group + * parameter, which is expected to be a PPB_NetAddress object. + * + * @param[in] udp_socket A PP_Resource corresponding to a UDP + * socket. + * @param[in] group A PP_Resource corresponding to the network + * address of the multicast group. + * @param[in] callback A PP_CompletionCallback to be called upon + * completion. + * + * @return An int32_t containing an error code from pp_errors.h. + */ + int32_t (*JoinGroup)(PP_Resource udp_socket, + PP_Resource group, + struct PP_CompletionCallback callback); + /** + * Leaves the multicast group with address specified by group + * parameter, which is expected to be a PPB_NetAddress object. + * + * @param[in] udp_socket A PP_Resource corresponding to a UDP + * socket. + * @param[in] group A PP_Resource corresponding to the network + * address of the multicast group. + * @param[in] callback A PP_CompletionCallback to be called upon + * completion. + * + * @return An int32_t containing an error code from pp_errors.h. + */ + int32_t (*LeaveGroup)(PP_Resource udp_socket, + PP_Resource group, + struct PP_CompletionCallback callback); +}; + +typedef struct PPB_UDPSocket_1_2 PPB_UDPSocket; + +struct PPB_UDPSocket_1_0 { + PP_Resource (*Create)(PP_Instance instance); + PP_Bool (*IsUDPSocket)(PP_Resource resource); + int32_t (*Bind)(PP_Resource udp_socket, + PP_Resource addr, + struct PP_CompletionCallback callback); + PP_Resource (*GetBoundAddress)(PP_Resource udp_socket); + int32_t (*RecvFrom)(PP_Resource udp_socket, + char* buffer, + int32_t num_bytes, + PP_Resource* addr, + struct PP_CompletionCallback callback); + int32_t (*SendTo)(PP_Resource udp_socket, + const char* buffer, + int32_t num_bytes, + PP_Resource addr, + struct PP_CompletionCallback callback); + void (*Close)(PP_Resource udp_socket); + int32_t (*SetOption)(PP_Resource udp_socket, + PP_UDPSocket_Option name, + struct PP_Var value, + struct PP_CompletionCallback callback); +}; + +struct PPB_UDPSocket_1_1 { + PP_Resource (*Create)(PP_Instance instance); + PP_Bool (*IsUDPSocket)(PP_Resource resource); + int32_t (*Bind)(PP_Resource udp_socket, + PP_Resource addr, + struct PP_CompletionCallback callback); + PP_Resource (*GetBoundAddress)(PP_Resource udp_socket); + int32_t (*RecvFrom)(PP_Resource udp_socket, + char* buffer, + int32_t num_bytes, + PP_Resource* addr, + struct PP_CompletionCallback callback); + int32_t (*SendTo)(PP_Resource udp_socket, + const char* buffer, + int32_t num_bytes, + PP_Resource addr, + struct PP_CompletionCallback callback); + void (*Close)(PP_Resource udp_socket); + int32_t (*SetOption)(PP_Resource udp_socket, + PP_UDPSocket_Option name, + struct PP_Var value, + struct PP_CompletionCallback callback); +}; +/** + * @} + */ + +/* ppb_url_loader.idl */ +/** + * @addtogroup Interfaces + * @{ + */ +/** + * The PPB_URLLoader interface contains pointers to functions + * for loading URLs. The typical steps for loading a URL are: + * + * -# Call Create() to create a URLLoader object. + * -# Create a URLRequestInfo object and set properties on it. + * Refer to PPB_URLRequestInfo for further information. + * -# Call Open() with the URLRequestInfo as an argument. + * -# When Open() completes, call GetResponseInfo() to examine the response + * headers. Refer to PPB_URLResponseInfo for further information. + * -# Call ReadResponseBody() to stream the data for the response. + * + * Alternatively, if PP_URLREQUESTPROPERTY_STREAMTOFILE was set on + * the URLRequestInfo in step #2: + * - Call FinishStreamingToFile(), after examining the response headers + * (step #4), to wait for the downloaded file to be complete. + * - Then, access the downloaded file using the GetBodyAsFileRef() function of + * the URLResponseInfo returned in step #4. + */ +struct PPB_URLLoader_1_0 { + /** + * Create() creates a new URLLoader object. The + * URLLoader is associated with a particular instance, so that + * any UI dialogs that need to be shown to the user can be positioned + * relative to the window containing the instance. + * + * @param[in] instance A PP_Instance identifying one instance + * of a module. + * + * @return A PP_Resource corresponding to a URLLoader if + * successful, 0 if the instance is invalid. + */ + PP_Resource (*Create)(PP_Instance instance); + /** + * IsURLLoader() determines if a resource is an URLLoader. + * + * @param[in] resource A PP_Resource corresponding to a + * URLLoader. + * + * @return PP_TRUE if the resource is a URLLoader, + * PP_FALSE if the resource is invalid or some type other + * than URLLoader. + */ + PP_Bool (*IsURLLoader)(PP_Resource resource); + /** + * Open() begins loading the URLRequestInfo. The operation + * completes when response headers are received or when an error occurs. Use + * GetResponseInfo() to access the response headers. + * + * @param[in] loader A PP_Resource corresponding to a + * URLLoader. + * @param[in] resource A PP_Resource corresponding to a + * URLRequestInfo. + * @param[in] callback A PP_CompletionCallback to run on + * asynchronous completion of Open(). This callback will run when response + * headers for the url are received or error occurred. This callback + * will only run if Open() returns PP_OK_COMPLETIONPENDING. + * + * @return An int32_t containing an error code from pp_errors.h. + */ + int32_t (*Open)(PP_Resource loader, + PP_Resource request_info, + struct PP_CompletionCallback callback); + /** + * FollowRedirect() can be invoked to follow a redirect after Open() + * completed on receiving redirect headers. + * + * @param[in] loader A PP_Resource corresponding to a + * URLLoader. + * @param[in] callback A PP_CompletionCallback to run on + * asynchronous completion of FollowRedirect(). This callback will run when + * response headers for the redirect url are received or error occurred. This + * callback will only run if FollowRedirect() returns + * PP_OK_COMPLETIONPENDING. + * + * @return An int32_t containing an error code from pp_errors.h. + */ + int32_t (*FollowRedirect)(PP_Resource loader, + struct PP_CompletionCallback callback); + /** + * GetUploadProgress() returns the current upload progress (which is + * meaningful after Open() has been called). Progress only refers to the + * request body and does not include the headers. + * + * This data is only available if the URLRequestInfo passed + * to Open() had the PP_URLREQUESTPROPERTY_REPORTUPLOADPROGRESS + * property set to PP_TRUE. + * + * @param[in] loader A PP_Resource corresponding to a + * URLLoader. + * @param[in] bytes_sent The number of bytes sent thus far. + * @param[in] total_bytes_to_be_sent The total number of bytes to be sent. + * + * @return PP_TRUE if the upload progress is available, + * PP_FALSE if it is not available. + */ + PP_Bool (*GetUploadProgress)(PP_Resource loader, + int64_t* bytes_sent, + int64_t* total_bytes_to_be_sent); + /** + * GetDownloadProgress() returns the current download progress, which is + * meaningful after Open() has been called. Progress only refers to the + * response body and does not include the headers. + * + * This data is only available if the URLRequestInfo passed to + * Open() had the PP_URLREQUESTPROPERTY_REPORTDOWNLOADPROGRESS + * property set to PP_TRUE. + * + * @param[in] loader A PP_Resource corresponding to a + * URLLoader. + * @param[in] bytes_received The number of bytes received thus far. + * @param[in] total_bytes_to_be_received The total number of bytes to be + * received. The total bytes to be received may be unknown, in which case + * total_bytes_to_be_received will be set to -1. + * + * @return PP_TRUE if the download progress is available, + * PP_FALSE if it is not available. + */ + PP_Bool (*GetDownloadProgress)(PP_Resource loader, + int64_t* bytes_received, + int64_t* total_bytes_to_be_received); + /** + * GetResponseInfo() returns the current URLResponseInfo object. + * + * @param[in] instance A PP_Resource corresponding to a + * URLLoader. + * + * @return A PP_Resource corresponding to the + * URLResponseInfo if successful, 0 if the loader is not a valid + * resource or if Open() has not been called. + */ + PP_Resource (*GetResponseInfo)(PP_Resource loader); + /** + * ReadResponseBody() is used to read the response body. The size of the + * buffer must be large enough to hold the specified number of bytes to read. + * This function might perform a partial read. + * + * @param[in] loader A PP_Resource corresponding to a + * URLLoader. + * @param[in,out] buffer A pointer to the buffer for the response body. + * @param[in] bytes_to_read The number of bytes to read. + * @param[in] callback A PP_CompletionCallback to run on + * asynchronous completion. The callback will run if the bytes (full or + * partial) are read or an error occurs asynchronously. This callback will + * run only if this function returns PP_OK_COMPLETIONPENDING. + * + * @return An int32_t containing the number of bytes read or an error code + * from pp_errors.h. + */ + int32_t (*ReadResponseBody)(PP_Resource loader, + void* buffer, + int32_t bytes_to_read, + struct PP_CompletionCallback callback); + /** + * FinishStreamingToFile() is used to wait for the response body to be + * completely downloaded to the file provided by the GetBodyAsFileRef() + * in the current URLResponseInfo. This function is only used if + * PP_URLREQUESTPROPERTY_STREAMTOFILE was set on the + * URLRequestInfo passed to Open(). + * + * @param[in] loader A PP_Resource corresponding to a + * URLLoader. + * @param[in] callback A PP_CompletionCallback to run on + * asynchronous completion. This callback will run when body is downloaded + * or an error occurs after FinishStreamingToFile() returns + * PP_OK_COMPLETIONPENDING. + * + * @return An int32_t containing the number of bytes read or an error code + * from pp_errors.h. + */ + int32_t (*FinishStreamingToFile)(PP_Resource loader, + struct PP_CompletionCallback callback); + /** + * Close is a pointer to a function used to cancel any pending IO and close + * the URLLoader object. Any pending callbacks will still run, + * reporting PP_ERROR_ABORTED if pending IO was interrupted. + * It is NOT valid to call Open() again after a call to this function. + * + * Note: If the URLLoader object is destroyed + * while it is still open, then it will be implicitly closed so you are not + * required to call Close(). + * + * @param[in] loader A PP_Resource corresponding to a + * URLLoader. + */ + void (*Close)(PP_Resource loader); +}; + +typedef struct PPB_URLLoader_1_0 PPB_URLLoader; +/** + * @} + */ + +/* ppb_url_request_info.idl */ +/** + * @addtogroup Enums + * @{ + */ +/** + * This enumeration contains properties that can be set on a URL request. + */ +typedef enum { + /** This corresponds to a string (PP_VARTYPE_STRING). */ + PP_URLREQUESTPROPERTY_URL = 0, + /** + * This corresponds to a string (PP_VARTYPE_STRING); either + * POST or GET. Refer to the + * HTTP + * Methods documentation for further information. + * + */ + PP_URLREQUESTPROPERTY_METHOD = 1, + /** + * This corresponds to a string (PP_VARTYPE_STRING); \n + * delimited. Refer to the + * documentation for further information. + */ + PP_URLREQUESTPROPERTY_HEADERS = 2, + /** + * This corresponds to a PP_Bool (PP_VARTYPE_BOOL; + * default=PP_FALSE). + * Set this value to PP_TRUE if you want to download the data + * to a file. Use PPB_URLLoader.FinishStreamingToFile() to complete the + * download. + */ + PP_URLREQUESTPROPERTY_STREAMTOFILE = 3, + /** + * This corresponds to a PP_Bool (PP_VARTYPE_BOOL; + * default=PP_TRUE). + * Set this value to PP_FALSE if you want to use + * PPB_URLLoader.FollowRedirects() to follow the redirects only after + * examining redirect headers. + */ + PP_URLREQUESTPROPERTY_FOLLOWREDIRECTS = 4, + /** + * This corresponds to a PP_Bool (PP_VARTYPE_BOOL; + * default=PP_FALSE). + * Set this value to PP_TRUE if you want to be able to poll the + * download progress using PPB_URLLoader.GetDownloadProgress(). + */ + PP_URLREQUESTPROPERTY_RECORDDOWNLOADPROGRESS = 5, + /** + * This corresponds to a PP_Bool + * (default=PP_FALSE). Set this value to PP_TRUE if + * you want to be able to poll the upload progress using + * PPB_URLLoader.GetUploadProgress(). + */ + PP_URLREQUESTPROPERTY_RECORDUPLOADPROGRESS = 6, + /** + * This corresponds to a string (PP_VARTYPE_STRING) or may be + * undefined (PP_VARTYPE_UNDEFINED; default). + * Set it to a string to set a custom referrer (if empty, the referrer header + * will be omitted), or to undefined to use the default referrer. Only loaders + * with universal access (only available on trusted implementations) will + * accept URLRequestInfo objects that try to set a custom + * referrer; if given to a loader without universal access, + * PP_ERROR_NOACCESS will result. + */ + PP_URLREQUESTPROPERTY_CUSTOMREFERRERURL = 7, + /** + * This corresponds to a PP_Bool (PP_VARTYPE_BOOL; + * default=PP_FALSE). Whether cross-origin requests are allowed. + * Cross-origin requests are made using the CORS (Cross-Origin Resource + * Sharing) algorithm to check whether the request should be allowed. For the + * complete CORS algorithm, refer to + * the Cross-Origin Resource + * Sharing documentation. + */ + PP_URLREQUESTPROPERTY_ALLOWCROSSORIGINREQUESTS = 8, + /** + * This corresponds to a PP_Bool (PP_VARTYPE_BOOL; + * default=PP_FALSE). + * Whether HTTP credentials are sent with cross-origin requests. If false, + * no credentials are sent with the request and cookies are ignored in the + * response. If the request is not cross-origin, this property is ignored. + */ + PP_URLREQUESTPROPERTY_ALLOWCREDENTIALS = 9, + /** + * This corresponds to a string (PP_VARTYPE_STRING) or may be + * undefined (PP_VARTYPE_UNDEFINED; default). + * Set it to a string to set a custom content-transfer-encoding header (if + * empty, that header will be omitted), or to undefined to use the default + * (if any). Only loaders with universal access (only available on trusted + * implementations) will accept URLRequestInfo objects that try + * to set a custom content transfer encoding; if given to a loader without + * universal access, PP_ERROR_NOACCESS will result. + */ + PP_URLREQUESTPROPERTY_CUSTOMCONTENTTRANSFERENCODING = 10, + /** + * This corresponds to an integer (PP_VARTYPE_INT32); default + * is not defined and is set by the browser, possibly depending on system + * capabilities. Set it to an integer to set an upper threshold for the + * prefetched buffer of an asynchronous load. When exceeded, the browser will + * defer loading until + * PP_URLREQUESTPROPERTY_PREFETCHBUFFERLOWERERTHRESHOLD is hit, + * at which time it will begin prefetching again. When setting this property, + * PP_URLREQUESTPROPERTY_PREFETCHBUFFERLOWERERTHRESHOLD must also + * be set. Behavior is undefined if the former is <= the latter. + */ + PP_URLREQUESTPROPERTY_PREFETCHBUFFERUPPERTHRESHOLD = 11, + /** + * This corresponds to an integer (PP_VARTYPE_INT32); default is + * not defined and is set by the browser to a value appropriate for the + * default PP_URLREQUESTPROPERTY_PREFETCHBUFFERUPPERTHRESHOLD. + * Set it to an integer to set a lower threshold for the prefetched buffer + * of an asynchronous load. When reached, the browser will resume loading if + * If PP_URLREQUESTPROPERTY_PREFETCHBUFFERLOWERERTHRESHOLD had + * previously been reached. + * When setting this property, + * PP_URLREQUESTPROPERTY_PREFETCHBUFFERUPPERTHRESHOLD must also + * be set. Behavior is undefined if the former is >= the latter. + */ + PP_URLREQUESTPROPERTY_PREFETCHBUFFERLOWERTHRESHOLD = 12, + /** + * This corresponds to a string (PP_VARTYPE_STRING) or may be + * undefined (PP_VARTYPE_UNDEFINED; default). Set it to a string + * to set a custom user-agent header (if empty, that header will be omitted), + * or to undefined to use the default. Only loaders with universal access + * (only available on trusted implementations) will accept + * URLRequestInfo objects that try to set a custom user agent; if + * given to a loader without universal access, PP_ERROR_NOACCESS + * will result. + */ + PP_URLREQUESTPROPERTY_CUSTOMUSERAGENT = 13 +} PP_URLRequestProperty; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_URLRequestProperty, 4); +/** + * @} + */ + +/** + * @addtogroup Interfaces + * @{ + */ +/** + * The PPB_URLRequestInfo interface is used to create + * and handle URL requests. This API is used in conjunction with + * PPB_URLLoader. Refer to PPB_URLLoader for further + * information. + */ +struct PPB_URLRequestInfo_1_0 { + /** + * Create() creates a new URLRequestInfo object. + * + * @param[in] instance A PP_Instance identifying one instance + * of a module. + * + * @return A PP_Resource identifying the + * URLRequestInfo if successful, 0 if the instance is invalid. + */ + PP_Resource (*Create)(PP_Instance instance); + /** + * IsURLRequestInfo() determines if a resource is a + * URLRequestInfo. + * + * @param[in] resource A PP_Resource corresponding to a + * URLRequestInfo. + * + * @return PP_TRUE if the resource is a + * URLRequestInfo, PP_FALSE if the resource is + * invalid or some type other than URLRequestInfo. + */ + PP_Bool (*IsURLRequestInfo)(PP_Resource resource); + /** + * SetProperty() sets a request property. The value of the property must be + * the correct type according to the property being set. + * + * @param[in] request A PP_Resource corresponding to a + * URLRequestInfo. + * @param[in] property A PP_URLRequestProperty identifying the + * property to set. + * @param[in] value A PP_Var containing the property value. + * + * @return PP_TRUE if successful, PP_FALSE if any + * of the parameters are invalid. + */ + PP_Bool (*SetProperty)(PP_Resource request, + PP_URLRequestProperty property, + struct PP_Var value); + /** + * AppendDataToBody() appends data to the request body. A Content-Length + * request header will be automatically generated. + * + * @param[in] request A PP_Resource corresponding to a + * URLRequestInfo. + * @param[in] data A pointer to a buffer holding the data. + * @param[in] len The length, in bytes, of the data. + * + * @return PP_TRUE if successful, PP_FALSE if any + * of the parameters are invalid. + * + * + */ + PP_Bool (*AppendDataToBody)(PP_Resource request, + const void* data, + uint32_t len); + /** + * AppendFileToBody() appends a file, to be uploaded, to the request body. + * A content-length request header will be automatically generated. + * + * @param[in] request A PP_Resource corresponding to a + * URLRequestInfo. + * @param[in] file_ref A PP_Resource corresponding to a file + * reference. + * @param[in] start_offset An optional starting point offset within the + * file. + * @param[in] number_of_bytes An optional number of bytes of the file to + * be included. If number_of_bytes is -1, then the sub-range + * to upload extends to the end of the file. + * @param[in] expected_last_modified_time An optional (non-zero) last + * modified time stamp used to validate that the file was not modified since + * the given time before it was uploaded. The upload will fail with an error + * code of PP_ERROR_FILECHANGED if the file has been modified + * since the given time. If expected_last_modified_time is 0, + * then no validation is performed. + * + * @return PP_TRUE if successful, PP_FALSE if any + * of the parameters are invalid. + */ + PP_Bool (*AppendFileToBody)(PP_Resource request, + PP_Resource file_ref, + int64_t start_offset, + int64_t number_of_bytes, + PP_Time expected_last_modified_time); +}; + +typedef struct PPB_URLRequestInfo_1_0 PPB_URLRequestInfo; +/** + * @} + */ + +/* ppb_url_response_info.idl */ +/** + * @addtogroup Enums + * @{ + */ +/** + * This enumeration contains properties set on a URL response. + */ +typedef enum { + /** + * This corresponds to a string (PP_VARTYPE_STRING); an absolute URL formed by + * resolving the relative request URL with the absolute document URL. Refer + * to the + * + * HTTP Request URI and + * + * HTML Resolving Relative URIs documentation for further information. + */ + PP_URLRESPONSEPROPERTY_URL = 0, + /** + * This corresponds to a string (PP_VARTYPE_STRING); the absolute URL returned + * in the response header's 'Location' field if this is a redirect response, + * an empty string otherwise. Refer to the + * + * HTTP Status Codes - Redirection documentation for further information. + */ + PP_URLRESPONSEPROPERTY_REDIRECTURL = 1, + /** + * This corresponds to a string (PP_VARTYPE_STRING); the HTTP method to be + * used in a new request if this is a redirect response, an empty string + * otherwise. Refer to the + * + * HTTP Status Codes - Redirection documentation for further information. + */ + PP_URLRESPONSEPROPERTY_REDIRECTMETHOD = 2, + /** + * This corresponds to an int32 (PP_VARETYPE_INT32); the status code from the + * response, e.g., 200 if the request was successful. Refer to the + * + * HTTP Status Code and Reason Phrase documentation for further + * information. + */ + PP_URLRESPONSEPROPERTY_STATUSCODE = 3, + /** + * This corresponds to a string (PP_VARTYPE_STRING); the status line + * from the response. Refer to the + * + * HTTP Response Status Line documentation for further information. + */ + PP_URLRESPONSEPROPERTY_STATUSLINE = 4, + /** + * This corresponds to a string(PP_VARTYPE_STRING), a \n-delimited list of + * header field/value pairs of the form "field: value", returned by the + * server. Refer to the + * + * HTTP Header Field Definitions documentation for further information. + */ + PP_URLRESPONSEPROPERTY_HEADERS = 5 +} PP_URLResponseProperty; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_URLResponseProperty, 4); +/** + * @} + */ + +/** + * @addtogroup Interfaces + * @{ + */ +/** + * The PPB_URLResponseInfo interface contains APIs for + * examining URL responses. Refer to PPB_URLLoader for further + * information. + */ +struct PPB_URLResponseInfo_1_0 { + /** + * IsURLResponseInfo() determines if a response is a + * URLResponseInfo. + * + * @param[in] resource A PP_Resource corresponding to a + * URLResponseInfo. + * + * @return PP_TRUE if the resource is a + * URLResponseInfo, PP_FALSE if the resource is + * invalid or some type other than URLResponseInfo. + */ + PP_Bool (*IsURLResponseInfo)(PP_Resource resource); + /** + * GetProperty() gets a response property. + * + * @param[in] request A PP_Resource corresponding to a + * URLResponseInfo. + * @param[in] property A PP_URLResponseProperty identifying + * the type of property in the response. + * + * @return A PP_Var containing the response property value if + * successful, PP_VARTYPE_VOID if an input parameter is invalid. + */ + struct PP_Var (*GetProperty)(PP_Resource response, + PP_URLResponseProperty property); + /** + * GetBodyAsFileRef() returns a FileRef pointing to the file containing the + * response body. This is only valid if + * PP_URLREQUESTPROPERTY_STREAMTOFILE was set on the + * URLRequestInfo used to produce this response. This file + * remains valid until the URLLoader associated with this + * URLResponseInfo is closed or destroyed. + * + * @param[in] request A PP_Resource corresponding to a + * URLResponseInfo. + * + * @return A PP_Resource corresponding to a FileRef + * if successful, 0 if PP_URLREQUESTPROPERTY_STREAMTOFILE was + * not requested or if the URLLoader has not been opened yet. + */ + PP_Resource (*GetBodyAsFileRef)(PP_Resource response); +}; + +typedef struct PPB_URLResponseInfo_1_0 PPB_URLResponseInfo; +/** + * @} + */ + +/* ppb_var.idl */ +/** + * @addtogroup Interfaces + * @{ + */ +/** + * PPB_Var API + */ +struct PPB_Var_1_2 { + /** + * AddRef() adds a reference to the given var. If this is not a refcounted + * object, this function will do nothing so you can always call it no matter + * what the type. + * + * @param[in] var A PP_Var that will have a reference added. + */ + void (*AddRef)(struct PP_Var var); + /** + * Release() removes a reference to given var, deleting it if the internal + * reference count becomes 0. If the PP_Var is of type + * PP_VARTYPE_RESOURCE, + * it will implicitly release a reference count on the + * PP_Resource (equivalent to PPB_Core::ReleaseResource()). + * + * If the given var is not a refcounted object, this function will do nothing + * so you can always call it no matter what the type. + * + * @param[in] var A PP_Var that will have a reference removed. + */ + void (*Release)(struct PP_Var var); + /** + * VarFromUtf8() creates a string var from a string. The string must be + * encoded in valid UTF-8 and is NOT NULL-terminated, the length must be + * specified in len. It is an error if the string is not + * valid UTF-8. + * + * If the length is 0, the *data pointer will not be dereferenced + * and may be NULL. Note, however if length is 0, the + * "NULL-ness" will not be preserved, as VarToUtf8() will never return + * NULL on success, even for empty strings. + * + * The resulting object will be a refcounted string object. It will be + * AddRef'ed for the caller. When the caller is done with it, it should be + * Released. + * + * On error (basically out of memory to allocate the string, or input that + * is not valid UTF-8), this function will return a Null var. + * + * @param[in] data A string + * @param[in] len The length of the string. + * + * @return A PP_Var structure containing a reference counted + * string object. + */ + struct PP_Var (*VarFromUtf8)(const char* data, uint32_t len); + /** + * VarToUtf8() converts a string-type var to a char* encoded in UTF-8. This + * string is NOT NULL-terminated. The length will be placed in + * *len. If the string is valid but empty the return value will + * be non-NULL, but *len will still be 0. + * + * If the var is not a string, this function will return NULL and + * *len will be 0. + * + * The returned buffer will be valid as long as the underlying var is alive. + * If the instance frees its reference, the string will be freed and the + * pointer will be to arbitrary memory. + * + * @param[in] var A PP_Var struct containing a string-type var. + * @param[in,out] len A pointer to the length of the string-type var. + * + * @return A char* encoded in UTF-8. + */ + const char* (*VarToUtf8)(struct PP_Var var, uint32_t* len); + /** + * Converts a resource-type var to a PP_Resource. + * + * @param[in] var A PP_Var struct containing a resource-type var. + * + * @return A PP_Resource retrieved from the var, or 0 if the var + * is not a resource. The reference count of the resource is incremented on + * behalf of the caller. + */ + PP_Resource (*VarToResource)(struct PP_Var var); + /** + * Creates a new PP_Var from a given resource. Implicitly adds a + * reference count on the PP_Resource (equivalent to + * PPB_Core::AddRefResource(resource)). + * + * @param[in] resource A PP_Resource to be wrapped in a var. + * + * @return A PP_Var created for this resource, with type + * PP_VARTYPE_RESOURCE. The reference count of the var is set to + * 1 on behalf of the caller. + */ + struct PP_Var (*VarFromResource)(PP_Resource resource); +}; + +typedef struct PPB_Var_1_2 PPB_Var; + +struct PPB_Var_1_0 { + void (*AddRef)(struct PP_Var var); + void (*Release)(struct PP_Var var); + struct PP_Var (*VarFromUtf8)(PP_Module module, + const char* data, + uint32_t len); + const char* (*VarToUtf8)(struct PP_Var var, uint32_t* len); +}; + +struct PPB_Var_1_1 { + void (*AddRef)(struct PP_Var var); + void (*Release)(struct PP_Var var); + struct PP_Var (*VarFromUtf8)(const char* data, uint32_t len); + const char* (*VarToUtf8)(struct PP_Var var, uint32_t* len); +}; +/** + * @} + */ + +/* ppb_var_array.idl */ +/** + * @addtogroup Interfaces + * @{ + */ +struct PPB_VarArray_1_0 { + /** + * Creates an array var, i.e., a PP_Var with type set to + * PP_VARTYPE_ARRAY. The array length is set to 0. + * + * @return An empty array var, whose reference count is set to 1 on behalf of + * the caller. + */ + struct PP_Var (*Create)(void); + /** + * Gets an element from the array. + * + * @param[in] array An array var. + * @param[in] index An index indicating which element to return. + * + * @return The element at the specified position. The reference count of the + * element returned is incremented on behalf of the caller. If + * index is larger than or equal to the array length, an + * undefined var is returned. + */ + struct PP_Var (*Get)(struct PP_Var array, uint32_t index); + /** + * Sets the value of an element in the array. + * + * @param[in] array An array var. + * @param[in] index An index indicating which element to modify. If + * index is larger than or equal to the array length, the length + * is updated to be index + 1. Any position in the array that + * hasn't been set before is set to undefined, i.e., PP_Var of + * type PP_VARTYPE_UNDEFINED. + * @param[in] value The value to set. The array holds a reference to it on + * success. + * + * @return A PP_Bool indicating whether the operation succeeds. + */ + PP_Bool (*Set)(struct PP_Var array, uint32_t index, struct PP_Var value); + /** + * Gets the array length. + * + * @param[in] array An array var. + * + * @return The array length. + */ + uint32_t (*GetLength)(struct PP_Var array); + /** + * Sets the array length. + * + * @param[in] array An array var. + * @param[in] length The new array length. If length is smaller + * than its current value, the array is truncated to the new length; any + * elements that no longer fit are removed and the references to them will be + * released. If length is larger than its current value, + * undefined vars are appended to increase the array to the specified length. + * + * @return A PP_Bool indicating whether the operation succeeds. + */ + PP_Bool (*SetLength)(struct PP_Var array, uint32_t length); +}; + +typedef struct PPB_VarArray_1_0 PPB_VarArray; +/** + * @} + */ + +/* ppb_var_array_buffer.idl */ +/** + * @addtogroup Interfaces + * @{ + */ +/** + * The PPB_VarArrayBuffer interface provides a way to interact + * with JavaScript ArrayBuffers, which represent a contiguous sequence of + * bytes. Use PPB_Var to manage the reference count for a + * VarArrayBuffer. Note that these Vars are not part of the + * embedding page's DOM, and can only be shared with JavaScript using the + * PostMessage and HandleMessage functions of + * pp::Instance. + */ +struct PPB_VarArrayBuffer_1_0 { + /** + * Create() creates a zero-initialized VarArrayBuffer. + * + * @param[in] size_in_bytes The size of the ArrayBuffer to + * be created. + * + * @return A PP_Var representing a VarArrayBuffer + * of the requested size and with a reference count of 1. + */ + struct PP_Var (*Create)(uint32_t size_in_bytes); + /** + * ByteLength() retrieves the length of the VarArrayBuffer in + * bytes. On success, byte_length is set to the length of the + * given ArrayBuffer var. On failure, byte_length + * is unchanged (this could happen, for instance, if the given + * PP_Var is not of type PP_VARTYPE_ARRAY_BUFFER). + * Note that ByteLength() will successfully retrieve the size of an + * ArrayBuffer even if the ArrayBuffer is not + * currently mapped. + * + * @param[in] array The ArrayBuffer whose length should be + * returned. + * + * @param[out] byte_length A variable which is set to the length of the given + * ArrayBuffer on success. + * + * @return PP_TRUE on success, PP_FALSE on failure. + */ + PP_Bool (*ByteLength)(struct PP_Var array, uint32_t* byte_length); + /** + * Map() maps the ArrayBuffer in to the module's address space + * and returns a pointer to the beginning of the buffer for the given + * ArrayBuffer PP_Var. ArrayBuffers are copied when transmitted, + * so changes to the underlying memory are not automatically available to + * the embedding page. + * + * Note that calling Map() can be a relatively expensive operation. Use care + * when calling it in performance-critical code. For example, you should call + * it only once when looping over an ArrayBuffer. + * + * Example: + * + * @code + * char* data = (char*)(array_buffer_if.Map(array_buffer_var)); + * uint32_t byte_length = 0; + * PP_Bool ok = array_buffer_if.ByteLength(array_buffer_var, &byte_length); + * if (!ok) + * return DoSomethingBecauseMyVarIsNotAnArrayBuffer(); + * for (uint32_t i = 0; i < byte_length; ++i) + * data[i] = 'A'; + * @endcode + * + * @param[in] array The ArrayBuffer whose internal buffer should + * be returned. + * + * @return A pointer to the internal buffer for this + * ArrayBuffer. Returns NULL + * if the given PP_Var is not of type + * PP_VARTYPE_ARRAY_BUFFER. + */ + void* (*Map)(struct PP_Var array); + /** + * Unmap() unmaps the given ArrayBuffer var from the module + * address space. Use this if you want to save memory but might want to call + * Map() to map the buffer again later. The PP_Var remains valid + * and should still be released using PPB_Var when you are done + * with the ArrayBuffer. + * + * @param[in] array The ArrayBuffer to be released. + */ + void (*Unmap)(struct PP_Var array); +}; + +typedef struct PPB_VarArrayBuffer_1_0 PPB_VarArrayBuffer; +/** + * @} + */ + +/* ppb_var_dictionary.idl */ +/** + * @addtogroup Interfaces + * @{ + */ +/** + * A dictionary var contains key-value pairs with unique keys. The keys are + * strings while the values can be arbitrary vars. Key comparison is always + * done by value instead of by reference. + */ +struct PPB_VarDictionary_1_0 { + /** + * Creates a dictionary var, i.e., a PP_Var with type set to + * PP_VARTYPE_DICTIONARY. + * + * @return An empty dictionary var, whose reference count is set to 1 on + * behalf of the caller. + */ + struct PP_Var (*Create)(void); + /** + * Gets the value associated with the specified key. + * + * @param[in] dict A dictionary var. + * @param[in] key A string var. + * + * @return The value that is associated with key. The reference + * count of the element returned is incremented on behalf of the caller. If + * key is not a string var, or it doesn't exist in + * dict, an undefined var is returned. + */ + struct PP_Var (*Get)(struct PP_Var dict, struct PP_Var key); + /** + * Sets the value associated with the specified key. + * + * @param[in] dict A dictionary var. + * @param[in] key A string var. If this key hasn't existed in + * dict, it is added and associated with value; + * otherwise, the previous value is replaced with value. + * @param[in] value The value to set. The dictionary holds a reference to it + * on success. + * + * @return A PP_Bool indicating whether the operation succeeds. + */ + PP_Bool (*Set)(struct PP_Var dict, struct PP_Var key, struct PP_Var value); + /** + * Deletes the specified key and its associated value, if the key exists. The + * reference to the element will be released. + * + * @param[in] dict A dictionary var. + * @param[in] key A string var. + */ + void (*Delete)(struct PP_Var dict, struct PP_Var key); + /** + * Checks whether a key exists. + * + * @param[in] dict A dictionary var. + * @param[in] key A string var. + * + * @return A PP_Bool indicating whether the key exists. + */ + PP_Bool (*HasKey)(struct PP_Var dict, struct PP_Var key); + /** + * Gets all the keys in a dictionary. Please note that for each key that you + * set into the dictionary, a string var with the same contents is returned; + * but it may not be the same string var (i.e., value.as_id may + * be different). + * + * @param[in] dict A dictionary var. + * + * @return An array var which contains all the keys of dict. Its + * reference count is incremented on behalf of the caller. The elements are + * string vars. Returns a null var if failed. + */ + struct PP_Var (*GetKeys)(struct PP_Var dict); +}; + +typedef struct PPB_VarDictionary_1_0 PPB_VarDictionary; +/** + * @} + */ + +/* ppb_video_decoder.idl */ +/** + * @addtogroup Interfaces + * @{ + */ +/** + * Video decoder interface. + * + * Typical usage: + * - Call Create() to create a new video decoder resource. + * - Call Initialize() to initialize it with a 3d graphics context and the + * desired codec profile. + * - Call Decode() continuously (waiting for each previous call to complete) to + * push bitstream buffers to the decoder. + * - Call GetPicture() continuously (waiting for each previous call to complete) + * to pull decoded pictures from the decoder. + * - Call Flush() to signal end of stream to the decoder and perform shutdown + * when it completes. + * - Call Reset() to quickly stop the decoder (e.g. to implement Seek) and wait + * for the callback before restarting decoding at another point. + * - To destroy the decoder, the plugin should release all of its references to + * it. Any pending callbacks will abort before the decoder is destroyed. + * + * Available video codecs vary by platform. + * All: theora, vorbis, vp8. + * Chrome and ChromeOS: aac, h264. + * ChromeOS: mpeg4. + */ +struct PPB_VideoDecoder_1_1 { + /** + * Creates a new video decoder resource. + * + * @param[in] instance A PP_Instance identifying the instance + * with the video decoder. + * + * @return A PP_Resource corresponding to a video decoder if + * successful or 0 otherwise. + */ + PP_Resource (*Create)(PP_Instance instance); + /** + * Determines if the given resource is a video decoder. + * + * @param[in] resource A PP_Resource identifying a resource. + * + * @return PP_TRUE if the resource is a + * PPB_VideoDecoder, PP_FALSE if the resource is + * invalid or some other type. + */ + PP_Bool (*IsVideoDecoder)(PP_Resource resource); + /** + * Initializes a video decoder resource. This should be called after Create() + * and before any other functions. + * + * @param[in] video_decoder A PP_Resource identifying the video + * decoder. + * @param[in] graphics3d_context A PPB_Graphics3D resource to use + * during decoding. + * @param[in] profile A PP_VideoProfile specifying the video + * codec profile. + * @param[in] acceleration A PP_HardwareAcceleration specifying + * whether to use a hardware accelerated or a software implementation. + * @param[in] min_picture_count A count of pictures the plugin would like to + * have in flight. This is effectively the number of times the plugin can + * call GetPicture() and get a decoded frame without calling + * RecyclePicture(). The decoder has its own internal minimum count, and will + * take the larger of its internal and this value. A client that doesn't care + * can therefore just pass in zero for this argument. + * @param[in] callback A PP_CompletionCallback to be called upon + * completion. + * + * @return An int32_t containing an error code from pp_errors.h. + * Returns PP_ERROR_NOTSUPPORTED if video decoding is not available, or the + * requested profile is not supported. In this case, the client may call + * Initialize() again with different parameters to find a good configuration. + * Returns PP_ERROR_BADARGUMENT if the requested minimum picture count is + * unreasonably large. + */ + int32_t (*Initialize)(PP_Resource video_decoder, + PP_Resource graphics3d_context, + PP_VideoProfile profile, + PP_HardwareAcceleration acceleration, + uint32_t min_picture_count, + struct PP_CompletionCallback callback); + /** + * Decodes a bitstream buffer. Copies |size| bytes of data from the plugin's + * |buffer|. The plugin should wait until the decoder signals completion by + * returning PP_OK or by running |callback| before calling Decode() again. + * + * In general, each bitstream buffer should contain a demuxed bitstream frame + * for the selected video codec. For example, H264 decoders expect to receive + * one AnnexB NAL unit, including the 4 byte start code prefix, while VP8 + * decoders expect to receive a bitstream frame without the IVF frame header. + * + * If the call to Decode() eventually results in a picture, the |decode_id| + * parameter is copied into the returned picture. The plugin can use this to + * associate decoded pictures with Decode() calls (e.g. to assign timestamps + * or frame numbers to pictures.) This value is opaque to the API so the + * plugin is free to pass any value. + * + * @param[in] video_decoder A PP_Resource identifying the video + * decoder. + * @param[in] decode_id An optional value, chosen by the plugin, that can be + * used to associate calls to Decode() with decoded pictures returned by + * GetPicture(). + * @param[in] size Buffer size in bytes. + * @param[in] buffer Starting address of buffer. + * @param[in] callback A PP_CompletionCallback to be called on + * completion. + * + * @return An int32_t containing an error code from pp_errors.h. + * Returns PP_ERROR_FAILED if the decoder isn't initialized or if a Flush() + * or Reset() call is pending. + * Returns PP_ERROR_INPROGRESS if there is another Decode() call pending. + * Returns PP_ERROR_NOMEMORY if a bitstream buffer can't be created. + * Returns PP_ERROR_ABORTED when Reset() is called while Decode() is pending. + */ + int32_t (*Decode)(PP_Resource video_decoder, + uint32_t decode_id, + uint32_t size, + const void* buffer, + struct PP_CompletionCallback callback); + /** + * Gets the next picture from the decoder. The picture is valid after the + * decoder signals completion by returning PP_OK or running |callback|. The + * plugin can call GetPicture() again after the decoder signals completion. + * When the plugin is finished using the picture, it should return it to the + * system by calling RecyclePicture(). + * + * @param[in] video_decoder A PP_Resource identifying the video + * decoder. + * @param[out] picture A PP_VideoPicture to hold the decoded + * picture. + * @param[in] callback A PP_CompletionCallback to be called on + * completion. + * + * @return An int32_t containing an error code from pp_errors.h. + * Returns PP_ERROR_FAILED if the decoder isn't initialized or if a Reset() + * call is pending. + * Returns PP_ERROR_INPROGRESS if there is another GetPicture() call pending. + * Returns PP_ERROR_ABORTED when Reset() is called, or if a call to Flush() + * completes while GetPicture() is pending. + */ + int32_t (*GetPicture)(PP_Resource video_decoder, + struct PP_VideoPicture* picture, + struct PP_CompletionCallback callback); + /** + * Recycles a picture that the plugin has received from the decoder. + * The plugin should call this as soon as it has finished using the texture so + * the decoder can decode more pictures. + * + * @param[in] video_decoder A PP_Resource identifying the video + * decoder. + * @param[in] picture A PP_VideoPicture to return to + * the decoder. + */ + void (*RecyclePicture)(PP_Resource video_decoder, + const struct PP_VideoPicture* picture); + /** + * Flushes the decoder. The plugin should call Flush() when it reaches the + * end of its video stream in order to stop cleanly. The decoder will run any + * pending Decode() call to completion. The plugin should make no further + * calls to the decoder other than GetPicture() and RecyclePicture() until + * the decoder signals completion by running |callback|. Just before + * completion, any pending GetPicture() call will complete by running its + * callback with result PP_ERROR_ABORTED to signal that no more pictures are + * available. Any pictures held by the plugin remain valid during and after + * the flush and should be recycled back to the decoder. + * + * @param[in] video_decoder A PP_Resource identifying the video + * decoder. + * @param[in] callback A PP_CompletionCallback to be called on + * completion. + * + * @return An int32_t containing an error code from pp_errors.h. + * Returns PP_ERROR_FAILED if the decoder isn't initialized. + */ + int32_t (*Flush)(PP_Resource video_decoder, + struct PP_CompletionCallback callback); + /** + * Resets the decoder as quickly as possible. The plugin can call Reset() to + * skip to another position in the video stream. After Reset() returns, any + * pending calls to Decode() and GetPicture()) abort, causing their callbacks + * to run with PP_ERROR_ABORTED. The plugin should not make further calls to + * the decoder other than RecyclePicture() until the decoder signals + * completion by running |callback|. Any pictures held by the plugin remain + * valid during and after the reset and should be recycled back to the + * decoder. + * + * @param[in] video_decoder A PP_Resource identifying the video + * decoder. + * @param[in] callback A PP_CompletionCallback to be called on + * completion. + * + * @return An int32_t containing an error code from pp_errors.h. + * Returns PP_ERROR_FAILED if the decoder isn't initialized. + */ + int32_t (*Reset)(PP_Resource video_decoder, + struct PP_CompletionCallback callback); +}; + +typedef struct PPB_VideoDecoder_1_1 PPB_VideoDecoder; + +struct PPB_VideoDecoder_0_1 { + PP_Resource (*Create)(PP_Instance instance); + PP_Bool (*IsVideoDecoder)(PP_Resource resource); + int32_t (*Initialize)(PP_Resource video_decoder, + PP_Resource graphics3d_context, + PP_VideoProfile profile, + PP_Bool allow_software_fallback, + struct PP_CompletionCallback callback); + int32_t (*Decode)(PP_Resource video_decoder, + uint32_t decode_id, + uint32_t size, + const void* buffer, + struct PP_CompletionCallback callback); + int32_t (*GetPicture)(PP_Resource video_decoder, + struct PP_VideoPicture_0_1* picture, + struct PP_CompletionCallback callback); + void (*RecyclePicture)(PP_Resource video_decoder, + const struct PP_VideoPicture* picture); + int32_t (*Flush)(PP_Resource video_decoder, + struct PP_CompletionCallback callback); + int32_t (*Reset)(PP_Resource video_decoder, + struct PP_CompletionCallback callback); +}; + +struct PPB_VideoDecoder_0_2 { + PP_Resource (*Create)(PP_Instance instance); + PP_Bool (*IsVideoDecoder)(PP_Resource resource); + int32_t (*Initialize)(PP_Resource video_decoder, + PP_Resource graphics3d_context, + PP_VideoProfile profile, + PP_HardwareAcceleration acceleration, + struct PP_CompletionCallback callback); + int32_t (*Decode)(PP_Resource video_decoder, + uint32_t decode_id, + uint32_t size, + const void* buffer, + struct PP_CompletionCallback callback); + int32_t (*GetPicture)(PP_Resource video_decoder, + struct PP_VideoPicture_0_1* picture, + struct PP_CompletionCallback callback); + void (*RecyclePicture)(PP_Resource video_decoder, + const struct PP_VideoPicture* picture); + int32_t (*Flush)(PP_Resource video_decoder, + struct PP_CompletionCallback callback); + int32_t (*Reset)(PP_Resource video_decoder, + struct PP_CompletionCallback callback); +}; + +struct PPB_VideoDecoder_1_0 { + PP_Resource (*Create)(PP_Instance instance); + PP_Bool (*IsVideoDecoder)(PP_Resource resource); + int32_t (*Initialize)(PP_Resource video_decoder, + PP_Resource graphics3d_context, + PP_VideoProfile profile, + PP_HardwareAcceleration acceleration, + struct PP_CompletionCallback callback); + int32_t (*Decode)(PP_Resource video_decoder, + uint32_t decode_id, + uint32_t size, + const void* buffer, + struct PP_CompletionCallback callback); + int32_t (*GetPicture)(PP_Resource video_decoder, + struct PP_VideoPicture* picture, + struct PP_CompletionCallback callback); + void (*RecyclePicture)(PP_Resource video_decoder, + const struct PP_VideoPicture* picture); + int32_t (*Flush)(PP_Resource video_decoder, + struct PP_CompletionCallback callback); + int32_t (*Reset)(PP_Resource video_decoder, + struct PP_CompletionCallback callback); +}; +/** + * @} + */ + +/* ppb_video_frame.idl */ +/** + * @addtogroup Enums + * @{ + */ +typedef enum { + /** + * Unknown format value. + */ + PP_VIDEOFRAME_FORMAT_UNKNOWN = 0, + /** + * 12bpp YVU planar 1x1 Y, 2x2 VU samples. + */ + PP_VIDEOFRAME_FORMAT_YV12 = 1, + /** + * 12bpp YUV planar 1x1 Y, 2x2 UV samples. + */ + PP_VIDEOFRAME_FORMAT_I420 = 2, + /** + * 32bpp BGRA. + */ + PP_VIDEOFRAME_FORMAT_BGRA = 3, + /** + * The last format. + */ + PP_VIDEOFRAME_FORMAT_LAST = PP_VIDEOFRAME_FORMAT_BGRA +} PP_VideoFrame_Format; +/** + * @} + */ + +/** + * @addtogroup Interfaces + * @{ + */ +struct PPB_VideoFrame_0_1 { + /** + * Determines if a resource is a VideoFrame resource. + * + * @param[in] resource The PP_Resource to test. + * + * @return A PP_Bool with PP_TRUE if the given + * resource is a VideoFrame resource or PP_FALSE otherwise. + */ + PP_Bool (*IsVideoFrame)(PP_Resource resource); + /** + * Gets the timestamp of the video frame. + * + * @param[in] frame A PP_Resource corresponding to a video frame + * resource. + * + * @return A PP_TimeDelta containing the timestamp of the video + * frame. Given in seconds since the start of the containing video stream. + */ + PP_TimeDelta (*GetTimestamp)(PP_Resource frame); + /** + * Sets the timestamp of the video frame. Given in seconds since the + * start of the containing video stream. + * + * @param[in] frame A PP_Resource corresponding to a video frame + * resource. + * @param[in] timestamp A PP_TimeDelta containing the timestamp + * of the video frame. Given in seconds since the start of the containing + * video stream. + */ + void (*SetTimestamp)(PP_Resource frame, PP_TimeDelta timestamp); + /** + * Gets the format of the video frame. + * + * @param[in] frame A PP_Resource corresponding to a video frame + * resource. + * + * @return A PP_VideoFrame_Format containing the format of the + * video frame. + */ + PP_VideoFrame_Format (*GetFormat)(PP_Resource frame); + /** + * Gets the size of the video frame. + * + * @param[in] frame A PP_Resource corresponding to a video frame + * resource. + * @param[out] size A PP_Size. + * + * @return A PP_Bool with PP_TRUE on success or + * PP_FALSE on failure. + */ + PP_Bool (*GetSize)(PP_Resource frame, struct PP_Size* size); + /** + * Gets the data buffer for video frame pixels. + * + * @param[in] frame A PP_Resource corresponding to a video frame + * resource. + * + * @return A pointer to the beginning of the data buffer. + */ + void* (*GetDataBuffer)(PP_Resource frame); + /** + * Gets the size of data buffer. + * + * @param[in] frame A PP_Resource corresponding to a video frame + * resource. + * + * @return The size of the data buffer. + */ + uint32_t (*GetDataBufferSize)(PP_Resource frame); +}; + +typedef struct PPB_VideoFrame_0_1 PPB_VideoFrame; +/** + * @} + */ + +/* ppb_video_encoder.idl */ +/** + * @addtogroup Interfaces + * @{ + */ +/** + * Video encoder interface. + * + * Typical usage: + * - Call Create() to create a new video encoder resource. + * - Call GetSupportedFormats() to determine which codecs and profiles are + * available. + * - Call Initialize() to initialize the encoder for a supported profile. + * - Call GetVideoFrame() to get a blank frame and fill it in, or get a video + * frame from another resource, e.g. PPB_MediaStreamVideoTrack. + * - Call Encode() to push the video frame to the encoder. If an external frame + * is pushed, wait for completion to recycle the frame. + * - Call GetBitstreamBuffer() continuously (waiting for each previous call to + * complete) to pull encoded pictures from the encoder. + * - Call RecycleBitstreamBuffer() after consuming the data in the bitstream + * buffer. + * - To destroy the encoder, the plugin should release all of its references to + * it. Any pending callbacks will abort before the encoder is destroyed. + * + * Available video codecs vary by platform. + * All: vp8 (software). + * ChromeOS, depending on your device: h264 (hardware), vp8 (hardware) + */ +struct PPB_VideoEncoder_0_2 { + /** + * Creates a new video encoder resource. + * + * @param[in] instance A PP_Instance identifying the instance + * with the video encoder. + * + * @return A PP_Resource corresponding to a video encoder if + * successful or 0 otherwise. + */ + PP_Resource (*Create)(PP_Instance instance); + /** + * Determines if the given resource is a video encoder. + * + * @param[in] resource A PP_Resource identifying a resource. + * + * @return PP_TRUE if the resource is a + * PPB_VideoEncoder, PP_FALSE if the resource is + * invalid or some other type. + */ + PP_Bool (*IsVideoEncoder)(PP_Resource resource); + /** + * Gets an array of supported video encoder profiles. + * These can be used to choose a profile before calling Initialize(). + * + * @param[in] video_encoder A PP_Resource identifying the video + * encoder. + * @param[in] output A PP_ArrayOutput to receive the supported + * PP_VideoProfileDescription structs. + * @param[in] callback A PP_CompletionCallback to be called upon + * completion. + * + * @return If >= 0, the number of supported profiles returned, otherwise an + * error code from pp_errors.h. + */ + int32_t (*GetSupportedProfiles)(PP_Resource video_encoder, + struct PP_ArrayOutput output, + struct PP_CompletionCallback callback); + /** + * Initializes a video encoder resource. The plugin should call Initialize() + * successfully before calling any of the functions below. + * + * @param[in] video_encoder A PP_Resource identifying the video + * encoder. + * @param[in] input_format The PP_VideoFrame_Format of the + * frames which will be encoded. + * @param[in] input_visible_size A PP_Size specifying the + * dimensions of the visible part of the input frames. + * @param[in] output_profile A PP_VideoProfile specifying the + * codec profile of the encoded output stream. + * @param[in] acceleration A PP_HardwareAcceleration specifying + * whether to use a hardware accelerated or a software implementation. + * @param[in] callback A PP_CompletionCallback to be called upon + * completion. + * + * @return An int32_t containing an error code from pp_errors.h. + * Returns PP_ERROR_NOTSUPPORTED if video encoding is not available, or the + * requested codec profile is not supported. + */ + int32_t (*Initialize)(PP_Resource video_encoder, + PP_VideoFrame_Format input_format, + const struct PP_Size* input_visible_size, + PP_VideoProfile output_profile, + uint32_t initial_bitrate, + PP_HardwareAcceleration acceleration, + struct PP_CompletionCallback callback); + /** + * Gets the number of input video frames that the encoder may hold while + * encoding. If the plugin is providing the video frames, it should have at + * least this many available. + * + * @param[in] video_encoder A PP_Resource identifying the video + * encoder. + * @return An int32_t containing the number of frames required, or an error + * code from pp_errors.h. + * Returns PP_ERROR_FAILED if Initialize() has not successfully completed. + */ + int32_t (*GetFramesRequired)(PP_Resource video_encoder); + /** + * Gets the coded size of the video frames required by the encoder. Coded + * size is the logical size of the input frames, in pixels. The encoder may + * have hardware alignment requirements that make this different from + * |input_visible_size|, as requested in the call to Initialize(). + * + * @param[in] video_encoder A PP_Resource identifying the video + * encoder. + * @param[in] coded_size A PP_Size to hold the coded size. + * @return An int32_t containing a result code from pp_errors.h. + * Returns PP_ERROR_FAILED if Initialize() has not successfully completed. + */ + int32_t (*GetFrameCodedSize)(PP_Resource video_encoder, + struct PP_Size* coded_size); + /** + * Gets a blank video frame which can be filled with video data and passed + * to the encoder. + * + * @param[in] video_encoder A PP_Resource identifying the video + * encoder. + * @param[out] video_frame A blank PPB_VideoFrame resource. + * @param[in] callback A PP_CompletionCallback to be called upon + * completion. + * + * @return An int32_t containing an error code from pp_errors.h. + * Returns PP_ERROR_FAILED if Initialize() has not successfully completed. + */ + int32_t (*GetVideoFrame)(PP_Resource video_encoder, + PP_Resource* video_frame, + struct PP_CompletionCallback callback); + /** + * Encodes a video frame. + * + * @param[in] video_encoder A PP_Resource identifying the video + * encoder. + * @param[in] video_frame The PPB_VideoFrame to be encoded. + * @param[in] force_keyframe A PP_Bool> specifying whether the encoder + * should emit a key frame for this video frame. + * @param[in] callback A PP_CompletionCallback to be called upon + * completion. Plugins that pass PPB_VideoFrame resources owned + * by other resources should wait for completion before reusing them. + * + * @return An int32_t containing an error code from pp_errors.h. + * Returns PP_ERROR_FAILED if Initialize() has not successfully completed. + */ + int32_t (*Encode)(PP_Resource video_encoder, + PP_Resource video_frame, + PP_Bool force_keyframe, + struct PP_CompletionCallback callback); + /** + * Gets the next encoded bitstream buffer from the encoder. + * + * @param[in] video_encoder A PP_Resource identifying the video + * encoder. + * @param[out] bitstream_buffer A PP_BitstreamBuffer containing + * encoded video data. + * @param[in] callback A PP_CompletionCallback to be called upon + * completion. The plugin can call GetBitstreamBuffer from the callback in + * order to continuously "pull" bitstream buffers from the encoder. + * + * @return An int32_t containing an error code from pp_errors.h. + * Returns PP_ERROR_FAILED if Initialize() has not successfully completed. + * Returns PP_ERROR_INPROGRESS if a prior call to GetBitstreamBuffer() has + * not completed. + */ + int32_t (*GetBitstreamBuffer)(PP_Resource video_encoder, + struct PP_BitstreamBuffer* bitstream_buffer, + struct PP_CompletionCallback callback); + /** + * Recycles a bitstream buffer back to the encoder. + * + * @param[in] video_encoder A PP_Resource identifying the video + * encoder. + * @param[in] bitstream_buffer A PP_BitstreamBuffer that is no + * longer needed by the plugin. + */ + void (*RecycleBitstreamBuffer)( + PP_Resource video_encoder, + const struct PP_BitstreamBuffer* bitstream_buffer); + /** + * Requests a change to encoding parameters. This is only a request, + * fulfilled on a best-effort basis. + * + * @param[in] video_encoder A PP_Resource identifying the video + * encoder. + * @param[in] bitrate The requested new bitrate, in bits per second. + * @param[in] framerate The requested new framerate, in frames per second. + */ + void (*RequestEncodingParametersChange)(PP_Resource video_encoder, + uint32_t bitrate, + uint32_t framerate); + /** + * Closes the video encoder, and cancels any pending encodes. Any pending + * callbacks will still run, reporting PP_ERROR_ABORTED . It is + * not valid to call any encoder functions after a call to this method. + * Note: Destroying the video encoder closes it implicitly, + * so you are not required to call Close(). + * + * @param[in] video_encoder A PP_Resource identifying the video + * encoder. + */ + void (*Close)(PP_Resource video_encoder); +}; + +typedef struct PPB_VideoEncoder_0_2 PPB_VideoEncoder; + +struct PPB_VideoEncoder_0_1 { /* dev */ + PP_Resource (*Create)(PP_Instance instance); + PP_Bool (*IsVideoEncoder)(PP_Resource resource); + int32_t (*GetSupportedProfiles)(PP_Resource video_encoder, + struct PP_ArrayOutput output, + struct PP_CompletionCallback callback); + int32_t (*Initialize)(PP_Resource video_encoder, + PP_VideoFrame_Format input_format, + const struct PP_Size* input_visible_size, + PP_VideoProfile output_profile, + uint32_t initial_bitrate, + PP_HardwareAcceleration acceleration, + struct PP_CompletionCallback callback); + int32_t (*GetFramesRequired)(PP_Resource video_encoder); + int32_t (*GetFrameCodedSize)(PP_Resource video_encoder, + struct PP_Size* coded_size); + int32_t (*GetVideoFrame)(PP_Resource video_encoder, + PP_Resource* video_frame, + struct PP_CompletionCallback callback); + int32_t (*Encode)(PP_Resource video_encoder, + PP_Resource video_frame, + PP_Bool force_keyframe, + struct PP_CompletionCallback callback); + int32_t (*GetBitstreamBuffer)(PP_Resource video_encoder, + struct PP_BitstreamBuffer* bitstream_buffer, + struct PP_CompletionCallback callback); + void (*RecycleBitstreamBuffer)( + PP_Resource video_encoder, + const struct PP_BitstreamBuffer* bitstream_buffer); + void (*RequestEncodingParametersChange)(PP_Resource video_encoder, + uint32_t bitrate, + uint32_t framerate); + void (*Close)(PP_Resource video_encoder); +}; +/** + * @} + */ + +/* ppb_view.idl */ +/** + * @addtogroup Interfaces + * @{ + */ +/** + * PPB_View represents the state of the view of an instance. + * You will receive new view information using + * PPP_Instance.DidChangeView. + */ +struct PPB_View_1_2 { + /** + * IsView() determines if the given resource is a valid + * PPB_View resource. Note that PPB_ViewChanged + * resources derive from PPB_View and will return true here + * as well. + * + * @param resource A PP_Resource corresponding to a + * PPB_View resource. + * + * @return PP_TRUE if the given resource supports + * PPB_View or PP_FALSE if it is an invalid + * resource or is a resource of another type. + */ + PP_Bool (*IsView)(PP_Resource resource); + /** + * GetRect() retrieves the rectangle of the module instance associated + * with a view changed notification relative to the upper-left of the browser + * viewport. This position changes when the page is scrolled. + * + * The returned rectangle may not be inside the visible portion of the + * viewport if the module instance is scrolled off the page. Therefore, the + * position may be negative or larger than the size of the page. The size will + * always reflect the size of the module were it to be scrolled entirely into + * view. + * + * In general, most modules will not need to worry about the position of the + * module instance in the viewport, and only need to use the size. + * + * @param resource A PP_Resource corresponding to a + * PPB_View resource. + * + * @param rect A PP_Rect receiving the rectangle on success. + * + * @return Returns PP_TRUE if the resource was valid and the + * viewport rectangle was filled in, PP_FALSE if not. + */ + PP_Bool (*GetRect)(PP_Resource resource, struct PP_Rect* rect); + /** + * IsFullscreen() returns whether the instance is currently + * displaying in fullscreen mode. + * + * @param resource A PP_Resource corresponding to a + * PPB_View resource. + * + * @return PP_TRUE if the instance is in full screen mode, + * or PP_FALSE if it's not or the resource is invalid. + */ + PP_Bool (*IsFullscreen)(PP_Resource resource); + /** + * IsVisible() determines whether the module instance might be visible to + * the user. For example, the Chrome window could be minimized or another + * window could be over it. In both of these cases, the module instance + * would not be visible to the user, but IsVisible() will return true. + * + * Use the result to speed up or stop updates for invisible module + * instances. + * + * This function performs the duties of GetRect() (determining whether the + * module instance is scrolled into view and the clip rectangle is nonempty) + * and IsPageVisible() (whether the page is visible to the user). + * + * @param resource A PP_Resource corresponding to a + * PPB_View resource. + * + * @return PP_TRUE if the instance might be visible to the + * user, PP_FALSE if it is definitely not visible. + */ + PP_Bool (*IsVisible)(PP_Resource resource); + /** + * IsPageVisible() determines if the page that contains the module instance + * is visible. The most common cause of invisible pages is that + * the page is in a background tab in the browser. + * + * Most applications should use IsVisible() instead of this function since + * the module instance could be scrolled off of a visible page, and this + * function will still return true. However, depending on how your module + * interacts with the page, there may be certain updates that you may want to + * perform when the page is visible even if your specific module instance is + * not visible. + * + * @param resource A PP_Resource corresponding to a + * PPB_View resource. + * + * @return PP_TRUE if the instance is plausibly visible to the + * user, PP_FALSE if it is definitely not visible. + */ + PP_Bool (*IsPageVisible)(PP_Resource resource); + /** + * GetClipRect() returns the clip rectangle relative to the upper-left corner + * of the module instance. This rectangle indicates the portions of the module + * instance that are scrolled into view. + * + * If the module instance is scrolled off the view, the return value will be + * (0, 0, 0, 0). This clip rectangle does not take into account page + * visibility. Therefore, if the module instance is scrolled into view, but + * the page itself is on a tab that is not visible, the return rectangle will + * contain the visible rectangle as though the page were visible. Refer to + * IsPageVisible() and IsVisible() if you want to account for page + * visibility. + * + * Most applications will not need to worry about the clip rectangle. The + * recommended behavior is to do full updates if the module instance is + * visible, as determined by IsVisible(), and do no updates if it is not + * visible. + * + * However, if the cost for computing pixels is very high for your + * application, or the pages you're targeting frequently have very large + * module instances with small visible portions, you may wish to optimize + * further. In this case, the clip rectangle will tell you which parts of + * the module to update. + * + * Note that painting of the page and sending of view changed updates + * happens asynchronously. This means when the user scrolls, for example, + * it is likely that the previous backing store of the module instance will + * be used for the first paint, and will be updated later when your + * application generates new content with the new clip. This may cause + * flickering at the boundaries when scrolling. If you do choose to do + * partial updates, you may want to think about what color the invisible + * portions of your backing store contain (be it transparent or some + * background color) or to paint a certain region outside the clip to reduce + * the visual distraction when this happens. + * + * @param resource A PP_Resource corresponding to a + * PPB_View resource. + * + * @param clip Output argument receiving the clip rect on success. + * + * @return Returns PP_TRUE if the resource was valid and the + * clip rect was filled in, PP_FALSE if not. + */ + PP_Bool (*GetClipRect)(PP_Resource resource, struct PP_Rect* clip); + /** + * GetDeviceScale returns the scale factor between device pixels and Density + * Independent Pixels (DIPs, also known as logical pixels or UI pixels on + * some platforms). This allows the developer to render their contents at + * device resolution, even as coordinates / sizes are given in DIPs through + * the API. + * + * Note that the coordinate system for Pepper APIs is DIPs. Also note that + * one DIP might not equal one CSS pixel - when page scale/zoom is in effect. + * + * @param[in] resource A PP_Resource corresponding to a + * PPB_View resource. + * + * @return A float value representing the number of device pixels + * per DIP. If the resource is invalid, the value will be 0.0. + */ + float (*GetDeviceScale)(PP_Resource resource); + /** + * GetCSSScale returns the scale factor between DIPs and CSS pixels. This + * allows proper scaling between DIPs - as sent via the Pepper API - and CSS + * pixel coordinates used for Web content. + * + * @param[in] resource A PP_Resource corresponding to a + * PPB_View resource. + * + * @return css_scale A float value representing the number of + * DIPs per CSS pixel. If the resource is invalid, the value will be 0.0. + */ + float (*GetCSSScale)(PP_Resource resource); + /** + * GetScrollOffset returns the scroll offset of the window containing the + * plugin. + * + * @param[in] resource A PP_Resource corresponding to a + * PPB_View resource. + * + * @param[out] offset A PP_Point which will be set to the value + * of the scroll offset in CSS pixels. + * + * @return Returns PP_TRUE if the resource was valid and the + * offset was filled in, PP_FALSE if not. + */ + PP_Bool (*GetScrollOffset)(PP_Resource resource, struct PP_Point* offset); +}; + +typedef struct PPB_View_1_2 PPB_View; + +struct PPB_View_1_0 { + PP_Bool (*IsView)(PP_Resource resource); + PP_Bool (*GetRect)(PP_Resource resource, struct PP_Rect* rect); + PP_Bool (*IsFullscreen)(PP_Resource resource); + PP_Bool (*IsVisible)(PP_Resource resource); + PP_Bool (*IsPageVisible)(PP_Resource resource); + PP_Bool (*GetClipRect)(PP_Resource resource, struct PP_Rect* clip); +}; + +struct PPB_View_1_1 { + PP_Bool (*IsView)(PP_Resource resource); + PP_Bool (*GetRect)(PP_Resource resource, struct PP_Rect* rect); + PP_Bool (*IsFullscreen)(PP_Resource resource); + PP_Bool (*IsVisible)(PP_Resource resource); + PP_Bool (*IsPageVisible)(PP_Resource resource); + PP_Bool (*GetClipRect)(PP_Resource resource, struct PP_Rect* clip); + float (*GetDeviceScale)(PP_Resource resource); + float (*GetCSSScale)(PP_Resource resource); +}; +/** + * @} + */ + +/* ppb_vpn_provider.idl */ +/** + * @addtogroup Interfaces + * @{ + */ +/** + * Use the PPB_VpnProvider interface to implement a VPN client. + * Important: This API is available only on Chrome OS. + * + * This interface enhances the chrome.vpnProvider JavaScript API by + * providing a high performance path for packet handling. + * + * Permissions: Apps permission vpnProvider is required for + * PPB_VpnProvider.Bind(). + * + * Typical usage: + * - Create a PPB_VpnProvider instance. + * - Register the callback for PPB_VpnProvider.ReceivePacket(). + * - In the extension follow the usual workflow for configuring a VPN connection + * via the chrome.vpnProvider API until the step for notifying + * the connection state as "connected". + * - Bind to the previously created connection using + * PPB_VpnProvider.Bind(). + * - Notify the connection state as "connected" from JavaScript using + * chrome.vpnProvider.notifyConnectionStateChanged. + * - When the steps above are completed without errors, a virtual tunnel is + * created to the network stack of Chrome OS. IP packets can be sent through + * the tunnel using PPB_VpnProvider.SendPacket() and any packets + * originating on the Chrome OS device will be received using the callback + * registered for PPB_VpnProvider.ReceivePacket(). + * - When the user disconnects from the VPN configuration or there is an error + * the extension will be notfied via + * chrome.vpnProvider.onPlatformMessage. + */ +struct PPB_VpnProvider_0_1 { /* dev */ + /** + * Create() creates a VpnProvider instance. + * + * @param[in] instance A PP_Instance identifying the instance + * with the VpnProvider. + * + * @return A PP_Resource corresponding to a VpnProvider if + * successful. + */ + PP_Resource (*Create)(PP_Instance instance); + /** + * IsVpnProvider() determines if the provided resource is a + * VpnProvider instance. + * + * @param[in] resource A PP_Resource corresponding to a + * VpnProvider. + * + * @return Returns PP_TRUE if resource is a + * PPB_VpnProvider, PP_FALSE if the + * resource is invalid or some type other than + * PPB_VpnProvider. + */ + PP_Bool (*IsVpnProvider)(PP_Resource resource); + /** + * Bind() binds to an existing configuration created from JavaScript by + * chrome.vpnProvider.createConfig. All packets will be routed + * via SendPacket and ReceivePacket. The user should + * register the callback for ReceivePacket before calling + * Bind(). + * + * @param[in] vpn_provider A PP_Resource corresponding to a + * VpnProvider. + * + * @param[in] configuration_id A PP_VARTYPE_STRING representing + * the configuration id from the callback of + * chrome.vpnProvider.createConfig. + * + * @param[in] configuration_name A PP_VARTYPE_STRING representing + * the configuration name as defined by the user when calling + * chrome.vpnProvider.createConfig. + * + * @param[in] callback A PP_CompletionCallback called on + * completion. + * + * @return An int32_t containing an error code from pp_errors.h. + * Returns PP_ERROR_INPROGRESS if a previous call to + * Bind() has not completed. + * Returns PP_ERROR_BADARGUMENT if either + * configuration_id or configuration_name are not of + * type PP_VARTYPE_STRING. + * Returns PP_ERROR_NOACCESS if the caller does the have the + * required "vpnProvider" permission. + * Returns PP_ERROR_FAILED if connection_id and + * connection_name could not be matched with the existing + * connection, or if the plugin originates from a different extension than the + * one that created the connection. + */ + int32_t (*Bind)(PP_Resource vpn_provider, + struct PP_Var configuration_id, + struct PP_Var configuration_name, + struct PP_CompletionCallback callback); + /** + * SendPacket() sends an IP packet through the tunnel created for the VPN + * session. This will succeed only when the VPN session is owned by the + * module and the connection is bound. + * + * @param[in] vpn_provider A PP_Resource corresponding to a + * VpnProvider. + * + * @param[in] packet A PP_VARTYPE_ARRAY_BUFFER corresponding to + * an IP packet to be sent to the platform. + * + * @param[in] callback A PP_CompletionCallback called on + * completion. + * + * @return An int32_t containing an error code from pp_errors.h. + * Returns PP_ERROR_FAILED if the connection is not bound. + * Returns PP_ERROR_INPROGRESS if a previous call to + * SendPacket() has not completed. + * Returns PP_ERROR_BADARGUMENT if packet is not of + * type PP_VARTYPE_ARRAY_BUFFER. + */ + int32_t (*SendPacket)(PP_Resource vpn_provider, + struct PP_Var packet, + struct PP_CompletionCallback callback); + /** + * ReceivePacket() receives an IP packet from the tunnel for the VPN session. + * This function only returns a single packet. This function must be called at + * least N times to receive N packets, no matter the size of each packet. The + * callback should be registered before calling Bind(). + * + * @param[in] vpn_provider A PP_Resource corresponding to a + * VpnProvider. + * + * @param[out] packet The received packet is copied to provided + * packet. The packet must remain valid until + * ReceivePacket() completes. Its received PP_VarType will be + * PP_VARTYPE_ARRAY_BUFFER. + * + * @param[in] callback A PP_CompletionCallback called on + * completion. + * + * @return An int32_t containing an error code from pp_errors.h. + * Returns PP_ERROR_INPROGRESS if a previous call to + * ReceivePacket() has not completed. + */ + int32_t (*ReceivePacket)(PP_Resource vpn_provider, + struct PP_Var* packet, + struct PP_CompletionCallback callback); +}; +/** + * @} + */ + +/* ppb_websocket.idl */ +/** + * @addtogroup Enums + * @{ + */ +/** + * This enumeration contains the types representing the WebSocket ready state + * and these states are based on the JavaScript WebSocket API specification. + * GetReadyState() returns one of these states. + */ +typedef enum { + /** + * Ready state is queried on an invalid resource. + */ + PP_WEBSOCKETREADYSTATE_INVALID = -1, + /** + * Ready state that the connection has not yet been established. + */ + PP_WEBSOCKETREADYSTATE_CONNECTING = 0, + /** + * Ready state that the WebSocket connection is established and communication + * is possible. + */ + PP_WEBSOCKETREADYSTATE_OPEN = 1, + /** + * Ready state that the connection is going through the closing handshake. + */ + PP_WEBSOCKETREADYSTATE_CLOSING = 2, + /** + * Ready state that the connection has been closed or could not be opened. + */ + PP_WEBSOCKETREADYSTATE_CLOSED = 3 +} PP_WebSocketReadyState; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_WebSocketReadyState, 4); + +/** + * This enumeration contains status codes. These codes are used in Close() and + * GetCloseCode(). Refer to RFC 6455, The WebSocket Protocol, for further + * information. + * PP_WEBSOCKETSTATUSCODE_NORMAL_CLOSURE and codes in the range + * PP_WEBSOCKETSTATUSCODE_USER_REGISTERED_MIN to + * PP_WEBSOCKETSTATUSCODE_USER_REGISTERED_MAX, and + * PP_WEBSOCKETSTATUSCODE_USER_PRIVATE_MIN to + * PP_WEBSOCKETSTATUSCODE_USER_PRIVATE_MAX are valid for Close(). + */ +typedef enum { + /** + * Indicates to request closing connection without status code and reason. + * + * (Note that the code 1005 is forbidden to send in actual close frames by + * the RFC. PP_WebSocket reuses this code internally and the code will never + * appear in the actual close frames.) + */ + PP_WEBSOCKETSTATUSCODE_NOT_SPECIFIED = 1005, + /** + * Status codes in the range 0-999 are not used. + */ + /** + * Indicates a normal closure. + */ + PP_WEBSOCKETSTATUSCODE_NORMAL_CLOSURE = 1000, + /** + * Indicates that an endpoint is "going away", such as a server going down. + */ + PP_WEBSOCKETSTATUSCODE_GOING_AWAY = 1001, + /** + * Indicates that an endpoint is terminating the connection due to a protocol + * error. + */ + PP_WEBSOCKETSTATUSCODE_PROTOCOL_ERROR = 1002, + /** + * Indicates that an endpoint is terminating the connection because it has + * received a type of data it cannot accept. + */ + PP_WEBSOCKETSTATUSCODE_UNSUPPORTED_DATA = 1003, + /** + * Status code 1004 is reserved. + */ + /** + * Pseudo code to indicate that receiving close frame doesn't contain any + * status code. + */ + PP_WEBSOCKETSTATUSCODE_NO_STATUS_RECEIVED = 1005, + /** + * Pseudo code to indicate that connection was closed abnormally, e.g., + * without closing handshake. + */ + PP_WEBSOCKETSTATUSCODE_ABNORMAL_CLOSURE = 1006, + /** + * Indicates that an endpoint is terminating the connection because it has + * received data within a message that was not consistent with the type of + * the message (e.g., non-UTF-8 data within a text message). + */ + PP_WEBSOCKETSTATUSCODE_INVALID_FRAME_PAYLOAD_DATA = 1007, + /** + * Indicates that an endpoint is terminating the connection because it has + * received a message that violates its policy. + */ + PP_WEBSOCKETSTATUSCODE_POLICY_VIOLATION = 1008, + /** + * Indicates that an endpoint is terminating the connection because it has + * received a message that is too big for it to process. + */ + PP_WEBSOCKETSTATUSCODE_MESSAGE_TOO_BIG = 1009, + /** + * Indicates that an endpoint (client) is terminating the connection because + * it has expected the server to negotiate one or more extension, but the + * server didn't return them in the response message of the WebSocket + * handshake. + */ + PP_WEBSOCKETSTATUSCODE_MANDATORY_EXTENSION = 1010, + /** + * Indicates that a server is terminating the connection because it + * encountered an unexpected condition. + */ + PP_WEBSOCKETSTATUSCODE_INTERNAL_SERVER_ERROR = 1011, + /** + * Status codes in the range 1012-1014 are reserved. + */ + /** + * Pseudo code to indicate that the connection was closed due to a failure to + * perform a TLS handshake. + */ + PP_WEBSOCKETSTATUSCODE_TLS_HANDSHAKE = 1015, + /** + * Status codes in the range 1016-2999 are reserved. + */ + /** + * Status codes in the range 3000-3999 are reserved for use by libraries, + * frameworks, and applications. These codes are registered directly with + * IANA. + */ + PP_WEBSOCKETSTATUSCODE_USER_REGISTERED_MIN = 3000, + PP_WEBSOCKETSTATUSCODE_USER_REGISTERED_MAX = 3999, + /** + * Status codes in the range 4000-4999 are reserved for private use. + * Application can use these codes for application specific purposes freely. + */ + PP_WEBSOCKETSTATUSCODE_USER_PRIVATE_MIN = 4000, + PP_WEBSOCKETSTATUSCODE_USER_PRIVATE_MAX = 4999 +} PP_WebSocketCloseCode; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_WebSocketCloseCode, 4); +/** + * @} + */ + +/** + * @addtogroup Interfaces + * @{ + */ +/** + * The PPB_WebSocket interface provides bi-directional, + * full-duplex, communications over a single TCP socket. + */ +struct PPB_WebSocket_1_0 { + /** + * Create() creates a WebSocket instance. + * + * @param[in] instance A PP_Instance identifying the instance + * with the WebSocket. + * + * @return A PP_Resource corresponding to a WebSocket if + * successful. + */ + PP_Resource (*Create)(PP_Instance instance); + /** + * IsWebSocket() determines if the provided resource is a + * WebSocket instance. + * + * @param[in] resource A PP_Resource corresponding to a + * WebSocket. + * + * @return Returns PP_TRUE if resource is a + * PPB_WebSocket, PP_FALSE if the + * resource is invalid or some type other than + * PPB_WebSocket. + */ + PP_Bool (*IsWebSocket)(PP_Resource resource); + /** + * Connect() connects to the specified WebSocket server. You can call this + * function once for a web_socket. + * + * @param[in] web_socket A PP_Resource corresponding to a + * WebSocket. + * + * @param[in] url A PP_Var representing a WebSocket server URL. + * The PP_VarType must be PP_VARTYPE_STRING. + * + * @param[in] protocols A pointer to an array of PP_Var + * specifying sub-protocols. Each PP_Var represents one + * sub-protocol and its PP_VarType must be + * PP_VARTYPE_STRING. This argument can be null only if + * protocol_count is 0. + * + * @param[in] protocol_count The number of sub-protocols in + * protocols. + * + * @param[in] callback A PP_CompletionCallback called + * when a connection is established or an error occurs in establishing + * connection. + * + * @return An int32_t containing an error code from pp_errors.h. + * Returns PP_ERROR_BADARGUMENT if the specified + * url, or protocols contain an invalid string as + * defined in the WebSocket API specification. + * PP_ERROR_BADARGUMENT corresponds to a SyntaxError in the + * WebSocket API specification. + * Returns PP_ERROR_NOACCESS if the protocol specified in the + * url is not a secure protocol, but the origin of the caller + * has a secure scheme. Also returns PP_ERROR_NOACCESS if the + * port specified in the url is a port that the user agent + * is configured to block access to because it is a well-known port like + * SMTP. PP_ERROR_NOACCESS corresponds to a SecurityError of the + * specification. + * Returns PP_ERROR_INPROGRESS if this is not the first call to + * Connect(). + */ + int32_t (*Connect)(PP_Resource web_socket, + struct PP_Var url, + const struct PP_Var protocols[], + uint32_t protocol_count, + struct PP_CompletionCallback callback); + /** + * Close() closes the specified WebSocket connection by specifying + * code and reason. + * + * @param[in] web_socket A PP_Resource corresponding to a + * WebSocket. + * + * @param[in] code The WebSocket close code. This is ignored if it is + * PP_WEBSOCKETSTATUSCODE_NOT_SPECIFIED. + * PP_WEBSOCKETSTATUSCODE_NORMAL_CLOSURE must be used for the + * usual case. To indicate some specific error cases, codes in the range + * PP_WEBSOCKETSTATUSCODE_USER_REGISTERED_MIN to + * PP_WEBSOCKETSTATUSCODE_USER_REGISTERED_MAX, and in the range + * PP_WEBSOCKETSTATUSCODE_USER_PRIVATE_MIN to + * PP_WEBSOCKETSTATUSCODE_USER_PRIVATE_MAX are available. + * + * @param[in] reason A PP_Var representing the WebSocket + * close reason. This is ignored if it is PP_VARTYPE_UNDEFINED. + * Otherwise, its PP_VarType must be + * PP_VARTYPE_STRING. + * + * @param[in] callback A PP_CompletionCallback called + * when the connection is closed or an error occurs in closing the + * connection. + * + * @return An int32_t containing an error code from pp_errors.h. + * Returns PP_ERROR_BADARGUMENT if reason contains + * an invalid character as a UTF-8 string, or is longer than 123 bytes. + * PP_ERROR_BADARGUMENT corresponds to a JavaScript SyntaxError + * in the WebSocket API specification. + * Returns PP_ERROR_NOACCESS if the code is not an integer + * equal to 1000 or in the range 3000 to 4999. PP_ERROR_NOACCESS + * corresponds to an InvalidAccessError in the WebSocket API specification. + * Returns PP_ERROR_INPROGRESS if a previous call to Close() is + * not finished. + */ + int32_t (*Close)(PP_Resource web_socket, + uint16_t code, + struct PP_Var reason, + struct PP_CompletionCallback callback); + /** + * ReceiveMessage() receives a message from the WebSocket server. + * This interface only returns a single message. That is, this interface must + * be called at least N times to receive N messages, no matter the size of + * each message. + * + * @param[in] web_socket A PP_Resource corresponding to a + * WebSocket. + * + * @param[out] message The received message is copied to provided + * message. The message must remain valid until + * ReceiveMessage() completes. Its received PP_VarType will be + * PP_VARTYPE_STRING or PP_VARTYPE_ARRAY_BUFFER. + * + * @param[in] callback A PP_CompletionCallback called + * when ReceiveMessage() completes. This callback is ignored if + * ReceiveMessage() completes synchronously and returns PP_OK. + * + * @return An int32_t containing an error code from pp_errors.h. + * If an error is detected or connection is closed, ReceiveMessage() returns + * PP_ERROR_FAILED after all buffered messages are received. + * Until buffered message become empty, ReceiveMessage() continues to return + * PP_OK as if connection is still established without errors. + */ + int32_t (*ReceiveMessage)(PP_Resource web_socket, + struct PP_Var* message, + struct PP_CompletionCallback callback); + /** + * SendMessage() sends a message to the WebSocket server. + * + * @param[in] web_socket A PP_Resource corresponding to a + * WebSocket. + * + * @param[in] message A message to send. The message is copied to an internal + * buffer, so the caller can free message safely after returning + * from the function. Its sent PP_VarType must be + * PP_VARTYPE_STRING or PP_VARTYPE_ARRAY_BUFFER. + * + * @return An int32_t containing an error code from pp_errors.h. + * Returns PP_ERROR_FAILED if the ReadyState is + * PP_WEBSOCKETREADYSTATE_CONNECTING. + * PP_ERROR_FAILED corresponds to a JavaScript + * InvalidStateError in the WebSocket API specification. + * Returns PP_ERROR_BADARGUMENT if the provided + * message contains an invalid character as a UTF-8 string. + * PP_ERROR_BADARGUMENT corresponds to a JavaScript + * SyntaxError in the WebSocket API specification. + * Otherwise, returns PP_OK, which doesn't necessarily mean + * that the server received the message. + */ + int32_t (*SendMessage)(PP_Resource web_socket, struct PP_Var message); + /** + * GetBufferedAmount() returns the number of bytes of text and binary + * messages that have been queued for the WebSocket connection to send, but + * have not been transmitted to the network yet. + * + * @param[in] web_socket A PP_Resource corresponding to a + * WebSocket. + * + * @return Returns the number of bytes. + */ + uint64_t (*GetBufferedAmount)(PP_Resource web_socket); + /** + * GetCloseCode() returns the connection close code for the WebSocket + * connection. + * + * @param[in] web_socket A PP_Resource corresponding to a + * WebSocket. + * + * @return Returns 0 if called before the close code is set. + */ + uint16_t (*GetCloseCode)(PP_Resource web_socket); + /** + * GetCloseReason() returns the connection close reason for the WebSocket + * connection. + * + * @param[in] web_socket A PP_Resource corresponding to a + * WebSocket. + * + * @return Returns a PP_VARTYPE_STRING var. If called before the + * close reason is set, the return value contains an empty string. Returns a + * PP_VARTYPE_UNDEFINED if called on an invalid resource. + */ + struct PP_Var (*GetCloseReason)(PP_Resource web_socket); + /** + * GetCloseWasClean() returns if the connection was closed cleanly for the + * specified WebSocket connection. + * + * @param[in] web_socket A PP_Resource corresponding to a + * WebSocket. + * + * @return Returns PP_FALSE if called before the connection is + * closed, called on an invalid resource, or closed for abnormal reasons. + * Otherwise, returns PP_TRUE if the connection was closed + * cleanly. + */ + PP_Bool (*GetCloseWasClean)(PP_Resource web_socket); + /** + * GetExtensions() returns the extensions selected by the server for the + * specified WebSocket connection. + * + * @param[in] web_socket A PP_Resource corresponding to a + * WebSocket. + * + * @return Returns a PP_VARTYPE_STRING var. If called before the + * connection is established, the var's data is an empty string. Returns a + * PP_VARTYPE_UNDEFINED if called on an invalid resource. + */ + struct PP_Var (*GetExtensions)(PP_Resource web_socket); + /** + * GetProtocol() returns the sub-protocol chosen by the server for the + * specified WebSocket connection. + * + * @param[in] web_socket A PP_Resource corresponding to a + * WebSocket. + * + * @return Returns a PP_VARTYPE_STRING var. If called before the + * connection is established, the var contains the empty string. Returns a + * PP_VARTYPE_UNDEFINED if called on an invalid resource. + */ + struct PP_Var (*GetProtocol)(PP_Resource web_socket); + /** + * GetReadyState() returns the ready state of the specified WebSocket + * connection. + * + * @param[in] web_socket A PP_Resource corresponding to a + * WebSocket. + * + * @return Returns PP_WEBSOCKETREADYSTATE_INVALID if called + * before Connect() is called, or if this function is called on an + * invalid resource. + */ + PP_WebSocketReadyState (*GetReadyState)(PP_Resource web_socket); + /** + * GetURL() returns the URL associated with specified WebSocket connection. + * + * @param[in] web_socket A PP_Resource corresponding to a + * WebSocket. + * + * @return Returns a PP_VARTYPE_STRING var. If called before the + * connection is established, the var contains the empty string. Returns a + * PP_VARTYPE_UNDEFINED if this function is called on an + * invalid resource. + */ + struct PP_Var (*GetURL)(PP_Resource web_socket); +}; + +typedef struct PPB_WebSocket_1_0 PPB_WebSocket; +/** + * @} + */ + +/* ppp.idl */ + +#include "ppapi/c/pp_module.h" +#include "ppapi/c/pp_stdint.h" +#include "ppapi/c/ppb.h" + +#if __GNUC__ >= 4 +#define PP_EXPORT __attribute__ ((visibility("default"))) +#elif defined(_MSC_VER) +#define PP_EXPORT __declspec(dllexport) +#endif + +/* {PENDING: undefine PP_EXPORT?} */ + +/* We don't want name mangling for these external functions. We only need + * 'extern "C"' if we're compiling with a C++ compiler. + */ +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @addtogroup Functions + * @{ + */ + +/** + * PPP_InitializeModule() is the entry point for a module and is called by the + * browser when your module loads. Your code must implement this function. + * + * Failure indicates to the browser that this module can not be used. In this + * case, the module will be unloaded and ShutdownModule will NOT be called. + * + * @param[in] module A handle to your module. Generally you should store this + * value since it will be required for other API calls. + * @param[in] get_browser_interface A pointer to the function that you can + * use to query for browser interfaces. Generally you should store this value + * for future use. + * + * @return PP_OK on success. Any other value on failure. + */ +PP_EXPORT int32_t PPP_InitializeModule(PP_Module module, + PPB_GetInterface get_browser_interface); +/** + * @} + */ + +/** + * @addtogroup Functions + * @{ + */ + +/** + * PPP_ShutdownModule() is sometimes called before the module + * is unloaded. It is not recommended that you implement this function. + * + * There is no practical use of this function for third party modules. Its + * existence is because of some internal use cases inside Chrome. + * + * Since your module runs in a separate process, there's no need to free + * allocated memory. There is also no need to free any resources since all of + * resources associated with an instance will be force-freed when that instance + * is deleted. + * + * Note: This function will always be skipped on untrusted + * (Native Client) implementations. This function may be skipped on trusted + * implementations in certain circumstances when Chrome does "fast shutdown" + * of a web page. + */ +PP_EXPORT void PPP_ShutdownModule(void); +/** + * @} + */ + +/** + * @addtogroup Functions + * @{ + */ + +/** + * PPP_GetInterface() is called by the browser to query the module for + * interfaces it supports. + * + * Your module must implement the PPP_Instance interface or it + * will be unloaded. Other interfaces are optional. + * + * This function is called from within browser code whenever an interface is + * needed. This means your plugin could be reentered via this function if you + * make a browser call and it needs an interface. Furthermore, you should not + * make any other browser calls from within your implementation to avoid + * reentering the browser. + * + * As a result, your implementation of this should merely provide a lookup + * from the requested name to an interface pointer, via something like a big + * if/else block or a map, and not do any other work. + * + * @param[in] interface_name A pointer to a "PPP" (plugin) interface name. + * Interface names are null-terminated ASCII strings. + * + * @return A pointer for the interface or NULL if the interface is + * not supported. + */ +PP_EXPORT const void* PPP_GetInterface(const char* interface_name); +/** + * @} + */ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + + +/** + * @addtogroup Typedefs + * @{ + */ +/** + * Defines the type of the PPP_InitializeModule function. + */ +typedef int32_t (*PP_InitializeModule_Func)( + PP_Module module, + PPB_GetInterface get_browser_interface); + +/** + * Defines the type of the PPP_ShutdownModule function. + */ +typedef void (*PP_ShutdownModule_Func)(void); + +/** + * Defines the type of the PPP_ShutdownModule function. + */ +typedef const void* (*PP_GetInterface_Func)(const char* interface_name); +/** + * @} + */ + +/* ppp_graphics_3d.idl */ +/** + * @addtogroup Interfaces + * @{ + */ +/** + * PPP_Graphics3D defines the notification interface for a 3D + * graphics context. + */ +struct PPP_Graphics3D_1_0 { + /** + * Called when the OpenGL ES window is invalidated and needs to be repainted. + */ + void (*Graphics3DContextLost)(PP_Instance instance); +}; + +typedef struct PPP_Graphics3D_1_0 PPP_Graphics3D; +/** + * @} + */ + +/* ppp_input_event.idl */ +/** + * @addtogroup Interfaces + * @{ + */ +struct PPP_InputEvent_0_1 { + /** + * Function for receiving input events from the browser. + * + * In order to receive input events, you must register for them by calling + * PPB_InputEvent.RequestInputEvents() or RequestFilteringInputEvents(). By + * default, no events are delivered. + * + * If the event was handled, it will not be forwarded to the default handlers + * in the web page. If it was not handled, it may be dispatched to a default + * handler. So it is important that an instance respond accurately with + * whether event propagation should continue. + * + * Event propagation also controls focus. If you handle an event like a mouse + * event, typically the instance will be given focus. Returning false from + * a filtered event handler or not registering for an event type means that + * the click will be given to a lower part of the page and your instance will + * not receive focus. This allows an instance to be partially transparent, + * where clicks on the transparent areas will behave like clicks to the + * underlying page. + * + * In general, you should try to keep input event handling short. Especially + * for filtered input events, the browser or page may be blocked waiting for + * you to respond. + * + * The caller of this function will maintain a reference to the input event + * resource during this call. Unless you take a reference to the resource + * to hold it for later, you don't need to release it. + * + * Note: If you're not receiving input events, make sure you + * register for the event classes you want by calling RequestInputEvents or + * RequestFilteringInputEvents. If you're still not receiving keyboard input + * events, make sure you're returning true (or using a non-filtered event + * handler) for mouse events. Otherwise, the instance will not receive focus + * and keyboard events will not be sent. + * + * \see PPB_InputEvent.RequestInputEvents and + * PPB_InputEvent.RequestFilteringInputEvents + * + * @return PP_TRUE if the event was handled, PP_FALSE if not. If you have + * registered to filter this class of events by calling + * RequestFilteringInputEvents, and you return PP_FALSE, the event will + * be forwarded to the page (and eventually the browser) for the default + * handling. For non-filtered events, the return value will be ignored. + */ + PP_Bool (*HandleInputEvent)(PP_Instance instance, PP_Resource input_event); +}; + +typedef struct PPP_InputEvent_0_1 PPP_InputEvent; +/** + * @} + */ + +/* ppp_instance.idl */ +/** + * @addtogroup Interfaces + * @{ + */ +/** + * The PPP_Instance interface contains pointers to a series of + * functions that you must implement in your module. These functions can be + * trivial (simply return the default return value) unless you want your module + * to handle events such as change of focus or input events (keyboard/mouse) + * events. + */ +struct PPP_Instance_1_1 { + /** + * DidCreate() is a creation handler that is called when a new instance is + * created. This function is called for each instantiation on the page, + * corresponding to one \ tag on the page. + * + * Generally you would handle this call by initializing the information + * your module associates with an instance and creating a mapping from the + * given PP_Instance handle to this data. The + * PP_Instance handle will be used in subsequent calls to + * identify which instance the call pertains to. + * + * It's possible for more than one instance to be created in a single module. + * This means that you may get more than one OnCreate without an + * OnDestroy in between, and should be prepared to maintain + * multiple states associated with each instance. + * + * If this function reports a failure (by returning PP_FALSE), + * the instance will be deleted. + * + * @param[in] instance A new PP_Instance identifying one + * instance of a module. This is an opaque handle. + * + * @param[in] argc The number of arguments contained in argn + * and argv. + * + * @param[in] argn An array of argument names. These argument names are + * supplied in the \ tag, for example: + * \ will produce two + * argument names: "id" and "dimensions." + * + * @param[in] argv An array of argument values. These are the values of the + * arguments listed in the \ tag, for example + * \ will produce two + * argument values: "nacl_module" and "2". The indices of these values match + * the indices of the corresponding names in argn. + * + * @return PP_TRUE on success or PP_FALSE on + * failure. + */ + PP_Bool (*DidCreate)(PP_Instance instance, + uint32_t argc, + const char* argn[], + const char* argv[]); + /** + * DidDestroy() is an instance destruction handler. This function is called + * in many cases (see below) when a module instance is destroyed. It will be + * called even if DidCreate() returned failure. + * + * Generally you will handle this call by deallocating the tracking + * information and the PP_Instance mapping you created in the + * DidCreate() call. You can also free resources associated with this + * instance but this isn't required; all resources associated with the deleted + * instance will be automatically freed when this function returns. + * + * The instance identifier will still be valid during this call, so the module + * can perform cleanup-related tasks. Once this function returns, the + * PP_Instance handle will be invalid. This means that you can't + * do any asynchronous operations like network requests, file writes or + * messaging from this function since they will be immediately canceled. + * + * Note: This function will always be skipped on untrusted + * (Native Client) implementations. This function may be skipped on trusted + * implementations in certain circumstances when Chrome does "fast shutdown" + * of a web page. Fast shutdown will happen in some cases when all module + * instances are being deleted, and no cleanup functions will be called. + * The module will just be unloaded and the process terminated. + * + * @param[in] instance A PP_Instance identifying one instance + * of a module. + */ + void (*DidDestroy)(PP_Instance instance); + /** + * DidChangeView() is called when the position, size, or other view + * attributes of the instance has changed. + */ + void (*DidChangeView)(PP_Instance instance, PP_Resource view); + /** + * DidChangeFocus() is called when an instance has gained or lost focus. + * Having focus means that keyboard events will be sent to the instance. + * An instance's default condition is that it will not have focus. + * + * The focus flag takes into account both browser tab and window focus as + * well as focus of the plugin element on the page. In order to be deemed + * to have focus, the browser window must be topmost, the tab must be + * selected in the window, and the instance must be the focused element on + * the page. + * + * Note:Clicks on instances will give focus only if you + * handle the click event. Return true from + * HandleInputEvent in PPP_InputEvent (or use + * unfiltered events) to signal that the click event was handled. Otherwise, + * the browser will bubble the event and give focus to the element on the page + * that actually did end up consuming it. If you're not getting focus, check + * to make sure you're either requesting them via + * RequestInputEvents() (which implicitly marks all input events + * as consumed) or via RequestFilteringInputEvents() and + * returning true from your event handler. + * + * @param[in] instance A PP_Instance identifying the instance + * receiving the input event. + * + * @param[in] has_focus Indicates the new focused state of the instance. + */ + void (*DidChangeFocus)(PP_Instance instance, PP_Bool has_focus); + /** + * HandleDocumentLoad() is called after initialize for a full-frame + * instance that was instantiated based on the MIME type of a DOMWindow + * navigation. This situation only applies to modules that are pre-registered + * to handle certain MIME types. If you haven't specifically registered to + * handle a MIME type or aren't positive this applies to you, your + * implementation of this function can just return PP_FALSE. + * + * The given url_loader corresponds to a + * PPB_URLLoader instance that is already opened. Its response + * headers may be queried using PPB_URLLoader::GetResponseInfo. + * The reference count for the URL loader is not incremented automatically on + * behalf of the module. You need to increment the reference count yourself + * if you are going to keep a reference to it. + * + * This method returns PP_FALSE if the module cannot handle the + * data. In response to this method, the module should call + * ReadResponseBody() to read the incoming data. + * + * @param[in] instance A PP_Instance identifying the instance + * that should do the load. + * + * @param[in] url_loader An open PPB_URLLoader instance. + * + * @return PP_TRUE if the data was handled, + * PP_FALSE otherwise. If you return false, the load will be + * canceled for you. + */ + PP_Bool (*HandleDocumentLoad)(PP_Instance instance, PP_Resource url_loader); +}; + +typedef struct PPP_Instance_1_1 PPP_Instance; + +struct PPP_Instance_1_0 { + PP_Bool (*DidCreate)(PP_Instance instance, + uint32_t argc, + const char* argn[], + const char* argv[]); + void (*DidDestroy)(PP_Instance instance); + void (*DidChangeView)(PP_Instance instance, + const struct PP_Rect* position, + const struct PP_Rect* clip); + void (*DidChangeFocus)(PP_Instance instance, PP_Bool has_focus); + PP_Bool (*HandleDocumentLoad)(PP_Instance instance, PP_Resource url_loader); +}; +/** + * @} + */ + +/* ppp_messaging.idl */ +/** + * @addtogroup Interfaces + * @{ + */ +/** + * The PPP_Messaging interface contains pointers to functions + * that you must implement to handle postMessage events on the associated + * DOM element. + */ +struct PPP_Messaging_1_0 { + /** + * HandleMessage() is a function that the browser calls when PostMessage() + * is invoked on the DOM element for the module instance in JavaScript. Note + * that PostMessage() in the JavaScript interface is asynchronous, meaning + * JavaScript execution will not be blocked while HandleMessage() is + * processing the message. + * + * @param[in] instance A PP_Instance identifying one instance + * of a module. + * @param[in] message A PP_Var which has been converted from a + * JavaScript value. JavaScript array/object types are supported from Chrome + * M29 onward. All JavaScript values are copied when passing them to the + * plugin. + * + * When converting JavaScript arrays, any object properties whose name + * is not an array index are ignored. When passing arrays and objects, the + * entire reference graph will be converted and transferred. If the reference + * graph has cycles, the message will not be sent and an error will be logged + * to the console. + * + * The following JavaScript code invokes HandleMessage, passing + * the module instance on which it was invoked, with message + * being a string PP_Var containing "Hello world!" + * + * Example: + * + * @code + * + * + * + * + * + * + * @endcode + * + */ + void (*HandleMessage)(PP_Instance instance, struct PP_Var message); +}; + +typedef struct PPP_Messaging_1_0 PPP_Messaging; +/** + * @} + */ + +/* ppp_mouse_lock.idl */ +/** + * @addtogroup Interfaces + * @{ + */ +/** + * The PPP_MouseLock interface contains a function that you must + * implement to receive mouse lock events from the browser. + */ +struct PPP_MouseLock_1_0 { + /** + * MouseLockLost() is called when the instance loses the mouse lock, such as + * when the user presses the ESC key. + * + * @param[in] instance A PP_Instance identifying one instance + * of a module. + */ + void (*MouseLockLost)(PP_Instance instance); +}; + +typedef struct PPP_MouseLock_1_0 PPP_MouseLock; +/** + * @} + */ + +/* trusted/ppb_broker_trusted.idl */ +/** + * @addtogroup Interfaces + * @{ + */ +/** + * The PPB_BrokerTrusted interface provides access to a trusted broker + * with greater privileges than the plugin. The interface only supports + * out-of-process plugins and is to be used by proxy implementations. All + * functions should be called from the main thread only. + * + * A PPB_BrokerTrusted resource represents a connection to the broker. Its + * lifetime controls the lifetime of the broker, regardless of whether the + * handle is closed. The handle should be closed before the resource is + * released. + */ +struct PPB_BrokerTrusted_0_3 { + /** + * Returns a trusted broker resource. + */ + PP_Resource (*CreateTrusted)(PP_Instance instance); + /** + * Returns true if the resource is a trusted broker. + */ + PP_Bool (*IsBrokerTrusted)(PP_Resource resource); + /** + * Connects to the trusted broker. It may have already + * been launched by another instance. + * The plugin takes ownership of the handle once the callback has been called + * with a result of PP_OK. The plugin should immediately call GetHandle and + * begin managing it. If the result is not PP_OK, the browser still owns the + * handle. + * + * Returns PP_ERROR_WOULD_BLOCK on success, and invokes + * the |connect_callback| asynchronously to complete. + * As this function should always be invoked from the main thread, + * do not use the blocking variant of PP_CompletionCallback. + * Returns PP_ERROR_FAILED if called from an in-process plugin. + */ + int32_t (*Connect)(PP_Resource broker, + struct PP_CompletionCallback connect_callback); + /** + * Gets the handle to the pipe. Use once Connect has completed. Each instance + * of this interface has its own pipe. + * + * Returns PP_OK on success, and places the result into the given output + * parameter. The handle is only set when returning PP_OK. Calling this + * before connect has completed will return PP_ERROR_FAILED. + */ + int32_t (*GetHandle)(PP_Resource broker, int32_t* handle); + /** + * Returns PP_TRUE if the plugin has permission to launch the broker. A user + * must explicitly grant permission to launch the broker for a particular + * website. This is done through an infobar that is displayed when |Connect| + * is called. This function returns PP_TRUE if the user has already granted + * permission to launch the broker for the website containing this plugin + * instance. Returns PP_FALSE otherwise. + */ + PP_Bool (*IsAllowed)(PP_Resource broker); +}; + +typedef struct PPB_BrokerTrusted_0_3 PPB_BrokerTrusted; + +struct PPB_BrokerTrusted_0_2 { + PP_Resource (*CreateTrusted)(PP_Instance instance); + PP_Bool (*IsBrokerTrusted)(PP_Resource resource); + int32_t (*Connect)(PP_Resource broker, + struct PP_CompletionCallback connect_callback); + int32_t (*GetHandle)(PP_Resource broker, int32_t* handle); +}; +/** + * @} + */ + +/* trusted/ppb_browser_font_trusted.idl */ +/** + * @addtogroup Enums + * @{ + */ +typedef enum { + /** + * Uses the user's default web page font (normally either the default serif + * or sans serif font). + */ + PP_BROWSERFONT_TRUSTED_FAMILY_DEFAULT = 0, + /** + * These families will use the default web page font corresponding to the + * given family. + */ + PP_BROWSERFONT_TRUSTED_FAMILY_SERIF = 1, + PP_BROWSERFONT_TRUSTED_FAMILY_SANSSERIF = 2, + PP_BROWSERFONT_TRUSTED_FAMILY_MONOSPACE = 3 +} PP_BrowserFont_Trusted_Family; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_BrowserFont_Trusted_Family, 4); + +/** + * Specifies the font weight. Normally users will only use NORMAL or BOLD. + */ +typedef enum { + PP_BROWSERFONT_TRUSTED_WEIGHT_100 = 0, + PP_BROWSERFONT_TRUSTED_WEIGHT_200 = 1, + PP_BROWSERFONT_TRUSTED_WEIGHT_300 = 2, + PP_BROWSERFONT_TRUSTED_WEIGHT_400 = 3, + PP_BROWSERFONT_TRUSTED_WEIGHT_500 = 4, + PP_BROWSERFONT_TRUSTED_WEIGHT_600 = 5, + PP_BROWSERFONT_TRUSTED_WEIGHT_700 = 6, + PP_BROWSERFONT_TRUSTED_WEIGHT_800 = 7, + PP_BROWSERFONT_TRUSTED_WEIGHT_900 = 8, + PP_BROWSERFONT_TRUSTED_WEIGHT_NORMAL = PP_BROWSERFONT_TRUSTED_WEIGHT_400, + PP_BROWSERFONT_TRUSTED_WEIGHT_BOLD = PP_BROWSERFONT_TRUSTED_WEIGHT_700 +} PP_BrowserFont_Trusted_Weight; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_BrowserFont_Trusted_Weight, 4); +/** + * @} + */ + +/** + * @addtogroup Structs + * @{ + */ +struct PP_BrowserFont_Trusted_Description { + /** + * Font face name as a string. This can also be an undefined var, in which + * case the generic family will be obeyed. If the face is not available on + * the system, the browser will attempt to do font fallback or pick a default + * font. + */ + struct PP_Var face; + /** + * When Create()ing a font and the face is an undefined var, the family + * specifies the generic font family type to use. If the face is specified, + * this will be ignored. + * + * When Describe()ing a font, the family will be the value you passed in when + * the font was created. In other words, if you specify a face name, the + * family will not be updated to reflect whether the font name you requested + * is serif or sans serif. + */ + PP_BrowserFont_Trusted_Family family; + /** + * Size in pixels. + * + * You can specify 0 to get the default font size. The default font size + * may vary depending on the requested font. The typical example is that + * the user may have a different font size for the default monospace font to + * give it a similar optical size to the proportionally spaced fonts. + */ + uint32_t size; + /** + * Normally you will use either normal or bold. + */ + PP_BrowserFont_Trusted_Weight weight; + PP_Bool italic; + PP_Bool small_caps; + /** + * Adjustment to apply to letter and word spacing, respectively. Initialize + * to 0 to get normal spacing. Negative values bring letters/words closer + * together, positive values separate them. + */ + int32_t letter_spacing; + int32_t word_spacing; + /** + * Ensure that this struct is 48-bytes wide by padding the end. In some + * compilers, PP_Var is 8-byte aligned, so those compilers align this struct + * on 8-byte boundaries as well and pad it to 16 bytes even without this + * padding attribute. This padding makes its size consistent across + * compilers. + */ + int32_t padding; +}; +PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_BrowserFont_Trusted_Description, 48); + +struct PP_BrowserFont_Trusted_Metrics { + int32_t height; + int32_t ascent; + int32_t descent; + int32_t line_spacing; + int32_t x_height; +}; +PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_BrowserFont_Trusted_Metrics, 20); + +struct PP_BrowserFont_Trusted_TextRun { + /** + * This var must either be a string or a null/undefined var (which will be + * treated as a 0-length string). + */ + struct PP_Var text; + /** + * Set to PP_TRUE if the text is right-to-left. + */ + PP_Bool rtl; + /** + * Set to PP_TRUE to force the directionality of the text regardless of + * content + */ + PP_Bool override_direction; +}; +PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_BrowserFont_Trusted_TextRun, 24); +/** + * @} + */ + +/** + * @addtogroup Interfaces + * @{ + */ +/** + * Provides an interface for native browser text rendering. + * + * This API is "trusted" not for security reasons, but because it can not be + * implemented efficiently when running out-of-process in Browser Client. In + * this case, WebKit is in another process and every text call would require a + * synchronous IPC to the renderer. It is, however, available to native + * (non-NaCl) out-of-process PPAPI plugins since WebKit is available in the + * plugin process. + */ +struct PPB_BrowserFont_Trusted_1_0 { + /** + * Returns a list of all available font families on the system. You can use + * this list to decide whether to Create() a font. + * + * The return value will be a single string with null characters delimiting + * the end of each font name. For example: "Arial\0Courier\0Times\0". + * + * Returns an undefined var on failure (this typically means you passed an + * invalid instance). + */ + struct PP_Var (*GetFontFamilies)(PP_Instance instance); + /** + * Returns a font which best matches the given description. The return value + * will have a non-zero ID on success, or zero on failure. + */ + PP_Resource (*Create)( + PP_Instance instance, + const struct PP_BrowserFont_Trusted_Description* description); + /** + * Returns PP_TRUE if the given resource is a Font. Returns PP_FALSE if the + * resource is invalid or some type other than a Font. + */ + PP_Bool (*IsFont)(PP_Resource resource); + /** + * Loads the description and metrics of the font into the given structures. + * The description will be different than the description the font was + * created with since it will be filled with the real values from the font + * that was actually selected. + * + * The PP_Var in the description should be of type Void on input. On output, + * this will contain the string and will have a reference count of 1. The + * plugin is responsible for calling Release on this var. + * + * Returns PP_TRUE on success, PP_FALSE if the font is invalid or if the Var + * in the description isn't Null (to prevent leaks). + */ + PP_Bool (*Describe)(PP_Resource font, + struct PP_BrowserFont_Trusted_Description* description, + struct PP_BrowserFont_Trusted_Metrics* metrics); + /** + * Draws the text to the image buffer. + * + * The given point represents the baseline of the left edge of the font, + * regardless of whether it is left-to-right or right-to-left (in the case of + * RTL text, this will actually represent the logical end of the text). + * + * The clip is optional and may be NULL. In this case, the text will be + * clipped to the image. + * + * The image_data_is_opaque flag indicates whether subpixel antialiasing can + * be performed, if it is supported. When the image below the text is + * opaque, subpixel antialiasing is supported and you should set this to + * PP_TRUE to pick up the user's default preferences. If your plugin is + * partially transparent, then subpixel antialiasing is not possible and + * grayscale antialiasing will be used instead (assuming the user has + * antialiasing enabled at all). + */ + PP_Bool (*DrawTextAt)(PP_Resource font, + PP_Resource image_data, + const struct PP_BrowserFont_Trusted_TextRun* text, + const struct PP_Point* position, + uint32_t color, + const struct PP_Rect* clip, + PP_Bool image_data_is_opaque); + /** + * Returns the width of the given string. If the font is invalid or the var + * isn't a valid string, this will return -1. + * + * Note that this function handles complex scripts such as Arabic, combining + * accents, etc. so that adding the width of substrings won't necessarily + * produce the correct width of the entire string. + * + * Returns -1 on failure. + */ + int32_t (*MeasureText)(PP_Resource font, + const struct PP_BrowserFont_Trusted_TextRun* text); + /** + * Returns the character at the given pixel X position from the beginning of + * the string. This handles complex scripts such as Arabic, where characters + * may be combined or replaced depending on the context. Returns (uint32)-1 + * on failure. + * + * TODO(brettw) this function may be broken. See the CharPosRTL test. It + * seems to tell you "insertion point" rather than painting position. This + * is useful but maybe not what we intended here. + */ + uint32_t (*CharacterOffsetForPixel)( + PP_Resource font, + const struct PP_BrowserFont_Trusted_TextRun* text, + int32_t pixel_position); + /** + * Returns the horizontal advance to the given character if the string was + * placed at the given position. This handles complex scripts such as Arabic, + * where characters may be combined or replaced depending on context. Returns + * -1 on error. + */ + int32_t (*PixelOffsetForCharacter)( + PP_Resource font, + const struct PP_BrowserFont_Trusted_TextRun* text, + uint32_t char_offset); +}; + +typedef struct PPB_BrowserFont_Trusted_1_0 PPB_BrowserFont_Trusted; +/** + * @} + */ + +/* trusted/ppb_char_set_trusted.idl */ +/** + * @addtogroup Enums + * @{ + */ +typedef enum { + /** + * Causes the entire conversion to fail if an error is encountered. The + * conversion function will return NULL. + */ + PP_CHARSET_TRUSTED_CONVERSIONERROR_FAIL, + /** + * Silently skips over errors. Unrepresentable characters and input encoding + * errors will be removed from the output. + */ + PP_CHARSET_TRUSTED_CONVERSIONERROR_SKIP, + /** + * Replaces the error or unrepresentable character with a substitution + * character. When converting to a Unicode character set (UTF-8 or UTF-16) it + * will use the unicode "substitution character" U+FFFD. When converting to + * another character set, the character will be charset-specific. For many + * languages this will be the representation of the '?' character. + */ + PP_CHARSET_TRUSTED_CONVERSIONERROR_SUBSTITUTE +} PP_CharSet_Trusted_ConversionError; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_CharSet_Trusted_ConversionError, 4); +/** + * @} + */ + +/** + * @addtogroup Interfaces + * @{ + */ +/** + * The PPB_CharSet_Trusted interface provides functions for + * converting between character sets. + * + * This inteface is provided for trusted plugins only since in Native Client it + * would require an expensive out-of-process IPC call for each conversion, + * which makes performance unacceptable. Native Client plugins should include + * ICU or some other library if they need this feature. + */ +struct PPB_CharSet_Trusted_1_0 { + /** + * Converts the UTF-16 string pointed to by |*utf16| to an 8-bit string in + * the specified code page. |utf16_len| is measured in UTF-16 units, not + * bytes. This value may not be NULL. + * + * The given output buffer will be filled up to output_length bytes with the + * result. output_length will be updated with the number of bytes required + * for the given string. The output buffer may be null to just retrieve the + * required buffer length. + * + * This function will return PP_FALSE if there was an error converting the + * string and you requested PP_CHARSET_CONVERSIONERROR_FAIL, or the output + * character set was unknown. Otherwise, it will return PP_TRUE. + */ + PP_Bool (*UTF16ToCharSet)(const uint16_t utf16[], + uint32_t utf16_len, + const char* output_char_set, + PP_CharSet_Trusted_ConversionError on_error, + char* output_buffer, + uint32_t* output_length); + /** + * Same as UTF16ToCharSet except converts in the other direction. The input + * is in the given charset, and the |input_len| is the number of bytes in + * the |input| string. + * + * Note that the output_utf16_length is measured in UTF-16 characters. + * + * Since UTF16 can represent every Unicode character, the only time the + * replacement character will be used is if the encoding in the input string + * is incorrect. + */ + PP_Bool (*CharSetToUTF16)(const char* input, + uint32_t input_len, + const char* input_char_set, + PP_CharSet_Trusted_ConversionError on_error, + uint16_t* output_buffer, + uint32_t* output_utf16_length); + /** + * Returns a string var representing the current multi-byte character set of + * the current system. + * + * WARNING: You really shouldn't be using this function unless you're dealing + * with legacy data. You should be using UTF-8 or UTF-16 and you don't have + * to worry about the character sets. + */ + struct PP_Var (*GetDefaultCharSet)(PP_Instance instance); +}; + +typedef struct PPB_CharSet_Trusted_1_0 PPB_CharSet_Trusted; +/** + * @} + */ + +/* trusted/ppb_file_chooser_trusted.idl */ +/** + * @addtogroup Interfaces + * @{ + */ +struct PPB_FileChooserTrusted_0_6 { + /** + * This function displays a previously created file chooser resource as a + * dialog box, prompting the user to choose a file or files to open, or a + * single file for saving. The callback is called with PP_OK on successful + * completion with a file (or files) selected or PP_ERROR_USERCANCEL if the + * user selected no file. + * + * @param[in] chooser The file chooser resource. + * @param[in] save_as A PP_Bool value indicating if this dialog + * is choosing a file for saving. + * @param[in] suggested_file_name If saving, the suggested name for the + * file, otherwise, null or undefined. + * @param[in] callback A CompletionCallback to be called after + * the user has closed the file chooser dialog. + * + * @return PP_OK_COMPLETIONPENDING if request to show the dialog was + * successful, another error code from pp_errors.h on failure. + */ + int32_t (*ShowWithoutUserGesture)(PP_Resource chooser, + PP_Bool save_as, + struct PP_Var suggested_file_name, + struct PP_ArrayOutput output, + struct PP_CompletionCallback callback); +}; + +typedef struct PPB_FileChooserTrusted_0_6 PPB_FileChooserTrusted; + +struct PPB_FileChooserTrusted_0_5 { + int32_t (*ShowWithoutUserGesture)(PP_Resource chooser, + PP_Bool save_as, + struct PP_Var suggested_file_name, + struct PP_CompletionCallback callback); +}; +/** + * @} + */ + +/* trusted/ppb_url_loader_trusted.idl */ +/** + * @addtogroup Typedefs + * @{ + */ +/** + * Callback that indicates the status of the download and upload for the + * given URLLoader resource. + */ +typedef void (*PP_URLLoaderTrusted_StatusCallback)( + PP_Instance pp_instance, + PP_Resource pp_resource, + int64_t bytes_sent, + int64_t total_bytes_to_be_sent, + int64_t bytes_received, + int64_t total_bytes_to_be_received); +/** + * @} + */ + +/** + * @addtogroup Interfaces + * @{ + */ +/* Available only to trusted implementations. */ +struct PPB_URLLoaderTrusted_0_3 { + /** + * Grant this URLLoader the capability to make unrestricted cross-origin + * requests. + */ + void (*GrantUniversalAccess)(PP_Resource loader); + /** + * Registers that the given function will be called when the upload or + * downloaded byte count has changed. This is not exposed on the untrusted + * interface because it can be quite chatty and encourages people to write + * feedback UIs that update as frequently as the progress updates. + * + * The other serious gotcha with this callback is that the callback must not + * mutate the URL loader or cause it to be destroyed. + * + * However, the proxy layer needs this information to push to the other + * process, so we expose it here. Only one callback can be set per URL + * Loader. Setting to a NULL callback will disable it. + */ + void (*RegisterStatusCallback)(PP_Resource loader, + PP_URLLoaderTrusted_StatusCallback cb); +}; + +typedef struct PPB_URLLoaderTrusted_0_3 PPB_URLLoaderTrusted; +/** + * @} + */ + +/* trusted/ppp_broker.idl */ +// {PENDING: undefine PP_EXPORT?} + +#include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_stdint.h" + + +#if __GNUC__ >= 4 + +#define PP_EXPORT __attribute__ ((visibility("default"))) +#elif defined(_MSC_VER) +#define PP_EXPORT __declspec(dllexport) +#endif + + + +/* We don't want name mangling for these external functions. We only need + * 'extern "C"' if we're compiling with a C++ compiler. + */ +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @addtogroup Typedefs + * @{ + */ + +/** + * PP_ConnectInstance_Func defines the signature that you implement to + * receive notifications when a plugin instance connects to the broker. + * The broker should listen on the socket before returning. + * + * @param[in] instance The plugin instance connecting to the broker. + * @param[in] handle Handle to a socket the broker can use to communicate with + * the plugin. + * @return PP_OK on success. Any other value on failure. + */ +typedef int32_t (*PP_ConnectInstance_Func)(PP_Instance instance, + int32_t handle); +/** + * @} + */ + +/** + * @addtogroup Functions + * @{ + */ + +/** + * PPP_InitializeBroker() is the entry point for a broker and is + * called by the browser when your module loads. Your code must implement this + * function. + * + * Failure indicates to the browser that this broker can not be used. In this + * case, the broker will be unloaded. + * + * @param[out] connect_instance_func A pointer to a connect instance function. + * @return PP_OK on success. Any other value on failure. +*/ +PP_EXPORT int32_t PPP_InitializeBroker( + PP_ConnectInstance_Func* connect_instance_func); +/** + * @} + */ + +/** + * @addtogroup Functions + * @{ + */ + +/** PPP_ShutdownBroker() is called before the broker is unloaded. + */ +PP_EXPORT void PPP_ShutdownBroker(); +/** + * @} + */ + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +/* dev/pp_cursor_type_dev.idl */ +/** + * @addtogroup Enums + * @{ + */ +enum PP_CursorType_Dev { + PP_CURSORTYPE_CUSTOM = -1, + PP_CURSORTYPE_POINTER = 0, + PP_CURSORTYPE_CROSS = 1, + PP_CURSORTYPE_HAND = 2, + PP_CURSORTYPE_IBEAM = 3, + PP_CURSORTYPE_WAIT = 4, + PP_CURSORTYPE_HELP = 5, + PP_CURSORTYPE_EASTRESIZE = 6, + PP_CURSORTYPE_NORTHRESIZE = 7, + PP_CURSORTYPE_NORTHEASTRESIZE = 8, + PP_CURSORTYPE_NORTHWESTRESIZE = 9, + PP_CURSORTYPE_SOUTHRESIZE = 10, + PP_CURSORTYPE_SOUTHEASTRESIZE = 11, + PP_CURSORTYPE_SOUTHWESTRESIZE = 12, + PP_CURSORTYPE_WESTRESIZE = 13, + PP_CURSORTYPE_NORTHSOUTHRESIZE = 14, + PP_CURSORTYPE_EASTWESTRESIZE = 15, + PP_CURSORTYPE_NORTHEASTSOUTHWESTRESIZE = 16, + PP_CURSORTYPE_NORTHWESTSOUTHEASTRESIZE = 17, + PP_CURSORTYPE_COLUMNRESIZE = 18, + PP_CURSORTYPE_ROWRESIZE = 19, + PP_CURSORTYPE_MIDDLEPANNING = 20, + PP_CURSORTYPE_EASTPANNING = 21, + PP_CURSORTYPE_NORTHPANNING = 22, + PP_CURSORTYPE_NORTHEASTPANNING = 23, + PP_CURSORTYPE_NORTHWESTPANNING = 24, + PP_CURSORTYPE_SOUTHPANNING = 25, + PP_CURSORTYPE_SOUTHEASTPANNING = 26, + PP_CURSORTYPE_SOUTHWESTPANNING = 27, + PP_CURSORTYPE_WESTPANNING = 28, + PP_CURSORTYPE_MOVE = 29, + PP_CURSORTYPE_VERTICALTEXT = 30, + PP_CURSORTYPE_CELL = 31, + PP_CURSORTYPE_CONTEXTMENU = 32, + PP_CURSORTYPE_ALIAS = 33, + PP_CURSORTYPE_PROGRESS = 34, + PP_CURSORTYPE_NODROP = 35, + PP_CURSORTYPE_COPY = 36, + PP_CURSORTYPE_NONE = 37, + PP_CURSORTYPE_NOTALLOWED = 38, + PP_CURSORTYPE_ZOOMIN = 39, + PP_CURSORTYPE_ZOOMOUT = 40, + PP_CURSORTYPE_GRAB = 41, + PP_CURSORTYPE_GRABBING = 42 +}; +PP_COMPILE_ASSERT_ENUM_SIZE_IN_BYTES(PP_CursorType_Dev, 4); +/** + * @} + */ + +/* dev/pp_print_settings_dev.idl */ +/** + * @addtogroup Enums + * @{ + */ +typedef enum { + PP_PRINTORIENTATION_NORMAL = 0, + PP_PRINTORIENTATION_ROTATED_90_CW = 1, + PP_PRINTORIENTATION_ROTATED_180 = 2, + PP_PRINTORIENTATION_ROTATED_90_CCW = 3 +} PP_PrintOrientation_Dev; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_PrintOrientation_Dev, 4); + +typedef enum { + PP_PRINTOUTPUTFORMAT_RASTER = 1u << 0, + PP_PRINTOUTPUTFORMAT_PDF = 1u << 1, + PP_PRINTOUTPUTFORMAT_POSTSCRIPT = 1u << 2, + PP_PRINTOUTPUTFORMAT_EMF = 1u << 3 +} PP_PrintOutputFormat_Dev; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_PrintOutputFormat_Dev, 4); + +typedef enum { + PP_PRINTSCALINGOPTION_NONE = 0, + PP_PRINTSCALINGOPTION_FIT_TO_PRINTABLE_AREA = 1, + PP_PRINTSCALINGOPTION_SOURCE_SIZE = 2 +} PP_PrintScalingOption_Dev; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_PrintScalingOption_Dev, 4); +/** + * @} + */ + +/** + * @addtogroup Structs + * @{ + */ +struct PP_PrintSettings_Dev { + /** This is the size of the printable area in points (1/72 of an inch). */ + struct PP_Rect printable_area; + struct PP_Rect content_area; + struct PP_Size paper_size; + int32_t dpi; + PP_PrintOrientation_Dev orientation; + PP_PrintScalingOption_Dev print_scaling_option; + PP_Bool grayscale; + /** Note that Chrome currently only supports PDF printing. */ + PP_PrintOutputFormat_Dev format; +}; +PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_PrintSettings_Dev, 60); +/** + * @} + */ + +/* dev/pp_video_capture_dev.idl */ +/** + * @addtogroup Structs + * @{ + */ +/** + * PP_VideoCaptureDeviceInfo_Dev is a structure that represent a video capture + * configuration, such as resolution and frame rate. + */ +struct PP_VideoCaptureDeviceInfo_Dev { + uint32_t width; + uint32_t height; + uint32_t frames_per_second; +}; +PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_VideoCaptureDeviceInfo_Dev, 12); +/** + * @} + */ + +/** + * @addtogroup Enums + * @{ + */ +/** + * PP_VideoCaptureStatus_Dev is an enumeration that defines the various possible + * states of a VideoCapture. + */ +typedef enum { + /** + * Initial state, capture is stopped. + */ + PP_VIDEO_CAPTURE_STATUS_STOPPED = 0, + /** + * StartCapture has been called, but capture hasn't started yet. + */ + PP_VIDEO_CAPTURE_STATUS_STARTING = 1, + /** + * Capture has been started. + */ + PP_VIDEO_CAPTURE_STATUS_STARTED = 2, + /** + * Capture has been started, but is paused because no buffer is available. + */ + PP_VIDEO_CAPTURE_STATUS_PAUSED = 3, + /** + * StopCapture has been called, but capture hasn't stopped yet. + */ + PP_VIDEO_CAPTURE_STATUS_STOPPING = 4 +} PP_VideoCaptureStatus_Dev; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_VideoCaptureStatus_Dev, 4); +/** + * @} + */ + +/* dev/pp_video_dev.idl */ +/** + * @addtogroup Enums + * @{ + */ +/** + * Video format. + * + * Keep the values in this enum unique, as they imply format (h.264 vs. VP8, + * for example), and keep the values for a particular format grouped together + * for clarity. + * Note: Keep these in sync with media::VideoCodecProfile. + */ +typedef enum { + PP_VIDEODECODER_PROFILE_UNKNOWN = -1, + PP_VIDEODECODER_H264PROFILE_NONE = 0, + PP_VIDEODECODER_H264PROFILE_BASELINE = 1, + PP_VIDEODECODER_H264PROFILE_MAIN = 2, + PP_VIDEODECODER_H264PROFILE_EXTENDED = 3, + PP_VIDEODECODER_H264PROFILE_HIGH = 4, + PP_VIDEODECODER_H264PROFILE_HIGH10PROFILE = 5, + PP_VIDEODECODER_H264PROFILE_HIGH422PROFILE = 6, + PP_VIDEODECODER_H264PROFILE_HIGH444PREDICTIVEPROFILE = 7, + PP_VIDEODECODER_H264PROFILE_SCALABLEBASELINE = 8, + PP_VIDEODECODER_H264PROFILE_SCALABLEHIGH = 9, + PP_VIDEODECODER_H264PROFILE_STEREOHIGH = 10, + PP_VIDEODECODER_H264PROFILE_MULTIVIEWHIGH = 11, + PP_VIDEODECODER_VP8PROFILE_ANY = 12 +} PP_VideoDecoder_Profile; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_VideoDecoder_Profile, 4); +/** + * @} + */ + +/** + * @addtogroup Structs + * @{ + */ +/** + * The data structure for video bitstream buffer. + */ +struct PP_VideoBitstreamBuffer_Dev { + /** + * Client-specified identifier for the bitstream buffer. Valid values are + * non-negative. + */ + int32_t id; + /** + * Buffer to hold the bitstream data. Should be allocated using the + * PPB_Buffer interface for consistent interprocess behaviour. + */ + PP_Resource data; + /** + * Size of the bitstream contained in buffer (in bytes). + */ + uint32_t size; +}; +PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_VideoBitstreamBuffer_Dev, 12); + +/** + * Struct for specifying texture-backed picture data. + */ +struct PP_PictureBuffer_Dev { + /** + * Client-specified id for the picture buffer. By using this value client can + * keep track of the buffers it has assigned to the video decoder and how they + * are passed back to it. Valid values are non-negative. + */ + int32_t id; + /** + * Dimensions of the buffer. + */ + struct PP_Size size; + /** + * Texture ID in the given context where picture is stored. + */ + uint32_t texture_id; +}; +PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_PictureBuffer_Dev, 16); + +/** + * Structure to describe a decoded output frame. + */ +struct PP_Picture_Dev { + /** + * ID of the picture buffer where the picture is stored. + */ + int32_t picture_buffer_id; + /** + * ID of the bitstream from which this data was decoded. + */ + int32_t bitstream_buffer_id; +}; +PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_Picture_Dev, 8); +/** + * @} + */ + +/** + * @addtogroup Enums + * @{ + */ +/** + * Decoder error codes reported to the plugin. A reasonable naive + * error handling policy is for the plugin to Destroy() the decoder on error. + */ +typedef enum { + /** + * An operation was attempted during an incompatible decoder state. + */ + PP_VIDEODECODERERROR_ILLEGAL_STATE = 1, + /** + * Invalid argument was passed to an API method. + */ + PP_VIDEODECODERERROR_INVALID_ARGUMENT = 2, + /** + * Encoded input is unreadable. + */ + PP_VIDEODECODERERROR_UNREADABLE_INPUT = 3, + /** + * A failure occurred at the browser layer or lower. Examples of such + * failures include GPU hardware failures, GPU driver failures, GPU library + * failures, browser programming errors, and so on. + */ + PP_VIDEODECODERERROR_PLATFORM_FAILURE = 4 +} PP_VideoDecodeError_Dev; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_VideoDecodeError_Dev, 4); +/** + * @} + */ + +/* dev/ppb_device_ref_dev.idl */ +/** + * @addtogroup Typedefs + * @{ + */ +/** + * Defines the callback type to receive device change notifications for + * PPB_AudioInput_Dev.MonitorDeviceChange() and + * PPB_VideoCapture_Dev.MonitorDeviceChange(). + * + * @param[inout] user_data The opaque pointer that the caller passed into + * MonitorDeviceChange(). + * @param[in] device_count How many devices in the array. + * @param[in] devices An array of PPB_DeviceRef_Dev. Please note + * that the ref count of the elements is not increased on behalf of the plugin. + */ +typedef void (*PP_MonitorDeviceChangeCallback)(void* user_data, + uint32_t device_count, + const PP_Resource devices[]); +/** + * @} + */ + +/** + * @addtogroup Enums + * @{ + */ +/** + * Device types. + */ +typedef enum { + PP_DEVICETYPE_DEV_INVALID = 0, + PP_DEVICETYPE_DEV_AUDIOCAPTURE = 1, + PP_DEVICETYPE_DEV_VIDEOCAPTURE = 2 +} PP_DeviceType_Dev; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_DeviceType_Dev, 4); +/** + * @} + */ + +/** + * @addtogroup Interfaces + * @{ + */ +struct PPB_DeviceRef_Dev_0_1 { + /** + * Determines if the provided resource is a device reference. + * + * @param[in] resource A PP_Resource corresponding to a generic + * resource. + * + * @return A PP_Bool that is PP_TRUE if the given + * resource is a device reference, otherwise PP_FALSE. + */ + PP_Bool (*IsDeviceRef)(PP_Resource resource); + /** + * Gets the device type. + * + * @param[in] device_ref A PP_Resource corresponding to a device + * reference. + * + * @return A PP_DeviceType_Dev value. + */ + PP_DeviceType_Dev (*GetType)(PP_Resource device_ref); + /** + * Gets the device name. + * + * @param[in] device_ref A PP_Resource corresponding to a device + * reference. + * + * @return A PP_Var of type PP_VARTYPE_STRING + * containing the name of the device if successful; a PP_Var of + * type PP_VARTYPE_UNDEFINED if failed. + */ + struct PP_Var (*GetName)(PP_Resource device_ref); +}; + +typedef struct PPB_DeviceRef_Dev_0_1 PPB_DeviceRef_Dev; +/** + * @} + */ + +/* dev/ppb_audio_input_dev.idl */ +/** + * @addtogroup Typedefs + * @{ + */ +/** + * PPB_AudioInput_Callback defines the type of an audio callback + * function used to provide the audio buffer with data. This callback will be + * called on a separate thread from the creation thread. + * + * @param[in] sample_buffer A buffer providing audio input data. + * @param[in] buffer_size_in_bytes The size of the buffer in bytes. + * @param[in] latency The time that has elapsed since the data was recorded. + * @param[inout] user_data An opaque pointer that was passed into + * PPB_AudioInput_Dev.Open(). + */ +typedef void (*PPB_AudioInput_Callback)(const void* sample_buffer, + uint32_t buffer_size_in_bytes, + PP_TimeDelta latency, + void* user_data); + +typedef void (*PPB_AudioInput_Callback_0_3)(const void* sample_buffer, + uint32_t buffer_size_in_bytes, + void* user_data); +/** + * @} + */ + +/** + * @addtogroup Interfaces + * @{ + */ +/** + * The PPB_AudioInput_Dev interface contains pointers to several + * functions for handling audio input resources. + * + * TODO(brettw) before moving out of dev, we need to resolve the issue of + * the mismatch between the current audio config interface and this one. + * + * In particular, the params for input assume stereo, but this class takes + * everything as mono. We either need to not use an audio config resource, or + * add mono support. + * + * In addition, RecommendSampleFrameCount is completely wrong for audio input. + * RecommendSampleFrameCount returns the frame count for the current + * low-latency output device, which is likely inappropriate for a random input + * device. We may want to move the "recommend" functions to the input or output + * classes rather than the config. + */ +struct PPB_AudioInput_Dev_0_4 { + /** + * Creates an audio input resource. + * + * @param[in] instance A PP_Instance identifying one instance of + * a module. + * + * @return A PP_Resource corresponding to an audio input resource + * if successful, 0 if failed. + */ + PP_Resource (*Create)(PP_Instance instance); + /** + * Determines if the given resource is an audio input resource. + * + * @param[in] resource A PP_Resource containing a resource. + * + * @return A PP_Bool containing PP_TRUE if the given + * resource is an audio input resource, otherwise PP_FALSE. + */ + PP_Bool (*IsAudioInput)(PP_Resource resource); + /** + * Enumerates audio input devices. + * + * @param[in] audio_input A PP_Resource corresponding to an audio + * input resource. + * @param[in] output An output array which will receive + * PPB_DeviceRef_Dev resources on success. Please note that the + * ref count of those resources has already been increased by 1 for the + * caller. + * @param[in] callback A PP_CompletionCallback to run on + * completion. + * + * @return An error code from pp_errors.h. + */ + int32_t (*EnumerateDevices)(PP_Resource audio_input, + struct PP_ArrayOutput output, + struct PP_CompletionCallback callback); + /** + * Requests device change notifications. + * + * @param[in] audio_input A PP_Resource corresponding to an audio + * input resource. + * @param[in] callback The callback to receive notifications. If not NULL, it + * will be called once for the currently available devices, and then every + * time the list of available devices changes. All calls will happen on the + * same thread as the one on which MonitorDeviceChange() is called. It will + * receive notifications until audio_input is destroyed or + * MonitorDeviceChange() is called to set a new callback for + * audio_input. You can pass NULL to cancel sending + * notifications. + * @param[inout] user_data An opaque pointer that will be passed to + * callback. + * + * @return An error code from pp_errors.h. + */ + int32_t (*MonitorDeviceChange)(PP_Resource audio_input, + PP_MonitorDeviceChangeCallback callback, + void* user_data); + /** + * Opens an audio input device. No sound will be captured until + * StartCapture() is called. + * + * @param[in] audio_input A PP_Resource corresponding to an audio + * input resource. + * @param[in] device_ref Identifies an audio input device. It could be one of + * the resource in the array returned by EnumerateDevices(), or 0 which means + * the default device. + * @param[in] config A PPB_AudioConfig audio configuration + * resource. + * @param[in] audio_input_callback A PPB_AudioInput_Callback + * function that will be called when data is available. + * @param[inout] user_data An opaque pointer that will be passed into + * audio_input_callback. + * @param[in] callback A PP_CompletionCallback to run when this + * open operation is completed. + * + * @return An error code from pp_errors.h. + */ + int32_t (*Open)(PP_Resource audio_input, + PP_Resource device_ref, + PP_Resource config, + PPB_AudioInput_Callback audio_input_callback, + void* user_data, + struct PP_CompletionCallback callback); + /** + * Returns an audio config resource for the given audio input resource. + * + * @param[in] audio_input A PP_Resource corresponding to an audio + * input resource. + * + * @return A PP_Resource containing the audio config resource if + * successful. + */ + PP_Resource (*GetCurrentConfig)(PP_Resource audio_input); + /** + * Starts the capture of the audio input resource and begins periodically + * calling the callback. + * + * @param[in] audio_input A PP_Resource corresponding to an audio + * input resource. + * + * @return A PP_Bool containing PP_TRUE if + * successful, otherwise PP_FALSE. + * Also returns PP_TRUE (and is a no-op) if called while capture + * is already started. + */ + PP_Bool (*StartCapture)(PP_Resource audio_input); + /** + * Stops the capture of the audio input resource. + * + * @param[in] audio_input A PP_Resource containing the audio input resource. + * + * @return A PP_Bool containing PP_TRUE if + * successful, otherwise PP_FALSE. + * Also returns PP_TRUE (and is a no-op) if called while capture + * is already stopped. If a buffer is being captured, StopCapture will block + * until the call completes. + */ + PP_Bool (*StopCapture)(PP_Resource audio_input); + /** + * Closes the audio input device, and stops capturing if necessary. It is + * not valid to call Open() again after a call to this method. + * If an audio input resource is destroyed while a device is still open, then + * it will be implicitly closed, so you are not required to call this method. + * + * @param[in] audio_input A PP_Resource corresponding to an audio + * input resource. + */ + void (*Close)(PP_Resource audio_input); +}; + +typedef struct PPB_AudioInput_Dev_0_4 PPB_AudioInput_Dev; + +struct PPB_AudioInput_Dev_0_3 { + PP_Resource (*Create)(PP_Instance instance); + PP_Bool (*IsAudioInput)(PP_Resource resource); + int32_t (*EnumerateDevices)(PP_Resource audio_input, + struct PP_ArrayOutput output, + struct PP_CompletionCallback callback); + int32_t (*MonitorDeviceChange)(PP_Resource audio_input, + PP_MonitorDeviceChangeCallback callback, + void* user_data); + int32_t (*Open)(PP_Resource audio_input, + PP_Resource device_ref, + PP_Resource config, + PPB_AudioInput_Callback_0_3 audio_input_callback, + void* user_data, + struct PP_CompletionCallback callback); + PP_Resource (*GetCurrentConfig)(PP_Resource audio_input); + PP_Bool (*StartCapture)(PP_Resource audio_input); + PP_Bool (*StopCapture)(PP_Resource audio_input); + void (*Close)(PP_Resource audio_input); +}; +/** + * @} + */ + +/* dev/ppb_buffer_dev.idl */ +/** + * @addtogroup Interfaces + * @{ + */ +struct PPB_Buffer_Dev_0_4 { + /** + * Allocates a buffer of the given size in bytes. The return value will have + * a non-zero ID on success, or zero on failure. Failure means the module + * handle was invalid. The buffer will be initialized to contain zeroes. + */ + PP_Resource (*Create)(PP_Instance instance, uint32_t size_in_bytes); + /** + * Returns PP_TRUE if the given resource is a Buffer. Returns PP_FALSE if the + * resource is invalid or some type other than a Buffer. + */ + PP_Bool (*IsBuffer)(PP_Resource resource); + /** + * Gets the size of the buffer. Returns PP_TRUE on success, PP_FALSE + * if the resource is not a buffer. On failure, |*size_in_bytes| is not set. + */ + PP_Bool (*Describe)(PP_Resource resource, uint32_t* size_in_bytes); + /** + * Maps this buffer into the plugin address space and returns a pointer to + * the beginning of the data. + */ + void* (*Map)(PP_Resource resource); + /** + * Unmaps this buffer. + */ + void (*Unmap)(PP_Resource resource); +}; + +typedef struct PPB_Buffer_Dev_0_4 PPB_Buffer_Dev; +/** + * @} + */ + +/* dev/ppb_char_set_dev.idl */ +/** + * @addtogroup Enums + * @{ + */ +typedef enum { + /** + * Causes the entire conversion to fail if an error is encountered. The + * conversion function will return NULL. + */ + PP_CHARSET_CONVERSIONERROR_FAIL, + /** + * Silently skips over errors. Unrepresentable characters and input encoding + * errors will be removed from the output. + */ + PP_CHARSET_CONVERSIONERROR_SKIP, + /** + * Replaces the error or unrepresentable character with a substitution + * character. When converting to a Unicode character set (UTF-8 or UTF-16) it + * will use the unicode "substitution character" U+FFFD. When converting to + * another character set, the character will be charset-specific. For many + * languages this will be the representation of the '?' character. + */ + PP_CHARSET_CONVERSIONERROR_SUBSTITUTE +} PP_CharSet_ConversionError; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_CharSet_ConversionError, 4); +/** + * @} + */ + + +typedef uint16_t* uint16_ptr_t; + + +/** + * @addtogroup Interfaces + * @{ + */ +/** + * The PPB_CharSet_Trusted interface provides functions for + * converting between character sets. + * + * This inteface is provided for trusted plugins only since in Native Client it + * would require an expensive out-of-process IPC call for each conversion, + * which makes performance unacceptable. Native Client plugins should include + * ICU or some other library if they need this feature. + */ +struct PPB_CharSet_Dev_0_4 { + /** + * Converts the UTF-16 string pointed to by |*utf16| to an 8-bit string in + * the specified code page. |utf16_len| is measured in UTF-16 units, not + * bytes. This value may not be NULL. + * + * The given output buffer will be filled up to output_length bytes with the + * result. output_length will be updated with the number of bytes required + * for the given string. The output buffer may be null to just retrieve the + * required buffer length. + * + * This function will return PP_FALSE if there was an error converting the + * string and you requested PP_CHARSET_CONVERSIONERROR_FAIL, or the output + * character set was unknown. Otherwise, it will return PP_TRUE. + */ + const char* (*UTF16ToCharSet)(PP_Instance instance, + const uint16_t utf16[], + uint32_t utf16_len, + const char* output_char_set, + PP_CharSet_ConversionError on_error, + uint32_t* output_length); + /** + * Same as UTF16ToCharSet except converts in the other direction. The input + * is in the given charset, and the |input_len| is the number of bytes in + * the |input| string. + * + * Note that the output_utf16_length is measured in UTF-16 characters. + * + * Since UTF16 can represent every Unicode character, the only time the + * replacement character will be used is if the encoding in the input string + * is incorrect. + */ + uint16_ptr_t (*CharSetToUTF16)(PP_Instance instance, + const char* input, + uint32_t input_len, + const char* input_char_set, + PP_CharSet_ConversionError on_error, + uint32_t* output_utf16_length); + /** + * Returns a string var representing the current multi-byte character set of + * the current system. + * + * WARNING: You really shouldn't be using this function unless you're dealing + * with legacy data. You should be using UTF-8 or UTF-16 and you don't have + * to worry about the character sets. + */ + struct PP_Var (*GetDefaultCharSet)(PP_Instance instance); +}; + +typedef struct PPB_CharSet_Dev_0_4 PPB_CharSet_Dev; +/** + * @} + */ + +/* dev/ppb_crypto_dev.idl */ +/** + * @addtogroup Interfaces + * @{ + */ +struct PPB_Crypto_Dev_0_1 { + /** + * Fills the given buffer with random bytes. This is potentially slow so only + * request the amount of data you need. + */ + void (*GetRandomBytes)(char* buffer, uint32_t num_bytes); +}; + +typedef struct PPB_Crypto_Dev_0_1 PPB_Crypto_Dev; +/** + * @} + */ + +/* dev/ppb_cursor_control_dev.idl */ +/** + * @addtogroup Interfaces + * @{ + */ +struct PPB_CursorControl_Dev_0_4 { + /** + * Set a cursor. If "type" is PP_CURSORTYPE_CUSTOM, then "custom_image" + * must be an ImageData resource containing the cursor and "hot_spot" must + * contain the offset within that image that refers to the cursor's position. + */ + PP_Bool (*SetCursor)(PP_Instance instance, + enum PP_CursorType_Dev type, + PP_Resource custom_image, + const struct PP_Point* hot_spot); + /** + * This method causes the cursor to be moved to the center of the + * instance and be locked, preventing the user from moving it. + * The cursor is implicitly hidden from the user while locked. + * Cursor lock may only be requested in response to a + * PP_InputEvent_MouseDown, and then only if the event was generated via + * user gesture. + * + * While the cursor is locked, any movement of the mouse will + * generate a PP_InputEvent_Type_MouseMove, whose x and y values + * indicate the position the cursor would have been moved to had + * the cursor not been locked, and had the screen been infinite in size. + * + * The browser may revoke cursor lock for reasons including but not + * limited to the user pressing the ESC key, the user activating + * another program via a reserved keystroke (e.g., ALT+TAB), or + * some other system event. + * + * Returns PP_TRUE if the cursor could be locked, PP_FALSE otherwise. + */ + PP_Bool (*LockCursor)(PP_Instance instance); + /** + * Causes the cursor to be unlocked, allowing it to track user + * movement again. + */ + PP_Bool (*UnlockCursor)(PP_Instance instance); + /** + * Returns PP_TRUE if the cursor is locked, PP_FALSE otherwise. + */ + PP_Bool (*HasCursorLock)(PP_Instance instance); + /** + * Returns PP_TRUE if the cursor can be locked, PP_FALSE otherwise. + */ + PP_Bool (*CanLockCursor)(PP_Instance instance); +}; + +typedef struct PPB_CursorControl_Dev_0_4 PPB_CursorControl_Dev; +/** + * @} + */ + +/* dev/ppb_file_chooser_dev.idl */ +/** + * @addtogroup Enums + * @{ + */ +/** + * This enumeration contains constants to control the behavior of the file + * chooser dialog. + */ +typedef enum { + /** + * Mode for choosing a single existing file. + */ + PP_FILECHOOSERMODE_OPEN = 0, + /** + * Mode for choosing multiple existing files. + */ + PP_FILECHOOSERMODE_OPENMULTIPLE = 1 +} PP_FileChooserMode_Dev; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_FileChooserMode_Dev, 4); +/** + * @} + */ + +/** + * @addtogroup Interfaces + * @{ + */ +struct PPB_FileChooser_Dev_0_6 { + /** + * This function creates a file chooser dialog resource. The chooser is + * associated with a particular instance, so that it may be positioned on the + * screen relative to the tab containing the instance. + * + * @param[in] instance A PP_Instance identifying one instance + * of a module. + * @param[in] mode A PP_FileChooserMode_Dev value that controls + * the behavior of the file chooser dialog. + * @param[in] accept_types A comma-separated list of MIME types and file + * extensions such as "audio/ *,text/plain,.html" (note there should be no + * space between the '/' and the '*', but one is added to avoid confusing C++ + * comments). The dialog may restrict selectable files to the specified MIME + * types and file extensions. If a string in the comma-separated list begins + * with a period (.) then the string is interpreted as a file extension, + * otherwise it is interpreted as a MIME-type. An empty string or an undefined + * var may be given to indicate that all types should be accepted. + * + * @return A PP_Resource containing the file chooser if + * successful or 0 if it could not be created. + */ + PP_Resource (*Create)(PP_Instance instance, + PP_FileChooserMode_Dev mode, + struct PP_Var accept_types); + /** + * Determines if the provided resource is a file chooser. + * + * @param[in] resource A PP_Resource corresponding to a generic + * resource. + * + * @return A PP_Bool that is PP_TRUE if the given + * resource is a file chooser resource, otherwise PP_FALSE. + */ + PP_Bool (*IsFileChooser)(PP_Resource resource); + /** + * This function displays a previously created file chooser resource as a + * dialog box, prompting the user to choose a file or files. This function + * must be called in response to a user gesture, such as a mouse click or + * touch event. The callback is called with PP_OK on successful completion + * with a file (or files) selected, PP_ERROR_USERCANCEL if the user selected + * no file, or another error code from pp_errors.h on failure. + * + * Subtle note: This function will only work when the tab containing + * the plugin is visible. Show() will fail if the tab is in the background. + * Since it's not normally possible to get input events while invisible, this + * is not normally an issue. But there is a race condition because events are + * processed asynchronously. If the user clicks and switches tabs very + * quickly, a plugin could believe the tab is visible while Chrome believes + * it is invisible and the Show() call will fail. This will not generally + * cause user confusion since the user will have switched tabs and will not + * want to see a file chooser from a different tab. + * + * @param[in] chooser The file chooser resource. + * + * @param[in] output An output array which will receive PP_Resource(s) + * identifying the PPB_FileRef objects that the user selected on + * success. + * + * @param[in] callback A CompletionCallback to be called after + * the user has closed the file chooser dialog. + * + * @return PP_OK_COMPLETIONPENDING if request to show the dialog was + * successful, another error code from pp_errors.h on failure. + */ + int32_t (*Show)(PP_Resource chooser, + struct PP_ArrayOutput output, + struct PP_CompletionCallback callback); +}; + +typedef struct PPB_FileChooser_Dev_0_6 PPB_FileChooser_Dev; + +struct PPB_FileChooser_Dev_0_5 { + PP_Resource (*Create)(PP_Instance instance, + PP_FileChooserMode_Dev mode, + struct PP_Var accept_types); + PP_Bool (*IsFileChooser)(PP_Resource resource); + int32_t (*Show)(PP_Resource chooser, struct PP_CompletionCallback callback); + PP_Resource (*GetNextChosenFile)(PP_Resource chooser); +}; +/** + * @} + */ + +/* dev/ppb_font_dev.idl */ +/** + * @addtogroup Enums + * @{ + */ +typedef enum { + /** + * Uses the user's default web page font (normally either the default serif + * or sans serif font). + */ + PP_FONTFAMILY_DEFAULT = 0, + /** + * These families will use the default web page font corresponding to the + * given family. + */ + PP_FONTFAMILY_SERIF = 1, + PP_FONTFAMILY_SANSSERIF = 2, + PP_FONTFAMILY_MONOSPACE = 3 +} PP_FontFamily_Dev; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_FontFamily_Dev, 4); + +/** + * Specifies the font weight. Normally users will only use NORMAL or BOLD. + */ +typedef enum { + PP_FONTWEIGHT_100 = 0, + PP_FONTWEIGHT_200 = 1, + PP_FONTWEIGHT_300 = 2, + PP_FONTWEIGHT_400 = 3, + PP_FONTWEIGHT_500 = 4, + PP_FONTWEIGHT_600 = 5, + PP_FONTWEIGHT_700 = 6, + PP_FONTWEIGHT_800 = 7, + PP_FONTWEIGHT_900 = 8, + PP_FONTWEIGHT_NORMAL = PP_FONTWEIGHT_400, + PP_FONTWEIGHT_BOLD = PP_FONTWEIGHT_700 +} PP_FontWeight_Dev; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_FontWeight_Dev, 4); +/** + * @} + */ + +/** + * @addtogroup Structs + * @{ + */ +struct PP_FontDescription_Dev { + /** + * Font face name as a string. This can also be an undefined var, in which + * case the generic family will be obeyed. If the face is not available on + * the system, the browser will attempt to do font fallback or pick a default + * font. + */ + struct PP_Var face; + /** + * When Create()ing a font and the face is an undefined var, the family + * specifies the generic font family type to use. If the face is specified, + * this will be ignored. + * + * When Describe()ing a font, the family will be the value you passed in when + * the font was created. In other words, if you specify a face name, the + * family will not be updated to reflect whether the font name you requested + * is serif or sans serif. + */ + PP_FontFamily_Dev family; + /** + * Size in pixels. + * + * You can specify 0 to get the default font size. The default font size + * may vary depending on the requested font. The typical example is that + * the user may have a different font size for the default monospace font to + * give it a similar optical size to the proportionally spaced fonts. + */ + uint32_t size; + /** + * Normally you will use either PP_FONTWEIGHT_NORMAL or PP_FONTWEIGHT_BOLD. + */ + PP_FontWeight_Dev weight; + PP_Bool italic; + PP_Bool small_caps; + /** + * Adjustment to apply to letter and word spacing, respectively. Initialize + * to 0 to get normal spacing. Negative values bring letters/words closer + * together, positive values separate them. + */ + int32_t letter_spacing; + int32_t word_spacing; + /** + * Ensure that this struct is 48-bytes wide by padding the end. In some + * compilers, PP_Var is 8-byte aligned, so those compilers align this struct + * on 8-byte boundaries as well and pad it to 16 bytes even without this + * padding attribute. This padding makes its size consistent across + * compilers. + */ + int32_t padding; +}; +PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_FontDescription_Dev, 48); + +struct PP_FontMetrics_Dev { + int32_t height; + int32_t ascent; + int32_t descent; + int32_t line_spacing; + int32_t x_height; +}; +PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_FontMetrics_Dev, 20); + +struct PP_TextRun_Dev { + /** + * This var must either be a string or a null/undefined var (which will be + * treated as a 0-length string). + */ + struct PP_Var text; + /** + * Set to PP_TRUE if the text is right-to-left. + * + * When override_direction is false, the browser will perform + * the Unicode Bidirectional Algorithm (http://unicode.org/reports/tr9/) on + * the text. The value of the rtl flag specifies the + * directionality of the surrounding environment. This means that Hebrew + * word will always display right to left, even if rtl is false. + * + * When override_direction is true, no autodetection will be done + * and rtl specifies the direction of the text. + * + * TODO(brettw) note that autodetection with rtl = true is currently + * unimplemented. + */ + PP_Bool rtl; + /** + * Set to PP_TRUE to force the directionality of the text regardless of + * content. + * + * If this flag is set, the browser will skip autodetection of the content + * and will display all text in the direction specified by the + * rtl flag. + */ + PP_Bool override_direction; +}; +PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_TextRun_Dev, 24); +/** + * @} + */ + +/** + * @addtogroup Interfaces + * @{ + */ +struct PPB_Font_Dev_0_6 { + /** + * Returns a list of all available font families on the system. You can use + * this list to decide whether to Create() a font. + * + * The return value will be a single string with null characters delimiting + * the end of each font name. For example: "Arial\0Courier\0Times\0". + * + * Returns an undefined var on failure (this typically means you passed an + * invalid instance). + */ + struct PP_Var (*GetFontFamilies)(PP_Instance instance); + /** + * Returns a font which best matches the given description. The return value + * will have a non-zero ID on success, or zero on failure. + */ + PP_Resource (*Create)(PP_Instance instance, + const struct PP_FontDescription_Dev* description); + /** + * Returns PP_TRUE if the given resource is a Font. Returns PP_FALSE if the + * resource is invalid or some type other than a Font. + */ + PP_Bool (*IsFont)(PP_Resource resource); + /** + * Loads the description and metrics of the font into the given structures. + * The description will be different than the description the font was + * created with since it will be filled with the real values from the font + * that was actually selected. + * + * The PP_Var in the description should be of type Void on input. On output, + * this will contain the string and will have a reference count of 1. The + * plugin is responsible for calling Release on this var. + * + * Returns PP_TRUE on success, PP_FALSE if the font is invalid or if the Var + * in the description isn't Null (to prevent leaks). + */ + PP_Bool (*Describe)(PP_Resource font, + struct PP_FontDescription_Dev* description, + struct PP_FontMetrics_Dev* metrics); + /** + * Draws the text to the image buffer. + * + * The given point represents the baseline of the left edge of the font, + * regardless of whether it is left-to-right or right-to-left (in the case of + * RTL text, this will actually represent the logical end of the text). + * + * The clip is optional and may be NULL. In this case, the text will be + * clipped to the image. + * + * The image_data_is_opaque flag indicates whether subpixel antialiasing can + * be performed, if it is supported. When the image below the text is + * opaque, subpixel antialiasing is supported and you should set this to + * PP_TRUE to pick up the user's default preferences. If your plugin is + * partially transparent, then subpixel antialiasing is not possible and + * grayscale antialiasing will be used instead (assuming the user has + * antialiasing enabled at all). + */ + PP_Bool (*DrawTextAt)(PP_Resource font, + PP_Resource image_data, + const struct PP_TextRun_Dev* text, + const struct PP_Point* position, + uint32_t color, + const struct PP_Rect* clip, + PP_Bool image_data_is_opaque); + /** + * Returns the width of the given string. If the font is invalid or the var + * isn't a valid string, this will return -1. + * + * Note that this function handles complex scripts such as Arabic, combining + * accents, etc. so that adding the width of substrings won't necessarily + * produce the correct width of the entire string. + * + * Returns -1 on failure. + */ + int32_t (*MeasureText)(PP_Resource font, const struct PP_TextRun_Dev* text); + /** + * Returns the character at the given pixel X position from the beginning of + * the string. This handles complex scripts such as Arabic, where characters + * may be combined or replaced depending on the context. Returns (uint32)-1 + * on failure. + */ + uint32_t (*CharacterOffsetForPixel)(PP_Resource font, + const struct PP_TextRun_Dev* text, + int32_t pixel_position); + /** + * Returns the horizontal advance to the given character if the string was + * placed at the given position. This handles complex scripts such as Arabic, + * where characters may be combined or replaced depending on context. Returns + * -1 on error. + */ + int32_t (*PixelOffsetForCharacter)(PP_Resource font, + const struct PP_TextRun_Dev* text, + uint32_t char_offset); +}; + +typedef struct PPB_Font_Dev_0_6 PPB_Font_Dev; +/** + * @} + */ + +/* dev/ppb_ime_input_event_dev.idl */ +/** + * @addtogroup Interfaces + * @{ + */ +struct PPB_IMEInputEvent_Dev_0_2 { + /** + * Create() creates an IME input event with the given parameters. Normally + * you will get an IME event passed through the HandleInputEvent + * and will not need to create them, but some applications may want to create + * their own for internal use. + * + * @param[in] instance The instance for which this event occurred. + * + * @param[in] type A PP_InputEvent_Type identifying the type of + * input event. The type must be one of the IME event types. + * + * @param[in] time_stamp A PP_TimeTicks indicating the time + * when the event occurred. + * + * @param[in] text The string returned by GetText. + * + * @param[in] segment_number The number returned by + * GetSegmentNumber. + * + * @param[in] segment_offsets The array of numbers returned by + * GetSegmentOffset. If segment_number is zero, + * the number of elements of the array should be zero. If + * segment_number is non-zero, the length of the array must be + * segment_number + 1. + * + * @param[in] target_segment The number returned by + * GetTargetSegment. + * + * @param[in] selection_start The start index returned by + * GetSelection. + * + * @param[in] selection_end The end index returned by + * GetSelection. + * + * @return A PP_Resource containing the new IME input event. + */ + PP_Resource (*Create)(PP_Instance instance, + PP_InputEvent_Type type, + PP_TimeTicks time_stamp, + struct PP_Var text, + uint32_t segment_number, + const uint32_t segment_offsets[], + int32_t target_segment, + uint32_t selection_start, + uint32_t selection_end); + /** + * IsIMEInputEvent() determines if a resource is an IME event. + * + * @param[in] resource A PP_Resource corresponding to an event. + * + * @return PP_TRUE if the given resource is a valid input event. + */ + PP_Bool (*IsIMEInputEvent)(PP_Resource resource); + /** + * GetText() returns the composition text as a UTF-8 string for the given IME + * event. + * + * @param[in] ime_event A PP_Resource corresponding to an IME + * event. + * + * @return A string var representing the composition text. For non-IME input + * events the return value will be an undefined var. + */ + struct PP_Var (*GetText)(PP_Resource ime_event); + /** + * GetSegmentNumber() returns the number of segments in the composition text. + * + * @param[in] ime_event A PP_Resource corresponding to an IME + * event. + * + * @return The number of segments. For events other than COMPOSITION_UPDATE, + * returns 0. + */ + uint32_t (*GetSegmentNumber)(PP_Resource ime_event); + /** + * GetSegmentOffset() returns the position of the index-th segmentation point + * in the composition text. The position is given by a byte-offset (not a + * character-offset) of the string returned by GetText(). It always satisfies + * 0=GetSegmentOffset(0) < ... < GetSegmentOffset(i) < GetSegmentOffset(i+1) + * < ... < GetSegmentOffset(GetSegmentNumber())=(byte-length of GetText()). + * Note that [GetSegmentOffset(i), GetSegmentOffset(i+1)) represents the range + * of the i-th segment, and hence GetSegmentNumber() can be a valid argument + * to this function instead of an off-by-1 error. + * + * @param[in] ime_event A PP_Resource corresponding to an IME + * event. + * + * @param[in] index An integer indicating a segment. + * + * @return The byte-offset of the segmentation point. If the event is not + * COMPOSITION_UPDATE or index is out of range, returns 0. + */ + uint32_t (*GetSegmentOffset)(PP_Resource ime_event, uint32_t index); + /** + * GetTargetSegment() returns the index of the current target segment of + * composition. + * + * @param[in] ime_event A PP_Resource corresponding to an IME + * event. + * + * @return An integer indicating the index of the target segment. When there + * is no active target segment, or the event is not COMPOSITION_UPDATE, + * returns -1. + */ + int32_t (*GetTargetSegment)(PP_Resource ime_event); + /** + * GetSelection() returns the range selected by caret in the composition text. + * + * @param[in] ime_event A PP_Resource corresponding to an IME + * event. + * + * @param[out] start The start position of the current selection. + * + * @param[out] end The end position of the current selection. + */ + void (*GetSelection)(PP_Resource ime_event, uint32_t* start, uint32_t* end); +}; + +typedef struct PPB_IMEInputEvent_Dev_0_2 PPB_IMEInputEvent_Dev; + +struct PPB_IMEInputEvent_Dev_0_1 { + PP_Bool (*IsIMEInputEvent)(PP_Resource resource); + struct PP_Var (*GetText)(PP_Resource ime_event); + uint32_t (*GetSegmentNumber)(PP_Resource ime_event); + uint32_t (*GetSegmentOffset)(PP_Resource ime_event, uint32_t index); + int32_t (*GetTargetSegment)(PP_Resource ime_event); + void (*GetSelection)(PP_Resource ime_event, uint32_t* start, uint32_t* end); +}; +/** + * @} + */ + +/* dev/ppb_memory_dev.idl */ +/** + * @addtogroup Interfaces + * @{ + */ +/** + * The PPB_Memory_Dev interface contains pointers to functions related to memory + * management. + * + */ +struct PPB_Memory_Dev_0_1 { + /** + * MemAlloc is a pointer to a function that allocate memory. + * + * @param[in] num_bytes A number of bytes to allocate. + * @return A pointer to the memory if successful, NULL If the + * allocation fails. + */ + void* (*MemAlloc)(uint32_t num_bytes); + /** + * MemFree is a pointer to a function that deallocates memory. + * + * @param[in] ptr A pointer to the memory to deallocate. It is safe to + * pass NULL to this function. + */ + void (*MemFree)(void* ptr); +}; + +typedef struct PPB_Memory_Dev_0_1 PPB_Memory_Dev; +/** + * @} + */ + +/* dev/ppb_opengles2ext_dev.idl */ +#include "ppapi/c/pp_resource.h" +#include "ppapi/c/ppb_opengles2.h" + + +/** + * @addtogroup Interfaces + * @{ + */ +struct PPB_OpenGLES2DrawBuffers_Dev_1_0 { + void (*DrawBuffersEXT)(PP_Resource context, + GLsizei count, + const GLenum* bufs); +}; + +struct PPB_OpenGLES2DrawBuffers_Dev { + void (*DrawBuffersEXT)(PP_Resource context, + GLsizei count, + const GLenum* bufs); +}; +/** + * @} + */ + +/* dev/ppb_printing_dev.idl */ +/** + * @addtogroup Interfaces + * @{ + */ +struct PPB_Printing_Dev_0_7 { + /** Create a resource for accessing printing functionality. + * + * @param[in] instance A PP_Instance identifying one instance + * of a module. + * + * @return A PP_Resource containing the printing resource if + * successful or 0 if it could not be created. + */ + PP_Resource (*Create)(PP_Instance instance); + /** + * Outputs the default print settings for the default printer into + * print_settings. The callback is called with + * PP_OK when the settings have been retrieved successfully. + * + * @param[in] resource The printing resource. + * + * @param[in] callback A CompletionCallback to be called when + * print_settings have been retrieved. + * + * @return PP_OK_COMPLETIONPENDING if request for the default print settings + * was successful, another error code from pp_errors.h on failure. + */ + int32_t (*GetDefaultPrintSettings)( + PP_Resource resource, + struct PP_PrintSettings_Dev* print_settings, + struct PP_CompletionCallback callback); +}; + +typedef struct PPB_Printing_Dev_0_7 PPB_Printing_Dev; +/** + * @} + */ + +/* dev/ppb_text_input_dev.idl */ +/** + * @addtogroup Enums + * @{ + */ +/** + * PP_TextInput_Type is used to indicate the status of a plugin in regard to + * text input. + */ +typedef enum { + /** + * Input caret is not in an editable mode, no input method shall be used. + */ + PP_TEXTINPUT_TYPE_DEV_NONE = 0, + /** + * Input caret is in a normal editable mode, any input method can be used. + */ + PP_TEXTINPUT_TYPE_DEV_TEXT = 1, + /** + * Input caret is in a password box, an input method may be used only if + * it's suitable for password input. + */ + PP_TEXTINPUT_TYPE_DEV_PASSWORD = 2, + PP_TEXTINPUT_TYPE_DEV_SEARCH = 3, + PP_TEXTINPUT_TYPE_DEV_EMAIL = 4, + PP_TEXTINPUT_TYPE_DEV_NUMBER = 5, + PP_TEXTINPUT_TYPE_DEV_TELEPHONE = 6, + PP_TEXTINPUT_TYPE_DEV_URL = 7 +} PP_TextInput_Type_Dev; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_TextInput_Type_Dev, 4); +/** + * @} + */ + +/** + * @addtogroup Interfaces + * @{ + */ +/** + * PPB_TextInput_Dev provides a set of functions for giving hints + * to the browser about the text input status of plugins, and functions for + * controlling input method editors (IMEs). + */ +struct PPB_TextInput_Dev_0_2 { + /** + * Informs the browser about the current text input mode of the plugin. + * Typical use of this information in the browser is to properly + * display/suppress tools for supporting text inputs (such as virtual + * keyboards in touch screen based devices, or input method editors often + * used for composing East Asian characters). + */ + void (*SetTextInputType)(PP_Instance instance, PP_TextInput_Type_Dev type); + /** + * Informs the browser about the coordinates of the text input caret and the + * bounding box of the text input area. Typical use of this information in + * the browser is to layout IME windows etc. + */ + void (*UpdateCaretPosition)(PP_Instance instance, + const struct PP_Rect* caret, + const struct PP_Rect* bounding_box); + /** + * Cancels the current composition in IME. + */ + void (*CancelCompositionText)(PP_Instance instance); + /** + * In response to the PPP_TextInput_Dev::RequestSurroundingText + * call, informs the browser about the current text selection and surrounding + * text. text is a UTF-8 string that contains the current range + * of text selection in the plugin. caret is the byte-index of + * the caret position within text. anchor is the + * byte-index of the anchor position (i.e., if a range of text is selected, + * it is the other edge of selection different from caret. If + * there are no selection, anchor is equal to caret. + * + * Typical use of this information in the browser is to enable "reconversion" + * features of IME that puts back the already committed text into the + * pre-commit composition state. Another use is to improve the precision + * of suggestion of IME by taking the context into account (e.g., if the caret + * looks to be on the beginning of a sentence, suggest capital letters in a + * virtual keyboard). + * + * When the focus is not on text, call this function setting text + * to an empty string and caret and anchor to zero. + * Also, the plugin should send the empty text when it does not want to reveal + * the selection to IME (e.g., when the surrounding text is containing + * password text). + */ + void (*UpdateSurroundingText)(PP_Instance instance, + const char* text, + uint32_t caret, + uint32_t anchor); + /** + * Informs the browser when a range of text selection is changed in a plugin. + * When the browser needs to know the content of the updated selection, it + * pings back by PPP_TextInput_Dev::RequestSurroundingText. The + * plugin then should send the information with + * UpdateSurroundingText. + */ + void (*SelectionChanged)(PP_Instance instance); +}; + +typedef struct PPB_TextInput_Dev_0_2 PPB_TextInput_Dev; + +struct PPB_TextInput_Dev_0_1 { + void (*SetTextInputType)(PP_Instance instance, PP_TextInput_Type_Dev type); + void (*UpdateCaretPosition)(PP_Instance instance, + const struct PP_Rect* caret, + const struct PP_Rect* bounding_box); + void (*CancelCompositionText)(PP_Instance instance); +}; +/** + * @} + */ + +/* dev/ppb_trace_event_dev.idl */ +/** + * @addtogroup Typedefs + * @{ + */ +/** + * A trace event timestamp. + */ +typedef int64_t PP_TraceEventTime; +/** + * @} + */ + +/** + * @addtogroup Interfaces + * @{ + */ +struct PPB_Trace_Event_Dev_0_2 { + /** + * Gets a pointer to a character for identifying a category name in the + * tracing system as well as for being able to early exit in client-side + * tracing code. + * + * NB: This mem_t return value should technically be const, but return values + * for Pepper IDL of mem_t type are not const. The same is true for the arg + * |category_enabled| for AddTraceEvent. + */ + void* (*GetCategoryEnabled)(const char* category_name); + /** + * Adds a trace event to the platform tracing system. This function call is + * usually the result of a TRACE_* macro from trace_event.h when tracing and + * the category of the particular trace are enabled. It is not advisable to + * call this function on its own; it is really only meant to be used by the + * trace macros. + */ + void (*AddTraceEvent)(int8_t phase, + const void* category_enabled, + const char* name, + uint64_t id, + uint32_t num_args, + const char* arg_names[], + const uint8_t arg_types[], + const uint64_t arg_values[], + uint8_t flags); + /** + * Version of the above interface that allows specifying a custom thread id + * and timestamp. This is useful for when tracing data cannot be registered + * in real time. For example, this could be used by storing timestamps + * internally and then registering the events retroactively. + */ + void (*AddTraceEventWithThreadIdAndTimestamp)(int8_t phase, + const void* category_enabled, + const char* name, + uint64_t id, + int32_t thread_id, + PP_TraceEventTime timestamp, + uint32_t num_args, + const char* arg_names[], + const uint8_t arg_types[], + const uint64_t arg_values[], + uint8_t flags); + /** + * Get the current clock value. Since this uses the same function as the trace + * events use internally, it can be used to create events with explicit time + * stamps. + */ + PP_TraceEventTime (*Now)(void); + /** + * Sets the thread name of the calling thread in the tracing system so it will + * show up properly in chrome://tracing. + */ + void (*SetThreadName)(const char* thread_name); +}; + +typedef struct PPB_Trace_Event_Dev_0_2 PPB_Trace_Event_Dev; + +struct PPB_Trace_Event_Dev_0_1 { + void* (*GetCategoryEnabled)(const char* category_name); + void (*AddTraceEvent)(int8_t phase, + const void* category_enabled, + const char* name, + uint64_t id, + uint32_t num_args, + const char* arg_names[], + const uint8_t arg_types[], + const uint64_t arg_values[], + uint8_t flags); + void (*SetThreadName)(const char* thread_name); +}; +/** + * @} + */ + +/* dev/ppb_truetype_font_dev.idl */ +/** + * @addtogroup Enums + * @{ + */ +/** + * The PP_TrueTypeFontFamily_Dev defines generic font families. These can be + * used to create generic fonts consistent with the user's browser settings. + */ +typedef enum { + /** + * For a description of these default families, see the + * + * 3.1.1 Generic font families documentation. + */ + PP_TRUETYPEFONTFAMILY_SERIF = 0, + PP_TRUETYPEFONTFAMILY_SANSSERIF = 1, + PP_TRUETYPEFONTFAMILY_CURSIVE = 2, + PP_TRUETYPEFONTFAMILY_FANTASY = 3, + PP_TRUETYPEFONTFAMILY_MONOSPACE = 4 +} PP_TrueTypeFontFamily_Dev; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_TrueTypeFontFamily_Dev, 4); + +/** + * The PP_TrueTypeFontStyle_Dev enum defines font styles. + */ +typedef enum { + PP_TRUETYPEFONTSTYLE_NORMAL = 0, + PP_TRUETYPEFONTSTYLE_ITALIC = 1 +} PP_TrueTypeFontStyle_Dev; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_TrueTypeFontStyle_Dev, 4); + +/** + * The PP_TrueTypeFontWeight_Dev enum defines font weights. + */ +typedef enum { + PP_TRUETYPEFONTWEIGHT_THIN = 100, + PP_TRUETYPEFONTWEIGHT_ULTRALIGHT = 200, + PP_TRUETYPEFONTWEIGHT_LIGHT = 300, + PP_TRUETYPEFONTWEIGHT_NORMAL = 400, + PP_TRUETYPEFONTWEIGHT_MEDIUM = 500, + PP_TRUETYPEFONTWEIGHT_SEMIBOLD = 600, + PP_TRUETYPEFONTWEIGHT_BOLD = 700, + PP_TRUETYPEFONTWEIGHT_ULTRABOLD = 800, + PP_TRUETYPEFONTWEIGHT_HEAVY = 900 +} PP_TrueTypeFontWeight_Dev; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_TrueTypeFontWeight_Dev, 4); + +/** + * The PP_TrueTypeFontWidth_Dev enum defines font widths. + */ +typedef enum { + PP_TRUETYPEFONTWIDTH_ULTRACONDENSED = 0, + PP_TRUETYPEFONTWIDTH_EXTRACONDENSED = 1, + PP_TRUETYPEFONTWIDTH_CONDENSED = 2, + PP_TRUETYPEFONTWIDTH_SEMICONDENSED = 3, + PP_TRUETYPEFONTWIDTH_NORMAL = 4, + PP_TRUETYPEFONTWIDTH_SEMIEXPANDED = 5, + PP_TRUETYPEFONTWIDTH_EXPANDED = 6, + PP_TRUETYPEFONTWIDTH_EXTRAEXPANDED = 7, + PP_TRUETYPEFONTWIDTH_ULTRAEXPANDED = 8 +} PP_TrueTypeFontWidth_Dev; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_TrueTypeFontWidth_Dev, 4); + +/** + * The PP_TrueTypeFontCharset enum defines font character sets. + */ +typedef enum { + PP_TRUETYPEFONTCHARSET_ANSI = 0, + PP_TRUETYPEFONTCHARSET_DEFAULT = 1, + PP_TRUETYPEFONTCHARSET_SYMBOL = 2, + PP_TRUETYPEFONTCHARSET_MAC = 77, + PP_TRUETYPEFONTCHARSET_SHIFTJIS = 128, + PP_TRUETYPEFONTCHARSET_HANGUL = 129, + PP_TRUETYPEFONTCHARSET_JOHAB = 130, + PP_TRUETYPEFONTCHARSET_GB2312 = 134, + PP_TRUETYPEFONTCHARSET_CHINESEBIG5 = 136, + PP_TRUETYPEFONTCHARSET_GREEK = 161, + PP_TRUETYPEFONTCHARSET_TURKISH = 162, + PP_TRUETYPEFONTCHARSET_VIETNAMESE = 163, + PP_TRUETYPEFONTCHARSET_HEBREW = 177, + PP_TRUETYPEFONTCHARSET_ARABIC = 178, + PP_TRUETYPEFONTCHARSET_BALTIC = 186, + PP_TRUETYPEFONTCHARSET_RUSSIAN = 204, + PP_TRUETYPEFONTCHARSET_THAI = 222, + PP_TRUETYPEFONTCHARSET_EASTEUROPE = 238, + PP_TRUETYPEFONTCHARSET_OEM = 255 +} PP_TrueTypeFontCharset_Dev; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_TrueTypeFontCharset_Dev, 4); +/** + * @} + */ + +/** + * @addtogroup Structs + * @{ + */ +/** + * The PP_TrueTypeFontDesc struct describes a TrueType font. It is + * passed to Create(), and returned by Describe(). + */ +struct PP_TrueTypeFontDesc_Dev { + /** + * Font family name as a string. This can also be an undefined var, in which + * case the generic family will be obeyed. If the face is not available on + * the system, the browser will attempt to do font fallback or pick a default + * font. + */ + struct PP_Var family; + /** This value specifies a generic font family. If a family name string is + * provided when creating a font, this is ignored. */ + PP_TrueTypeFontFamily_Dev generic_family; + /** This value specifies the font style. */ + PP_TrueTypeFontStyle_Dev style; + /** This value specifies the font weight. */ + PP_TrueTypeFontWeight_Dev weight; + /** This value specifies the font width, for condensed or expanded fonts */ + PP_TrueTypeFontWidth_Dev width; + /** This value specifies a character set. */ + PP_TrueTypeFontCharset_Dev charset; + /** + * Ensure that this struct is 40-bytes wide by padding the end. In some + * compilers, PP_Var is 8-byte aligned, so those compilers align this struct + * on 8-byte boundaries as well and pad it to 16 bytes even without this + * padding attribute. This padding makes its size consistent across + * compilers. + */ + int32_t padding; +}; +PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_TrueTypeFontDesc_Dev, 40); +/** + * @} + */ + +/** + * @addtogroup Interfaces + * @{ + */ +struct PPB_TrueTypeFont_Dev_0_1 { + /** + * Gets an array of TrueType font family names available on the host. + * These names can be used to create a font from a specific family. + * + * @param[in] instance A PP_Instance requesting the family names. + * @param[in] output A PP_ArrayOutput to hold the names. + * The output is an array of PP_Vars, each holding a family name. + * @param[in] callback A PP_CompletionCallback to be called upon + * completion of GetFontFamilies. + * + * @return If >= 0, the number of family names returned, otherwise an error + * code from pp_errors.h. + */ + int32_t (*GetFontFamilies)(PP_Instance instance, + struct PP_ArrayOutput output, + struct PP_CompletionCallback callback); + /** + * Gets an array of TrueType font descriptors for a given font family. These + * descriptors can be used to create a font in that family and matching the + * descriptor attributes. + * + * @param[in] instance A PP_Instance requesting the font + * descriptors. + * @param[in] family A PP_Var holding a string specifying the + * font family. + * @param[in] output A PP_ArrayOutput to hold the descriptors. + * The output is an array of PP_TrueTypeFontDesc structs. Each + * desc contains a PP_Var for the family name which must be released. + * @param[in] callback A PP_CompletionCallback to be called upon + * completion of GetFontsInFamily. + * + * @return If >= 0, the number of font descriptors returned, otherwise an + * error code from pp_errors.h. + */ + int32_t (*GetFontsInFamily)(PP_Instance instance, + struct PP_Var family, + struct PP_ArrayOutput output, + struct PP_CompletionCallback callback); + /** + * Creates a font resource matching the given font characteristics. The + * resource id will be non-zero on success, or zero on failure. + * + * @param[in] instance A PP_Instance to own the font. + * @param[in] desc A pointer to a PP_TrueTypeFontDesc describing + * the font. + */ + PP_Resource (*Create)(PP_Instance instance, + const struct PP_TrueTypeFontDesc_Dev* desc); + /** + * Determines if the given resource is a TrueType font. + * + * @param[in] resource A PP_Resource corresponding to a resource. + * + * @return PP_TRUE if the resource is a + * PPB_TrueTypeFont_Dev, PP_FALSE otherwise. + */ + PP_Bool (*IsTrueTypeFont)(PP_Resource resource); + /** + * Returns a description of the given font resource. This description may + * differ from the description passed to Create, reflecting the host's font + * matching and fallback algorithm. + * + * @param[in] font A PP_Resource corresponding to a font. + * @param[out] desc A pointer to a PP_TrueTypeFontDesc to hold + * the description. The internal 'family' PP_Var should be set to undefined, + * since this function overwrites the PP_TrueTypeFontDesc. After + * successful completion, the family will be set to a PP_Var with a single + * reference, which the caller must release after use. + * @param[in] callback A PP_CompletionCallback to be called upon + * completion of Describe. + * + * @return A return code from pp_errors.h. If an error code is + * returned, the PP_TrueTypeFontDesc will be unchanged. + */ + int32_t (*Describe)(PP_Resource font, + struct PP_TrueTypeFontDesc_Dev* desc, + struct PP_CompletionCallback callback); + /** + * Gets an array of identifying tags for each table in the font. These tags + * can be used to request specific tables using GetTable. + * + * @param[in] font A PP_Resource corresponding to a font. + * @param[in] output A PP_ArrayOutput to hold the tags. + * The output is an array of 4 byte integers, each representing a table tag. + * @param[in] callback A PP_CompletionCallback to be called upon + * completion of GetTableTags. + * + * @return If >= 0, the number of table tags returned, otherwise an error + * code from pp_errors.h. + */ + int32_t (*GetTableTags)(PP_Resource font, + struct PP_ArrayOutput output, + struct PP_CompletionCallback callback); + /** + * Copies the given font table into client memory. + * + * @param[in] font A PP_Resource corresponding to a font. + * @param[in] table A 4 byte value indicating which table to copy. + * For example, 'glyf' will cause the outline table to be copied into the + * output array. A zero tag value will cause the entire font to be copied. + * @param[in] offset The offset into the font table. Passing an offset + * greater than or equal to the table size will succeed with 0 bytes copied. + * @param[in] max_data_length The maximum number of bytes to transfer from + * offset. + * @param[in] output A PP_ArrayOutput to hold the font data. + * The output is an array of bytes. + * @param[in] callback A PP_CompletionCallback to be called upon + * completion of GetTable. + * + * @return If >= 0, the table size in bytes, otherwise an error code from + * pp_errors.h. + */ + int32_t (*GetTable)(PP_Resource font, + uint32_t table, + int32_t offset, + int32_t max_data_length, + struct PP_ArrayOutput output, + struct PP_CompletionCallback callback); +}; + +typedef struct PPB_TrueTypeFont_Dev_0_1 PPB_TrueTypeFont_Dev; +/** + * @} + */ + +/* dev/ppb_url_util_dev.idl */ +/** + * @addtogroup Structs + * @{ + */ +/* + * A component specifies the range of the part of the URL. The begin specifies + * the index into the string of the first character of that component. The len + * specifies the length of that component. + * + * This range does not include any special delimiter for that component, so + * the scheme doesn't include the trailing colon, the username and password + * don't include the @ and :, the port doesn't include the colon, the query + * doesn't include the ?, and the ref doesn't include the #. + * + * The exception is that the path *does* include the first /, since that's an + * integral part of the path. + * + * If the component is not present at all, begin will be 0 and len will be -1. + * If the component is present but empty, the length will be 0 instead. Example: + * http://foo/search -> query = (0, -1) + * http://foo/search? -> query = (18, 0) + */ +struct PP_URLComponent_Dev { + int32_t begin; + int32_t len; +}; +PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_URLComponent_Dev, 8); + +struct PP_URLComponents_Dev { + struct PP_URLComponent_Dev scheme; + struct PP_URLComponent_Dev username; + struct PP_URLComponent_Dev password; + struct PP_URLComponent_Dev host; + struct PP_URLComponent_Dev port; + struct PP_URLComponent_Dev path; + struct PP_URLComponent_Dev query; + struct PP_URLComponent_Dev ref; +}; +PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_URLComponents_Dev, 64); +/** + * @} + */ + +/** + * @addtogroup Interfaces + * @{ + */ +/* + * URL encoding: URLs are supplied to this interface as NULL-terminated 8-bit + * strings. You can pass non-ASCII characters which will be interpreted as + * UTF-8. Canonicalized URL strings returned by these functions will be ASCII + * except for the reference fragment (stuff after the '#') which will be + * encoded as UTF-8. + */ +struct PPB_URLUtil_Dev_0_7 { + /* + * Canonicalizes the given URL string according to the rules of the host + * browser. If the URL is invalid or the var is not a string, this will + * return a Null var and the components structure will be unchanged. + * + * The components pointer, if non-NULL and the canonicalized URL is valid, + * will identify the components of the resulting URL. Components may be NULL + * to specify that no component information is necessary. + */ + struct PP_Var (*Canonicalize)(struct PP_Var url, + struct PP_URLComponents_Dev* components); + /* + * Resolves the given URL relative to the given base URL. The resulting URL + * is returned as a string. If the resolution is invalid or either of the + * inputs are not strings, a Null var will be returned. The resulting URL + * will also be canonicalized according to the rules of the browser. + * + * Note that the "relative" URL may in fact be absolute, in which case it + * will be returned. This function is identical to resolving the full URL + * for an on a web page. Attempting to resolve a relative URL + * on a base URL that doesn't support this (e.g. "data") will fail and will + * return a Null var, unless the relative URL is itself absolute. + * + * The components pointer, if non-NULL and the canonicalized URL is valid, + * will identify the components of the resulting URL. Components may be NULL + * to specify that no component information is necessary. + */ + struct PP_Var (*ResolveRelativeToURL)( + struct PP_Var base_url, + struct PP_Var relative_string, + struct PP_URLComponents_Dev* components); + /* + * Identical to ResolveRelativeToURL except that the base URL is the base + * URL of the document containing the given plugin instance. + * + * Danger: This will be identical to resolving a relative URL on the page, + * and might be overridden by the page to something different than its actual + * URL via the tag. Therefore, resolving a relative URL of "" won't + * necessarily give you the URL of the page! + */ + struct PP_Var (*ResolveRelativeToDocument)( + PP_Instance instance, + struct PP_Var relative_string, + struct PP_URLComponents_Dev* components); + /* + * Checks whether the given two URLs are in the same security origin. Returns + * FALSE if either of the URLs are invalid. + */ + PP_Bool (*IsSameSecurityOrigin)(struct PP_Var url_a, struct PP_Var url_b); + /* + * Checks whether the document hosting the given plugin instance can access + * the given URL according to the same origin policy of the browser. Returns + * PP_FALSE if the instance or the URL is invalid. + */ + PP_Bool (*DocumentCanRequest)(PP_Instance instance, struct PP_Var url); + /* + * Checks whether the document containing the |active| plugin instance can + * access the document containing the |target| plugin instance according to + * the security policy of the browser. This includes the same origin policy + * and any cross-origin capabilities enabled by the document. If either of + * the plugin instances are invalid, returns PP_FALSE. + */ + PP_Bool (*DocumentCanAccessDocument)(PP_Instance active, PP_Instance target); + /* + * Returns the URL for the document. This is a safe way to retrieve + * window.location.href. + * The components pointer, if non-NULL and the canonicalized URL is valid, + * will identify the components of the resulting URL. Components may be NULL + * to specify that no component information is necessary. + */ + struct PP_Var (*GetDocumentURL)(PP_Instance instance, + struct PP_URLComponents_Dev* components); + /* + * Returns the Source URL for the plugin. This returns the URL that would be + * streamed to the plugin if it were a NPAPI plugin. This is usually the src + * attribute on the element, but the rules are obscure and different + * based on whether the plugin is loaded from an element or an + * element. + * The components pointer, if non-NULL and the canonicalized URL is valid, + * will identify the components of the resulting URL. Components may be NULL + * to specify that no component information is necessary. + */ + struct PP_Var (*GetPluginInstanceURL)( + PP_Instance instance, + struct PP_URLComponents_Dev* components); + /* + * Returns the Referrer URL of the HTTP request that loaded the plugin. This + * is the value of the 'Referer' header of the request. An undefined value + * means the 'Referer' header was absent. + * The components pointer, if non-NULL and the canonicalized URL is valid, + * will identify the components of the resulting URL. Components may be NULL + * to specify that no component information is necessary. + */ + struct PP_Var (*GetPluginReferrerURL)( + PP_Instance instance, + struct PP_URLComponents_Dev* components); +}; + +typedef struct PPB_URLUtil_Dev_0_7 PPB_URLUtil_Dev; + +struct PPB_URLUtil_Dev_0_6 { + struct PP_Var (*Canonicalize)(struct PP_Var url, + struct PP_URLComponents_Dev* components); + struct PP_Var (*ResolveRelativeToURL)( + struct PP_Var base_url, + struct PP_Var relative_string, + struct PP_URLComponents_Dev* components); + struct PP_Var (*ResolveRelativeToDocument)( + PP_Instance instance, + struct PP_Var relative_string, + struct PP_URLComponents_Dev* components); + PP_Bool (*IsSameSecurityOrigin)(struct PP_Var url_a, struct PP_Var url_b); + PP_Bool (*DocumentCanRequest)(PP_Instance instance, struct PP_Var url); + PP_Bool (*DocumentCanAccessDocument)(PP_Instance active, PP_Instance target); + struct PP_Var (*GetDocumentURL)(PP_Instance instance, + struct PP_URLComponents_Dev* components); + struct PP_Var (*GetPluginInstanceURL)( + PP_Instance instance, + struct PP_URLComponents_Dev* components); +}; +/** + * @} + */ + +/* dev/ppp_class_deprecated.idl */ +/** + * @addtogroup Interfaces + * @{ + */ +/** + * Interface for the plugin to implement JavaScript-accessible objects. + * + * This interface has no interface name. Instead, the plugin passes a pointer + * to this interface to PPB_Var_Deprecated.CreateObject that corresponds to the + * object being implemented. + * + * See the PPB_Var_Deprecated interface for more information on these functions. + * This interface just allows you to implement the "back end" of those + * functions, so most of the contract is specified in that interface. + * + * See + * http://code.google.com/p/ppapi/wiki/InterfacingWithJavaScript + * for general information on using and implementing vars. + */ +struct PPP_Class_Deprecated_1_0 { + /** + * |name| is guaranteed to be an integer or string type var. Exception is + * guaranteed non-NULL. An integer is used for |name| when implementing + * array access into the object. This test should only return true for + * properties that are not methods. Use HasMethod() to handle methods. + */ + PP_Bool (*HasProperty)(const void* object, + struct PP_Var name, + struct PP_Var* exception); + /** + * |name| is guaranteed to be a string-type. Exception is guaranteed non-NULL. + * If the method does not exist, return false and don't set the exception. + * Errors in this function will probably not occur in general usage, but + * if you need to throw an exception, still return false. + */ + PP_Bool (*HasMethod)(const void* object, + struct PP_Var name, + struct PP_Var* exception); + /** + * |name| is guaranteed to be a string-type or an integer-type var. Exception + * is guaranteed non-NULL. An integer is used for |name| when implementing + * array access into the object. If the property does not exist, set the + * exception and return a var of type Void. A property does not exist if + * a call HasProperty() for the same |name| would return false. + */ + struct PP_Var (*GetProperty)(const void* object, + struct PP_Var name, + struct PP_Var* exception); + /** + * Exception is guaranteed non-NULL. + * + * This should include all enumerable properties, including methods. Be sure + * to set |*property_count| to 0 and |properties| to NULL in all failure + * cases, these should never be unset when calling this function. The + * pointers passed in are guaranteed not to be NULL, so you don't have to + * NULL check them. + * + * If you have any properties, allocate the property array with + * PPB_Core.MemAlloc(sizeof(PP_Var) * property_count) and add a reference + * to each property on behalf of the caller. The caller is responsible for + * Release()ing each var and calling PPB_Core.MemFree on the property pointer. + */ + void (*GetAllPropertyNames)(const void* object, + uint32_t* property_count, + struct PP_Var** properties, + struct PP_Var* exception); + /** + * |name| is guaranteed to be an integer or string type var. Exception is + * guaranteed non-NULL. + */ + void (*SetProperty)(const void* object, + struct PP_Var name, + struct PP_Var value, + struct PP_Var* exception); + /** + * |name| is guaranteed to be an integer or string type var. Exception is + * guaranteed non-NULL. + */ + void (*RemoveProperty)(const void* object, + struct PP_Var name, + struct PP_Var* exception); + /* TODO(brettw) need native array access here. */ + /** + * |name| is guaranteed to be a string type var. Exception is guaranteed + * non-NULL + */ + struct PP_Var (*Call)(const void* object, + struct PP_Var method_name, + uint32_t argc, + const struct PP_Var argv[], + struct PP_Var* exception); + /** Exception is guaranteed non-NULL. */ + struct PP_Var (*Construct)(const void* object, + uint32_t argc, + const struct PP_Var argv[], + struct PP_Var* exception); + /** + * Called when the reference count of the object reaches 0. Normally, plugins + * would free their internal data pointed to by the |object| pointer. + */ + void (*Deallocate)(const void* object); +}; + +typedef struct PPP_Class_Deprecated_1_0 PPP_Class_Deprecated; +/** + * @} + */ + +/* dev/ppb_var_deprecated.idl */ +/** + * @addtogroup Interfaces + * @{ + */ +struct PPB_Var_Deprecated_0_3 { + /** + * Adds a reference to the given var. If this is not a refcounted object, + * this function will do nothing so you can always call it no matter what the + * type. + */ + void (*AddRef)(struct PP_Var var); + /** + * Removes a reference to given var, deleting it if the internal refcount + * becomes 0. If the given var is not a refcounted object, this function will + * do nothing so you can always call it no matter what the type. + */ + void (*Release)(struct PP_Var var); + /** + * Creates a string var from a string. The string must be encoded in valid + * UTF-8 and is NOT NULL-terminated, the length must be specified in |len|. + * It is an error if the string is not valid UTF-8. + * + * If the length is 0, the |data| pointer will not be dereferenced and may + * be NULL. Note, however, that if you do this, the "NULL-ness" will not be + * preserved, as VarToUtf8 will never return NULL on success, even for empty + * strings. + * + * The resulting object will be a refcounted string object. It will be + * AddRef()ed for the caller. When the caller is done with it, it should be + * Release()d. + * + * On error (basically out of memory to allocate the string, or input that + * is not valid UTF-8), this function will return a Null var. + */ + struct PP_Var (*VarFromUtf8)(PP_Module module, + const char* data, + uint32_t len); + /** + * Converts a string-type var to a char* encoded in UTF-8. This string is NOT + * NULL-terminated. The length will be placed in |*len|. If the string is + * valid but empty the return value will be non-NULL, but |*len| will still + * be 0. + * + * If the var is not a string, this function will return NULL and |*len| will + * be 0. + * + * The returned buffer will be valid as long as the underlying var is alive. + * If the plugin frees its reference, the string will be freed and the pointer + * will be to random memory. + */ + const char* (*VarToUtf8)(struct PP_Var var, uint32_t* len); + /** + * Returns true if the property with the given name exists on the given + * object, false if it does not. Methods are also counted as properties. + * + * The name can either be a string or an integer var. It is an error to pass + * another type of var as the name. + * + * If you pass an invalid name or object, the exception will be set (if it is + * non-NULL, and the return value will be false). + */ + PP_Bool (*HasProperty)(struct PP_Var object, + struct PP_Var name, + struct PP_Var* exception); + /** + * Identical to HasProperty, except that HasMethod additionally checks if the + * property is a function. + */ + PP_Bool (*HasMethod)(struct PP_Var object, + struct PP_Var name, + struct PP_Var* exception); + /** + * Returns the value of the given property. If the property doesn't exist, the + * exception (if non-NULL) will be set and a "Void" var will be returned. + */ + struct PP_Var (*GetProperty)(struct PP_Var object, + struct PP_Var name, + struct PP_Var* exception); + /** + * Retrieves all property names on the given object. Property names include + * methods. + * + * If there is a failure, the given exception will be set (if it is non-NULL). + * On failure, |*properties| will be set to NULL and |*property_count| will be + * set to 0. + * + * A pointer to the array of property names will be placesd in |*properties|. + * The caller is responsible for calling Release() on each of these properties + * (as per normal refcounted memory management) as well as freeing the array + * pointer with PPB_Core.MemFree(). + * + * This function returns all "enumerable" properties. Some JavaScript + * properties are "hidden" and these properties won't be retrieved by this + * function, yet you can still set and get them. + * + * Example: + *
  uint32_t count;
+   *   PP_Var* properties;
+   *   ppb_var.GetAllPropertyNames(object, &count, &properties);
+   *
+   *   ...use the properties here...
+   *
+   *   for (uint32_t i = 0; i < count; i++)
+   *     ppb_var.Release(properties[i]);
+   *   ppb_core.MemFree(properties); 
+ */ + void (*GetAllPropertyNames)(struct PP_Var object, + uint32_t* property_count, + struct PP_Var** properties, + struct PP_Var* exception); + /** + * Sets the property with the given name on the given object. The exception + * will be set, if it is non-NULL, on failure. + */ + void (*SetProperty)(struct PP_Var object, + struct PP_Var name, + struct PP_Var value, + struct PP_Var* exception); + /** + * Removes the given property from the given object. The property name must + * be an string or integer var, using other types will throw an exception + * (assuming the exception pointer is non-NULL). + */ + void (*RemoveProperty)(struct PP_Var object, + struct PP_Var name, + struct PP_Var* exception); + /* TODO(brettw) need native array access here. */ + /** + * Invoke the function |method_name| on the given object. If |method_name| + * is a Null var, the default method will be invoked, which is how you can + * invoke function objects. + * + * Unless it is type Null, |method_name| must be a string. Unlike other + * Var functions, integer lookup is not supported since you can't call + * functions on integers in JavaScript. + * + * Pass the arguments to the function in order in the |argv| array, and the + * number of arguments in the |argc| parameter. |argv| can be NULL if |argc| + * is zero. + * + * Example: + * Call(obj, VarFromUtf8("DoIt"), 0, NULL, NULL) = obj.DoIt() in JavaScript. + * Call(obj, PP_MakeNull(), 0, NULL, NULL) = obj() in JavaScript. + */ + struct PP_Var (*Call)(struct PP_Var object, + struct PP_Var method_name, + uint32_t argc, + const struct PP_Var argv[], + struct PP_Var* exception); + /** + * Invoke the object as a constructor. + * + * For example, if |object| is |String|, this is like saying |new String| in + * JavaScript. + */ + struct PP_Var (*Construct)(struct PP_Var object, + uint32_t argc, + const struct PP_Var argv[], + struct PP_Var* exception); + /** + * If the object is an instance of the given class, then this method returns + * true and sets *object_data to the value passed to CreateObject provided + * object_data is non-NULL. Otherwise, this method returns false. + */ + PP_Bool (*IsInstanceOf)(struct PP_Var var, + const struct PPP_Class_Deprecated_1_0* object_class, + void* object_data); + /** + * Creates an object that the plugin implements. The plugin supplies a + * pointer to the class interface it implements for that object, and its + * associated internal data that represents that object. This object data + * must be unique among all "live" objects. + * + * The returned object will have a reference count of 1. When the reference + * count reached 0, the class' Destruct function wlil be called. + * + * On failure, this will return a null var. This probably means the module + * was invalid. + * + * Example: Say we're implementing a "Point" object. + *
  void PointDestruct(void* object) {
+   *     delete (Point*)object;
+   *   }
+   *
+   *   const PPP_Class_Deprecated point_class = {
+   *     ... all the other class functions go here ...
+   *     &PointDestruct
+   *   };
+   *
+   *    * The plugin's internal object associated with the point.
+   *   class Point {
+   *     ...
+   *   };
+   *
+   *   PP_Var MakePoint(int x, int y) {
+   *     return CreateObject(&point_class, new Point(x, y));
+   *   }
+ */ + struct PP_Var (*CreateObject)( + PP_Instance instance, + const struct PPP_Class_Deprecated_1_0* object_class, + void* object_data); + /* Like CreateObject but takes a module. This will be deleted when all callers + * can be changed to use the PP_Instance CreateObject one. */ + struct PP_Var (*CreateObjectWithModuleDeprecated)( + PP_Module module, + const struct PPP_Class_Deprecated_1_0* object_class, + void* object_data); +}; + +typedef struct PPB_Var_Deprecated_0_3 PPB_Var_Deprecated; +/** + * @} + */ + +/* dev/ppb_video_capture_dev.idl */ +/** + * @addtogroup Interfaces + * @{ + */ +/** + * Video capture interface. It goes hand-in-hand with PPP_VideoCapture_Dev. + * + * Theory of operation: + * 1- Create a VideoCapture resource using Create. + * 2- Find available video capture devices using EnumerateDevices. + * 3- Open a video capture device. In addition to a device reference (0 can be + * used to indicate the default device), you pass in the requested info + * (resolution, frame rate), as well as suggest a number of buffers you will + * need. + * 4- Start the capture using StartCapture. + * 5- Receive the OnDeviceInfo callback, in PPP_VideoCapture_Dev, which will + * give you the actual capture info (the requested one is not guaranteed), as + * well as an array of buffers allocated by the browser. + * 6- On every frame captured by the browser, OnBufferReady (in + * PPP_VideoCapture_Dev) is called with the index of the buffer from the array + * containing the new frame. The buffer is now "owned" by the plugin, and the + * browser won't reuse it until ReuseBuffer is called. + * 7- When the plugin is done with the buffer, call ReuseBuffer. + * 8- Stop the capture using StopCapture. + * 9- Close the device. + * + * The browser may change the resolution based on the constraints of the system, + * in which case OnDeviceInfo will be called again, with new buffers. + * + * The buffers contain the pixel data for a frame. The format is planar YUV + * 4:2:0, one byte per pixel, tightly packed (width x height Y values, then + * width/2 x height/2 U values, then width/2 x height/2 V values). + */ +struct PPB_VideoCapture_Dev_0_3 { + /** + * Creates a new VideoCapture. + */ + PP_Resource (*Create)(PP_Instance instance); + /** + * Returns PP_TRUE if the given resource is a VideoCapture. + */ + PP_Bool (*IsVideoCapture)(PP_Resource video_capture); + /** + * Enumerates video capture devices. + * + * @param[in] video_capture A PP_Resource corresponding to a + * video capture resource. + * @param[in] output An output array which will receive + * PPB_DeviceRef_Dev resources on success. Please note that the + * ref count of those resources has already been increased by 1 for the + * caller. + * @param[in] callback A PP_CompletionCallback to run on + * completion. + * + * @return An error code from pp_errors.h. + */ + int32_t (*EnumerateDevices)(PP_Resource video_capture, + struct PP_ArrayOutput output, + struct PP_CompletionCallback callback); + /** + * Requests device change notifications. + * + * @param[in] video_capture A PP_Resource corresponding to a + * video capture resource. + * @param[in] callback The callback to receive notifications. If not NULL, it + * will be called once for the currently available devices, and then every + * time the list of available devices changes. All calls will happen on the + * same thread as the one on which MonitorDeviceChange() is called. It will + * receive notifications until video_capture is destroyed or + * MonitorDeviceChange() is called to set a new callback for + * video_capture. You can pass NULL to cancel sending + * notifications. + * @param[inout] user_data An opaque pointer that will be passed to + * callback. + * + * @return An error code from pp_errors.h. + */ + int32_t (*MonitorDeviceChange)(PP_Resource video_capture, + PP_MonitorDeviceChangeCallback callback, + void* user_data); + /** + * Opens a video capture device. |device_ref| identifies a video capture + * device. It could be one of the resource in the array returned by + * |EnumerateDevices()|, or 0 which means the default device. + * |requested_info| is a pointer to a structure containing the requested + * resolution and frame rate. |buffer_count| is the number of buffers + * requested by the plugin. Note: it is only used as advisory, the browser may + * allocate more or fewer based on available resources. How many buffers + * depends on usage. At least 2 to make sure latency doesn't cause lost + * frames. If the plugin expects to hold on to more than one buffer at a time + * (e.g. to do multi-frame processing, like video encoding), it should request + * that many more. + */ + int32_t (*Open)(PP_Resource video_capture, + PP_Resource device_ref, + const struct PP_VideoCaptureDeviceInfo_Dev* requested_info, + uint32_t buffer_count, + struct PP_CompletionCallback callback); + /** + * Starts the capture. + * + * Returns PP_ERROR_FAILED if called when the capture was already started, or + * PP_OK on success. + */ + int32_t (*StartCapture)(PP_Resource video_capture); + /** + * Allows the browser to reuse a buffer that was previously sent by + * PPP_VideoCapture_Dev.OnBufferReady. |buffer| is the index of the buffer in + * the array returned by PPP_VideoCapture_Dev.OnDeviceInfo. + * + * Returns PP_ERROR_BADARGUMENT if buffer is out of range (greater than the + * number of buffers returned by PPP_VideoCapture_Dev.OnDeviceInfo), or if it + * is not currently owned by the plugin. Returns PP_OK otherwise. + */ + int32_t (*ReuseBuffer)(PP_Resource video_capture, uint32_t buffer); + /** + * Stops the capture. + * + * Returns PP_ERROR_FAILED if the capture wasn't already started, or PP_OK on + * success. + */ + int32_t (*StopCapture)(PP_Resource video_capture); + /** + * Closes the video capture device, and stops capturing if necessary. It is + * not valid to call |Open()| again after a call to this method. + * If a video capture resource is destroyed while a device is still open, then + * it will be implicitly closed, so you are not required to call this method. + */ + void (*Close)(PP_Resource video_capture); +}; + +typedef struct PPB_VideoCapture_Dev_0_3 PPB_VideoCapture_Dev; +/** + * @} + */ + +/* dev/ppb_video_decoder_dev.idl */ +/** + * @addtogroup Interfaces + * @{ + */ +/** + * Video decoder interface. + * + * Typical usage: + * - Use Create() to create & configure a new PPB_VideoDecoder_Dev resource. + * - Call Decode() to decode some video data. + * - Receive ProvidePictureBuffers callback + * - Supply the decoder with textures using AssignPictureBuffers. + * - Receive PictureReady callbacks + * - Hand the textures back to the decoder using ReusePictureBuffer. + * - To signal EOS to the decoder: call Flush() and wait for NotifyFlushDone + * callback. + * - To reset the decoder (e.g. to implement Seek): call Reset() and wait for + * NotifyResetDone callback. + * - To tear down the decoder call Destroy(). + * + * See PPP_VideoDecoder_Dev for the notifications the decoder may send the + * plugin. + */ +struct PPB_VideoDecoder_Dev_0_16 { + /** + * Creates & initializes a video decoder. + * + * Parameters: + * |instance| pointer to the plugin instance. + * |context| a PPB_Graphics3D resource in which decoding will happen. + * |profile| the video stream's format profile. + * + * The created decoder is returned as PP_Resource. 0 means failure. + */ + PP_Resource (*Create)(PP_Instance instance, + PP_Resource context, + PP_VideoDecoder_Profile profile); + /** + * Tests whether |resource| is a video decoder created through Create + * function of this interface. + * + * Parameters: + * |resource| is handle to resource to test. + * + * Returns true if is a video decoder, false otherwise. + */ + PP_Bool (*IsVideoDecoder)(PP_Resource resource); + /** + * Dispatches bitstream buffer to the decoder. + * + * Parameters: + * |video_decoder| is the previously created handle to the decoder resource. + * |bitstream_buffer| is the bitstream buffer that contains at most one + * input frame. + * |callback| will be called when |bitstream_buffer| has been processed by + * the decoder. + * + * Returns an error code from pp_errors.h. + */ + int32_t (*Decode)(PP_Resource video_decoder, + const struct PP_VideoBitstreamBuffer_Dev* bitstream_buffer, + struct PP_CompletionCallback callback); + /** + * Provides the decoder with texture-backed picture buffers for video + * decoding. + * + * This function should be called when the plugin has its + * ProvidePictureBuffers method called. The decoder will stall until it has + * received all the buffers it's asked for. + * + * Parameters: + * |video_decoder| is the previously created handle to the decoder resource. + * |no_of_buffers| how many buffers are behind picture buffer pointer. + * |buffers| contains the reference to the picture buffer that was + * allocated. + */ + void (*AssignPictureBuffers)(PP_Resource video_decoder, + uint32_t no_of_buffers, + const struct PP_PictureBuffer_Dev buffers[]); + /** + * Tells the decoder to reuse the given picture buffer. Typical use of this + * function is to call from PictureReady callback to recycle picture buffer + * back to the decoder after blitting the image so that decoder can use the + * image for output again. + * + * Parameters: + * |video_decoder| is the previously created handle to the decoder resource. + * |picture_buffer_id| contains the id of the picture buffer that was + * processed. + */ + void (*ReusePictureBuffer)(PP_Resource video_decoder, + int32_t picture_buffer_id); + /** + * Flush input and output buffers in the decoder. Any pending inputs are + * decoded and pending outputs are delivered to the plugin. Once done + * flushing, the decoder will call |callback|. + * + * Parameters: + * |video_decoder| is the previously created handle to the decoder resource. + * |callback| is one-time callback that will be called once the flushing + * request has been completed. + * + * Returns an error code from pp_errors.h. + */ + int32_t (*Flush)(PP_Resource video_decoder, + struct PP_CompletionCallback callback); + /** + * Reset the decoder as quickly as possible. Pending inputs and outputs are + * dropped and the decoder is put back into a state ready to receive further + * Decode() calls. |callback| will be called when the reset is done. + * + * Parameters: + * |video_decoder| is the previously created handle to the decoder resource. + * |callback| is one-time callback that will be called once the reset + * request has been completed. + * + * Returns an error code from pp_errors.h. + */ + int32_t (*Reset)(PP_Resource video_decoder, + struct PP_CompletionCallback callback); + /** + * Tear down the decoder as quickly as possible. Pending inputs and outputs + * are dropped and the decoder frees all of its resources. Although resources + * may be freed asynchronously, after this method returns no more callbacks + * will be made on the client. Any resources held by the client at that point + * may be freed. + * + * Parameters: + * |video_decoder| is the previously created handle to the decoder resource. + */ + void (*Destroy)(PP_Resource video_decoder); +}; + +typedef struct PPB_VideoDecoder_Dev_0_16 PPB_VideoDecoder_Dev; +/** + * @} + */ + +/* dev/ppb_view_dev.idl */ +/** + * @addtogroup Interfaces + * @{ + */ +/* PPB_View_Dev interface */ +struct PPB_View_Dev_0_1 { + /** + * GetDeviceScale returns the scale factor between device pixels and DIPs + * (also known as logical pixels or UI pixels on some platforms). This allows + * the developer to render their contents at device resolution, even as + * coordinates / sizes are given in DIPs through the API. + * + * Note that the coordinate system for Pepper APIs is DIPs. Also note that + * one DIP might not equal one CSS pixel - when page scale/zoom is in effect. + * + * @param[in] resource A PP_Resource corresponding to a + * PPB_View resource. + * + * @return A float value representing the number of device pixels + * per DIP. If the resource is invalid, the value will be 0.0. + */ + float (*GetDeviceScale)(PP_Resource resource); + /** + * GetCSSScale returns the scale factor between DIPs and CSS pixels. This + * allows proper scaling between DIPs - as sent via the Pepper API - and CSS + * pixel coordinates used for Web content. + * + * @param[in] resource A PP_Resource corresponding to a + * PPB_View resource. + * + * @return css_scale A float value representing the number of + * DIPs per CSS pixel. If the resource is invalid, the value will be 0.0. + */ + float (*GetCSSScale)(PP_Resource resource); +}; + +typedef struct PPB_View_Dev_0_1 PPB_View_Dev; +/** + * @} + */ + +/* dev/ppp_network_state_dev.idl */ +/** + * @addtogroup Interfaces + * @{ + */ +struct PPP_NetworkState_Dev_0_1 { + /** + * Notification that the online state has changed for the user's network. + * This will change as a result of a network cable being plugged or + * unplugged, WiFi connections going up and down, or other events. + * + * Note that being "online" isn't a guarantee that any particular connections + * will succeed. + */ + void (*SetOnLine)(PP_Bool is_online); +}; + +typedef struct PPP_NetworkState_Dev_0_1 PPP_NetworkState_Dev; +/** + * @} + */ + +/* dev/ppp_printing_dev.idl */ +/** + * @addtogroup Structs + * @{ + */ +/** + * Specifies a contiguous range of page numbers to be printed. + * The page numbers use a zero-based index. + */ +struct PP_PrintPageNumberRange_Dev { + uint32_t first_page_number; + uint32_t last_page_number; +}; +PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_PrintPageNumberRange_Dev, 8); +/** + * @} + */ + +/** + * @addtogroup Interfaces + * @{ + */ +struct PPP_Printing_Dev_0_6 { + /** + * Returns a bit field representing the supported print output formats. For + * example, if only PDF and PostScript are supported, + * QuerySupportedFormats returns a value equivalent to: + * (PP_PRINTOUTPUTFORMAT_PDF | PP_PRINTOUTPUTFORMAT_POSTSCRIPT) + */ + uint32_t (*QuerySupportedFormats)(PP_Instance instance); + /** + * Begins a print session with the given print settings. Calls to PrintPages + * can only be made after a successful call to Begin. Returns the number of + * pages required for the print output at the given page size (0 indicates + * a failure). + */ + int32_t (*Begin)(PP_Instance instance, + const struct PP_PrintSettings_Dev* print_settings); + /** + * Prints the specified pages using the format specified in Begin. + * Returns a PPB_Buffer resource that represents the printed output. Returns + * 0 on failure. + */ + PP_Resource (*PrintPages)( + PP_Instance instance, + const struct PP_PrintPageNumberRange_Dev* page_ranges, + uint32_t page_range_count); + /** Ends the print session. Further calls to PrintPages will fail. */ + void (*End)(PP_Instance instance); + /** + * Returns true if the current content should be printed into the full page + * and not scaled down to fit within the printer's printable area. + */ + PP_Bool (*IsScalingDisabled)(PP_Instance instance); +}; + +typedef struct PPP_Printing_Dev_0_6 PPP_Printing_Dev; +/** + * @} + */ + +/* dev/ppp_text_input_dev.idl */ +/** + * @addtogroup Interfaces + * @{ + */ +/** + * PPP_TextInput_Dev is a set of function pointers that the + * plugin has to implement to provide hints for text input system (IME). + */ +struct PPP_TextInput_Dev_0_1 { + /** + * Requests the plugin to send back the text around the current caret or + * selection by PPB_TextInput_Dev::UpdateSurroundingText. + * It is recommended to include the desired_number_of_characters + * characters before and after the selection, but not mandatory. + */ + void (*RequestSurroundingText)(PP_Instance instance, + uint32_t desired_number_of_characters); +}; + +typedef struct PPP_TextInput_Dev_0_1 PPP_TextInput_Dev; +/** + * @} + */ + +/* dev/ppp_video_capture_dev.idl */ +/** + * @addtogroup Interfaces + * @{ + */ +/** + * Video Capture client interface. See |PPB_VideoCapture_Dev| for general theory + * of operation. + */ +struct PPP_VideoCapture_Dev_0_1 { + /** + * Signals the capture device information, such as resolution and frame rate, + * and the array of buffers that the browser will use to send pixel data. + * + * |info| is a pointer to the PP_VideoCaptureDeviceInfo_Dev structure + * containing resolution and frame rate. + * |buffer_count| is the number of buffers, and |buffers| is the array of + * PPB_Buffer_Dev buffers. + * + * Note: the buffers are passed without an extra reference. The plugin is + * expected to add its own references to the buffers. + */ + void (*OnDeviceInfo)(PP_Instance instance, + PP_Resource video_capture, + const struct PP_VideoCaptureDeviceInfo_Dev* info, + uint32_t buffer_count, + const PP_Resource buffers[]); + /** + * Signals status changes on the VideoCapture. |status| is a + * one of the values from PP_VideoCaptureStatus_Dev; + */ + void (*OnStatus)(PP_Instance instance, + PP_Resource video_capture, + uint32_t status); + /** + * Signals an error from the video capture system. + * + * Errors that can be generated: + * - PP_ERROR_NOMEMORY: not enough memory was available to allocate buffers. + * - PP_ERROR_FAILED: video capture could not start. + */ + void (*OnError)(PP_Instance instance, + PP_Resource video_capture, + uint32_t error_code); + /** + * Signals that a buffer is available for consumption by the plugin. + * + * |buffer| is the index of the buffer, in the array returned by OnDeviceInfo. + */ + void (*OnBufferReady)(PP_Instance instance, + PP_Resource video_capture, + uint32_t buffer); +}; + +typedef struct PPP_VideoCapture_Dev_0_1 PPP_VideoCapture_Dev; +/** + * @} + */ + +/* dev/ppp_video_decoder_dev.idl */ +/** + * @addtogroup Interfaces + * @{ + */ +/** + * PPP_VideoDecoder_Dev structure contains the function pointers that the + * plugin MUST implement to provide services needed by the video decoder + * implementation. + * + * See PPB_VideoDecoder_Dev for general usage tips. + */ +struct PPP_VideoDecoder_Dev_0_11 { + /** + * Callback function to provide buffers for the decoded output pictures. If + * succeeds plugin must provide buffers through AssignPictureBuffers function + * to the API. If |req_num_of_bufs| matching exactly the specification + * given in the parameters cannot be allocated decoder should be destroyed. + * + * Decoding will not proceed until buffers have been provided. + * + * Parameters: + * |instance| the plugin instance to which the callback is responding. + * |decoder| the PPB_VideoDecoder_Dev resource. + * |req_num_of_bufs| tells how many buffers are needed by the decoder. + * |dimensions| tells the dimensions of the buffer to allocate. + * |texture_target| the type of texture used. Sample targets in use are + * TEXTURE_2D (most platforms) and TEXTURE_EXTERNAL_OES (on ARM). + */ + void (*ProvidePictureBuffers)(PP_Instance instance, + PP_Resource decoder, + uint32_t req_num_of_bufs, + const struct PP_Size* dimensions, + uint32_t texture_target); + /** + * Callback function for decoder to deliver unneeded picture buffers back to + * the plugin. + * + * Parameters: + * |instance| the plugin instance to which the callback is responding. + * |decoder| the PPB_VideoDecoder_Dev resource. + * |picture_buffer| points to the picture buffer that is no longer needed. + */ + void (*DismissPictureBuffer)(PP_Instance instance, + PP_Resource decoder, + int32_t picture_buffer_id); + /** + * Callback function for decoder to deliver decoded pictures ready to be + * displayed. Decoder expects the plugin to return the buffer back to the + * decoder through ReusePictureBuffer function in PPB Video Decoder API. + * + * Parameters: + * |instance| the plugin instance to which the callback is responding. + * |decoder| the PPB_VideoDecoder_Dev resource. + * |picture| is the picture that is ready. + */ + void (*PictureReady)(PP_Instance instance, + PP_Resource decoder, + const struct PP_Picture_Dev* picture); + /** + * Error handler callback for decoder to deliver information about detected + * errors to the plugin. + * + * Parameters: + * |instance| the plugin instance to which the callback is responding. + * |decoder| the PPB_VideoDecoder_Dev resource. + * |error| error is the enumeration specifying the error. + */ + void (*NotifyError)(PP_Instance instance, + PP_Resource decoder, + PP_VideoDecodeError_Dev error); +}; + +typedef struct PPP_VideoDecoder_Dev_0_11 PPP_VideoDecoder_Dev; +/** + * @} + */ + +/* private/pp_content_decryptor.idl */ +/** + * @addtogroup Structs + * @{ + */ +struct PP_DecryptTrackingInfo { + /** + * Client-specified identifier for the associated decrypt request. By using + * this value, the client can associate the decrypted block with a decryption + * request. + */ + uint32_t request_id; + /** + * A unique buffer ID to identify a PPB_Buffer_Dev. Unlike a PP_Resource, + * this ID is identical at both the renderer side and the plugin side. + * In PPB_ContentDecryptor_Private calls, this is the ID of the + * buffer associated with the decrypted block/frame/samples. + * In PPP_ContentDecryptor_Private calls, this is the ID of a + * buffer that is no longer need at the renderer side, which can be released + * or recycled by the plugin. This ID can be 0 if there is no buffer to be + * released or recycled. + */ + uint32_t buffer_id; + /** + * Timestamp in microseconds of the associated block. By using this value, + * the client can associate the decrypted (and decoded) data with an input + * block. This is needed because buffers may be delivered out of order and + * not in response to the request_id they were provided with. + */ + int64_t timestamp; +}; +PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_DecryptTrackingInfo, 16); + +/** + * The PP_DecryptSubsampleDescription struct contains information + * to support subsample decryption. + * + * An input block can be split into several continuous subsamples. + * A PP_DecryptSubsampleEntry specifies the number of clear and + * cipher bytes in each subsample. For example, the following block has three + * subsamples: + * + * |<----- subsample1 ----->|<----- subsample2 ----->|<----- subsample3 ----->| + * | clear1 | cipher1 | clear2 | cipher2 | clear3 | cipher3 | + * + * For decryption, all of the cipher bytes in a block should be treated as a + * contiguous (in the subsample order) logical stream. The clear bytes should + * not be considered as part of decryption. + * + * Logical stream to decrypt: | cipher1 | cipher2 | cipher3 | + * Decrypted stream: | decrypted1| decrypted2 | decrypted3 | + * + * After decryption, the decrypted bytes should be copied over the position + * of the corresponding cipher bytes in the original block to form the output + * block. Following the above example, the decrypted block should be: + * + * |<----- subsample1 ----->|<----- subsample2 ----->|<----- subsample3 ----->| + * | clear1 | decrypted1| clear2 | decrypted2 | clear3 | decrypted3 | + */ +struct PP_DecryptSubsampleDescription { + /** + * Size in bytes of clear data in a subsample entry. + */ + uint32_t clear_bytes; + /** + * Size in bytes of encrypted data in a subsample entry. + */ + uint32_t cipher_bytes; +}; +PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_DecryptSubsampleDescription, 8); + +/** + * The PP_EncryptedBlockInfo struct contains all the information + * needed to decrypt an encrypted block. + */ +struct PP_EncryptedBlockInfo { + /** + * Information needed by the client to track the block to be decrypted. + */ + struct PP_DecryptTrackingInfo tracking_info; + /** + * Size in bytes of data to be decrypted (data_offset included). + */ + uint32_t data_size; + /** + * Key ID of the block to be decrypted. + * + * For WebM the key ID can be as large as 2048 bytes in theory. But it's not + * used in current implementations. If we really need to support it, we should + * move key ID out as a separate parameter, e.g. as a PP_Var, or + * make the whole PP_EncryptedBlockInfo as a + * PP_Resource. + */ + uint8_t key_id[64]; + uint32_t key_id_size; + /** + * Initialization vector of the block to be decrypted. + */ + uint8_t iv[16]; + uint32_t iv_size; + /** + * Subsample information of the block to be decrypted. + * + * We need to have a fixed size of |subsamples| here. Choose 32 because it is + * sufficient for almost all real life scenarios. Note that in theory the + * number of subsamples could be larger than 32. If that happens, playback + * will fail. + */ + struct PP_DecryptSubsampleDescription subsamples[32]; + uint32_t num_subsamples; +}; +PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_EncryptedBlockInfo, 368); +/** + * @} + */ + +/** + * @addtogroup Enums + * @{ + */ +/** + * PP_DecryptedFrameFormat contains video frame formats. + */ +typedef enum { + PP_DECRYPTEDFRAMEFORMAT_UNKNOWN = 0, + PP_DECRYPTEDFRAMEFORMAT_YV12 = 1, + PP_DECRYPTEDFRAMEFORMAT_I420 = 2 +} PP_DecryptedFrameFormat; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_DecryptedFrameFormat, 4); + +/** + * PP_DecryptedSampleFormat contains audio sample formats. + */ +typedef enum { + PP_DECRYPTEDSAMPLEFORMAT_UNKNOWN = 0, + PP_DECRYPTEDSAMPLEFORMAT_U8 = 1, + PP_DECRYPTEDSAMPLEFORMAT_S16 = 2, + PP_DECRYPTEDSAMPLEFORMAT_S32 = 3, + PP_DECRYPTEDSAMPLEFORMAT_F32 = 4, + PP_DECRYPTEDSAMPLEFORMAT_PLANAR_S16 = 5, + PP_DECRYPTEDSAMPLEFORMAT_PLANAR_F32 = 6 +} PP_DecryptedSampleFormat; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_DecryptedSampleFormat, 4); + +/** + * The PP_DecryptResult enum contains decryption and decoding + * result constants. + */ +typedef enum { + /** The decryption (and/or decoding) operation finished successfully. */ + PP_DECRYPTRESULT_SUCCESS = 0, + /** The decryptor did not have the necessary decryption key. */ + PP_DECRYPTRESULT_DECRYPT_NOKEY = 1, + /** The input was accepted by the decoder but no frame(s) can be produced. */ + PP_DECRYPTRESULT_NEEDMOREDATA = 2, + /** An unexpected error happened during decryption. */ + PP_DECRYPTRESULT_DECRYPT_ERROR = 3, + /** An unexpected error happened during decoding. */ + PP_DECRYPTRESULT_DECODE_ERROR = 4 +} PP_DecryptResult; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_DecryptResult, 4); +/** + * @} + */ + +/** + * @addtogroup Structs + * @{ + */ +/** + * PP_DecryptedBlockInfo struct contains the decryption result and + * tracking info associated with the decrypted block. + */ +struct PP_DecryptedBlockInfo { + /** + * Result of the decryption (and/or decoding) operation. + */ + PP_DecryptResult result; + /** + * Size in bytes of decrypted data, which may be less than the size of the + * corresponding buffer. + */ + uint32_t data_size; + /** + * Information needed by the client to track the block to be decrypted. + */ + struct PP_DecryptTrackingInfo tracking_info; +}; +PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_DecryptedBlockInfo, 24); +/** + * @} + */ + +/** + * @addtogroup Enums + * @{ + */ +/** + * PP_DecryptedFramePlanes provides YUV plane index values for + * accessing plane offsets stored in PP_DecryptedFrameInfo. + */ +typedef enum { + PP_DECRYPTEDFRAMEPLANES_Y = 0, + PP_DECRYPTEDFRAMEPLANES_U = 1, + PP_DECRYPTEDFRAMEPLANES_V = 2 +} PP_DecryptedFramePlanes; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_DecryptedFramePlanes, 4); +/** + * @} + */ + +/** + * @addtogroup Structs + * @{ + */ +/** + * PP_DecryptedFrameInfo contains the result of the + * decrypt and decode operation on the associated frame, information required + * to access the frame data in buffer, and tracking info. + */ +struct PP_DecryptedFrameInfo { + /** + * Result of the decrypt and decode operation. + */ + PP_DecryptResult result; + /** + * Format of the decrypted frame. + */ + PP_DecryptedFrameFormat format; + /** + * Offsets into the buffer resource for accessing video planes. + */ + int32_t plane_offsets[3]; + /** + * Stride of each plane. + */ + int32_t strides[3]; + /** + * Width of the video frame, in pixels. + */ + int32_t width; + /** + * Height of the video frame, in pixels. + */ + int32_t height; + /** + * Information needed by the client to track the decrypted frame. + */ + struct PP_DecryptTrackingInfo tracking_info; +}; +PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_DecryptedFrameInfo, 56); + +/** + * PP_DecryptedSampleInfo contains the result of the + * decrypt and decode operation on the associated samples, information required + * to access the sample data in buffer, and tracking info. + */ +struct PP_DecryptedSampleInfo { + /** + * Result of the decrypt and decode operation. + */ + PP_DecryptResult result; + /** + * Format of the decrypted samples. + */ + PP_DecryptedSampleFormat format; + /** + * Size in bytes of decrypted samples. + */ + uint32_t data_size; + /** + * 4-byte padding to make the size of PP_DecryptedSampleInfo + * a multiple of 8 bytes. The value of this field should not be used. + */ + uint32_t padding; + /** + * Information needed by the client to track the decrypted samples. + */ + struct PP_DecryptTrackingInfo tracking_info; +}; +PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_DecryptedSampleInfo, 32); +/** + * @} + */ + +/** + * @addtogroup Enums + * @{ + */ +/** + * PP_AudioCodec contains audio codec type constants. + */ +typedef enum { + PP_AUDIOCODEC_UNKNOWN = 0, + PP_AUDIOCODEC_VORBIS = 1, + PP_AUDIOCODEC_AAC = 2 +} PP_AudioCodec; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_AudioCodec, 4); +/** + * @} + */ + +/** + * @addtogroup Structs + * @{ + */ +/** + * PP_AudioDecoderConfig contains audio decoder configuration + * information required to initialize audio decoders, and a request ID + * that allows clients to associate a decoder initialization request with a + * status response. Note: When codec requires extra data for + * initialization, the data is sent as a PP_Resource carried + * alongside PP_AudioDecoderConfig. + */ +struct PP_AudioDecoderConfig { + /** + * The audio codec to initialize. + */ + PP_AudioCodec codec; + /** + * Number of audio channels. + */ + int32_t channel_count; + /** + * Size of each audio channel. + */ + int32_t bits_per_channel; + /** + * Audio sampling rate. + */ + int32_t samples_per_second; + /** + * Client-specified identifier for the associated audio decoder initialization + * request. By using this value, the client can associate a decoder + * initialization status response with an initialization request. + */ + uint32_t request_id; +}; +PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_AudioDecoderConfig, 20); +/** + * @} + */ + +/** + * @addtogroup Enums + * @{ + */ +/** + * PP_VideoCodec contains video codec type constants. + */ +typedef enum { + PP_VIDEOCODEC_UNKNOWN = 0, + PP_VIDEOCODEC_VP8 = 1, + PP_VIDEOCODEC_H264 = 2, + PP_VIDEOCODEC_VP9 = 3 +} PP_VideoCodec; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_VideoCodec, 4); + +/** + * PP_VideoCodecProfile contains video codec profile type + * constants required for video decoder configuration. + *. + */ +typedef enum { + PP_VIDEOCODECPROFILE_UNKNOWN = 0, + PP_VIDEOCODECPROFILE_NOT_NEEDED = 1, + PP_VIDEOCODECPROFILE_H264_BASELINE = 2, + PP_VIDEOCODECPROFILE_H264_MAIN = 3, + PP_VIDEOCODECPROFILE_H264_EXTENDED = 4, + PP_VIDEOCODECPROFILE_H264_HIGH = 5, + PP_VIDEOCODECPROFILE_H264_HIGH_10 = 6, + PP_VIDEOCODECPROFILE_H264_HIGH_422 = 7, + PP_VIDEOCODECPROFILE_H264_HIGH_444_PREDICTIVE = 8 +} PP_VideoCodecProfile; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_VideoCodecProfile, 4); +/** + * @} + */ + +/** + * @addtogroup Structs + * @{ + */ +/** + * PP_VideoDecoderConfig contains video decoder configuration + * information required to initialize video decoders, and a request ID + * that allows clients to associate a decoder initialization request with a + * status response. Note: When codec requires extra data for + * initialization, the data is sent as a PP_Resource carried + * alongside PP_VideoDecoderConfig. + */ +struct PP_VideoDecoderConfig { + /** + * The video codec to initialize. + */ + PP_VideoCodec codec; + /** + * Profile to use when initializing the video codec. + */ + PP_VideoCodecProfile profile; + /** + * Output video format. + */ + PP_DecryptedFrameFormat format; + /** + * Width of decoded video frames, in pixels. + */ + int32_t width; + /** + * Height of decoded video frames, in pixels. + */ + int32_t height; + /** + * Client-specified identifier for the associated video decoder initialization + * request. By using this value, the client can associate a decoder + * initialization status response with an initialization request. + */ + uint32_t request_id; +}; +PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_VideoDecoderConfig, 24); +/** + * @} + */ + +/** + * @addtogroup Enums + * @{ + */ +/** + * PP_DecryptorStreamType contains stream type constants. + */ +typedef enum { + PP_DECRYPTORSTREAMTYPE_AUDIO = 0, + PP_DECRYPTORSTREAMTYPE_VIDEO = 1 +} PP_DecryptorStreamType; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_DecryptorStreamType, 4); + +/** + * PP_SessionType contains session type constants. + */ +typedef enum { + PP_SESSIONTYPE_TEMPORARY = 0, + PP_SESSIONTYPE_PERSISTENT_LICENSE = 1, + PP_SESSIONTYPE_PERSISTENT_RELEASE = 2 +} PP_SessionType; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_SessionType, 4); + +/** + * PP_InitDataType contains Initialization Data Type constants. + */ +typedef enum { + PP_INITDATATYPE_CENC = 0, + PP_INITDATATYPE_KEYIDS = 1, + PP_INITDATATYPE_WEBM = 2 +} PP_InitDataType; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_InitDataType, 4); + +/** + * PP_CdmExceptionCode contains exception code constants. + */ +typedef enum { + PP_CDMEXCEPTIONCODE_NOTSUPPORTEDERROR = 1, + PP_CDMEXCEPTIONCODE_INVALIDSTATEERROR = 2, + PP_CDMEXCEPTIONCODE_INVALIDACCESSERROR = 3, + PP_CDMEXCEPTIONCODE_QUOTAEXCEEDEDERROR = 4, + PP_CDMEXCEPTIONCODE_UNKNOWNERROR = 5, + PP_CDMEXCEPTIONCODE_CLIENTERROR = 6, + PP_CDMEXCEPTIONCODE_OUTPUTERROR = 7 +} PP_CdmExceptionCode; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_CdmExceptionCode, 4); + +/** + * PP_CdmMessageType contains message type constants. + */ +typedef enum { + PP_CDMMESSAGETYPE_LICENSE_REQUEST = 0, + PP_CDMMESSAGETYPE_LICENSE_RENEWAL = 1, + PP_CDMMESSAGETYPE_LICENSE_RELEASE = 2 +} PP_CdmMessageType; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_CdmMessageType, 4); + +/** + * PP_CdmKeyStatus contains key status constants. + */ +typedef enum { + PP_CDMKEYSTATUS_USABLE = 0, + PP_CDMKEYSTATUS_INVALID = 1, + PP_CDMKEYSTATUS_EXPIRED = 2, + PP_CDMKEYSTATUS_OUTPUTRESTRICTED = 3, + PP_CDMKEYSTATUS_OUTPUTDOWNSCALED = 4, + PP_CDMKEYSTATUS_STATUSPENDING = 5, + PP_CDMKEYSTATUS_RELEASED = 6 +} PP_CdmKeyStatus; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_CdmKeyStatus, 4); +/** + * @} + */ + +/** + * @addtogroup Structs + * @{ + */ +/** + * The PP_KeyInformation struct contains information about a + * key used for decryption. + */ +struct PP_KeyInformation { + /** + * Key ID. + */ + uint8_t key_id[512]; + uint32_t key_id_size; + /** + * Status of this key. + */ + PP_CdmKeyStatus key_status; + /** + * Optional error code for keys that are not usable. + */ + uint32_t system_code; +}; +PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_KeyInformation, 524); +/** + * @} + */ + +/* private/pp_file_handle.idl */ + +#ifdef _WIN32 +#include +typedef HANDLE PP_FileHandle; +static const PP_FileHandle PP_kInvalidFileHandle = NULL; + +#else +typedef int PP_FileHandle; +static const PP_FileHandle PP_kInvalidFileHandle = -1; +#endif + +/* private/pp_private_font_charset.idl */ +/** + * @addtogroup Enums + * @{ + */ +typedef enum { + PP_PRIVATEFONTCHARSET_ANSI = 0, + PP_PRIVATEFONTCHARSET_DEFAULT = 1, + PP_PRIVATEFONTCHARSET_SYMBOL = 2, + PP_PRIVATEFONTCHARSET_MAC = 77, + PP_PRIVATEFONTCHARSET_SHIFTJIS = 128, + PP_PRIVATEFONTCHARSET_HANGUL = 129, + PP_PRIVATEFONTCHARSET_JOHAB = 130, + PP_PRIVATEFONTCHARSET_GB2312 = 134, + PP_PRIVATEFONTCHARSET_CHINESEBIG5 = 136, + PP_PRIVATEFONTCHARSET_GREEK = 161, + PP_PRIVATEFONTCHARSET_TURKISH = 162, + PP_PRIVATEFONTCHARSET_VIETNAMESE = 163, + PP_PRIVATEFONTCHARSET_HEBREW = 177, + PP_PRIVATEFONTCHARSET_ARABIC = 178, + PP_PRIVATEFONTCHARSET_BALTIC = 186, + PP_PRIVATEFONTCHARSET_RUSSIAN = 204, + PP_PRIVATEFONTCHARSET_THAI = 222, + PP_PRIVATEFONTCHARSET_EASTEUROPE = 238, + PP_PRIVATEFONTCHARSET_OEM = 255 +} PP_PrivateFontCharset; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_PrivateFontCharset, 4); +/** + * @} + */ + +/* private/pp_video_capture_format.idl */ +/** + * @addtogroup Structs + * @{ + */ +/** + * The PP_VideoCaptureFormat struct represents a video capture + * format. + */ +struct PP_VideoCaptureFormat { + /** + * Frame size in pixels. + */ + struct PP_Size frame_size; + /** + * Frame rate in frames per second. + */ + float frame_rate; +}; +PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_VideoCaptureFormat, 12); +/** + * @} + */ + +/* private/pp_video_frame_private.idl */ +/** + * @addtogroup Structs + * @{ + */ +/** + * The PP_VideoFrame_Private struct represents a video frame. + * Video sources and destinations use frames to transfer video to and from + * the browser. + */ +struct PP_VideoFrame_Private { + /** + * A timestamp placing the frame in a video stream. + */ + PP_TimeTicks timestamp; + /** + * An image data resource to hold the video frame. + */ + PP_Resource image_data; + /** + * Ensure that this struct is 16-bytes wide by padding the end. In some + * compilers, PP_TimeTicks is 8-byte aligned, so those compilers align this + * struct on 8-byte boundaries as well and pad it to 8 bytes even without this + * padding attribute. This padding makes its size consistent across + * compilers. + */ + int32_t padding; +}; +PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_VideoFrame_Private, 16); +/** + * @} + */ + +/* private/ppb_camera_capabilities_private.idl */ +/** + * @addtogroup Interfaces + * @{ + */ +/** + * The PPB_CameraCapabilities_Private interface contains pointers + * to several functions for getting the image capture capabilities within the + * browser. + */ +struct PPB_CameraCapabilities_Private_0_1 { + /** + * IsCameraCapabilities() determines if the given resource is a + * PPB_CameraCapabilities_Private. + * + * @param[in] resource A PP_Resource corresponding to an image + * capture capabilities resource. + * + * @return A PP_Bool containing PP_TRUE if the given + * resource is an PP_CameraCapabilities_Private resource, + * otherwise PP_FALSE. + */ + PP_Bool (*IsCameraCapabilities)(PP_Resource resource); + /** + * GetSupportedVideoCaptureFormats() returns the supported video capture + * formats for the given PPB_CameraCapabilities_Private. + * + * @param[in] capabilities A PP_Resource corresponding to an + * image capture capabilities resource. + * @param[out] array_size The size of preview size array. + * @param[out] formats An array of PP_VideoCaptureFormat + * corresponding to the supported video capture formats. The ownership of the + * array belongs to PPB_CameraCapabilities_Private and the caller + * should not free it. When a PPB_CameraCapabilities_Private is deleted, the + * array returning from this is no longer valid. + */ + void (*GetSupportedVideoCaptureFormats)( + PP_Resource capabilities, + uint32_t* array_size, + struct PP_VideoCaptureFormat** formats); +}; + +typedef struct PPB_CameraCapabilities_Private_0_1 + PPB_CameraCapabilities_Private; +/** + * @} + */ + +/* private/ppb_camera_device_private.idl */ +/** + * @addtogroup Interfaces + * @{ + */ +/** + * To query camera capabilities: + * 1. Get a PPB_CameraDevice_Private object by Create(). + * 2. Open() camera device with track id of MediaStream video track. + * 3. Call GetCameraCapabilities() to get a + * PPB_CameraCapabilities_Private object, which can be used to + * query camera capabilities. + */ +struct PPB_CameraDevice_Private_0_1 { + /** + * Creates a PPB_CameraDevice_Private resource. + * + * @param[in] instance A PP_Instance identifying one instance + * of a module. + * + * @return A PP_Resource corresponding to a + * PPB_CameraDevice_Private resource if successful, 0 if failed. + */ + PP_Resource (*Create)(PP_Instance instance); + /** + * Determines if a resource is a camera device resource. + * + * @param[in] resource The PP_Resource to test. + * + * @return A PP_Bool with PP_TRUE if the given + * resource is a camera device resource or PP_FALSE + * otherwise. + */ + PP_Bool (*IsCameraDevice)(PP_Resource resource); + /** + * Opens a camera device. + * + * @param[in] camera_device A PP_Resource corresponding to a + * camera device resource. + * @param[in] device_id A PP_Var identifying a camera device. The + * type is string. The ID can be obtained from MediaStreamTrack.getSources() + * or MediaStreamVideoTrack.id. + * @param[in] callback A PP_CompletionCallback to be called upon + * completion of Open(). + * + * @return An error code from pp_errors.h. + */ + int32_t (*Open)(PP_Resource camera_device, + struct PP_Var device_id, + struct PP_CompletionCallback callback); + /** + * Disconnects from the camera and cancels all pending requests. + * After this returns, no callbacks will be called. If + * PPB_CameraDevice_Private is destroyed and is not closed yet, this + * function will be automatically called. Calling this more than once has no + * effect. + * + * @param[in] camera_device A PP_Resource corresponding to a + * camera device resource. + */ + void (*Close)(PP_Resource camera_device); + /** + * Gets the camera capabilities. + * + * The camera capabilities do not change for a given camera source. + * + * @param[in] camera_device A PP_Resource corresponding to a + * camera device resource. + * @param[out] capabilities A PPB_CameraCapabilities_Private for + * storing the camera capabilities on success. Otherwise, the value will not + * be changed. + * @param[in] callback PP_CompletionCallback to be called upon + * completion of GetCameraCapabilities(). + * + * @return An int32_t containing a result code from pp_errors.h. + */ + int32_t (*GetCameraCapabilities)(PP_Resource camera_device, + PP_Resource* capabilities, + struct PP_CompletionCallback callback); +}; + +typedef struct PPB_CameraDevice_Private_0_1 PPB_CameraDevice_Private; +/** + * @} + */ + +/* private/ppb_content_decryptor_private.idl */ +/** + * @addtogroup Interfaces + * @{ + */ +/** + * PPB_ContentDecryptor_Private structure contains the function + * pointers the browser must implement to support plugins implementing the + * PPP_ContentDecryptor_Private interface. This interface provides + * browser side support for the Content Decryption Module (CDM) for Encrypted + * Media Extensions: http://www.w3.org/TR/encrypted-media/ + */ +struct PPB_ContentDecryptor_Private_0_14 { + /** + * A promise has been resolved by the CDM. + * + * @param[in] promise_id Identifies the promise that the CDM resolved. + */ + void (*PromiseResolved)(PP_Instance instance, uint32_t promise_id); + /** + * A promise that resulted in a new session has been resolved by the CDM. + * + * @param[in] promise_id Identifies the promise that the CDM resolved. + * + * @param[in] session_id A PP_Var of type + * PP_VARTYPE_STRING containing the session's ID attribute. + */ + void (*PromiseResolvedWithSession)(PP_Instance instance, + uint32_t promise_id, + struct PP_Var session_id); + /** + * A promise has been rejected by the CDM due to an error. + * + * @param[in] promise_id Identifies the promise that the CDM rejected. + * + * @param[in] exception_code A PP_CdmExceptionCode containing + * the exception code. + * + * @param[in] system_code A system error code. + * + * @param[in] error_description A PP_Var of type + * PP_VARTYPE_STRING containing the error description. + */ + void (*PromiseRejected)(PP_Instance instance, + uint32_t promise_id, + PP_CdmExceptionCode exception_code, + uint32_t system_code, + struct PP_Var error_description); + /** + * A message or request has been generated for key_system in the CDM, and + * must be sent to the web application. + * + * For example, when the browser invokes CreateSession() + * on the PPP_ContentDecryptor_Private interface, the plugin + * must send a message containing the license request. + * + * Note that SessionMessage() can be used for purposes other than + * responses to CreateSession() calls. See also the text + * in the comment for SessionReady(), which describes a sequence + * of UpdateSession() and SessionMessage() calls + * required to prepare for decryption. + * + * @param[in] session_id A PP_Var of type + * PP_VARTYPE_STRING containing the ID of a session for + * which this message is intended. + * + * @param[in] message_type A PP_CdmMessageType containing the + * message type. + * + * @param[in] message A PP_Var of type + * PP_VARTYPE_ARRAY_BUFFER that contains the message. + * + * @param[in] legacy_destination_url A PP_Var of type + * PP_VARTYPE_STRING containing the destination URL for the + * message. + */ + void (*SessionMessage)(PP_Instance instance, + struct PP_Var session_id, + PP_CdmMessageType message_type, + struct PP_Var message, + struct PP_Var legacy_destination_url); + /** + * The keys for a session have changed. + * + * @param[in] session_id A PP_Var of type + * PP_VARTYPE_STRING containing the ID of the session that has + * a change in keys. + * + * @param[in] has_additional_usable_key A PP_Bool indicating if + * a new usable key has been added. + * + * @param[in] key_count The number of arguments contained in + * key_information + * + * @param[in] key_information An array of type PP_KeyInformation + * that are the session's key IDs and their status. + */ + void (*SessionKeysChange)(PP_Instance instance, + struct PP_Var session_id, + PP_Bool has_additional_usable_key, + uint32_t key_count, + const struct PP_KeyInformation key_information[]); + /** + * The expiration time for a session has changed. + * + * @param[in] session_id A PP_Var of type + * PP_VARTYPE_STRING containing the ID of the session that has + * a new expiration time. + * + * @param[in] new_expiry_time A PP_Time indicating the new + * expiry time of the session. The value is defined as the number of seconds + * since the Epoch (00:00:00 UTC, January 1, 1970). + */ + void (*SessionExpirationChange)(PP_Instance instance, + struct PP_Var session_id, + PP_Time new_expiry_time); + /** + * The session has been closed as the result of a call to the + * ReleaseSession() method on the + * PPP_ContentDecryptor_Private interface, or due to other + * factors as determined by the CDM. + * + * @param[in] session_id A PP_Var of type + * PP_VARTYPE_STRING containing the session's ID attribute of + * the session that is now closed. + */ + void (*SessionClosed)(PP_Instance instance, struct PP_Var session_id); + /** + * An error occurred in a PPP_ContentDecryptor_Private method, + * or within the plugin implementing the interface. + * + * @param[in] session_id A PP_Var of type + * PP_VARTYPE_STRING containing the session's ID attribute of + * the session that caused the error. + * + * @param[in] exception_code A PP_CdmExceptionCode containing + * the exception code. + * + * @param[in] system_code A system error code. + * + * @param[in] error_description A PP_Var of type + * PP_VARTYPE_STRING containing the error description. + */ + void (*LegacySessionError)(PP_Instance instance, + struct PP_Var session_id, + PP_CdmExceptionCode exception_code, + uint32_t system_code, + struct PP_Var error_description); + /** + * Called after the Decrypt() method on the + * PPP_ContentDecryptor_Private interface completes to + * deliver decrypted_block to the browser for decoding and rendering. + * + * The plugin must not hold a reference to the encrypted buffer resource + * provided to Decrypt() when it calls this method. The browser + * will reuse the buffer in a subsequent Decrypt() call. + * + * @param[in] decrypted_block A PP_Resource corresponding to a + * PPB_Buffer_Dev resource that contains a decrypted data + * block. + * + * @param[in] decrypted_block_info A PP_DecryptedBlockInfo that + * contains the result code and tracking info associated with the + * decrypted_block. + */ + void (*DeliverBlock)( + PP_Instance instance, + PP_Resource decrypted_block, + const struct PP_DecryptedBlockInfo* decrypted_block_info); + /** + * Called after the InitializeAudioDecoder() or + * InitializeVideoDecoder() method on the + * PPP_ContentDecryptor_Private interface completes to report + * decoder initialization status to the browser. + * + * @param[in] success A PP_Bool that is set to + * PP_TRUE when the decoder initialization request associated + * with request_id was successful. + * + * @param[in] decoder_type A PP_DecryptorStreamType identifying + * the decoder type for which this initialization status response was sent. + * + * @param[in] request_id The request_id value passed to + * InitializeAudioDecoder or InitializeVideoDecoder + * in PP_AudioDecoderConfig or + * PP_VideoDecoderConfig. + */ + void (*DecoderInitializeDone)(PP_Instance instance, + PP_DecryptorStreamType decoder_type, + uint32_t request_id, + PP_Bool success); + /** + * Called after the DeinitializeDecoder() method on the + * PPP_ContentDecryptor_Private interface completes to report + * decoder de-initialization completion to the browser. + * + * @param[in] decoder_type The PP_DecryptorStreamType passed to + * DeinitializeDecoder(). + * + * @param[in] request_id The request_id value passed to + * DeinitializeDecoder(). + */ + void (*DecoderDeinitializeDone)(PP_Instance instance, + PP_DecryptorStreamType decoder_type, + uint32_t request_id); + /** + * Called after the ResetDecoder() method on the + * PPP_ContentDecryptor_Private interface completes to report + * decoder reset completion to the browser. + * + * @param[in] decoder_type The PP_DecryptorStreamType passed to + * ResetDecoder(). + * + * @param[in] request_id The request_id value passed to + * ResetDecoder(). + */ + void (*DecoderResetDone)(PP_Instance instance, + PP_DecryptorStreamType decoder_type, + uint32_t request_id); + /** + * Called after the DecryptAndDecode() method on the + * PPP_ContentDecryptor_Private interface completes to deliver + * a decrypted and decoded video frame to the browser for rendering. + * + * The plugin must not hold a reference to the encrypted buffer resource + * provided to DecryptAndDecode() when it calls this method. The + * browser will reuse the buffer in a subsequent + * DecryptAndDecode() call. + * + * @param[in] decrypted_frame A PP_Resource corresponding to a + * PPB_Buffer_Dev resource that contains a video frame. + * + * @param[in] decrypted_frame_info A PP_DecryptedFrameInfo that + * contains the result code, tracking info, and buffer format associated with + * decrypted_frame. + */ + void (*DeliverFrame)( + PP_Instance instance, + PP_Resource decrypted_frame, + const struct PP_DecryptedFrameInfo* decrypted_frame_info); + /** + * Called after the DecryptAndDecode() method on the + * PPP_ContentDecryptor_Private interface completes to deliver + * a buffer of decrypted and decoded audio samples to the browser for + * rendering. + * + * The plugin must not hold a reference to the encrypted buffer resource + * provided to DecryptAndDecode() when it calls this method. The + * browser will reuse the buffer in a subsequent + * DecryptAndDecode() call. + * + * audio_frames can contain multiple audio output buffers. Each + * buffer is serialized in this format: + * + * |<------------------- serialized audio buffer ------------------->| + * | int64_t timestamp | int64_t length | length bytes of audio data | + * + * For example, with three audio output buffers, |audio_frames| will look + * like this: + * + * |<---------------- audio_frames ------------------>| + * | audio buffer 0 | audio buffer 1 | audio buffer 2 | + * + * @param[in] audio_frames A PP_Resource corresponding to a + * PPB_Buffer_Dev resource that contains a decrypted buffer + * of decoded audio samples. + * + * @param[in] decrypted_sample_info A PP_DecryptedSampleInfo that + * contains the tracking info and result code associated with the decrypted + * samples. + */ + void (*DeliverSamples)( + PP_Instance instance, + PP_Resource audio_frames, + const struct PP_DecryptedSampleInfo* decrypted_sample_info); +}; + +typedef struct PPB_ContentDecryptor_Private_0_14 PPB_ContentDecryptor_Private; +/** + * @} + */ + +/* private/ppb_display_color_profile_private.idl */ +/** + * @addtogroup Interfaces + * @{ + */ +/** + * PPB_DisplayColorProfile_Private defines the methods for getting + * the display color profile and monitoring its changes. + * + * Setup: + * @code + * PP_ArrayOutput output = { MyAllocatorFunction, color_profile_data }; + * PP_Resource display_cp = display_cp_interface->Create(instance); + * display_cp_interface->GetColorProfile(display_cp, + * output, + * completion_callback); + * @endcode + */ +struct PPB_DisplayColorProfile_Private_0_1 { + /** + * Create() creates a display color profile resource. + * + * @param[in] instance The module instance. + * @return A PP_Resource containing a display color profile + * resource. + */ + PP_Resource (*Create)(PP_Instance instance); + /** + * IsDisplayColorProfile() determines if the given resource is a valid + * DisplayColorProfile resource. + * + * @param[in] resource A DisplayColorProfile context resource. + * @return Returns: + * - PP_TRUE if the given resource is a valid + * DisplayColorProfile + * - PP_FALSE if it is an invalid resource or is a resource + * of another type. + */ + PP_Bool (*IsDisplayColorProfile)(PP_Resource resource); + /** + * GetColorProfile() enqueues a request for the current display color profile. + * + * This method is intended for getting the color profile data of the display + * on which the browser window resides. [However currently Chrome only + * considers the system's primary display color profile when doing its color + * management. For consistency this method will also return the color profile + * that Chrome uses for its browser window.] + * + * @param[in] display_color_profile_res The display color profile resource. + * @param[in] color_profile A PP_OutputArray which on success + * will receive a byte array containing the ICC color profile data (see + * www.color.org for a reference to the ICC color profile specification + * and versions). The returned color profile version is the one supported by + * the host system. + * @param[in] callback The completion callback to be called once the display + * color profile data is available. + * + * @return Returns an error code from pp_errors.h. + */ + int32_t (*GetColorProfile)(PP_Resource display_color_profile_res, + struct PP_ArrayOutput color_profile, + struct PP_CompletionCallback callback); + /** + * RegisterColorProfileChangeCallback() registers a callback to be called next + * time the color profile for the browser window in which the plugin resides + * changes. In order to get notifications for all color profile changes a call + * to RegisterColorProfileChangeCallback() function should be done when the + * previous notification was fired. + * + * There might be 2 scenarios in which the color profile for a window changes: + * a) The window is moved from one display to another; + * b) The user changes the display color space from the system settings. + * + * @param[in] display_color_profile_res The display color profile resource. + * @param[in] callback The callback to be invoked next time the display + * color profile changes. + * + * @return Returns an error code from pp_errors.h. + */ + int32_t (*RegisterColorProfileChangeCallback)( + PP_Resource display_color_profile_res, + struct PP_CompletionCallback callback); +}; + +typedef struct PPB_DisplayColorProfile_Private_0_1 + PPB_DisplayColorProfile_Private; +/** + * @} + */ + +/* private/ppb_ext_crx_file_system_private.idl */ +/** + * @addtogroup Interfaces + * @{ + */ +/* PPB_Ext_CrxFileSystem_Private interface */ +struct PPB_Ext_CrxFileSystem_Private_0_1 { + /** + * Open() opens the CRX file system for the current extension. It will fail + * when called from non-extension context. + * + * @param[in] crxfs A PP_Resource corresponding to a + * CrxFileSystem. + * @param[out] file_system An output PP_Resource corresponding + * to a PPB_FileSystem. + * @param[in] callback A PP_CompletionCallback to be called upon + * completion of Open. + * + * @return An int32_t containing an error code from pp_errors.h. + */ + int32_t (*Open)(PP_Instance instance, + PP_Resource* file_system, + struct PP_CompletionCallback callback); +}; + +typedef struct PPB_Ext_CrxFileSystem_Private_0_1 PPB_Ext_CrxFileSystem_Private; +/** + * @} + */ + +/* private/ppb_file_io_private.idl */ +#include "ppapi/c/private/pp_file_handle.h" + +/** + * @addtogroup Interfaces + * @{ + */ +/* PPB_FileIO_Private interface */ +struct PPB_FileIO_Private_0_1 { + /** + * Returns a file handle corresponding to the given FileIO + * object. The FileIO object must have been opened with a + * successful call to FileIO::Open. The caller gets the ownership + * of the returned file handle and must close it. + */ + int32_t (*RequestOSFileHandle)(PP_Resource file_io, + PP_FileHandle* handle, + struct PP_CompletionCallback callback); +}; + +typedef struct PPB_FileIO_Private_0_1 PPB_FileIO_Private; +/** + * @} + */ + +/* private/ppb_file_ref_private.idl */ +/** + * @addtogroup Interfaces + * @{ + */ +/* PPB_FileRefPrivate interface */ +struct PPB_FileRefPrivate_0_1 { + /** + * GetAbsolutePath() returns the absolute path of the file. + * + * @param[in] file_ref A PP_Resource corresponding to a file + * reference. + * + * @return A PP_Var containing the absolute path of the file. + */ + struct PP_Var (*GetAbsolutePath)(PP_Resource file_ref); +}; + +typedef struct PPB_FileRefPrivate_0_1 PPB_FileRefPrivate; +/** + * @} + */ + +/* private/ppb_find_private.idl */ +/** + * @addtogroup Interfaces + * @{ + */ +/** + * This is a private interface for doing browser Find in the PDF plugin. + */ +struct PPB_Find_Private_0_3 { + /** + * Sets the instance of this plugin as the mechanism that will be used to + * handle find requests in the renderer. This will only succeed if the plugin + * is embedded within the content of the top level frame. Note that this will + * result in the renderer handing over all responsibility for doing find to + * the plugin and content from the rest of the page will not be searched. + * + * + * In the case that the plugin is loaded directly as the top level document, + * this function does not need to be called. In that case the plugin is + * assumed to handle find requests. + * + * There can only be one plugin which handles find requests. If a plugin calls + * this while an existing plugin is registered, the existing plugin will be + * de-registered and will no longer receive any requests. + */ + void (*SetPluginToHandleFindRequests)(PP_Instance instance); + /** + * Updates the number of find results for the current search term. If + * there are no matches 0 should be passed in. Only when the plugin has + * finished searching should it pass in the final count with final_result set + * to PP_TRUE. + */ + void (*NumberOfFindResultsChanged)(PP_Instance instance, + int32_t total, + PP_Bool final_result); + /** + * Updates the index of the currently selected search item. + */ + void (*SelectedFindResultChanged)(PP_Instance instance, int32_t index); + /** + * Updates the tickmarks on the scrollbar for the find request. |tickmarks| + * contains |count| PP_Rects indicating the tickmark ranges. + */ + void (*SetTickmarks)(PP_Instance instance, + const struct PP_Rect tickmarks[], + uint32_t count); +}; + +typedef struct PPB_Find_Private_0_3 PPB_Find_Private; +/** + * @} + */ + +/* private/ppb_flash.idl */ +/** + * @addtogroup Enums + * @{ + */ +typedef enum { + /** + * No restrictions on Flash LSOs. + */ + PP_FLASHLSORESTRICTIONS_NONE = 1, + /** + * Don't allow access to Flash LSOs. + */ + PP_FLASHLSORESTRICTIONS_BLOCK = 2, + /** + * Store Flash LSOs in memory only. + */ + PP_FLASHLSORESTRICTIONS_IN_MEMORY = 3 +} PP_FlashLSORestrictions; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_FlashLSORestrictions, 4); + +typedef enum { + /** + * Specifies if the system likely supports 3D hardware acceleration. + * + * The result is a boolean PP_Var, depending on the supported nature of 3D + * acceleration. If querying this function returns true, the 3D system will + * normally use the native hardware for rendering which will be much faster. + * + * Having this set to true only means that 3D should be used to draw 2D and + * video elements. PP_FLASHSETTING_STAGE3D_ENABLED should be checked to + * determine if it's ok to use 3D for arbitrary content. + * + * In rare cases (depending on the platform) this value will be true but a + * created 3D context will use emulation because context initialization + * failed. + */ + PP_FLASHSETTING_3DENABLED = 1, + /** + * Specifies if the given instance is in private/incognito/off-the-record mode + * (returns true) or "regular" mode (returns false). Returns an undefined + * PP_Var on invalid instance. + */ + PP_FLASHSETTING_INCOGNITO = 2, + /** + * Specifies if arbitrary 3d commands are supported (returns true), or if 3d + * should only be used for drawing 2d and video (returns false). + * + * This should only be enabled if PP_FLASHSETTING_3DENABLED is true. + */ + PP_FLASHSETTING_STAGE3DENABLED = 3, + /** + * Specifies the string for the language code of the UI of the browser. + * + * For example: "en-US" or "de". + * + * Returns an undefined PP_Var on invalid instance. + */ + PP_FLASHSETTING_LANGUAGE = 4, + /** + * Specifies the number of CPU cores that are present on the system. + */ + PP_FLASHSETTING_NUMCORES = 5, + /** + * Specifies restrictions on how flash should handle LSOs. The result is an + * int from PP_FlashLSORestrictions. + */ + PP_FLASHSETTING_LSORESTRICTIONS = 6, + /** + * Specifies if the driver is reliable enough to use Shader Model 3 commands + * with it. + * + * This should only be enabled if PP_FLASHSETTING_STAGE3DENABLED is true. + */ + PP_FLASHSETTING_STAGE3DBASELINEENABLED = 7 +} PP_FlashSetting; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_FlashSetting, 4); + +/** + * This enum provides keys for setting breakpad crash report data. + */ +typedef enum { + /** + * Specifies the document URL which contains the flash instance. + */ + PP_FLASHCRASHKEY_URL = 1, + /** + * Specifies the URL of the current swf. + */ + PP_FLASHCRASHKEY_RESOURCE_URL = 2 +} PP_FlashCrashKey; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_FlashCrashKey, 4); +/** + * @} + */ + +/** + * @addtogroup Interfaces + * @{ + */ +/** + * The PPB_Flash interface contains pointers to various functions + * that are only needed to support Pepper Flash. + */ +struct PPB_Flash_13_0 { + /** + * Sets or clears the rendering hint that the given plugin instance is always + * on top of page content. Somewhat more optimized painting can be used in + * this case. + */ + void (*SetInstanceAlwaysOnTop)(PP_Instance instance, PP_Bool on_top); + /** + * Draws the given pre-laid-out text. It is almost equivalent to Windows' + * ExtTextOut with the addition of the transformation (a 3x3 matrix given the + * transform to apply before drawing). It also adds the allow_subpixel_aa + * flag which when true, will use subpixel antialiasing if enabled in the + * system settings. For this to work properly, the graphics layer that the + * text is being drawn into must be opaque. + */ + PP_Bool (*DrawGlyphs)( + PP_Instance instance, + PP_Resource pp_image_data, + const struct PP_BrowserFont_Trusted_Description* font_desc, + uint32_t color, + const struct PP_Point* position, + const struct PP_Rect* clip, + const float transformation[3][3], + PP_Bool allow_subpixel_aa, + uint32_t glyph_count, + const uint16_t glyph_indices[], + const struct PP_Point glyph_advances[]); + /** + * Retrieves the proxy that will be used for the given URL. The result will + * be a string in PAC format, or an undefined var on error. + */ + struct PP_Var (*GetProxyForURL)(PP_Instance instance, const char* url); + /** + * Navigate to the URL given by the given URLRequestInfo. (This supports GETs, + * POSTs, and javascript: URLs.) May open a new tab if target is not "_self". + */ + int32_t (*Navigate)(PP_Resource request_info, + const char* target, + PP_Bool from_user_action); + /** + * Retrieves the local time zone offset from GM time for the given UTC time. + */ + double (*GetLocalTimeZoneOffset)(PP_Instance instance, PP_Time t); + /** + * Gets a (string) with "command-line" options for Flash; used to pass + * run-time debugging parameters, etc. + */ + struct PP_Var (*GetCommandLineArgs)(PP_Module module); + /** + * Loads the given font in a more privileged process on Windows. Call this if + * Windows is giving errors for font calls. See + * content/renderer/font_cache_dispatcher_win.cc + * + * The parameter is a pointer to a LOGFONTW structure. + * + * On non-Windows platforms, this function does nothing. + */ + void (*PreloadFontWin)(const void* logfontw); + /** + * Returns whether the given rectangle (in the plugin) is topmost, i.e., above + * all other web content. + */ + PP_Bool (*IsRectTopmost)(PP_Instance instance, const struct PP_Rect* rect); + /** + * Indicates that there's activity and, e.g., the screensaver shouldn't kick + * in. + */ + void (*UpdateActivity)(PP_Instance instance); + /** + * Returns the value associated with the given setting. Invalid enums will + * result in an undefined PP_Var return value. + */ + struct PP_Var (*GetSetting)(PP_Instance instance, PP_FlashSetting setting); + /** + * Allows setting breakpad crash data which will be included in plugin crash + * reports. Returns PP_FALSE if crash data could not be set. + */ + PP_Bool (*SetCrashData)(PP_Instance instance, + PP_FlashCrashKey key, + struct PP_Var value); + /** + * Enumerates video capture devices. |video_capture| is a valid + * PPB_VideoCapture_Dev resource. Once the operation has completed + * successfully, |devices| will be set up with an array of + * PPB_DeviceRef_Dev resources. + * + * PP_OK is returned on success and different pepper error code on failure. + * The ref count of the returned |devices| has already been increased by 1 for + * the caller. + * + * NOTE: This method is a synchronous version of |EnumerateDevices| in + * PPB_VideoCapture_Dev. + */ + int32_t (*EnumerateVideoCaptureDevices)(PP_Instance instance, + PP_Resource video_capture, + struct PP_ArrayOutput devices); +}; + +typedef struct PPB_Flash_13_0 PPB_Flash; + +struct PPB_Flash_12_4 { + void (*SetInstanceAlwaysOnTop)(PP_Instance instance, PP_Bool on_top); + PP_Bool (*DrawGlyphs)( + PP_Instance instance, + PP_Resource pp_image_data, + const struct PP_BrowserFont_Trusted_Description* font_desc, + uint32_t color, + const struct PP_Point* position, + const struct PP_Rect* clip, + const float transformation[3][3], + PP_Bool allow_subpixel_aa, + uint32_t glyph_count, + const uint16_t glyph_indices[], + const struct PP_Point glyph_advances[]); + struct PP_Var (*GetProxyForURL)(PP_Instance instance, const char* url); + int32_t (*Navigate)(PP_Resource request_info, + const char* target, + PP_Bool from_user_action); + void (*RunMessageLoop)(PP_Instance instance); + void (*QuitMessageLoop)(PP_Instance instance); + double (*GetLocalTimeZoneOffset)(PP_Instance instance, PP_Time t); + struct PP_Var (*GetCommandLineArgs)(PP_Module module); + void (*PreloadFontWin)(const void* logfontw); + PP_Bool (*IsRectTopmost)(PP_Instance instance, const struct PP_Rect* rect); + int32_t (*InvokePrinting)(PP_Instance instance); + void (*UpdateActivity)(PP_Instance instance); + struct PP_Var (*GetDeviceID)(PP_Instance instance); + int32_t (*GetSettingInt)(PP_Instance instance, PP_FlashSetting setting); + struct PP_Var (*GetSetting)(PP_Instance instance, PP_FlashSetting setting); +}; + +struct PPB_Flash_12_5 { + void (*SetInstanceAlwaysOnTop)(PP_Instance instance, PP_Bool on_top); + PP_Bool (*DrawGlyphs)( + PP_Instance instance, + PP_Resource pp_image_data, + const struct PP_BrowserFont_Trusted_Description* font_desc, + uint32_t color, + const struct PP_Point* position, + const struct PP_Rect* clip, + const float transformation[3][3], + PP_Bool allow_subpixel_aa, + uint32_t glyph_count, + const uint16_t glyph_indices[], + const struct PP_Point glyph_advances[]); + struct PP_Var (*GetProxyForURL)(PP_Instance instance, const char* url); + int32_t (*Navigate)(PP_Resource request_info, + const char* target, + PP_Bool from_user_action); + void (*RunMessageLoop)(PP_Instance instance); + void (*QuitMessageLoop)(PP_Instance instance); + double (*GetLocalTimeZoneOffset)(PP_Instance instance, PP_Time t); + struct PP_Var (*GetCommandLineArgs)(PP_Module module); + void (*PreloadFontWin)(const void* logfontw); + PP_Bool (*IsRectTopmost)(PP_Instance instance, const struct PP_Rect* rect); + int32_t (*InvokePrinting)(PP_Instance instance); + void (*UpdateActivity)(PP_Instance instance); + struct PP_Var (*GetDeviceID)(PP_Instance instance); + int32_t (*GetSettingInt)(PP_Instance instance, PP_FlashSetting setting); + struct PP_Var (*GetSetting)(PP_Instance instance, PP_FlashSetting setting); + PP_Bool (*SetCrashData)(PP_Instance instance, + PP_FlashCrashKey key, + struct PP_Var value); +}; + +struct PPB_Flash_12_6 { + void (*SetInstanceAlwaysOnTop)(PP_Instance instance, PP_Bool on_top); + PP_Bool (*DrawGlyphs)( + PP_Instance instance, + PP_Resource pp_image_data, + const struct PP_BrowserFont_Trusted_Description* font_desc, + uint32_t color, + const struct PP_Point* position, + const struct PP_Rect* clip, + const float transformation[3][3], + PP_Bool allow_subpixel_aa, + uint32_t glyph_count, + const uint16_t glyph_indices[], + const struct PP_Point glyph_advances[]); + struct PP_Var (*GetProxyForURL)(PP_Instance instance, const char* url); + int32_t (*Navigate)(PP_Resource request_info, + const char* target, + PP_Bool from_user_action); + void (*RunMessageLoop)(PP_Instance instance); + void (*QuitMessageLoop)(PP_Instance instance); + double (*GetLocalTimeZoneOffset)(PP_Instance instance, PP_Time t); + struct PP_Var (*GetCommandLineArgs)(PP_Module module); + void (*PreloadFontWin)(const void* logfontw); + PP_Bool (*IsRectTopmost)(PP_Instance instance, const struct PP_Rect* rect); + int32_t (*InvokePrinting)(PP_Instance instance); + void (*UpdateActivity)(PP_Instance instance); + struct PP_Var (*GetDeviceID)(PP_Instance instance); + int32_t (*GetSettingInt)(PP_Instance instance, PP_FlashSetting setting); + struct PP_Var (*GetSetting)(PP_Instance instance, PP_FlashSetting setting); + PP_Bool (*SetCrashData)(PP_Instance instance, + PP_FlashCrashKey key, + struct PP_Var value); + int32_t (*EnumerateVideoCaptureDevices)(PP_Instance instance, + PP_Resource video_capture, + struct PP_ArrayOutput devices); +}; +/** + * @} + */ + +/* private/ppb_flash_clipboard.idl */ +/** + * @addtogroup Enums + * @{ + */ +/** + * This enumeration contains the types of clipboards that can be accessed. + * These types correspond to clipboard types in WebKit. + */ +typedef enum { + /** The standard clipboard. */ + PP_FLASH_CLIPBOARD_TYPE_STANDARD = 0, + /** The selection clipboard (e.g., on Linux). */ + PP_FLASH_CLIPBOARD_TYPE_SELECTION = 1 +} PP_Flash_Clipboard_Type; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_Flash_Clipboard_Type, 4); + +/** + * This enumeration contains the predefined clipboard data formats. + */ +typedef enum { + /** Indicates an invalid or unsupported clipboard data format. */ + PP_FLASH_CLIPBOARD_FORMAT_INVALID = 0, + /** + * Indicates plaintext clipboard data. The format expected/returned is a + * PP_VARTYPE_STRING. + */ + PP_FLASH_CLIPBOARD_FORMAT_PLAINTEXT = 1, + /** + * Indicates HTML clipboard data. The format expected/returned is a + * PP_VARTYPE_STRING. + */ + PP_FLASH_CLIPBOARD_FORMAT_HTML = 2, + /** + * Indicates RTF clipboard data. The format expected/returned is a + * PP_VARTYPE_ARRAY_BUFFER. + */ + PP_FLASH_CLIPBOARD_FORMAT_RTF = 3 +} PP_Flash_Clipboard_Format; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_Flash_Clipboard_Format, 4); +/** + * @} + */ + +/** + * @addtogroup Interfaces + * @{ + */ +/** + * The PPB_Flash_Clipboard interface contains pointers to functions + * used by Pepper Flash to access the clipboard. + * + */ +struct PPB_Flash_Clipboard_5_1 { + /** + * Registers a custom clipboard format. The format is identified by a + * string. An id identifying the format will be returned if the format is + * successfully registered, which can be used to read/write data of that + * format. If the format has already been registered, the id associated with + * that format will be returned. If the format fails to be registered + * PP_FLASH_CLIPBOARD_FORMAT_INVALID will be returned. + * + * All custom data should be read/written as PP_Var array + * buffers. The clipboard format is pepper-specific meaning that although the + * data will be stored on the system clipboard, it can only be accessed in a + * sensible way by using the pepper API. Data stored in custom formats can + * be safely shared between different applications that use pepper. + */ + uint32_t (*RegisterCustomFormat)(PP_Instance instance_id, + const char* format_name); + /** + * Checks whether a given data format is available from the given clipboard. + * Returns true if the given format is available from the given clipboard. + */ + PP_Bool (*IsFormatAvailable)(PP_Instance instance_id, + PP_Flash_Clipboard_Type clipboard_type, + uint32_t format); + /** + * Reads data in the given format from the clipboard. An + * undefined PP_Var is returned if there is an error in reading + * the clipboard data and a null PP_Var is returned if there is + * no data of the specified format to read. + */ + struct PP_Var (*ReadData)(PP_Instance instance_id, + PP_Flash_Clipboard_Type clipboard_type, + uint32_t format); + /** + * Writes the given array of data items to the clipboard. All existing + * clipboard data in any format is erased before writing this data. Thus, + * passing an array of size 0 has the effect of clearing the clipboard without + * writing any data. Each data item in the array should have a different + * PP_Flash_Clipboard_Format. If multiple data items have the + * same format, only the last item with that format will be written. + * If there is an error writing any of the items in the array to the + * clipboard, none will be written and an error code is returned. + * The error code will be PP_ERROR_NOSPACE if the value is + * too large to be written, PP_ERROR_BADARGUMENT if a PP_Var + * cannot be converted into the format supplied or PP_FAILED + * if the format is not supported. + */ + int32_t (*WriteData)(PP_Instance instance_id, + PP_Flash_Clipboard_Type clipboard_type, + uint32_t data_item_count, + const uint32_t formats[], + const struct PP_Var data_items[]); + /** + * Gets a sequence number which uniquely identifies clipboard state. This can + * be used to version the data on the clipboard and determine whether it has + * changed. The sequence number will be placed in |sequence_number| and + * PP_TRUE returned if the sequence number was retrieved successfully. + */ + PP_Bool (*GetSequenceNumber)(PP_Instance instance_id, + PP_Flash_Clipboard_Type clipboard_type, + uint64_t* sequence_number); +}; + +typedef struct PPB_Flash_Clipboard_5_1 PPB_Flash_Clipboard; + +struct PPB_Flash_Clipboard_4_0 { + PP_Bool (*IsFormatAvailable)(PP_Instance instance_id, + PP_Flash_Clipboard_Type clipboard_type, + PP_Flash_Clipboard_Format format); + struct PP_Var (*ReadData)(PP_Instance instance_id, + PP_Flash_Clipboard_Type clipboard_type, + PP_Flash_Clipboard_Format format); + int32_t (*WriteData)(PP_Instance instance_id, + PP_Flash_Clipboard_Type clipboard_type, + uint32_t data_item_count, + const PP_Flash_Clipboard_Format formats[], + const struct PP_Var data_items[]); +}; + +struct PPB_Flash_Clipboard_5_0 { + uint32_t (*RegisterCustomFormat)(PP_Instance instance_id, + const char* format_name); + PP_Bool (*IsFormatAvailable)(PP_Instance instance_id, + PP_Flash_Clipboard_Type clipboard_type, + uint32_t format); + struct PP_Var (*ReadData)(PP_Instance instance_id, + PP_Flash_Clipboard_Type clipboard_type, + uint32_t format); + int32_t (*WriteData)(PP_Instance instance_id, + PP_Flash_Clipboard_Type clipboard_type, + uint32_t data_item_count, + const uint32_t formats[], + const struct PP_Var data_items[]); +}; +/** + * @} + */ + +/* private/ppb_flash_device_id.idl */ +/** + * @addtogroup Interfaces + * @{ + */ +/* TODO(raymes): This is deprecated by the PPB_Flash_DRM interface. Remove this + * interface after a few versions of Chrome have passed. */ +struct PPB_Flash_DeviceID_1_0 { + PP_Resource (*Create)(PP_Instance instance); + /** + * Asynchronously computes the device ID. When available, it will place the + * string in |*id| and will call the completion callback. On failure the + * given var will be PP_VARTYPE_UNDEFINED. + */ + int32_t (*GetDeviceID)(PP_Resource device_id, + struct PP_Var* id, + struct PP_CompletionCallback callback); +}; + +typedef struct PPB_Flash_DeviceID_1_0 PPB_Flash_DeviceID; +/** + * @} + */ + +/* private/ppb_flash_drm.idl */ +/** + * @addtogroup Interfaces + * @{ + */ +/** + * A resource for performing Flash DRM-related operations. + */ +struct PPB_Flash_DRM_1_1 { + /** + * Creates a PPB_Flash_DRM resource for performing DRM-related operations in + * Flash. + */ + PP_Resource (*Create)(PP_Instance instance); + /** + * Asynchronously computes the device ID. When available, it will place the + * string in |*id| and will call the completion callback. On failure the + * given var will be PP_VARTYPE_UNDEFINED. + */ + int32_t (*GetDeviceID)(PP_Resource drm, + struct PP_Var* id, + struct PP_CompletionCallback callback); + /** + * Windows and Mac only. Synchronously outputs the HMONITOR or + * CGDirectDisplayID corresponding to the monitor on which the plugin instance + * is displayed in |hmonitor|. This value is queried asynchronously and this + * will return PP_FALSE if the value is not yet available or an error + * occurred. PP_TRUE is returned on success. + */ + PP_Bool (*GetHmonitor)(PP_Resource drm, int64_t* hmonitor); + /** + * Asynchronously returns a PPB_FileRef resource in |file_ref| which points to + * the Voucher file for performing DRM verification. |callback| will be called + * upon completion. + */ + int32_t (*GetVoucherFile)(PP_Resource drm, + PP_Resource* file_ref, + struct PP_CompletionCallback callback); + /** + * Asynchronously returns a value indicating whether the monitor on which the + * plugin instance is displayed is external. |callback| will be called upon + * completion. + */ + int32_t (*MonitorIsExternal)(PP_Resource drm, + PP_Bool* is_external, + struct PP_CompletionCallback callback); +}; + +typedef struct PPB_Flash_DRM_1_1 PPB_Flash_DRM; + +struct PPB_Flash_DRM_1_0 { + PP_Resource (*Create)(PP_Instance instance); + int32_t (*GetDeviceID)(PP_Resource drm, + struct PP_Var* id, + struct PP_CompletionCallback callback); + PP_Bool (*GetHmonitor)(PP_Resource drm, int64_t* hmonitor); + int32_t (*GetVoucherFile)(PP_Resource drm, + PP_Resource* file_ref, + struct PP_CompletionCallback callback); +}; +/** + * @} + */ + +/* private/ppb_flash_file.idl */ +/** + * @addtogroup Structs + * @{ + */ +struct PP_DirEntry_Dev { + char* name; + PP_Bool is_dir; +}; + +/* Directory. */ +struct PP_DirContents_Dev { + int32_t count; + struct PP_DirEntry_Dev *entries; +}; +/** + * @} + */ + +/** + * @addtogroup Interfaces + * @{ + */ +/* PPB_Flash_File_ModuleLocal */ +struct PPB_Flash_File_ModuleLocal_3_0 { + /* Deprecated. Returns true. */ + PP_Bool (*CreateThreadAdapterForInstance)(PP_Instance instance); + /* Deprecated. Does nothing. */ + void (*ClearThreadAdapterForInstance)(PP_Instance instance); + /* Opens a module-local file, returning a file descriptor (posix) or a HANDLE + * (win32) into file. Module-local file paths (here and below) are + * '/'-separated UTF-8 strings, relative to a module-specific root. The return + * value is the ppapi error, PP_OK if success, one of the PP_ERROR_* in case + * of failure + */ + int32_t (*OpenFile)(PP_Instance instance, + const char* path, + int32_t mode, + PP_FileHandle* file); + /* Renames a module-local file. The return value is the ppapi error, PP_OK if + * success, one of the PP_ERROR_* in case of failure. + */ + int32_t (*RenameFile)(PP_Instance instance, + const char* path_from, + const char* path_to); + /* Deletes a module-local file or directory. If recursive is set and the path + * points to a directory, deletes all the contents of the directory. The + * return value is the ppapi error, PP_OK if success, one of the PP_ERROR_* in + * case of failure. + */ + int32_t (*DeleteFileOrDir)(PP_Instance instance, + const char* path, + PP_Bool recursive); + /* Creates a module-local directory. The return value is the ppapi error, + * PP_OK if success, one of the PP_ERROR_* in case of failure. + */ + int32_t (*CreateDir)(PP_Instance instance, const char* path); + /* Queries information about a module-local file. The return value is the + * ppapi error, PP_OK if success, one of the PP_ERROR_* in case of failure. + */ + int32_t (*QueryFile)(PP_Instance instance, + const char* path, + struct PP_FileInfo* info); + /* Gets the list of files contained in a module-local directory. The return + * value is the ppapi error, PP_OK if success, one of the PP_ERROR_* in case + * of failure. If non-NULL, the returned contents should be freed with + * FreeDirContents. + */ + int32_t (*GetDirContents)(PP_Instance instance, + const char* path, + struct PP_DirContents_Dev** contents); + /* Frees the data allocated by GetDirContents. */ + void (*FreeDirContents)(PP_Instance instance, + const struct PP_DirContents_Dev* contents); + /* Creates a temporary file. The file will be automatically deleted when all + * handles to it are closed. + * Returns PP_OK if successful, one of the PP_ERROR_* values in case of + * failure. + * If successful, |file| is set to a file descriptor (posix) or a HANDLE + * (win32) to the file. If failed, |file| is not touched. + */ + int32_t (*CreateTemporaryFile)(PP_Instance instance, PP_FileHandle* file); +}; + +typedef struct PPB_Flash_File_ModuleLocal_3_0 PPB_Flash_File_ModuleLocal; + +/** + * This interface provides (for Flash) synchronous access to files whose paths + * are given by a Pepper FileRef. Such FileRefs are typically obtained via the + * Pepper file chooser. + */ +struct PPB_Flash_File_FileRef_2_0 { + /* The functions below correspond exactly to their module-local counterparts + * (except in taking FileRefs instead of paths, of course). We omit the + * functionality which we do not provide for FileRefs. + */ + int32_t (*OpenFile)(PP_Resource file_ref_id, + int32_t mode, + PP_FileHandle* file); + int32_t (*QueryFile)(PP_Resource file_ref_id, struct PP_FileInfo* info); +}; + +typedef struct PPB_Flash_File_FileRef_2_0 PPB_Flash_File_FileRef; +/** + * @} + */ + +/* private/ppb_flash_font_file.idl */ +/** + * @addtogroup Interfaces + * @{ + */ +struct PPB_Flash_FontFile_0_2 { + /* Returns a resource identifying a font file corresponding to the given font + * request after applying the browser-specific fallback. + */ + PP_Resource (*Create)( + PP_Instance instance, + const struct PP_BrowserFont_Trusted_Description* description, + PP_PrivateFontCharset charset); + /* Determines if a given resource is Flash font file. + */ + PP_Bool (*IsFlashFontFile)(PP_Resource resource); + /* Returns the requested font table. + * |output_length| should pass in the size of |output|. And it will return + * the actual length of returned data. |output| could be NULL in order to + * query the size of the buffer size needed. In that case, the input value of + * |output_length| is ignored. + * Note: it is Linux only and fails directly on other platforms. + */ + PP_Bool (*GetFontTable)(PP_Resource font_file, + uint32_t table, + void* output, + uint32_t* output_length); + /** + * Returns whether PPB_Flash_FontFile is supported on Windows. + */ + PP_Bool (*IsSupportedForWindows)(void); +}; + +typedef struct PPB_Flash_FontFile_0_2 PPB_Flash_FontFile; + +struct PPB_Flash_FontFile_0_1 { + PP_Resource (*Create)( + PP_Instance instance, + const struct PP_BrowserFont_Trusted_Description* description, + PP_PrivateFontCharset charset); + PP_Bool (*IsFlashFontFile)(PP_Resource resource); + PP_Bool (*GetFontTable)(PP_Resource font_file, + uint32_t table, + void* output, + uint32_t* output_length); +}; +/** + * @} + */ + +/* private/ppb_flash_fullscreen.idl */ +/** + * @addtogroup Interfaces + * @{ + */ +struct PPB_FlashFullscreen_1_0 { + /** + * Checks whether the plugin instance is currently in fullscreen mode. + */ + PP_Bool (*IsFullscreen)(PP_Instance instance); + /** + * Switches the plugin instance to/from fullscreen mode. Returns PP_TRUE on + * success, PP_FALSE on failure. + * + * This does not unbind the current Graphics2D or Graphics3D. Pending flushes + * and swapbuffers will execute as if the resource was off-screen. The + * transition is asynchronous. During the transition, IsFullscreen will + * return PP_FALSE, and no Graphics2D or Graphics3D can be bound. The + * transition ends at the next DidChangeView when going into fullscreen mode. + * The transition out of fullscreen mode is synchronous. + */ + PP_Bool (*SetFullscreen)(PP_Instance instance, PP_Bool fullscreen); + /** + * Gets the size of the screen in pixels. When going fullscreen, the instance + * will be resized to that size. + */ + PP_Bool (*GetScreenSize)(PP_Instance instance, struct PP_Size* size); +}; + +typedef struct PPB_FlashFullscreen_1_0 PPB_FlashFullscreen; + +struct PPB_FlashFullscreen_0_1 { + PP_Bool (*IsFullscreen)(PP_Instance instance); + PP_Bool (*SetFullscreen)(PP_Instance instance, PP_Bool fullscreen); + PP_Bool (*GetScreenSize)(PP_Instance instance, struct PP_Size* size); +}; +/** + * @} + */ + +/* private/ppb_flash_menu.idl */ +/** + * @addtogroup Enums + * @{ + */ +/* Menu item type. + * + * TODO(viettrungluu): Radio items not supported yet. Will also probably want + * special menu items tied to clipboard access. + */ +typedef enum { + PP_FLASH_MENUITEM_TYPE_NORMAL = 0, + PP_FLASH_MENUITEM_TYPE_CHECKBOX = 1, + PP_FLASH_MENUITEM_TYPE_SEPARATOR = 2, + PP_FLASH_MENUITEM_TYPE_SUBMENU = 3 +} PP_Flash_MenuItem_Type; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_Flash_MenuItem_Type, 4); +/** + * @} + */ + +/** + * @addtogroup Structs + * @{ + */ +struct PP_Flash_MenuItem { + PP_Flash_MenuItem_Type type; + char* name; + int32_t id; + PP_Bool enabled; + PP_Bool checked; + struct PP_Flash_Menu* submenu; +}; + +struct PP_Flash_Menu { + uint32_t count; + struct PP_Flash_MenuItem *items; +}; +/** + * @} + */ + +/** + * @addtogroup Interfaces + * @{ + */ +struct PPB_Flash_Menu_0_2 { + PP_Resource (*Create)(PP_Instance instance_id, + const struct PP_Flash_Menu* menu_data); + PP_Bool (*IsFlashMenu)(PP_Resource resource_id); + /* Display a context menu at the given location. If the user selects an item, + * |selected_id| will be set to its |id| and the callback called with |PP_OK|. + * If the user dismisses the menu without selecting an item, + * |PP_ERROR_USERCANCEL| will be indicated. + */ + int32_t (*Show)(PP_Resource menu_id, + const struct PP_Point* location, + int32_t* selected_id, + struct PP_CompletionCallback callback); +}; + +typedef struct PPB_Flash_Menu_0_2 PPB_Flash_Menu; +/** + * @} + */ + +/* private/ppb_flash_message_loop.idl */ +/** + * @addtogroup Interfaces + * @{ + */ +/** + * The PPB_Flash_MessageLoop interface supports Pepper Flash to run + * nested message loops. + */ +struct PPB_Flash_MessageLoop_0_1 { + /** + * Allocates a Flash message loop resource. + * + * @param[in] instance A PP_Instance identifying one instance + * of a module. + * + * @return A PP_Resource that can be used to run a nested message + * loop if successful; 0 if failed. + */ + PP_Resource (*Create)(PP_Instance instance); + /** + * Determines if a given resource is a Flash message loop. + * + * @param[in] resource A PP_Resource corresponding to a generic + * resource. + * + * @return A PP_Bool that is PP_TRUE if the given + * resource is a Flash message loop, otherwise PP_FALSE. + */ + PP_Bool (*IsFlashMessageLoop)(PP_Resource resource); + /** + * Runs a nested message loop. The plugin will be reentered from this call. + * This function is used in places where Flash would normally enter a nested + * message loop (e.g., when displaying context menus), but Pepper provides + * only an asynchronous call. After performing that asynchronous call, call + * Run(). In the callback, call Quit(). + * + * For a given message loop resource, only the first call to + * Run() will start a nested message loop. The subsequent calls + * will return PP_ERROR_FAILED immediately. + * + * @param[in] flash_message_loop The Flash message loop. + * + * @return PP_ERROR_ABORTED if the message loop quits because the + * resource is destroyed; PP_OK if the message loop quits because + * of other reasons (e.g., Quit() is called); + * PP_ERROR_FAILED if this is not the first call to + * Run(). + */ + int32_t (*Run)(PP_Resource flash_message_loop); + /** + * Signals to quit the outermost nested message loop. Use this to exit and + * return back to the caller after you call Run(). + * + * If Quit() is not called to balance the call to + * Run(), the outermost nested message loop will be quitted + * implicitly when the resource is destroyed. + * + * @param[in] flash_message_loop The Flash message loop. + */ + void (*Quit)(PP_Resource flash_message_loop); +}; + +typedef struct PPB_Flash_MessageLoop_0_1 PPB_Flash_MessageLoop; +/** + * @} + */ + +/* private/ppb_flash_print.idl */ +/** + * @addtogroup Interfaces + * @{ + */ +/** + * The PPB_Flash_Print interface contains Flash-specific printing + * functionality. + */ +struct PPB_Flash_Print_1_0 { + /** + * Invokes printing on the given plugin instance. + */ + void (*InvokePrinting)(PP_Instance instance); +}; + +typedef struct PPB_Flash_Print_1_0 PPB_Flash_Print; +/** + * @} + */ + +/* private/ppb_net_address_private.idl */ +/** + * @addtogroup Enums + * @{ + */ +typedef enum { + /** + * The address family is unspecified. + */ + PP_NETADDRESSFAMILY_PRIVATE_UNSPECIFIED = 0, + /** + * The Internet Protocol version 4 (IPv4) address family. + */ + PP_NETADDRESSFAMILY_PRIVATE_IPV4 = 1, + /** + * The Internet Protocol version 6 (IPv6) address family. + */ + PP_NETADDRESSFAMILY_PRIVATE_IPV6 = 2 +} PP_NetAddressFamily_Private; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_NetAddressFamily_Private, 4); +/** + * @} + */ + +/** + * @addtogroup Structs + * @{ + */ +/** + * This is an opaque type holding a network address. Plugins must + * never access members of this struct directly. + */ +struct PP_NetAddress_Private { + uint32_t size; + int8_t data[128]; +}; +PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_NetAddress_Private, 132); +/** + * @} + */ + +/** + * @addtogroup Interfaces + * @{ + */ +/** + * The PPB_NetAddress_Private interface provides operations on + * network addresses. + */ +struct PPB_NetAddress_Private_1_1 { + /** + * Returns PP_TRUE if the two addresses are equal (host and port). + */ + PP_Bool (*AreEqual)(const struct PP_NetAddress_Private* addr1, + const struct PP_NetAddress_Private* addr2); + /** + * Returns PP_TRUE if the two addresses refer to the same host. + */ + PP_Bool (*AreHostsEqual)(const struct PP_NetAddress_Private* addr1, + const struct PP_NetAddress_Private* addr2); + /** + * Returns a human-readable description of the network address, optionally + * including the port (e.g., "192.168.0.1", "192.168.0.1:99", or "[::1]:80"), + * or an undefined var on failure. + */ + struct PP_Var (*Describe)(PP_Module module, + const struct PP_NetAddress_Private* addr, + PP_Bool include_port); + /** + * Replaces the port in the given source address. Returns PP_TRUE on success. + */ + PP_Bool (*ReplacePort)(const struct PP_NetAddress_Private* src_addr, + uint16_t port, + struct PP_NetAddress_Private* addr_out); + /** + * Gets the "any" address (for IPv4 or IPv6); for use with UDP Bind. + */ + void (*GetAnyAddress)(PP_Bool is_ipv6, struct PP_NetAddress_Private* addr); + /** + * Gets the address family. + */ + PP_NetAddressFamily_Private (*GetFamily)( + const struct PP_NetAddress_Private* addr); + /** + * Gets the port. The port is returned in host byte order. + */ + uint16_t (*GetPort)(const struct PP_NetAddress_Private* addr); + /** + * Gets the address. The output, address, must be large enough for the + * current socket family. The output will be the binary representation of an + * address for the current socket family. For IPv4 and IPv6 the address is in + * network byte order. PP_TRUE is returned if the address was successfully + * retrieved. + */ + PP_Bool (*GetAddress)(const struct PP_NetAddress_Private* addr, + void* address, + uint16_t address_size); + /** + * Returns ScopeID for IPv6 addresses or 0 for IPv4. + */ + uint32_t (*GetScopeID)(const struct PP_NetAddress_Private* addr); + /** + * Creates NetAddress with the specified IPv4 address and port + * number. + */ + void (*CreateFromIPv4Address)(const uint8_t ip[4], + uint16_t port, + struct PP_NetAddress_Private* addr_out); + /** + * Creates NetAddress with the specified IPv6 address, scope_id and + * port number. + */ + void (*CreateFromIPv6Address)(const uint8_t ip[16], + uint32_t scope_id, + uint16_t port, + struct PP_NetAddress_Private* addr_out); +}; + +typedef struct PPB_NetAddress_Private_1_1 PPB_NetAddress_Private; + +struct PPB_NetAddress_Private_0_1 { + PP_Bool (*AreEqual)(const struct PP_NetAddress_Private* addr1, + const struct PP_NetAddress_Private* addr2); + PP_Bool (*AreHostsEqual)(const struct PP_NetAddress_Private* addr1, + const struct PP_NetAddress_Private* addr2); + struct PP_Var (*Describe)(PP_Module module, + const struct PP_NetAddress_Private* addr, + PP_Bool include_port); + PP_Bool (*ReplacePort)(const struct PP_NetAddress_Private* src_addr, + uint16_t port, + struct PP_NetAddress_Private* addr_out); + void (*GetAnyAddress)(PP_Bool is_ipv6, struct PP_NetAddress_Private* addr); +}; + +struct PPB_NetAddress_Private_1_0 { + PP_Bool (*AreEqual)(const struct PP_NetAddress_Private* addr1, + const struct PP_NetAddress_Private* addr2); + PP_Bool (*AreHostsEqual)(const struct PP_NetAddress_Private* addr1, + const struct PP_NetAddress_Private* addr2); + struct PP_Var (*Describe)(PP_Module module, + const struct PP_NetAddress_Private* addr, + PP_Bool include_port); + PP_Bool (*ReplacePort)(const struct PP_NetAddress_Private* src_addr, + uint16_t port, + struct PP_NetAddress_Private* addr_out); + void (*GetAnyAddress)(PP_Bool is_ipv6, struct PP_NetAddress_Private* addr); + PP_NetAddressFamily_Private (*GetFamily)( + const struct PP_NetAddress_Private* addr); + uint16_t (*GetPort)(const struct PP_NetAddress_Private* addr); + PP_Bool (*GetAddress)(const struct PP_NetAddress_Private* addr, + void* address, + uint16_t address_size); +}; +/** + * @} + */ + +/* private/ppb_host_resolver_private.idl */ +/** + * @addtogroup Enums + * @{ + */ +/** + * The PP_HostResolver_Flags is an enumeration of the + * different types of flags, that can be OR-ed and passed to host + * resolver. + */ +typedef enum { + /** + * AI_CANONNAME + */ + PP_HOST_RESOLVER_PRIVATE_FLAGS_CANONNAME = 1 << 0, + /** + * Hint to the resolver that only loopback addresses are configured. + */ + PP_HOST_RESOLVER_PRIVATE_FLAGS_LOOPBACK_ONLY = 1 << 1 +} PP_HostResolver_Private_Flags; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_HostResolver_Private_Flags, 4); +/** + * @} + */ + +/** + * @addtogroup Structs + * @{ + */ +struct PP_HostResolver_Private_Hint { + PP_NetAddressFamily_Private family; + int32_t flags; +}; +PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_HostResolver_Private_Hint, 8); +/** + * @} + */ + +/** + * @addtogroup Interfaces + * @{ + */ +struct PPB_HostResolver_Private_0_1 { + /** + * Allocates a Host Resolver resource. + */ + PP_Resource (*Create)(PP_Instance instance); + /** + * Determines if a given resource is a Host Resolver. + */ + PP_Bool (*IsHostResolver)(PP_Resource resource); + /** + * Creates a new request to Host Resolver. |callback| is invoked + * when request is processed and a list of network addresses is + * obtained. These addresses can be be used in Connect, Bind or + * Listen calls to connect to a given |host| and |port|. + */ + int32_t (*Resolve)(PP_Resource host_resolver, + const char* host, + uint16_t port, + const struct PP_HostResolver_Private_Hint* hint, + struct PP_CompletionCallback callback); + /** + * Returns canonical name of host. + */ + struct PP_Var (*GetCanonicalName)(PP_Resource host_resolver); + /** + * Returns number of network addresses obtained after Resolve call. + */ + uint32_t (*GetSize)(PP_Resource host_resolver); + /** + * Stores in the |addr| |index|-th network address. |addr| can't be + * NULL. Returns PP_TRUE if success or PP_FALSE if the given + * resource is not a Host Resolver or |index| exceeds number of + * available addresses. + */ + PP_Bool (*GetNetAddress)(PP_Resource host_resolver, + uint32_t index, + struct PP_NetAddress_Private* addr); +}; + +typedef struct PPB_HostResolver_Private_0_1 PPB_HostResolver_Private; +/** + * @} + */ + +/* private/ppb_instance_private.idl */ +/** + * @addtogroup Enums + * @{ + */ +/** + * The PP_ExternalPluginResult enum contains result codes from + * launching an external plugin. + */ +typedef enum { + /** Successful external plugin call */ + PP_EXTERNAL_PLUGIN_OK = 0, + /** Unspecified external plugin error */ + PP_EXTERNAL_PLUGIN_FAILED = 1, + /** Error creating the module */ + PP_EXTERNAL_PLUGIN_ERROR_MODULE = 2, + /** Error creating and initializing the instance */ + PP_EXTERNAL_PLUGIN_ERROR_INSTANCE = 3 +} PP_ExternalPluginResult; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_ExternalPluginResult, 4); +/** + * @} + */ + +/** + * @addtogroup Interfaces + * @{ + */ +/** + * The PPB_Instance_Private interface contains functions available only to + * trusted plugin instances. + * + */ +struct PPB_Instance_Private_0_1 { + /** + * GetWindowObject is a pointer to a function that determines + * the DOM window containing this module instance. + * + * @param[in] instance A PP_Instance whose WindowObject should be retrieved. + * @return A PP_Var containing window object on success. + */ + struct PP_Var (*GetWindowObject)(PP_Instance instance); + /** + * GetOwnerElementObject is a pointer to a function that determines + * the DOM element containing this module instance. + * + * @param[in] instance A PP_Instance whose WindowObject should be retrieved. + * @return A PP_Var containing DOM element on success. + */ + struct PP_Var (*GetOwnerElementObject)(PP_Instance instance); + /** + * ExecuteScript is a pointer to a function that executes the given + * script in the context of the frame containing the module. + * + * The exception, if any, will be returned in *exception. As with the PPB_Var + * interface, the exception parameter, if non-NULL, must be initialized + * to a "void" var or the function will immediately return. On success, + * the exception parameter will be set to a "void" var. On failure, the + * return value will be a "void" var. + * + * @param[in] script A string containing the JavaScript to execute. + * @param[in/out] exception PP_Var containing the exception. Initialize + * this to NULL if you don't want exception info; initialize this to a void + * exception if want exception info. + * + * @return The result of the script execution, or a "void" var + * if execution failed. + */ + struct PP_Var (*ExecuteScript)(PP_Instance instance, + struct PP_Var script, + struct PP_Var* exception); +}; + +typedef struct PPB_Instance_Private_0_1 PPB_Instance_Private; +/** + * @} + */ + +/* private/ppb_isolated_file_system_private.idl */ +/** + * @addtogroup Enums + * @{ + */ +/** + * The PP_IsolatedFileSystemType_Private values indicate the type + * of isolated file systems. + */ +typedef enum { + /** Type for invalid file systems */ + PP_ISOLATEDFILESYSTEMTYPE_PRIVATE_INVALID = 0, + /** Type for CRX file systems */ + PP_ISOLATEDFILESYSTEMTYPE_PRIVATE_CRX = 1, + /** Type for PluginPrivate file systems */ + PP_ISOLATEDFILESYSTEMTYPE_PRIVATE_PLUGINPRIVATE = 2 +} PP_IsolatedFileSystemType_Private; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_IsolatedFileSystemType_Private, 4); +/** + * @} + */ + +/** + * @addtogroup Interfaces + * @{ + */ +/* PPB_IsolatedFileSystem_Private interface */ +struct PPB_IsolatedFileSystem_Private_0_2 { + /** + * Open() opens a file system corresponding the given file system type. + * + * When opening the CRX file system, this should be called from an extension + * context, otherwise it will fail. + * + * @param[in] instance A PP_Instance identifying the instance + * with the file system. + * @param[in] type A file system type as defined by + * PP_IsolatedFileSystemType_Private enum. + * @param[out] file_system An output PP_Resource corresponding + * to a PPB_FileSystem. + * @param[in] callback A PP_CompletionCallback to be called upon + * completion of Open. + * + * @return An int32_t containing an error code from pp_errors.h. + */ + int32_t (*Open)(PP_Instance instance, + PP_IsolatedFileSystemType_Private type, + PP_Resource* file_system, + struct PP_CompletionCallback callback); +}; + +typedef struct PPB_IsolatedFileSystem_Private_0_2 + PPB_IsolatedFileSystem_Private; +/** + * @} + */ + +/* private/ppb_output_protection_private.idl */ +/** + * @addtogroup Enums + * @{ + */ +/** + * Content protection methods applied on video output link. + */ +typedef enum { + PP_OUTPUT_PROTECTION_METHOD_PRIVATE_NONE = 0, + PP_OUTPUT_PROTECTION_METHOD_PRIVATE_HDCP = 1 << 0 +} PP_OutputProtectionMethod_Private; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_OutputProtectionMethod_Private, 4); + +/** + * Video output link types. + */ +typedef enum { + PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_NONE = 0, + PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_UNKNOWN = 1 << 0, + PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_INTERNAL = 1 << 1, + PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_VGA = 1 << 2, + PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_HDMI = 1 << 3, + PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_DVI = 1 << 4, + PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_DISPLAYPORT = 1 << 5, + PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_NETWORK = 1 << 6 +} PP_OutputProtectionLinkType_Private; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_OutputProtectionLinkType_Private, 4); +/** + * @} + */ + +/** + * @addtogroup Interfaces + * @{ + */ +/** + * The PPB_OutputProtection_Private interface allows controlling + * output protection. + * + * Example: + * + * @code + * op = output_protection->Create(instance); + * output_protection->QueryStatus(op, &link_mask, &protection_mask, + * done_callback); + * @endcode + * + * In this example, the plugin wants to enforce HDCP for HDMI link. + * @code + * if (link_mask & PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_HDMI) { + * output_protection->EnableProtection( + * op, PP_OUTPUT_PROTECTION_METHOD_PRIVATE_HDCP, done_callback); + * } + * @endcode + * + * After EnableProtection() completes, the plugin has to query protection + * status periodically to make sure the protection is enabled and remains + * enabled. + */ +struct PPB_OutputProtection_Private_0_1 { + /** + * Create() creates a new PPB_OutputProtection_Private object. + * + * @pram[in] instance A PP_Instance identifying one instance of + * a module. + * + * @return A PP_Resource corresponding to a + * PPB_OutputProtection_Private if successful, 0 if creation + * failed. + */ + PP_Resource (*Create)(PP_Instance instance); + /** + * IsOutputProtection() determines if the provided resource is a + * PPB_OutputProtection_Private. + * + * @param[in] resource A PP_Resource corresponding to a + * PPB_OutputProtection_Private. + * + * @return PP_TRUE if the resource is a + * PPB_OutputProtection_Private, PP_FALSE if the + * resource is invalid or some type other than + * PPB_OutputProtection_Private. + */ + PP_Bool (*IsOutputProtection)(PP_Resource resource); + /** + * Query link status and protection status. + * Clients have to query status periodically in order to detect changes. + * + * @param[in] resource A PP_Resource corresponding to a + * PPB_OutputProtection_Private. + * @param[out] link_mask The type of connected output links, which is a + * bit-mask of the PP_OutputProtectionLinkType_Private values. + * @param[out] protection_mask Enabled protection methods, which is a + * bit-mask of the PP_OutputProtectionMethod_Private values. + * @param[in] callback A PP_CompletionCallback to run on + * asynchronous completion of QueryStatus(). This callback will only run if + * QueryStatus() returns PP_OK_COMPLETIONPENDING. + * + * @return An int32_t containing an error code from pp_errors.h. + */ + int32_t (*QueryStatus)(PP_Resource resource, + uint32_t* link_mask, + uint32_t* protection_mask, + struct PP_CompletionCallback callback); + /** + * Set desired protection methods. + * + * When the desired protection method(s) have been applied to all applicable + * output links, the relevant bit(s) of the protection_mask returned by + * QueryStatus() will be set. Otherwise, the relevant bit(s) of + * protection_mask will not be set; there is no separate error code or + * callback. + * + * Protections will be disabled if no longer desired by all instances. + * + * @param[in] resource A PP_Resource corresponding to a + * PPB_OutputProtection_Private. + * @param[in] desired_protection_mask The desired protection methods, which + * is a bit-mask of the PP_OutputProtectionMethod_Private + * values. + * @param[in] callback A PP_CompletionCallback to be called with + * PP_OK when the protection request has been made. This may be + * before the protection have actually been applied. Call QueryStatus to get + * protection status. If it failed to make the protection request, the + * callback is called with PP_ERROR_FAILED and there is no need + * to call QueryStatus(). + * + * @return An int32_t containing an error code from pp_errors.h. + */ + int32_t (*EnableProtection)(PP_Resource resource, + uint32_t desired_protection_mask, + struct PP_CompletionCallback callback); +}; + +typedef struct PPB_OutputProtection_Private_0_1 PPB_OutputProtection_Private; +/** + * @} + */ + +/* private/ppb_pdf.idl */ +/** + * @addtogroup Enums + * @{ + */ +typedef enum { + PP_PDFFEATURE_HIDPI = 0, + PP_PDFFEATURE_PRINTING = 1 +} PP_PDFFeature; +/** + * @} + */ + +/** + * @addtogroup Structs + * @{ + */ +struct PP_PrivateFontFileDescription { + char* face; + uint32_t weight; + PP_Bool italic; +}; + +struct PP_PrivateFindResult { + int32_t start_index; + int32_t length; +}; + +struct PP_PrivateAccessibilityViewportInfo { + double zoom; + struct PP_Point scroll; + struct PP_Point offset; +}; + +struct PP_PrivateAccessibilityDocInfo { + uint32_t page_count; + PP_Bool text_accessible; + PP_Bool text_copyable; +}; +/** + * @} + */ + +/** + * @addtogroup Enums + * @{ + */ +typedef enum { + PP_PRIVATEDIRECTION_NONE = 0, + PP_PRIVATEDIRECTION_LTR = 1, + PP_PRIVATEDIRECTION_RTL = 2, + PP_PRIVATEDIRECTION_TTB = 3, + PP_PRIVATEDIRECTION_BTT = 4, + PP_PRIVATEDIRECTION_LAST = PP_PRIVATEDIRECTION_BTT +} PP_PrivateDirection; +/** + * @} + */ + +/** + * @addtogroup Structs + * @{ + */ +struct PP_PrivateAccessibilityPageInfo { + uint32_t page_index; + struct PP_Rect bounds; + uint32_t text_run_count; + uint32_t char_count; +}; + +struct PP_PrivateAccessibilityTextRunInfo { + uint32_t len; + double font_size; + struct PP_FloatRect bounds; + PP_PrivateDirection direction; +}; + +struct PP_PrivateAccessibilityCharInfo { + uint32_t unicode_character; + double char_width; +}; +/** + * @} + */ + +/** + * @addtogroup Interfaces + * @{ + */ +struct PPB_PDF_0_1 { + /* Returns a resource identifying a font file corresponding to the given font + * request after applying the browser-specific fallback. + * + * Currently Linux-only. + */ + PP_Resource (*GetFontFileWithFallback)( + PP_Instance instance, + const struct PP_BrowserFont_Trusted_Description* description, + PP_PrivateFontCharset charset); + /* Given a resource previously returned by GetFontFileWithFallback, returns + * a pointer to the requested font table. Linux only. + */ + PP_Bool (*GetFontTableForPrivateFontFile)(PP_Resource font_file, + uint32_t table, + void* output, + uint32_t* output_length); + /* Search the given string using ICU. Use PPB_Core's MemFree on results when + * done. + */ + void (*SearchString)(PP_Instance instance, + const void* str, + const void* term, + PP_Bool case_sensitive, + struct PP_PrivateFindResult** results, + int32_t* count); + /* Since WebFrame doesn't know about PPAPI requests, it'll think the page has + * finished loading even if there are outstanding requests by the plugin. + * Take this out once WebFrame knows about requests by PPAPI plugins. + */ + void (*DidStartLoading)(PP_Instance instance); + void (*DidStopLoading)(PP_Instance instance); + /* Sets content restriction for a full-page plugin (i.e. can't copy/print). + * The value is a bitfield of ContentRestriction enums. + */ + void (*SetContentRestriction)(PP_Instance instance, int32_t restrictions); + /* Notifies the browser that the given action has been performed. */ + void (*UserMetricsRecordAction)(PP_Instance instance, struct PP_Var action); + /* Notifies the browser that the PDF has an unsupported feature. */ + void (*HasUnsupportedFeature)(PP_Instance instance); + /*Invoke SaveAs... dialog, similar to the right-click or wrench menu. */ + void (*SaveAs)(PP_Instance instance); + /* Invoke Print dialog for plugin. */ + void (*Print)(PP_Instance instance); + PP_Bool (*IsFeatureEnabled)(PP_Instance instance, PP_PDFFeature feature); + /* Sets the selected text of the plugin. If |selected_text| is empty, then no + * text is selected. */ + void (*SetSelectedText)(PP_Instance instance, const char* selected_text); + /* Sets the link under the cursor. If |url| is empty, then no link is under + * the cursor. */ + void (*SetLinkUnderCursor)(PP_Instance instance, const char* url); + /* Gets pointers to both the mmap'd V8 snapshot files and their sizes. + * This is needed when loading V8's initial snapshot from external files. */ + void (*GetV8ExternalSnapshotData)(PP_Instance instance, + void** natives_data_out, + int32_t* natives_size_out, + void** snapshot_data_out, + int32_t* snapshot_size_out); + /* Sends information about the viewport to the renderer for accessibility + * support. */ + void (*SetAccessibilityViewportInfo)( + PP_Instance instance, + const struct PP_PrivateAccessibilityViewportInfo* viewport_info); + /* Sends information about the PDF document to the renderer for accessibility + * support. */ + void (*SetAccessibilityDocInfo)( + PP_Instance instance, + const struct PP_PrivateAccessibilityDocInfo* doc_info); + /* Sends information about one page in a PDF document to the renderer for + * accessibility support. */ + void (*SetAccessibilityPageInfo)( + PP_Instance instance, + const struct PP_PrivateAccessibilityPageInfo* page_info, + const struct PP_PrivateAccessibilityTextRunInfo text_runs[], + const struct PP_PrivateAccessibilityCharInfo chars[]); + /* Sends information about the PDF's URL and the embedder's URL. */ + void (*SetCrashData)(PP_Instance instance, + const char* pdf_url, + const char* top_level_url); +}; + +typedef struct PPB_PDF_0_1 PPB_PDF; +/** + * @} + */ + +/* private/ppb_platform_verification_private.idl */ +/** + * @addtogroup Interfaces + * @{ + */ +/** + * The PPB_PlatformVerification_Private interface allows authorized + * services to verify that the underlying platform is trusted. An example of a + * trusted platform is a Chrome OS device in verified boot mode. + */ +struct PPB_PlatformVerification_Private_0_2 { + /** + * Create() creates a PPB_PlatformVerification_Private object. + * + * @pram[in] instance A PP_Instance identifying one instance of + * a module. + * + * @return A PP_Resource corresponding to a + * PPB_PlatformVerification_Private if successful, 0 if creation + * failed. + */ + PP_Resource (*Create)(PP_Instance instance); + /** + * IsPlatformVerification() determines if the provided resource is a + * PPB_PlatformVerification_Private. + * + * @param[in] resource A PP_Resource corresponding to a + * PPB_PlatformVerification_Private. + * + * @return PP_TRUE if the resource is a + * PPB_PlatformVerification_Private, PP_FALSE if the + * resource is invalid or some type other than + * PPB_PlatformVerification_Private. + */ + PP_Bool (*IsPlatformVerification)(PP_Resource resource); + /** + * Requests a platform challenge for a given service id. + * + * @param[in] service_id A PP_Var of type + * PP_VARTYPE_STRING containing the service_id for the challenge. + * + * @param[in] challenge A PP_Var of type + * PP_VARTYPE_ARRAY_BUFFER that contains the challenge data. + * + * @param[out] signed_data A PP_Var of type + * PP_VARTYPE_ARRAY_BUFFER that contains the data signed by the + * platform. + * + * @param[out] signed_data_signature A PP_Var of type + * PP_VARTYPE_ARRAY_BUFFER that contains the signature of the + * signed data block. + * + * @param[out] platform_key_certificate A PP_Var of type + * PP_VARTYPE_STRING that contains the device specific + * certificate for the requested service_id. + * + * @param[in] callback A PP_CompletionCallback to be called after + * the platform challenge has been completed. This callback will only run if + * the return code is PP_OK_COMPLETIONPENDING. + * + * @return An int32_t containing an error code from pp_errors.h. + */ + int32_t (*ChallengePlatform)(PP_Resource instance, + struct PP_Var service_id, + struct PP_Var challenge, + struct PP_Var* signed_data, + struct PP_Var* signed_data_signature, + struct PP_Var* platform_key_certificate, + struct PP_CompletionCallback callback); +}; + +typedef struct PPB_PlatformVerification_Private_0_2 + PPB_PlatformVerification_Private; +/** + * @} + */ + +/* private/ppb_tcp_server_socket_private.idl */ +/** + * @addtogroup Interfaces + * @{ + */ +/** + * The PPB_TCPServerSocket_Private interface provides TCP + * server socket operations. + */ +struct PPB_TCPServerSocket_Private_0_2 { + /** + * Allocates a TCP server socket resource. + */ + PP_Resource (*Create)(PP_Instance instance); + /** + * Determines if a given resource is TCP server socket. + */ + PP_Bool (*IsTCPServerSocket)(PP_Resource resource); + /** + * Binds |tcp_server_socket| to the address given by |addr| and + * starts listening. The |backlog| argument defines the maximum + * length to which the queue of pending connections may + * grow. |callback| is invoked when |tcp_server_socket| is ready to + * accept incoming connections or in the case of failure. Returns + * PP_ERROR_NOSPACE if socket can't be initialized, or + * PP_ERROR_FAILED in the case of Listen failure. Otherwise, returns + * PP_OK. + */ + int32_t (*Listen)(PP_Resource tcp_server_socket, + const struct PP_NetAddress_Private* addr, + int32_t backlog, + struct PP_CompletionCallback callback); + /** + * Accepts single connection, creates instance of + * PPB_TCPSocket_Private and stores reference to it in + * |tcp_socket|. |callback| is invoked when connection is accepted + * or in the case of failure. This method can be called only after + * successful Listen call on |tcp_server_socket|. + */ + int32_t (*Accept)(PP_Resource tcp_server_socket, + PP_Resource* tcp_socket, + struct PP_CompletionCallback callback); + /** + * Returns the current address to which the socket is bound, in the + * buffer pointed to by |addr|. This method can be called only after + * successful Listen() call and before StopListening() call. + */ + int32_t (*GetLocalAddress)(PP_Resource tcp_server_socket, + struct PP_NetAddress_Private* addr); + /** + * Cancels all pending callbacks reporting PP_ERROR_ABORTED and + * closes the socket. Note: this method is implicitly called when + * server socket is destroyed. + */ + void (*StopListening)(PP_Resource tcp_server_socket); +}; + +typedef struct PPB_TCPServerSocket_Private_0_2 PPB_TCPServerSocket_Private; + +struct PPB_TCPServerSocket_Private_0_1 { + PP_Resource (*Create)(PP_Instance instance); + PP_Bool (*IsTCPServerSocket)(PP_Resource resource); + int32_t (*Listen)(PP_Resource tcp_server_socket, + const struct PP_NetAddress_Private* addr, + int32_t backlog, + struct PP_CompletionCallback callback); + int32_t (*Accept)(PP_Resource tcp_server_socket, + PP_Resource* tcp_socket, + struct PP_CompletionCallback callback); + void (*StopListening)(PP_Resource tcp_server_socket); +}; +/** + * @} + */ + +/* private/ppb_tcp_socket_private.idl */ +/** + * @addtogroup Enums + * @{ + */ +typedef enum { + /* Special value used for testing. Guaranteed to fail SetOption(). */ + PP_TCPSOCKETOPTION_PRIVATE_INVALID = 0, + /* Disable coalescing of small writes to make TCP segments, and instead + * deliver data immediately. For SSL sockets, this option must be set before + * SSLHandshake() is called. Value type is PP_VARTYPE_BOOL. */ + PP_TCPSOCKETOPTION_PRIVATE_NO_DELAY = 1 +} PP_TCPSocketOption_Private; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_TCPSocketOption_Private, 4); +/** + * @} + */ + +/** + * @addtogroup Interfaces + * @{ + */ +/** + * The PPB_TCPSocket_Private interface provides TCP socket + * operations. + */ +struct PPB_TCPSocket_Private_0_5 { + /** + * Allocates a TCP socket resource. + */ + PP_Resource (*Create)(PP_Instance instance); + /** + * Determines if a given resource is TCP socket. + */ + PP_Bool (*IsTCPSocket)(PP_Resource resource); + /** + * Connects to a TCP port given as a host-port pair. + * When a proxy server is used, |host| and |port| refer to the proxy server + * instead of the destination server. + */ + int32_t (*Connect)(PP_Resource tcp_socket, + const char* host, + uint16_t port, + struct PP_CompletionCallback callback); + /** + * Same as Connect(), but connecting to the address given by |addr|. A typical + * use-case would be for reconnections. + */ + int32_t (*ConnectWithNetAddress)(PP_Resource tcp_socket, + const struct PP_NetAddress_Private* addr, + struct PP_CompletionCallback callback); + /** + * Gets the local address of the socket, if it has been connected. + * Returns PP_TRUE on success. + */ + PP_Bool (*GetLocalAddress)(PP_Resource tcp_socket, + struct PP_NetAddress_Private* local_addr); + /** + * Gets the remote address of the socket, if it has been connected. + * Returns PP_TRUE on success. + */ + PP_Bool (*GetRemoteAddress)(PP_Resource tcp_socket, + struct PP_NetAddress_Private* remote_addr); + /** + * Does SSL handshake and moves to sending and receiving encrypted data. The + * socket must have been successfully connected. |server_name| will be + * compared with the name(s) in the server's certificate during the SSL + * handshake. |server_port| is only used to identify an SSL server in the SSL + * session cache. + * When a proxy server is used, |server_name| and |server_port| refer to the + * destination server. + * If the socket is not connected, or there are pending read/write requests, + * SSLHandshake() will fail without starting a handshake. Otherwise, any + * failure during the handshake process will cause the socket to be + * disconnected. + */ + int32_t (*SSLHandshake)(PP_Resource tcp_socket, + const char* server_name, + uint16_t server_port, + struct PP_CompletionCallback callback); + /** + * Returns the server's PPB_X509Certificate_Private for a socket + * connection if an SSL connection has been established using + * SSLHandshake. If no SSL connection has been established, a + * null resource is returned. + */ + PP_Resource (*GetServerCertificate)(PP_Resource tcp_socket); + /** + * NOTE: This function is not implemented and will return + * PP_FALSE. + * Adds a trusted/untrusted chain building certificate to be used for this + * connection. The certificate must be a + * PPB_X509Certificate_Private. PP_TRUE is returned + * upon success. + */ + PP_Bool (*AddChainBuildingCertificate)(PP_Resource tcp_socket, + PP_Resource certificate, + PP_Bool is_trusted); + /** + * Reads data from the socket. The size of |buffer| must be at least as large + * as |bytes_to_read|. May perform a partial read. Returns the number of bytes + * read or an error code. If the return value is 0, then it indicates that + * end-of-file was reached. + * This method won't return more than 1 megabyte, so if |bytes_to_read| + * exceeds 1 megabyte, it will always perform a partial read. + * Multiple outstanding read requests are not supported. + */ + int32_t (*Read)(PP_Resource tcp_socket, + char* buffer, + int32_t bytes_to_read, + struct PP_CompletionCallback callback); + /** + * Writes data to the socket. May perform a partial write. Returns the number + * of bytes written or an error code. + * This method won't write more than 1 megabyte, so if |bytes_to_write| + * exceeds 1 megabyte, it will always perform a partial write. + * Multiple outstanding write requests are not supported. + */ + int32_t (*Write)(PP_Resource tcp_socket, + const char* buffer, + int32_t bytes_to_write, + struct PP_CompletionCallback callback); + /** + * Cancels any IO that may be pending, and disconnects the socket. Any pending + * callbacks will still run, reporting PP_Error_Aborted if pending IO was + * interrupted. It is NOT valid to call Connect() again after a call to this + * method. Note: If the socket is destroyed when it is still connected, then + * it will be implicitly disconnected, so you are not required to call this + * method. + */ + void (*Disconnect)(PP_Resource tcp_socket); + /** + * Sets an option on |tcp_socket|. Supported |name| and |value| parameters + * are as described for PP_TCPSocketOption_Private. |callback| will be + * invoked with PP_OK if setting the option succeeds, or an error code + * otherwise. The socket must be connection before SetOption is called. + */ + int32_t (*SetOption)(PP_Resource tcp_socket, + PP_TCPSocketOption_Private name, + struct PP_Var value, + struct PP_CompletionCallback callback); +}; + +typedef struct PPB_TCPSocket_Private_0_5 PPB_TCPSocket_Private; + +struct PPB_TCPSocket_Private_0_3 { + PP_Resource (*Create)(PP_Instance instance); + PP_Bool (*IsTCPSocket)(PP_Resource resource); + int32_t (*Connect)(PP_Resource tcp_socket, + const char* host, + uint16_t port, + struct PP_CompletionCallback callback); + int32_t (*ConnectWithNetAddress)(PP_Resource tcp_socket, + const struct PP_NetAddress_Private* addr, + struct PP_CompletionCallback callback); + PP_Bool (*GetLocalAddress)(PP_Resource tcp_socket, + struct PP_NetAddress_Private* local_addr); + PP_Bool (*GetRemoteAddress)(PP_Resource tcp_socket, + struct PP_NetAddress_Private* remote_addr); + int32_t (*SSLHandshake)(PP_Resource tcp_socket, + const char* server_name, + uint16_t server_port, + struct PP_CompletionCallback callback); + int32_t (*Read)(PP_Resource tcp_socket, + char* buffer, + int32_t bytes_to_read, + struct PP_CompletionCallback callback); + int32_t (*Write)(PP_Resource tcp_socket, + const char* buffer, + int32_t bytes_to_write, + struct PP_CompletionCallback callback); + void (*Disconnect)(PP_Resource tcp_socket); +}; + +struct PPB_TCPSocket_Private_0_4 { + PP_Resource (*Create)(PP_Instance instance); + PP_Bool (*IsTCPSocket)(PP_Resource resource); + int32_t (*Connect)(PP_Resource tcp_socket, + const char* host, + uint16_t port, + struct PP_CompletionCallback callback); + int32_t (*ConnectWithNetAddress)(PP_Resource tcp_socket, + const struct PP_NetAddress_Private* addr, + struct PP_CompletionCallback callback); + PP_Bool (*GetLocalAddress)(PP_Resource tcp_socket, + struct PP_NetAddress_Private* local_addr); + PP_Bool (*GetRemoteAddress)(PP_Resource tcp_socket, + struct PP_NetAddress_Private* remote_addr); + int32_t (*SSLHandshake)(PP_Resource tcp_socket, + const char* server_name, + uint16_t server_port, + struct PP_CompletionCallback callback); + PP_Resource (*GetServerCertificate)(PP_Resource tcp_socket); + PP_Bool (*AddChainBuildingCertificate)(PP_Resource tcp_socket, + PP_Resource certificate, + PP_Bool is_trusted); + int32_t (*Read)(PP_Resource tcp_socket, + char* buffer, + int32_t bytes_to_read, + struct PP_CompletionCallback callback); + int32_t (*Write)(PP_Resource tcp_socket, + const char* buffer, + int32_t bytes_to_write, + struct PP_CompletionCallback callback); + void (*Disconnect)(PP_Resource tcp_socket); +}; +/** + * @} + */ + +/* private/ppb_testing_private.idl */ +/** + * @addtogroup Interfaces + * @{ + */ +struct PPB_Testing_Private_1_0 { + /** + * Reads the bitmap data out of the backing store for the given + * DeviceContext2D and into the given image. If the data was successfully + * read, it will return PP_TRUE. + * + * This function should not generally be necessary for normal plugin + * operation. If you want to update portions of a device, the expectation is + * that you will either regenerate the data, or maintain a backing store + * pushing updates to the device from your backing store via PaintImageData. + * Using this function will introduce an extra copy which will make your + * plugin slower. In some cases, this may be a very expensive operation (it + * may require slow cross-process transitions or graphics card readbacks). + * + * Data will be read into the image starting at |top_left| in the device + * context, and proceeding down and to the right for as many pixels as the + * image is large. If any part of the image bound would fall outside of the + * backing store of the device if positioned at |top_left|, this function + * will fail and return PP_FALSE. + * + * The image format must be of the format + * PPB_ImageData.GetNativeImageDataFormat() or this function will fail and + * return PP_FALSE. + * + * The returned image data will represent the current status of the backing + * store. This will not include any paint, scroll, or replace operations + * that have not yet been flushed; these operations are only reflected in + * the backing store (and hence ReadImageData) until after a Flush() + * operation has completed. + */ + PP_Bool (*ReadImageData)(PP_Resource device_context_2d, + PP_Resource image, + const struct PP_Point* top_left); + /** + * Runs a nested message loop. The plugin will be reentered from this call. + * This function is used for unit testing the API. The normal pattern is to + * issue some asynchronous call that has a callback. Then you call + * RunMessageLoop which will suspend the plugin and go back to processing + * messages, giving the asynchronous operation time to complete. In your + * callback, you save the data and call QuitMessageLoop, which will then + * pop back up and continue with the test. This avoids having to write a + * complicated state machine for simple tests for asynchronous APIs. + */ + void (*RunMessageLoop)(PP_Instance instance); + /** + * Posts a quit message for the outermost nested message loop. Use this to + * exit and return back to the caller after you call RunMessageLoop. + */ + void (*QuitMessageLoop)(PP_Instance instance); + /** + * Returns the number of live objects (resources + strings + objects) + * associated with this plugin instance. Used for detecting leaks. Returns + * (uint32_t)-1 on failure. + */ + uint32_t (*GetLiveObjectsForInstance)(PP_Instance instance); + /** + * Returns PP_TRUE if the plugin is running out-of-process, PP_FALSE + * otherwise. + */ + PP_Bool (*IsOutOfProcess)(void); + /** + * Posts the plugin's current Power Saver status to JavaScript. The plugin + * itself does not recieve anything. This is not idiomatic for Pepper, + * but convenient for testing. + */ + void (*PostPowerSaverStatus)(PP_Instance instance); + /** + * Subscribes to changes to the plugin's Power Saver status. The status + * changes are not forwarded to the plugin itself, but posted to JavaScript. + * This is not idiomatic for Pepper, but conveienent for testing. + */ + void (*SubscribeToPowerSaverNotifications)(PP_Instance instance); + /** + * Passes the input event to the browser, which sends it back to the + * plugin. The plugin should implement PPP_InputEvent and register for + * the input event type. + * + * This method sends an input event through the browser just as if it had + * come from the user. If the browser determines that it is an event for the + * plugin, it will be sent to be handled by the plugin's PPP_InputEvent + * interface. When generating mouse events, make sure the position is within + * the plugin's area on the page. When generating a keyboard event, make sure + * the plugin is focused. + * + * Note that the browser may generate extra input events in order to + * maintain certain invariants, such as always having a "mouse enter" event + * before any other mouse event. Furthermore, the event the plugin receives + * after sending a simulated event will be slightly different from the + * original event. The browser may change the timestamp, add modifiers, and + * slightly alter the mouse position, due to coordinate transforms it + * performs. + */ + void (*SimulateInputEvent)(PP_Instance instance, PP_Resource input_event); + /** + * Returns the URL for the document. This is a safe way to retrieve + * window.location.href. + * If the canonicalized URL is valid, the method will parse the URL + * and fill in the components structure. This pointer may be NULL + * to specify that no component information is necessary. + */ + struct PP_Var (*GetDocumentURL)(PP_Instance instance, + struct PP_URLComponents_Dev* components); + /** + * Fetches up to |array_size| active PP_Vars in the tracker. Returns the + * number of vars in the tracker. The active vars are written to |live_vars| + * contiguously starting at index 0. The vars are not in any particular order. + * If the number of live vars is greater than |array_size|, then an arbitrary + * subset of |array_size| vars is written to |live_vars|. The reference count + * of the returned PP_Vars will *not* be affected by this call. + */ + uint32_t (*GetLiveVars)(struct PP_Var live_vars[], uint32_t array_size); + /** + * Sets the threshold size at which point we switch from transmitting + * array buffers in IPC messages to using shared memory. This is only used + * for testing purposes where we need to transmit small buffers using shmem + * (in order to have fast tests). Passing a value of 0 resets the threshold + * to its default. The threshold is in bytes. + */ + void (*SetMinimumArrayBufferSizeForShmem)(PP_Instance instance, + uint32_t threshold); + /** + * Run the V8 garbage collector for tests. + */ + void (*RunV8GC)(PP_Instance instance); +}; + +typedef struct PPB_Testing_Private_1_0 PPB_Testing_Private; +/** + * @} + */ + +/* private/ppb_udp_socket_private.idl */ +/** + * @addtogroup Enums + * @{ + */ +typedef enum { + /* Allow the socket to share the local address to which socket will + * be bound with other processes. Value's type should be + * PP_VARTYPE_BOOL. */ + PP_UDPSOCKETFEATURE_PRIVATE_ADDRESS_REUSE = 0, + /* Allow sending and receiving packets sent to and from broadcast + * addresses. Value's type should be PP_VARTYPE_BOOL. */ + PP_UDPSOCKETFEATURE_PRIVATE_BROADCAST = 1, + /* Special value for counting the number of available + * features. Should not be passed to SetSocketFeature(). */ + PP_UDPSOCKETFEATURE_PRIVATE_COUNT = 2 +} PP_UDPSocketFeature_Private; +PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_UDPSocketFeature_Private, 4); +/** + * @} + */ + +/** + * @addtogroup Interfaces + * @{ + */ +struct PPB_UDPSocket_Private_0_4 { + /** + * Creates a UDP socket resource. + */ + PP_Resource (*Create)(PP_Instance instance_id); + /** + * Determines if a given resource is a UDP socket. + */ + PP_Bool (*IsUDPSocket)(PP_Resource resource_id); + /** + * Sets a socket feature to |udp_socket|. Should be called before + * Bind(). Possible values for |name|, |value| and |value|'s type + * are described in PP_UDPSocketFeature_Private description. If no + * error occurs, returns PP_OK. Otherwise, returns + * PP_ERROR_BADRESOURCE (if bad |udp_socket| provided), + * PP_ERROR_BADARGUMENT (if bad name/value/value's type provided) + * or PP_ERROR_FAILED in the case of internal errors. + */ + int32_t (*SetSocketFeature)(PP_Resource udp_socket, + PP_UDPSocketFeature_Private name, + struct PP_Var value); + /* Creates a socket and binds to the address given by |addr|. */ + int32_t (*Bind)(PP_Resource udp_socket, + const struct PP_NetAddress_Private* addr, + struct PP_CompletionCallback callback); + /* Returns the address that the socket has bound to. A successful + * call to Bind must be called first. Returns PP_FALSE if Bind + * fails, or if Close has been called. + */ + PP_Bool (*GetBoundAddress)(PP_Resource udp_socket, + struct PP_NetAddress_Private* addr); + /* Performs a non-blocking recvfrom call on socket. + * Bind must be called first. |callback| is invoked when recvfrom + * reads data. You must call GetRecvFromAddress to recover the + * address the data was retrieved from. + */ + int32_t (*RecvFrom)(PP_Resource udp_socket, + char* buffer, + int32_t num_bytes, + struct PP_CompletionCallback callback); + /* Upon successful completion of RecvFrom, the address that the data + * was received from is stored in |addr|. + */ + PP_Bool (*GetRecvFromAddress)(PP_Resource udp_socket, + struct PP_NetAddress_Private* addr); + /* Performs a non-blocking sendto call on the socket created and + * bound(has already called Bind). The callback |callback| is + * invoked when sendto completes. + */ + int32_t (*SendTo)(PP_Resource udp_socket, + const char* buffer, + int32_t num_bytes, + const struct PP_NetAddress_Private* addr, + struct PP_CompletionCallback callback); + /* Cancels all pending reads and writes, and closes the socket. */ + void (*Close)(PP_Resource udp_socket); +}; + +typedef struct PPB_UDPSocket_Private_0_4 PPB_UDPSocket_Private; + +struct PPB_UDPSocket_Private_0_2 { + PP_Resource (*Create)(PP_Instance instance_id); + PP_Bool (*IsUDPSocket)(PP_Resource resource_id); + int32_t (*Bind)(PP_Resource udp_socket, + const struct PP_NetAddress_Private* addr, + struct PP_CompletionCallback callback); + int32_t (*RecvFrom)(PP_Resource udp_socket, + char* buffer, + int32_t num_bytes, + struct PP_CompletionCallback callback); + PP_Bool (*GetRecvFromAddress)(PP_Resource udp_socket, + struct PP_NetAddress_Private* addr); + int32_t (*SendTo)(PP_Resource udp_socket, + const char* buffer, + int32_t num_bytes, + const struct PP_NetAddress_Private* addr, + struct PP_CompletionCallback callback); + void (*Close)(PP_Resource udp_socket); +}; + +struct PPB_UDPSocket_Private_0_3 { + PP_Resource (*Create)(PP_Instance instance_id); + PP_Bool (*IsUDPSocket)(PP_Resource resource_id); + int32_t (*Bind)(PP_Resource udp_socket, + const struct PP_NetAddress_Private* addr, + struct PP_CompletionCallback callback); + PP_Bool (*GetBoundAddress)(PP_Resource udp_socket, + struct PP_NetAddress_Private* addr); + int32_t (*RecvFrom)(PP_Resource udp_socket, + char* buffer, + int32_t num_bytes, + struct PP_CompletionCallback callback); + PP_Bool (*GetRecvFromAddress)(PP_Resource udp_socket, + struct PP_NetAddress_Private* addr); + int32_t (*SendTo)(PP_Resource udp_socket, + const char* buffer, + int32_t num_bytes, + const struct PP_NetAddress_Private* addr, + struct PP_CompletionCallback callback); + void (*Close)(PP_Resource udp_socket); +}; +/** + * @} + */ + +/* private/ppb_uma_private.idl */ +/** + * @addtogroup Interfaces + * @{ + */ +/** + * Contains functions for plugins to report UMA usage stats. + */ +struct PPB_UMA_Private_0_3 { + /** + * HistogramCustomTimes is a pointer to a function which records a time + * sample given in milliseconds in the histogram given by |name|, possibly + * creating the histogram if it does not exist. + */ + void (*HistogramCustomTimes)(PP_Instance instance, + struct PP_Var name, + int64_t sample, + int64_t min, + int64_t max, + uint32_t bucket_count); + /** + * HistogramCustomCounts is a pointer to a function which records a sample + * in the histogram given by |name|, possibly creating the histogram if it + * does not exist. + */ + void (*HistogramCustomCounts)(PP_Instance instance, + struct PP_Var name, + int32_t sample, + int32_t min, + int32_t max, + uint32_t bucket_count); + /** + * HistogramEnumeration is a pointer to a function which records a sample + * in the histogram given by |name|, possibly creating the histogram if it + * does not exist. The sample represents a value in an enumeration bounded + * by |boundary_value|, that is, sample < boundary_value always. + */ + void (*HistogramEnumeration)(PP_Instance instance, + struct PP_Var name, + int32_t sample, + int32_t boundary_value); + /** + * IsCrashReportingEnabled returns PP_OK to the completion callback to + * indicate that the current user has opted-in to crash reporting, or + * PP_ERROR_* on failure or when a user has not opted-in. This can be used to + * gate other reporting processes such as analytics and crash reporting. + */ + int32_t (*IsCrashReportingEnabled)(PP_Instance instance, + struct PP_CompletionCallback callback); +}; + +typedef struct PPB_UMA_Private_0_3 PPB_UMA_Private; +/** + * @} + */ + +/* private/ppb_video_destination_private.idl */ +/** + * @addtogroup Interfaces + * @{ + */ +/** + * The PPB_VideoDestination_Private interface contains pointers to + * several functions for creating video destination resources and using them to + * send video frames to a MediaStream video track in the browser. + */ +struct PPB_VideoDestination_Private_0_1 { + /** + * Creates a video destination resource. + * + * @param[in] instance A PP_Instance identifying an instance of + * a module. + * + * @return A PP_Resource with a nonzero ID on success or zero on + * failure. Failure means the instance was invalid. + */ + PP_Resource (*Create)(PP_Instance instance); + /** + * Determines if a resource is a video destination resource. + * + * @param[in] resource The PP_Resource to test. + * + * @return A PP_Bool with PP_TRUE if the given + * resource is a video destination resource or PP_FALSE + * otherwise. + */ + PP_Bool (*IsVideoDestination)(PP_Resource resource); + /** + * Opens a video destination for putting frames. + * + * @param[in] destination A PP_Resource corresponding to a video + * destination resource. + * @param[in] stream_url A PP_Var string holding a URL + * identifying a MediaStream. + * @param[in] callback A PP_CompletionCallback to be called upon + * completion of Open(). + * + * @return An int32_t containing a result code from pp_errors.h. + * Returns PP_ERROR_BADRESOURCE if destination isn't a valid video + * destination. + * Returns PP_ERROR_INPROGRESS if destination is already open. + * Returns PP_ERROR_FAILED if the MediaStream doesn't exist or if there is + * some other browser error. + */ + int32_t (*Open)(PP_Resource destination, + struct PP_Var stream_url, + struct PP_CompletionCallback callback); + /** + * Puts a frame to the video destination. + * + * After this call, you should take care to release your references to the + * image embedded in the video frame. If you paint to the image after + * PutFame(), there is the possibility of artifacts because the browser may + * still be copying the frame to the stream. + * + * @param[in] destination A PP_Resource corresponding to a video + * destination resource. + * @param[in] frame A PP_VideoFrame_Private holding the video + * frame to send to the destination. + * + * @return An int32_t containing a result code from pp_errors.h. + * Returns PP_ERROR_BADRESOURCE if destination isn't a valid video + * destination. + * Returns PP_ERROR_FAILED if destination is not open, if the video frame has + * an invalid image data resource, or if some other browser error occurs. + */ + int32_t (*PutFrame)(PP_Resource destination, + const struct PP_VideoFrame_Private* frame); + /** + * Closes the video destination. + * + * @param[in] destination A PP_Resource corresponding to a video + * destination. + */ + void (*Close)(PP_Resource destination); +}; + +typedef struct PPB_VideoDestination_Private_0_1 PPB_VideoDestination_Private; +/** + * @} + */ + +/* private/ppb_video_source_private.idl */ +/** + * @addtogroup Interfaces + * @{ + */ +/** + * The PPB_VideoSource_Private interface contains pointers to + * several functions for creating video source resources and using them to + * receive video frames from a MediaStream video track in the browser. + */ +struct PPB_VideoSource_Private_0_1 { + /** + * Creates a video source resource. + * + * @param[in] instance A PP_Instance identifying an instance of + * a module. + * + * @return A PP_Resource with a nonzero ID on success or zero on + * failure. Failure means the instance was invalid. + */ + PP_Resource (*Create)(PP_Instance instance); + /** + * Determines if a resource is a video source resource. + * + * @param[in] resource The PP_Resource to test. + * + * @return A PP_Bool with PP_TRUE if the given + * resource is a video source resource or PP_FALSE otherwise. + */ + PP_Bool (*IsVideoSource)(PP_Resource resource); + /** + * Opens a video source for getting frames. + * + * @param[in] source A PP_Resource corresponding to a video + * source resource. + * @param[in] stream_url A PP_Var string holding a URL + * identifying a MediaStream. + * @param[in] callback A PP_CompletionCallback to be called upon + * completion of Open(). + * + * @return An int32_t containing a result code from pp_errors.h. + * Returns PP_ERROR_BADRESOURCE if source isn't a valid video source. + * Returns PP_ERROR_INPROGRESS if source is already open. + * Returns PP_ERROR_FAILED if the MediaStream doesn't exist or if there is + * some other browser error. + */ + int32_t (*Open)(PP_Resource source, + struct PP_Var stream_url, + struct PP_CompletionCallback callback); + /** + * Gets a frame from the video source. The returned image data is only valid + * until the next call to GetFrame. + * The image data resource inside the returned frame will have its reference + * count incremented by one and must be managed by the plugin. + * + * @param[in] source A PP_Resource corresponding to a video + * source resource. + * @param[out] frame A PP_VideoFrame_Private to hold a video + * frame from the source. + * @param[in] callback A PP_CompletionCallback to be called upon + * completion of GetNextFrame(). + * + * @return An int32_t containing a result code from pp_errors.h. + * Returns PP_ERROR_BADRESOURCE if source isn't a valid video source. + * Returns PP_ERROR_FAILED if the source is not open, or if some other + * browser error occurs. + */ + int32_t (*GetFrame)(PP_Resource source, + struct PP_VideoFrame_Private* frame, + struct PP_CompletionCallback callback); + /** + * Closes the video source. + * + * @param[in] source A PP_Resource corresponding to a video + * source resource. + */ + void (*Close)(PP_Resource source); +}; + +typedef struct PPB_VideoSource_Private_0_1 PPB_VideoSource_Private; +/** + * @} + */ + +/* private/ppb_x509_certificate_private.idl */ +/** + * @addtogroup Enums + * @{ + */ +/** + * This enumeration corresponds to fields of an X509 certificate. Refer to + * PP_TRUE on success, PP_FALSE on failure. + */ + PP_Bool (*DeauthorizeContentLicenses)(const char* plugin_data_path); + /** + * Gets permission settings. callback will be called exactly once + * to return the settings. + * + * @param[in] plugin_data_path String containing the directory where the + * plugin settings are stored. + * @param[in] setting_type What type of setting to retrieve. + * @param[in] callback The callback to return retrieved data. + * @param[inout] user_data An opaque pointer that will be passed to + * callback. + */ + void (*GetPermissionSettings)( + const char* plugin_data_path, + PP_Flash_BrowserOperations_SettingType setting_type, + PPB_Flash_BrowserOperations_GetSettingsCallback callback, + void* user_data); + /** + * Sets default permission. It applies to all sites except those with + * site-specific settings. + * + * @param[in] plugin_data_path String containing the directory where the + * plugin settings are stored. + * @param[in] setting_type What type of setting to set. + * @param[in] permission The default permission. + * @param[in] clear_site_specific Whether to remove all site-specific + * settings. + * + * @return PP_TRUE on success, PP_FALSE on failure. + */ + PP_Bool (*SetDefaultPermission)( + const char* plugin_data_path, + PP_Flash_BrowserOperations_SettingType setting_type, + PP_Flash_BrowserOperations_Permission permission, + PP_Bool clear_site_specific); + /** + * Sets site-specific permission. If a site has already got site-specific + * permission and it is not in sites, it won't be affected. + * + * @param[in] plugin_data_path String containing the directory where the + * plugin settings are stored. + * @param[in] setting_type What type of setting to set. + * @param[in] site_count How many items are there in sites. + * @param[in] sites The site-specific settings. If a site is specified with + * PP_FLASH_BROWSEROPERATIONS_PERMISSION_DEFAULT permission, it + * will be removed from the site-specific list. + * + * @return PP_TRUE on success, PP_FALSE on failure. + */ + PP_Bool (*SetSitePermission)( + const char* plugin_data_path, + PP_Flash_BrowserOperations_SettingType setting_type, + uint32_t site_count, + const struct PP_Flash_BrowserOperations_SiteSetting sites[]); + /** + * Returns a list of sites that have stored data, for use with the + * "Clear site data" feature. + * + * @param[in] plugin_data_path String containing the directory where the + * plugin data is stored. + * @param[out] sites A NULL-terminated array of sites that have stored data. + * Use FreeSiteList on the array when done. + * + * See also the NPP_GetSitesWithData function in NPAPI: + * https://wiki.mozilla.org/NPAPI:ClearSiteData + */ + void (*GetSitesWithData)(const char* plugin_data_path, char*** sites); + /** + * Frees the list of sites returned by GetSitesWithData. + * + * @param[in] sites A NULL-terminated array of strings. + */ + void (*FreeSiteList)(char* sites[]); +}; + +typedef struct PPP_Flash_BrowserOperations_1_3 PPP_Flash_BrowserOperations; + +struct PPP_Flash_BrowserOperations_1_0 { + PP_Bool (*ClearSiteData)(const char* plugin_data_path, + const char* site, + uint64_t flags, + uint64_t max_age); +}; + +struct PPP_Flash_BrowserOperations_1_2 { + PP_Bool (*ClearSiteData)(const char* plugin_data_path, + const char* site, + uint64_t flags, + uint64_t max_age); + PP_Bool (*DeauthorizeContentLicenses)(const char* plugin_data_path); + void (*GetPermissionSettings)( + const char* plugin_data_path, + PP_Flash_BrowserOperations_SettingType setting_type, + PPB_Flash_BrowserOperations_GetSettingsCallback callback, + void* user_data); + PP_Bool (*SetDefaultPermission)( + const char* plugin_data_path, + PP_Flash_BrowserOperations_SettingType setting_type, + PP_Flash_BrowserOperations_Permission permission, + PP_Bool clear_site_specific); + PP_Bool (*SetSitePermission)( + const char* plugin_data_path, + PP_Flash_BrowserOperations_SettingType setting_type, + uint32_t site_count, + const struct PP_Flash_BrowserOperations_SiteSetting sites[]); +}; +/** + * @} + */ + +/* private/ppp_instance_private.idl */ +/** + * @addtogroup Interfaces + * @{ + */ +/** + * The PPP_Instance_Private interface contains pointers to a series of + * functions that may be implemented in a trusted plugin to provide capabilities + * that aren't possible in untrusted modules. + */ +struct PPP_Instance_Private_0_1 { + /** + * GetInstanceObject returns a PP_Var representing the scriptable object for + * the given instance. Normally this will be a PPP_Class_Deprecated object + * that exposes methods and properties to JavaScript. + * + * On Failure, the returned PP_Var should be a "void" var. + * + * The returned PP_Var should have a reference added for the caller, which + * will be responsible for Release()ing that reference. + * + * @param[in] instance A PP_Instance identifying the instance from which the + * instance object is being requested. + * @return A PP_Var containing scriptable object. + */ + struct PP_Var (*GetInstanceObject)(PP_Instance instance); +}; + +typedef struct PPP_Instance_Private_0_1 PPP_Instance_Private; +/** + * @} + */ + +/* private/ppp_pexe_stream_handler.idl */ +#include "ppapi/c/private/pp_file_handle.h" + +/** + * @addtogroup Interfaces + * @{ + */ +struct PPP_PexeStreamHandler_1_0 { + /** + * Invoked as a result of a cache hit for a translated pexe. + */ + void (*DidCacheHit)(void* user_data, PP_FileHandle nexe_file_handle); + /** + * Invoked as a result of a cache miss for a translated pexe. + * Provides the expected length of the pexe, as read from HTTP headers. + */ + void (*DidCacheMiss)(void* user_data, + int64_t expected_total_length, + PP_FileHandle temp_nexe_file); + /** + * Invoked when a block of data has been downloaded. + * Only invoked after DidCacheMiss(). + */ + void (*DidStreamData)(void* user_data, const void* data, int32_t length); + /** + * Invoked when the stream has finished downloading, regardless of whether it + * succeeded. Not invoked if DidCacheHit() was called. + */ + void (*DidFinishStream)(void* user_data, int32_t pp_error); +}; + +typedef struct PPP_PexeStreamHandler_1_0 PPP_PexeStreamHandler; +/** + * @} + */ + +#include "host/rpc.h" +#include "json/json.cpp" +using namespace std; +using namespace JSON; +const string ToString_PP_ArrayOutput_GetDataBuffer(const PP_ArrayOutput_GetDataBuffer &v); +void FromJSON_PP_ArrayOutput_GetDataBuffer(JSONIterator& iterator, PP_ArrayOutput_GetDataBuffer &value); +const string ToString_PP_ArrayOutput(const PP_ArrayOutput *v); +const string ToString_PP_ArrayOutput(const PP_ArrayOutput &v); +void FromJSON_PP_ArrayOutput(JSONIterator& iterator, PP_ArrayOutput &value); +const string ToString_PP_Bool(const PP_Bool *v); +const string ToString_PP_Bool(const PP_Bool &v); +void FromJSON_PP_Bool(JSONIterator& iterator, PP_Bool &value); +const string ToString_PP_VideoProfile(const PP_VideoProfile *v); +const string ToString_PP_VideoProfile(const PP_VideoProfile &v); +void FromJSON_PP_VideoProfile(JSONIterator& iterator, PP_VideoProfile &value); +const string ToString_PP_AudioProfile(const PP_AudioProfile *v); +const string ToString_PP_AudioProfile(const PP_AudioProfile &v); +void FromJSON_PP_AudioProfile(JSONIterator& iterator, PP_AudioProfile &value); +const string ToString_PP_HardwareAcceleration(const PP_HardwareAcceleration *v); +const string ToString_PP_HardwareAcceleration(const PP_HardwareAcceleration &v); +void FromJSON_PP_HardwareAcceleration(JSONIterator& iterator, PP_HardwareAcceleration &value); +const string ToString_PP_VideoPicture(const PP_VideoPicture *v); +const string ToString_PP_VideoPicture(const PP_VideoPicture &v); +void FromJSON_PP_VideoPicture(JSONIterator& iterator, PP_VideoPicture &value); +const string ToString_PP_VideoPicture_0_1(const PP_VideoPicture_0_1 *v); +const string ToString_PP_VideoPicture_0_1(const PP_VideoPicture_0_1 &v); +void FromJSON_PP_VideoPicture_0_1(JSONIterator& iterator, PP_VideoPicture_0_1 &value); +const string ToString_PP_VideoProfileDescription(const PP_VideoProfileDescription *v); +const string ToString_PP_VideoProfileDescription(const PP_VideoProfileDescription &v); +void FromJSON_PP_VideoProfileDescription(JSONIterator& iterator, PP_VideoProfileDescription &value); +const string ToString_PP_VideoProfileDescription_0_1(const PP_VideoProfileDescription_0_1 *v); +const string ToString_PP_VideoProfileDescription_0_1(const PP_VideoProfileDescription_0_1 &v); +void FromJSON_PP_VideoProfileDescription_0_1(JSONIterator& iterator, PP_VideoProfileDescription_0_1 &value); +const string ToString_PP_AudioProfileDescription(const PP_AudioProfileDescription *v); +const string ToString_PP_AudioProfileDescription(const PP_AudioProfileDescription &v); +void FromJSON_PP_AudioProfileDescription(JSONIterator& iterator, PP_AudioProfileDescription &value); +const string ToString_PP_BitstreamBuffer(const PP_BitstreamBuffer *v); +const string ToString_PP_BitstreamBuffer(const PP_BitstreamBuffer &v); +void FromJSON_PP_BitstreamBuffer(JSONIterator& iterator, PP_BitstreamBuffer &value); +const string ToString_PP_AudioBitstreamBuffer(const PP_AudioBitstreamBuffer *v); +const string ToString_PP_AudioBitstreamBuffer(const PP_AudioBitstreamBuffer &v); +void FromJSON_PP_AudioBitstreamBuffer(JSONIterator& iterator, PP_AudioBitstreamBuffer &value); +const string ToString_PP_CompletionCallback_Func(const PP_CompletionCallback_Func &v); +void FromJSON_PP_CompletionCallback_Func(JSONIterator& iterator, PP_CompletionCallback_Func &value); +const string ToString_PP_CompletionCallback_Flag(const PP_CompletionCallback_Flag *v); +const string ToString_PP_CompletionCallback_Flag(const PP_CompletionCallback_Flag &v); +void FromJSON_PP_CompletionCallback_Flag(JSONIterator& iterator, PP_CompletionCallback_Flag &value); +const string ToString_PP_CompletionCallback(const PP_CompletionCallback *v); +const string ToString_PP_CompletionCallback(const PP_CompletionCallback &v); +void FromJSON_PP_CompletionCallback(JSONIterator& iterator, PP_CompletionCallback &value); +const string ToString_PP_DirectoryEntry(const PP_DirectoryEntry *v); +const string ToString_PP_DirectoryEntry(const PP_DirectoryEntry &v); +void FromJSON_PP_DirectoryEntry(JSONIterator& iterator, PP_DirectoryEntry &value); +const string ToString_PP_FileType(const PP_FileType *v); +const string ToString_PP_FileType(const PP_FileType &v); +void FromJSON_PP_FileType(JSONIterator& iterator, PP_FileType &value); +const string ToString_PP_FileSystemType(const PP_FileSystemType *v); +const string ToString_PP_FileSystemType(const PP_FileSystemType &v); +void FromJSON_PP_FileSystemType(JSONIterator& iterator, PP_FileSystemType &value); +const string ToString_PP_FileInfo(const PP_FileInfo *v); +const string ToString_PP_FileInfo(const PP_FileInfo &v); +void FromJSON_PP_FileInfo(JSONIterator& iterator, PP_FileInfo &value); +const string ToString_PP_Graphics3DAttrib(const PP_Graphics3DAttrib *v); +const string ToString_PP_Graphics3DAttrib(const PP_Graphics3DAttrib &v); +void FromJSON_PP_Graphics3DAttrib(JSONIterator& iterator, PP_Graphics3DAttrib &value); +const string ToString_PP_InputEvent_Key(const PP_InputEvent_Key *v); +const string ToString_PP_InputEvent_Key(const PP_InputEvent_Key &v); +void FromJSON_PP_InputEvent_Key(JSONIterator& iterator, PP_InputEvent_Key &value); +const string ToString_PP_InputEvent_Character(const PP_InputEvent_Character *v); +const string ToString_PP_InputEvent_Character(const PP_InputEvent_Character &v); +void FromJSON_PP_InputEvent_Character(JSONIterator& iterator, PP_InputEvent_Character &value); +const string ToString_PP_InputEvent_Mouse(const PP_InputEvent_Mouse *v); +const string ToString_PP_InputEvent_Mouse(const PP_InputEvent_Mouse &v); +void FromJSON_PP_InputEvent_Mouse(JSONIterator& iterator, PP_InputEvent_Mouse &value); +const string ToString_PP_InputEvent_Wheel(const PP_InputEvent_Wheel *v); +const string ToString_PP_InputEvent_Wheel(const PP_InputEvent_Wheel &v); +void FromJSON_PP_InputEvent_Wheel(JSONIterator& iterator, PP_InputEvent_Wheel &value); +const string ToString_PP_Instance(const PP_Instance *v); +const string ToString_PP_Instance(const PP_Instance &v); +void FromJSON_PP_Instance(JSONIterator& iterator, PP_Instance &value); +const string ToString_PP_Module(const PP_Module *v); +const string ToString_PP_Module(const PP_Module &v); +void FromJSON_PP_Module(JSONIterator& iterator, PP_Module &value); +const string ToString_PP_Point(const PP_Point *v); +const string ToString_PP_Point(const PP_Point &v); +void FromJSON_PP_Point(JSONIterator& iterator, PP_Point &value); +const string ToString_PP_FloatPoint(const PP_FloatPoint *v); +const string ToString_PP_FloatPoint(const PP_FloatPoint &v); +void FromJSON_PP_FloatPoint(JSONIterator& iterator, PP_FloatPoint &value); +const string ToString_PP_Rect(const PP_Rect *v); +const string ToString_PP_Rect(const PP_Rect &v); +void FromJSON_PP_Rect(JSONIterator& iterator, PP_Rect &value); +const string ToString_PP_FloatRect(const PP_FloatRect *v); +const string ToString_PP_FloatRect(const PP_FloatRect &v); +void FromJSON_PP_FloatRect(JSONIterator& iterator, PP_FloatRect &value); +const string ToString_PP_Resource(const PP_Resource *v); +const string ToString_PP_Resource(const PP_Resource &v); +void FromJSON_PP_Resource(JSONIterator& iterator, PP_Resource &value); +const string ToString_PP_Size(const PP_Size *v); +const string ToString_PP_Size(const PP_Size &v); +void FromJSON_PP_Size(JSONIterator& iterator, PP_Size &value); +const string ToString_PP_FloatSize(const PP_FloatSize *v); +const string ToString_PP_FloatSize(const PP_FloatSize &v); +void FromJSON_PP_FloatSize(JSONIterator& iterator, PP_FloatSize &value); +const string ToString_PP_Time(const PP_Time *v); +const string ToString_PP_Time(const PP_Time &v); +void FromJSON_PP_Time(JSONIterator& iterator, PP_Time &value); +const string ToString_PP_TimeTicks(const PP_TimeTicks *v); +const string ToString_PP_TimeTicks(const PP_TimeTicks &v); +void FromJSON_PP_TimeTicks(JSONIterator& iterator, PP_TimeTicks &value); +const string ToString_PP_TimeDelta(const PP_TimeDelta *v); +const string ToString_PP_TimeDelta(const PP_TimeDelta &v); +void FromJSON_PP_TimeDelta(JSONIterator& iterator, PP_TimeDelta &value); +const string ToString_PP_TouchPoint(const PP_TouchPoint *v); +const string ToString_PP_TouchPoint(const PP_TouchPoint &v); +void FromJSON_PP_TouchPoint(JSONIterator& iterator, PP_TouchPoint &value); +const string ToString_PP_VarType(const PP_VarType *v); +const string ToString_PP_VarType(const PP_VarType &v); +void FromJSON_PP_VarType(JSONIterator& iterator, PP_VarType &value); +const string ToString_PP_VarValue(const PP_VarValue *v); +const string ToString_PP_VarValue(const PP_VarValue &v); +void FromJSON_PP_VarValue(JSONIterator& iterator, PP_VarValue &value); +const string ToString_PP_Var(const PP_Var *v); +const string ToString_PP_Var(const PP_Var &v); +void FromJSON_PP_Var(JSONIterator& iterator, PP_Var &value); +const string ToString_PPB_GetInterface(const PPB_GetInterface &v); +void FromJSON_PPB_GetInterface(JSONIterator& iterator, PPB_GetInterface &value); +const string ToString_PPB_Audio_Callback(const PPB_Audio_Callback_1_0 &v); +void FromJSON_PPB_Audio_Callback(JSONIterator& iterator, PPB_Audio_Callback_1_0 &value); +const string ToString_PPB_Audio_Callback(const PPB_Audio_Callback &v); +void FromJSON_PPB_Audio_Callback(JSONIterator& iterator, PPB_Audio_Callback &value); +#ifdef INTERPOSE +static PPB_Audio_1_0 *_real_PPB_Audio_1_0; +#endif // INTERPOSE +const string ToString_PPB_Audio(const PPB_Audio_1_0 *v); +#ifdef INTERPOSE +static PPB_Audio_1_1 *_real_PPB_Audio_1_1; +#endif // INTERPOSE +const string ToString_PPB_Audio(const PPB_Audio_1_1 *v); +const string ToString_PP_AudioBuffer_SampleRate(const PP_AudioBuffer_SampleRate *v); +const string ToString_PP_AudioBuffer_SampleRate(const PP_AudioBuffer_SampleRate &v); +void FromJSON_PP_AudioBuffer_SampleRate(JSONIterator& iterator, PP_AudioBuffer_SampleRate &value); +const string ToString_PP_AudioBuffer_SampleSize(const PP_AudioBuffer_SampleSize *v); +const string ToString_PP_AudioBuffer_SampleSize(const PP_AudioBuffer_SampleSize &v); +void FromJSON_PP_AudioBuffer_SampleSize(JSONIterator& iterator, PP_AudioBuffer_SampleSize &value); +#ifdef INTERPOSE +static PPB_AudioBuffer_0_1 *_real_PPB_AudioBuffer_0_1; +#endif // INTERPOSE +const string ToString_PPB_AudioBuffer(const PPB_AudioBuffer_0_1 *v); +const string ToString_PP_AudioSampleRate(const PP_AudioSampleRate *v); +const string ToString_PP_AudioSampleRate(const PP_AudioSampleRate &v); +void FromJSON_PP_AudioSampleRate(JSONIterator& iterator, PP_AudioSampleRate &value); +#ifdef INTERPOSE +static PPB_AudioConfig_1_0 *_real_PPB_AudioConfig_1_0; +#endif // INTERPOSE +const string ToString_PPB_AudioConfig(const PPB_AudioConfig_1_0 *v); +#ifdef INTERPOSE +static PPB_AudioConfig_1_1 *_real_PPB_AudioConfig_1_1; +#endif // INTERPOSE +const string ToString_PPB_AudioConfig(const PPB_AudioConfig_1_1 *v); +#ifdef INTERPOSE +static PPB_AudioEncoder_0_1 *_real_PPB_AudioEncoder_0_1; +#endif // INTERPOSE +const string ToString_PPB_AudioEncoder(const PPB_AudioEncoder_0_1 *v); +#ifdef INTERPOSE +static PPB_Compositor_0_1 *_real_PPB_Compositor_0_1; +#endif // INTERPOSE +const string ToString_PPB_Compositor(const PPB_Compositor_0_1 *v); +const string ToString_PP_BlendMode(const PP_BlendMode *v); +const string ToString_PP_BlendMode(const PP_BlendMode &v); +void FromJSON_PP_BlendMode(JSONIterator& iterator, PP_BlendMode &value); +#ifdef INTERPOSE +static PPB_CompositorLayer_0_1 *_real_PPB_CompositorLayer_0_1; +#endif // INTERPOSE +const string ToString_PPB_CompositorLayer(const PPB_CompositorLayer_0_1 *v); +#ifdef INTERPOSE +static PPB_CompositorLayer_0_2 *_real_PPB_CompositorLayer_0_2; +#endif // INTERPOSE +const string ToString_PPB_CompositorLayer(const PPB_CompositorLayer_0_2 *v); +const string ToString_PP_LogLevel(const PP_LogLevel *v); +const string ToString_PP_LogLevel(const PP_LogLevel &v); +void FromJSON_PP_LogLevel(JSONIterator& iterator, PP_LogLevel &value); +#ifdef INTERPOSE +static PPB_Console_1_0 *_real_PPB_Console_1_0; +#endif // INTERPOSE +const string ToString_PPB_Console(const PPB_Console_1_0 *v); +#ifdef INTERPOSE +static PPB_Core_1_0 *_real_PPB_Core_1_0; +#endif // INTERPOSE +const string ToString_PPB_Core(const PPB_Core_1_0 *v); +const string ToString_PP_FileOpenFlags(const PP_FileOpenFlags *v); +const string ToString_PP_FileOpenFlags(const PP_FileOpenFlags &v); +void FromJSON_PP_FileOpenFlags(JSONIterator& iterator, PP_FileOpenFlags &value); +#ifdef INTERPOSE +static PPB_FileIO_1_0 *_real_PPB_FileIO_1_0; +#endif // INTERPOSE +const string ToString_PPB_FileIO(const PPB_FileIO_1_0 *v); +#ifdef INTERPOSE +static PPB_FileIO_1_1 *_real_PPB_FileIO_1_1; +#endif // INTERPOSE +const string ToString_PPB_FileIO(const PPB_FileIO_1_1 *v); +const string ToString_PP_MakeDirectoryFlags(const PP_MakeDirectoryFlags *v); +const string ToString_PP_MakeDirectoryFlags(const PP_MakeDirectoryFlags &v); +void FromJSON_PP_MakeDirectoryFlags(JSONIterator& iterator, PP_MakeDirectoryFlags &value); +#ifdef INTERPOSE +static PPB_FileRef_1_0 *_real_PPB_FileRef_1_0; +#endif // INTERPOSE +const string ToString_PPB_FileRef(const PPB_FileRef_1_0 *v); +#ifdef INTERPOSE +static PPB_FileRef_1_1 *_real_PPB_FileRef_1_1; +#endif // INTERPOSE +const string ToString_PPB_FileRef(const PPB_FileRef_1_1 *v); +#ifdef INTERPOSE +static PPB_FileRef_1_2 *_real_PPB_FileRef_1_2; +#endif // INTERPOSE +const string ToString_PPB_FileRef(const PPB_FileRef_1_2 *v); +#ifdef INTERPOSE +static PPB_FileSystem_1_0 *_real_PPB_FileSystem_1_0; +#endif // INTERPOSE +const string ToString_PPB_FileSystem(const PPB_FileSystem_1_0 *v); +#ifdef INTERPOSE +static PPB_Fullscreen_1_0 *_real_PPB_Fullscreen_1_0; +#endif // INTERPOSE +const string ToString_PPB_Fullscreen(const PPB_Fullscreen_1_0 *v); +const string ToString_PP_GamepadSampleData(const PP_GamepadSampleData *v); +const string ToString_PP_GamepadSampleData(const PP_GamepadSampleData &v); +void FromJSON_PP_GamepadSampleData(JSONIterator& iterator, PP_GamepadSampleData &value); +const string ToString_PP_GamepadsSampleData(const PP_GamepadsSampleData *v); +const string ToString_PP_GamepadsSampleData(const PP_GamepadsSampleData &v); +void FromJSON_PP_GamepadsSampleData(JSONIterator& iterator, PP_GamepadsSampleData &value); +#ifdef INTERPOSE +static PPB_Gamepad_1_0 *_real_PPB_Gamepad_1_0; +#endif // INTERPOSE +const string ToString_PPB_Gamepad(const PPB_Gamepad_1_0 *v); +#ifdef INTERPOSE +static PPB_Graphics2D_1_0 *_real_PPB_Graphics2D_1_0; +#endif // INTERPOSE +const string ToString_PPB_Graphics2D(const PPB_Graphics2D_1_0 *v); +#ifdef INTERPOSE +static PPB_Graphics2D_1_1 *_real_PPB_Graphics2D_1_1; +#endif // INTERPOSE +const string ToString_PPB_Graphics2D(const PPB_Graphics2D_1_1 *v); +#ifdef INTERPOSE +static PPB_Graphics2D_1_2 *_real_PPB_Graphics2D_1_2; +#endif // INTERPOSE +const string ToString_PPB_Graphics2D(const PPB_Graphics2D_1_2 *v); +#ifdef INTERPOSE +static PPB_Graphics3D_1_0 *_real_PPB_Graphics3D_1_0; +#endif // INTERPOSE +const string ToString_PPB_Graphics3D(const PPB_Graphics3D_1_0 *v); +const string ToString_PP_HostResolver_Flag(const PP_HostResolver_Flag *v); +const string ToString_PP_HostResolver_Flag(const PP_HostResolver_Flag &v); +void FromJSON_PP_HostResolver_Flag(JSONIterator& iterator, PP_HostResolver_Flag &value); +const string ToString_PP_HostResolver_Hint(const PP_HostResolver_Hint *v); +const string ToString_PP_HostResolver_Hint(const PP_HostResolver_Hint &v); +void FromJSON_PP_HostResolver_Hint(JSONIterator& iterator, PP_HostResolver_Hint &value); +#ifdef INTERPOSE +static PPB_HostResolver_1_0 *_real_PPB_HostResolver_1_0; +#endif // INTERPOSE +const string ToString_PPB_HostResolver(const PPB_HostResolver_1_0 *v); +const string ToString_PP_ImageDataFormat(const PP_ImageDataFormat *v); +const string ToString_PP_ImageDataFormat(const PP_ImageDataFormat &v); +void FromJSON_PP_ImageDataFormat(JSONIterator& iterator, PP_ImageDataFormat &value); +const string ToString_PP_ImageDataDesc(const PP_ImageDataDesc *v); +const string ToString_PP_ImageDataDesc(const PP_ImageDataDesc &v); +void FromJSON_PP_ImageDataDesc(JSONIterator& iterator, PP_ImageDataDesc &value); +#ifdef INTERPOSE +static PPB_ImageData_1_0 *_real_PPB_ImageData_1_0; +#endif // INTERPOSE +const string ToString_PPB_ImageData(const PPB_ImageData_1_0 *v); +const string ToString_PP_InputEvent_Type(const PP_InputEvent_Type *v); +const string ToString_PP_InputEvent_Type(const PP_InputEvent_Type &v); +void FromJSON_PP_InputEvent_Type(JSONIterator& iterator, PP_InputEvent_Type &value); +const string ToString_PP_InputEvent_Modifier(const PP_InputEvent_Modifier *v); +const string ToString_PP_InputEvent_Modifier(const PP_InputEvent_Modifier &v); +void FromJSON_PP_InputEvent_Modifier(JSONIterator& iterator, PP_InputEvent_Modifier &value); +const string ToString_PP_InputEvent_MouseButton(const PP_InputEvent_MouseButton *v); +const string ToString_PP_InputEvent_MouseButton(const PP_InputEvent_MouseButton &v); +void FromJSON_PP_InputEvent_MouseButton(JSONIterator& iterator, PP_InputEvent_MouseButton &value); +const string ToString_PP_InputEvent_Class(const PP_InputEvent_Class *v); +const string ToString_PP_InputEvent_Class(const PP_InputEvent_Class &v); +void FromJSON_PP_InputEvent_Class(JSONIterator& iterator, PP_InputEvent_Class &value); +#ifdef INTERPOSE +static PPB_InputEvent_1_0 *_real_PPB_InputEvent_1_0; +#endif // INTERPOSE +const string ToString_PPB_InputEvent(const PPB_InputEvent_1_0 *v); +#ifdef INTERPOSE +static PPB_MouseInputEvent_1_0 *_real_PPB_MouseInputEvent_1_0; +#endif // INTERPOSE +const string ToString_PPB_MouseInputEvent(const PPB_MouseInputEvent_1_0 *v); +#ifdef INTERPOSE +static PPB_MouseInputEvent_1_1 *_real_PPB_MouseInputEvent_1_1; +#endif // INTERPOSE +const string ToString_PPB_MouseInputEvent(const PPB_MouseInputEvent_1_1 *v); +#ifdef INTERPOSE +static PPB_WheelInputEvent_1_0 *_real_PPB_WheelInputEvent_1_0; +#endif // INTERPOSE +const string ToString_PPB_WheelInputEvent(const PPB_WheelInputEvent_1_0 *v); +#ifdef INTERPOSE +static PPB_KeyboardInputEvent_1_0 *_real_PPB_KeyboardInputEvent_1_0; +#endif // INTERPOSE +const string ToString_PPB_KeyboardInputEvent(const PPB_KeyboardInputEvent_1_0 *v); +#ifdef INTERPOSE +static PPB_KeyboardInputEvent_1_2 *_real_PPB_KeyboardInputEvent_1_2; +#endif // INTERPOSE +const string ToString_PPB_KeyboardInputEvent(const PPB_KeyboardInputEvent_1_2 *v); +const string ToString_PP_TouchListType(const PP_TouchListType *v); +const string ToString_PP_TouchListType(const PP_TouchListType &v); +void FromJSON_PP_TouchListType(JSONIterator& iterator, PP_TouchListType &value); +#ifdef INTERPOSE +static PPB_TouchInputEvent_1_0 *_real_PPB_TouchInputEvent_1_0; +#endif // INTERPOSE +const string ToString_PPB_TouchInputEvent(const PPB_TouchInputEvent_1_0 *v); +#ifdef INTERPOSE +static PPB_IMEInputEvent_1_0 *_real_PPB_IMEInputEvent_1_0; +#endif // INTERPOSE +const string ToString_PPB_IMEInputEvent(const PPB_IMEInputEvent_1_0 *v); +#ifdef INTERPOSE +static PPB_Instance_1_0 *_real_PPB_Instance_1_0; +#endif // INTERPOSE +const string ToString_PPB_Instance(const PPB_Instance_1_0 *v); +const string ToString_PP_MediaStreamAudioTrack_Attrib(const PP_MediaStreamAudioTrack_Attrib *v); +const string ToString_PP_MediaStreamAudioTrack_Attrib(const PP_MediaStreamAudioTrack_Attrib &v); +void FromJSON_PP_MediaStreamAudioTrack_Attrib(JSONIterator& iterator, PP_MediaStreamAudioTrack_Attrib &value); +#ifdef INTERPOSE +static PPB_MediaStreamAudioTrack_0_1 *_real_PPB_MediaStreamAudioTrack_0_1; +#endif // INTERPOSE +const string ToString_PPB_MediaStreamAudioTrack(const PPB_MediaStreamAudioTrack_0_1 *v); +const string ToString_PP_MediaStreamVideoTrack_Attrib(const PP_MediaStreamVideoTrack_Attrib *v); +const string ToString_PP_MediaStreamVideoTrack_Attrib(const PP_MediaStreamVideoTrack_Attrib &v); +void FromJSON_PP_MediaStreamVideoTrack_Attrib(JSONIterator& iterator, PP_MediaStreamVideoTrack_Attrib &value); +#ifdef INTERPOSE +static PPB_MediaStreamVideoTrack_0_1 *_real_PPB_MediaStreamVideoTrack_0_1; +#endif // INTERPOSE +const string ToString_PPB_MediaStreamVideoTrack(const PPB_MediaStreamVideoTrack_0_1 *v); +#ifdef INTERPOSE +static PPB_MediaStreamVideoTrack_1_0 *_real_PPB_MediaStreamVideoTrack_1_0; +#endif // INTERPOSE +const string ToString_PPB_MediaStreamVideoTrack(const PPB_MediaStreamVideoTrack_1_0 *v); +#ifdef INTERPOSE +static PPB_MessageLoop_1_0 *_real_PPB_MessageLoop_1_0; +#endif // INTERPOSE +const string ToString_PPB_MessageLoop(const PPB_MessageLoop_1_0 *v); +#ifdef INTERPOSE +static PPB_Messaging_1_0 *_real_PPB_Messaging_1_0; +#endif // INTERPOSE +const string ToString_PPB_Messaging(const PPB_Messaging_1_0 *v); +#ifdef INTERPOSE +static PPB_Messaging_1_2 *_real_PPB_Messaging_1_2; +#endif // INTERPOSE +const string ToString_PPB_Messaging(const PPB_Messaging_1_2 *v); +const string ToString_PP_MouseCursor_Type(const PP_MouseCursor_Type *v); +const string ToString_PP_MouseCursor_Type(const PP_MouseCursor_Type &v); +void FromJSON_PP_MouseCursor_Type(JSONIterator& iterator, PP_MouseCursor_Type &value); +#ifdef INTERPOSE +static PPB_MouseCursor_1_0 *_real_PPB_MouseCursor_1_0; +#endif // INTERPOSE +const string ToString_PPB_MouseCursor(const PPB_MouseCursor_1_0 *v); +#ifdef INTERPOSE +static PPB_MouseLock_1_0 *_real_PPB_MouseLock_1_0; +#endif // INTERPOSE +const string ToString_PPB_MouseLock(const PPB_MouseLock_1_0 *v); +const string ToString_PP_NetAddress_Family(const PP_NetAddress_Family *v); +const string ToString_PP_NetAddress_Family(const PP_NetAddress_Family &v); +void FromJSON_PP_NetAddress_Family(JSONIterator& iterator, PP_NetAddress_Family &value); +const string ToString_PP_NetAddress_IPv4(const PP_NetAddress_IPv4 *v); +const string ToString_PP_NetAddress_IPv4(const PP_NetAddress_IPv4 &v); +void FromJSON_PP_NetAddress_IPv4(JSONIterator& iterator, PP_NetAddress_IPv4 &value); +const string ToString_PP_NetAddress_IPv6(const PP_NetAddress_IPv6 *v); +const string ToString_PP_NetAddress_IPv6(const PP_NetAddress_IPv6 &v); +void FromJSON_PP_NetAddress_IPv6(JSONIterator& iterator, PP_NetAddress_IPv6 &value); +#ifdef INTERPOSE +static PPB_NetAddress_1_0 *_real_PPB_NetAddress_1_0; +#endif // INTERPOSE +const string ToString_PPB_NetAddress(const PPB_NetAddress_1_0 *v); +const string ToString_PP_NetworkList_Type(const PP_NetworkList_Type *v); +const string ToString_PP_NetworkList_Type(const PP_NetworkList_Type &v); +void FromJSON_PP_NetworkList_Type(JSONIterator& iterator, PP_NetworkList_Type &value); +const string ToString_PP_NetworkList_State(const PP_NetworkList_State *v); +const string ToString_PP_NetworkList_State(const PP_NetworkList_State &v); +void FromJSON_PP_NetworkList_State(JSONIterator& iterator, PP_NetworkList_State &value); +#ifdef INTERPOSE +static PPB_NetworkList_1_0 *_real_PPB_NetworkList_1_0; +#endif // INTERPOSE +const string ToString_PPB_NetworkList(const PPB_NetworkList_1_0 *v); +#ifdef INTERPOSE +static PPB_NetworkMonitor_1_0 *_real_PPB_NetworkMonitor_1_0; +#endif // INTERPOSE +const string ToString_PPB_NetworkMonitor(const PPB_NetworkMonitor_1_0 *v); +#ifdef INTERPOSE +static PPB_NetworkProxy_1_0 *_real_PPB_NetworkProxy_1_0; +#endif // INTERPOSE +const string ToString_PPB_NetworkProxy(const PPB_NetworkProxy_1_0 *v); +#ifdef INTERPOSE +static PPB_OpenGLES2_1_0 *_real_PPB_OpenGLES2_1_0; +#endif // INTERPOSE +const string ToString_PPB_OpenGLES2(const PPB_OpenGLES2_1_0 *v); +#ifdef INTERPOSE +static PPB_OpenGLES2InstancedArrays_1_0 *_real_PPB_OpenGLES2InstancedArrays_1_0; +#endif // INTERPOSE +const string ToString_PPB_OpenGLES2InstancedArrays(const PPB_OpenGLES2InstancedArrays_1_0 *v); +#ifdef INTERPOSE +static PPB_OpenGLES2FramebufferBlit_1_0 *_real_PPB_OpenGLES2FramebufferBlit_1_0; +#endif // INTERPOSE +const string ToString_PPB_OpenGLES2FramebufferBlit(const PPB_OpenGLES2FramebufferBlit_1_0 *v); +#ifdef INTERPOSE +static PPB_OpenGLES2FramebufferMultisample_1_0 *_real_PPB_OpenGLES2FramebufferMultisample_1_0; +#endif // INTERPOSE +const string ToString_PPB_OpenGLES2FramebufferMultisample(const PPB_OpenGLES2FramebufferMultisample_1_0 *v); +#ifdef INTERPOSE +static PPB_OpenGLES2ChromiumEnableFeature_1_0 *_real_PPB_OpenGLES2ChromiumEnableFeature_1_0; +#endif // INTERPOSE +const string ToString_PPB_OpenGLES2ChromiumEnableFeature(const PPB_OpenGLES2ChromiumEnableFeature_1_0 *v); +#ifdef INTERPOSE +static PPB_OpenGLES2ChromiumMapSub_1_0 *_real_PPB_OpenGLES2ChromiumMapSub_1_0; +#endif // INTERPOSE +const string ToString_PPB_OpenGLES2ChromiumMapSub(const PPB_OpenGLES2ChromiumMapSub_1_0 *v); +#ifdef INTERPOSE +static PPB_OpenGLES2Query_1_0 *_real_PPB_OpenGLES2Query_1_0; +#endif // INTERPOSE +const string ToString_PPB_OpenGLES2Query(const PPB_OpenGLES2Query_1_0 *v); +#ifdef INTERPOSE +static PPB_OpenGLES2VertexArrayObject_1_0 *_real_PPB_OpenGLES2VertexArrayObject_1_0; +#endif // INTERPOSE +const string ToString_PPB_OpenGLES2VertexArrayObject(const PPB_OpenGLES2VertexArrayObject_1_0 *v); +const string ToString_PP_TCPSocket_Option(const PP_TCPSocket_Option *v); +const string ToString_PP_TCPSocket_Option(const PP_TCPSocket_Option &v); +void FromJSON_PP_TCPSocket_Option(JSONIterator& iterator, PP_TCPSocket_Option &value); +#ifdef INTERPOSE +static PPB_TCPSocket_1_0 *_real_PPB_TCPSocket_1_0; +#endif // INTERPOSE +const string ToString_PPB_TCPSocket(const PPB_TCPSocket_1_0 *v); +#ifdef INTERPOSE +static PPB_TCPSocket_1_1 *_real_PPB_TCPSocket_1_1; +#endif // INTERPOSE +const string ToString_PPB_TCPSocket(const PPB_TCPSocket_1_1 *v); +#ifdef INTERPOSE +static PPB_TCPSocket_1_2 *_real_PPB_TCPSocket_1_2; +#endif // INTERPOSE +const string ToString_PPB_TCPSocket(const PPB_TCPSocket_1_2 *v); +const string ToString_PP_TextInput_Type(const PP_TextInput_Type *v); +const string ToString_PP_TextInput_Type(const PP_TextInput_Type &v); +void FromJSON_PP_TextInput_Type(JSONIterator& iterator, PP_TextInput_Type &value); +#ifdef INTERPOSE +static PPB_TextInputController_1_0 *_real_PPB_TextInputController_1_0; +#endif // INTERPOSE +const string ToString_PPB_TextInputController(const PPB_TextInputController_1_0 *v); +const string ToString_PP_UDPSocket_Option(const PP_UDPSocket_Option *v); +const string ToString_PP_UDPSocket_Option(const PP_UDPSocket_Option &v); +void FromJSON_PP_UDPSocket_Option(JSONIterator& iterator, PP_UDPSocket_Option &value); +#ifdef INTERPOSE +static PPB_UDPSocket_1_0 *_real_PPB_UDPSocket_1_0; +#endif // INTERPOSE +const string ToString_PPB_UDPSocket(const PPB_UDPSocket_1_0 *v); +#ifdef INTERPOSE +static PPB_UDPSocket_1_1 *_real_PPB_UDPSocket_1_1; +#endif // INTERPOSE +const string ToString_PPB_UDPSocket(const PPB_UDPSocket_1_1 *v); +#ifdef INTERPOSE +static PPB_UDPSocket_1_2 *_real_PPB_UDPSocket_1_2; +#endif // INTERPOSE +const string ToString_PPB_UDPSocket(const PPB_UDPSocket_1_2 *v); +#ifdef INTERPOSE +static PPB_URLLoader_1_0 *_real_PPB_URLLoader_1_0; +#endif // INTERPOSE +const string ToString_PPB_URLLoader(const PPB_URLLoader_1_0 *v); +const string ToString_PP_URLRequestProperty(const PP_URLRequestProperty *v); +const string ToString_PP_URLRequestProperty(const PP_URLRequestProperty &v); +void FromJSON_PP_URLRequestProperty(JSONIterator& iterator, PP_URLRequestProperty &value); +#ifdef INTERPOSE +static PPB_URLRequestInfo_1_0 *_real_PPB_URLRequestInfo_1_0; +#endif // INTERPOSE +const string ToString_PPB_URLRequestInfo(const PPB_URLRequestInfo_1_0 *v); +const string ToString_PP_URLResponseProperty(const PP_URLResponseProperty *v); +const string ToString_PP_URLResponseProperty(const PP_URLResponseProperty &v); +void FromJSON_PP_URLResponseProperty(JSONIterator& iterator, PP_URLResponseProperty &value); +#ifdef INTERPOSE +static PPB_URLResponseInfo_1_0 *_real_PPB_URLResponseInfo_1_0; +#endif // INTERPOSE +const string ToString_PPB_URLResponseInfo(const PPB_URLResponseInfo_1_0 *v); +#ifdef INTERPOSE +static PPB_Var_1_0 *_real_PPB_Var_1_0; +#endif // INTERPOSE +const string ToString_PPB_Var(const PPB_Var_1_0 *v); +#ifdef INTERPOSE +static PPB_Var_1_1 *_real_PPB_Var_1_1; +#endif // INTERPOSE +const string ToString_PPB_Var(const PPB_Var_1_1 *v); +#ifdef INTERPOSE +static PPB_Var_1_2 *_real_PPB_Var_1_2; +#endif // INTERPOSE +const string ToString_PPB_Var(const PPB_Var_1_2 *v); +#ifdef INTERPOSE +static PPB_VarArray_1_0 *_real_PPB_VarArray_1_0; +#endif // INTERPOSE +const string ToString_PPB_VarArray(const PPB_VarArray_1_0 *v); +#ifdef INTERPOSE +static PPB_VarArrayBuffer_1_0 *_real_PPB_VarArrayBuffer_1_0; +#endif // INTERPOSE +const string ToString_PPB_VarArrayBuffer(const PPB_VarArrayBuffer_1_0 *v); +#ifdef INTERPOSE +static PPB_VarDictionary_1_0 *_real_PPB_VarDictionary_1_0; +#endif // INTERPOSE +const string ToString_PPB_VarDictionary(const PPB_VarDictionary_1_0 *v); +#ifdef INTERPOSE +static PPB_VideoDecoder_0_1 *_real_PPB_VideoDecoder_0_1; +#endif // INTERPOSE +const string ToString_PPB_VideoDecoder(const PPB_VideoDecoder_0_1 *v); +#ifdef INTERPOSE +static PPB_VideoDecoder_0_2 *_real_PPB_VideoDecoder_0_2; +#endif // INTERPOSE +const string ToString_PPB_VideoDecoder(const PPB_VideoDecoder_0_2 *v); +#ifdef INTERPOSE +static PPB_VideoDecoder_1_0 *_real_PPB_VideoDecoder_1_0; +#endif // INTERPOSE +const string ToString_PPB_VideoDecoder(const PPB_VideoDecoder_1_0 *v); +#ifdef INTERPOSE +static PPB_VideoDecoder_1_1 *_real_PPB_VideoDecoder_1_1; +#endif // INTERPOSE +const string ToString_PPB_VideoDecoder(const PPB_VideoDecoder_1_1 *v); +#ifdef INTERPOSE +static PPB_VideoEncoder_0_1 *_real_PPB_VideoEncoder_0_1; +#endif // INTERPOSE +const string ToString_PPB_VideoEncoder(const PPB_VideoEncoder_0_1 *v); +#ifdef INTERPOSE +static PPB_VideoEncoder_0_2 *_real_PPB_VideoEncoder_0_2; +#endif // INTERPOSE +const string ToString_PPB_VideoEncoder(const PPB_VideoEncoder_0_2 *v); +const string ToString_PP_VideoFrame_Format(const PP_VideoFrame_Format *v); +const string ToString_PP_VideoFrame_Format(const PP_VideoFrame_Format &v); +void FromJSON_PP_VideoFrame_Format(JSONIterator& iterator, PP_VideoFrame_Format &value); +#ifdef INTERPOSE +static PPB_VideoFrame_0_1 *_real_PPB_VideoFrame_0_1; +#endif // INTERPOSE +const string ToString_PPB_VideoFrame(const PPB_VideoFrame_0_1 *v); +#ifdef INTERPOSE +static PPB_View_1_0 *_real_PPB_View_1_0; +#endif // INTERPOSE +const string ToString_PPB_View(const PPB_View_1_0 *v); +#ifdef INTERPOSE +static PPB_View_1_1 *_real_PPB_View_1_1; +#endif // INTERPOSE +const string ToString_PPB_View(const PPB_View_1_1 *v); +#ifdef INTERPOSE +static PPB_View_1_2 *_real_PPB_View_1_2; +#endif // INTERPOSE +const string ToString_PPB_View(const PPB_View_1_2 *v); +#ifdef INTERPOSE +static PPB_VpnProvider_0_1 *_real_PPB_VpnProvider_0_1; +#endif // INTERPOSE +const string ToString_PPB_VpnProvider(const PPB_VpnProvider_0_1 *v); +const string ToString_PP_WebSocketReadyState(const PP_WebSocketReadyState *v); +const string ToString_PP_WebSocketReadyState(const PP_WebSocketReadyState &v); +void FromJSON_PP_WebSocketReadyState(JSONIterator& iterator, PP_WebSocketReadyState &value); +const string ToString_PP_WebSocketCloseCode(const PP_WebSocketCloseCode *v); +const string ToString_PP_WebSocketCloseCode(const PP_WebSocketCloseCode &v); +void FromJSON_PP_WebSocketCloseCode(JSONIterator& iterator, PP_WebSocketCloseCode &value); +#ifdef INTERPOSE +static PPB_WebSocket_1_0 *_real_PPB_WebSocket_1_0; +#endif // INTERPOSE +const string ToString_PPB_WebSocket(const PPB_WebSocket_1_0 *v); +const string ToString_PP_InitializeModule_Func(const PP_InitializeModule_Func &v); +void FromJSON_PP_InitializeModule_Func(JSONIterator& iterator, PP_InitializeModule_Func &value); +const string ToString_PP_ShutdownModule_Func(const PP_ShutdownModule_Func &v); +void FromJSON_PP_ShutdownModule_Func(JSONIterator& iterator, PP_ShutdownModule_Func &value); +const string ToString_PP_GetInterface_Func(const PP_GetInterface_Func &v); +void FromJSON_PP_GetInterface_Func(JSONIterator& iterator, PP_GetInterface_Func &value); +#ifdef INTERPOSE +static PPP_Graphics3D_1_0 *_real_PPP_Graphics3D_1_0; +#endif // INTERPOSE +static char* Call_PPP_Graphics3D(void* _interface, JSONIterator& iterator); +#ifdef INTERPOSE +static PPP_InputEvent_0_1 *_real_PPP_InputEvent_0_1; +#endif // INTERPOSE +static char* Call_PPP_InputEvent(void* _interface, JSONIterator& iterator); +#ifdef INTERPOSE +static PPP_Instance_1_0 *_real_PPP_Instance_1_0; +#endif // INTERPOSE +static char* Call_PPP_Instance_1_0(void* _interface, JSONIterator& iterator); +#ifdef INTERPOSE +static PPP_Instance_1_1 *_real_PPP_Instance_1_1; +#endif // INTERPOSE +static char* Call_PPP_Instance(void* _interface, JSONIterator& iterator); +#ifdef INTERPOSE +static PPP_MessageHandler_0_2 *_real_PPP_MessageHandler_0_2; +#endif // INTERPOSE +static char* Call_PPP_MessageHandler(void* _interface, JSONIterator& iterator); +#ifdef INTERPOSE +static PPP_Messaging_1_0 *_real_PPP_Messaging_1_0; +#endif // INTERPOSE +static char* Call_PPP_Messaging(void* _interface, JSONIterator& iterator); +#ifdef INTERPOSE +static PPP_MouseLock_1_0 *_real_PPP_MouseLock_1_0; +#endif // INTERPOSE +static char* Call_PPP_MouseLock(void* _interface, JSONIterator& iterator); +#ifdef INTERPOSE +static PPB_BrokerTrusted_0_2 *_real_PPB_BrokerTrusted_0_2; +#endif // INTERPOSE +const string ToString_PPB_BrokerTrusted(const PPB_BrokerTrusted_0_2 *v); +#ifdef INTERPOSE +static PPB_BrokerTrusted_0_3 *_real_PPB_BrokerTrusted_0_3; +#endif // INTERPOSE +const string ToString_PPB_BrokerTrusted(const PPB_BrokerTrusted_0_3 *v); +const string ToString_PP_BrowserFont_Trusted_Family(const PP_BrowserFont_Trusted_Family *v); +const string ToString_PP_BrowserFont_Trusted_Family(const PP_BrowserFont_Trusted_Family &v); +void FromJSON_PP_BrowserFont_Trusted_Family(JSONIterator& iterator, PP_BrowserFont_Trusted_Family &value); +const string ToString_PP_BrowserFont_Trusted_Weight(const PP_BrowserFont_Trusted_Weight *v); +const string ToString_PP_BrowserFont_Trusted_Weight(const PP_BrowserFont_Trusted_Weight &v); +void FromJSON_PP_BrowserFont_Trusted_Weight(JSONIterator& iterator, PP_BrowserFont_Trusted_Weight &value); +const string ToString_PP_BrowserFont_Trusted_Description(const PP_BrowserFont_Trusted_Description *v); +const string ToString_PP_BrowserFont_Trusted_Description(const PP_BrowserFont_Trusted_Description &v); +void FromJSON_PP_BrowserFont_Trusted_Description(JSONIterator& iterator, PP_BrowserFont_Trusted_Description &value); +const string ToString_PP_BrowserFont_Trusted_Metrics(const PP_BrowserFont_Trusted_Metrics *v); +const string ToString_PP_BrowserFont_Trusted_Metrics(const PP_BrowserFont_Trusted_Metrics &v); +void FromJSON_PP_BrowserFont_Trusted_Metrics(JSONIterator& iterator, PP_BrowserFont_Trusted_Metrics &value); +const string ToString_PP_BrowserFont_Trusted_TextRun(const PP_BrowserFont_Trusted_TextRun *v); +const string ToString_PP_BrowserFont_Trusted_TextRun(const PP_BrowserFont_Trusted_TextRun &v); +void FromJSON_PP_BrowserFont_Trusted_TextRun(JSONIterator& iterator, PP_BrowserFont_Trusted_TextRun &value); +#ifdef INTERPOSE +static PPB_BrowserFont_Trusted_1_0 *_real_PPB_BrowserFont_Trusted_1_0; +#endif // INTERPOSE +const string ToString_PPB_BrowserFont_Trusted(const PPB_BrowserFont_Trusted_1_0 *v); +const string ToString_PP_CharSet_Trusted_ConversionError(const PP_CharSet_Trusted_ConversionError *v); +const string ToString_PP_CharSet_Trusted_ConversionError(const PP_CharSet_Trusted_ConversionError &v); +void FromJSON_PP_CharSet_Trusted_ConversionError(JSONIterator& iterator, PP_CharSet_Trusted_ConversionError &value); +#ifdef INTERPOSE +static PPB_CharSet_Trusted_1_0 *_real_PPB_CharSet_Trusted_1_0; +#endif // INTERPOSE +const string ToString_PPB_CharSet_Trusted(const PPB_CharSet_Trusted_1_0 *v); +#ifdef INTERPOSE +static PPB_FileChooserTrusted_0_5 *_real_PPB_FileChooserTrusted_0_5; +#endif // INTERPOSE +const string ToString_PPB_FileChooserTrusted(const PPB_FileChooserTrusted_0_5 *v); +#ifdef INTERPOSE +static PPB_FileChooserTrusted_0_6 *_real_PPB_FileChooserTrusted_0_6; +#endif // INTERPOSE +const string ToString_PPB_FileChooserTrusted(const PPB_FileChooserTrusted_0_6 *v); +const string ToString_PP_URLLoaderTrusted_StatusCallback(const PP_URLLoaderTrusted_StatusCallback &v); +void FromJSON_PP_URLLoaderTrusted_StatusCallback(JSONIterator& iterator, PP_URLLoaderTrusted_StatusCallback &value); +#ifdef INTERPOSE +static PPB_URLLoaderTrusted_0_3 *_real_PPB_URLLoaderTrusted_0_3; +#endif // INTERPOSE +const string ToString_PPB_URLLoaderTrusted(const PPB_URLLoaderTrusted_0_3 *v); +const string ToString_PP_CursorType_Dev(const PP_CursorType_Dev *v); +const string ToString_PP_CursorType_Dev(const PP_CursorType_Dev &v); +void FromJSON_PP_CursorType_Dev(JSONIterator& iterator, PP_CursorType_Dev &value); +const string ToString_PP_PrintOrientation_Dev(const PP_PrintOrientation_Dev *v); +const string ToString_PP_PrintOrientation_Dev(const PP_PrintOrientation_Dev &v); +void FromJSON_PP_PrintOrientation_Dev(JSONIterator& iterator, PP_PrintOrientation_Dev &value); +const string ToString_PP_PrintOutputFormat_Dev(const PP_PrintOutputFormat_Dev *v); +const string ToString_PP_PrintOutputFormat_Dev(const PP_PrintOutputFormat_Dev &v); +void FromJSON_PP_PrintOutputFormat_Dev(JSONIterator& iterator, PP_PrintOutputFormat_Dev &value); +const string ToString_PP_PrintScalingOption_Dev(const PP_PrintScalingOption_Dev *v); +const string ToString_PP_PrintScalingOption_Dev(const PP_PrintScalingOption_Dev &v); +void FromJSON_PP_PrintScalingOption_Dev(JSONIterator& iterator, PP_PrintScalingOption_Dev &value); +const string ToString_PP_PrintSettings_Dev(const PP_PrintSettings_Dev *v); +const string ToString_PP_PrintSettings_Dev(const PP_PrintSettings_Dev &v); +void FromJSON_PP_PrintSettings_Dev(JSONIterator& iterator, PP_PrintSettings_Dev &value); +const string ToString_PP_VideoCaptureDeviceInfo_Dev(const PP_VideoCaptureDeviceInfo_Dev *v); +const string ToString_PP_VideoCaptureDeviceInfo_Dev(const PP_VideoCaptureDeviceInfo_Dev &v); +void FromJSON_PP_VideoCaptureDeviceInfo_Dev(JSONIterator& iterator, PP_VideoCaptureDeviceInfo_Dev &value); +const string ToString_PP_VideoCaptureStatus_Dev(const PP_VideoCaptureStatus_Dev *v); +const string ToString_PP_VideoCaptureStatus_Dev(const PP_VideoCaptureStatus_Dev &v); +void FromJSON_PP_VideoCaptureStatus_Dev(JSONIterator& iterator, PP_VideoCaptureStatus_Dev &value); +const string ToString_PP_VideoDecoder_Profile(const PP_VideoDecoder_Profile *v); +const string ToString_PP_VideoDecoder_Profile(const PP_VideoDecoder_Profile &v); +void FromJSON_PP_VideoDecoder_Profile(JSONIterator& iterator, PP_VideoDecoder_Profile &value); +const string ToString_PP_VideoBitstreamBuffer_Dev(const PP_VideoBitstreamBuffer_Dev *v); +const string ToString_PP_VideoBitstreamBuffer_Dev(const PP_VideoBitstreamBuffer_Dev &v); +void FromJSON_PP_VideoBitstreamBuffer_Dev(JSONIterator& iterator, PP_VideoBitstreamBuffer_Dev &value); +const string ToString_PP_PictureBuffer_Dev(const PP_PictureBuffer_Dev *v); +const string ToString_PP_PictureBuffer_Dev(const PP_PictureBuffer_Dev &v); +void FromJSON_PP_PictureBuffer_Dev(JSONIterator& iterator, PP_PictureBuffer_Dev &value); +const string ToString_PP_Picture_Dev(const PP_Picture_Dev *v); +const string ToString_PP_Picture_Dev(const PP_Picture_Dev &v); +void FromJSON_PP_Picture_Dev(JSONIterator& iterator, PP_Picture_Dev &value); +const string ToString_PP_VideoDecodeError_Dev(const PP_VideoDecodeError_Dev *v); +const string ToString_PP_VideoDecodeError_Dev(const PP_VideoDecodeError_Dev &v); +void FromJSON_PP_VideoDecodeError_Dev(JSONIterator& iterator, PP_VideoDecodeError_Dev &value); +const string ToString_PPB_AudioInput_Callback(const PPB_AudioInput_Callback_0_3 &v); +void FromJSON_PPB_AudioInput_Callback(JSONIterator& iterator, PPB_AudioInput_Callback_0_3 &value); +const string ToString_PPB_AudioInput_Callback(const PPB_AudioInput_Callback &v); +void FromJSON_PPB_AudioInput_Callback(JSONIterator& iterator, PPB_AudioInput_Callback &value); +#ifdef INTERPOSE +static PPB_AudioInput_Dev_0_3 *_real_PPB_AudioInput_Dev_0_3; +#endif // INTERPOSE +const string ToString_PPB_AudioInput_Dev(const PPB_AudioInput_Dev_0_3 *v); +#ifdef INTERPOSE +static PPB_AudioInput_Dev_0_4 *_real_PPB_AudioInput_Dev_0_4; +#endif // INTERPOSE +const string ToString_PPB_AudioInput_Dev(const PPB_AudioInput_Dev_0_4 *v); +#ifdef INTERPOSE +static PPB_Buffer_Dev_0_4 *_real_PPB_Buffer_Dev_0_4; +#endif // INTERPOSE +const string ToString_PPB_Buffer_Dev(const PPB_Buffer_Dev_0_4 *v); +const string ToString_PP_CharSet_ConversionError(const PP_CharSet_ConversionError *v); +const string ToString_PP_CharSet_ConversionError(const PP_CharSet_ConversionError &v); +void FromJSON_PP_CharSet_ConversionError(JSONIterator& iterator, PP_CharSet_ConversionError &value); +#ifdef INTERPOSE +static PPB_CharSet_Dev_0_4 *_real_PPB_CharSet_Dev_0_4; +#endif // INTERPOSE +const string ToString_PPB_CharSet_Dev(const PPB_CharSet_Dev_0_4 *v); +#ifdef INTERPOSE +static PPB_Crypto_Dev_0_1 *_real_PPB_Crypto_Dev_0_1; +#endif // INTERPOSE +const string ToString_PPB_Crypto_Dev(const PPB_Crypto_Dev_0_1 *v); +#ifdef INTERPOSE +static PPB_CursorControl_Dev_0_4 *_real_PPB_CursorControl_Dev_0_4; +#endif // INTERPOSE +const string ToString_PPB_CursorControl_Dev(const PPB_CursorControl_Dev_0_4 *v); +const string ToString_PP_MonitorDeviceChangeCallback(const PP_MonitorDeviceChangeCallback &v); +void FromJSON_PP_MonitorDeviceChangeCallback(JSONIterator& iterator, PP_MonitorDeviceChangeCallback &value); +const string ToString_PP_DeviceType_Dev(const PP_DeviceType_Dev *v); +const string ToString_PP_DeviceType_Dev(const PP_DeviceType_Dev &v); +void FromJSON_PP_DeviceType_Dev(JSONIterator& iterator, PP_DeviceType_Dev &value); +#ifdef INTERPOSE +static PPB_DeviceRef_Dev_0_1 *_real_PPB_DeviceRef_Dev_0_1; +#endif // INTERPOSE +const string ToString_PPB_DeviceRef_Dev(const PPB_DeviceRef_Dev_0_1 *v); +const string ToString_PP_FileChooserMode_Dev(const PP_FileChooserMode_Dev *v); +const string ToString_PP_FileChooserMode_Dev(const PP_FileChooserMode_Dev &v); +void FromJSON_PP_FileChooserMode_Dev(JSONIterator& iterator, PP_FileChooserMode_Dev &value); +#ifdef INTERPOSE +static PPB_FileChooser_Dev_0_5 *_real_PPB_FileChooser_Dev_0_5; +#endif // INTERPOSE +const string ToString_PPB_FileChooser_Dev(const PPB_FileChooser_Dev_0_5 *v); +#ifdef INTERPOSE +static PPB_FileChooser_Dev_0_6 *_real_PPB_FileChooser_Dev_0_6; +#endif // INTERPOSE +const string ToString_PPB_FileChooser_Dev(const PPB_FileChooser_Dev_0_6 *v); +const string ToString_PP_FontFamily_Dev(const PP_FontFamily_Dev *v); +const string ToString_PP_FontFamily_Dev(const PP_FontFamily_Dev &v); +void FromJSON_PP_FontFamily_Dev(JSONIterator& iterator, PP_FontFamily_Dev &value); +const string ToString_PP_FontWeight_Dev(const PP_FontWeight_Dev *v); +const string ToString_PP_FontWeight_Dev(const PP_FontWeight_Dev &v); +void FromJSON_PP_FontWeight_Dev(JSONIterator& iterator, PP_FontWeight_Dev &value); +const string ToString_PP_FontDescription_Dev(const PP_FontDescription_Dev *v); +const string ToString_PP_FontDescription_Dev(const PP_FontDescription_Dev &v); +void FromJSON_PP_FontDescription_Dev(JSONIterator& iterator, PP_FontDescription_Dev &value); +const string ToString_PP_FontMetrics_Dev(const PP_FontMetrics_Dev *v); +const string ToString_PP_FontMetrics_Dev(const PP_FontMetrics_Dev &v); +void FromJSON_PP_FontMetrics_Dev(JSONIterator& iterator, PP_FontMetrics_Dev &value); +const string ToString_PP_TextRun_Dev(const PP_TextRun_Dev *v); +const string ToString_PP_TextRun_Dev(const PP_TextRun_Dev &v); +void FromJSON_PP_TextRun_Dev(JSONIterator& iterator, PP_TextRun_Dev &value); +#ifdef INTERPOSE +static PPB_Font_Dev_0_6 *_real_PPB_Font_Dev_0_6; +#endif // INTERPOSE +const string ToString_PPB_Font_Dev(const PPB_Font_Dev_0_6 *v); +#ifdef INTERPOSE +static PPB_IMEInputEvent_Dev_0_1 *_real_PPB_IMEInputEvent_Dev_0_1; +#endif // INTERPOSE +const string ToString_PPB_IMEInputEvent_Dev(const PPB_IMEInputEvent_Dev_0_1 *v); +#ifdef INTERPOSE +static PPB_IMEInputEvent_Dev_0_2 *_real_PPB_IMEInputEvent_Dev_0_2; +#endif // INTERPOSE +const string ToString_PPB_IMEInputEvent_Dev(const PPB_IMEInputEvent_Dev_0_2 *v); +#ifdef INTERPOSE +static PPB_Memory_Dev_0_1 *_real_PPB_Memory_Dev_0_1; +#endif // INTERPOSE +const string ToString_PPB_Memory_Dev(const PPB_Memory_Dev_0_1 *v); +#ifdef INTERPOSE +static PPB_OpenGLES2DrawBuffers_Dev_1_0 *_real_PPB_OpenGLES2DrawBuffers_Dev_1_0; +#endif // INTERPOSE +const string ToString_PPB_OpenGLES2DrawBuffers_Dev(const PPB_OpenGLES2DrawBuffers_Dev_1_0 *v); +#ifdef INTERPOSE +static PPB_Printing_Dev_0_7 *_real_PPB_Printing_Dev_0_7; +#endif // INTERPOSE +const string ToString_PPB_Printing_Dev(const PPB_Printing_Dev_0_7 *v); +const string ToString_PP_TextInput_Type_Dev(const PP_TextInput_Type_Dev *v); +const string ToString_PP_TextInput_Type_Dev(const PP_TextInput_Type_Dev &v); +void FromJSON_PP_TextInput_Type_Dev(JSONIterator& iterator, PP_TextInput_Type_Dev &value); +#ifdef INTERPOSE +static PPB_TextInput_Dev_0_1 *_real_PPB_TextInput_Dev_0_1; +#endif // INTERPOSE +const string ToString_PPB_TextInput_Dev(const PPB_TextInput_Dev_0_1 *v); +#ifdef INTERPOSE +static PPB_TextInput_Dev_0_2 *_real_PPB_TextInput_Dev_0_2; +#endif // INTERPOSE +const string ToString_PPB_TextInput_Dev(const PPB_TextInput_Dev_0_2 *v); +const string ToString_PP_TraceEventTime(const PP_TraceEventTime *v); +const string ToString_PP_TraceEventTime(const PP_TraceEventTime &v); +void FromJSON_PP_TraceEventTime(JSONIterator& iterator, PP_TraceEventTime &value); +#ifdef INTERPOSE +static PPB_Trace_Event_Dev_0_1 *_real_PPB_Trace_Event_Dev_0_1; +#endif // INTERPOSE +const string ToString_PPB_Trace_Event_Dev(const PPB_Trace_Event_Dev_0_1 *v); +#ifdef INTERPOSE +static PPB_Trace_Event_Dev_0_2 *_real_PPB_Trace_Event_Dev_0_2; +#endif // INTERPOSE +const string ToString_PPB_Trace_Event_Dev(const PPB_Trace_Event_Dev_0_2 *v); +const string ToString_PP_TrueTypeFontFamily_Dev(const PP_TrueTypeFontFamily_Dev *v); +const string ToString_PP_TrueTypeFontFamily_Dev(const PP_TrueTypeFontFamily_Dev &v); +void FromJSON_PP_TrueTypeFontFamily_Dev(JSONIterator& iterator, PP_TrueTypeFontFamily_Dev &value); +const string ToString_PP_TrueTypeFontStyle_Dev(const PP_TrueTypeFontStyle_Dev *v); +const string ToString_PP_TrueTypeFontStyle_Dev(const PP_TrueTypeFontStyle_Dev &v); +void FromJSON_PP_TrueTypeFontStyle_Dev(JSONIterator& iterator, PP_TrueTypeFontStyle_Dev &value); +const string ToString_PP_TrueTypeFontWeight_Dev(const PP_TrueTypeFontWeight_Dev *v); +const string ToString_PP_TrueTypeFontWeight_Dev(const PP_TrueTypeFontWeight_Dev &v); +void FromJSON_PP_TrueTypeFontWeight_Dev(JSONIterator& iterator, PP_TrueTypeFontWeight_Dev &value); +const string ToString_PP_TrueTypeFontWidth_Dev(const PP_TrueTypeFontWidth_Dev *v); +const string ToString_PP_TrueTypeFontWidth_Dev(const PP_TrueTypeFontWidth_Dev &v); +void FromJSON_PP_TrueTypeFontWidth_Dev(JSONIterator& iterator, PP_TrueTypeFontWidth_Dev &value); +const string ToString_PP_TrueTypeFontCharset_Dev(const PP_TrueTypeFontCharset_Dev *v); +const string ToString_PP_TrueTypeFontCharset_Dev(const PP_TrueTypeFontCharset_Dev &v); +void FromJSON_PP_TrueTypeFontCharset_Dev(JSONIterator& iterator, PP_TrueTypeFontCharset_Dev &value); +const string ToString_PP_TrueTypeFontDesc_Dev(const PP_TrueTypeFontDesc_Dev *v); +const string ToString_PP_TrueTypeFontDesc_Dev(const PP_TrueTypeFontDesc_Dev &v); +void FromJSON_PP_TrueTypeFontDesc_Dev(JSONIterator& iterator, PP_TrueTypeFontDesc_Dev &value); +#ifdef INTERPOSE +static PPB_TrueTypeFont_Dev_0_1 *_real_PPB_TrueTypeFont_Dev_0_1; +#endif // INTERPOSE +const string ToString_PPB_TrueTypeFont_Dev(const PPB_TrueTypeFont_Dev_0_1 *v); +const string ToString_PP_URLComponent_Dev(const PP_URLComponent_Dev *v); +const string ToString_PP_URLComponent_Dev(const PP_URLComponent_Dev &v); +void FromJSON_PP_URLComponent_Dev(JSONIterator& iterator, PP_URLComponent_Dev &value); +const string ToString_PP_URLComponents_Dev(const PP_URLComponents_Dev *v); +const string ToString_PP_URLComponents_Dev(const PP_URLComponents_Dev &v); +void FromJSON_PP_URLComponents_Dev(JSONIterator& iterator, PP_URLComponents_Dev &value); +#ifdef INTERPOSE +static PPB_URLUtil_Dev_0_6 *_real_PPB_URLUtil_Dev_0_6; +#endif // INTERPOSE +const string ToString_PPB_URLUtil_Dev(const PPB_URLUtil_Dev_0_6 *v); +#ifdef INTERPOSE +static PPB_URLUtil_Dev_0_7 *_real_PPB_URLUtil_Dev_0_7; +#endif // INTERPOSE +const string ToString_PPB_URLUtil_Dev(const PPB_URLUtil_Dev_0_7 *v); +#ifdef INTERPOSE +static PPB_Var_Deprecated_0_3 *_real_PPB_Var_Deprecated_0_3; +#endif // INTERPOSE +const string ToString_PPB_Var_Deprecated(const PPB_Var_Deprecated_0_3 *v); +#ifdef INTERPOSE +static PPB_VideoCapture_Dev_0_3 *_real_PPB_VideoCapture_Dev_0_3; +#endif // INTERPOSE +const string ToString_PPB_VideoCapture_Dev(const PPB_VideoCapture_Dev_0_3 *v); +#ifdef INTERPOSE +static PPB_VideoDecoder_Dev_0_16 *_real_PPB_VideoDecoder_Dev_0_16; +#endif // INTERPOSE +const string ToString_PPB_VideoDecoder_Dev(const PPB_VideoDecoder_Dev_0_16 *v); +#ifdef INTERPOSE +static PPB_View_Dev_0_1 *_real_PPB_View_Dev_0_1; +#endif // INTERPOSE +const string ToString_PPB_View_Dev(const PPB_View_Dev_0_1 *v); +#ifdef INTERPOSE +static PPP_Class_Deprecated_1_0 *_real_PPP_Class_Deprecated_1_0; +#endif // INTERPOSE +static char* Call_PPP_Class_Deprecated(void* _interface, JSONIterator& iterator); +#ifdef INTERPOSE +static PPP_NetworkState_Dev_0_1 *_real_PPP_NetworkState_Dev_0_1; +#endif // INTERPOSE +static char* Call_PPP_NetworkState_Dev(void* _interface, JSONIterator& iterator); +const string ToString_PP_PrintPageNumberRange_Dev(const PP_PrintPageNumberRange_Dev *v); +const string ToString_PP_PrintPageNumberRange_Dev(const PP_PrintPageNumberRange_Dev &v); +void FromJSON_PP_PrintPageNumberRange_Dev(JSONIterator& iterator, PP_PrintPageNumberRange_Dev &value); +#ifdef INTERPOSE +static PPP_Printing_Dev_0_6 *_real_PPP_Printing_Dev_0_6; +#endif // INTERPOSE +static char* Call_PPP_Printing_Dev(void* _interface, JSONIterator& iterator); +#ifdef INTERPOSE +static PPP_TextInput_Dev_0_1 *_real_PPP_TextInput_Dev_0_1; +#endif // INTERPOSE +static char* Call_PPP_TextInput_Dev(void* _interface, JSONIterator& iterator); +#ifdef INTERPOSE +static PPP_VideoCapture_Dev_0_1 *_real_PPP_VideoCapture_Dev_0_1; +#endif // INTERPOSE +static char* Call_PPP_VideoCapture_Dev(void* _interface, JSONIterator& iterator); +#ifdef INTERPOSE +static PPP_VideoDecoder_Dev_0_11 *_real_PPP_VideoDecoder_Dev_0_11; +#endif // INTERPOSE +static char* Call_PPP_VideoDecoder_Dev(void* _interface, JSONIterator& iterator); +const string ToString_PP_DecryptTrackingInfo(const PP_DecryptTrackingInfo *v); +const string ToString_PP_DecryptTrackingInfo(const PP_DecryptTrackingInfo &v); +void FromJSON_PP_DecryptTrackingInfo(JSONIterator& iterator, PP_DecryptTrackingInfo &value); +const string ToString_PP_DecryptSubsampleDescription(const PP_DecryptSubsampleDescription *v); +const string ToString_PP_DecryptSubsampleDescription(const PP_DecryptSubsampleDescription &v); +void FromJSON_PP_DecryptSubsampleDescription(JSONIterator& iterator, PP_DecryptSubsampleDescription &value); +const string ToString_PP_EncryptedBlockInfo(const PP_EncryptedBlockInfo *v); +const string ToString_PP_EncryptedBlockInfo(const PP_EncryptedBlockInfo &v); +void FromJSON_PP_EncryptedBlockInfo(JSONIterator& iterator, PP_EncryptedBlockInfo &value); +const string ToString_PP_DecryptedFrameFormat(const PP_DecryptedFrameFormat *v); +const string ToString_PP_DecryptedFrameFormat(const PP_DecryptedFrameFormat &v); +void FromJSON_PP_DecryptedFrameFormat(JSONIterator& iterator, PP_DecryptedFrameFormat &value); +const string ToString_PP_DecryptedSampleFormat(const PP_DecryptedSampleFormat *v); +const string ToString_PP_DecryptedSampleFormat(const PP_DecryptedSampleFormat &v); +void FromJSON_PP_DecryptedSampleFormat(JSONIterator& iterator, PP_DecryptedSampleFormat &value); +const string ToString_PP_DecryptResult(const PP_DecryptResult *v); +const string ToString_PP_DecryptResult(const PP_DecryptResult &v); +void FromJSON_PP_DecryptResult(JSONIterator& iterator, PP_DecryptResult &value); +const string ToString_PP_DecryptedBlockInfo(const PP_DecryptedBlockInfo *v); +const string ToString_PP_DecryptedBlockInfo(const PP_DecryptedBlockInfo &v); +void FromJSON_PP_DecryptedBlockInfo(JSONIterator& iterator, PP_DecryptedBlockInfo &value); +const string ToString_PP_DecryptedFramePlanes(const PP_DecryptedFramePlanes *v); +const string ToString_PP_DecryptedFramePlanes(const PP_DecryptedFramePlanes &v); +void FromJSON_PP_DecryptedFramePlanes(JSONIterator& iterator, PP_DecryptedFramePlanes &value); +const string ToString_PP_DecryptedFrameInfo(const PP_DecryptedFrameInfo *v); +const string ToString_PP_DecryptedFrameInfo(const PP_DecryptedFrameInfo &v); +void FromJSON_PP_DecryptedFrameInfo(JSONIterator& iterator, PP_DecryptedFrameInfo &value); +const string ToString_PP_DecryptedSampleInfo(const PP_DecryptedSampleInfo *v); +const string ToString_PP_DecryptedSampleInfo(const PP_DecryptedSampleInfo &v); +void FromJSON_PP_DecryptedSampleInfo(JSONIterator& iterator, PP_DecryptedSampleInfo &value); +const string ToString_PP_AudioCodec(const PP_AudioCodec *v); +const string ToString_PP_AudioCodec(const PP_AudioCodec &v); +void FromJSON_PP_AudioCodec(JSONIterator& iterator, PP_AudioCodec &value); +const string ToString_PP_AudioDecoderConfig(const PP_AudioDecoderConfig *v); +const string ToString_PP_AudioDecoderConfig(const PP_AudioDecoderConfig &v); +void FromJSON_PP_AudioDecoderConfig(JSONIterator& iterator, PP_AudioDecoderConfig &value); +const string ToString_PP_VideoCodec(const PP_VideoCodec *v); +const string ToString_PP_VideoCodec(const PP_VideoCodec &v); +void FromJSON_PP_VideoCodec(JSONIterator& iterator, PP_VideoCodec &value); +const string ToString_PP_VideoCodecProfile(const PP_VideoCodecProfile *v); +const string ToString_PP_VideoCodecProfile(const PP_VideoCodecProfile &v); +void FromJSON_PP_VideoCodecProfile(JSONIterator& iterator, PP_VideoCodecProfile &value); +const string ToString_PP_VideoDecoderConfig(const PP_VideoDecoderConfig *v); +const string ToString_PP_VideoDecoderConfig(const PP_VideoDecoderConfig &v); +void FromJSON_PP_VideoDecoderConfig(JSONIterator& iterator, PP_VideoDecoderConfig &value); +const string ToString_PP_DecryptorStreamType(const PP_DecryptorStreamType *v); +const string ToString_PP_DecryptorStreamType(const PP_DecryptorStreamType &v); +void FromJSON_PP_DecryptorStreamType(JSONIterator& iterator, PP_DecryptorStreamType &value); +const string ToString_PP_SessionType(const PP_SessionType *v); +const string ToString_PP_SessionType(const PP_SessionType &v); +void FromJSON_PP_SessionType(JSONIterator& iterator, PP_SessionType &value); +const string ToString_PP_InitDataType(const PP_InitDataType *v); +const string ToString_PP_InitDataType(const PP_InitDataType &v); +void FromJSON_PP_InitDataType(JSONIterator& iterator, PP_InitDataType &value); +const string ToString_PP_CdmExceptionCode(const PP_CdmExceptionCode *v); +const string ToString_PP_CdmExceptionCode(const PP_CdmExceptionCode &v); +void FromJSON_PP_CdmExceptionCode(JSONIterator& iterator, PP_CdmExceptionCode &value); +const string ToString_PP_CdmMessageType(const PP_CdmMessageType *v); +const string ToString_PP_CdmMessageType(const PP_CdmMessageType &v); +void FromJSON_PP_CdmMessageType(JSONIterator& iterator, PP_CdmMessageType &value); +const string ToString_PP_CdmKeyStatus(const PP_CdmKeyStatus *v); +const string ToString_PP_CdmKeyStatus(const PP_CdmKeyStatus &v); +void FromJSON_PP_CdmKeyStatus(JSONIterator& iterator, PP_CdmKeyStatus &value); +const string ToString_PP_KeyInformation(const PP_KeyInformation *v); +const string ToString_PP_KeyInformation(const PP_KeyInformation &v); +void FromJSON_PP_KeyInformation(JSONIterator& iterator, PP_KeyInformation &value); +const string ToString_PP_PrivateFontCharset(const PP_PrivateFontCharset *v); +const string ToString_PP_PrivateFontCharset(const PP_PrivateFontCharset &v); +void FromJSON_PP_PrivateFontCharset(JSONIterator& iterator, PP_PrivateFontCharset &value); +const string ToString_PP_VideoCaptureFormat(const PP_VideoCaptureFormat *v); +const string ToString_PP_VideoCaptureFormat(const PP_VideoCaptureFormat &v); +void FromJSON_PP_VideoCaptureFormat(JSONIterator& iterator, PP_VideoCaptureFormat &value); +const string ToString_PP_VideoFrame_Private(const PP_VideoFrame_Private *v); +const string ToString_PP_VideoFrame_Private(const PP_VideoFrame_Private &v); +void FromJSON_PP_VideoFrame_Private(JSONIterator& iterator, PP_VideoFrame_Private &value); +#ifdef INTERPOSE +static PPB_CameraCapabilities_Private_0_1 *_real_PPB_CameraCapabilities_Private_0_1; +#endif // INTERPOSE +const string ToString_PPB_CameraCapabilities_Private(const PPB_CameraCapabilities_Private_0_1 *v); +#ifdef INTERPOSE +static PPB_CameraDevice_Private_0_1 *_real_PPB_CameraDevice_Private_0_1; +#endif // INTERPOSE +const string ToString_PPB_CameraDevice_Private(const PPB_CameraDevice_Private_0_1 *v); +#ifdef INTERPOSE +static PPB_ContentDecryptor_Private_0_14 *_real_PPB_ContentDecryptor_Private_0_14; +#endif // INTERPOSE +const string ToString_PPB_ContentDecryptor_Private(const PPB_ContentDecryptor_Private_0_14 *v); +#ifdef INTERPOSE +static PPB_DisplayColorProfile_Private_0_1 *_real_PPB_DisplayColorProfile_Private_0_1; +#endif // INTERPOSE +const string ToString_PPB_DisplayColorProfile_Private(const PPB_DisplayColorProfile_Private_0_1 *v); +#ifdef INTERPOSE +static PPB_Ext_CrxFileSystem_Private_0_1 *_real_PPB_Ext_CrxFileSystem_Private_0_1; +#endif // INTERPOSE +const string ToString_PPB_Ext_CrxFileSystem_Private(const PPB_Ext_CrxFileSystem_Private_0_1 *v); +#ifdef INTERPOSE +static PPB_FileIO_Private_0_1 *_real_PPB_FileIO_Private_0_1; +#endif // INTERPOSE +const string ToString_PPB_FileIO_Private(const PPB_FileIO_Private_0_1 *v); +#ifdef INTERPOSE +static PPB_FileRefPrivate_0_1 *_real_PPB_FileRefPrivate_0_1; +#endif // INTERPOSE +const string ToString_PPB_FileRefPrivate(const PPB_FileRefPrivate_0_1 *v); +#ifdef INTERPOSE +static PPB_Find_Private_0_3 *_real_PPB_Find_Private_0_3; +#endif // INTERPOSE +const string ToString_PPB_Find_Private(const PPB_Find_Private_0_3 *v); +const string ToString_PP_FlashLSORestrictions(const PP_FlashLSORestrictions *v); +const string ToString_PP_FlashLSORestrictions(const PP_FlashLSORestrictions &v); +void FromJSON_PP_FlashLSORestrictions(JSONIterator& iterator, PP_FlashLSORestrictions &value); +const string ToString_PP_FlashSetting(const PP_FlashSetting *v); +const string ToString_PP_FlashSetting(const PP_FlashSetting &v); +void FromJSON_PP_FlashSetting(JSONIterator& iterator, PP_FlashSetting &value); +const string ToString_PP_FlashCrashKey(const PP_FlashCrashKey *v); +const string ToString_PP_FlashCrashKey(const PP_FlashCrashKey &v); +void FromJSON_PP_FlashCrashKey(JSONIterator& iterator, PP_FlashCrashKey &value); +#ifdef INTERPOSE +static PPB_Flash_12_4 *_real_PPB_Flash_12_4; +#endif // INTERPOSE +const string ToString_PPB_Flash(const PPB_Flash_12_4 *v); +#ifdef INTERPOSE +static PPB_Flash_12_5 *_real_PPB_Flash_12_5; +#endif // INTERPOSE +const string ToString_PPB_Flash(const PPB_Flash_12_5 *v); +#ifdef INTERPOSE +static PPB_Flash_12_6 *_real_PPB_Flash_12_6; +#endif // INTERPOSE +const string ToString_PPB_Flash(const PPB_Flash_12_6 *v); +#ifdef INTERPOSE +static PPB_Flash_13_0 *_real_PPB_Flash_13_0; +#endif // INTERPOSE +const string ToString_PPB_Flash(const PPB_Flash_13_0 *v); +const string ToString_PP_Flash_Clipboard_Type(const PP_Flash_Clipboard_Type *v); +const string ToString_PP_Flash_Clipboard_Type(const PP_Flash_Clipboard_Type &v); +void FromJSON_PP_Flash_Clipboard_Type(JSONIterator& iterator, PP_Flash_Clipboard_Type &value); +const string ToString_PP_Flash_Clipboard_Format(const PP_Flash_Clipboard_Format *v); +const string ToString_PP_Flash_Clipboard_Format(const PP_Flash_Clipboard_Format &v); +void FromJSON_PP_Flash_Clipboard_Format(JSONIterator& iterator, PP_Flash_Clipboard_Format &value); +#ifdef INTERPOSE +static PPB_Flash_Clipboard_4_0 *_real_PPB_Flash_Clipboard_4_0; +#endif // INTERPOSE +const string ToString_PPB_Flash_Clipboard(const PPB_Flash_Clipboard_4_0 *v); +#ifdef INTERPOSE +static PPB_Flash_Clipboard_5_0 *_real_PPB_Flash_Clipboard_5_0; +#endif // INTERPOSE +const string ToString_PPB_Flash_Clipboard(const PPB_Flash_Clipboard_5_0 *v); +#ifdef INTERPOSE +static PPB_Flash_Clipboard_5_1 *_real_PPB_Flash_Clipboard_5_1; +#endif // INTERPOSE +const string ToString_PPB_Flash_Clipboard(const PPB_Flash_Clipboard_5_1 *v); +#ifdef INTERPOSE +static PPB_Flash_DeviceID_1_0 *_real_PPB_Flash_DeviceID_1_0; +#endif // INTERPOSE +const string ToString_PPB_Flash_DeviceID(const PPB_Flash_DeviceID_1_0 *v); +#ifdef INTERPOSE +static PPB_Flash_DRM_1_0 *_real_PPB_Flash_DRM_1_0; +#endif // INTERPOSE +const string ToString_PPB_Flash_DRM(const PPB_Flash_DRM_1_0 *v); +#ifdef INTERPOSE +static PPB_Flash_DRM_1_1 *_real_PPB_Flash_DRM_1_1; +#endif // INTERPOSE +const string ToString_PPB_Flash_DRM(const PPB_Flash_DRM_1_1 *v); +const string ToString_PP_DirEntry_Dev(const PP_DirEntry_Dev *v); +const string ToString_PP_DirEntry_Dev(const PP_DirEntry_Dev &v); +void FromJSON_PP_DirEntry_Dev(JSONIterator& iterator, PP_DirEntry_Dev &value); +const string ToString_PP_DirContents_Dev(const PP_DirContents_Dev *v); +const string ToString_PP_DirContents_Dev(const PP_DirContents_Dev &v); +void FromJSON_PP_DirContents_Dev(JSONIterator& iterator, PP_DirContents_Dev &value); +#ifdef INTERPOSE +static PPB_Flash_File_ModuleLocal_3_0 *_real_PPB_Flash_File_ModuleLocal_3_0; +#endif // INTERPOSE +const string ToString_PPB_Flash_File_ModuleLocal(const PPB_Flash_File_ModuleLocal_3_0 *v); +#ifdef INTERPOSE +static PPB_Flash_File_FileRef_2_0 *_real_PPB_Flash_File_FileRef_2_0; +#endif // INTERPOSE +const string ToString_PPB_Flash_File_FileRef(const PPB_Flash_File_FileRef_2_0 *v); +#ifdef INTERPOSE +static PPB_Flash_FontFile_0_1 *_real_PPB_Flash_FontFile_0_1; +#endif // INTERPOSE +const string ToString_PPB_Flash_FontFile(const PPB_Flash_FontFile_0_1 *v); +#ifdef INTERPOSE +static PPB_Flash_FontFile_0_2 *_real_PPB_Flash_FontFile_0_2; +#endif // INTERPOSE +const string ToString_PPB_Flash_FontFile(const PPB_Flash_FontFile_0_2 *v); +#ifdef INTERPOSE +static PPB_FlashFullscreen_0_1 *_real_PPB_FlashFullscreen_0_1; +#endif // INTERPOSE +const string ToString_PPB_FlashFullscreen(const PPB_FlashFullscreen_0_1 *v); +#ifdef INTERPOSE +static PPB_FlashFullscreen_1_0 *_real_PPB_FlashFullscreen_1_0; +#endif // INTERPOSE +const string ToString_PPB_FlashFullscreen(const PPB_FlashFullscreen_1_0 *v); +const string ToString_PP_Flash_MenuItem_Type(const PP_Flash_MenuItem_Type *v); +const string ToString_PP_Flash_MenuItem_Type(const PP_Flash_MenuItem_Type &v); +void FromJSON_PP_Flash_MenuItem_Type(JSONIterator& iterator, PP_Flash_MenuItem_Type &value); +const string ToString_PP_Flash_MenuItem(const PP_Flash_MenuItem *v); +const string ToString_PP_Flash_MenuItem(const PP_Flash_MenuItem &v); +void FromJSON_PP_Flash_MenuItem(JSONIterator& iterator, PP_Flash_MenuItem &value); +const string ToString_PP_Flash_Menu(const PP_Flash_Menu *v); +const string ToString_PP_Flash_Menu(const PP_Flash_Menu &v); +void FromJSON_PP_Flash_Menu(JSONIterator& iterator, PP_Flash_Menu &value); +#ifdef INTERPOSE +static PPB_Flash_Menu_0_2 *_real_PPB_Flash_Menu_0_2; +#endif // INTERPOSE +const string ToString_PPB_Flash_Menu(const PPB_Flash_Menu_0_2 *v); +#ifdef INTERPOSE +static PPB_Flash_MessageLoop_0_1 *_real_PPB_Flash_MessageLoop_0_1; +#endif // INTERPOSE +const string ToString_PPB_Flash_MessageLoop(const PPB_Flash_MessageLoop_0_1 *v); +#ifdef INTERPOSE +static PPB_Flash_Print_1_0 *_real_PPB_Flash_Print_1_0; +#endif // INTERPOSE +const string ToString_PPB_Flash_Print(const PPB_Flash_Print_1_0 *v); +const string ToString_PP_HostResolver_Private_Flags(const PP_HostResolver_Private_Flags *v); +const string ToString_PP_HostResolver_Private_Flags(const PP_HostResolver_Private_Flags &v); +void FromJSON_PP_HostResolver_Private_Flags(JSONIterator& iterator, PP_HostResolver_Private_Flags &value); +const string ToString_PP_HostResolver_Private_Hint(const PP_HostResolver_Private_Hint *v); +const string ToString_PP_HostResolver_Private_Hint(const PP_HostResolver_Private_Hint &v); +void FromJSON_PP_HostResolver_Private_Hint(JSONIterator& iterator, PP_HostResolver_Private_Hint &value); +#ifdef INTERPOSE +static PPB_HostResolver_Private_0_1 *_real_PPB_HostResolver_Private_0_1; +#endif // INTERPOSE +const string ToString_PPB_HostResolver_Private(const PPB_HostResolver_Private_0_1 *v); +const string ToString_PP_ExternalPluginResult(const PP_ExternalPluginResult *v); +const string ToString_PP_ExternalPluginResult(const PP_ExternalPluginResult &v); +void FromJSON_PP_ExternalPluginResult(JSONIterator& iterator, PP_ExternalPluginResult &value); +#ifdef INTERPOSE +static PPB_Instance_Private_0_1 *_real_PPB_Instance_Private_0_1; +#endif // INTERPOSE +const string ToString_PPB_Instance_Private(const PPB_Instance_Private_0_1 *v); +const string ToString_PP_IsolatedFileSystemType_Private(const PP_IsolatedFileSystemType_Private *v); +const string ToString_PP_IsolatedFileSystemType_Private(const PP_IsolatedFileSystemType_Private &v); +void FromJSON_PP_IsolatedFileSystemType_Private(JSONIterator& iterator, PP_IsolatedFileSystemType_Private &value); +#ifdef INTERPOSE +static PPB_IsolatedFileSystem_Private_0_2 *_real_PPB_IsolatedFileSystem_Private_0_2; +#endif // INTERPOSE +const string ToString_PPB_IsolatedFileSystem_Private(const PPB_IsolatedFileSystem_Private_0_2 *v); +const string ToString_PP_NetAddressFamily_Private(const PP_NetAddressFamily_Private *v); +const string ToString_PP_NetAddressFamily_Private(const PP_NetAddressFamily_Private &v); +void FromJSON_PP_NetAddressFamily_Private(JSONIterator& iterator, PP_NetAddressFamily_Private &value); +const string ToString_PP_NetAddress_Private(const PP_NetAddress_Private *v); +const string ToString_PP_NetAddress_Private(const PP_NetAddress_Private &v); +void FromJSON_PP_NetAddress_Private(JSONIterator& iterator, PP_NetAddress_Private &value); +#ifdef INTERPOSE +static PPB_NetAddress_Private_0_1 *_real_PPB_NetAddress_Private_0_1; +#endif // INTERPOSE +const string ToString_PPB_NetAddress_Private(const PPB_NetAddress_Private_0_1 *v); +#ifdef INTERPOSE +static PPB_NetAddress_Private_1_0 *_real_PPB_NetAddress_Private_1_0; +#endif // INTERPOSE +const string ToString_PPB_NetAddress_Private(const PPB_NetAddress_Private_1_0 *v); +#ifdef INTERPOSE +static PPB_NetAddress_Private_1_1 *_real_PPB_NetAddress_Private_1_1; +#endif // INTERPOSE +const string ToString_PPB_NetAddress_Private(const PPB_NetAddress_Private_1_1 *v); +const string ToString_PP_OutputProtectionMethod_Private(const PP_OutputProtectionMethod_Private *v); +const string ToString_PP_OutputProtectionMethod_Private(const PP_OutputProtectionMethod_Private &v); +void FromJSON_PP_OutputProtectionMethod_Private(JSONIterator& iterator, PP_OutputProtectionMethod_Private &value); +const string ToString_PP_OutputProtectionLinkType_Private(const PP_OutputProtectionLinkType_Private *v); +const string ToString_PP_OutputProtectionLinkType_Private(const PP_OutputProtectionLinkType_Private &v); +void FromJSON_PP_OutputProtectionLinkType_Private(JSONIterator& iterator, PP_OutputProtectionLinkType_Private &value); +#ifdef INTERPOSE +static PPB_OutputProtection_Private_0_1 *_real_PPB_OutputProtection_Private_0_1; +#endif // INTERPOSE +const string ToString_PPB_OutputProtection_Private(const PPB_OutputProtection_Private_0_1 *v); +const string ToString_PP_PDFFeature(const PP_PDFFeature *v); +const string ToString_PP_PDFFeature(const PP_PDFFeature &v); +void FromJSON_PP_PDFFeature(JSONIterator& iterator, PP_PDFFeature &value); +const string ToString_PP_PrivateFontFileDescription(const PP_PrivateFontFileDescription *v); +const string ToString_PP_PrivateFontFileDescription(const PP_PrivateFontFileDescription &v); +void FromJSON_PP_PrivateFontFileDescription(JSONIterator& iterator, PP_PrivateFontFileDescription &value); +const string ToString_PP_PrivateFindResult(const PP_PrivateFindResult *v); +const string ToString_PP_PrivateFindResult(const PP_PrivateFindResult &v); +void FromJSON_PP_PrivateFindResult(JSONIterator& iterator, PP_PrivateFindResult &value); +const string ToString_PP_PrivateAccessibilityViewportInfo(const PP_PrivateAccessibilityViewportInfo *v); +const string ToString_PP_PrivateAccessibilityViewportInfo(const PP_PrivateAccessibilityViewportInfo &v); +void FromJSON_PP_PrivateAccessibilityViewportInfo(JSONIterator& iterator, PP_PrivateAccessibilityViewportInfo &value); +const string ToString_PP_PrivateAccessibilityDocInfo(const PP_PrivateAccessibilityDocInfo *v); +const string ToString_PP_PrivateAccessibilityDocInfo(const PP_PrivateAccessibilityDocInfo &v); +void FromJSON_PP_PrivateAccessibilityDocInfo(JSONIterator& iterator, PP_PrivateAccessibilityDocInfo &value); +const string ToString_PP_PrivateDirection(const PP_PrivateDirection *v); +const string ToString_PP_PrivateDirection(const PP_PrivateDirection &v); +void FromJSON_PP_PrivateDirection(JSONIterator& iterator, PP_PrivateDirection &value); +const string ToString_PP_PrivateAccessibilityPageInfo(const PP_PrivateAccessibilityPageInfo *v); +const string ToString_PP_PrivateAccessibilityPageInfo(const PP_PrivateAccessibilityPageInfo &v); +void FromJSON_PP_PrivateAccessibilityPageInfo(JSONIterator& iterator, PP_PrivateAccessibilityPageInfo &value); +const string ToString_PP_PrivateAccessibilityTextRunInfo(const PP_PrivateAccessibilityTextRunInfo *v); +const string ToString_PP_PrivateAccessibilityTextRunInfo(const PP_PrivateAccessibilityTextRunInfo &v); +void FromJSON_PP_PrivateAccessibilityTextRunInfo(JSONIterator& iterator, PP_PrivateAccessibilityTextRunInfo &value); +const string ToString_PP_PrivateAccessibilityCharInfo(const PP_PrivateAccessibilityCharInfo *v); +const string ToString_PP_PrivateAccessibilityCharInfo(const PP_PrivateAccessibilityCharInfo &v); +void FromJSON_PP_PrivateAccessibilityCharInfo(JSONIterator& iterator, PP_PrivateAccessibilityCharInfo &value); +#ifdef INTERPOSE +static PPB_PDF_0_1 *_real_PPB_PDF_0_1; +#endif // INTERPOSE +const string ToString_PPB_PDF(const PPB_PDF_0_1 *v); +#ifdef INTERPOSE +static PPB_PlatformVerification_Private_0_2 *_real_PPB_PlatformVerification_Private_0_2; +#endif // INTERPOSE +const string ToString_PPB_PlatformVerification_Private(const PPB_PlatformVerification_Private_0_2 *v); +#ifdef INTERPOSE +static PPB_TCPServerSocket_Private_0_1 *_real_PPB_TCPServerSocket_Private_0_1; +#endif // INTERPOSE +const string ToString_PPB_TCPServerSocket_Private(const PPB_TCPServerSocket_Private_0_1 *v); +#ifdef INTERPOSE +static PPB_TCPServerSocket_Private_0_2 *_real_PPB_TCPServerSocket_Private_0_2; +#endif // INTERPOSE +const string ToString_PPB_TCPServerSocket_Private(const PPB_TCPServerSocket_Private_0_2 *v); +const string ToString_PP_TCPSocketOption_Private(const PP_TCPSocketOption_Private *v); +const string ToString_PP_TCPSocketOption_Private(const PP_TCPSocketOption_Private &v); +void FromJSON_PP_TCPSocketOption_Private(JSONIterator& iterator, PP_TCPSocketOption_Private &value); +#ifdef INTERPOSE +static PPB_TCPSocket_Private_0_3 *_real_PPB_TCPSocket_Private_0_3; +#endif // INTERPOSE +const string ToString_PPB_TCPSocket_Private(const PPB_TCPSocket_Private_0_3 *v); +#ifdef INTERPOSE +static PPB_TCPSocket_Private_0_4 *_real_PPB_TCPSocket_Private_0_4; +#endif // INTERPOSE +const string ToString_PPB_TCPSocket_Private(const PPB_TCPSocket_Private_0_4 *v); +#ifdef INTERPOSE +static PPB_TCPSocket_Private_0_5 *_real_PPB_TCPSocket_Private_0_5; +#endif // INTERPOSE +const string ToString_PPB_TCPSocket_Private(const PPB_TCPSocket_Private_0_5 *v); +#ifdef INTERPOSE +static PPB_Testing_Private_1_0 *_real_PPB_Testing_Private_1_0; +#endif // INTERPOSE +const string ToString_PPB_Testing_Private(const PPB_Testing_Private_1_0 *v); +const string ToString_PP_UDPSocketFeature_Private(const PP_UDPSocketFeature_Private *v); +const string ToString_PP_UDPSocketFeature_Private(const PP_UDPSocketFeature_Private &v); +void FromJSON_PP_UDPSocketFeature_Private(JSONIterator& iterator, PP_UDPSocketFeature_Private &value); +#ifdef INTERPOSE +static PPB_UDPSocket_Private_0_2 *_real_PPB_UDPSocket_Private_0_2; +#endif // INTERPOSE +const string ToString_PPB_UDPSocket_Private(const PPB_UDPSocket_Private_0_2 *v); +#ifdef INTERPOSE +static PPB_UDPSocket_Private_0_3 *_real_PPB_UDPSocket_Private_0_3; +#endif // INTERPOSE +const string ToString_PPB_UDPSocket_Private(const PPB_UDPSocket_Private_0_3 *v); +#ifdef INTERPOSE +static PPB_UDPSocket_Private_0_4 *_real_PPB_UDPSocket_Private_0_4; +#endif // INTERPOSE +const string ToString_PPB_UDPSocket_Private(const PPB_UDPSocket_Private_0_4 *v); +#ifdef INTERPOSE +static PPB_UMA_Private_0_3 *_real_PPB_UMA_Private_0_3; +#endif // INTERPOSE +const string ToString_PPB_UMA_Private(const PPB_UMA_Private_0_3 *v); +#ifdef INTERPOSE +static PPB_VideoDestination_Private_0_1 *_real_PPB_VideoDestination_Private_0_1; +#endif // INTERPOSE +const string ToString_PPB_VideoDestination_Private(const PPB_VideoDestination_Private_0_1 *v); +#ifdef INTERPOSE +static PPB_VideoSource_Private_0_1 *_real_PPB_VideoSource_Private_0_1; +#endif // INTERPOSE +const string ToString_PPB_VideoSource_Private(const PPB_VideoSource_Private_0_1 *v); +const string ToString_PP_X509Certificate_Private_Field(const PP_X509Certificate_Private_Field *v); +const string ToString_PP_X509Certificate_Private_Field(const PP_X509Certificate_Private_Field &v); +void FromJSON_PP_X509Certificate_Private_Field(JSONIterator& iterator, PP_X509Certificate_Private_Field &value); +const string ToString_PPB_X509Certificate_Private_Version(const PPB_X509Certificate_Private_Version *v); +const string ToString_PPB_X509Certificate_Private_Version(const PPB_X509Certificate_Private_Version &v); +void FromJSON_PPB_X509Certificate_Private_Version(JSONIterator& iterator, PPB_X509Certificate_Private_Version &value); +#ifdef INTERPOSE +static PPB_X509Certificate_Private_0_1 *_real_PPB_X509Certificate_Private_0_1; +#endif // INTERPOSE +const string ToString_PPB_X509Certificate_Private(const PPB_X509Certificate_Private_0_1 *v); +#ifdef INTERPOSE +static PPP_ContentDecryptor_Private_0_16 *_real_PPP_ContentDecryptor_Private_0_16; +#endif // INTERPOSE +static char* Call_PPP_ContentDecryptor_Private(void* _interface, JSONIterator& iterator); +#ifdef INTERPOSE +static PPP_Find_Private_0_3 *_real_PPP_Find_Private_0_3; +#endif // INTERPOSE +static char* Call_PPP_Find_Private(void* _interface, JSONIterator& iterator); +const string ToString_PP_Flash_BrowserOperations_SettingType(const PP_Flash_BrowserOperations_SettingType *v); +const string ToString_PP_Flash_BrowserOperations_SettingType(const PP_Flash_BrowserOperations_SettingType &v); +void FromJSON_PP_Flash_BrowserOperations_SettingType(JSONIterator& iterator, PP_Flash_BrowserOperations_SettingType &value); +const string ToString_PP_Flash_BrowserOperations_Permission(const PP_Flash_BrowserOperations_Permission *v); +const string ToString_PP_Flash_BrowserOperations_Permission(const PP_Flash_BrowserOperations_Permission &v); +void FromJSON_PP_Flash_BrowserOperations_Permission(JSONIterator& iterator, PP_Flash_BrowserOperations_Permission &value); +const string ToString_PP_Flash_BrowserOperations_SiteSetting(const PP_Flash_BrowserOperations_SiteSetting *v); +const string ToString_PP_Flash_BrowserOperations_SiteSetting(const PP_Flash_BrowserOperations_SiteSetting &v); +void FromJSON_PP_Flash_BrowserOperations_SiteSetting(JSONIterator& iterator, PP_Flash_BrowserOperations_SiteSetting &value); +const string ToString_PPB_Flash_BrowserOperations_GetSettingsCallback(const PPB_Flash_BrowserOperations_GetSettingsCallback &v); +void FromJSON_PPB_Flash_BrowserOperations_GetSettingsCallback(JSONIterator& iterator, PPB_Flash_BrowserOperations_GetSettingsCallback &value); +#ifdef INTERPOSE +static PPP_Flash_BrowserOperations_1_0 *_real_PPP_Flash_BrowserOperations_1_0; +#endif // INTERPOSE +static char* Call_PPP_Flash_BrowserOperations_1_0(void* _interface, JSONIterator& iterator); +#ifdef INTERPOSE +static PPP_Flash_BrowserOperations_1_2 *_real_PPP_Flash_BrowserOperations_1_2; +#endif // INTERPOSE +static char* Call_PPP_Flash_BrowserOperations_1_2(void* _interface, JSONIterator& iterator); +#ifdef INTERPOSE +static PPP_Flash_BrowserOperations_1_3 *_real_PPP_Flash_BrowserOperations_1_3; +#endif // INTERPOSE +static char* Call_PPP_Flash_BrowserOperations(void* _interface, JSONIterator& iterator); +#ifdef INTERPOSE +static PPP_Instance_Private_0_1 *_real_PPP_Instance_Private_0_1; +#endif // INTERPOSE +static char* Call_PPP_Instance_Private(void* _interface, JSONIterator& iterator); +#ifdef INTERPOSE +static PPP_PexeStreamHandler_1_0 *_real_PPP_PexeStreamHandler_1_0; +#endif // INTERPOSE +static char* Call_PPP_PexeStreamHandler(void* _interface, JSONIterator& iterator); +const string ToString_PP_ArrayOutput_GetDataBuffer(const PP_ArrayOutput_GetDataBuffer &v) { + return PointerToString(v); +} +void FromJSON_PP_ArrayOutput_GetDataBuffer(JSONIterator& iterator, PP_ArrayOutput_GetDataBuffer &value) { + PointerValueFromJSON(iterator, value); +} +const string ToString_PP_ArrayOutput(const PP_ArrayOutput *v) { + if (!v) { + return "null"; + } + return ToString_PP_ArrayOutput(*v); +} +const string ToString_PP_ArrayOutput(const PP_ArrayOutput &v) { + stringstream x; + BeginProps(x); + AddProp(x, "GetDataBuffer", ToString_PP_ArrayOutput_GetDataBuffer(v.GetDataBuffer)); + AddProp(x, "user_data", ToString_mem_t(v.user_data)); + EndProps(x); + return x.str(); +} +void FromJSON_PP_ArrayOutput(JSONIterator& iterator, PP_ArrayOutput &value) { + const JSON::Token& current = iterator.getCurrentAndGotoNext(); + if (current.isPrimitive() && !current.value().compare("null")) { + return; + } + if (!current.isObject()) { + Fail("Expected object!", ""); + } + iterator.skip(); + FromJSON_PP_ArrayOutput_GetDataBuffer(iterator, value.GetDataBuffer); + iterator.skip(); + FromJSON_mem_t(iterator, value.user_data); +} +const string ToString_PP_Bool(const PP_Bool *v) { + switch (*v) { + case 0: + return "\"PP_FALSE\""; + case 1: + return "\"PP_TRUE\""; + default: + return "\"???\""; + } +} +const string ToString_PP_Bool(const PP_Bool &v) { + return ToString_PP_Bool(&v); +} +void FromJSON_PP_Bool(JSONIterator& iterator, PP_Bool &value) { + long int v; + FromJSON_int(iterator, v); + value = PP_Bool(v); +} +const string ToString_PP_VideoProfile(const PP_VideoProfile *v) { + switch (*v) { + case 0: + return "\"PP_VIDEOPROFILE_H264BASELINE\""; + case 1: + return "\"PP_VIDEOPROFILE_H264MAIN\""; + case 2: + return "\"PP_VIDEOPROFILE_H264EXTENDED\""; + case 3: + return "\"PP_VIDEOPROFILE_H264HIGH\""; + case 4: + return "\"PP_VIDEOPROFILE_H264HIGH10PROFILE\""; + case 5: + return "\"PP_VIDEOPROFILE_H264HIGH422PROFILE\""; + case 6: + return "\"PP_VIDEOPROFILE_H264HIGH444PREDICTIVEPROFILE\""; + case 7: + return "\"PP_VIDEOPROFILE_H264SCALABLEBASELINE\""; + case 8: + return "\"PP_VIDEOPROFILE_H264SCALABLEHIGH\""; + case 9: + return "\"PP_VIDEOPROFILE_H264STEREOHIGH\""; + case 10: + return "\"PP_VIDEOPROFILE_H264MULTIVIEWHIGH\""; + case 11: + return "\"PP_VIDEOPROFILE_VP8_ANY\""; + case 12: + return "\"PP_VIDEOPROFILE_VP9_ANY\""; + default: + return "\"???\""; + } +} +const string ToString_PP_VideoProfile(const PP_VideoProfile &v) { + return ToString_PP_VideoProfile(&v); +} +void FromJSON_PP_VideoProfile(JSONIterator& iterator, PP_VideoProfile &value) { + long int v; + FromJSON_int(iterator, v); + value = PP_VideoProfile(v); +} +const string ToString_PP_AudioProfile(const PP_AudioProfile *v) { + switch (*v) { + case 0: + return "\"PP_AUDIOPROFILE_OPUS\""; + default: + return "\"???\""; + } +} +const string ToString_PP_AudioProfile(const PP_AudioProfile &v) { + return ToString_PP_AudioProfile(&v); +} +void FromJSON_PP_AudioProfile(JSONIterator& iterator, PP_AudioProfile &value) { + long int v; + FromJSON_int(iterator, v); + value = PP_AudioProfile(v); +} +const string ToString_PP_HardwareAcceleration(const PP_HardwareAcceleration *v) { + switch (*v) { + case 0: + return "\"PP_HARDWAREACCELERATION_ONLY\""; + case 1: + return "\"PP_HARDWAREACCELERATION_WITHFALLBACK\""; + case 2: + return "\"PP_HARDWAREACCELERATION_NONE\""; + default: + return "\"???\""; + } +} +const string ToString_PP_HardwareAcceleration(const PP_HardwareAcceleration &v) { + return ToString_PP_HardwareAcceleration(&v); +} +void FromJSON_PP_HardwareAcceleration(JSONIterator& iterator, PP_HardwareAcceleration &value) { + long int v; + FromJSON_int(iterator, v); + value = PP_HardwareAcceleration(v); +} +const string ToString_PP_VideoPicture(const PP_VideoPicture *v) { + if (!v) { + return "null"; + } + return ToString_PP_VideoPicture(*v); +} +const string ToString_PP_VideoPicture(const PP_VideoPicture &v) { + stringstream x; + BeginProps(x); + AddProp(x, "decode_id", ToString_uint32_t(v.decode_id)); + AddProp(x, "texture_id", ToString_uint32_t(v.texture_id)); + AddProp(x, "texture_target", ToString_uint32_t(v.texture_target)); + AddProp(x, "texture_size", ToString_PP_Size(v.texture_size)); + AddProp(x, "visible_rect", ToString_PP_Rect(v.visible_rect)); + EndProps(x); + return x.str(); +} +void FromJSON_PP_VideoPicture(JSONIterator& iterator, PP_VideoPicture &value) { + const JSON::Token& current = iterator.getCurrentAndGotoNext(); + if (current.isPrimitive() && !current.value().compare("null")) { + return; + } + if (!current.isObject()) { + Fail("Expected object!", ""); + } + iterator.skip(); + FromJSON_uint32_t(iterator, value.decode_id); + iterator.skip(); + FromJSON_uint32_t(iterator, value.texture_id); + iterator.skip(); + FromJSON_uint32_t(iterator, value.texture_target); + iterator.skip(); + FromJSON_PP_Size(iterator, value.texture_size); + iterator.skip(); + FromJSON_PP_Rect(iterator, value.visible_rect); +} +const string ToString_PP_VideoPicture_0_1(const PP_VideoPicture_0_1 *v) { + if (!v) { + return "null"; + } + return ToString_PP_VideoPicture_0_1(*v); +} +const string ToString_PP_VideoPicture_0_1(const PP_VideoPicture_0_1 &v) { + stringstream x; + BeginProps(x); + AddProp(x, "decode_id", ToString_uint32_t(v.decode_id)); + AddProp(x, "texture_id", ToString_uint32_t(v.texture_id)); + AddProp(x, "texture_target", ToString_uint32_t(v.texture_target)); + AddProp(x, "texture_size", ToString_PP_Size(v.texture_size)); + EndProps(x); + return x.str(); +} +void FromJSON_PP_VideoPicture_0_1(JSONIterator& iterator, PP_VideoPicture_0_1 &value) { + const JSON::Token& current = iterator.getCurrentAndGotoNext(); + if (current.isPrimitive() && !current.value().compare("null")) { + return; + } + if (!current.isObject()) { + Fail("Expected object!", ""); + } + iterator.skip(); + FromJSON_uint32_t(iterator, value.decode_id); + iterator.skip(); + FromJSON_uint32_t(iterator, value.texture_id); + iterator.skip(); + FromJSON_uint32_t(iterator, value.texture_target); + iterator.skip(); + FromJSON_PP_Size(iterator, value.texture_size); +} +const string ToString_PP_VideoProfileDescription(const PP_VideoProfileDescription *v) { + if (!v) { + return "null"; + } + return ToString_PP_VideoProfileDescription(*v); +} +const string ToString_PP_VideoProfileDescription(const PP_VideoProfileDescription &v) { + stringstream x; + BeginProps(x); + AddProp(x, "profile", ToString_PP_VideoProfile(v.profile)); + AddProp(x, "max_resolution", ToString_PP_Size(v.max_resolution)); + AddProp(x, "max_framerate_numerator", ToString_uint32_t(v.max_framerate_numerator)); + AddProp(x, "max_framerate_denominator", ToString_uint32_t(v.max_framerate_denominator)); + AddProp(x, "hardware_accelerated", ToString_PP_Bool(v.hardware_accelerated)); + EndProps(x); + return x.str(); +} +void FromJSON_PP_VideoProfileDescription(JSONIterator& iterator, PP_VideoProfileDescription &value) { + const JSON::Token& current = iterator.getCurrentAndGotoNext(); + if (current.isPrimitive() && !current.value().compare("null")) { + return; + } + if (!current.isObject()) { + Fail("Expected object!", ""); + } + iterator.skip(); + FromJSON_PP_VideoProfile(iterator, value.profile); + iterator.skip(); + FromJSON_PP_Size(iterator, value.max_resolution); + iterator.skip(); + FromJSON_uint32_t(iterator, value.max_framerate_numerator); + iterator.skip(); + FromJSON_uint32_t(iterator, value.max_framerate_denominator); + iterator.skip(); + FromJSON_PP_Bool(iterator, value.hardware_accelerated); +} +const string ToString_PP_VideoProfileDescription_0_1(const PP_VideoProfileDescription_0_1 *v) { + if (!v) { + return "null"; + } + return ToString_PP_VideoProfileDescription_0_1(*v); +} +const string ToString_PP_VideoProfileDescription_0_1(const PP_VideoProfileDescription_0_1 &v) { + stringstream x; + BeginProps(x); + AddProp(x, "profile", ToString_PP_VideoProfile(v.profile)); + AddProp(x, "max_resolution", ToString_PP_Size(v.max_resolution)); + AddProp(x, "max_framerate_numerator", ToString_uint32_t(v.max_framerate_numerator)); + AddProp(x, "max_framerate_denominator", ToString_uint32_t(v.max_framerate_denominator)); + AddProp(x, "acceleration", ToString_PP_HardwareAcceleration(v.acceleration)); + EndProps(x); + return x.str(); +} +void FromJSON_PP_VideoProfileDescription_0_1(JSONIterator& iterator, PP_VideoProfileDescription_0_1 &value) { + const JSON::Token& current = iterator.getCurrentAndGotoNext(); + if (current.isPrimitive() && !current.value().compare("null")) { + return; + } + if (!current.isObject()) { + Fail("Expected object!", ""); + } + iterator.skip(); + FromJSON_PP_VideoProfile(iterator, value.profile); + iterator.skip(); + FromJSON_PP_Size(iterator, value.max_resolution); + iterator.skip(); + FromJSON_uint32_t(iterator, value.max_framerate_numerator); + iterator.skip(); + FromJSON_uint32_t(iterator, value.max_framerate_denominator); + iterator.skip(); + FromJSON_PP_HardwareAcceleration(iterator, value.acceleration); +} +const string ToString_PP_AudioProfileDescription(const PP_AudioProfileDescription *v) { + if (!v) { + return "null"; + } + return ToString_PP_AudioProfileDescription(*v); +} +const string ToString_PP_AudioProfileDescription(const PP_AudioProfileDescription &v) { + stringstream x; + BeginProps(x); + AddProp(x, "profile", ToString_PP_AudioProfile(v.profile)); + AddProp(x, "max_channels", ToString_uint32_t(v.max_channels)); + AddProp(x, "sample_size", ToString_uint32_t(v.sample_size)); + AddProp(x, "sample_rate", ToString_uint32_t(v.sample_rate)); + AddProp(x, "hardware_accelerated", ToString_PP_Bool(v.hardware_accelerated)); + EndProps(x); + return x.str(); +} +void FromJSON_PP_AudioProfileDescription(JSONIterator& iterator, PP_AudioProfileDescription &value) { + const JSON::Token& current = iterator.getCurrentAndGotoNext(); + if (current.isPrimitive() && !current.value().compare("null")) { + return; + } + if (!current.isObject()) { + Fail("Expected object!", ""); + } + iterator.skip(); + FromJSON_PP_AudioProfile(iterator, value.profile); + iterator.skip(); + FromJSON_uint32_t(iterator, value.max_channels); + iterator.skip(); + FromJSON_uint32_t(iterator, value.sample_size); + iterator.skip(); + FromJSON_uint32_t(iterator, value.sample_rate); + iterator.skip(); + FromJSON_PP_Bool(iterator, value.hardware_accelerated); +} +const string ToString_PP_BitstreamBuffer(const PP_BitstreamBuffer *v) { + if (!v) { + return "null"; + } + return ToString_PP_BitstreamBuffer(*v); +} +const string ToString_PP_BitstreamBuffer(const PP_BitstreamBuffer &v) { + stringstream x; + BeginProps(x); + AddProp(x, "size", ToString_uint32_t(v.size)); + AddProp(x, "buffer", ToString_mem_t(v.buffer)); + AddProp(x, "key_frame", ToString_PP_Bool(v.key_frame)); + EndProps(x); + return x.str(); +} +void FromJSON_PP_BitstreamBuffer(JSONIterator& iterator, PP_BitstreamBuffer &value) { + const JSON::Token& current = iterator.getCurrentAndGotoNext(); + if (current.isPrimitive() && !current.value().compare("null")) { + return; + } + if (!current.isObject()) { + Fail("Expected object!", ""); + } + iterator.skip(); + FromJSON_uint32_t(iterator, value.size); + iterator.skip(); + FromJSON_mem_t(iterator, value.buffer); + iterator.skip(); + FromJSON_PP_Bool(iterator, value.key_frame); +} +const string ToString_PP_AudioBitstreamBuffer(const PP_AudioBitstreamBuffer *v) { + if (!v) { + return "null"; + } + return ToString_PP_AudioBitstreamBuffer(*v); +} +const string ToString_PP_AudioBitstreamBuffer(const PP_AudioBitstreamBuffer &v) { + stringstream x; + BeginProps(x); + AddProp(x, "size", ToString_uint32_t(v.size)); + AddProp(x, "buffer", ToString_mem_t(v.buffer)); + EndProps(x); + return x.str(); +} +void FromJSON_PP_AudioBitstreamBuffer(JSONIterator& iterator, PP_AudioBitstreamBuffer &value) { + const JSON::Token& current = iterator.getCurrentAndGotoNext(); + if (current.isPrimitive() && !current.value().compare("null")) { + return; + } + if (!current.isObject()) { + Fail("Expected object!", ""); + } + iterator.skip(); + FromJSON_uint32_t(iterator, value.size); + iterator.skip(); + FromJSON_mem_t(iterator, value.buffer); +} +const string ToString_PP_CompletionCallback_Func(const PP_CompletionCallback_Func &v) { + return PointerToString(v); +} +void FromJSON_PP_CompletionCallback_Func(JSONIterator& iterator, PP_CompletionCallback_Func &value) { + PointerValueFromJSON(iterator, value); +} +const string ToString_PP_CompletionCallback_Flag(const PP_CompletionCallback_Flag *v) { + switch (*v) { + case 0 << 0: + return "\"PP_COMPLETIONCALLBACK_FLAG_NONE\""; + case 1 << 0: + return "\"PP_COMPLETIONCALLBACK_FLAG_OPTIONAL\""; + default: + return "\"???\""; + } +} +const string ToString_PP_CompletionCallback_Flag(const PP_CompletionCallback_Flag &v) { + return ToString_PP_CompletionCallback_Flag(&v); +} +void FromJSON_PP_CompletionCallback_Flag(JSONIterator& iterator, PP_CompletionCallback_Flag &value) { + long int v; + FromJSON_int(iterator, v); + value = PP_CompletionCallback_Flag(v); +} +const string ToString_PP_CompletionCallback(const PP_CompletionCallback *v) { + if (!v) { + return "null"; + } + return ToString_PP_CompletionCallback(*v); +} +const string ToString_PP_CompletionCallback(const PP_CompletionCallback &v) { + stringstream x; + BeginProps(x); + AddProp(x, "func", ToString_PP_CompletionCallback_Func(v.func)); + AddProp(x, "user_data", ToString_mem_t(v.user_data)); + AddProp(x, "flags", ToString_int32_t(v.flags)); + EndProps(x); + return x.str(); +} +void FromJSON_PP_CompletionCallback(JSONIterator& iterator, PP_CompletionCallback &value) { + const JSON::Token& current = iterator.getCurrentAndGotoNext(); + if (current.isPrimitive() && !current.value().compare("null")) { + return; + } + if (!current.isObject()) { + Fail("Expected object!", ""); + } + iterator.skip(); + FromJSON_PP_CompletionCallback_Func(iterator, value.func); + iterator.skip(); + FromJSON_mem_t(iterator, value.user_data); + iterator.skip(); + FromJSON_int32_t(iterator, value.flags); +} +const string ToString_PP_DirectoryEntry(const PP_DirectoryEntry *v) { + if (!v) { + return "null"; + } + return ToString_PP_DirectoryEntry(*v); +} +const string ToString_PP_DirectoryEntry(const PP_DirectoryEntry &v) { + stringstream x; + BeginProps(x); + AddProp(x, "file_ref", ToString_PP_Resource(v.file_ref)); + AddProp(x, "file_type", ToString_PP_FileType(v.file_type)); + EndProps(x); + return x.str(); +} +void FromJSON_PP_DirectoryEntry(JSONIterator& iterator, PP_DirectoryEntry &value) { + const JSON::Token& current = iterator.getCurrentAndGotoNext(); + if (current.isPrimitive() && !current.value().compare("null")) { + return; + } + if (!current.isObject()) { + Fail("Expected object!", ""); + } + iterator.skip(); + FromJSON_PP_Resource(iterator, value.file_ref); + iterator.skip(); + FromJSON_PP_FileType(iterator, value.file_type); +} +const string ToString_PP_FileType(const PP_FileType *v) { + switch (*v) { + case 0: + return "\"PP_FILETYPE_REGULAR\""; + case 1: + return "\"PP_FILETYPE_DIRECTORY\""; + case 2: + return "\"PP_FILETYPE_OTHER\""; + default: + return "\"???\""; + } +} +const string ToString_PP_FileType(const PP_FileType &v) { + return ToString_PP_FileType(&v); +} +void FromJSON_PP_FileType(JSONIterator& iterator, PP_FileType &value) { + long int v; + FromJSON_int(iterator, v); + value = PP_FileType(v); +} +const string ToString_PP_FileSystemType(const PP_FileSystemType *v) { + switch (*v) { + case 0: + return "\"PP_FILESYSTEMTYPE_INVALID\""; + case 1: + return "\"PP_FILESYSTEMTYPE_EXTERNAL\""; + case 2: + return "\"PP_FILESYSTEMTYPE_LOCALPERSISTENT\""; + case 3: + return "\"PP_FILESYSTEMTYPE_LOCALTEMPORARY\""; + case 4: + return "\"PP_FILESYSTEMTYPE_ISOLATED\""; + default: + return "\"???\""; + } +} +const string ToString_PP_FileSystemType(const PP_FileSystemType &v) { + return ToString_PP_FileSystemType(&v); +} +void FromJSON_PP_FileSystemType(JSONIterator& iterator, PP_FileSystemType &value) { + long int v; + FromJSON_int(iterator, v); + value = PP_FileSystemType(v); +} +const string ToString_PP_FileInfo(const PP_FileInfo *v) { + if (!v) { + return "null"; + } + return ToString_PP_FileInfo(*v); +} +const string ToString_PP_FileInfo(const PP_FileInfo &v) { + stringstream x; + BeginProps(x); + AddProp(x, "size", ToString_int64_t(v.size)); + AddProp(x, "type", ToString_PP_FileType(v.type)); + AddProp(x, "system_type", ToString_PP_FileSystemType(v.system_type)); + AddProp(x, "creation_time", ToString_PP_Time(v.creation_time)); + AddProp(x, "last_access_time", ToString_PP_Time(v.last_access_time)); + AddProp(x, "last_modified_time", ToString_PP_Time(v.last_modified_time)); + EndProps(x); + return x.str(); +} +void FromJSON_PP_FileInfo(JSONIterator& iterator, PP_FileInfo &value) { + const JSON::Token& current = iterator.getCurrentAndGotoNext(); + if (current.isPrimitive() && !current.value().compare("null")) { + return; + } + if (!current.isObject()) { + Fail("Expected object!", ""); + } + iterator.skip(); + FromJSON_int64_t(iterator, value.size); + iterator.skip(); + FromJSON_PP_FileType(iterator, value.type); + iterator.skip(); + FromJSON_PP_FileSystemType(iterator, value.system_type); + iterator.skip(); + FromJSON_PP_Time(iterator, value.creation_time); + iterator.skip(); + FromJSON_PP_Time(iterator, value.last_access_time); + iterator.skip(); + FromJSON_PP_Time(iterator, value.last_modified_time); +} +const string ToString_PP_Graphics3DAttrib(const PP_Graphics3DAttrib *v) { + switch (*v) { + case 0x3021: + return "\"PP_GRAPHICS3DATTRIB_ALPHA_SIZE\""; + case 0x3022: + return "\"PP_GRAPHICS3DATTRIB_BLUE_SIZE\""; + case 0x3023: + return "\"PP_GRAPHICS3DATTRIB_GREEN_SIZE\""; + case 0x3024: + return "\"PP_GRAPHICS3DATTRIB_RED_SIZE\""; + case 0x3025: + return "\"PP_GRAPHICS3DATTRIB_DEPTH_SIZE\""; + case 0x3026: + return "\"PP_GRAPHICS3DATTRIB_STENCIL_SIZE\""; + case 0x3031: + return "\"PP_GRAPHICS3DATTRIB_SAMPLES\""; + case 0x3032: + return "\"PP_GRAPHICS3DATTRIB_SAMPLE_BUFFERS\""; + case 0x3038: + return "\"PP_GRAPHICS3DATTRIB_NONE\""; + case 0x3056: + return "\"PP_GRAPHICS3DATTRIB_HEIGHT\""; + case 0x3057: + return "\"PP_GRAPHICS3DATTRIB_WIDTH\""; + case 0x3093: + return "\"PP_GRAPHICS3DATTRIB_SWAP_BEHAVIOR\""; + case 0x3094: + return "\"PP_GRAPHICS3DATTRIB_BUFFER_PRESERVED\""; + case 0x3095: + return "\"PP_GRAPHICS3DATTRIB_BUFFER_DESTROYED\""; + case 0x11000: + return "\"PP_GRAPHICS3DATTRIB_GPU_PREFERENCE\""; + case 0x11001: + return "\"PP_GRAPHICS3DATTRIB_GPU_PREFERENCE_LOW_POWER\""; + case 0x11002: + return "\"PP_GRAPHICS3DATTRIB_GPU_PREFERENCE_PERFORMANCE\""; + default: + return "\"???\""; + } +} +const string ToString_PP_Graphics3DAttrib(const PP_Graphics3DAttrib &v) { + return ToString_PP_Graphics3DAttrib(&v); +} +void FromJSON_PP_Graphics3DAttrib(JSONIterator& iterator, PP_Graphics3DAttrib &value) { + long int v; + FromJSON_int(iterator, v); + value = PP_Graphics3DAttrib(v); +} +const string ToString_PP_InputEvent_Key(const PP_InputEvent_Key *v) { + if (!v) { + return "null"; + } + return ToString_PP_InputEvent_Key(*v); +} +const string ToString_PP_InputEvent_Key(const PP_InputEvent_Key &v) { + stringstream x; + BeginProps(x); + AddProp(x, "modifier", ToString_uint32_t(v.modifier)); + AddProp(x, "key_code", ToString_uint32_t(v.key_code)); + EndProps(x); + return x.str(); +} +void FromJSON_PP_InputEvent_Key(JSONIterator& iterator, PP_InputEvent_Key &value) { + const JSON::Token& current = iterator.getCurrentAndGotoNext(); + if (current.isPrimitive() && !current.value().compare("null")) { + return; + } + if (!current.isObject()) { + Fail("Expected object!", ""); + } + iterator.skip(); + FromJSON_uint32_t(iterator, value.modifier); + iterator.skip(); + FromJSON_uint32_t(iterator, value.key_code); +} +const string ToString_PP_InputEvent_Character(const PP_InputEvent_Character *v) { + if (!v) { + return "null"; + } + return ToString_PP_InputEvent_Character(*v); +} +const string ToString_PP_InputEvent_Character(const PP_InputEvent_Character &v) { + stringstream x; + BeginProps(x); + AddProp(x, "modifier", ToString_uint32_t(v.modifier)); + { + BeginProp(x, "text"); + BeginElements(x); + for (uint32_t _n = 0; _n < 5; ++_n) { + AddElement(x, ToString_int8_t(v.text[_n])); + } + EndElements(x); + } + EndProps(x); + return x.str(); +} +void FromJSON_PP_InputEvent_Character(JSONIterator& iterator, PP_InputEvent_Character &value) { + const JSON::Token& current = iterator.getCurrentAndGotoNext(); + if (current.isPrimitive() && !current.value().compare("null")) { + return; + } + if (!current.isObject()) { + Fail("Expected object!", ""); + } + iterator.skip(); + FromJSON_uint32_t(iterator, value.modifier); + iterator.skip(); + + { + size_t children = iterator.expectArrayAndGotoFirstItem(); + if (children > 5) { + Fail("Too many items in array\n", ""); + } + for (uint32_t _n = 0; _n < children; ++_n) { + FromJSON_int8_t(iterator, (value.text)[_n]); + } + // FIXME Null out remaining items? + } +} +const string ToString_PP_InputEvent_Mouse(const PP_InputEvent_Mouse *v) { + if (!v) { + return "null"; + } + return ToString_PP_InputEvent_Mouse(*v); +} +const string ToString_PP_InputEvent_Mouse(const PP_InputEvent_Mouse &v) { + stringstream x; + BeginProps(x); + AddProp(x, "modifier", ToString_uint32_t(v.modifier)); + AddProp(x, "button", ToString_PP_InputEvent_MouseButton(v.button)); + AddProp(x, "x", ToString_float_t(v.x)); + AddProp(x, "y", ToString_float_t(v.y)); + AddProp(x, "click_count", ToString_int32_t(v.click_count)); + EndProps(x); + return x.str(); +} +void FromJSON_PP_InputEvent_Mouse(JSONIterator& iterator, PP_InputEvent_Mouse &value) { + const JSON::Token& current = iterator.getCurrentAndGotoNext(); + if (current.isPrimitive() && !current.value().compare("null")) { + return; + } + if (!current.isObject()) { + Fail("Expected object!", ""); + } + iterator.skip(); + FromJSON_uint32_t(iterator, value.modifier); + iterator.skip(); + FromJSON_PP_InputEvent_MouseButton(iterator, value.button); + iterator.skip(); + FromJSON_float_t(iterator, value.x); + iterator.skip(); + FromJSON_float_t(iterator, value.y); + iterator.skip(); + FromJSON_int32_t(iterator, value.click_count); +} +const string ToString_PP_InputEvent_Wheel(const PP_InputEvent_Wheel *v) { + if (!v) { + return "null"; + } + return ToString_PP_InputEvent_Wheel(*v); +} +const string ToString_PP_InputEvent_Wheel(const PP_InputEvent_Wheel &v) { + stringstream x; + BeginProps(x); + AddProp(x, "modifier", ToString_uint32_t(v.modifier)); + AddProp(x, "delta_x", ToString_float_t(v.delta_x)); + AddProp(x, "delta_y", ToString_float_t(v.delta_y)); + AddProp(x, "wheel_ticks_x", ToString_float_t(v.wheel_ticks_x)); + AddProp(x, "wheel_ticks_y", ToString_float_t(v.wheel_ticks_y)); + AddProp(x, "scroll_by_page", ToString_PP_Bool(v.scroll_by_page)); + EndProps(x); + return x.str(); +} +void FromJSON_PP_InputEvent_Wheel(JSONIterator& iterator, PP_InputEvent_Wheel &value) { + const JSON::Token& current = iterator.getCurrentAndGotoNext(); + if (current.isPrimitive() && !current.value().compare("null")) { + return; + } + if (!current.isObject()) { + Fail("Expected object!", ""); + } + iterator.skip(); + FromJSON_uint32_t(iterator, value.modifier); + iterator.skip(); + FromJSON_float_t(iterator, value.delta_x); + iterator.skip(); + FromJSON_float_t(iterator, value.delta_y); + iterator.skip(); + FromJSON_float_t(iterator, value.wheel_ticks_x); + iterator.skip(); + FromJSON_float_t(iterator, value.wheel_ticks_y); + iterator.skip(); + FromJSON_PP_Bool(iterator, value.scroll_by_page); +} +const string ToString_PP_Instance(const PP_Instance *v) { + return ToString_int32_t(v); +} +const string ToString_PP_Instance(const PP_Instance &v) { + return ToString_PP_Instance(&v); +} +void FromJSON_PP_Instance(JSONIterator& iterator, PP_Instance &value) { + FromJSON_int32_t(iterator, value); +} +const string ToString_PP_Module(const PP_Module *v) { + return ToString_int32_t(v); +} +const string ToString_PP_Module(const PP_Module &v) { + return ToString_PP_Module(&v); +} +void FromJSON_PP_Module(JSONIterator& iterator, PP_Module &value) { + FromJSON_int32_t(iterator, value); +} +const string ToString_PP_Point(const PP_Point *v) { + if (!v) { + return "null"; + } + return ToString_PP_Point(*v); +} +const string ToString_PP_Point(const PP_Point &v) { + stringstream x; + BeginProps(x); + AddProp(x, "x", ToString_int32_t(v.x)); + AddProp(x, "y", ToString_int32_t(v.y)); + EndProps(x); + return x.str(); +} +void FromJSON_PP_Point(JSONIterator& iterator, PP_Point &value) { + const JSON::Token& current = iterator.getCurrentAndGotoNext(); + if (current.isPrimitive() && !current.value().compare("null")) { + return; + } + if (!current.isObject()) { + Fail("Expected object!", ""); + } + iterator.skip(); + FromJSON_int32_t(iterator, value.x); + iterator.skip(); + FromJSON_int32_t(iterator, value.y); +} +const string ToString_PP_FloatPoint(const PP_FloatPoint *v) { + if (!v) { + return "null"; + } + return ToString_PP_FloatPoint(*v); +} +const string ToString_PP_FloatPoint(const PP_FloatPoint &v) { + stringstream x; + BeginProps(x); + AddProp(x, "x", ToString_float_t(v.x)); + AddProp(x, "y", ToString_float_t(v.y)); + EndProps(x); + return x.str(); +} +void FromJSON_PP_FloatPoint(JSONIterator& iterator, PP_FloatPoint &value) { + const JSON::Token& current = iterator.getCurrentAndGotoNext(); + if (current.isPrimitive() && !current.value().compare("null")) { + return; + } + if (!current.isObject()) { + Fail("Expected object!", ""); + } + iterator.skip(); + FromJSON_float_t(iterator, value.x); + iterator.skip(); + FromJSON_float_t(iterator, value.y); +} +const string ToString_PP_Rect(const PP_Rect *v) { + if (!v) { + return "null"; + } + return ToString_PP_Rect(*v); +} +const string ToString_PP_Rect(const PP_Rect &v) { + stringstream x; + BeginProps(x); + AddProp(x, "point", ToString_PP_Point(v.point)); + AddProp(x, "size", ToString_PP_Size(v.size)); + EndProps(x); + return x.str(); +} +void FromJSON_PP_Rect(JSONIterator& iterator, PP_Rect &value) { + const JSON::Token& current = iterator.getCurrentAndGotoNext(); + if (current.isPrimitive() && !current.value().compare("null")) { + return; + } + if (!current.isObject()) { + Fail("Expected object!", ""); + } + iterator.skip(); + FromJSON_PP_Point(iterator, value.point); + iterator.skip(); + FromJSON_PP_Size(iterator, value.size); +} +const string ToString_PP_FloatRect(const PP_FloatRect *v) { + if (!v) { + return "null"; + } + return ToString_PP_FloatRect(*v); +} +const string ToString_PP_FloatRect(const PP_FloatRect &v) { + stringstream x; + BeginProps(x); + AddProp(x, "point", ToString_PP_FloatPoint(v.point)); + AddProp(x, "size", ToString_PP_FloatSize(v.size)); + EndProps(x); + return x.str(); +} +void FromJSON_PP_FloatRect(JSONIterator& iterator, PP_FloatRect &value) { + const JSON::Token& current = iterator.getCurrentAndGotoNext(); + if (current.isPrimitive() && !current.value().compare("null")) { + return; + } + if (!current.isObject()) { + Fail("Expected object!", ""); + } + iterator.skip(); + FromJSON_PP_FloatPoint(iterator, value.point); + iterator.skip(); + FromJSON_PP_FloatSize(iterator, value.size); +} +const string ToString_PP_Resource(const PP_Resource *v) { + return ToString_int32_t(v); +} +const string ToString_PP_Resource(const PP_Resource &v) { + return ToString_PP_Resource(&v); +} +void FromJSON_PP_Resource(JSONIterator& iterator, PP_Resource &value) { + FromJSON_int32_t(iterator, value); +} +const string ToString_PP_Size(const PP_Size *v) { + if (!v) { + return "null"; + } + return ToString_PP_Size(*v); +} +const string ToString_PP_Size(const PP_Size &v) { + stringstream x; + BeginProps(x); + AddProp(x, "width", ToString_int32_t(v.width)); + AddProp(x, "height", ToString_int32_t(v.height)); + EndProps(x); + return x.str(); +} +void FromJSON_PP_Size(JSONIterator& iterator, PP_Size &value) { + const JSON::Token& current = iterator.getCurrentAndGotoNext(); + if (current.isPrimitive() && !current.value().compare("null")) { + return; + } + if (!current.isObject()) { + Fail("Expected object!", ""); + } + iterator.skip(); + FromJSON_int32_t(iterator, value.width); + iterator.skip(); + FromJSON_int32_t(iterator, value.height); +} +const string ToString_PP_FloatSize(const PP_FloatSize *v) { + if (!v) { + return "null"; + } + return ToString_PP_FloatSize(*v); +} +const string ToString_PP_FloatSize(const PP_FloatSize &v) { + stringstream x; + BeginProps(x); + AddProp(x, "width", ToString_float_t(v.width)); + AddProp(x, "height", ToString_float_t(v.height)); + EndProps(x); + return x.str(); +} +void FromJSON_PP_FloatSize(JSONIterator& iterator, PP_FloatSize &value) { + const JSON::Token& current = iterator.getCurrentAndGotoNext(); + if (current.isPrimitive() && !current.value().compare("null")) { + return; + } + if (!current.isObject()) { + Fail("Expected object!", ""); + } + iterator.skip(); + FromJSON_float_t(iterator, value.width); + iterator.skip(); + FromJSON_float_t(iterator, value.height); +} +const string ToString_PP_Time(const PP_Time *v) { + return ToString_double_t(v); +} +const string ToString_PP_Time(const PP_Time &v) { + return ToString_PP_Time(&v); +} +void FromJSON_PP_Time(JSONIterator& iterator, PP_Time &value) { + FromJSON_double_t(iterator, value); +} +const string ToString_PP_TimeTicks(const PP_TimeTicks *v) { + return ToString_double_t(v); +} +const string ToString_PP_TimeTicks(const PP_TimeTicks &v) { + return ToString_PP_TimeTicks(&v); +} +void FromJSON_PP_TimeTicks(JSONIterator& iterator, PP_TimeTicks &value) { + FromJSON_double_t(iterator, value); +} +const string ToString_PP_TimeDelta(const PP_TimeDelta *v) { + return ToString_double_t(v); +} +const string ToString_PP_TimeDelta(const PP_TimeDelta &v) { + return ToString_PP_TimeDelta(&v); +} +void FromJSON_PP_TimeDelta(JSONIterator& iterator, PP_TimeDelta &value) { + FromJSON_double_t(iterator, value); +} +const string ToString_PP_TouchPoint(const PP_TouchPoint *v) { + if (!v) { + return "null"; + } + return ToString_PP_TouchPoint(*v); +} +const string ToString_PP_TouchPoint(const PP_TouchPoint &v) { + stringstream x; + BeginProps(x); + AddProp(x, "id", ToString_uint32_t(v.id)); + AddProp(x, "position", ToString_PP_FloatPoint(v.position)); + AddProp(x, "radius", ToString_PP_FloatPoint(v.radius)); + AddProp(x, "rotation_angle", ToString_float_t(v.rotation_angle)); + AddProp(x, "pressure", ToString_float_t(v.pressure)); + EndProps(x); + return x.str(); +} +void FromJSON_PP_TouchPoint(JSONIterator& iterator, PP_TouchPoint &value) { + const JSON::Token& current = iterator.getCurrentAndGotoNext(); + if (current.isPrimitive() && !current.value().compare("null")) { + return; + } + if (!current.isObject()) { + Fail("Expected object!", ""); + } + iterator.skip(); + FromJSON_uint32_t(iterator, value.id); + iterator.skip(); + FromJSON_PP_FloatPoint(iterator, value.position); + iterator.skip(); + FromJSON_PP_FloatPoint(iterator, value.radius); + iterator.skip(); + FromJSON_float_t(iterator, value.rotation_angle); + iterator.skip(); + FromJSON_float_t(iterator, value.pressure); +} +const string ToString_PP_VarType(const PP_VarType *v) { + switch (*v) { + case 0: + return "\"PP_VARTYPE_UNDEFINED\""; + case 1: + return "\"PP_VARTYPE_NULL\""; + case 2: + return "\"PP_VARTYPE_BOOL\""; + case 3: + return "\"PP_VARTYPE_INT32\""; + case 4: + return "\"PP_VARTYPE_DOUBLE\""; + case 5: + return "\"PP_VARTYPE_STRING\""; + case 6: + return "\"PP_VARTYPE_OBJECT\""; + case 7: + return "\"PP_VARTYPE_ARRAY\""; + case 8: + return "\"PP_VARTYPE_DICTIONARY\""; + case 9: + return "\"PP_VARTYPE_ARRAY_BUFFER\""; + case 10: + return "\"PP_VARTYPE_RESOURCE\""; + default: + return "\"???\""; + } +} +const string ToString_PP_VarType(const PP_VarType &v) { + return ToString_PP_VarType(&v); +} +void FromJSON_PP_VarType(JSONIterator& iterator, PP_VarType &value) { + long int v; + FromJSON_int(iterator, v); + value = PP_VarType(v); +} +const string ToString_PP_VarValue(const PP_VarValue *v) { + if (!v) { + return "null"; + } + return ToString_PP_VarValue(*v); +} +const string ToString_PP_VarValue(const PP_VarValue &v) { + stringstream x; + BeginProps(x); + AddProp(x, "as_bool", ToString_PP_Bool(v.as_bool)); + AddProp(x, "as_int", ToString_int32_t(v.as_int)); + AddProp(x, "as_double", ToString_double_t(v.as_double)); + AddProp(x, "as_id", ToString_int64_t(v.as_id)); + EndProps(x); + return x.str(); +} +void FromJSON_PP_VarValue(JSONIterator& iterator, PP_VarValue &value) { + const JSON::Token& current = iterator.getCurrentAndGotoNext(); + if (current.isPrimitive() && !current.value().compare("null")) { + return; + } + if (!current.isObject()) { + Fail("Expected object!", ""); + } + string name = iterator.getCurrentStringAndGotoNext().value(); + if (!name.compare("as_bool")) { + FromJSON_PP_Bool(iterator, value.as_bool); + } else if (!name.compare("as_int")) { + FromJSON_int32_t(iterator, value.as_int); + } else if (!name.compare("as_double")) { + FromJSON_double_t(iterator, value.as_double); + } else if (!name.compare("as_id")) { + FromJSON_int64_t(iterator, value.as_id); + } +} +const string ToString_PP_Var(const PP_Var *v) { + if (!v) { + return "null"; + } + return ToString_PP_Var(*v); +} +const string ToString_PP_Var(const PP_Var &v) { + stringstream x; + BeginProps(x); + AddProp(x, "type", ToString_PP_VarType(v.type)); + AddProp(x, "padding", ToString_int32_t(v.padding)); + AddProp(x, "value", ToString_PP_VarValue(v.value)); + EndProps(x); + return x.str(); +} +void FromJSON_PP_Var(JSONIterator& iterator, PP_Var &value) { + const JSON::Token& current = iterator.getCurrentAndGotoNext(); + if (current.isPrimitive() && !current.value().compare("null")) { + return; + } + if (!current.isObject()) { + Fail("Expected object!", ""); + } + iterator.skip(); + FromJSON_PP_VarType(iterator, value.type); + iterator.skip(); + FromJSON_int32_t(iterator, value.padding); + iterator.skip(); + FromJSON_PP_VarValue(iterator, value.value); +} +const string ToString_PPB_GetInterface(const PPB_GetInterface &v) { + return PointerToString(v); +} +void FromJSON_PPB_GetInterface(JSONIterator& iterator, PPB_GetInterface &value) { + PointerValueFromJSON(iterator, value); +} +const string ToString_PPB_Audio_Callback(const PPB_Audio_Callback_1_0 &v) { + return PointerToString(v); +} +void FromJSON_PPB_Audio_Callback(JSONIterator& iterator, PPB_Audio_Callback_1_0 &value) { + PointerValueFromJSON(iterator, value); +} +const string ToString_PPB_Audio_Callback(const PPB_Audio_Callback &v) { + return PointerToString(v); +} +void FromJSON_PPB_Audio_Callback(JSONIterator& iterator, PPB_Audio_Callback &value) { + PointerValueFromJSON(iterator, value); +} +namespace ns_PPB_Audio_1_0 { +static PP_Resource Create_1_0(PP_Instance instance, PP_Resource config, PPB_Audio_Callback_1_0 audio_callback, void* user_data) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Audio\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"Create\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "config", ToString_PP_Resource(config)); + AddProp(ss, "audio_callback", ToString_PPB_Audio_Callback(audio_callback)); + AddProp(ss, "user_data", ToString_mem_t(user_data)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Resource(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + Logging_PPB_Audio_Callback_1_0_holder* audio_callback_holder = new Logging_PPB_Audio_Callback_1_0_holder(); + audio_callback_holder->func = audio_callback; + audio_callback_holder->user_data = user_data; + user_data = audio_callback_holder; + int32_t rval = ((PPB_Audio_1_0*)RealGetInterface("PPB_Audio;1.0"))->Create(instance, config, Logging_PPB_Audio_Callback_1_0, user_data); + printf("RPC response: ["); + printf("%s", ToString_PP_Resource(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool IsAudio_1_0(PP_Resource resource) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Audio\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"IsAudio\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_Audio_1_0*)RealGetInterface("PPB_Audio;1.0"))->IsAudio(resource); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Resource GetCurrentConfig_1_0(PP_Resource audio) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Audio\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"GetCurrentConfig\""); + AddProp(ss, "audio", ToString_PP_Resource(audio)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Resource(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_Audio_1_0*)RealGetInterface("PPB_Audio;1.0"))->GetCurrentConfig(audio); + printf("RPC response: ["); + printf("%s", ToString_PP_Resource(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool StartPlayback_1_0(PP_Resource audio) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Audio\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"StartPlayback\""); + AddProp(ss, "audio", ToString_PP_Resource(audio)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_Audio_1_0*)RealGetInterface("PPB_Audio;1.0"))->StartPlayback(audio); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool StopPlayback_1_0(PP_Resource audio) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Audio\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"StopPlayback\""); + AddProp(ss, "audio", ToString_PP_Resource(audio)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_Audio_1_0*)RealGetInterface("PPB_Audio;1.0"))->StopPlayback(audio); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +} +static PPB_Audio_1_0 _PPB_Audio_1_0 = { + ns_PPB_Audio_1_0::Create_1_0, + ns_PPB_Audio_1_0::IsAudio_1_0, + ns_PPB_Audio_1_0::GetCurrentConfig_1_0, + ns_PPB_Audio_1_0::StartPlayback_1_0, + ns_PPB_Audio_1_0::StopPlayback_1_0, +}; +const string ToString_PPB_Audio(const PPB_Audio_1_0 *v) { + stringstream s; + s << v; + return s.str(); +} +namespace ns_PPB_Audio_1_1 { +static PP_Resource Create_1_1(PP_Instance instance, PP_Resource config, PPB_Audio_Callback audio_callback, void* user_data) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Audio\""); + AddProp(ss, "__version", "\"1.1\""); + AddProp(ss, "__method", "\"Create\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "config", ToString_PP_Resource(config)); + AddProp(ss, "audio_callback", ToString_PPB_Audio_Callback(audio_callback)); + AddProp(ss, "user_data", ToString_mem_t(user_data)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Resource(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_Audio_1_1*)RealGetInterface("PPB_Audio;1.1"))->Create(instance, config, audio_callback, user_data); + printf("RPC response: ["); + printf("%s", ToString_PP_Resource(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool IsAudio_1_1(PP_Resource resource) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Audio\""); + AddProp(ss, "__version", "\"1.1\""); + AddProp(ss, "__method", "\"IsAudio\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_Audio_1_1*)RealGetInterface("PPB_Audio;1.1"))->IsAudio(resource); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Resource GetCurrentConfig_1_1(PP_Resource audio) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Audio\""); + AddProp(ss, "__version", "\"1.1\""); + AddProp(ss, "__method", "\"GetCurrentConfig\""); + AddProp(ss, "audio", ToString_PP_Resource(audio)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Resource(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_Audio_1_1*)RealGetInterface("PPB_Audio;1.1"))->GetCurrentConfig(audio); + printf("RPC response: ["); + printf("%s", ToString_PP_Resource(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool StartPlayback_1_1(PP_Resource audio) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Audio\""); + AddProp(ss, "__version", "\"1.1\""); + AddProp(ss, "__method", "\"StartPlayback\""); + AddProp(ss, "audio", ToString_PP_Resource(audio)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_Audio_1_1*)RealGetInterface("PPB_Audio;1.1"))->StartPlayback(audio); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool StopPlayback_1_1(PP_Resource audio) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Audio\""); + AddProp(ss, "__version", "\"1.1\""); + AddProp(ss, "__method", "\"StopPlayback\""); + AddProp(ss, "audio", ToString_PP_Resource(audio)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_Audio_1_1*)RealGetInterface("PPB_Audio;1.1"))->StopPlayback(audio); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +} +static PPB_Audio_1_1 _PPB_Audio_1_1 = { + ns_PPB_Audio_1_1::Create_1_1, + ns_PPB_Audio_1_1::IsAudio_1_1, + ns_PPB_Audio_1_1::GetCurrentConfig_1_1, + ns_PPB_Audio_1_1::StartPlayback_1_1, + ns_PPB_Audio_1_1::StopPlayback_1_1, +}; +const string ToString_PPB_Audio(const PPB_Audio_1_1 *v) { + stringstream s; + s << v; + return s.str(); +} +const string ToString_PP_AudioBuffer_SampleRate(const PP_AudioBuffer_SampleRate *v) { + switch (*v) { + case 0: + return "\"PP_AUDIOBUFFER_SAMPLERATE_UNKNOWN\""; + case 8000: + return "\"PP_AUDIOBUFFER_SAMPLERATE_8000\""; + case 16000: + return "\"PP_AUDIOBUFFER_SAMPLERATE_16000\""; + case 22050: + return "\"PP_AUDIOBUFFER_SAMPLERATE_22050\""; + case 32000: + return "\"PP_AUDIOBUFFER_SAMPLERATE_32000\""; + case 44100: + return "\"PP_AUDIOBUFFER_SAMPLERATE_44100\""; + case 48000: + return "\"PP_AUDIOBUFFER_SAMPLERATE_48000\""; + case 96000: + return "\"PP_AUDIOBUFFER_SAMPLERATE_96000\""; + case 192000: + return "\"PP_AUDIOBUFFER_SAMPLERATE_192000\""; + default: + return "\"???\""; + } +} +const string ToString_PP_AudioBuffer_SampleRate(const PP_AudioBuffer_SampleRate &v) { + return ToString_PP_AudioBuffer_SampleRate(&v); +} +void FromJSON_PP_AudioBuffer_SampleRate(JSONIterator& iterator, PP_AudioBuffer_SampleRate &value) { + long int v; + FromJSON_int(iterator, v); + value = PP_AudioBuffer_SampleRate(v); +} +const string ToString_PP_AudioBuffer_SampleSize(const PP_AudioBuffer_SampleSize *v) { + switch (*v) { + case 0: + return "\"PP_AUDIOBUFFER_SAMPLESIZE_UNKNOWN\""; + case 2: + return "\"PP_AUDIOBUFFER_SAMPLESIZE_16_BITS\""; + default: + return "\"???\""; + } +} +const string ToString_PP_AudioBuffer_SampleSize(const PP_AudioBuffer_SampleSize &v) { + return ToString_PP_AudioBuffer_SampleSize(&v); +} +void FromJSON_PP_AudioBuffer_SampleSize(JSONIterator& iterator, PP_AudioBuffer_SampleSize &value) { + long int v; + FromJSON_int(iterator, v); + value = PP_AudioBuffer_SampleSize(v); +} +namespace ns_PPB_AudioBuffer_0_1 { +static PP_Bool IsAudioBuffer_0_1(PP_Resource resource) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_AudioBuffer\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"IsAudioBuffer\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_AudioBuffer_0_1*)RealGetInterface("PPB_AudioBuffer;0.1"))->IsAudioBuffer(resource); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_TimeDelta GetTimestamp_0_1(PP_Resource buffer) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_AudioBuffer\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"GetTimestamp\""); + AddProp(ss, "buffer", ToString_PP_Resource(buffer)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + double rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_TimeDelta(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + double rval = ((PPB_AudioBuffer_0_1*)RealGetInterface("PPB_AudioBuffer;0.1"))->GetTimestamp(buffer); + printf("RPC response: ["); + printf("%s", ToString_PP_TimeDelta(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static void SetTimestamp_0_1(PP_Resource buffer, PP_TimeDelta timestamp) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_AudioBuffer\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"SetTimestamp\""); + AddProp(ss, "buffer", ToString_PP_Resource(buffer)); + AddProp(ss, "timestamp", ToString_PP_TimeDelta(timestamp)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_AudioBuffer_0_1*)RealGetInterface("PPB_AudioBuffer;0.1"))->SetTimestamp(buffer, timestamp); +#endif // !INTERPOSE +} +static PP_AudioBuffer_SampleRate GetSampleRate_0_1(PP_Resource buffer) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_AudioBuffer\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"GetSampleRate\""); + AddProp(ss, "buffer", ToString_PP_Resource(buffer)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_AudioBuffer_SampleRate rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_AudioBuffer_SampleRate(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_AudioBuffer_SampleRate rval = ((PPB_AudioBuffer_0_1*)RealGetInterface("PPB_AudioBuffer;0.1"))->GetSampleRate(buffer); + printf("RPC response: ["); + printf("%s", ToString_PP_AudioBuffer_SampleRate(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_AudioBuffer_SampleSize GetSampleSize_0_1(PP_Resource buffer) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_AudioBuffer\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"GetSampleSize\""); + AddProp(ss, "buffer", ToString_PP_Resource(buffer)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_AudioBuffer_SampleSize rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_AudioBuffer_SampleSize(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_AudioBuffer_SampleSize rval = ((PPB_AudioBuffer_0_1*)RealGetInterface("PPB_AudioBuffer;0.1"))->GetSampleSize(buffer); + printf("RPC response: ["); + printf("%s", ToString_PP_AudioBuffer_SampleSize(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static uint32_t GetNumberOfChannels_0_1(PP_Resource buffer) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_AudioBuffer\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"GetNumberOfChannels\""); + AddProp(ss, "buffer", ToString_PP_Resource(buffer)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + uint32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_uint32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + uint32_t rval = ((PPB_AudioBuffer_0_1*)RealGetInterface("PPB_AudioBuffer;0.1"))->GetNumberOfChannels(buffer); + printf("RPC response: ["); + printf("%s", ToString_uint32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static uint32_t GetNumberOfSamples_0_1(PP_Resource buffer) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_AudioBuffer\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"GetNumberOfSamples\""); + AddProp(ss, "buffer", ToString_PP_Resource(buffer)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + uint32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_uint32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + uint32_t rval = ((PPB_AudioBuffer_0_1*)RealGetInterface("PPB_AudioBuffer;0.1"))->GetNumberOfSamples(buffer); + printf("RPC response: ["); + printf("%s", ToString_uint32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static void* GetDataBuffer_0_1(PP_Resource buffer) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_AudioBuffer\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"GetDataBuffer\""); + AddProp(ss, "buffer", ToString_PP_Resource(buffer)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + void* rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_mem_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + void* rval = ((PPB_AudioBuffer_0_1*)RealGetInterface("PPB_AudioBuffer;0.1"))->GetDataBuffer(buffer); + printf("RPC response: ["); + printf("%s", ToString_mem_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static uint32_t GetDataBufferSize_0_1(PP_Resource buffer) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_AudioBuffer\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"GetDataBufferSize\""); + AddProp(ss, "buffer", ToString_PP_Resource(buffer)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + uint32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_uint32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + uint32_t rval = ((PPB_AudioBuffer_0_1*)RealGetInterface("PPB_AudioBuffer;0.1"))->GetDataBufferSize(buffer); + printf("RPC response: ["); + printf("%s", ToString_uint32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +} +static PPB_AudioBuffer_0_1 _PPB_AudioBuffer_0_1 = { + ns_PPB_AudioBuffer_0_1::IsAudioBuffer_0_1, + ns_PPB_AudioBuffer_0_1::GetTimestamp_0_1, + ns_PPB_AudioBuffer_0_1::SetTimestamp_0_1, + ns_PPB_AudioBuffer_0_1::GetSampleRate_0_1, + ns_PPB_AudioBuffer_0_1::GetSampleSize_0_1, + ns_PPB_AudioBuffer_0_1::GetNumberOfChannels_0_1, + ns_PPB_AudioBuffer_0_1::GetNumberOfSamples_0_1, + ns_PPB_AudioBuffer_0_1::GetDataBuffer_0_1, + ns_PPB_AudioBuffer_0_1::GetDataBufferSize_0_1, +}; +const string ToString_PPB_AudioBuffer(const PPB_AudioBuffer_0_1 *v) { + stringstream s; + s << v; + return s.str(); +} +const string ToString_PP_AudioSampleRate(const PP_AudioSampleRate *v) { + switch (*v) { + case 0: + return "\"PP_AUDIOSAMPLERATE_NONE\""; + case 44100: + return "\"PP_AUDIOSAMPLERATE_44100\""; + case 48000: + return "\"PP_AUDIOSAMPLERATE_48000\""; + default: + return "\"???\""; + } +} +const string ToString_PP_AudioSampleRate(const PP_AudioSampleRate &v) { + return ToString_PP_AudioSampleRate(&v); +} +void FromJSON_PP_AudioSampleRate(JSONIterator& iterator, PP_AudioSampleRate &value) { + long int v; + FromJSON_int(iterator, v); + value = PP_AudioSampleRate(v); +} +namespace ns_PPB_AudioConfig_1_0 { +static PP_Resource CreateStereo16Bit_1_0(PP_Instance instance, PP_AudioSampleRate sample_rate, uint32_t sample_frame_count) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_AudioConfig\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"CreateStereo16Bit\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "sample_rate", ToString_PP_AudioSampleRate(sample_rate)); + AddProp(ss, "sample_frame_count", ToString_uint32_t(sample_frame_count)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Resource(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_AudioConfig_1_0*)RealGetInterface("PPB_AudioConfig;1.0"))->CreateStereo16Bit(instance, sample_rate, sample_frame_count); + printf("RPC response: ["); + printf("%s", ToString_PP_Resource(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static uint32_t RecommendSampleFrameCount_1_0(PP_AudioSampleRate sample_rate, uint32_t requested_sample_frame_count) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_AudioConfig\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"RecommendSampleFrameCount\""); + AddProp(ss, "sample_rate", ToString_PP_AudioSampleRate(sample_rate)); + AddProp(ss, "requested_sample_frame_count", ToString_uint32_t(requested_sample_frame_count)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + uint32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_uint32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + uint32_t rval = ((PPB_AudioConfig_1_0*)RealGetInterface("PPB_AudioConfig;1.0"))->RecommendSampleFrameCount(sample_rate, requested_sample_frame_count); + printf("RPC response: ["); + printf("%s", ToString_uint32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +/* skipping RecommendSampleFrameCount */ +static PP_Bool IsAudioConfig_1_0(PP_Resource resource) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_AudioConfig\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"IsAudioConfig\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_AudioConfig_1_0*)RealGetInterface("PPB_AudioConfig;1.0"))->IsAudioConfig(resource); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_AudioSampleRate GetSampleRate_1_0(PP_Resource config) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_AudioConfig\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"GetSampleRate\""); + AddProp(ss, "config", ToString_PP_Resource(config)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_AudioSampleRate rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_AudioSampleRate(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_AudioSampleRate rval = ((PPB_AudioConfig_1_0*)RealGetInterface("PPB_AudioConfig;1.0"))->GetSampleRate(config); + printf("RPC response: ["); + printf("%s", ToString_PP_AudioSampleRate(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static uint32_t GetSampleFrameCount_1_0(PP_Resource config) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_AudioConfig\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"GetSampleFrameCount\""); + AddProp(ss, "config", ToString_PP_Resource(config)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + uint32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_uint32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + uint32_t rval = ((PPB_AudioConfig_1_0*)RealGetInterface("PPB_AudioConfig;1.0"))->GetSampleFrameCount(config); + printf("RPC response: ["); + printf("%s", ToString_uint32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +/* skipping RecommendSampleRate */ +} +static PPB_AudioConfig_1_0 _PPB_AudioConfig_1_0 = { + ns_PPB_AudioConfig_1_0::CreateStereo16Bit_1_0, + ns_PPB_AudioConfig_1_0::RecommendSampleFrameCount_1_0, + ns_PPB_AudioConfig_1_0::IsAudioConfig_1_0, + ns_PPB_AudioConfig_1_0::GetSampleRate_1_0, + ns_PPB_AudioConfig_1_0::GetSampleFrameCount_1_0, +}; +const string ToString_PPB_AudioConfig(const PPB_AudioConfig_1_0 *v) { + stringstream s; + s << v; + return s.str(); +} +namespace ns_PPB_AudioConfig_1_1 { +static PP_Resource CreateStereo16Bit_1_1(PP_Instance instance, PP_AudioSampleRate sample_rate, uint32_t sample_frame_count) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_AudioConfig\""); + AddProp(ss, "__version", "\"1.1\""); + AddProp(ss, "__method", "\"CreateStereo16Bit\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "sample_rate", ToString_PP_AudioSampleRate(sample_rate)); + AddProp(ss, "sample_frame_count", ToString_uint32_t(sample_frame_count)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Resource(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_AudioConfig_1_1*)RealGetInterface("PPB_AudioConfig;1.1"))->CreateStereo16Bit(instance, sample_rate, sample_frame_count); + printf("RPC response: ["); + printf("%s", ToString_PP_Resource(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +/* skipping RecommendSampleFrameCount */ +static uint32_t RecommendSampleFrameCount_1_1(PP_Instance instance, PP_AudioSampleRate sample_rate, uint32_t requested_sample_frame_count) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_AudioConfig\""); + AddProp(ss, "__version", "\"1.1\""); + AddProp(ss, "__method", "\"RecommendSampleFrameCount\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "sample_rate", ToString_PP_AudioSampleRate(sample_rate)); + AddProp(ss, "requested_sample_frame_count", ToString_uint32_t(requested_sample_frame_count)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + uint32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_uint32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + uint32_t rval = ((PPB_AudioConfig_1_1*)RealGetInterface("PPB_AudioConfig;1.1"))->RecommendSampleFrameCount(instance, sample_rate, requested_sample_frame_count); + printf("RPC response: ["); + printf("%s", ToString_uint32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool IsAudioConfig_1_1(PP_Resource resource) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_AudioConfig\""); + AddProp(ss, "__version", "\"1.1\""); + AddProp(ss, "__method", "\"IsAudioConfig\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_AudioConfig_1_1*)RealGetInterface("PPB_AudioConfig;1.1"))->IsAudioConfig(resource); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_AudioSampleRate GetSampleRate_1_1(PP_Resource config) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_AudioConfig\""); + AddProp(ss, "__version", "\"1.1\""); + AddProp(ss, "__method", "\"GetSampleRate\""); + AddProp(ss, "config", ToString_PP_Resource(config)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_AudioSampleRate rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_AudioSampleRate(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_AudioSampleRate rval = ((PPB_AudioConfig_1_1*)RealGetInterface("PPB_AudioConfig;1.1"))->GetSampleRate(config); + printf("RPC response: ["); + printf("%s", ToString_PP_AudioSampleRate(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static uint32_t GetSampleFrameCount_1_1(PP_Resource config) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_AudioConfig\""); + AddProp(ss, "__version", "\"1.1\""); + AddProp(ss, "__method", "\"GetSampleFrameCount\""); + AddProp(ss, "config", ToString_PP_Resource(config)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + uint32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_uint32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + uint32_t rval = ((PPB_AudioConfig_1_1*)RealGetInterface("PPB_AudioConfig;1.1"))->GetSampleFrameCount(config); + printf("RPC response: ["); + printf("%s", ToString_uint32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_AudioSampleRate RecommendSampleRate_1_1(PP_Instance instance) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_AudioConfig\""); + AddProp(ss, "__version", "\"1.1\""); + AddProp(ss, "__method", "\"RecommendSampleRate\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_AudioSampleRate rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_AudioSampleRate(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_AudioSampleRate rval = ((PPB_AudioConfig_1_1*)RealGetInterface("PPB_AudioConfig;1.1"))->RecommendSampleRate(instance); + printf("RPC response: ["); + printf("%s", ToString_PP_AudioSampleRate(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +} +static PPB_AudioConfig_1_1 _PPB_AudioConfig_1_1 = { + ns_PPB_AudioConfig_1_1::CreateStereo16Bit_1_1, + ns_PPB_AudioConfig_1_1::RecommendSampleFrameCount_1_1, + ns_PPB_AudioConfig_1_1::IsAudioConfig_1_1, + ns_PPB_AudioConfig_1_1::GetSampleRate_1_1, + ns_PPB_AudioConfig_1_1::GetSampleFrameCount_1_1, + ns_PPB_AudioConfig_1_1::RecommendSampleRate_1_1, +}; +const string ToString_PPB_AudioConfig(const PPB_AudioConfig_1_1 *v) { + stringstream s; + s << v; + return s.str(); +} +namespace ns_PPB_AudioEncoder_0_1 { +static PP_Resource Create_0_1(PP_Instance instance) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_AudioEncoder\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"Create\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Resource(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_AudioEncoder_0_1*)RealGetInterface("PPB_AudioEncoder;0.1"))->Create(instance); + printf("RPC response: ["); + printf("%s", ToString_PP_Resource(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool IsAudioEncoder_0_1(PP_Resource resource) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_AudioEncoder\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"IsAudioEncoder\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_AudioEncoder_0_1*)RealGetInterface("PPB_AudioEncoder;0.1"))->IsAudioEncoder(resource); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t GetSupportedProfiles_0_1(PP_Resource audio_encoder, struct PP_ArrayOutput output, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_AudioEncoder\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"GetSupportedProfiles\""); + AddProp(ss, "audio_encoder", ToString_PP_Resource(audio_encoder)); + AddProp(ss, "output", ToString_PP_ArrayOutput(output)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_AudioEncoder_0_1*)RealGetInterface("PPB_AudioEncoder;0.1"))->GetSupportedProfiles(audio_encoder, output, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t Initialize_0_1(PP_Resource audio_encoder, uint32_t channels, PP_AudioBuffer_SampleRate input_sample_rate, PP_AudioBuffer_SampleSize input_sample_size, PP_AudioProfile output_profile, uint32_t initial_bitrate, PP_HardwareAcceleration acceleration, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_AudioEncoder\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"Initialize\""); + AddProp(ss, "audio_encoder", ToString_PP_Resource(audio_encoder)); + AddProp(ss, "channels", ToString_uint32_t(channels)); + AddProp(ss, "input_sample_rate", ToString_PP_AudioBuffer_SampleRate(input_sample_rate)); + AddProp(ss, "input_sample_size", ToString_PP_AudioBuffer_SampleSize(input_sample_size)); + AddProp(ss, "output_profile", ToString_PP_AudioProfile(output_profile)); + AddProp(ss, "initial_bitrate", ToString_uint32_t(initial_bitrate)); + AddProp(ss, "acceleration", ToString_PP_HardwareAcceleration(acceleration)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_AudioEncoder_0_1*)RealGetInterface("PPB_AudioEncoder;0.1"))->Initialize(audio_encoder, channels, input_sample_rate, input_sample_size, output_profile, initial_bitrate, acceleration, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t GetNumberOfSamples_0_1(PP_Resource audio_encoder) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_AudioEncoder\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"GetNumberOfSamples\""); + AddProp(ss, "audio_encoder", ToString_PP_Resource(audio_encoder)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_AudioEncoder_0_1*)RealGetInterface("PPB_AudioEncoder;0.1"))->GetNumberOfSamples(audio_encoder); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t GetBuffer_0_1(PP_Resource audio_encoder, PP_Resource* audio_buffer, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_AudioEncoder\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"GetBuffer\""); + AddProp(ss, "audio_encoder", ToString_PP_Resource(audio_encoder)); + AddProp(ss, "audio_buffer", PointerToString(audio_buffer)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + iterator.skip(); + FromJSON_PP_Resource(iterator, *audio_buffer); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_AudioEncoder_0_1*)RealGetInterface("PPB_AudioEncoder;0.1"))->GetBuffer(audio_encoder, audio_buffer, logging_callback); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_int32_t(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + if (!!audio_buffer) { + AddProp(os, "audio_buffer", ToString_PP_Resource(audio_buffer)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t Encode_0_1(PP_Resource audio_encoder, PP_Resource audio_buffer, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_AudioEncoder\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"Encode\""); + AddProp(ss, "audio_encoder", ToString_PP_Resource(audio_encoder)); + AddProp(ss, "audio_buffer", ToString_PP_Resource(audio_buffer)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_AudioEncoder_0_1*)RealGetInterface("PPB_AudioEncoder;0.1"))->Encode(audio_encoder, audio_buffer, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t GetBitstreamBuffer_0_1(PP_Resource audio_encoder, struct PP_AudioBitstreamBuffer* bitstream_buffer, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_AudioEncoder\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"GetBitstreamBuffer\""); + AddProp(ss, "audio_encoder", ToString_PP_Resource(audio_encoder)); + AddProp(ss, "bitstream_buffer", PointerToString(bitstream_buffer)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + if (!!bitstream_buffer) { + iterator.skip(); + FromJSON_PP_AudioBitstreamBuffer(iterator, *bitstream_buffer); + } + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_AudioEncoder_0_1*)RealGetInterface("PPB_AudioEncoder;0.1"))->GetBitstreamBuffer(audio_encoder, bitstream_buffer, logging_callback); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_int32_t(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + if (!!bitstream_buffer) { + AddProp(os, "bitstream_buffer", ToString_PP_AudioBitstreamBuffer(bitstream_buffer)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static void RecycleBitstreamBuffer_0_1(PP_Resource audio_encoder, const struct PP_AudioBitstreamBuffer* bitstream_buffer) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_AudioEncoder\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"RecycleBitstreamBuffer\""); + AddProp(ss, "audio_encoder", ToString_PP_Resource(audio_encoder)); + AddProp(ss, "bitstream_buffer", ToString_PP_AudioBitstreamBuffer(bitstream_buffer)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_AudioEncoder_0_1*)RealGetInterface("PPB_AudioEncoder;0.1"))->RecycleBitstreamBuffer(audio_encoder, bitstream_buffer); +#endif // !INTERPOSE +} +static void RequestBitrateChange_0_1(PP_Resource audio_encoder, uint32_t bitrate) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_AudioEncoder\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"RequestBitrateChange\""); + AddProp(ss, "audio_encoder", ToString_PP_Resource(audio_encoder)); + AddProp(ss, "bitrate", ToString_uint32_t(bitrate)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_AudioEncoder_0_1*)RealGetInterface("PPB_AudioEncoder;0.1"))->RequestBitrateChange(audio_encoder, bitrate); +#endif // !INTERPOSE +} +static void Close_0_1(PP_Resource audio_encoder) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_AudioEncoder\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"Close\""); + AddProp(ss, "audio_encoder", ToString_PP_Resource(audio_encoder)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_AudioEncoder_0_1*)RealGetInterface("PPB_AudioEncoder;0.1"))->Close(audio_encoder); +#endif // !INTERPOSE +} +} +static PPB_AudioEncoder_0_1 _PPB_AudioEncoder_0_1 = { + ns_PPB_AudioEncoder_0_1::Create_0_1, + ns_PPB_AudioEncoder_0_1::IsAudioEncoder_0_1, + ns_PPB_AudioEncoder_0_1::GetSupportedProfiles_0_1, + ns_PPB_AudioEncoder_0_1::Initialize_0_1, + ns_PPB_AudioEncoder_0_1::GetNumberOfSamples_0_1, + ns_PPB_AudioEncoder_0_1::GetBuffer_0_1, + ns_PPB_AudioEncoder_0_1::Encode_0_1, + ns_PPB_AudioEncoder_0_1::GetBitstreamBuffer_0_1, + ns_PPB_AudioEncoder_0_1::RecycleBitstreamBuffer_0_1, + ns_PPB_AudioEncoder_0_1::RequestBitrateChange_0_1, + ns_PPB_AudioEncoder_0_1::Close_0_1, +}; +const string ToString_PPB_AudioEncoder(const PPB_AudioEncoder_0_1 *v) { + stringstream s; + s << v; + return s.str(); +} +namespace ns_PPB_Compositor_0_1 { +static PP_Bool IsCompositor_0_1(PP_Resource resource) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Compositor\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"IsCompositor\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_Compositor_0_1*)RealGetInterface("PPB_Compositor;0.1"))->IsCompositor(resource); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Resource Create_0_1(PP_Instance instance) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Compositor\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"Create\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Resource(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_Compositor_0_1*)RealGetInterface("PPB_Compositor;0.1"))->Create(instance); + printf("RPC response: ["); + printf("%s", ToString_PP_Resource(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Resource AddLayer_0_1(PP_Resource compositor) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Compositor\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"AddLayer\""); + AddProp(ss, "compositor", ToString_PP_Resource(compositor)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Resource(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_Compositor_0_1*)RealGetInterface("PPB_Compositor;0.1"))->AddLayer(compositor); + printf("RPC response: ["); + printf("%s", ToString_PP_Resource(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t CommitLayers_0_1(PP_Resource compositor, struct PP_CompletionCallback cc) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Compositor\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"CommitLayers\""); + AddProp(ss, "compositor", ToString_PP_Resource(compositor)); + AddProp(ss, "cc", ToString_PP_CompletionCallback(cc)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_cc; + logging_cc.func = &Logging_PP_CompletionCallback; + logging_cc.user_data = new PP_CompletionCallback(cc); + logging_cc.flags = cc.flags; + int32_t rval = ((PPB_Compositor_0_1*)RealGetInterface("PPB_Compositor;0.1"))->CommitLayers(compositor, logging_cc); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t ResetLayers_0_1(PP_Resource compositor) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Compositor\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"ResetLayers\""); + AddProp(ss, "compositor", ToString_PP_Resource(compositor)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_Compositor_0_1*)RealGetInterface("PPB_Compositor;0.1"))->ResetLayers(compositor); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +} +static PPB_Compositor_0_1 _PPB_Compositor_0_1 = { + ns_PPB_Compositor_0_1::IsCompositor_0_1, + ns_PPB_Compositor_0_1::Create_0_1, + ns_PPB_Compositor_0_1::AddLayer_0_1, + ns_PPB_Compositor_0_1::CommitLayers_0_1, + ns_PPB_Compositor_0_1::ResetLayers_0_1, +}; +const string ToString_PPB_Compositor(const PPB_Compositor_0_1 *v) { + stringstream s; + s << v; + return s.str(); +} +const string ToString_PP_BlendMode(const PP_BlendMode *v) { + switch (*v) { + case 0: + return "\"PP_BLENDMODE_NONE\""; + case 1: + return "\"PP_BLENDMODE_SRC_OVER\""; + default: + return "\"???\""; + } +} +const string ToString_PP_BlendMode(const PP_BlendMode &v) { + return ToString_PP_BlendMode(&v); +} +void FromJSON_PP_BlendMode(JSONIterator& iterator, PP_BlendMode &value) { + long int v; + FromJSON_int(iterator, v); + value = PP_BlendMode(v); +} +namespace ns_PPB_CompositorLayer_0_1 { +static PP_Bool IsCompositorLayer_0_1(PP_Resource resource) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_CompositorLayer\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"IsCompositorLayer\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_CompositorLayer_0_1*)RealGetInterface("PPB_CompositorLayer;0.1"))->IsCompositorLayer(resource); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t SetColor_0_1(PP_Resource layer, float red, float green, float blue, float alpha, const struct PP_Size* size) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_CompositorLayer\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"SetColor\""); + AddProp(ss, "layer", ToString_PP_Resource(layer)); + AddProp(ss, "red", ToString_float_t(red)); + AddProp(ss, "green", ToString_float_t(green)); + AddProp(ss, "blue", ToString_float_t(blue)); + AddProp(ss, "alpha", ToString_float_t(alpha)); + AddProp(ss, "size", ToString_PP_Size(size)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_CompositorLayer_0_1*)RealGetInterface("PPB_CompositorLayer;0.1"))->SetColor(layer, red, green, blue, alpha, size); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t SetTexture_0_1(PP_Resource layer, PP_Resource context, uint32_t texture, const struct PP_Size* size, struct PP_CompletionCallback cc) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_CompositorLayer\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"SetTexture\""); + AddProp(ss, "layer", ToString_PP_Resource(layer)); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "texture", ToString_uint32_t(texture)); + AddProp(ss, "size", ToString_PP_Size(size)); + AddProp(ss, "cc", ToString_PP_CompletionCallback(cc)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_cc; + logging_cc.func = &Logging_PP_CompletionCallback; + logging_cc.user_data = new PP_CompletionCallback(cc); + logging_cc.flags = cc.flags; + int32_t rval = ((PPB_CompositorLayer_0_1*)RealGetInterface("PPB_CompositorLayer;0.1"))->SetTexture(layer, context, texture, size, logging_cc); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +/* skipping SetTexture */ +static int32_t SetImage_0_1(PP_Resource layer, PP_Resource image_data, const struct PP_Size* size, struct PP_CompletionCallback cc) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_CompositorLayer\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"SetImage\""); + AddProp(ss, "layer", ToString_PP_Resource(layer)); + AddProp(ss, "image_data", ToString_PP_Resource(image_data)); + AddProp(ss, "size", ToString_PP_Size(size)); + AddProp(ss, "cc", ToString_PP_CompletionCallback(cc)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_cc; + logging_cc.func = &Logging_PP_CompletionCallback; + logging_cc.user_data = new PP_CompletionCallback(cc); + logging_cc.flags = cc.flags; + int32_t rval = ((PPB_CompositorLayer_0_1*)RealGetInterface("PPB_CompositorLayer;0.1"))->SetImage(layer, image_data, size, logging_cc); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t SetClipRect_0_1(PP_Resource layer, const struct PP_Rect* rect) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_CompositorLayer\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"SetClipRect\""); + AddProp(ss, "layer", ToString_PP_Resource(layer)); + AddProp(ss, "rect", ToString_PP_Rect(rect)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_CompositorLayer_0_1*)RealGetInterface("PPB_CompositorLayer;0.1"))->SetClipRect(layer, rect); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t SetTransform_0_1(PP_Resource layer, const float matrix[16]) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_CompositorLayer\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"SetTransform\""); + AddProp(ss, "layer", ToString_PP_Resource(layer)); + { + BeginProp(ss, "matrix"); + BeginElements(ss); + for (uint32_t _n = 0; _n < 16; ++_n) { + AddElement(ss, ToString_float_t(matrix[_n])); + } + EndElements(ss); + } + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_CompositorLayer_0_1*)RealGetInterface("PPB_CompositorLayer;0.1"))->SetTransform(layer, matrix); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t SetOpacity_0_1(PP_Resource layer, float opacity) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_CompositorLayer\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"SetOpacity\""); + AddProp(ss, "layer", ToString_PP_Resource(layer)); + AddProp(ss, "opacity", ToString_float_t(opacity)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_CompositorLayer_0_1*)RealGetInterface("PPB_CompositorLayer;0.1"))->SetOpacity(layer, opacity); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t SetBlendMode_0_1(PP_Resource layer, PP_BlendMode mode) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_CompositorLayer\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"SetBlendMode\""); + AddProp(ss, "layer", ToString_PP_Resource(layer)); + AddProp(ss, "mode", ToString_PP_BlendMode(mode)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_CompositorLayer_0_1*)RealGetInterface("PPB_CompositorLayer;0.1"))->SetBlendMode(layer, mode); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t SetSourceRect_0_1(PP_Resource layer, const struct PP_FloatRect* rect) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_CompositorLayer\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"SetSourceRect\""); + AddProp(ss, "layer", ToString_PP_Resource(layer)); + AddProp(ss, "rect", ToString_PP_FloatRect(rect)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_CompositorLayer_0_1*)RealGetInterface("PPB_CompositorLayer;0.1"))->SetSourceRect(layer, rect); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t SetPremultipliedAlpha_0_1(PP_Resource layer, PP_Bool premult) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_CompositorLayer\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"SetPremultipliedAlpha\""); + AddProp(ss, "layer", ToString_PP_Resource(layer)); + AddProp(ss, "premult", ToString_PP_Bool(premult)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_CompositorLayer_0_1*)RealGetInterface("PPB_CompositorLayer;0.1"))->SetPremultipliedAlpha(layer, premult); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +} +static PPB_CompositorLayer_0_1 _PPB_CompositorLayer_0_1 = { + ns_PPB_CompositorLayer_0_1::IsCompositorLayer_0_1, + ns_PPB_CompositorLayer_0_1::SetColor_0_1, + ns_PPB_CompositorLayer_0_1::SetTexture_0_1, + ns_PPB_CompositorLayer_0_1::SetImage_0_1, + ns_PPB_CompositorLayer_0_1::SetClipRect_0_1, + ns_PPB_CompositorLayer_0_1::SetTransform_0_1, + ns_PPB_CompositorLayer_0_1::SetOpacity_0_1, + ns_PPB_CompositorLayer_0_1::SetBlendMode_0_1, + ns_PPB_CompositorLayer_0_1::SetSourceRect_0_1, + ns_PPB_CompositorLayer_0_1::SetPremultipliedAlpha_0_1, +}; +const string ToString_PPB_CompositorLayer(const PPB_CompositorLayer_0_1 *v) { + stringstream s; + s << v; + return s.str(); +} +namespace ns_PPB_CompositorLayer_0_2 { +static PP_Bool IsCompositorLayer_0_2(PP_Resource resource) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_CompositorLayer\""); + AddProp(ss, "__version", "\"0.2\""); + AddProp(ss, "__method", "\"IsCompositorLayer\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_CompositorLayer_0_2*)RealGetInterface("PPB_CompositorLayer;0.2"))->IsCompositorLayer(resource); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t SetColor_0_2(PP_Resource layer, float red, float green, float blue, float alpha, const struct PP_Size* size) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_CompositorLayer\""); + AddProp(ss, "__version", "\"0.2\""); + AddProp(ss, "__method", "\"SetColor\""); + AddProp(ss, "layer", ToString_PP_Resource(layer)); + AddProp(ss, "red", ToString_float_t(red)); + AddProp(ss, "green", ToString_float_t(green)); + AddProp(ss, "blue", ToString_float_t(blue)); + AddProp(ss, "alpha", ToString_float_t(alpha)); + AddProp(ss, "size", ToString_PP_Size(size)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_CompositorLayer_0_2*)RealGetInterface("PPB_CompositorLayer;0.2"))->SetColor(layer, red, green, blue, alpha, size); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +/* skipping SetTexture */ +static int32_t SetTexture_0_2(PP_Resource layer, PP_Resource context, uint32_t target, uint32_t texture, const struct PP_Size* size, struct PP_CompletionCallback cc) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_CompositorLayer\""); + AddProp(ss, "__version", "\"0.2\""); + AddProp(ss, "__method", "\"SetTexture\""); + AddProp(ss, "layer", ToString_PP_Resource(layer)); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "target", ToString_uint32_t(target)); + AddProp(ss, "texture", ToString_uint32_t(texture)); + AddProp(ss, "size", ToString_PP_Size(size)); + AddProp(ss, "cc", ToString_PP_CompletionCallback(cc)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_cc; + logging_cc.func = &Logging_PP_CompletionCallback; + logging_cc.user_data = new PP_CompletionCallback(cc); + logging_cc.flags = cc.flags; + int32_t rval = ((PPB_CompositorLayer_0_2*)RealGetInterface("PPB_CompositorLayer;0.2"))->SetTexture(layer, context, target, texture, size, logging_cc); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t SetImage_0_2(PP_Resource layer, PP_Resource image_data, const struct PP_Size* size, struct PP_CompletionCallback cc) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_CompositorLayer\""); + AddProp(ss, "__version", "\"0.2\""); + AddProp(ss, "__method", "\"SetImage\""); + AddProp(ss, "layer", ToString_PP_Resource(layer)); + AddProp(ss, "image_data", ToString_PP_Resource(image_data)); + AddProp(ss, "size", ToString_PP_Size(size)); + AddProp(ss, "cc", ToString_PP_CompletionCallback(cc)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_cc; + logging_cc.func = &Logging_PP_CompletionCallback; + logging_cc.user_data = new PP_CompletionCallback(cc); + logging_cc.flags = cc.flags; + int32_t rval = ((PPB_CompositorLayer_0_2*)RealGetInterface("PPB_CompositorLayer;0.2"))->SetImage(layer, image_data, size, logging_cc); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t SetClipRect_0_2(PP_Resource layer, const struct PP_Rect* rect) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_CompositorLayer\""); + AddProp(ss, "__version", "\"0.2\""); + AddProp(ss, "__method", "\"SetClipRect\""); + AddProp(ss, "layer", ToString_PP_Resource(layer)); + AddProp(ss, "rect", ToString_PP_Rect(rect)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_CompositorLayer_0_2*)RealGetInterface("PPB_CompositorLayer;0.2"))->SetClipRect(layer, rect); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t SetTransform_0_2(PP_Resource layer, const float matrix[16]) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_CompositorLayer\""); + AddProp(ss, "__version", "\"0.2\""); + AddProp(ss, "__method", "\"SetTransform\""); + AddProp(ss, "layer", ToString_PP_Resource(layer)); + { + BeginProp(ss, "matrix"); + BeginElements(ss); + for (uint32_t _n = 0; _n < 16; ++_n) { + AddElement(ss, ToString_float_t(matrix[_n])); + } + EndElements(ss); + } + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_CompositorLayer_0_2*)RealGetInterface("PPB_CompositorLayer;0.2"))->SetTransform(layer, matrix); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t SetOpacity_0_2(PP_Resource layer, float opacity) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_CompositorLayer\""); + AddProp(ss, "__version", "\"0.2\""); + AddProp(ss, "__method", "\"SetOpacity\""); + AddProp(ss, "layer", ToString_PP_Resource(layer)); + AddProp(ss, "opacity", ToString_float_t(opacity)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_CompositorLayer_0_2*)RealGetInterface("PPB_CompositorLayer;0.2"))->SetOpacity(layer, opacity); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t SetBlendMode_0_2(PP_Resource layer, PP_BlendMode mode) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_CompositorLayer\""); + AddProp(ss, "__version", "\"0.2\""); + AddProp(ss, "__method", "\"SetBlendMode\""); + AddProp(ss, "layer", ToString_PP_Resource(layer)); + AddProp(ss, "mode", ToString_PP_BlendMode(mode)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_CompositorLayer_0_2*)RealGetInterface("PPB_CompositorLayer;0.2"))->SetBlendMode(layer, mode); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t SetSourceRect_0_2(PP_Resource layer, const struct PP_FloatRect* rect) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_CompositorLayer\""); + AddProp(ss, "__version", "\"0.2\""); + AddProp(ss, "__method", "\"SetSourceRect\""); + AddProp(ss, "layer", ToString_PP_Resource(layer)); + AddProp(ss, "rect", ToString_PP_FloatRect(rect)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_CompositorLayer_0_2*)RealGetInterface("PPB_CompositorLayer;0.2"))->SetSourceRect(layer, rect); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t SetPremultipliedAlpha_0_2(PP_Resource layer, PP_Bool premult) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_CompositorLayer\""); + AddProp(ss, "__version", "\"0.2\""); + AddProp(ss, "__method", "\"SetPremultipliedAlpha\""); + AddProp(ss, "layer", ToString_PP_Resource(layer)); + AddProp(ss, "premult", ToString_PP_Bool(premult)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_CompositorLayer_0_2*)RealGetInterface("PPB_CompositorLayer;0.2"))->SetPremultipliedAlpha(layer, premult); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +} +static PPB_CompositorLayer_0_2 _PPB_CompositorLayer_0_2 = { + ns_PPB_CompositorLayer_0_2::IsCompositorLayer_0_2, + ns_PPB_CompositorLayer_0_2::SetColor_0_2, + ns_PPB_CompositorLayer_0_2::SetTexture_0_2, + ns_PPB_CompositorLayer_0_2::SetImage_0_2, + ns_PPB_CompositorLayer_0_2::SetClipRect_0_2, + ns_PPB_CompositorLayer_0_2::SetTransform_0_2, + ns_PPB_CompositorLayer_0_2::SetOpacity_0_2, + ns_PPB_CompositorLayer_0_2::SetBlendMode_0_2, + ns_PPB_CompositorLayer_0_2::SetSourceRect_0_2, + ns_PPB_CompositorLayer_0_2::SetPremultipliedAlpha_0_2, +}; +const string ToString_PPB_CompositorLayer(const PPB_CompositorLayer_0_2 *v) { + stringstream s; + s << v; + return s.str(); +} +const string ToString_PP_LogLevel(const PP_LogLevel *v) { + switch (*v) { + case 0: + return "\"PP_LOGLEVEL_TIP\""; + case 1: + return "\"PP_LOGLEVEL_LOG\""; + case 2: + return "\"PP_LOGLEVEL_WARNING\""; + case 3: + return "\"PP_LOGLEVEL_ERROR\""; + default: + return "\"???\""; + } +} +const string ToString_PP_LogLevel(const PP_LogLevel &v) { + return ToString_PP_LogLevel(&v); +} +void FromJSON_PP_LogLevel(JSONIterator& iterator, PP_LogLevel &value) { + long int v; + FromJSON_int(iterator, v); + value = PP_LogLevel(v); +} +namespace ns_PPB_Console_1_0 { +static void Log_1_0(PP_Instance instance, PP_LogLevel level, struct PP_Var value) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Console\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"Log\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "level", ToString_PP_LogLevel(level)); + AddProp(ss, "value", ToString_PP_Var(value)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_Console_1_0*)RealGetInterface("PPB_Console;1.0"))->Log(instance, level, value); +#endif // !INTERPOSE +} +static void LogWithSource_1_0(PP_Instance instance, PP_LogLevel level, struct PP_Var source, struct PP_Var value) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Console\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"LogWithSource\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "level", ToString_PP_LogLevel(level)); + AddProp(ss, "source", ToString_PP_Var(source)); + AddProp(ss, "value", ToString_PP_Var(value)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_Console_1_0*)RealGetInterface("PPB_Console;1.0"))->LogWithSource(instance, level, source, value); +#endif // !INTERPOSE +} +} +static PPB_Console_1_0 _PPB_Console_1_0 = { + ns_PPB_Console_1_0::Log_1_0, + ns_PPB_Console_1_0::LogWithSource_1_0, +}; +const string ToString_PPB_Console(const PPB_Console_1_0 *v) { + stringstream s; + s << v; + return s.str(); +} +namespace ns_PPB_Core_1_0 { +static void AddRefResource_1_0(PP_Resource resource) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Core\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"AddRefResource\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_Core_1_0*)RealGetInterface("PPB_Core;1.0"))->AddRefResource(resource); +#endif // !INTERPOSE +} +static void ReleaseResource_1_0(PP_Resource resource) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Core\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"ReleaseResource\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_Core_1_0*)RealGetInterface("PPB_Core;1.0"))->ReleaseResource(resource); +#endif // !INTERPOSE +} +static PP_Time GetTime_1_0(void) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Core\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"GetTime\""); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + double rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Time(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + double rval = ((PPB_Core_1_0*)RealGetInterface("PPB_Core;1.0"))->GetTime(); + printf("RPC response: ["); + printf("%s", ToString_PP_Time(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_TimeTicks GetTimeTicks_1_0(void) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Core\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"GetTimeTicks\""); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + double rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_TimeTicks(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + double rval = ((PPB_Core_1_0*)RealGetInterface("PPB_Core;1.0"))->GetTimeTicks(); + printf("RPC response: ["); + printf("%s", ToString_PP_TimeTicks(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static void CallOnMainThread_1_0(int32_t delay_in_milliseconds, struct PP_CompletionCallback callback, int32_t result) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Core\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"CallOnMainThread\""); + AddProp(ss, "delay_in_milliseconds", ToString_int32_t(delay_in_milliseconds)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + AddProp(ss, "result", ToString_int32_t(result)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + ((PPB_Core_1_0*)RealGetInterface("PPB_Core;1.0"))->CallOnMainThread(delay_in_milliseconds, logging_callback, result); +#endif // !INTERPOSE +} +static PP_Bool IsMainThread_1_0(void) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Core\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"IsMainThread\""); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_Core_1_0*)RealGetInterface("PPB_Core;1.0"))->IsMainThread(); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +} +static PPB_Core_1_0 _PPB_Core_1_0 = { + ns_PPB_Core_1_0::AddRefResource_1_0, + ns_PPB_Core_1_0::ReleaseResource_1_0, + ns_PPB_Core_1_0::GetTime_1_0, + ns_PPB_Core_1_0::GetTimeTicks_1_0, + ns_PPB_Core_1_0::CallOnMainThread_1_0, + ns_PPB_Core_1_0::IsMainThread_1_0, +}; +const string ToString_PPB_Core(const PPB_Core_1_0 *v) { + stringstream s; + s << v; + return s.str(); +} +const string ToString_PP_FileOpenFlags(const PP_FileOpenFlags *v) { + switch (*v) { + case 1 << 0: + return "\"PP_FILEOPENFLAG_READ\""; + case 1 << 1: + return "\"PP_FILEOPENFLAG_WRITE\""; + case 1 << 2: + return "\"PP_FILEOPENFLAG_CREATE\""; + case 1 << 3: + return "\"PP_FILEOPENFLAG_TRUNCATE\""; + case 1 << 4: + return "\"PP_FILEOPENFLAG_EXCLUSIVE\""; + case 1 << 5: + return "\"PP_FILEOPENFLAG_APPEND\""; + default: + return "\"???\""; + } +} +const string ToString_PP_FileOpenFlags(const PP_FileOpenFlags &v) { + return ToString_PP_FileOpenFlags(&v); +} +void FromJSON_PP_FileOpenFlags(JSONIterator& iterator, PP_FileOpenFlags &value) { + long int v; + FromJSON_int(iterator, v); + value = PP_FileOpenFlags(v); +} +namespace ns_PPB_FileIO_1_0 { +static PP_Resource Create_1_0(PP_Instance instance) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_FileIO\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"Create\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Resource(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_FileIO_1_0*)RealGetInterface("PPB_FileIO;1.0"))->Create(instance); + printf("RPC response: ["); + printf("%s", ToString_PP_Resource(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool IsFileIO_1_0(PP_Resource resource) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_FileIO\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"IsFileIO\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_FileIO_1_0*)RealGetInterface("PPB_FileIO;1.0"))->IsFileIO(resource); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t Open_1_0(PP_Resource file_io, PP_Resource file_ref, int32_t open_flags, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_FileIO\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"Open\""); + AddProp(ss, "file_io", ToString_PP_Resource(file_io)); + AddProp(ss, "file_ref", ToString_PP_Resource(file_ref)); + AddProp(ss, "open_flags", ToString_int32_t(open_flags)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_FileIO_1_0*)RealGetInterface("PPB_FileIO;1.0"))->Open(file_io, file_ref, open_flags, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t Query_1_0(PP_Resource file_io, struct PP_FileInfo* info, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_FileIO\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"Query\""); + AddProp(ss, "file_io", ToString_PP_Resource(file_io)); + AddProp(ss, "info", PointerToString(info)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + if (!!info) { + iterator.skip(); + FromJSON_PP_FileInfo(iterator, *info); + } + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_FileIO_1_0*)RealGetInterface("PPB_FileIO;1.0"))->Query(file_io, info, logging_callback); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_int32_t(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + if (!!info) { + AddProp(os, "info", ToString_PP_FileInfo(info)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t Touch_1_0(PP_Resource file_io, PP_Time last_access_time, PP_Time last_modified_time, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_FileIO\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"Touch\""); + AddProp(ss, "file_io", ToString_PP_Resource(file_io)); + AddProp(ss, "last_access_time", ToString_PP_Time(last_access_time)); + AddProp(ss, "last_modified_time", ToString_PP_Time(last_modified_time)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_FileIO_1_0*)RealGetInterface("PPB_FileIO;1.0"))->Touch(file_io, last_access_time, last_modified_time, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t Read_1_0(PP_Resource file_io, int64_t offset, char* buffer, int32_t bytes_to_read, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_FileIO\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"Read\""); + AddProp(ss, "file_io", ToString_PP_Resource(file_io)); + AddProp(ss, "offset", ToString_int64_t(offset)); + AddProp(ss, "buffer", ToString_str_t(buffer)); + AddProp(ss, "bytes_to_read", ToString_int32_t(bytes_to_read)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + iterator.skip(); + FromJSON_str_t(iterator, buffer); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_FileIO_1_0*)RealGetInterface("PPB_FileIO;1.0"))->Read(file_io, offset, buffer, bytes_to_read, logging_callback); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_int32_t(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + AddProp(os, "buffer", ToString_str_t(buffer)); + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t Write_1_0(PP_Resource file_io, int64_t offset, const char* buffer, int32_t bytes_to_write, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_FileIO\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"Write\""); + AddProp(ss, "file_io", ToString_PP_Resource(file_io)); + AddProp(ss, "offset", ToString_int64_t(offset)); + AddProp(ss, "buffer", ToString_str_t(buffer)); + AddProp(ss, "bytes_to_write", ToString_int32_t(bytes_to_write)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_FileIO_1_0*)RealGetInterface("PPB_FileIO;1.0"))->Write(file_io, offset, buffer, bytes_to_write, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t SetLength_1_0(PP_Resource file_io, int64_t length, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_FileIO\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"SetLength\""); + AddProp(ss, "file_io", ToString_PP_Resource(file_io)); + AddProp(ss, "length", ToString_int64_t(length)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_FileIO_1_0*)RealGetInterface("PPB_FileIO;1.0"))->SetLength(file_io, length, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t Flush_1_0(PP_Resource file_io, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_FileIO\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"Flush\""); + AddProp(ss, "file_io", ToString_PP_Resource(file_io)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_FileIO_1_0*)RealGetInterface("PPB_FileIO;1.0"))->Flush(file_io, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static void Close_1_0(PP_Resource file_io) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_FileIO\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"Close\""); + AddProp(ss, "file_io", ToString_PP_Resource(file_io)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_FileIO_1_0*)RealGetInterface("PPB_FileIO;1.0"))->Close(file_io); +#endif // !INTERPOSE +} +/* skipping ReadToArray */ +} +static PPB_FileIO_1_0 _PPB_FileIO_1_0 = { + ns_PPB_FileIO_1_0::Create_1_0, + ns_PPB_FileIO_1_0::IsFileIO_1_0, + ns_PPB_FileIO_1_0::Open_1_0, + ns_PPB_FileIO_1_0::Query_1_0, + ns_PPB_FileIO_1_0::Touch_1_0, + ns_PPB_FileIO_1_0::Read_1_0, + ns_PPB_FileIO_1_0::Write_1_0, + ns_PPB_FileIO_1_0::SetLength_1_0, + ns_PPB_FileIO_1_0::Flush_1_0, + ns_PPB_FileIO_1_0::Close_1_0, +}; +const string ToString_PPB_FileIO(const PPB_FileIO_1_0 *v) { + stringstream s; + s << v; + return s.str(); +} +namespace ns_PPB_FileIO_1_1 { +static PP_Resource Create_1_1(PP_Instance instance) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_FileIO\""); + AddProp(ss, "__version", "\"1.1\""); + AddProp(ss, "__method", "\"Create\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Resource(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_FileIO_1_1*)RealGetInterface("PPB_FileIO;1.1"))->Create(instance); + printf("RPC response: ["); + printf("%s", ToString_PP_Resource(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool IsFileIO_1_1(PP_Resource resource) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_FileIO\""); + AddProp(ss, "__version", "\"1.1\""); + AddProp(ss, "__method", "\"IsFileIO\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_FileIO_1_1*)RealGetInterface("PPB_FileIO;1.1"))->IsFileIO(resource); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t Open_1_1(PP_Resource file_io, PP_Resource file_ref, int32_t open_flags, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_FileIO\""); + AddProp(ss, "__version", "\"1.1\""); + AddProp(ss, "__method", "\"Open\""); + AddProp(ss, "file_io", ToString_PP_Resource(file_io)); + AddProp(ss, "file_ref", ToString_PP_Resource(file_ref)); + AddProp(ss, "open_flags", ToString_int32_t(open_flags)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_FileIO_1_1*)RealGetInterface("PPB_FileIO;1.1"))->Open(file_io, file_ref, open_flags, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t Query_1_1(PP_Resource file_io, struct PP_FileInfo* info, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_FileIO\""); + AddProp(ss, "__version", "\"1.1\""); + AddProp(ss, "__method", "\"Query\""); + AddProp(ss, "file_io", ToString_PP_Resource(file_io)); + AddProp(ss, "info", PointerToString(info)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + if (!!info) { + iterator.skip(); + FromJSON_PP_FileInfo(iterator, *info); + } + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_FileIO_1_1*)RealGetInterface("PPB_FileIO;1.1"))->Query(file_io, info, logging_callback); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_int32_t(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + if (!!info) { + AddProp(os, "info", ToString_PP_FileInfo(info)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t Touch_1_1(PP_Resource file_io, PP_Time last_access_time, PP_Time last_modified_time, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_FileIO\""); + AddProp(ss, "__version", "\"1.1\""); + AddProp(ss, "__method", "\"Touch\""); + AddProp(ss, "file_io", ToString_PP_Resource(file_io)); + AddProp(ss, "last_access_time", ToString_PP_Time(last_access_time)); + AddProp(ss, "last_modified_time", ToString_PP_Time(last_modified_time)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_FileIO_1_1*)RealGetInterface("PPB_FileIO;1.1"))->Touch(file_io, last_access_time, last_modified_time, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t Read_1_1(PP_Resource file_io, int64_t offset, char* buffer, int32_t bytes_to_read, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_FileIO\""); + AddProp(ss, "__version", "\"1.1\""); + AddProp(ss, "__method", "\"Read\""); + AddProp(ss, "file_io", ToString_PP_Resource(file_io)); + AddProp(ss, "offset", ToString_int64_t(offset)); + AddProp(ss, "buffer", ToString_str_t(buffer)); + AddProp(ss, "bytes_to_read", ToString_int32_t(bytes_to_read)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + iterator.skip(); + FromJSON_str_t(iterator, buffer); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_FileIO_1_1*)RealGetInterface("PPB_FileIO;1.1"))->Read(file_io, offset, buffer, bytes_to_read, logging_callback); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_int32_t(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + AddProp(os, "buffer", ToString_str_t(buffer)); + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t Write_1_1(PP_Resource file_io, int64_t offset, const char* buffer, int32_t bytes_to_write, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_FileIO\""); + AddProp(ss, "__version", "\"1.1\""); + AddProp(ss, "__method", "\"Write\""); + AddProp(ss, "file_io", ToString_PP_Resource(file_io)); + AddProp(ss, "offset", ToString_int64_t(offset)); + AddProp(ss, "buffer", ToString_str_t(buffer)); + AddProp(ss, "bytes_to_write", ToString_int32_t(bytes_to_write)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_FileIO_1_1*)RealGetInterface("PPB_FileIO;1.1"))->Write(file_io, offset, buffer, bytes_to_write, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t SetLength_1_1(PP_Resource file_io, int64_t length, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_FileIO\""); + AddProp(ss, "__version", "\"1.1\""); + AddProp(ss, "__method", "\"SetLength\""); + AddProp(ss, "file_io", ToString_PP_Resource(file_io)); + AddProp(ss, "length", ToString_int64_t(length)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_FileIO_1_1*)RealGetInterface("PPB_FileIO;1.1"))->SetLength(file_io, length, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t Flush_1_1(PP_Resource file_io, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_FileIO\""); + AddProp(ss, "__version", "\"1.1\""); + AddProp(ss, "__method", "\"Flush\""); + AddProp(ss, "file_io", ToString_PP_Resource(file_io)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_FileIO_1_1*)RealGetInterface("PPB_FileIO;1.1"))->Flush(file_io, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static void Close_1_1(PP_Resource file_io) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_FileIO\""); + AddProp(ss, "__version", "\"1.1\""); + AddProp(ss, "__method", "\"Close\""); + AddProp(ss, "file_io", ToString_PP_Resource(file_io)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_FileIO_1_1*)RealGetInterface("PPB_FileIO;1.1"))->Close(file_io); +#endif // !INTERPOSE +} +static int32_t ReadToArray_1_1(PP_Resource file_io, int64_t offset, int32_t max_read_length, struct PP_ArrayOutput* output, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_FileIO\""); + AddProp(ss, "__version", "\"1.1\""); + AddProp(ss, "__method", "\"ReadToArray\""); + AddProp(ss, "file_io", ToString_PP_Resource(file_io)); + AddProp(ss, "offset", ToString_int64_t(offset)); + AddProp(ss, "max_read_length", ToString_int32_t(max_read_length)); + AddProp(ss, "output", ToString_PP_ArrayOutput(output)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + iterator.skip(); + FromJSON_PP_ArrayOutput(iterator, *output); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_FileIO_1_1*)RealGetInterface("PPB_FileIO;1.1"))->ReadToArray(file_io, offset, max_read_length, output, logging_callback); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_int32_t(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + AddProp(os, "output", ToString_PP_ArrayOutput(output)); + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +} +static PPB_FileIO_1_1 _PPB_FileIO_1_1 = { + ns_PPB_FileIO_1_1::Create_1_1, + ns_PPB_FileIO_1_1::IsFileIO_1_1, + ns_PPB_FileIO_1_1::Open_1_1, + ns_PPB_FileIO_1_1::Query_1_1, + ns_PPB_FileIO_1_1::Touch_1_1, + ns_PPB_FileIO_1_1::Read_1_1, + ns_PPB_FileIO_1_1::Write_1_1, + ns_PPB_FileIO_1_1::SetLength_1_1, + ns_PPB_FileIO_1_1::Flush_1_1, + ns_PPB_FileIO_1_1::Close_1_1, + ns_PPB_FileIO_1_1::ReadToArray_1_1, +}; +const string ToString_PPB_FileIO(const PPB_FileIO_1_1 *v) { + stringstream s; + s << v; + return s.str(); +} +const string ToString_PP_MakeDirectoryFlags(const PP_MakeDirectoryFlags *v) { + switch (*v) { + case 0 << 0: + return "\"PP_MAKEDIRECTORYFLAG_NONE\""; + case 1 << 0: + return "\"PP_MAKEDIRECTORYFLAG_WITH_ANCESTORS\""; + case 1 << 1: + return "\"PP_MAKEDIRECTORYFLAG_EXCLUSIVE\""; + default: + return "\"???\""; + } +} +const string ToString_PP_MakeDirectoryFlags(const PP_MakeDirectoryFlags &v) { + return ToString_PP_MakeDirectoryFlags(&v); +} +void FromJSON_PP_MakeDirectoryFlags(JSONIterator& iterator, PP_MakeDirectoryFlags &value) { + long int v; + FromJSON_int(iterator, v); + value = PP_MakeDirectoryFlags(v); +} +namespace ns_PPB_FileRef_1_0 { +static PP_Resource Create_1_0(PP_Resource file_system, const char* path) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_FileRef\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"Create\""); + AddProp(ss, "file_system", ToString_PP_Resource(file_system)); + AddProp(ss, "path", ToString_str_t(path)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Resource(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_FileRef_1_0*)RealGetInterface("PPB_FileRef;1.0"))->Create(file_system, path); + printf("RPC response: ["); + printf("%s", ToString_PP_Resource(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool IsFileRef_1_0(PP_Resource resource) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_FileRef\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"IsFileRef\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_FileRef_1_0*)RealGetInterface("PPB_FileRef;1.0"))->IsFileRef(resource); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_FileSystemType GetFileSystemType_1_0(PP_Resource file_ref) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_FileRef\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"GetFileSystemType\""); + AddProp(ss, "file_ref", ToString_PP_Resource(file_ref)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_FileSystemType rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_FileSystemType(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_FileSystemType rval = ((PPB_FileRef_1_0*)RealGetInterface("PPB_FileRef;1.0"))->GetFileSystemType(file_ref); + printf("RPC response: ["); + printf("%s", ToString_PP_FileSystemType(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static struct PP_Var GetName_1_0(PP_Resource file_ref) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_FileRef\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"GetName\""); + AddProp(ss, "file_ref", ToString_PP_Resource(file_ref)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + struct PP_Var rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Var(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + struct PP_Var rval = ((PPB_FileRef_1_0*)RealGetInterface("PPB_FileRef;1.0"))->GetName(file_ref); + printf("RPC response: ["); + printf("%s", ToString_PP_Var(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static struct PP_Var GetPath_1_0(PP_Resource file_ref) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_FileRef\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"GetPath\""); + AddProp(ss, "file_ref", ToString_PP_Resource(file_ref)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + struct PP_Var rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Var(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + struct PP_Var rval = ((PPB_FileRef_1_0*)RealGetInterface("PPB_FileRef;1.0"))->GetPath(file_ref); + printf("RPC response: ["); + printf("%s", ToString_PP_Var(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Resource GetParent_1_0(PP_Resource file_ref) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_FileRef\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"GetParent\""); + AddProp(ss, "file_ref", ToString_PP_Resource(file_ref)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Resource(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_FileRef_1_0*)RealGetInterface("PPB_FileRef;1.0"))->GetParent(file_ref); + printf("RPC response: ["); + printf("%s", ToString_PP_Resource(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t MakeDirectory_1_0(PP_Resource directory_ref, PP_Bool make_ancestors, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_FileRef\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"MakeDirectory\""); + AddProp(ss, "directory_ref", ToString_PP_Resource(directory_ref)); + AddProp(ss, "make_ancestors", ToString_PP_Bool(make_ancestors)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_FileRef_1_0*)RealGetInterface("PPB_FileRef;1.0"))->MakeDirectory(directory_ref, make_ancestors, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +/* skipping MakeDirectory */ +static int32_t Touch_1_0(PP_Resource file_ref, PP_Time last_access_time, PP_Time last_modified_time, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_FileRef\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"Touch\""); + AddProp(ss, "file_ref", ToString_PP_Resource(file_ref)); + AddProp(ss, "last_access_time", ToString_PP_Time(last_access_time)); + AddProp(ss, "last_modified_time", ToString_PP_Time(last_modified_time)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_FileRef_1_0*)RealGetInterface("PPB_FileRef;1.0"))->Touch(file_ref, last_access_time, last_modified_time, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t Delete_1_0(PP_Resource file_ref, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_FileRef\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"Delete\""); + AddProp(ss, "file_ref", ToString_PP_Resource(file_ref)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_FileRef_1_0*)RealGetInterface("PPB_FileRef;1.0"))->Delete(file_ref, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t Rename_1_0(PP_Resource file_ref, PP_Resource new_file_ref, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_FileRef\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"Rename\""); + AddProp(ss, "file_ref", ToString_PP_Resource(file_ref)); + AddProp(ss, "new_file_ref", ToString_PP_Resource(new_file_ref)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_FileRef_1_0*)RealGetInterface("PPB_FileRef;1.0"))->Rename(file_ref, new_file_ref, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +/* skipping Query */ +/* skipping ReadDirectoryEntries */ +} +static PPB_FileRef_1_0 _PPB_FileRef_1_0 = { + ns_PPB_FileRef_1_0::Create_1_0, + ns_PPB_FileRef_1_0::IsFileRef_1_0, + ns_PPB_FileRef_1_0::GetFileSystemType_1_0, + ns_PPB_FileRef_1_0::GetName_1_0, + ns_PPB_FileRef_1_0::GetPath_1_0, + ns_PPB_FileRef_1_0::GetParent_1_0, + ns_PPB_FileRef_1_0::MakeDirectory_1_0, + ns_PPB_FileRef_1_0::Touch_1_0, + ns_PPB_FileRef_1_0::Delete_1_0, + ns_PPB_FileRef_1_0::Rename_1_0, +}; +const string ToString_PPB_FileRef(const PPB_FileRef_1_0 *v) { + stringstream s; + s << v; + return s.str(); +} +namespace ns_PPB_FileRef_1_1 { +static PP_Resource Create_1_1(PP_Resource file_system, const char* path) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_FileRef\""); + AddProp(ss, "__version", "\"1.1\""); + AddProp(ss, "__method", "\"Create\""); + AddProp(ss, "file_system", ToString_PP_Resource(file_system)); + AddProp(ss, "path", ToString_str_t(path)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Resource(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_FileRef_1_1*)RealGetInterface("PPB_FileRef;1.1"))->Create(file_system, path); + printf("RPC response: ["); + printf("%s", ToString_PP_Resource(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool IsFileRef_1_1(PP_Resource resource) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_FileRef\""); + AddProp(ss, "__version", "\"1.1\""); + AddProp(ss, "__method", "\"IsFileRef\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_FileRef_1_1*)RealGetInterface("PPB_FileRef;1.1"))->IsFileRef(resource); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_FileSystemType GetFileSystemType_1_1(PP_Resource file_ref) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_FileRef\""); + AddProp(ss, "__version", "\"1.1\""); + AddProp(ss, "__method", "\"GetFileSystemType\""); + AddProp(ss, "file_ref", ToString_PP_Resource(file_ref)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_FileSystemType rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_FileSystemType(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_FileSystemType rval = ((PPB_FileRef_1_1*)RealGetInterface("PPB_FileRef;1.1"))->GetFileSystemType(file_ref); + printf("RPC response: ["); + printf("%s", ToString_PP_FileSystemType(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static struct PP_Var GetName_1_1(PP_Resource file_ref) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_FileRef\""); + AddProp(ss, "__version", "\"1.1\""); + AddProp(ss, "__method", "\"GetName\""); + AddProp(ss, "file_ref", ToString_PP_Resource(file_ref)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + struct PP_Var rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Var(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + struct PP_Var rval = ((PPB_FileRef_1_1*)RealGetInterface("PPB_FileRef;1.1"))->GetName(file_ref); + printf("RPC response: ["); + printf("%s", ToString_PP_Var(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static struct PP_Var GetPath_1_1(PP_Resource file_ref) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_FileRef\""); + AddProp(ss, "__version", "\"1.1\""); + AddProp(ss, "__method", "\"GetPath\""); + AddProp(ss, "file_ref", ToString_PP_Resource(file_ref)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + struct PP_Var rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Var(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + struct PP_Var rval = ((PPB_FileRef_1_1*)RealGetInterface("PPB_FileRef;1.1"))->GetPath(file_ref); + printf("RPC response: ["); + printf("%s", ToString_PP_Var(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Resource GetParent_1_1(PP_Resource file_ref) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_FileRef\""); + AddProp(ss, "__version", "\"1.1\""); + AddProp(ss, "__method", "\"GetParent\""); + AddProp(ss, "file_ref", ToString_PP_Resource(file_ref)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Resource(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_FileRef_1_1*)RealGetInterface("PPB_FileRef;1.1"))->GetParent(file_ref); + printf("RPC response: ["); + printf("%s", ToString_PP_Resource(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t MakeDirectory_1_1(PP_Resource directory_ref, PP_Bool make_ancestors, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_FileRef\""); + AddProp(ss, "__version", "\"1.1\""); + AddProp(ss, "__method", "\"MakeDirectory\""); + AddProp(ss, "directory_ref", ToString_PP_Resource(directory_ref)); + AddProp(ss, "make_ancestors", ToString_PP_Bool(make_ancestors)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_FileRef_1_1*)RealGetInterface("PPB_FileRef;1.1"))->MakeDirectory(directory_ref, make_ancestors, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +/* skipping MakeDirectory */ +static int32_t Touch_1_1(PP_Resource file_ref, PP_Time last_access_time, PP_Time last_modified_time, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_FileRef\""); + AddProp(ss, "__version", "\"1.1\""); + AddProp(ss, "__method", "\"Touch\""); + AddProp(ss, "file_ref", ToString_PP_Resource(file_ref)); + AddProp(ss, "last_access_time", ToString_PP_Time(last_access_time)); + AddProp(ss, "last_modified_time", ToString_PP_Time(last_modified_time)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_FileRef_1_1*)RealGetInterface("PPB_FileRef;1.1"))->Touch(file_ref, last_access_time, last_modified_time, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t Delete_1_1(PP_Resource file_ref, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_FileRef\""); + AddProp(ss, "__version", "\"1.1\""); + AddProp(ss, "__method", "\"Delete\""); + AddProp(ss, "file_ref", ToString_PP_Resource(file_ref)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_FileRef_1_1*)RealGetInterface("PPB_FileRef;1.1"))->Delete(file_ref, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t Rename_1_1(PP_Resource file_ref, PP_Resource new_file_ref, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_FileRef\""); + AddProp(ss, "__version", "\"1.1\""); + AddProp(ss, "__method", "\"Rename\""); + AddProp(ss, "file_ref", ToString_PP_Resource(file_ref)); + AddProp(ss, "new_file_ref", ToString_PP_Resource(new_file_ref)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_FileRef_1_1*)RealGetInterface("PPB_FileRef;1.1"))->Rename(file_ref, new_file_ref, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t Query_1_1(PP_Resource file_ref, struct PP_FileInfo* info, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_FileRef\""); + AddProp(ss, "__version", "\"1.1\""); + AddProp(ss, "__method", "\"Query\""); + AddProp(ss, "file_ref", ToString_PP_Resource(file_ref)); + AddProp(ss, "info", PointerToString(info)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + if (!!info) { + iterator.skip(); + FromJSON_PP_FileInfo(iterator, *info); + } + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_FileRef_1_1*)RealGetInterface("PPB_FileRef;1.1"))->Query(file_ref, info, logging_callback); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_int32_t(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + if (!!info) { + AddProp(os, "info", ToString_PP_FileInfo(info)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t ReadDirectoryEntries_1_1(PP_Resource file_ref, struct PP_ArrayOutput output, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_FileRef\""); + AddProp(ss, "__version", "\"1.1\""); + AddProp(ss, "__method", "\"ReadDirectoryEntries\""); + AddProp(ss, "file_ref", ToString_PP_Resource(file_ref)); + AddProp(ss, "output", ToString_PP_ArrayOutput(output)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_FileRef_1_1*)RealGetInterface("PPB_FileRef;1.1"))->ReadDirectoryEntries(file_ref, output, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +} +static PPB_FileRef_1_1 _PPB_FileRef_1_1 = { + ns_PPB_FileRef_1_1::Create_1_1, + ns_PPB_FileRef_1_1::IsFileRef_1_1, + ns_PPB_FileRef_1_1::GetFileSystemType_1_1, + ns_PPB_FileRef_1_1::GetName_1_1, + ns_PPB_FileRef_1_1::GetPath_1_1, + ns_PPB_FileRef_1_1::GetParent_1_1, + ns_PPB_FileRef_1_1::MakeDirectory_1_1, + ns_PPB_FileRef_1_1::Touch_1_1, + ns_PPB_FileRef_1_1::Delete_1_1, + ns_PPB_FileRef_1_1::Rename_1_1, + ns_PPB_FileRef_1_1::Query_1_1, + ns_PPB_FileRef_1_1::ReadDirectoryEntries_1_1, +}; +const string ToString_PPB_FileRef(const PPB_FileRef_1_1 *v) { + stringstream s; + s << v; + return s.str(); +} +namespace ns_PPB_FileRef_1_2 { +static PP_Resource Create_1_2(PP_Resource file_system, const char* path) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_FileRef\""); + AddProp(ss, "__version", "\"1.2\""); + AddProp(ss, "__method", "\"Create\""); + AddProp(ss, "file_system", ToString_PP_Resource(file_system)); + AddProp(ss, "path", ToString_str_t(path)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Resource(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_FileRef_1_2*)RealGetInterface("PPB_FileRef;1.2"))->Create(file_system, path); + printf("RPC response: ["); + printf("%s", ToString_PP_Resource(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool IsFileRef_1_2(PP_Resource resource) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_FileRef\""); + AddProp(ss, "__version", "\"1.2\""); + AddProp(ss, "__method", "\"IsFileRef\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_FileRef_1_2*)RealGetInterface("PPB_FileRef;1.2"))->IsFileRef(resource); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_FileSystemType GetFileSystemType_1_2(PP_Resource file_ref) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_FileRef\""); + AddProp(ss, "__version", "\"1.2\""); + AddProp(ss, "__method", "\"GetFileSystemType\""); + AddProp(ss, "file_ref", ToString_PP_Resource(file_ref)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_FileSystemType rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_FileSystemType(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_FileSystemType rval = ((PPB_FileRef_1_2*)RealGetInterface("PPB_FileRef;1.2"))->GetFileSystemType(file_ref); + printf("RPC response: ["); + printf("%s", ToString_PP_FileSystemType(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static struct PP_Var GetName_1_2(PP_Resource file_ref) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_FileRef\""); + AddProp(ss, "__version", "\"1.2\""); + AddProp(ss, "__method", "\"GetName\""); + AddProp(ss, "file_ref", ToString_PP_Resource(file_ref)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + struct PP_Var rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Var(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + struct PP_Var rval = ((PPB_FileRef_1_2*)RealGetInterface("PPB_FileRef;1.2"))->GetName(file_ref); + printf("RPC response: ["); + printf("%s", ToString_PP_Var(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static struct PP_Var GetPath_1_2(PP_Resource file_ref) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_FileRef\""); + AddProp(ss, "__version", "\"1.2\""); + AddProp(ss, "__method", "\"GetPath\""); + AddProp(ss, "file_ref", ToString_PP_Resource(file_ref)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + struct PP_Var rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Var(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + struct PP_Var rval = ((PPB_FileRef_1_2*)RealGetInterface("PPB_FileRef;1.2"))->GetPath(file_ref); + printf("RPC response: ["); + printf("%s", ToString_PP_Var(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Resource GetParent_1_2(PP_Resource file_ref) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_FileRef\""); + AddProp(ss, "__version", "\"1.2\""); + AddProp(ss, "__method", "\"GetParent\""); + AddProp(ss, "file_ref", ToString_PP_Resource(file_ref)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Resource(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_FileRef_1_2*)RealGetInterface("PPB_FileRef;1.2"))->GetParent(file_ref); + printf("RPC response: ["); + printf("%s", ToString_PP_Resource(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +/* skipping MakeDirectory */ +static int32_t MakeDirectory_1_2(PP_Resource directory_ref, int32_t make_directory_flags, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_FileRef\""); + AddProp(ss, "__version", "\"1.2\""); + AddProp(ss, "__method", "\"MakeDirectory\""); + AddProp(ss, "directory_ref", ToString_PP_Resource(directory_ref)); + AddProp(ss, "make_directory_flags", ToString_int32_t(make_directory_flags)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_FileRef_1_2*)RealGetInterface("PPB_FileRef;1.2"))->MakeDirectory(directory_ref, make_directory_flags, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t Touch_1_2(PP_Resource file_ref, PP_Time last_access_time, PP_Time last_modified_time, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_FileRef\""); + AddProp(ss, "__version", "\"1.2\""); + AddProp(ss, "__method", "\"Touch\""); + AddProp(ss, "file_ref", ToString_PP_Resource(file_ref)); + AddProp(ss, "last_access_time", ToString_PP_Time(last_access_time)); + AddProp(ss, "last_modified_time", ToString_PP_Time(last_modified_time)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_FileRef_1_2*)RealGetInterface("PPB_FileRef;1.2"))->Touch(file_ref, last_access_time, last_modified_time, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t Delete_1_2(PP_Resource file_ref, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_FileRef\""); + AddProp(ss, "__version", "\"1.2\""); + AddProp(ss, "__method", "\"Delete\""); + AddProp(ss, "file_ref", ToString_PP_Resource(file_ref)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_FileRef_1_2*)RealGetInterface("PPB_FileRef;1.2"))->Delete(file_ref, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t Rename_1_2(PP_Resource file_ref, PP_Resource new_file_ref, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_FileRef\""); + AddProp(ss, "__version", "\"1.2\""); + AddProp(ss, "__method", "\"Rename\""); + AddProp(ss, "file_ref", ToString_PP_Resource(file_ref)); + AddProp(ss, "new_file_ref", ToString_PP_Resource(new_file_ref)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_FileRef_1_2*)RealGetInterface("PPB_FileRef;1.2"))->Rename(file_ref, new_file_ref, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t Query_1_2(PP_Resource file_ref, struct PP_FileInfo* info, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_FileRef\""); + AddProp(ss, "__version", "\"1.2\""); + AddProp(ss, "__method", "\"Query\""); + AddProp(ss, "file_ref", ToString_PP_Resource(file_ref)); + AddProp(ss, "info", PointerToString(info)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + if (!!info) { + iterator.skip(); + FromJSON_PP_FileInfo(iterator, *info); + } + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_FileRef_1_2*)RealGetInterface("PPB_FileRef;1.2"))->Query(file_ref, info, logging_callback); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_int32_t(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + if (!!info) { + AddProp(os, "info", ToString_PP_FileInfo(info)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t ReadDirectoryEntries_1_2(PP_Resource file_ref, struct PP_ArrayOutput output, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_FileRef\""); + AddProp(ss, "__version", "\"1.2\""); + AddProp(ss, "__method", "\"ReadDirectoryEntries\""); + AddProp(ss, "file_ref", ToString_PP_Resource(file_ref)); + AddProp(ss, "output", ToString_PP_ArrayOutput(output)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_FileRef_1_2*)RealGetInterface("PPB_FileRef;1.2"))->ReadDirectoryEntries(file_ref, output, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +} +static PPB_FileRef_1_2 _PPB_FileRef_1_2 = { + ns_PPB_FileRef_1_2::Create_1_2, + ns_PPB_FileRef_1_2::IsFileRef_1_2, + ns_PPB_FileRef_1_2::GetFileSystemType_1_2, + ns_PPB_FileRef_1_2::GetName_1_2, + ns_PPB_FileRef_1_2::GetPath_1_2, + ns_PPB_FileRef_1_2::GetParent_1_2, + ns_PPB_FileRef_1_2::MakeDirectory_1_2, + ns_PPB_FileRef_1_2::Touch_1_2, + ns_PPB_FileRef_1_2::Delete_1_2, + ns_PPB_FileRef_1_2::Rename_1_2, + ns_PPB_FileRef_1_2::Query_1_2, + ns_PPB_FileRef_1_2::ReadDirectoryEntries_1_2, +}; +const string ToString_PPB_FileRef(const PPB_FileRef_1_2 *v) { + stringstream s; + s << v; + return s.str(); +} +namespace ns_PPB_FileSystem_1_0 { +static PP_Resource Create_1_0(PP_Instance instance, PP_FileSystemType type) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_FileSystem\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"Create\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "type", ToString_PP_FileSystemType(type)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Resource(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_FileSystem_1_0*)RealGetInterface("PPB_FileSystem;1.0"))->Create(instance, type); + printf("RPC response: ["); + printf("%s", ToString_PP_Resource(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool IsFileSystem_1_0(PP_Resource resource) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_FileSystem\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"IsFileSystem\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_FileSystem_1_0*)RealGetInterface("PPB_FileSystem;1.0"))->IsFileSystem(resource); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t Open_1_0(PP_Resource file_system, int64_t expected_size, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_FileSystem\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"Open\""); + AddProp(ss, "file_system", ToString_PP_Resource(file_system)); + AddProp(ss, "expected_size", ToString_int64_t(expected_size)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_FileSystem_1_0*)RealGetInterface("PPB_FileSystem;1.0"))->Open(file_system, expected_size, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_FileSystemType GetType_1_0(PP_Resource file_system) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_FileSystem\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"GetType\""); + AddProp(ss, "file_system", ToString_PP_Resource(file_system)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_FileSystemType rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_FileSystemType(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_FileSystemType rval = ((PPB_FileSystem_1_0*)RealGetInterface("PPB_FileSystem;1.0"))->GetType(file_system); + printf("RPC response: ["); + printf("%s", ToString_PP_FileSystemType(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +} +static PPB_FileSystem_1_0 _PPB_FileSystem_1_0 = { + ns_PPB_FileSystem_1_0::Create_1_0, + ns_PPB_FileSystem_1_0::IsFileSystem_1_0, + ns_PPB_FileSystem_1_0::Open_1_0, + ns_PPB_FileSystem_1_0::GetType_1_0, +}; +const string ToString_PPB_FileSystem(const PPB_FileSystem_1_0 *v) { + stringstream s; + s << v; + return s.str(); +} +namespace ns_PPB_Fullscreen_1_0 { +static PP_Bool IsFullscreen_1_0(PP_Instance instance) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Fullscreen\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"IsFullscreen\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_Fullscreen_1_0*)RealGetInterface("PPB_Fullscreen;1.0"))->IsFullscreen(instance); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool SetFullscreen_1_0(PP_Instance instance, PP_Bool fullscreen) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Fullscreen\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"SetFullscreen\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "fullscreen", ToString_PP_Bool(fullscreen)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_Fullscreen_1_0*)RealGetInterface("PPB_Fullscreen;1.0"))->SetFullscreen(instance, fullscreen); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool GetScreenSize_1_0(PP_Instance instance, struct PP_Size* size) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Fullscreen\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"GetScreenSize\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "size", PointerToString(size)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + if (!!size) { + iterator.skip(); + FromJSON_PP_Size(iterator, *size); + } + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_Fullscreen_1_0*)RealGetInterface("PPB_Fullscreen;1.0"))->GetScreenSize(instance, size); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + if (!!size) { + AddProp(os, "size", ToString_PP_Size(size)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +} +static PPB_Fullscreen_1_0 _PPB_Fullscreen_1_0 = { + ns_PPB_Fullscreen_1_0::IsFullscreen_1_0, + ns_PPB_Fullscreen_1_0::SetFullscreen_1_0, + ns_PPB_Fullscreen_1_0::GetScreenSize_1_0, +}; +const string ToString_PPB_Fullscreen(const PPB_Fullscreen_1_0 *v) { + stringstream s; + s << v; + return s.str(); +} +const string ToString_PP_GamepadSampleData(const PP_GamepadSampleData *v) { + if (!v) { + return "null"; + } + return ToString_PP_GamepadSampleData(*v); +} +const string ToString_PP_GamepadSampleData(const PP_GamepadSampleData &v) { + stringstream x; + BeginProps(x); + AddProp(x, "axes_length", ToString_uint32_t(v.axes_length)); + { + BeginProp(x, "axes"); + BeginElements(x); + for (uint32_t _n = 0; _n < 16; ++_n) { + AddElement(x, ToString_float_t(v.axes[_n])); + } + EndElements(x); + } + AddProp(x, "buttons_length", ToString_uint32_t(v.buttons_length)); + { + BeginProp(x, "buttons"); + BeginElements(x); + for (uint32_t _n = 0; _n < 32; ++_n) { + AddElement(x, ToString_float_t(v.buttons[_n])); + } + EndElements(x); + } + AddProp(x, "timestamp", ToString_double_t(v.timestamp)); + { + BeginProp(x, "id"); + BeginElements(x); + for (uint32_t _n = 0; _n < 128; ++_n) { + AddElement(x, ToString_uint16_t(v.id[_n])); + } + EndElements(x); + } + AddProp(x, "connected", ToString_PP_Bool(v.connected)); + { + BeginProp(x, "unused_pad_"); + BeginElements(x); + for (uint32_t _n = 0; _n < 4; ++_n) { + AddElement(x, ToString_int8_t(v.unused_pad_[_n])); + } + EndElements(x); + } + EndProps(x); + return x.str(); +} +void FromJSON_PP_GamepadSampleData(JSONIterator& iterator, PP_GamepadSampleData &value) { + const JSON::Token& current = iterator.getCurrentAndGotoNext(); + if (current.isPrimitive() && !current.value().compare("null")) { + return; + } + if (!current.isObject()) { + Fail("Expected object!", ""); + } + iterator.skip(); + FromJSON_uint32_t(iterator, value.axes_length); + iterator.skip(); + + { + size_t children = iterator.expectArrayAndGotoFirstItem(); + if (children > 16) { + Fail("Too many items in array\n", ""); + } + for (uint32_t _n = 0; _n < children; ++_n) { + FromJSON_float_t(iterator, (value.axes)[_n]); + } + // FIXME Null out remaining items? + } + iterator.skip(); + FromJSON_uint32_t(iterator, value.buttons_length); + iterator.skip(); + + { + size_t children = iterator.expectArrayAndGotoFirstItem(); + if (children > 32) { + Fail("Too many items in array\n", ""); + } + for (uint32_t _n = 0; _n < children; ++_n) { + FromJSON_float_t(iterator, (value.buttons)[_n]); + } + // FIXME Null out remaining items? + } + iterator.skip(); + FromJSON_double_t(iterator, value.timestamp); + iterator.skip(); + + { + size_t children = iterator.expectArrayAndGotoFirstItem(); + if (children > 128) { + Fail("Too many items in array\n", ""); + } + for (uint32_t _n = 0; _n < children; ++_n) { + FromJSON_uint16_t(iterator, (value.id)[_n]); + } + // FIXME Null out remaining items? + } + iterator.skip(); + FromJSON_PP_Bool(iterator, value.connected); + iterator.skip(); + + { + size_t children = iterator.expectArrayAndGotoFirstItem(); + if (children > 4) { + Fail("Too many items in array\n", ""); + } + for (uint32_t _n = 0; _n < children; ++_n) { + FromJSON_int8_t(iterator, (value.unused_pad_)[_n]); + } + // FIXME Null out remaining items? + } +} +const string ToString_PP_GamepadsSampleData(const PP_GamepadsSampleData *v) { + if (!v) { + return "null"; + } + return ToString_PP_GamepadsSampleData(*v); +} +const string ToString_PP_GamepadsSampleData(const PP_GamepadsSampleData &v) { + stringstream x; + BeginProps(x); + AddProp(x, "length", ToString_uint32_t(v.length)); + { + BeginProp(x, "unused_pad_"); + BeginElements(x); + for (uint32_t _n = 0; _n < 4; ++_n) { + AddElement(x, ToString_int8_t(v.unused_pad_[_n])); + } + EndElements(x); + } + { + BeginProp(x, "items"); + BeginElements(x); + for (uint32_t _n = 0; _n < 4; ++_n) { + AddElement(x, ToString_PP_GamepadSampleData(v.items[_n])); + } + EndElements(x); + } + EndProps(x); + return x.str(); +} +void FromJSON_PP_GamepadsSampleData(JSONIterator& iterator, PP_GamepadsSampleData &value) { + const JSON::Token& current = iterator.getCurrentAndGotoNext(); + if (current.isPrimitive() && !current.value().compare("null")) { + return; + } + if (!current.isObject()) { + Fail("Expected object!", ""); + } + iterator.skip(); + FromJSON_uint32_t(iterator, value.length); + iterator.skip(); + + { + size_t children = iterator.expectArrayAndGotoFirstItem(); + if (children > 4) { + Fail("Too many items in array\n", ""); + } + for (uint32_t _n = 0; _n < children; ++_n) { + FromJSON_int8_t(iterator, (value.unused_pad_)[_n]); + } + // FIXME Null out remaining items? + } + iterator.skip(); + + { + size_t children = iterator.expectArrayAndGotoFirstItem(); + if (children > 4) { + Fail("Too many items in array\n", ""); + } + for (uint32_t _n = 0; _n < children; ++_n) { + FromJSON_PP_GamepadSampleData(iterator, (value.items)[_n]); + } + // FIXME Null out remaining items? + } +} +namespace ns_PPB_Gamepad_1_0 { +static void Sample_1_0(PP_Instance instance, struct PP_GamepadsSampleData* data) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Gamepad\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"Sample\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "data", PointerToString(data)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectObjectAndGotoFirstProperty(); + if (!!data) { + iterator.skip(); + FromJSON_PP_GamepadsSampleData(iterator, *data); + } +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_Gamepad_1_0*)RealGetInterface("PPB_Gamepad;1.0"))->Sample(instance, data); + printf("RPC response: ["); + printf("["); + std::stringstream os; + BeginProps(os); + if (!!data) { + AddProp(os, "data", ToString_PP_GamepadsSampleData(data)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); +#endif // !INTERPOSE +} +} +static PPB_Gamepad_1_0 _PPB_Gamepad_1_0 = { + ns_PPB_Gamepad_1_0::Sample_1_0, +}; +const string ToString_PPB_Gamepad(const PPB_Gamepad_1_0 *v) { + stringstream s; + s << v; + return s.str(); +} +namespace ns_PPB_Graphics2D_1_0 { +static PP_Resource Create_1_0(PP_Instance instance, const struct PP_Size* size, PP_Bool is_always_opaque) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Graphics2D\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"Create\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "size", ToString_PP_Size(size)); + AddProp(ss, "is_always_opaque", ToString_PP_Bool(is_always_opaque)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Resource(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_Graphics2D_1_0*)RealGetInterface("PPB_Graphics2D;1.0"))->Create(instance, size, is_always_opaque); + printf("RPC response: ["); + printf("%s", ToString_PP_Resource(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool IsGraphics2D_1_0(PP_Resource resource) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Graphics2D\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"IsGraphics2D\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_Graphics2D_1_0*)RealGetInterface("PPB_Graphics2D;1.0"))->IsGraphics2D(resource); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool Describe_1_0(PP_Resource graphics_2d, struct PP_Size* size, PP_Bool* is_always_opaque) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Graphics2D\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"Describe\""); + AddProp(ss, "graphics_2d", ToString_PP_Resource(graphics_2d)); + AddProp(ss, "size", PointerToString(size)); + AddProp(ss, "is_always_opaque", PointerToString(is_always_opaque)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + if (!!size) { + iterator.skip(); + FromJSON_PP_Size(iterator, *size); + } + iterator.skip(); + FromJSON_PP_Bool(iterator, *is_always_opaque); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_Graphics2D_1_0*)RealGetInterface("PPB_Graphics2D;1.0"))->Describe(graphics_2d, size, is_always_opaque); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + if (!!size) { + AddProp(os, "size", ToString_PP_Size(size)); + } + AddProp(os, "is_always_opaque", ToString_PP_Bool(is_always_opaque)); + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static void PaintImageData_1_0(PP_Resource graphics_2d, PP_Resource image_data, const struct PP_Point* top_left, const struct PP_Rect* src_rect) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Graphics2D\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"PaintImageData\""); + AddProp(ss, "graphics_2d", ToString_PP_Resource(graphics_2d)); + AddProp(ss, "image_data", ToString_PP_Resource(image_data)); + AddProp(ss, "top_left", ToString_PP_Point(top_left)); + AddProp(ss, "src_rect", ToString_PP_Rect(src_rect)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_Graphics2D_1_0*)RealGetInterface("PPB_Graphics2D;1.0"))->PaintImageData(graphics_2d, image_data, top_left, src_rect); +#endif // !INTERPOSE +} +static void Scroll_1_0(PP_Resource graphics_2d, const struct PP_Rect* clip_rect, const struct PP_Point* amount) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Graphics2D\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"Scroll\""); + AddProp(ss, "graphics_2d", ToString_PP_Resource(graphics_2d)); + AddProp(ss, "clip_rect", ToString_PP_Rect(clip_rect)); + AddProp(ss, "amount", ToString_PP_Point(amount)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_Graphics2D_1_0*)RealGetInterface("PPB_Graphics2D;1.0"))->Scroll(graphics_2d, clip_rect, amount); +#endif // !INTERPOSE +} +static void ReplaceContents_1_0(PP_Resource graphics_2d, PP_Resource image_data) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Graphics2D\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"ReplaceContents\""); + AddProp(ss, "graphics_2d", ToString_PP_Resource(graphics_2d)); + AddProp(ss, "image_data", ToString_PP_Resource(image_data)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_Graphics2D_1_0*)RealGetInterface("PPB_Graphics2D;1.0"))->ReplaceContents(graphics_2d, image_data); +#endif // !INTERPOSE +} +static int32_t Flush_1_0(PP_Resource graphics_2d, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Graphics2D\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"Flush\""); + AddProp(ss, "graphics_2d", ToString_PP_Resource(graphics_2d)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_Graphics2D_1_0*)RealGetInterface("PPB_Graphics2D;1.0"))->Flush(graphics_2d, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +/* skipping SetScale */ +/* skipping GetScale */ +/* skipping SetLayerTransform */ +} +static PPB_Graphics2D_1_0 _PPB_Graphics2D_1_0 = { + ns_PPB_Graphics2D_1_0::Create_1_0, + ns_PPB_Graphics2D_1_0::IsGraphics2D_1_0, + ns_PPB_Graphics2D_1_0::Describe_1_0, + ns_PPB_Graphics2D_1_0::PaintImageData_1_0, + ns_PPB_Graphics2D_1_0::Scroll_1_0, + ns_PPB_Graphics2D_1_0::ReplaceContents_1_0, + ns_PPB_Graphics2D_1_0::Flush_1_0, +}; +const string ToString_PPB_Graphics2D(const PPB_Graphics2D_1_0 *v) { + stringstream s; + s << v; + return s.str(); +} +namespace ns_PPB_Graphics2D_1_1 { +static PP_Resource Create_1_1(PP_Instance instance, const struct PP_Size* size, PP_Bool is_always_opaque) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Graphics2D\""); + AddProp(ss, "__version", "\"1.1\""); + AddProp(ss, "__method", "\"Create\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "size", ToString_PP_Size(size)); + AddProp(ss, "is_always_opaque", ToString_PP_Bool(is_always_opaque)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Resource(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_Graphics2D_1_1*)RealGetInterface("PPB_Graphics2D;1.1"))->Create(instance, size, is_always_opaque); + printf("RPC response: ["); + printf("%s", ToString_PP_Resource(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool IsGraphics2D_1_1(PP_Resource resource) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Graphics2D\""); + AddProp(ss, "__version", "\"1.1\""); + AddProp(ss, "__method", "\"IsGraphics2D\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_Graphics2D_1_1*)RealGetInterface("PPB_Graphics2D;1.1"))->IsGraphics2D(resource); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool Describe_1_1(PP_Resource graphics_2d, struct PP_Size* size, PP_Bool* is_always_opaque) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Graphics2D\""); + AddProp(ss, "__version", "\"1.1\""); + AddProp(ss, "__method", "\"Describe\""); + AddProp(ss, "graphics_2d", ToString_PP_Resource(graphics_2d)); + AddProp(ss, "size", PointerToString(size)); + AddProp(ss, "is_always_opaque", PointerToString(is_always_opaque)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + if (!!size) { + iterator.skip(); + FromJSON_PP_Size(iterator, *size); + } + iterator.skip(); + FromJSON_PP_Bool(iterator, *is_always_opaque); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_Graphics2D_1_1*)RealGetInterface("PPB_Graphics2D;1.1"))->Describe(graphics_2d, size, is_always_opaque); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + if (!!size) { + AddProp(os, "size", ToString_PP_Size(size)); + } + AddProp(os, "is_always_opaque", ToString_PP_Bool(is_always_opaque)); + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static void PaintImageData_1_1(PP_Resource graphics_2d, PP_Resource image_data, const struct PP_Point* top_left, const struct PP_Rect* src_rect) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Graphics2D\""); + AddProp(ss, "__version", "\"1.1\""); + AddProp(ss, "__method", "\"PaintImageData\""); + AddProp(ss, "graphics_2d", ToString_PP_Resource(graphics_2d)); + AddProp(ss, "image_data", ToString_PP_Resource(image_data)); + AddProp(ss, "top_left", ToString_PP_Point(top_left)); + AddProp(ss, "src_rect", ToString_PP_Rect(src_rect)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_Graphics2D_1_1*)RealGetInterface("PPB_Graphics2D;1.1"))->PaintImageData(graphics_2d, image_data, top_left, src_rect); +#endif // !INTERPOSE +} +static void Scroll_1_1(PP_Resource graphics_2d, const struct PP_Rect* clip_rect, const struct PP_Point* amount) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Graphics2D\""); + AddProp(ss, "__version", "\"1.1\""); + AddProp(ss, "__method", "\"Scroll\""); + AddProp(ss, "graphics_2d", ToString_PP_Resource(graphics_2d)); + AddProp(ss, "clip_rect", ToString_PP_Rect(clip_rect)); + AddProp(ss, "amount", ToString_PP_Point(amount)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_Graphics2D_1_1*)RealGetInterface("PPB_Graphics2D;1.1"))->Scroll(graphics_2d, clip_rect, amount); +#endif // !INTERPOSE +} +static void ReplaceContents_1_1(PP_Resource graphics_2d, PP_Resource image_data) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Graphics2D\""); + AddProp(ss, "__version", "\"1.1\""); + AddProp(ss, "__method", "\"ReplaceContents\""); + AddProp(ss, "graphics_2d", ToString_PP_Resource(graphics_2d)); + AddProp(ss, "image_data", ToString_PP_Resource(image_data)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_Graphics2D_1_1*)RealGetInterface("PPB_Graphics2D;1.1"))->ReplaceContents(graphics_2d, image_data); +#endif // !INTERPOSE +} +static int32_t Flush_1_1(PP_Resource graphics_2d, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Graphics2D\""); + AddProp(ss, "__version", "\"1.1\""); + AddProp(ss, "__method", "\"Flush\""); + AddProp(ss, "graphics_2d", ToString_PP_Resource(graphics_2d)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_Graphics2D_1_1*)RealGetInterface("PPB_Graphics2D;1.1"))->Flush(graphics_2d, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool SetScale_1_1(PP_Resource resource, float scale) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Graphics2D\""); + AddProp(ss, "__version", "\"1.1\""); + AddProp(ss, "__method", "\"SetScale\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + AddProp(ss, "scale", ToString_float_t(scale)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_Graphics2D_1_1*)RealGetInterface("PPB_Graphics2D;1.1"))->SetScale(resource, scale); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static float GetScale_1_1(PP_Resource resource) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Graphics2D\""); + AddProp(ss, "__version", "\"1.1\""); + AddProp(ss, "__method", "\"GetScale\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + float rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_float_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + float rval = ((PPB_Graphics2D_1_1*)RealGetInterface("PPB_Graphics2D;1.1"))->GetScale(resource); + printf("RPC response: ["); + printf("%s", ToString_float_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +/* skipping SetLayerTransform */ +} +static PPB_Graphics2D_1_1 _PPB_Graphics2D_1_1 = { + ns_PPB_Graphics2D_1_1::Create_1_1, + ns_PPB_Graphics2D_1_1::IsGraphics2D_1_1, + ns_PPB_Graphics2D_1_1::Describe_1_1, + ns_PPB_Graphics2D_1_1::PaintImageData_1_1, + ns_PPB_Graphics2D_1_1::Scroll_1_1, + ns_PPB_Graphics2D_1_1::ReplaceContents_1_1, + ns_PPB_Graphics2D_1_1::Flush_1_1, + ns_PPB_Graphics2D_1_1::SetScale_1_1, + ns_PPB_Graphics2D_1_1::GetScale_1_1, +}; +const string ToString_PPB_Graphics2D(const PPB_Graphics2D_1_1 *v) { + stringstream s; + s << v; + return s.str(); +} +namespace ns_PPB_Graphics2D_1_2 { +static PP_Resource Create_1_2(PP_Instance instance, const struct PP_Size* size, PP_Bool is_always_opaque) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Graphics2D\""); + AddProp(ss, "__version", "\"1.2\""); + AddProp(ss, "__method", "\"Create\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "size", ToString_PP_Size(size)); + AddProp(ss, "is_always_opaque", ToString_PP_Bool(is_always_opaque)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Resource(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_Graphics2D_1_2*)RealGetInterface("PPB_Graphics2D;1.2"))->Create(instance, size, is_always_opaque); + printf("RPC response: ["); + printf("%s", ToString_PP_Resource(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool IsGraphics2D_1_2(PP_Resource resource) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Graphics2D\""); + AddProp(ss, "__version", "\"1.2\""); + AddProp(ss, "__method", "\"IsGraphics2D\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_Graphics2D_1_2*)RealGetInterface("PPB_Graphics2D;1.2"))->IsGraphics2D(resource); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool Describe_1_2(PP_Resource graphics_2d, struct PP_Size* size, PP_Bool* is_always_opaque) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Graphics2D\""); + AddProp(ss, "__version", "\"1.2\""); + AddProp(ss, "__method", "\"Describe\""); + AddProp(ss, "graphics_2d", ToString_PP_Resource(graphics_2d)); + AddProp(ss, "size", PointerToString(size)); + AddProp(ss, "is_always_opaque", PointerToString(is_always_opaque)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + if (!!size) { + iterator.skip(); + FromJSON_PP_Size(iterator, *size); + } + iterator.skip(); + FromJSON_PP_Bool(iterator, *is_always_opaque); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_Graphics2D_1_2*)RealGetInterface("PPB_Graphics2D;1.2"))->Describe(graphics_2d, size, is_always_opaque); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + if (!!size) { + AddProp(os, "size", ToString_PP_Size(size)); + } + AddProp(os, "is_always_opaque", ToString_PP_Bool(is_always_opaque)); + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static void PaintImageData_1_2(PP_Resource graphics_2d, PP_Resource image_data, const struct PP_Point* top_left, const struct PP_Rect* src_rect) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Graphics2D\""); + AddProp(ss, "__version", "\"1.2\""); + AddProp(ss, "__method", "\"PaintImageData\""); + AddProp(ss, "graphics_2d", ToString_PP_Resource(graphics_2d)); + AddProp(ss, "image_data", ToString_PP_Resource(image_data)); + AddProp(ss, "top_left", ToString_PP_Point(top_left)); + AddProp(ss, "src_rect", ToString_PP_Rect(src_rect)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_Graphics2D_1_2*)RealGetInterface("PPB_Graphics2D;1.2"))->PaintImageData(graphics_2d, image_data, top_left, src_rect); +#endif // !INTERPOSE +} +static void Scroll_1_2(PP_Resource graphics_2d, const struct PP_Rect* clip_rect, const struct PP_Point* amount) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Graphics2D\""); + AddProp(ss, "__version", "\"1.2\""); + AddProp(ss, "__method", "\"Scroll\""); + AddProp(ss, "graphics_2d", ToString_PP_Resource(graphics_2d)); + AddProp(ss, "clip_rect", ToString_PP_Rect(clip_rect)); + AddProp(ss, "amount", ToString_PP_Point(amount)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_Graphics2D_1_2*)RealGetInterface("PPB_Graphics2D;1.2"))->Scroll(graphics_2d, clip_rect, amount); +#endif // !INTERPOSE +} +static void ReplaceContents_1_2(PP_Resource graphics_2d, PP_Resource image_data) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Graphics2D\""); + AddProp(ss, "__version", "\"1.2\""); + AddProp(ss, "__method", "\"ReplaceContents\""); + AddProp(ss, "graphics_2d", ToString_PP_Resource(graphics_2d)); + AddProp(ss, "image_data", ToString_PP_Resource(image_data)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_Graphics2D_1_2*)RealGetInterface("PPB_Graphics2D;1.2"))->ReplaceContents(graphics_2d, image_data); +#endif // !INTERPOSE +} +static int32_t Flush_1_2(PP_Resource graphics_2d, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Graphics2D\""); + AddProp(ss, "__version", "\"1.2\""); + AddProp(ss, "__method", "\"Flush\""); + AddProp(ss, "graphics_2d", ToString_PP_Resource(graphics_2d)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_Graphics2D_1_2*)RealGetInterface("PPB_Graphics2D;1.2"))->Flush(graphics_2d, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool SetScale_1_2(PP_Resource resource, float scale) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Graphics2D\""); + AddProp(ss, "__version", "\"1.2\""); + AddProp(ss, "__method", "\"SetScale\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + AddProp(ss, "scale", ToString_float_t(scale)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_Graphics2D_1_2*)RealGetInterface("PPB_Graphics2D;1.2"))->SetScale(resource, scale); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static float GetScale_1_2(PP_Resource resource) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Graphics2D\""); + AddProp(ss, "__version", "\"1.2\""); + AddProp(ss, "__method", "\"GetScale\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + float rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_float_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + float rval = ((PPB_Graphics2D_1_2*)RealGetInterface("PPB_Graphics2D;1.2"))->GetScale(resource); + printf("RPC response: ["); + printf("%s", ToString_float_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool SetLayerTransform_1_2(PP_Resource resource, float scale, const struct PP_Point* origin, const struct PP_Point* translate) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Graphics2D\""); + AddProp(ss, "__version", "\"1.2\""); + AddProp(ss, "__method", "\"SetLayerTransform\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + AddProp(ss, "scale", ToString_float_t(scale)); + AddProp(ss, "origin", ToString_PP_Point(origin)); + AddProp(ss, "translate", ToString_PP_Point(translate)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_Graphics2D_1_2*)RealGetInterface("PPB_Graphics2D;1.2"))->SetLayerTransform(resource, scale, origin, translate); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +} +static PPB_Graphics2D_1_2 _PPB_Graphics2D_1_2 = { + ns_PPB_Graphics2D_1_2::Create_1_2, + ns_PPB_Graphics2D_1_2::IsGraphics2D_1_2, + ns_PPB_Graphics2D_1_2::Describe_1_2, + ns_PPB_Graphics2D_1_2::PaintImageData_1_2, + ns_PPB_Graphics2D_1_2::Scroll_1_2, + ns_PPB_Graphics2D_1_2::ReplaceContents_1_2, + ns_PPB_Graphics2D_1_2::Flush_1_2, + ns_PPB_Graphics2D_1_2::SetScale_1_2, + ns_PPB_Graphics2D_1_2::GetScale_1_2, + ns_PPB_Graphics2D_1_2::SetLayerTransform_1_2, +}; +const string ToString_PPB_Graphics2D(const PPB_Graphics2D_1_2 *v) { + stringstream s; + s << v; + return s.str(); +} +namespace ns_PPB_Graphics3D_1_0 { +static int32_t GetAttribMaxValue_1_0(PP_Resource instance, int32_t attribute, int32_t* value) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Graphics3D\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"GetAttribMaxValue\""); + AddProp(ss, "instance", ToString_PP_Resource(instance)); + AddProp(ss, "attribute", ToString_int32_t(attribute)); + AddProp(ss, "value", PointerToString(value)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + iterator.skip(); + FromJSON_int32_t(iterator, *value); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_Graphics3D_1_0*)RealGetInterface("PPB_Graphics3D;1.0"))->GetAttribMaxValue(instance, attribute, value); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_int32_t(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + if (!!value) { + AddProp(os, "value", ToString_int32_t(value)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Resource Create_1_0(PP_Instance instance, PP_Resource share_context, const int32_t attrib_list[]) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Graphics3D\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"Create\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "share_context", ToString_PP_Resource(share_context)); + { + BeginProp(ss, "attrib_list"); + BeginElements(ss); + for (uint32_t _n = 0; attrib_list[_n] != PP_GRAPHICS3DATTRIB_NONE; ++_n) { + AddElement(ss, ToString_int32_t(attrib_list[_n])); + } + EndElements(ss); + } + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Resource(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_Graphics3D_1_0*)RealGetInterface("PPB_Graphics3D;1.0"))->Create(instance, share_context, attrib_list); + printf("RPC response: ["); + printf("%s", ToString_PP_Resource(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool IsGraphics3D_1_0(PP_Resource resource) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Graphics3D\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"IsGraphics3D\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_Graphics3D_1_0*)RealGetInterface("PPB_Graphics3D;1.0"))->IsGraphics3D(resource); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t GetAttribs_1_0(PP_Resource context, int32_t attrib_list[]) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Graphics3D\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"GetAttribs\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + { + BeginProp(ss, "attrib_list"); + BeginElements(ss); + for (uint32_t _n = 0; attrib_list[_n] != 0; ++_n) { + AddElement(ss, ToString_int32_t(attrib_list[_n])); + } + EndElements(ss); + } + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + iterator.skip(); + + { + size_t children = iterator.expectArrayAndGotoFirstItem(); + for (uint32_t _n = 0; _n < children; ++_n) { + FromJSON_int32_t(iterator, (attrib_list)[_n]); + } + // FIXME Null out remaining items? + } + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_Graphics3D_1_0*)RealGetInterface("PPB_Graphics3D;1.0"))->GetAttribs(context, attrib_list); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_int32_t(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + { + BeginProp(os, "attrib_list"); + BeginElements(os); + for (uint32_t _n = 0; attrib_list[_n] != 0; ++_n) { + AddElement(os, ToString_int32_t(attrib_list[_n])); + } + EndElements(os); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t SetAttribs_1_0(PP_Resource context, const int32_t attrib_list[]) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Graphics3D\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"SetAttribs\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + { + BeginProp(ss, "attrib_list"); + BeginElements(ss); + for (uint32_t _n = 0; attrib_list[_n] != 0; ++_n) { + AddElement(ss, ToString_int32_t(attrib_list[_n])); + } + EndElements(ss); + } + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_Graphics3D_1_0*)RealGetInterface("PPB_Graphics3D;1.0"))->SetAttribs(context, attrib_list); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t GetError_1_0(PP_Resource context) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Graphics3D\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"GetError\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_Graphics3D_1_0*)RealGetInterface("PPB_Graphics3D;1.0"))->GetError(context); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t ResizeBuffers_1_0(PP_Resource context, int32_t width, int32_t height) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Graphics3D\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"ResizeBuffers\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "width", ToString_int32_t(width)); + AddProp(ss, "height", ToString_int32_t(height)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_Graphics3D_1_0*)RealGetInterface("PPB_Graphics3D;1.0"))->ResizeBuffers(context, width, height); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t SwapBuffers_1_0(PP_Resource context, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Graphics3D\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"SwapBuffers\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_Graphics3D_1_0*)RealGetInterface("PPB_Graphics3D;1.0"))->SwapBuffers(context, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +} +static PPB_Graphics3D_1_0 _PPB_Graphics3D_1_0 = { + ns_PPB_Graphics3D_1_0::GetAttribMaxValue_1_0, + ns_PPB_Graphics3D_1_0::Create_1_0, + ns_PPB_Graphics3D_1_0::IsGraphics3D_1_0, + ns_PPB_Graphics3D_1_0::GetAttribs_1_0, + ns_PPB_Graphics3D_1_0::SetAttribs_1_0, + ns_PPB_Graphics3D_1_0::GetError_1_0, + ns_PPB_Graphics3D_1_0::ResizeBuffers_1_0, + ns_PPB_Graphics3D_1_0::SwapBuffers_1_0, +}; +const string ToString_PPB_Graphics3D(const PPB_Graphics3D_1_0 *v) { + stringstream s; + s << v; + return s.str(); +} +const string ToString_PP_HostResolver_Flag(const PP_HostResolver_Flag *v) { + switch (*v) { + case 1 << 0: + return "\"PP_HOSTRESOLVER_FLAG_CANONNAME\""; + default: + return "\"???\""; + } +} +const string ToString_PP_HostResolver_Flag(const PP_HostResolver_Flag &v) { + return ToString_PP_HostResolver_Flag(&v); +} +void FromJSON_PP_HostResolver_Flag(JSONIterator& iterator, PP_HostResolver_Flag &value) { + long int v; + FromJSON_int(iterator, v); + value = PP_HostResolver_Flag(v); +} +const string ToString_PP_HostResolver_Hint(const PP_HostResolver_Hint *v) { + if (!v) { + return "null"; + } + return ToString_PP_HostResolver_Hint(*v); +} +const string ToString_PP_HostResolver_Hint(const PP_HostResolver_Hint &v) { + stringstream x; + BeginProps(x); + AddProp(x, "family", ToString_PP_NetAddress_Family(v.family)); + AddProp(x, "flags", ToString_int32_t(v.flags)); + EndProps(x); + return x.str(); +} +void FromJSON_PP_HostResolver_Hint(JSONIterator& iterator, PP_HostResolver_Hint &value) { + const JSON::Token& current = iterator.getCurrentAndGotoNext(); + if (current.isPrimitive() && !current.value().compare("null")) { + return; + } + if (!current.isObject()) { + Fail("Expected object!", ""); + } + iterator.skip(); + FromJSON_PP_NetAddress_Family(iterator, value.family); + iterator.skip(); + FromJSON_int32_t(iterator, value.flags); +} +namespace ns_PPB_HostResolver_1_0 { +static PP_Resource Create_1_0(PP_Instance instance) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_HostResolver\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"Create\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Resource(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_HostResolver_1_0*)RealGetInterface("PPB_HostResolver;1.0"))->Create(instance); + printf("RPC response: ["); + printf("%s", ToString_PP_Resource(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool IsHostResolver_1_0(PP_Resource resource) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_HostResolver\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"IsHostResolver\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_HostResolver_1_0*)RealGetInterface("PPB_HostResolver;1.0"))->IsHostResolver(resource); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t Resolve_1_0(PP_Resource host_resolver, const char* host, uint16_t port, const struct PP_HostResolver_Hint* hint, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_HostResolver\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"Resolve\""); + AddProp(ss, "host_resolver", ToString_PP_Resource(host_resolver)); + AddProp(ss, "host", ToString_str_t(host)); + AddProp(ss, "port", ToString_uint16_t(port)); + AddProp(ss, "hint", ToString_PP_HostResolver_Hint(hint)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_HostResolver_1_0*)RealGetInterface("PPB_HostResolver;1.0"))->Resolve(host_resolver, host, port, hint, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static struct PP_Var GetCanonicalName_1_0(PP_Resource host_resolver) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_HostResolver\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"GetCanonicalName\""); + AddProp(ss, "host_resolver", ToString_PP_Resource(host_resolver)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + struct PP_Var rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Var(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + struct PP_Var rval = ((PPB_HostResolver_1_0*)RealGetInterface("PPB_HostResolver;1.0"))->GetCanonicalName(host_resolver); + printf("RPC response: ["); + printf("%s", ToString_PP_Var(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static uint32_t GetNetAddressCount_1_0(PP_Resource host_resolver) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_HostResolver\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"GetNetAddressCount\""); + AddProp(ss, "host_resolver", ToString_PP_Resource(host_resolver)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + uint32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_uint32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + uint32_t rval = ((PPB_HostResolver_1_0*)RealGetInterface("PPB_HostResolver;1.0"))->GetNetAddressCount(host_resolver); + printf("RPC response: ["); + printf("%s", ToString_uint32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Resource GetNetAddress_1_0(PP_Resource host_resolver, uint32_t index) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_HostResolver\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"GetNetAddress\""); + AddProp(ss, "host_resolver", ToString_PP_Resource(host_resolver)); + AddProp(ss, "index", ToString_uint32_t(index)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Resource(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_HostResolver_1_0*)RealGetInterface("PPB_HostResolver;1.0"))->GetNetAddress(host_resolver, index); + printf("RPC response: ["); + printf("%s", ToString_PP_Resource(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +} +static PPB_HostResolver_1_0 _PPB_HostResolver_1_0 = { + ns_PPB_HostResolver_1_0::Create_1_0, + ns_PPB_HostResolver_1_0::IsHostResolver_1_0, + ns_PPB_HostResolver_1_0::Resolve_1_0, + ns_PPB_HostResolver_1_0::GetCanonicalName_1_0, + ns_PPB_HostResolver_1_0::GetNetAddressCount_1_0, + ns_PPB_HostResolver_1_0::GetNetAddress_1_0, +}; +const string ToString_PPB_HostResolver(const PPB_HostResolver_1_0 *v) { + stringstream s; + s << v; + return s.str(); +} +const string ToString_PP_ImageDataFormat(const PP_ImageDataFormat *v) { + switch (*v) { + case 0: + return "\"PP_IMAGEDATAFORMAT_BGRA_PREMUL\""; + case 1: + return "\"PP_IMAGEDATAFORMAT_RGBA_PREMUL\""; + default: + return "\"???\""; + } +} +const string ToString_PP_ImageDataFormat(const PP_ImageDataFormat &v) { + return ToString_PP_ImageDataFormat(&v); +} +void FromJSON_PP_ImageDataFormat(JSONIterator& iterator, PP_ImageDataFormat &value) { + long int v; + FromJSON_int(iterator, v); + value = PP_ImageDataFormat(v); +} +const string ToString_PP_ImageDataDesc(const PP_ImageDataDesc *v) { + if (!v) { + return "null"; + } + return ToString_PP_ImageDataDesc(*v); +} +const string ToString_PP_ImageDataDesc(const PP_ImageDataDesc &v) { + stringstream x; + BeginProps(x); + AddProp(x, "format", ToString_PP_ImageDataFormat(v.format)); + AddProp(x, "size", ToString_PP_Size(v.size)); + AddProp(x, "stride", ToString_int32_t(v.stride)); + EndProps(x); + return x.str(); +} +void FromJSON_PP_ImageDataDesc(JSONIterator& iterator, PP_ImageDataDesc &value) { + const JSON::Token& current = iterator.getCurrentAndGotoNext(); + if (current.isPrimitive() && !current.value().compare("null")) { + return; + } + if (!current.isObject()) { + Fail("Expected object!", ""); + } + iterator.skip(); + FromJSON_PP_ImageDataFormat(iterator, value.format); + iterator.skip(); + FromJSON_PP_Size(iterator, value.size); + iterator.skip(); + FromJSON_int32_t(iterator, value.stride); +} +namespace ns_PPB_ImageData_1_0 { +static PP_ImageDataFormat GetNativeImageDataFormat_1_0(void) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_ImageData\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"GetNativeImageDataFormat\""); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_ImageDataFormat rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_ImageDataFormat(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_ImageDataFormat rval = ((PPB_ImageData_1_0*)RealGetInterface("PPB_ImageData;1.0"))->GetNativeImageDataFormat(); + printf("RPC response: ["); + printf("%s", ToString_PP_ImageDataFormat(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool IsImageDataFormatSupported_1_0(PP_ImageDataFormat format) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_ImageData\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"IsImageDataFormatSupported\""); + AddProp(ss, "format", ToString_PP_ImageDataFormat(format)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_ImageData_1_0*)RealGetInterface("PPB_ImageData;1.0"))->IsImageDataFormatSupported(format); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Resource Create_1_0(PP_Instance instance, PP_ImageDataFormat format, const struct PP_Size* size, PP_Bool init_to_zero) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_ImageData\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"Create\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "format", ToString_PP_ImageDataFormat(format)); + AddProp(ss, "size", ToString_PP_Size(size)); + AddProp(ss, "init_to_zero", ToString_PP_Bool(init_to_zero)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Resource(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_ImageData_1_0*)RealGetInterface("PPB_ImageData;1.0"))->Create(instance, format, size, init_to_zero); + printf("RPC response: ["); + printf("%s", ToString_PP_Resource(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool IsImageData_1_0(PP_Resource image_data) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_ImageData\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"IsImageData\""); + AddProp(ss, "image_data", ToString_PP_Resource(image_data)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_ImageData_1_0*)RealGetInterface("PPB_ImageData;1.0"))->IsImageData(image_data); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool Describe_1_0(PP_Resource image_data, struct PP_ImageDataDesc* desc) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_ImageData\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"Describe\""); + AddProp(ss, "image_data", ToString_PP_Resource(image_data)); + AddProp(ss, "desc", PointerToString(desc)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + if (!!desc) { + iterator.skip(); + FromJSON_PP_ImageDataDesc(iterator, *desc); + } + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_ImageData_1_0*)RealGetInterface("PPB_ImageData;1.0"))->Describe(image_data, desc); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + if (!!desc) { + AddProp(os, "desc", ToString_PP_ImageDataDesc(desc)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static void* Map_1_0(PP_Resource image_data) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_ImageData\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"Map\""); + AddProp(ss, "image_data", ToString_PP_Resource(image_data)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + void* rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_mem_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + void* rval = ((PPB_ImageData_1_0*)RealGetInterface("PPB_ImageData;1.0"))->Map(image_data); + printf("RPC response: ["); + printf("%s", ToString_mem_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static void Unmap_1_0(PP_Resource image_data) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_ImageData\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"Unmap\""); + AddProp(ss, "image_data", ToString_PP_Resource(image_data)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_ImageData_1_0*)RealGetInterface("PPB_ImageData;1.0"))->Unmap(image_data); +#endif // !INTERPOSE +} +} +static PPB_ImageData_1_0 _PPB_ImageData_1_0 = { + ns_PPB_ImageData_1_0::GetNativeImageDataFormat_1_0, + ns_PPB_ImageData_1_0::IsImageDataFormatSupported_1_0, + ns_PPB_ImageData_1_0::Create_1_0, + ns_PPB_ImageData_1_0::IsImageData_1_0, + ns_PPB_ImageData_1_0::Describe_1_0, + ns_PPB_ImageData_1_0::Map_1_0, + ns_PPB_ImageData_1_0::Unmap_1_0, +}; +const string ToString_PPB_ImageData(const PPB_ImageData_1_0 *v) { + stringstream s; + s << v; + return s.str(); +} +const string ToString_PP_InputEvent_Type(const PP_InputEvent_Type *v) { + switch (*v) { + case -1: + return "\"PP_INPUTEVENT_TYPE_UNDEFINED\""; + case 0: + return "\"PP_INPUTEVENT_TYPE_MOUSEDOWN\""; + case 1: + return "\"PP_INPUTEVENT_TYPE_MOUSEUP\""; + case 2: + return "\"PP_INPUTEVENT_TYPE_MOUSEMOVE\""; + case 3: + return "\"PP_INPUTEVENT_TYPE_MOUSEENTER\""; + case 4: + return "\"PP_INPUTEVENT_TYPE_MOUSELEAVE\""; + case 5: + return "\"PP_INPUTEVENT_TYPE_WHEEL\""; + case 6: + return "\"PP_INPUTEVENT_TYPE_RAWKEYDOWN\""; + case 7: + return "\"PP_INPUTEVENT_TYPE_KEYDOWN\""; + case 8: + return "\"PP_INPUTEVENT_TYPE_KEYUP\""; + case 9: + return "\"PP_INPUTEVENT_TYPE_CHAR\""; + case 10: + return "\"PP_INPUTEVENT_TYPE_CONTEXTMENU\""; + case 11: + return "\"PP_INPUTEVENT_TYPE_IME_COMPOSITION_START\""; + case 12: + return "\"PP_INPUTEVENT_TYPE_IME_COMPOSITION_UPDATE\""; + case 13: + return "\"PP_INPUTEVENT_TYPE_IME_COMPOSITION_END\""; + case 14: + return "\"PP_INPUTEVENT_TYPE_IME_TEXT\""; + case 15: + return "\"PP_INPUTEVENT_TYPE_TOUCHSTART\""; + case 16: + return "\"PP_INPUTEVENT_TYPE_TOUCHMOVE\""; + case 17: + return "\"PP_INPUTEVENT_TYPE_TOUCHEND\""; + case 18: + return "\"PP_INPUTEVENT_TYPE_TOUCHCANCEL\""; + default: + return "\"???\""; + } +} +const string ToString_PP_InputEvent_Type(const PP_InputEvent_Type &v) { + return ToString_PP_InputEvent_Type(&v); +} +void FromJSON_PP_InputEvent_Type(JSONIterator& iterator, PP_InputEvent_Type &value) { + long int v; + FromJSON_int(iterator, v); + value = PP_InputEvent_Type(v); +} +const string ToString_PP_InputEvent_Modifier(const PP_InputEvent_Modifier *v) { + switch (*v) { + case 1 << 0: + return "\"PP_INPUTEVENT_MODIFIER_SHIFTKEY\""; + case 1 << 1: + return "\"PP_INPUTEVENT_MODIFIER_CONTROLKEY\""; + case 1 << 2: + return "\"PP_INPUTEVENT_MODIFIER_ALTKEY\""; + case 1 << 3: + return "\"PP_INPUTEVENT_MODIFIER_METAKEY\""; + case 1 << 4: + return "\"PP_INPUTEVENT_MODIFIER_ISKEYPAD\""; + case 1 << 5: + return "\"PP_INPUTEVENT_MODIFIER_ISAUTOREPEAT\""; + case 1 << 6: + return "\"PP_INPUTEVENT_MODIFIER_LEFTBUTTONDOWN\""; + case 1 << 7: + return "\"PP_INPUTEVENT_MODIFIER_MIDDLEBUTTONDOWN\""; + case 1 << 8: + return "\"PP_INPUTEVENT_MODIFIER_RIGHTBUTTONDOWN\""; + case 1 << 9: + return "\"PP_INPUTEVENT_MODIFIER_CAPSLOCKKEY\""; + case 1 << 10: + return "\"PP_INPUTEVENT_MODIFIER_NUMLOCKKEY\""; + case 1 << 11: + return "\"PP_INPUTEVENT_MODIFIER_ISLEFT\""; + case 1 << 12: + return "\"PP_INPUTEVENT_MODIFIER_ISRIGHT\""; + case 1 << 13: + return "\"PP_INPUTEVENT_MODIFIER_ISPEN\""; + case 1 << 14: + return "\"PP_INPUTEVENT_MODIFIER_ISERASER\""; + default: + return "\"???\""; + } +} +const string ToString_PP_InputEvent_Modifier(const PP_InputEvent_Modifier &v) { + return ToString_PP_InputEvent_Modifier(&v); +} +void FromJSON_PP_InputEvent_Modifier(JSONIterator& iterator, PP_InputEvent_Modifier &value) { + long int v; + FromJSON_int(iterator, v); + value = PP_InputEvent_Modifier(v); +} +const string ToString_PP_InputEvent_MouseButton(const PP_InputEvent_MouseButton *v) { + switch (*v) { + case -1: + return "\"PP_INPUTEVENT_MOUSEBUTTON_NONE\""; + case 0: + return "\"PP_INPUTEVENT_MOUSEBUTTON_LEFT\""; + case 1: + return "\"PP_INPUTEVENT_MOUSEBUTTON_MIDDLE\""; + case 2: + return "\"PP_INPUTEVENT_MOUSEBUTTON_RIGHT\""; + default: + return "\"???\""; + } +} +const string ToString_PP_InputEvent_MouseButton(const PP_InputEvent_MouseButton &v) { + return ToString_PP_InputEvent_MouseButton(&v); +} +void FromJSON_PP_InputEvent_MouseButton(JSONIterator& iterator, PP_InputEvent_MouseButton &value) { + long int v; + FromJSON_int(iterator, v); + value = PP_InputEvent_MouseButton(v); +} +const string ToString_PP_InputEvent_Class(const PP_InputEvent_Class *v) { + switch (*v) { + case 1 << 0: + return "\"PP_INPUTEVENT_CLASS_MOUSE\""; + case 1 << 1: + return "\"PP_INPUTEVENT_CLASS_KEYBOARD\""; + case 1 << 2: + return "\"PP_INPUTEVENT_CLASS_WHEEL\""; + case 1 << 3: + return "\"PP_INPUTEVENT_CLASS_TOUCH\""; + case 1 << 4: + return "\"PP_INPUTEVENT_CLASS_IME\""; + default: + return "\"???\""; + } +} +const string ToString_PP_InputEvent_Class(const PP_InputEvent_Class &v) { + return ToString_PP_InputEvent_Class(&v); +} +void FromJSON_PP_InputEvent_Class(JSONIterator& iterator, PP_InputEvent_Class &value) { + long int v; + FromJSON_int(iterator, v); + value = PP_InputEvent_Class(v); +} +namespace ns_PPB_InputEvent_1_0 { +static int32_t RequestInputEvents_1_0(PP_Instance instance, uint32_t event_classes) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_InputEvent\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"RequestInputEvents\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "event_classes", ToString_uint32_t(event_classes)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_InputEvent_1_0*)RealGetInterface("PPB_InputEvent;1.0"))->RequestInputEvents(instance, event_classes); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t RequestFilteringInputEvents_1_0(PP_Instance instance, uint32_t event_classes) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_InputEvent\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"RequestFilteringInputEvents\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "event_classes", ToString_uint32_t(event_classes)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_InputEvent_1_0*)RealGetInterface("PPB_InputEvent;1.0"))->RequestFilteringInputEvents(instance, event_classes); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static void ClearInputEventRequest_1_0(PP_Instance instance, uint32_t event_classes) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_InputEvent\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"ClearInputEventRequest\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "event_classes", ToString_uint32_t(event_classes)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_InputEvent_1_0*)RealGetInterface("PPB_InputEvent;1.0"))->ClearInputEventRequest(instance, event_classes); +#endif // !INTERPOSE +} +static PP_Bool IsInputEvent_1_0(PP_Resource resource) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_InputEvent\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"IsInputEvent\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_InputEvent_1_0*)RealGetInterface("PPB_InputEvent;1.0"))->IsInputEvent(resource); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_InputEvent_Type GetType_1_0(PP_Resource event) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_InputEvent\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"GetType\""); + AddProp(ss, "event", ToString_PP_Resource(event)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_InputEvent_Type rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_InputEvent_Type(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_InputEvent_Type rval = ((PPB_InputEvent_1_0*)RealGetInterface("PPB_InputEvent;1.0"))->GetType(event); + printf("RPC response: ["); + printf("%s", ToString_PP_InputEvent_Type(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_TimeTicks GetTimeStamp_1_0(PP_Resource event) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_InputEvent\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"GetTimeStamp\""); + AddProp(ss, "event", ToString_PP_Resource(event)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + double rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_TimeTicks(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + double rval = ((PPB_InputEvent_1_0*)RealGetInterface("PPB_InputEvent;1.0"))->GetTimeStamp(event); + printf("RPC response: ["); + printf("%s", ToString_PP_TimeTicks(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static uint32_t GetModifiers_1_0(PP_Resource event) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_InputEvent\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"GetModifiers\""); + AddProp(ss, "event", ToString_PP_Resource(event)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + uint32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_uint32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + uint32_t rval = ((PPB_InputEvent_1_0*)RealGetInterface("PPB_InputEvent;1.0"))->GetModifiers(event); + printf("RPC response: ["); + printf("%s", ToString_uint32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +} +static PPB_InputEvent_1_0 _PPB_InputEvent_1_0 = { + ns_PPB_InputEvent_1_0::RequestInputEvents_1_0, + ns_PPB_InputEvent_1_0::RequestFilteringInputEvents_1_0, + ns_PPB_InputEvent_1_0::ClearInputEventRequest_1_0, + ns_PPB_InputEvent_1_0::IsInputEvent_1_0, + ns_PPB_InputEvent_1_0::GetType_1_0, + ns_PPB_InputEvent_1_0::GetTimeStamp_1_0, + ns_PPB_InputEvent_1_0::GetModifiers_1_0, +}; +const string ToString_PPB_InputEvent(const PPB_InputEvent_1_0 *v) { + stringstream s; + s << v; + return s.str(); +} +namespace ns_PPB_MouseInputEvent_1_0 { +static PP_Resource Create_1_0(PP_Instance instance, PP_InputEvent_Type type, PP_TimeTicks time_stamp, uint32_t modifiers, PP_InputEvent_MouseButton mouse_button, const struct PP_Point* mouse_position, int32_t click_count) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_MouseInputEvent\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"Create\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "type", ToString_PP_InputEvent_Type(type)); + AddProp(ss, "time_stamp", ToString_PP_TimeTicks(time_stamp)); + AddProp(ss, "modifiers", ToString_uint32_t(modifiers)); + AddProp(ss, "mouse_button", ToString_PP_InputEvent_MouseButton(mouse_button)); + AddProp(ss, "mouse_position", ToString_PP_Point(mouse_position)); + AddProp(ss, "click_count", ToString_int32_t(click_count)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Resource(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_MouseInputEvent_1_0*)RealGetInterface("PPB_MouseInputEvent;1.0"))->Create(instance, type, time_stamp, modifiers, mouse_button, mouse_position, click_count); + printf("RPC response: ["); + printf("%s", ToString_PP_Resource(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +/* skipping Create */ +static PP_Bool IsMouseInputEvent_1_0(PP_Resource resource) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_MouseInputEvent\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"IsMouseInputEvent\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_MouseInputEvent_1_0*)RealGetInterface("PPB_MouseInputEvent;1.0"))->IsMouseInputEvent(resource); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_InputEvent_MouseButton GetButton_1_0(PP_Resource mouse_event) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_MouseInputEvent\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"GetButton\""); + AddProp(ss, "mouse_event", ToString_PP_Resource(mouse_event)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_InputEvent_MouseButton rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_InputEvent_MouseButton(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_InputEvent_MouseButton rval = ((PPB_MouseInputEvent_1_0*)RealGetInterface("PPB_MouseInputEvent;1.0"))->GetButton(mouse_event); + printf("RPC response: ["); + printf("%s", ToString_PP_InputEvent_MouseButton(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static struct PP_Point GetPosition_1_0(PP_Resource mouse_event) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_MouseInputEvent\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"GetPosition\""); + AddProp(ss, "mouse_event", ToString_PP_Resource(mouse_event)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + struct PP_Point rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Point(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + struct PP_Point rval = ((PPB_MouseInputEvent_1_0*)RealGetInterface("PPB_MouseInputEvent;1.0"))->GetPosition(mouse_event); + printf("RPC response: ["); + printf("%s", ToString_PP_Point(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t GetClickCount_1_0(PP_Resource mouse_event) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_MouseInputEvent\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"GetClickCount\""); + AddProp(ss, "mouse_event", ToString_PP_Resource(mouse_event)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_MouseInputEvent_1_0*)RealGetInterface("PPB_MouseInputEvent;1.0"))->GetClickCount(mouse_event); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +/* skipping GetMovement */ +} +static PPB_MouseInputEvent_1_0 _PPB_MouseInputEvent_1_0 = { + ns_PPB_MouseInputEvent_1_0::Create_1_0, + ns_PPB_MouseInputEvent_1_0::IsMouseInputEvent_1_0, + ns_PPB_MouseInputEvent_1_0::GetButton_1_0, + ns_PPB_MouseInputEvent_1_0::GetPosition_1_0, + ns_PPB_MouseInputEvent_1_0::GetClickCount_1_0, +}; +const string ToString_PPB_MouseInputEvent(const PPB_MouseInputEvent_1_0 *v) { + stringstream s; + s << v; + return s.str(); +} +namespace ns_PPB_MouseInputEvent_1_1 { +/* skipping Create */ +static PP_Resource Create_1_1(PP_Instance instance, PP_InputEvent_Type type, PP_TimeTicks time_stamp, uint32_t modifiers, PP_InputEvent_MouseButton mouse_button, const struct PP_Point* mouse_position, int32_t click_count, const struct PP_Point* mouse_movement) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_MouseInputEvent\""); + AddProp(ss, "__version", "\"1.1\""); + AddProp(ss, "__method", "\"Create\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "type", ToString_PP_InputEvent_Type(type)); + AddProp(ss, "time_stamp", ToString_PP_TimeTicks(time_stamp)); + AddProp(ss, "modifiers", ToString_uint32_t(modifiers)); + AddProp(ss, "mouse_button", ToString_PP_InputEvent_MouseButton(mouse_button)); + AddProp(ss, "mouse_position", ToString_PP_Point(mouse_position)); + AddProp(ss, "click_count", ToString_int32_t(click_count)); + AddProp(ss, "mouse_movement", ToString_PP_Point(mouse_movement)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Resource(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_MouseInputEvent_1_1*)RealGetInterface("PPB_MouseInputEvent;1.1"))->Create(instance, type, time_stamp, modifiers, mouse_button, mouse_position, click_count, mouse_movement); + printf("RPC response: ["); + printf("%s", ToString_PP_Resource(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool IsMouseInputEvent_1_1(PP_Resource resource) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_MouseInputEvent\""); + AddProp(ss, "__version", "\"1.1\""); + AddProp(ss, "__method", "\"IsMouseInputEvent\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_MouseInputEvent_1_1*)RealGetInterface("PPB_MouseInputEvent;1.1"))->IsMouseInputEvent(resource); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_InputEvent_MouseButton GetButton_1_1(PP_Resource mouse_event) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_MouseInputEvent\""); + AddProp(ss, "__version", "\"1.1\""); + AddProp(ss, "__method", "\"GetButton\""); + AddProp(ss, "mouse_event", ToString_PP_Resource(mouse_event)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_InputEvent_MouseButton rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_InputEvent_MouseButton(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_InputEvent_MouseButton rval = ((PPB_MouseInputEvent_1_1*)RealGetInterface("PPB_MouseInputEvent;1.1"))->GetButton(mouse_event); + printf("RPC response: ["); + printf("%s", ToString_PP_InputEvent_MouseButton(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static struct PP_Point GetPosition_1_1(PP_Resource mouse_event) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_MouseInputEvent\""); + AddProp(ss, "__version", "\"1.1\""); + AddProp(ss, "__method", "\"GetPosition\""); + AddProp(ss, "mouse_event", ToString_PP_Resource(mouse_event)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + struct PP_Point rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Point(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + struct PP_Point rval = ((PPB_MouseInputEvent_1_1*)RealGetInterface("PPB_MouseInputEvent;1.1"))->GetPosition(mouse_event); + printf("RPC response: ["); + printf("%s", ToString_PP_Point(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t GetClickCount_1_1(PP_Resource mouse_event) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_MouseInputEvent\""); + AddProp(ss, "__version", "\"1.1\""); + AddProp(ss, "__method", "\"GetClickCount\""); + AddProp(ss, "mouse_event", ToString_PP_Resource(mouse_event)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_MouseInputEvent_1_1*)RealGetInterface("PPB_MouseInputEvent;1.1"))->GetClickCount(mouse_event); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static struct PP_Point GetMovement_1_1(PP_Resource mouse_event) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_MouseInputEvent\""); + AddProp(ss, "__version", "\"1.1\""); + AddProp(ss, "__method", "\"GetMovement\""); + AddProp(ss, "mouse_event", ToString_PP_Resource(mouse_event)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + struct PP_Point rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Point(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + struct PP_Point rval = ((PPB_MouseInputEvent_1_1*)RealGetInterface("PPB_MouseInputEvent;1.1"))->GetMovement(mouse_event); + printf("RPC response: ["); + printf("%s", ToString_PP_Point(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +} +static PPB_MouseInputEvent_1_1 _PPB_MouseInputEvent_1_1 = { + ns_PPB_MouseInputEvent_1_1::Create_1_1, + ns_PPB_MouseInputEvent_1_1::IsMouseInputEvent_1_1, + ns_PPB_MouseInputEvent_1_1::GetButton_1_1, + ns_PPB_MouseInputEvent_1_1::GetPosition_1_1, + ns_PPB_MouseInputEvent_1_1::GetClickCount_1_1, + ns_PPB_MouseInputEvent_1_1::GetMovement_1_1, +}; +const string ToString_PPB_MouseInputEvent(const PPB_MouseInputEvent_1_1 *v) { + stringstream s; + s << v; + return s.str(); +} +namespace ns_PPB_WheelInputEvent_1_0 { +static PP_Resource Create_1_0(PP_Instance instance, PP_TimeTicks time_stamp, uint32_t modifiers, const struct PP_FloatPoint* wheel_delta, const struct PP_FloatPoint* wheel_ticks, PP_Bool scroll_by_page) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_WheelInputEvent\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"Create\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "time_stamp", ToString_PP_TimeTicks(time_stamp)); + AddProp(ss, "modifiers", ToString_uint32_t(modifiers)); + AddProp(ss, "wheel_delta", ToString_PP_FloatPoint(wheel_delta)); + AddProp(ss, "wheel_ticks", ToString_PP_FloatPoint(wheel_ticks)); + AddProp(ss, "scroll_by_page", ToString_PP_Bool(scroll_by_page)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Resource(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_WheelInputEvent_1_0*)RealGetInterface("PPB_WheelInputEvent;1.0"))->Create(instance, time_stamp, modifiers, wheel_delta, wheel_ticks, scroll_by_page); + printf("RPC response: ["); + printf("%s", ToString_PP_Resource(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool IsWheelInputEvent_1_0(PP_Resource resource) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_WheelInputEvent\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"IsWheelInputEvent\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_WheelInputEvent_1_0*)RealGetInterface("PPB_WheelInputEvent;1.0"))->IsWheelInputEvent(resource); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static struct PP_FloatPoint GetDelta_1_0(PP_Resource wheel_event) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_WheelInputEvent\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"GetDelta\""); + AddProp(ss, "wheel_event", ToString_PP_Resource(wheel_event)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + struct PP_FloatPoint rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_FloatPoint(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + struct PP_FloatPoint rval = ((PPB_WheelInputEvent_1_0*)RealGetInterface("PPB_WheelInputEvent;1.0"))->GetDelta(wheel_event); + printf("RPC response: ["); + printf("%s", ToString_PP_FloatPoint(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static struct PP_FloatPoint GetTicks_1_0(PP_Resource wheel_event) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_WheelInputEvent\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"GetTicks\""); + AddProp(ss, "wheel_event", ToString_PP_Resource(wheel_event)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + struct PP_FloatPoint rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_FloatPoint(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + struct PP_FloatPoint rval = ((PPB_WheelInputEvent_1_0*)RealGetInterface("PPB_WheelInputEvent;1.0"))->GetTicks(wheel_event); + printf("RPC response: ["); + printf("%s", ToString_PP_FloatPoint(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool GetScrollByPage_1_0(PP_Resource wheel_event) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_WheelInputEvent\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"GetScrollByPage\""); + AddProp(ss, "wheel_event", ToString_PP_Resource(wheel_event)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_WheelInputEvent_1_0*)RealGetInterface("PPB_WheelInputEvent;1.0"))->GetScrollByPage(wheel_event); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +} +static PPB_WheelInputEvent_1_0 _PPB_WheelInputEvent_1_0 = { + ns_PPB_WheelInputEvent_1_0::Create_1_0, + ns_PPB_WheelInputEvent_1_0::IsWheelInputEvent_1_0, + ns_PPB_WheelInputEvent_1_0::GetDelta_1_0, + ns_PPB_WheelInputEvent_1_0::GetTicks_1_0, + ns_PPB_WheelInputEvent_1_0::GetScrollByPage_1_0, +}; +const string ToString_PPB_WheelInputEvent(const PPB_WheelInputEvent_1_0 *v) { + stringstream s; + s << v; + return s.str(); +} +namespace ns_PPB_KeyboardInputEvent_1_0 { +static PP_Resource Create_1_0(PP_Instance instance, PP_InputEvent_Type type, PP_TimeTicks time_stamp, uint32_t modifiers, uint32_t key_code, struct PP_Var character_text) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_KeyboardInputEvent\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"Create\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "type", ToString_PP_InputEvent_Type(type)); + AddProp(ss, "time_stamp", ToString_PP_TimeTicks(time_stamp)); + AddProp(ss, "modifiers", ToString_uint32_t(modifiers)); + AddProp(ss, "key_code", ToString_uint32_t(key_code)); + AddProp(ss, "character_text", ToString_PP_Var(character_text)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Resource(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_KeyboardInputEvent_1_0*)RealGetInterface("PPB_KeyboardInputEvent;1.0"))->Create(instance, type, time_stamp, modifiers, key_code, character_text); + printf("RPC response: ["); + printf("%s", ToString_PP_Resource(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +/* skipping Create */ +static PP_Bool IsKeyboardInputEvent_1_0(PP_Resource resource) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_KeyboardInputEvent\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"IsKeyboardInputEvent\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_KeyboardInputEvent_1_0*)RealGetInterface("PPB_KeyboardInputEvent;1.0"))->IsKeyboardInputEvent(resource); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static uint32_t GetKeyCode_1_0(PP_Resource key_event) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_KeyboardInputEvent\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"GetKeyCode\""); + AddProp(ss, "key_event", ToString_PP_Resource(key_event)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + uint32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_uint32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + uint32_t rval = ((PPB_KeyboardInputEvent_1_0*)RealGetInterface("PPB_KeyboardInputEvent;1.0"))->GetKeyCode(key_event); + printf("RPC response: ["); + printf("%s", ToString_uint32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static struct PP_Var GetCharacterText_1_0(PP_Resource character_event) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_KeyboardInputEvent\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"GetCharacterText\""); + AddProp(ss, "character_event", ToString_PP_Resource(character_event)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + struct PP_Var rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Var(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + struct PP_Var rval = ((PPB_KeyboardInputEvent_1_0*)RealGetInterface("PPB_KeyboardInputEvent;1.0"))->GetCharacterText(character_event); + printf("RPC response: ["); + printf("%s", ToString_PP_Var(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +/* skipping GetCode */ +} +static PPB_KeyboardInputEvent_1_0 _PPB_KeyboardInputEvent_1_0 = { + ns_PPB_KeyboardInputEvent_1_0::Create_1_0, + ns_PPB_KeyboardInputEvent_1_0::IsKeyboardInputEvent_1_0, + ns_PPB_KeyboardInputEvent_1_0::GetKeyCode_1_0, + ns_PPB_KeyboardInputEvent_1_0::GetCharacterText_1_0, +}; +const string ToString_PPB_KeyboardInputEvent(const PPB_KeyboardInputEvent_1_0 *v) { + stringstream s; + s << v; + return s.str(); +} +namespace ns_PPB_KeyboardInputEvent_1_2 { +/* skipping Create */ +static PP_Resource Create_1_2(PP_Instance instance, PP_InputEvent_Type type, PP_TimeTicks time_stamp, uint32_t modifiers, uint32_t key_code, struct PP_Var character_text, struct PP_Var code) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_KeyboardInputEvent\""); + AddProp(ss, "__version", "\"1.2\""); + AddProp(ss, "__method", "\"Create\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "type", ToString_PP_InputEvent_Type(type)); + AddProp(ss, "time_stamp", ToString_PP_TimeTicks(time_stamp)); + AddProp(ss, "modifiers", ToString_uint32_t(modifiers)); + AddProp(ss, "key_code", ToString_uint32_t(key_code)); + AddProp(ss, "character_text", ToString_PP_Var(character_text)); + AddProp(ss, "code", ToString_PP_Var(code)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Resource(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_KeyboardInputEvent_1_2*)RealGetInterface("PPB_KeyboardInputEvent;1.2"))->Create(instance, type, time_stamp, modifiers, key_code, character_text, code); + printf("RPC response: ["); + printf("%s", ToString_PP_Resource(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool IsKeyboardInputEvent_1_2(PP_Resource resource) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_KeyboardInputEvent\""); + AddProp(ss, "__version", "\"1.2\""); + AddProp(ss, "__method", "\"IsKeyboardInputEvent\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_KeyboardInputEvent_1_2*)RealGetInterface("PPB_KeyboardInputEvent;1.2"))->IsKeyboardInputEvent(resource); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static uint32_t GetKeyCode_1_2(PP_Resource key_event) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_KeyboardInputEvent\""); + AddProp(ss, "__version", "\"1.2\""); + AddProp(ss, "__method", "\"GetKeyCode\""); + AddProp(ss, "key_event", ToString_PP_Resource(key_event)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + uint32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_uint32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + uint32_t rval = ((PPB_KeyboardInputEvent_1_2*)RealGetInterface("PPB_KeyboardInputEvent;1.2"))->GetKeyCode(key_event); + printf("RPC response: ["); + printf("%s", ToString_uint32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static struct PP_Var GetCharacterText_1_2(PP_Resource character_event) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_KeyboardInputEvent\""); + AddProp(ss, "__version", "\"1.2\""); + AddProp(ss, "__method", "\"GetCharacterText\""); + AddProp(ss, "character_event", ToString_PP_Resource(character_event)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + struct PP_Var rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Var(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + struct PP_Var rval = ((PPB_KeyboardInputEvent_1_2*)RealGetInterface("PPB_KeyboardInputEvent;1.2"))->GetCharacterText(character_event); + printf("RPC response: ["); + printf("%s", ToString_PP_Var(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static struct PP_Var GetCode_1_2(PP_Resource key_event) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_KeyboardInputEvent\""); + AddProp(ss, "__version", "\"1.2\""); + AddProp(ss, "__method", "\"GetCode\""); + AddProp(ss, "key_event", ToString_PP_Resource(key_event)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + struct PP_Var rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Var(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + struct PP_Var rval = ((PPB_KeyboardInputEvent_1_2*)RealGetInterface("PPB_KeyboardInputEvent;1.2"))->GetCode(key_event); + printf("RPC response: ["); + printf("%s", ToString_PP_Var(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +} +static PPB_KeyboardInputEvent_1_2 _PPB_KeyboardInputEvent_1_2 = { + ns_PPB_KeyboardInputEvent_1_2::Create_1_2, + ns_PPB_KeyboardInputEvent_1_2::IsKeyboardInputEvent_1_2, + ns_PPB_KeyboardInputEvent_1_2::GetKeyCode_1_2, + ns_PPB_KeyboardInputEvent_1_2::GetCharacterText_1_2, + ns_PPB_KeyboardInputEvent_1_2::GetCode_1_2, +}; +const string ToString_PPB_KeyboardInputEvent(const PPB_KeyboardInputEvent_1_2 *v) { + stringstream s; + s << v; + return s.str(); +} +const string ToString_PP_TouchListType(const PP_TouchListType *v) { + switch (*v) { + case 0: + return "\"PP_TOUCHLIST_TYPE_TOUCHES\""; + case 1: + return "\"PP_TOUCHLIST_TYPE_CHANGEDTOUCHES\""; + case 2: + return "\"PP_TOUCHLIST_TYPE_TARGETTOUCHES\""; + default: + return "\"???\""; + } +} +const string ToString_PP_TouchListType(const PP_TouchListType &v) { + return ToString_PP_TouchListType(&v); +} +void FromJSON_PP_TouchListType(JSONIterator& iterator, PP_TouchListType &value) { + long int v; + FromJSON_int(iterator, v); + value = PP_TouchListType(v); +} +namespace ns_PPB_TouchInputEvent_1_0 { +static PP_Resource Create_1_0(PP_Instance instance, PP_InputEvent_Type type, PP_TimeTicks time_stamp, uint32_t modifiers) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_TouchInputEvent\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"Create\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "type", ToString_PP_InputEvent_Type(type)); + AddProp(ss, "time_stamp", ToString_PP_TimeTicks(time_stamp)); + AddProp(ss, "modifiers", ToString_uint32_t(modifiers)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Resource(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_TouchInputEvent_1_0*)RealGetInterface("PPB_TouchInputEvent;1.0"))->Create(instance, type, time_stamp, modifiers); + printf("RPC response: ["); + printf("%s", ToString_PP_Resource(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static void AddTouchPoint_1_0(PP_Resource touch_event, PP_TouchListType list, const struct PP_TouchPoint* point) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_TouchInputEvent\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"AddTouchPoint\""); + AddProp(ss, "touch_event", ToString_PP_Resource(touch_event)); + AddProp(ss, "list", ToString_PP_TouchListType(list)); + AddProp(ss, "point", ToString_PP_TouchPoint(point)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_TouchInputEvent_1_0*)RealGetInterface("PPB_TouchInputEvent;1.0"))->AddTouchPoint(touch_event, list, point); +#endif // !INTERPOSE +} +static PP_Bool IsTouchInputEvent_1_0(PP_Resource resource) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_TouchInputEvent\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"IsTouchInputEvent\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_TouchInputEvent_1_0*)RealGetInterface("PPB_TouchInputEvent;1.0"))->IsTouchInputEvent(resource); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static uint32_t GetTouchCount_1_0(PP_Resource resource, PP_TouchListType list) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_TouchInputEvent\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"GetTouchCount\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + AddProp(ss, "list", ToString_PP_TouchListType(list)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + uint32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_uint32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + uint32_t rval = ((PPB_TouchInputEvent_1_0*)RealGetInterface("PPB_TouchInputEvent;1.0"))->GetTouchCount(resource, list); + printf("RPC response: ["); + printf("%s", ToString_uint32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static struct PP_TouchPoint GetTouchByIndex_1_0(PP_Resource resource, PP_TouchListType list, uint32_t index) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_TouchInputEvent\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"GetTouchByIndex\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + AddProp(ss, "list", ToString_PP_TouchListType(list)); + AddProp(ss, "index", ToString_uint32_t(index)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + struct PP_TouchPoint rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_TouchPoint(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + struct PP_TouchPoint rval = ((PPB_TouchInputEvent_1_0*)RealGetInterface("PPB_TouchInputEvent;1.0"))->GetTouchByIndex(resource, list, index); + printf("RPC response: ["); + printf("%s", ToString_PP_TouchPoint(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static struct PP_TouchPoint GetTouchById_1_0(PP_Resource resource, PP_TouchListType list, uint32_t touch_id) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_TouchInputEvent\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"GetTouchById\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + AddProp(ss, "list", ToString_PP_TouchListType(list)); + AddProp(ss, "touch_id", ToString_uint32_t(touch_id)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + struct PP_TouchPoint rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_TouchPoint(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + struct PP_TouchPoint rval = ((PPB_TouchInputEvent_1_0*)RealGetInterface("PPB_TouchInputEvent;1.0"))->GetTouchById(resource, list, touch_id); + printf("RPC response: ["); + printf("%s", ToString_PP_TouchPoint(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +} +static PPB_TouchInputEvent_1_0 _PPB_TouchInputEvent_1_0 = { + ns_PPB_TouchInputEvent_1_0::Create_1_0, + ns_PPB_TouchInputEvent_1_0::AddTouchPoint_1_0, + ns_PPB_TouchInputEvent_1_0::IsTouchInputEvent_1_0, + ns_PPB_TouchInputEvent_1_0::GetTouchCount_1_0, + ns_PPB_TouchInputEvent_1_0::GetTouchByIndex_1_0, + ns_PPB_TouchInputEvent_1_0::GetTouchById_1_0, +}; +const string ToString_PPB_TouchInputEvent(const PPB_TouchInputEvent_1_0 *v) { + stringstream s; + s << v; + return s.str(); +} +namespace ns_PPB_IMEInputEvent_1_0 { +static PP_Resource Create_1_0(PP_Instance instance, PP_InputEvent_Type type, PP_TimeTicks time_stamp, struct PP_Var text, uint32_t segment_number, const uint32_t segment_offsets[], int32_t target_segment, uint32_t selection_start, uint32_t selection_end) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_IMEInputEvent\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"Create\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "type", ToString_PP_InputEvent_Type(type)); + AddProp(ss, "time_stamp", ToString_PP_TimeTicks(time_stamp)); + AddProp(ss, "text", ToString_PP_Var(text)); + AddProp(ss, "segment_number", ToString_uint32_t(segment_number)); + { + BeginProp(ss, "segment_offsets"); + BeginElements(ss); + for (uint32_t _n = 0; segment_offsets[_n] != 0; ++_n) { + AddElement(ss, ToString_uint32_t(segment_offsets[_n])); + } + EndElements(ss); + } + AddProp(ss, "target_segment", ToString_int32_t(target_segment)); + AddProp(ss, "selection_start", ToString_uint32_t(selection_start)); + AddProp(ss, "selection_end", ToString_uint32_t(selection_end)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Resource(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_IMEInputEvent_1_0*)RealGetInterface("PPB_IMEInputEvent;1.0"))->Create(instance, type, time_stamp, text, segment_number, segment_offsets, target_segment, selection_start, selection_end); + printf("RPC response: ["); + printf("%s", ToString_PP_Resource(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool IsIMEInputEvent_1_0(PP_Resource resource) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_IMEInputEvent\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"IsIMEInputEvent\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_IMEInputEvent_1_0*)RealGetInterface("PPB_IMEInputEvent;1.0"))->IsIMEInputEvent(resource); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static struct PP_Var GetText_1_0(PP_Resource ime_event) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_IMEInputEvent\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"GetText\""); + AddProp(ss, "ime_event", ToString_PP_Resource(ime_event)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + struct PP_Var rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Var(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + struct PP_Var rval = ((PPB_IMEInputEvent_1_0*)RealGetInterface("PPB_IMEInputEvent;1.0"))->GetText(ime_event); + printf("RPC response: ["); + printf("%s", ToString_PP_Var(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static uint32_t GetSegmentNumber_1_0(PP_Resource ime_event) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_IMEInputEvent\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"GetSegmentNumber\""); + AddProp(ss, "ime_event", ToString_PP_Resource(ime_event)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + uint32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_uint32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + uint32_t rval = ((PPB_IMEInputEvent_1_0*)RealGetInterface("PPB_IMEInputEvent;1.0"))->GetSegmentNumber(ime_event); + printf("RPC response: ["); + printf("%s", ToString_uint32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static uint32_t GetSegmentOffset_1_0(PP_Resource ime_event, uint32_t index) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_IMEInputEvent\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"GetSegmentOffset\""); + AddProp(ss, "ime_event", ToString_PP_Resource(ime_event)); + AddProp(ss, "index", ToString_uint32_t(index)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + uint32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_uint32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + uint32_t rval = ((PPB_IMEInputEvent_1_0*)RealGetInterface("PPB_IMEInputEvent;1.0"))->GetSegmentOffset(ime_event, index); + printf("RPC response: ["); + printf("%s", ToString_uint32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t GetTargetSegment_1_0(PP_Resource ime_event) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_IMEInputEvent\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"GetTargetSegment\""); + AddProp(ss, "ime_event", ToString_PP_Resource(ime_event)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_IMEInputEvent_1_0*)RealGetInterface("PPB_IMEInputEvent;1.0"))->GetTargetSegment(ime_event); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static void GetSelection_1_0(PP_Resource ime_event, uint32_t* start, uint32_t* end) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_IMEInputEvent\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"GetSelection\""); + AddProp(ss, "ime_event", ToString_PP_Resource(ime_event)); + AddProp(ss, "start", PointerToString(start)); + AddProp(ss, "end", PointerToString(end)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectObjectAndGotoFirstProperty(); + iterator.skip(); + FromJSON_uint32_t(iterator, *start); + iterator.skip(); + FromJSON_uint32_t(iterator, *end); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_IMEInputEvent_1_0*)RealGetInterface("PPB_IMEInputEvent;1.0"))->GetSelection(ime_event, start, end); + printf("RPC response: ["); + printf("["); + std::stringstream os; + BeginProps(os); + if (!!start) { + AddProp(os, "start", ToString_uint32_t(start)); + } + if (!!end) { + AddProp(os, "end", ToString_uint32_t(end)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); +#endif // !INTERPOSE +} +} +static PPB_IMEInputEvent_1_0 _PPB_IMEInputEvent_1_0 = { + ns_PPB_IMEInputEvent_1_0::Create_1_0, + ns_PPB_IMEInputEvent_1_0::IsIMEInputEvent_1_0, + ns_PPB_IMEInputEvent_1_0::GetText_1_0, + ns_PPB_IMEInputEvent_1_0::GetSegmentNumber_1_0, + ns_PPB_IMEInputEvent_1_0::GetSegmentOffset_1_0, + ns_PPB_IMEInputEvent_1_0::GetTargetSegment_1_0, + ns_PPB_IMEInputEvent_1_0::GetSelection_1_0, +}; +const string ToString_PPB_IMEInputEvent(const PPB_IMEInputEvent_1_0 *v) { + stringstream s; + s << v; + return s.str(); +} +namespace ns_PPB_Instance_1_0 { +static PP_Bool BindGraphics_1_0(PP_Instance instance, PP_Resource device) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Instance\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"BindGraphics\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "device", ToString_PP_Resource(device)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_Instance_1_0*)RealGetInterface("PPB_Instance;1.0"))->BindGraphics(instance, device); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool IsFullFrame_1_0(PP_Instance instance) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Instance\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"IsFullFrame\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_Instance_1_0*)RealGetInterface("PPB_Instance;1.0"))->IsFullFrame(instance); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +} +static PPB_Instance_1_0 _PPB_Instance_1_0 = { + ns_PPB_Instance_1_0::BindGraphics_1_0, + ns_PPB_Instance_1_0::IsFullFrame_1_0, +}; +const string ToString_PPB_Instance(const PPB_Instance_1_0 *v) { + stringstream s; + s << v; + return s.str(); +} +const string ToString_PP_MediaStreamAudioTrack_Attrib(const PP_MediaStreamAudioTrack_Attrib *v) { + switch (*v) { + case 0: + return "\"PP_MEDIASTREAMAUDIOTRACK_ATTRIB_NONE\""; + case 1: + return "\"PP_MEDIASTREAMAUDIOTRACK_ATTRIB_BUFFERS\""; + case 2: + return "\"PP_MEDIASTREAMAUDIOTRACK_ATTRIB_SAMPLE_RATE\""; + case 3: + return "\"PP_MEDIASTREAMAUDIOTRACK_ATTRIB_SAMPLE_SIZE\""; + case 4: + return "\"PP_MEDIASTREAMAUDIOTRACK_ATTRIB_CHANNELS\""; + case 5: + return "\"PP_MEDIASTREAMAUDIOTRACK_ATTRIB_DURATION\""; + default: + return "\"???\""; + } +} +const string ToString_PP_MediaStreamAudioTrack_Attrib(const PP_MediaStreamAudioTrack_Attrib &v) { + return ToString_PP_MediaStreamAudioTrack_Attrib(&v); +} +void FromJSON_PP_MediaStreamAudioTrack_Attrib(JSONIterator& iterator, PP_MediaStreamAudioTrack_Attrib &value) { + long int v; + FromJSON_int(iterator, v); + value = PP_MediaStreamAudioTrack_Attrib(v); +} +namespace ns_PPB_MediaStreamAudioTrack_0_1 { +static PP_Bool IsMediaStreamAudioTrack_0_1(PP_Resource resource) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_MediaStreamAudioTrack\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"IsMediaStreamAudioTrack\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_MediaStreamAudioTrack_0_1*)RealGetInterface("PPB_MediaStreamAudioTrack;0.1"))->IsMediaStreamAudioTrack(resource); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t Configure_0_1(PP_Resource audio_track, const int32_t attrib_list[], struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_MediaStreamAudioTrack\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"Configure\""); + AddProp(ss, "audio_track", ToString_PP_Resource(audio_track)); + { + BeginProp(ss, "attrib_list"); + BeginElements(ss); + for (uint32_t _n = 0; attrib_list[_n] != PP_MEDIASTREAMAUDIOTRACK_ATTRIB_NONE; ++_n) { + AddElement(ss, ToString_int32_t(attrib_list[_n])); + } + EndElements(ss); + } + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_MediaStreamAudioTrack_0_1*)RealGetInterface("PPB_MediaStreamAudioTrack;0.1"))->Configure(audio_track, attrib_list, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t GetAttrib_0_1(PP_Resource audio_track, PP_MediaStreamAudioTrack_Attrib attrib, int32_t* value) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_MediaStreamAudioTrack\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"GetAttrib\""); + AddProp(ss, "audio_track", ToString_PP_Resource(audio_track)); + AddProp(ss, "attrib", ToString_PP_MediaStreamAudioTrack_Attrib(attrib)); + AddProp(ss, "value", PointerToString(value)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + iterator.skip(); + FromJSON_int32_t(iterator, *value); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_MediaStreamAudioTrack_0_1*)RealGetInterface("PPB_MediaStreamAudioTrack;0.1"))->GetAttrib(audio_track, attrib, value); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_int32_t(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + if (!!value) { + AddProp(os, "value", ToString_int32_t(value)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static struct PP_Var GetId_0_1(PP_Resource audio_track) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_MediaStreamAudioTrack\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"GetId\""); + AddProp(ss, "audio_track", ToString_PP_Resource(audio_track)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + struct PP_Var rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Var(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + struct PP_Var rval = ((PPB_MediaStreamAudioTrack_0_1*)RealGetInterface("PPB_MediaStreamAudioTrack;0.1"))->GetId(audio_track); + printf("RPC response: ["); + printf("%s", ToString_PP_Var(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool HasEnded_0_1(PP_Resource audio_track) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_MediaStreamAudioTrack\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"HasEnded\""); + AddProp(ss, "audio_track", ToString_PP_Resource(audio_track)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_MediaStreamAudioTrack_0_1*)RealGetInterface("PPB_MediaStreamAudioTrack;0.1"))->HasEnded(audio_track); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t GetBuffer_0_1(PP_Resource audio_track, PP_Resource* buffer, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_MediaStreamAudioTrack\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"GetBuffer\""); + AddProp(ss, "audio_track", ToString_PP_Resource(audio_track)); + AddProp(ss, "buffer", PointerToString(buffer)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + iterator.skip(); + FromJSON_PP_Resource(iterator, *buffer); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_MediaStreamAudioTrack_0_1*)RealGetInterface("PPB_MediaStreamAudioTrack;0.1"))->GetBuffer(audio_track, buffer, logging_callback); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_int32_t(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + if (!!buffer) { + AddProp(os, "buffer", ToString_PP_Resource(buffer)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t RecycleBuffer_0_1(PP_Resource audio_track, PP_Resource buffer) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_MediaStreamAudioTrack\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"RecycleBuffer\""); + AddProp(ss, "audio_track", ToString_PP_Resource(audio_track)); + AddProp(ss, "buffer", ToString_PP_Resource(buffer)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_MediaStreamAudioTrack_0_1*)RealGetInterface("PPB_MediaStreamAudioTrack;0.1"))->RecycleBuffer(audio_track, buffer); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static void Close_0_1(PP_Resource audio_track) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_MediaStreamAudioTrack\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"Close\""); + AddProp(ss, "audio_track", ToString_PP_Resource(audio_track)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_MediaStreamAudioTrack_0_1*)RealGetInterface("PPB_MediaStreamAudioTrack;0.1"))->Close(audio_track); +#endif // !INTERPOSE +} +} +static PPB_MediaStreamAudioTrack_0_1 _PPB_MediaStreamAudioTrack_0_1 = { + ns_PPB_MediaStreamAudioTrack_0_1::IsMediaStreamAudioTrack_0_1, + ns_PPB_MediaStreamAudioTrack_0_1::Configure_0_1, + ns_PPB_MediaStreamAudioTrack_0_1::GetAttrib_0_1, + ns_PPB_MediaStreamAudioTrack_0_1::GetId_0_1, + ns_PPB_MediaStreamAudioTrack_0_1::HasEnded_0_1, + ns_PPB_MediaStreamAudioTrack_0_1::GetBuffer_0_1, + ns_PPB_MediaStreamAudioTrack_0_1::RecycleBuffer_0_1, + ns_PPB_MediaStreamAudioTrack_0_1::Close_0_1, +}; +const string ToString_PPB_MediaStreamAudioTrack(const PPB_MediaStreamAudioTrack_0_1 *v) { + stringstream s; + s << v; + return s.str(); +} +const string ToString_PP_MediaStreamVideoTrack_Attrib(const PP_MediaStreamVideoTrack_Attrib *v) { + switch (*v) { + case 0: + return "\"PP_MEDIASTREAMVIDEOTRACK_ATTRIB_NONE\""; + case 1: + return "\"PP_MEDIASTREAMVIDEOTRACK_ATTRIB_BUFFERED_FRAMES\""; + case 2: + return "\"PP_MEDIASTREAMVIDEOTRACK_ATTRIB_WIDTH\""; + case 3: + return "\"PP_MEDIASTREAMVIDEOTRACK_ATTRIB_HEIGHT\""; + case 4: + return "\"PP_MEDIASTREAMVIDEOTRACK_ATTRIB_FORMAT\""; + default: + return "\"???\""; + } +} +const string ToString_PP_MediaStreamVideoTrack_Attrib(const PP_MediaStreamVideoTrack_Attrib &v) { + return ToString_PP_MediaStreamVideoTrack_Attrib(&v); +} +void FromJSON_PP_MediaStreamVideoTrack_Attrib(JSONIterator& iterator, PP_MediaStreamVideoTrack_Attrib &value) { + long int v; + FromJSON_int(iterator, v); + value = PP_MediaStreamVideoTrack_Attrib(v); +} +namespace ns_PPB_MediaStreamVideoTrack_0_1 { +/* skipping Create */ +static PP_Bool IsMediaStreamVideoTrack_0_1(PP_Resource resource) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_MediaStreamVideoTrack\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"IsMediaStreamVideoTrack\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_MediaStreamVideoTrack_0_1*)RealGetInterface("PPB_MediaStreamVideoTrack;0.1"))->IsMediaStreamVideoTrack(resource); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t Configure_0_1(PP_Resource video_track, const int32_t attrib_list[], struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_MediaStreamVideoTrack\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"Configure\""); + AddProp(ss, "video_track", ToString_PP_Resource(video_track)); + { + BeginProp(ss, "attrib_list"); + BeginElements(ss); + for (uint32_t _n = 0; attrib_list[_n] != 0; ++_n) { + AddElement(ss, ToString_int32_t(attrib_list[_n])); + } + EndElements(ss); + } + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_MediaStreamVideoTrack_0_1*)RealGetInterface("PPB_MediaStreamVideoTrack;0.1"))->Configure(video_track, attrib_list, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t GetAttrib_0_1(PP_Resource video_track, PP_MediaStreamVideoTrack_Attrib attrib, int32_t* value) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_MediaStreamVideoTrack\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"GetAttrib\""); + AddProp(ss, "video_track", ToString_PP_Resource(video_track)); + AddProp(ss, "attrib", ToString_PP_MediaStreamVideoTrack_Attrib(attrib)); + AddProp(ss, "value", PointerToString(value)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + iterator.skip(); + FromJSON_int32_t(iterator, *value); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_MediaStreamVideoTrack_0_1*)RealGetInterface("PPB_MediaStreamVideoTrack;0.1"))->GetAttrib(video_track, attrib, value); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_int32_t(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + if (!!value) { + AddProp(os, "value", ToString_int32_t(value)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static struct PP_Var GetId_0_1(PP_Resource video_track) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_MediaStreamVideoTrack\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"GetId\""); + AddProp(ss, "video_track", ToString_PP_Resource(video_track)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + struct PP_Var rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Var(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + struct PP_Var rval = ((PPB_MediaStreamVideoTrack_0_1*)RealGetInterface("PPB_MediaStreamVideoTrack;0.1"))->GetId(video_track); + printf("RPC response: ["); + printf("%s", ToString_PP_Var(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool HasEnded_0_1(PP_Resource video_track) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_MediaStreamVideoTrack\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"HasEnded\""); + AddProp(ss, "video_track", ToString_PP_Resource(video_track)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_MediaStreamVideoTrack_0_1*)RealGetInterface("PPB_MediaStreamVideoTrack;0.1"))->HasEnded(video_track); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t GetFrame_0_1(PP_Resource video_track, PP_Resource* frame, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_MediaStreamVideoTrack\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"GetFrame\""); + AddProp(ss, "video_track", ToString_PP_Resource(video_track)); + AddProp(ss, "frame", PointerToString(frame)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + iterator.skip(); + FromJSON_PP_Resource(iterator, *frame); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_MediaStreamVideoTrack_0_1*)RealGetInterface("PPB_MediaStreamVideoTrack;0.1"))->GetFrame(video_track, frame, logging_callback); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_int32_t(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + if (!!frame) { + AddProp(os, "frame", ToString_PP_Resource(frame)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t RecycleFrame_0_1(PP_Resource video_track, PP_Resource frame) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_MediaStreamVideoTrack\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"RecycleFrame\""); + AddProp(ss, "video_track", ToString_PP_Resource(video_track)); + AddProp(ss, "frame", ToString_PP_Resource(frame)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_MediaStreamVideoTrack_0_1*)RealGetInterface("PPB_MediaStreamVideoTrack;0.1"))->RecycleFrame(video_track, frame); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static void Close_0_1(PP_Resource video_track) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_MediaStreamVideoTrack\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"Close\""); + AddProp(ss, "video_track", ToString_PP_Resource(video_track)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_MediaStreamVideoTrack_0_1*)RealGetInterface("PPB_MediaStreamVideoTrack;0.1"))->Close(video_track); +#endif // !INTERPOSE +} +/* skipping GetEmptyFrame */ +/* skipping PutFrame */ +} +static PPB_MediaStreamVideoTrack_0_1 _PPB_MediaStreamVideoTrack_0_1 = { + ns_PPB_MediaStreamVideoTrack_0_1::IsMediaStreamVideoTrack_0_1, + ns_PPB_MediaStreamVideoTrack_0_1::Configure_0_1, + ns_PPB_MediaStreamVideoTrack_0_1::GetAttrib_0_1, + ns_PPB_MediaStreamVideoTrack_0_1::GetId_0_1, + ns_PPB_MediaStreamVideoTrack_0_1::HasEnded_0_1, + ns_PPB_MediaStreamVideoTrack_0_1::GetFrame_0_1, + ns_PPB_MediaStreamVideoTrack_0_1::RecycleFrame_0_1, + ns_PPB_MediaStreamVideoTrack_0_1::Close_0_1, +}; +const string ToString_PPB_MediaStreamVideoTrack(const PPB_MediaStreamVideoTrack_0_1 *v) { + stringstream s; + s << v; + return s.str(); +} +namespace ns_PPB_MediaStreamVideoTrack_1_0 { +static PP_Resource Create_1_0(PP_Instance instance) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_MediaStreamVideoTrack\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"Create\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Resource(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_MediaStreamVideoTrack_1_0*)RealGetInterface("PPB_MediaStreamVideoTrack;1.0"))->Create(instance); + printf("RPC response: ["); + printf("%s", ToString_PP_Resource(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool IsMediaStreamVideoTrack_1_0(PP_Resource resource) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_MediaStreamVideoTrack\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"IsMediaStreamVideoTrack\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_MediaStreamVideoTrack_1_0*)RealGetInterface("PPB_MediaStreamVideoTrack;1.0"))->IsMediaStreamVideoTrack(resource); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t Configure_1_0(PP_Resource video_track, const int32_t attrib_list[], struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_MediaStreamVideoTrack\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"Configure\""); + AddProp(ss, "video_track", ToString_PP_Resource(video_track)); + { + BeginProp(ss, "attrib_list"); + BeginElements(ss); + for (uint32_t _n = 0; attrib_list[_n] != 0; ++_n) { + AddElement(ss, ToString_int32_t(attrib_list[_n])); + } + EndElements(ss); + } + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_MediaStreamVideoTrack_1_0*)RealGetInterface("PPB_MediaStreamVideoTrack;1.0"))->Configure(video_track, attrib_list, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t GetAttrib_1_0(PP_Resource video_track, PP_MediaStreamVideoTrack_Attrib attrib, int32_t* value) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_MediaStreamVideoTrack\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"GetAttrib\""); + AddProp(ss, "video_track", ToString_PP_Resource(video_track)); + AddProp(ss, "attrib", ToString_PP_MediaStreamVideoTrack_Attrib(attrib)); + AddProp(ss, "value", PointerToString(value)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + iterator.skip(); + FromJSON_int32_t(iterator, *value); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_MediaStreamVideoTrack_1_0*)RealGetInterface("PPB_MediaStreamVideoTrack;1.0"))->GetAttrib(video_track, attrib, value); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_int32_t(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + if (!!value) { + AddProp(os, "value", ToString_int32_t(value)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static struct PP_Var GetId_1_0(PP_Resource video_track) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_MediaStreamVideoTrack\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"GetId\""); + AddProp(ss, "video_track", ToString_PP_Resource(video_track)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + struct PP_Var rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Var(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + struct PP_Var rval = ((PPB_MediaStreamVideoTrack_1_0*)RealGetInterface("PPB_MediaStreamVideoTrack;1.0"))->GetId(video_track); + printf("RPC response: ["); + printf("%s", ToString_PP_Var(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool HasEnded_1_0(PP_Resource video_track) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_MediaStreamVideoTrack\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"HasEnded\""); + AddProp(ss, "video_track", ToString_PP_Resource(video_track)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_MediaStreamVideoTrack_1_0*)RealGetInterface("PPB_MediaStreamVideoTrack;1.0"))->HasEnded(video_track); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t GetFrame_1_0(PP_Resource video_track, PP_Resource* frame, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_MediaStreamVideoTrack\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"GetFrame\""); + AddProp(ss, "video_track", ToString_PP_Resource(video_track)); + AddProp(ss, "frame", PointerToString(frame)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + iterator.skip(); + FromJSON_PP_Resource(iterator, *frame); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_MediaStreamVideoTrack_1_0*)RealGetInterface("PPB_MediaStreamVideoTrack;1.0"))->GetFrame(video_track, frame, logging_callback); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_int32_t(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + if (!!frame) { + AddProp(os, "frame", ToString_PP_Resource(frame)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t RecycleFrame_1_0(PP_Resource video_track, PP_Resource frame) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_MediaStreamVideoTrack\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"RecycleFrame\""); + AddProp(ss, "video_track", ToString_PP_Resource(video_track)); + AddProp(ss, "frame", ToString_PP_Resource(frame)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_MediaStreamVideoTrack_1_0*)RealGetInterface("PPB_MediaStreamVideoTrack;1.0"))->RecycleFrame(video_track, frame); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static void Close_1_0(PP_Resource video_track) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_MediaStreamVideoTrack\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"Close\""); + AddProp(ss, "video_track", ToString_PP_Resource(video_track)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_MediaStreamVideoTrack_1_0*)RealGetInterface("PPB_MediaStreamVideoTrack;1.0"))->Close(video_track); +#endif // !INTERPOSE +} +static int32_t GetEmptyFrame_1_0(PP_Resource video_track, PP_Resource* frame, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_MediaStreamVideoTrack\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"GetEmptyFrame\""); + AddProp(ss, "video_track", ToString_PP_Resource(video_track)); + AddProp(ss, "frame", PointerToString(frame)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + iterator.skip(); + FromJSON_PP_Resource(iterator, *frame); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_MediaStreamVideoTrack_1_0*)RealGetInterface("PPB_MediaStreamVideoTrack;1.0"))->GetEmptyFrame(video_track, frame, logging_callback); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_int32_t(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + if (!!frame) { + AddProp(os, "frame", ToString_PP_Resource(frame)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t PutFrame_1_0(PP_Resource video_track, PP_Resource frame) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_MediaStreamVideoTrack\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"PutFrame\""); + AddProp(ss, "video_track", ToString_PP_Resource(video_track)); + AddProp(ss, "frame", ToString_PP_Resource(frame)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_MediaStreamVideoTrack_1_0*)RealGetInterface("PPB_MediaStreamVideoTrack;1.0"))->PutFrame(video_track, frame); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +} +static PPB_MediaStreamVideoTrack_1_0 _PPB_MediaStreamVideoTrack_1_0 = { + ns_PPB_MediaStreamVideoTrack_1_0::Create_1_0, + ns_PPB_MediaStreamVideoTrack_1_0::IsMediaStreamVideoTrack_1_0, + ns_PPB_MediaStreamVideoTrack_1_0::Configure_1_0, + ns_PPB_MediaStreamVideoTrack_1_0::GetAttrib_1_0, + ns_PPB_MediaStreamVideoTrack_1_0::GetId_1_0, + ns_PPB_MediaStreamVideoTrack_1_0::HasEnded_1_0, + ns_PPB_MediaStreamVideoTrack_1_0::GetFrame_1_0, + ns_PPB_MediaStreamVideoTrack_1_0::RecycleFrame_1_0, + ns_PPB_MediaStreamVideoTrack_1_0::Close_1_0, + ns_PPB_MediaStreamVideoTrack_1_0::GetEmptyFrame_1_0, + ns_PPB_MediaStreamVideoTrack_1_0::PutFrame_1_0, +}; +const string ToString_PPB_MediaStreamVideoTrack(const PPB_MediaStreamVideoTrack_1_0 *v) { + stringstream s; + s << v; + return s.str(); +} +namespace ns_PPB_MessageLoop_1_0 { +static PP_Resource Create_1_0(PP_Instance instance) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_MessageLoop\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"Create\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Resource(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_MessageLoop_1_0*)RealGetInterface("PPB_MessageLoop;1.0"))->Create(instance); + printf("RPC response: ["); + printf("%s", ToString_PP_Resource(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Resource GetForMainThread_1_0(void) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_MessageLoop\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"GetForMainThread\""); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Resource(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_MessageLoop_1_0*)RealGetInterface("PPB_MessageLoop;1.0"))->GetForMainThread(); + printf("RPC response: ["); + printf("%s", ToString_PP_Resource(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Resource GetCurrent_1_0(void) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_MessageLoop\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"GetCurrent\""); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Resource(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_MessageLoop_1_0*)RealGetInterface("PPB_MessageLoop;1.0"))->GetCurrent(); + printf("RPC response: ["); + printf("%s", ToString_PP_Resource(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t AttachToCurrentThread_1_0(PP_Resource message_loop) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_MessageLoop\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"AttachToCurrentThread\""); + AddProp(ss, "message_loop", ToString_PP_Resource(message_loop)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_MessageLoop_1_0*)RealGetInterface("PPB_MessageLoop;1.0"))->AttachToCurrentThread(message_loop); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t Run_1_0(PP_Resource message_loop) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_MessageLoop\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"Run\""); + AddProp(ss, "message_loop", ToString_PP_Resource(message_loop)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_MessageLoop_1_0*)RealGetInterface("PPB_MessageLoop;1.0"))->Run(message_loop); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t PostWork_1_0(PP_Resource message_loop, struct PP_CompletionCallback callback, int64_t delay_ms) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_MessageLoop\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"PostWork\""); + AddProp(ss, "message_loop", ToString_PP_Resource(message_loop)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + AddProp(ss, "delay_ms", ToString_int64_t(delay_ms)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_MessageLoop_1_0*)RealGetInterface("PPB_MessageLoop;1.0"))->PostWork(message_loop, logging_callback, delay_ms); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t PostQuit_1_0(PP_Resource message_loop, PP_Bool should_destroy) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_MessageLoop\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"PostQuit\""); + AddProp(ss, "message_loop", ToString_PP_Resource(message_loop)); + AddProp(ss, "should_destroy", ToString_PP_Bool(should_destroy)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_MessageLoop_1_0*)RealGetInterface("PPB_MessageLoop;1.0"))->PostQuit(message_loop, should_destroy); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +} +static PPB_MessageLoop_1_0 _PPB_MessageLoop_1_0 = { + ns_PPB_MessageLoop_1_0::Create_1_0, + ns_PPB_MessageLoop_1_0::GetForMainThread_1_0, + ns_PPB_MessageLoop_1_0::GetCurrent_1_0, + ns_PPB_MessageLoop_1_0::AttachToCurrentThread_1_0, + ns_PPB_MessageLoop_1_0::Run_1_0, + ns_PPB_MessageLoop_1_0::PostWork_1_0, + ns_PPB_MessageLoop_1_0::PostQuit_1_0, +}; +const string ToString_PPB_MessageLoop(const PPB_MessageLoop_1_0 *v) { + stringstream s; + s << v; + return s.str(); +} +namespace ns_PPB_Messaging_1_0 { +static void PostMessage_1_0(PP_Instance instance, struct PP_Var message) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Messaging\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"PostMessage\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "message", ToString_PP_Var(message)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_Messaging_1_0*)RealGetInterface("PPB_Messaging;1.0"))->PostMessage(instance, message); +#endif // !INTERPOSE +} +/* skipping RegisterMessageHandler */ +/* skipping UnregisterMessageHandler */ +} +static PPB_Messaging_1_0 _PPB_Messaging_1_0 = { + ns_PPB_Messaging_1_0::PostMessage_1_0, +}; +const string ToString_PPB_Messaging(const PPB_Messaging_1_0 *v) { + stringstream s; + s << v; + return s.str(); +} +namespace ns_PPB_Messaging_1_2 { +static void PostMessage_1_2(PP_Instance instance, struct PP_Var message) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Messaging\""); + AddProp(ss, "__version", "\"1.2\""); + AddProp(ss, "__method", "\"PostMessage\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "message", ToString_PP_Var(message)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_Messaging_1_2*)RealGetInterface("PPB_Messaging;1.2"))->PostMessage(instance, message); +#endif // !INTERPOSE +} +static int32_t RegisterMessageHandler_1_2(PP_Instance instance, void* user_data, const struct PPP_MessageHandler_0_2* handler, PP_Resource message_loop) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Messaging\""); + AddProp(ss, "__version", "\"1.2\""); + AddProp(ss, "__method", "\"RegisterMessageHandler\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "user_data", ToString_mem_t(user_data)); + AddProp(ss, "handler", ToString_PPP_MessageHandler(handler)); + AddProp(ss, "message_loop", ToString_PP_Resource(message_loop)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_Messaging_1_2*)RealGetInterface("PPB_Messaging;1.2"))->RegisterMessageHandler(instance, user_data, handler, message_loop); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static void UnregisterMessageHandler_1_2(PP_Instance instance) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Messaging\""); + AddProp(ss, "__version", "\"1.2\""); + AddProp(ss, "__method", "\"UnregisterMessageHandler\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_Messaging_1_2*)RealGetInterface("PPB_Messaging;1.2"))->UnregisterMessageHandler(instance); +#endif // !INTERPOSE +} +} +static PPB_Messaging_1_2 _PPB_Messaging_1_2 = { + ns_PPB_Messaging_1_2::PostMessage_1_2, + ns_PPB_Messaging_1_2::RegisterMessageHandler_1_2, + ns_PPB_Messaging_1_2::UnregisterMessageHandler_1_2, +}; +const string ToString_PPB_Messaging(const PPB_Messaging_1_2 *v) { + stringstream s; + s << v; + return s.str(); +} +const string ToString_PP_MouseCursor_Type(const PP_MouseCursor_Type *v) { + switch (*v) { + case -1: + return "\"PP_MOUSECURSOR_TYPE_CUSTOM\""; + case 0: + return "\"PP_MOUSECURSOR_TYPE_POINTER\""; + case 1: + return "\"PP_MOUSECURSOR_TYPE_CROSS\""; + case 2: + return "\"PP_MOUSECURSOR_TYPE_HAND\""; + case 3: + return "\"PP_MOUSECURSOR_TYPE_IBEAM\""; + case 4: + return "\"PP_MOUSECURSOR_TYPE_WAIT\""; + case 5: + return "\"PP_MOUSECURSOR_TYPE_HELP\""; + case 6: + return "\"PP_MOUSECURSOR_TYPE_EASTRESIZE\""; + case 7: + return "\"PP_MOUSECURSOR_TYPE_NORTHRESIZE\""; + case 8: + return "\"PP_MOUSECURSOR_TYPE_NORTHEASTRESIZE\""; + case 9: + return "\"PP_MOUSECURSOR_TYPE_NORTHWESTRESIZE\""; + case 10: + return "\"PP_MOUSECURSOR_TYPE_SOUTHRESIZE\""; + case 11: + return "\"PP_MOUSECURSOR_TYPE_SOUTHEASTRESIZE\""; + case 12: + return "\"PP_MOUSECURSOR_TYPE_SOUTHWESTRESIZE\""; + case 13: + return "\"PP_MOUSECURSOR_TYPE_WESTRESIZE\""; + case 14: + return "\"PP_MOUSECURSOR_TYPE_NORTHSOUTHRESIZE\""; + case 15: + return "\"PP_MOUSECURSOR_TYPE_EASTWESTRESIZE\""; + case 16: + return "\"PP_MOUSECURSOR_TYPE_NORTHEASTSOUTHWESTRESIZE\""; + case 17: + return "\"PP_MOUSECURSOR_TYPE_NORTHWESTSOUTHEASTRESIZE\""; + case 18: + return "\"PP_MOUSECURSOR_TYPE_COLUMNRESIZE\""; + case 19: + return "\"PP_MOUSECURSOR_TYPE_ROWRESIZE\""; + case 20: + return "\"PP_MOUSECURSOR_TYPE_MIDDLEPANNING\""; + case 21: + return "\"PP_MOUSECURSOR_TYPE_EASTPANNING\""; + case 22: + return "\"PP_MOUSECURSOR_TYPE_NORTHPANNING\""; + case 23: + return "\"PP_MOUSECURSOR_TYPE_NORTHEASTPANNING\""; + case 24: + return "\"PP_MOUSECURSOR_TYPE_NORTHWESTPANNING\""; + case 25: + return "\"PP_MOUSECURSOR_TYPE_SOUTHPANNING\""; + case 26: + return "\"PP_MOUSECURSOR_TYPE_SOUTHEASTPANNING\""; + case 27: + return "\"PP_MOUSECURSOR_TYPE_SOUTHWESTPANNING\""; + case 28: + return "\"PP_MOUSECURSOR_TYPE_WESTPANNING\""; + case 29: + return "\"PP_MOUSECURSOR_TYPE_MOVE\""; + case 30: + return "\"PP_MOUSECURSOR_TYPE_VERTICALTEXT\""; + case 31: + return "\"PP_MOUSECURSOR_TYPE_CELL\""; + case 32: + return "\"PP_MOUSECURSOR_TYPE_CONTEXTMENU\""; + case 33: + return "\"PP_MOUSECURSOR_TYPE_ALIAS\""; + case 34: + return "\"PP_MOUSECURSOR_TYPE_PROGRESS\""; + case 35: + return "\"PP_MOUSECURSOR_TYPE_NODROP\""; + case 36: + return "\"PP_MOUSECURSOR_TYPE_COPY\""; + case 37: + return "\"PP_MOUSECURSOR_TYPE_NONE\""; + case 38: + return "\"PP_MOUSECURSOR_TYPE_NOTALLOWED\""; + case 39: + return "\"PP_MOUSECURSOR_TYPE_ZOOMIN\""; + case 40: + return "\"PP_MOUSECURSOR_TYPE_ZOOMOUT\""; + case 41: + return "\"PP_MOUSECURSOR_TYPE_GRAB\""; + case 42: + return "\"PP_MOUSECURSOR_TYPE_GRABBING\""; + default: + return "\"???\""; + } +} +const string ToString_PP_MouseCursor_Type(const PP_MouseCursor_Type &v) { + return ToString_PP_MouseCursor_Type(&v); +} +void FromJSON_PP_MouseCursor_Type(JSONIterator& iterator, PP_MouseCursor_Type &value) { + long int v; + FromJSON_int(iterator, v); + value = PP_MouseCursor_Type(v); +} +namespace ns_PPB_MouseCursor_1_0 { +static PP_Bool SetCursor_1_0(PP_Instance instance, enum PP_MouseCursor_Type type, PP_Resource image, const struct PP_Point* hot_spot) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_MouseCursor\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"SetCursor\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "type", ToString_PP_MouseCursor_Type(type)); + AddProp(ss, "image", ToString_PP_Resource(image)); + AddProp(ss, "hot_spot", ToString_PP_Point(hot_spot)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_MouseCursor_1_0*)RealGetInterface("PPB_MouseCursor;1.0"))->SetCursor(instance, type, image, hot_spot); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +} +static PPB_MouseCursor_1_0 _PPB_MouseCursor_1_0 = { + ns_PPB_MouseCursor_1_0::SetCursor_1_0, +}; +const string ToString_PPB_MouseCursor(const PPB_MouseCursor_1_0 *v) { + stringstream s; + s << v; + return s.str(); +} +namespace ns_PPB_MouseLock_1_0 { +static int32_t LockMouse_1_0(PP_Instance instance, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_MouseLock\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"LockMouse\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_MouseLock_1_0*)RealGetInterface("PPB_MouseLock;1.0"))->LockMouse(instance, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static void UnlockMouse_1_0(PP_Instance instance) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_MouseLock\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"UnlockMouse\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_MouseLock_1_0*)RealGetInterface("PPB_MouseLock;1.0"))->UnlockMouse(instance); +#endif // !INTERPOSE +} +} +static PPB_MouseLock_1_0 _PPB_MouseLock_1_0 = { + ns_PPB_MouseLock_1_0::LockMouse_1_0, + ns_PPB_MouseLock_1_0::UnlockMouse_1_0, +}; +const string ToString_PPB_MouseLock(const PPB_MouseLock_1_0 *v) { + stringstream s; + s << v; + return s.str(); +} +const string ToString_PP_NetAddress_Family(const PP_NetAddress_Family *v) { + switch (*v) { + case 0: + return "\"PP_NETADDRESS_FAMILY_UNSPECIFIED\""; + case 1: + return "\"PP_NETADDRESS_FAMILY_IPV4\""; + case 2: + return "\"PP_NETADDRESS_FAMILY_IPV6\""; + default: + return "\"???\""; + } +} +const string ToString_PP_NetAddress_Family(const PP_NetAddress_Family &v) { + return ToString_PP_NetAddress_Family(&v); +} +void FromJSON_PP_NetAddress_Family(JSONIterator& iterator, PP_NetAddress_Family &value) { + long int v; + FromJSON_int(iterator, v); + value = PP_NetAddress_Family(v); +} +const string ToString_PP_NetAddress_IPv4(const PP_NetAddress_IPv4 *v) { + if (!v) { + return "null"; + } + return ToString_PP_NetAddress_IPv4(*v); +} +const string ToString_PP_NetAddress_IPv4(const PP_NetAddress_IPv4 &v) { + stringstream x; + BeginProps(x); + AddProp(x, "port", ToString_uint16_t(v.port)); + { + BeginProp(x, "addr"); + BeginElements(x); + for (uint32_t _n = 0; _n < 4; ++_n) { + AddElement(x, ToString_uint8_t(v.addr[_n])); + } + EndElements(x); + } + EndProps(x); + return x.str(); +} +void FromJSON_PP_NetAddress_IPv4(JSONIterator& iterator, PP_NetAddress_IPv4 &value) { + const JSON::Token& current = iterator.getCurrentAndGotoNext(); + if (current.isPrimitive() && !current.value().compare("null")) { + return; + } + if (!current.isObject()) { + Fail("Expected object!", ""); + } + iterator.skip(); + FromJSON_uint16_t(iterator, value.port); + iterator.skip(); + + { + size_t children = iterator.expectArrayAndGotoFirstItem(); + if (children > 4) { + Fail("Too many items in array\n", ""); + } + for (uint32_t _n = 0; _n < children; ++_n) { + FromJSON_uint8_t(iterator, (value.addr)[_n]); + } + // FIXME Null out remaining items? + } +} +const string ToString_PP_NetAddress_IPv6(const PP_NetAddress_IPv6 *v) { + if (!v) { + return "null"; + } + return ToString_PP_NetAddress_IPv6(*v); +} +const string ToString_PP_NetAddress_IPv6(const PP_NetAddress_IPv6 &v) { + stringstream x; + BeginProps(x); + AddProp(x, "port", ToString_uint16_t(v.port)); + { + BeginProp(x, "addr"); + BeginElements(x); + for (uint32_t _n = 0; _n < 16; ++_n) { + AddElement(x, ToString_uint8_t(v.addr[_n])); + } + EndElements(x); + } + EndProps(x); + return x.str(); +} +void FromJSON_PP_NetAddress_IPv6(JSONIterator& iterator, PP_NetAddress_IPv6 &value) { + const JSON::Token& current = iterator.getCurrentAndGotoNext(); + if (current.isPrimitive() && !current.value().compare("null")) { + return; + } + if (!current.isObject()) { + Fail("Expected object!", ""); + } + iterator.skip(); + FromJSON_uint16_t(iterator, value.port); + iterator.skip(); + + { + size_t children = iterator.expectArrayAndGotoFirstItem(); + if (children > 16) { + Fail("Too many items in array\n", ""); + } + for (uint32_t _n = 0; _n < children; ++_n) { + FromJSON_uint8_t(iterator, (value.addr)[_n]); + } + // FIXME Null out remaining items? + } +} +namespace ns_PPB_NetAddress_1_0 { +static PP_Resource CreateFromIPv4Address_1_0(PP_Instance instance, const struct PP_NetAddress_IPv4* ipv4_addr) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_NetAddress\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"CreateFromIPv4Address\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "ipv4_addr", ToString_PP_NetAddress_IPv4(ipv4_addr)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Resource(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_NetAddress_1_0*)RealGetInterface("PPB_NetAddress;1.0"))->CreateFromIPv4Address(instance, ipv4_addr); + printf("RPC response: ["); + printf("%s", ToString_PP_Resource(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Resource CreateFromIPv6Address_1_0(PP_Instance instance, const struct PP_NetAddress_IPv6* ipv6_addr) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_NetAddress\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"CreateFromIPv6Address\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "ipv6_addr", ToString_PP_NetAddress_IPv6(ipv6_addr)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Resource(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_NetAddress_1_0*)RealGetInterface("PPB_NetAddress;1.0"))->CreateFromIPv6Address(instance, ipv6_addr); + printf("RPC response: ["); + printf("%s", ToString_PP_Resource(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool IsNetAddress_1_0(PP_Resource resource) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_NetAddress\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"IsNetAddress\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_NetAddress_1_0*)RealGetInterface("PPB_NetAddress;1.0"))->IsNetAddress(resource); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_NetAddress_Family GetFamily_1_0(PP_Resource addr) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_NetAddress\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"GetFamily\""); + AddProp(ss, "addr", ToString_PP_Resource(addr)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_NetAddress_Family rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_NetAddress_Family(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_NetAddress_Family rval = ((PPB_NetAddress_1_0*)RealGetInterface("PPB_NetAddress;1.0"))->GetFamily(addr); + printf("RPC response: ["); + printf("%s", ToString_PP_NetAddress_Family(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static struct PP_Var DescribeAsString_1_0(PP_Resource addr, PP_Bool include_port) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_NetAddress\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"DescribeAsString\""); + AddProp(ss, "addr", ToString_PP_Resource(addr)); + AddProp(ss, "include_port", ToString_PP_Bool(include_port)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + struct PP_Var rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Var(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + struct PP_Var rval = ((PPB_NetAddress_1_0*)RealGetInterface("PPB_NetAddress;1.0"))->DescribeAsString(addr, include_port); + printf("RPC response: ["); + printf("%s", ToString_PP_Var(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool DescribeAsIPv4Address_1_0(PP_Resource addr, struct PP_NetAddress_IPv4* ipv4_addr) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_NetAddress\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"DescribeAsIPv4Address\""); + AddProp(ss, "addr", ToString_PP_Resource(addr)); + AddProp(ss, "ipv4_addr", PointerToString(ipv4_addr)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + if (!!ipv4_addr) { + iterator.skip(); + FromJSON_PP_NetAddress_IPv4(iterator, *ipv4_addr); + } + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_NetAddress_1_0*)RealGetInterface("PPB_NetAddress;1.0"))->DescribeAsIPv4Address(addr, ipv4_addr); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + if (!!ipv4_addr) { + AddProp(os, "ipv4_addr", ToString_PP_NetAddress_IPv4(ipv4_addr)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool DescribeAsIPv6Address_1_0(PP_Resource addr, struct PP_NetAddress_IPv6* ipv6_addr) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_NetAddress\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"DescribeAsIPv6Address\""); + AddProp(ss, "addr", ToString_PP_Resource(addr)); + AddProp(ss, "ipv6_addr", PointerToString(ipv6_addr)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + if (!!ipv6_addr) { + iterator.skip(); + FromJSON_PP_NetAddress_IPv6(iterator, *ipv6_addr); + } + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_NetAddress_1_0*)RealGetInterface("PPB_NetAddress;1.0"))->DescribeAsIPv6Address(addr, ipv6_addr); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + if (!!ipv6_addr) { + AddProp(os, "ipv6_addr", ToString_PP_NetAddress_IPv6(ipv6_addr)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +} +static PPB_NetAddress_1_0 _PPB_NetAddress_1_0 = { + ns_PPB_NetAddress_1_0::CreateFromIPv4Address_1_0, + ns_PPB_NetAddress_1_0::CreateFromIPv6Address_1_0, + ns_PPB_NetAddress_1_0::IsNetAddress_1_0, + ns_PPB_NetAddress_1_0::GetFamily_1_0, + ns_PPB_NetAddress_1_0::DescribeAsString_1_0, + ns_PPB_NetAddress_1_0::DescribeAsIPv4Address_1_0, + ns_PPB_NetAddress_1_0::DescribeAsIPv6Address_1_0, +}; +const string ToString_PPB_NetAddress(const PPB_NetAddress_1_0 *v) { + stringstream s; + s << v; + return s.str(); +} +const string ToString_PP_NetworkList_Type(const PP_NetworkList_Type *v) { + switch (*v) { + case 0: + return "\"PP_NETWORKLIST_TYPE_UNKNOWN\""; + case 1: + return "\"PP_NETWORKLIST_TYPE_ETHERNET\""; + case 2: + return "\"PP_NETWORKLIST_TYPE_WIFI\""; + case 3: + return "\"PP_NETWORKLIST_TYPE_CELLULAR\""; + default: + return "\"???\""; + } +} +const string ToString_PP_NetworkList_Type(const PP_NetworkList_Type &v) { + return ToString_PP_NetworkList_Type(&v); +} +void FromJSON_PP_NetworkList_Type(JSONIterator& iterator, PP_NetworkList_Type &value) { + long int v; + FromJSON_int(iterator, v); + value = PP_NetworkList_Type(v); +} +const string ToString_PP_NetworkList_State(const PP_NetworkList_State *v) { + switch (*v) { + case 0: + return "\"PP_NETWORKLIST_STATE_DOWN\""; + case 1: + return "\"PP_NETWORKLIST_STATE_UP\""; + default: + return "\"???\""; + } +} +const string ToString_PP_NetworkList_State(const PP_NetworkList_State &v) { + return ToString_PP_NetworkList_State(&v); +} +void FromJSON_PP_NetworkList_State(JSONIterator& iterator, PP_NetworkList_State &value) { + long int v; + FromJSON_int(iterator, v); + value = PP_NetworkList_State(v); +} +namespace ns_PPB_NetworkList_1_0 { +static PP_Bool IsNetworkList_1_0(PP_Resource resource) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_NetworkList\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"IsNetworkList\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_NetworkList_1_0*)RealGetInterface("PPB_NetworkList;1.0"))->IsNetworkList(resource); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static uint32_t GetCount_1_0(PP_Resource resource) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_NetworkList\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"GetCount\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + uint32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_uint32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + uint32_t rval = ((PPB_NetworkList_1_0*)RealGetInterface("PPB_NetworkList;1.0"))->GetCount(resource); + printf("RPC response: ["); + printf("%s", ToString_uint32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static struct PP_Var GetName_1_0(PP_Resource resource, uint32_t index) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_NetworkList\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"GetName\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + AddProp(ss, "index", ToString_uint32_t(index)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + struct PP_Var rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Var(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + struct PP_Var rval = ((PPB_NetworkList_1_0*)RealGetInterface("PPB_NetworkList;1.0"))->GetName(resource, index); + printf("RPC response: ["); + printf("%s", ToString_PP_Var(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_NetworkList_Type GetType_1_0(PP_Resource resource, uint32_t index) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_NetworkList\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"GetType\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + AddProp(ss, "index", ToString_uint32_t(index)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_NetworkList_Type rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_NetworkList_Type(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_NetworkList_Type rval = ((PPB_NetworkList_1_0*)RealGetInterface("PPB_NetworkList;1.0"))->GetType(resource, index); + printf("RPC response: ["); + printf("%s", ToString_PP_NetworkList_Type(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_NetworkList_State GetState_1_0(PP_Resource resource, uint32_t index) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_NetworkList\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"GetState\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + AddProp(ss, "index", ToString_uint32_t(index)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_NetworkList_State rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_NetworkList_State(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_NetworkList_State rval = ((PPB_NetworkList_1_0*)RealGetInterface("PPB_NetworkList;1.0"))->GetState(resource, index); + printf("RPC response: ["); + printf("%s", ToString_PP_NetworkList_State(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t GetIpAddresses_1_0(PP_Resource resource, uint32_t index, struct PP_ArrayOutput output) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_NetworkList\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"GetIpAddresses\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + AddProp(ss, "index", ToString_uint32_t(index)); + AddProp(ss, "output", ToString_PP_ArrayOutput(output)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_NetworkList_1_0*)RealGetInterface("PPB_NetworkList;1.0"))->GetIpAddresses(resource, index, output); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static struct PP_Var GetDisplayName_1_0(PP_Resource resource, uint32_t index) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_NetworkList\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"GetDisplayName\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + AddProp(ss, "index", ToString_uint32_t(index)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + struct PP_Var rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Var(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + struct PP_Var rval = ((PPB_NetworkList_1_0*)RealGetInterface("PPB_NetworkList;1.0"))->GetDisplayName(resource, index); + printf("RPC response: ["); + printf("%s", ToString_PP_Var(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static uint32_t GetMTU_1_0(PP_Resource resource, uint32_t index) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_NetworkList\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"GetMTU\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + AddProp(ss, "index", ToString_uint32_t(index)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + uint32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_uint32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + uint32_t rval = ((PPB_NetworkList_1_0*)RealGetInterface("PPB_NetworkList;1.0"))->GetMTU(resource, index); + printf("RPC response: ["); + printf("%s", ToString_uint32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +} +static PPB_NetworkList_1_0 _PPB_NetworkList_1_0 = { + ns_PPB_NetworkList_1_0::IsNetworkList_1_0, + ns_PPB_NetworkList_1_0::GetCount_1_0, + ns_PPB_NetworkList_1_0::GetName_1_0, + ns_PPB_NetworkList_1_0::GetType_1_0, + ns_PPB_NetworkList_1_0::GetState_1_0, + ns_PPB_NetworkList_1_0::GetIpAddresses_1_0, + ns_PPB_NetworkList_1_0::GetDisplayName_1_0, + ns_PPB_NetworkList_1_0::GetMTU_1_0, +}; +const string ToString_PPB_NetworkList(const PPB_NetworkList_1_0 *v) { + stringstream s; + s << v; + return s.str(); +} +namespace ns_PPB_NetworkMonitor_1_0 { +static PP_Resource Create_1_0(PP_Instance instance) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_NetworkMonitor\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"Create\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Resource(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_NetworkMonitor_1_0*)RealGetInterface("PPB_NetworkMonitor;1.0"))->Create(instance); + printf("RPC response: ["); + printf("%s", ToString_PP_Resource(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t UpdateNetworkList_1_0(PP_Resource network_monitor, PP_Resource* network_list, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_NetworkMonitor\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"UpdateNetworkList\""); + AddProp(ss, "network_monitor", ToString_PP_Resource(network_monitor)); + AddProp(ss, "network_list", PointerToString(network_list)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + iterator.skip(); + FromJSON_PP_Resource(iterator, *network_list); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_NetworkMonitor_1_0*)RealGetInterface("PPB_NetworkMonitor;1.0"))->UpdateNetworkList(network_monitor, network_list, logging_callback); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_int32_t(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + if (!!network_list) { + AddProp(os, "network_list", ToString_PP_Resource(network_list)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool IsNetworkMonitor_1_0(PP_Resource resource) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_NetworkMonitor\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"IsNetworkMonitor\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_NetworkMonitor_1_0*)RealGetInterface("PPB_NetworkMonitor;1.0"))->IsNetworkMonitor(resource); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +} +static PPB_NetworkMonitor_1_0 _PPB_NetworkMonitor_1_0 = { + ns_PPB_NetworkMonitor_1_0::Create_1_0, + ns_PPB_NetworkMonitor_1_0::UpdateNetworkList_1_0, + ns_PPB_NetworkMonitor_1_0::IsNetworkMonitor_1_0, +}; +const string ToString_PPB_NetworkMonitor(const PPB_NetworkMonitor_1_0 *v) { + stringstream s; + s << v; + return s.str(); +} +namespace ns_PPB_NetworkProxy_1_0 { +static int32_t GetProxyForURL_1_0(PP_Instance instance, struct PP_Var url, struct PP_Var* proxy_string, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_NetworkProxy\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"GetProxyForURL\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "url", ToString_PP_Var(url)); + AddProp(ss, "proxy_string", PointerToString(proxy_string)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + iterator.skip(); + FromJSON_PP_Var(iterator, *proxy_string); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_NetworkProxy_1_0*)RealGetInterface("PPB_NetworkProxy;1.0"))->GetProxyForURL(instance, url, proxy_string, logging_callback); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_int32_t(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + if (!!proxy_string) { + AddProp(os, "proxy_string", ToString_PP_Var(proxy_string)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +} +static PPB_NetworkProxy_1_0 _PPB_NetworkProxy_1_0 = { + ns_PPB_NetworkProxy_1_0::GetProxyForURL_1_0, +}; +const string ToString_PPB_NetworkProxy(const PPB_NetworkProxy_1_0 *v) { + stringstream s; + s << v; + return s.str(); +} +namespace ns_PPB_OpenGLES2_1_0 { +static void ActiveTexture_1_0(PP_Resource context, GLenum texture) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"ActiveTexture\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "texture", ToString_GLenum(texture)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->ActiveTexture(context, texture); +#endif // !INTERPOSE +} +static void AttachShader_1_0(PP_Resource context, GLuint program, GLuint shader) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"AttachShader\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "program", ToString_GLuint(program)); + AddProp(ss, "shader", ToString_GLuint(shader)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->AttachShader(context, program, shader); +#endif // !INTERPOSE +} +static void BindAttribLocation_1_0(PP_Resource context, GLuint program, GLuint index, const char* name) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"BindAttribLocation\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "program", ToString_GLuint(program)); + AddProp(ss, "index", ToString_GLuint(index)); + AddProp(ss, "name", ToString_cstr_t(name)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->BindAttribLocation(context, program, index, name); +#endif // !INTERPOSE +} +static void BindBuffer_1_0(PP_Resource context, GLenum target, GLuint buffer) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"BindBuffer\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "target", ToString_GLenum(target)); + AddProp(ss, "buffer", ToString_GLuint(buffer)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->BindBuffer(context, target, buffer); +#endif // !INTERPOSE +} +static void BindFramebuffer_1_0(PP_Resource context, GLenum target, GLuint framebuffer) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"BindFramebuffer\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "target", ToString_GLenum(target)); + AddProp(ss, "framebuffer", ToString_GLuint(framebuffer)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->BindFramebuffer(context, target, framebuffer); +#endif // !INTERPOSE +} +static void BindRenderbuffer_1_0(PP_Resource context, GLenum target, GLuint renderbuffer) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"BindRenderbuffer\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "target", ToString_GLenum(target)); + AddProp(ss, "renderbuffer", ToString_GLuint(renderbuffer)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->BindRenderbuffer(context, target, renderbuffer); +#endif // !INTERPOSE +} +static void BindTexture_1_0(PP_Resource context, GLenum target, GLuint texture) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"BindTexture\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "target", ToString_GLenum(target)); + AddProp(ss, "texture", ToString_GLuint(texture)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->BindTexture(context, target, texture); +#endif // !INTERPOSE +} +static void BlendColor_1_0(PP_Resource context, GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"BlendColor\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "red", ToString_GLclampf(red)); + AddProp(ss, "green", ToString_GLclampf(green)); + AddProp(ss, "blue", ToString_GLclampf(blue)); + AddProp(ss, "alpha", ToString_GLclampf(alpha)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->BlendColor(context, red, green, blue, alpha); +#endif // !INTERPOSE +} +static void BlendEquation_1_0(PP_Resource context, GLenum mode) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"BlendEquation\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "mode", ToString_GLenum(mode)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->BlendEquation(context, mode); +#endif // !INTERPOSE +} +static void BlendEquationSeparate_1_0(PP_Resource context, GLenum modeRGB, GLenum modeAlpha) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"BlendEquationSeparate\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "modeRGB", ToString_GLenum(modeRGB)); + AddProp(ss, "modeAlpha", ToString_GLenum(modeAlpha)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->BlendEquationSeparate(context, modeRGB, modeAlpha); +#endif // !INTERPOSE +} +static void BlendFunc_1_0(PP_Resource context, GLenum sfactor, GLenum dfactor) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"BlendFunc\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "sfactor", ToString_GLenum(sfactor)); + AddProp(ss, "dfactor", ToString_GLenum(dfactor)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->BlendFunc(context, sfactor, dfactor); +#endif // !INTERPOSE +} +static void BlendFuncSeparate_1_0(PP_Resource context, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"BlendFuncSeparate\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "srcRGB", ToString_GLenum(srcRGB)); + AddProp(ss, "dstRGB", ToString_GLenum(dstRGB)); + AddProp(ss, "srcAlpha", ToString_GLenum(srcAlpha)); + AddProp(ss, "dstAlpha", ToString_GLenum(dstAlpha)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->BlendFuncSeparate(context, srcRGB, dstRGB, srcAlpha, dstAlpha); +#endif // !INTERPOSE +} +static void BufferData_1_0(PP_Resource context, GLenum target, GLsizeiptr size, const void* data, GLenum usage) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"BufferData\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "target", ToString_GLenum(target)); + AddProp(ss, "size", ToString_GLsizeiptr(size)); + AddProp(ss, "data", ToString_mem_t(data)); + AddProp(ss, "usage", ToString_GLenum(usage)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->BufferData(context, target, size, data, usage); +#endif // !INTERPOSE +} +static void BufferSubData_1_0(PP_Resource context, GLenum target, GLintptr offset, GLsizeiptr size, const void* data) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"BufferSubData\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "target", ToString_GLenum(target)); + AddProp(ss, "offset", ToString_GLintptr(offset)); + AddProp(ss, "size", ToString_GLsizeiptr(size)); + AddProp(ss, "data", ToString_mem_t(data)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->BufferSubData(context, target, offset, size, data); +#endif // !INTERPOSE +} +static GLenum CheckFramebufferStatus_1_0(PP_Resource context, GLenum target) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"CheckFramebufferStatus\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "target", ToString_GLenum(target)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + GLenum rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_GLenum(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + GLenum rval = ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->CheckFramebufferStatus(context, target); + printf("RPC response: ["); + printf("%s", ToString_GLenum(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static void Clear_1_0(PP_Resource context, GLbitfield mask) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"Clear\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "mask", ToString_GLbitfield(mask)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->Clear(context, mask); +#endif // !INTERPOSE +} +static void ClearColor_1_0(PP_Resource context, GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"ClearColor\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "red", ToString_GLclampf(red)); + AddProp(ss, "green", ToString_GLclampf(green)); + AddProp(ss, "blue", ToString_GLclampf(blue)); + AddProp(ss, "alpha", ToString_GLclampf(alpha)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->ClearColor(context, red, green, blue, alpha); +#endif // !INTERPOSE +} +static void ClearDepthf_1_0(PP_Resource context, GLclampf depth) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"ClearDepthf\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "depth", ToString_GLclampf(depth)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->ClearDepthf(context, depth); +#endif // !INTERPOSE +} +static void ClearStencil_1_0(PP_Resource context, GLint s) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"ClearStencil\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "s", ToString_GLint(s)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->ClearStencil(context, s); +#endif // !INTERPOSE +} +static void ColorMask_1_0(PP_Resource context, GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"ColorMask\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "red", ToString_GLboolean(red)); + AddProp(ss, "green", ToString_GLboolean(green)); + AddProp(ss, "blue", ToString_GLboolean(blue)); + AddProp(ss, "alpha", ToString_GLboolean(alpha)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->ColorMask(context, red, green, blue, alpha); +#endif // !INTERPOSE +} +static void CompileShader_1_0(PP_Resource context, GLuint shader) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"CompileShader\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "shader", ToString_GLuint(shader)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->CompileShader(context, shader); +#endif // !INTERPOSE +} +static void CompressedTexImage2D_1_0(PP_Resource context, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void* data) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"CompressedTexImage2D\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "target", ToString_GLenum(target)); + AddProp(ss, "level", ToString_GLint(level)); + AddProp(ss, "internalformat", ToString_GLenum(internalformat)); + AddProp(ss, "width", ToString_GLsizei(width)); + AddProp(ss, "height", ToString_GLsizei(height)); + AddProp(ss, "border", ToString_GLint(border)); + AddProp(ss, "imageSize", ToString_GLsizei(imageSize)); + AddProp(ss, "data", ToString_mem_t(data)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->CompressedTexImage2D(context, target, level, internalformat, width, height, border, imageSize, data); +#endif // !INTERPOSE +} +static void CompressedTexSubImage2D_1_0(PP_Resource context, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void* data) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"CompressedTexSubImage2D\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "target", ToString_GLenum(target)); + AddProp(ss, "level", ToString_GLint(level)); + AddProp(ss, "xoffset", ToString_GLint(xoffset)); + AddProp(ss, "yoffset", ToString_GLint(yoffset)); + AddProp(ss, "width", ToString_GLsizei(width)); + AddProp(ss, "height", ToString_GLsizei(height)); + AddProp(ss, "format", ToString_GLenum(format)); + AddProp(ss, "imageSize", ToString_GLsizei(imageSize)); + AddProp(ss, "data", ToString_mem_t(data)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->CompressedTexSubImage2D(context, target, level, xoffset, yoffset, width, height, format, imageSize, data); +#endif // !INTERPOSE +} +static void CopyTexImage2D_1_0(PP_Resource context, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"CopyTexImage2D\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "target", ToString_GLenum(target)); + AddProp(ss, "level", ToString_GLint(level)); + AddProp(ss, "internalformat", ToString_GLenum(internalformat)); + AddProp(ss, "x", ToString_GLint(x)); + AddProp(ss, "y", ToString_GLint(y)); + AddProp(ss, "width", ToString_GLsizei(width)); + AddProp(ss, "height", ToString_GLsizei(height)); + AddProp(ss, "border", ToString_GLint(border)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->CopyTexImage2D(context, target, level, internalformat, x, y, width, height, border); +#endif // !INTERPOSE +} +static void CopyTexSubImage2D_1_0(PP_Resource context, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"CopyTexSubImage2D\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "target", ToString_GLenum(target)); + AddProp(ss, "level", ToString_GLint(level)); + AddProp(ss, "xoffset", ToString_GLint(xoffset)); + AddProp(ss, "yoffset", ToString_GLint(yoffset)); + AddProp(ss, "x", ToString_GLint(x)); + AddProp(ss, "y", ToString_GLint(y)); + AddProp(ss, "width", ToString_GLsizei(width)); + AddProp(ss, "height", ToString_GLsizei(height)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->CopyTexSubImage2D(context, target, level, xoffset, yoffset, x, y, width, height); +#endif // !INTERPOSE +} +static GLuint CreateProgram_1_0(PP_Resource context) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"CreateProgram\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + GLuint rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_GLuint(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + GLuint rval = ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->CreateProgram(context); + printf("RPC response: ["); + printf("%s", ToString_GLuint(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static GLuint CreateShader_1_0(PP_Resource context, GLenum type) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"CreateShader\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "type", ToString_GLenum(type)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + GLuint rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_GLuint(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + GLuint rval = ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->CreateShader(context, type); + printf("RPC response: ["); + printf("%s", ToString_GLuint(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static void CullFace_1_0(PP_Resource context, GLenum mode) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"CullFace\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "mode", ToString_GLenum(mode)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->CullFace(context, mode); +#endif // !INTERPOSE +} +static void DeleteBuffers_1_0(PP_Resource context, GLsizei n, const GLuint* buffers) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"DeleteBuffers\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "n", ToString_GLsizei(n)); + { + BeginProp(ss, "buffers"); + BeginElements(ss); + for (uint32_t _n = 0; _n < n; ++_n) { + AddElement(ss, ToString_GLuint(buffers[_n])); + } + EndElements(ss); + } + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->DeleteBuffers(context, n, buffers); +#endif // !INTERPOSE +} +static void DeleteFramebuffers_1_0(PP_Resource context, GLsizei n, const GLuint* framebuffers) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"DeleteFramebuffers\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "n", ToString_GLsizei(n)); + { + BeginProp(ss, "framebuffers"); + BeginElements(ss); + for (uint32_t _n = 0; _n < n; ++_n) { + AddElement(ss, ToString_GLuint(framebuffers[_n])); + } + EndElements(ss); + } + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->DeleteFramebuffers(context, n, framebuffers); +#endif // !INTERPOSE +} +static void DeleteProgram_1_0(PP_Resource context, GLuint program) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"DeleteProgram\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "program", ToString_GLuint(program)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->DeleteProgram(context, program); +#endif // !INTERPOSE +} +static void DeleteRenderbuffers_1_0(PP_Resource context, GLsizei n, const GLuint* renderbuffers) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"DeleteRenderbuffers\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "n", ToString_GLsizei(n)); + { + BeginProp(ss, "renderbuffers"); + BeginElements(ss); + for (uint32_t _n = 0; _n < n; ++_n) { + AddElement(ss, ToString_GLuint(renderbuffers[_n])); + } + EndElements(ss); + } + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->DeleteRenderbuffers(context, n, renderbuffers); +#endif // !INTERPOSE +} +static void DeleteShader_1_0(PP_Resource context, GLuint shader) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"DeleteShader\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "shader", ToString_GLuint(shader)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->DeleteShader(context, shader); +#endif // !INTERPOSE +} +static void DeleteTextures_1_0(PP_Resource context, GLsizei n, const GLuint* textures) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"DeleteTextures\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "n", ToString_GLsizei(n)); + { + BeginProp(ss, "textures"); + BeginElements(ss); + for (uint32_t _n = 0; _n < n; ++_n) { + AddElement(ss, ToString_GLuint(textures[_n])); + } + EndElements(ss); + } + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->DeleteTextures(context, n, textures); +#endif // !INTERPOSE +} +static void DepthFunc_1_0(PP_Resource context, GLenum func) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"DepthFunc\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "func", ToString_GLenum(func)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->DepthFunc(context, func); +#endif // !INTERPOSE +} +static void DepthMask_1_0(PP_Resource context, GLboolean flag) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"DepthMask\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "flag", ToString_GLboolean(flag)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->DepthMask(context, flag); +#endif // !INTERPOSE +} +static void DepthRangef_1_0(PP_Resource context, GLclampf zNear, GLclampf zFar) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"DepthRangef\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "zNear", ToString_GLclampf(zNear)); + AddProp(ss, "zFar", ToString_GLclampf(zFar)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->DepthRangef(context, zNear, zFar); +#endif // !INTERPOSE +} +static void DetachShader_1_0(PP_Resource context, GLuint program, GLuint shader) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"DetachShader\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "program", ToString_GLuint(program)); + AddProp(ss, "shader", ToString_GLuint(shader)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->DetachShader(context, program, shader); +#endif // !INTERPOSE +} +static void Disable_1_0(PP_Resource context, GLenum cap) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"Disable\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "cap", ToString_GLenum(cap)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->Disable(context, cap); +#endif // !INTERPOSE +} +static void DisableVertexAttribArray_1_0(PP_Resource context, GLuint index) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"DisableVertexAttribArray\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "index", ToString_GLuint(index)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->DisableVertexAttribArray(context, index); +#endif // !INTERPOSE +} +static void DrawArrays_1_0(PP_Resource context, GLenum mode, GLint first, GLsizei count) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"DrawArrays\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "mode", ToString_GLenum(mode)); + AddProp(ss, "first", ToString_GLint(first)); + AddProp(ss, "count", ToString_GLsizei(count)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->DrawArrays(context, mode, first, count); +#endif // !INTERPOSE +} +static void DrawElements_1_0(PP_Resource context, GLenum mode, GLsizei count, GLenum type, const void* indices) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"DrawElements\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "mode", ToString_GLenum(mode)); + AddProp(ss, "count", ToString_GLsizei(count)); + AddProp(ss, "type", ToString_GLenum(type)); + AddProp(ss, "indices", ToString_mem_t(indices)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->DrawElements(context, mode, count, type, indices); +#endif // !INTERPOSE +} +static void Enable_1_0(PP_Resource context, GLenum cap) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"Enable\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "cap", ToString_GLenum(cap)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->Enable(context, cap); +#endif // !INTERPOSE +} +static void EnableVertexAttribArray_1_0(PP_Resource context, GLuint index) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"EnableVertexAttribArray\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "index", ToString_GLuint(index)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->EnableVertexAttribArray(context, index); +#endif // !INTERPOSE +} +static void Finish_1_0(PP_Resource context) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"Finish\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->Finish(context); +#endif // !INTERPOSE +} +static void Flush_1_0(PP_Resource context) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"Flush\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->Flush(context); +#endif // !INTERPOSE +} +static void FramebufferRenderbuffer_1_0(PP_Resource context, GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"FramebufferRenderbuffer\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "target", ToString_GLenum(target)); + AddProp(ss, "attachment", ToString_GLenum(attachment)); + AddProp(ss, "renderbuffertarget", ToString_GLenum(renderbuffertarget)); + AddProp(ss, "renderbuffer", ToString_GLuint(renderbuffer)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->FramebufferRenderbuffer(context, target, attachment, renderbuffertarget, renderbuffer); +#endif // !INTERPOSE +} +static void FramebufferTexture2D_1_0(PP_Resource context, GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"FramebufferTexture2D\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "target", ToString_GLenum(target)); + AddProp(ss, "attachment", ToString_GLenum(attachment)); + AddProp(ss, "textarget", ToString_GLenum(textarget)); + AddProp(ss, "texture", ToString_GLuint(texture)); + AddProp(ss, "level", ToString_GLint(level)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->FramebufferTexture2D(context, target, attachment, textarget, texture, level); +#endif // !INTERPOSE +} +static void FrontFace_1_0(PP_Resource context, GLenum mode) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"FrontFace\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "mode", ToString_GLenum(mode)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->FrontFace(context, mode); +#endif // !INTERPOSE +} +static void GenBuffers_1_0(PP_Resource context, GLsizei n, GLuint* buffers) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"GenBuffers\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "n", ToString_GLsizei(n)); + AddProp(ss, "buffers", PointerToString(buffers)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectObjectAndGotoFirstProperty(); + iterator.skip(); + + { + size_t children = iterator.expectArrayAndGotoFirstItem(); + if (children > n) { + Fail("Too many items in array\n", ""); + } + for (uint32_t _n = 0; _n < children; ++_n) { + FromJSON_GLuint(iterator, (buffers)[_n]); + } + // FIXME Null out remaining items? + } +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->GenBuffers(context, n, buffers); + printf("RPC response: ["); + printf("["); + std::stringstream os; + BeginProps(os); + { + BeginProp(os, "buffers"); + BeginElements(os); + for (uint32_t _n = 0; _n < n; ++_n) { + AddElement(os, ToString_GLuint(buffers[_n])); + } + EndElements(os); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); +#endif // !INTERPOSE +} +static void GenerateMipmap_1_0(PP_Resource context, GLenum target) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"GenerateMipmap\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "target", ToString_GLenum(target)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->GenerateMipmap(context, target); +#endif // !INTERPOSE +} +static void GenFramebuffers_1_0(PP_Resource context, GLsizei n, GLuint* framebuffers) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"GenFramebuffers\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "n", ToString_GLsizei(n)); + AddProp(ss, "framebuffers", PointerToString(framebuffers)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectObjectAndGotoFirstProperty(); + iterator.skip(); + FromJSON_GLuint_ptr_t(iterator, framebuffers); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->GenFramebuffers(context, n, framebuffers); + printf("RPC response: ["); + printf("["); + std::stringstream os; + BeginProps(os); + AddProp(os, "framebuffers", ToString_GLuint_ptr_t(framebuffers)); + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); +#endif // !INTERPOSE +} +static void GenRenderbuffers_1_0(PP_Resource context, GLsizei n, GLuint* renderbuffers) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"GenRenderbuffers\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "n", ToString_GLsizei(n)); + AddProp(ss, "renderbuffers", PointerToString(renderbuffers)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectObjectAndGotoFirstProperty(); + iterator.skip(); + FromJSON_GLuint_ptr_t(iterator, renderbuffers); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->GenRenderbuffers(context, n, renderbuffers); + printf("RPC response: ["); + printf("["); + std::stringstream os; + BeginProps(os); + AddProp(os, "renderbuffers", ToString_GLuint_ptr_t(renderbuffers)); + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); +#endif // !INTERPOSE +} +static void GenTextures_1_0(PP_Resource context, GLsizei n, GLuint* textures) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"GenTextures\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "n", ToString_GLsizei(n)); + AddProp(ss, "textures", PointerToString(textures)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectObjectAndGotoFirstProperty(); + iterator.skip(); + + { + size_t children = iterator.expectArrayAndGotoFirstItem(); + if (children > n) { + Fail("Too many items in array\n", ""); + } + for (uint32_t _n = 0; _n < children; ++_n) { + FromJSON_GLuint(iterator, (textures)[_n]); + } + // FIXME Null out remaining items? + } +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->GenTextures(context, n, textures); + printf("RPC response: ["); + printf("["); + std::stringstream os; + BeginProps(os); + { + BeginProp(os, "textures"); + BeginElements(os); + for (uint32_t _n = 0; _n < n; ++_n) { + AddElement(os, ToString_GLuint(textures[_n])); + } + EndElements(os); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); +#endif // !INTERPOSE +} +static void GetActiveAttrib_1_0(PP_Resource context, GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"GetActiveAttrib\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "program", ToString_GLuint(program)); + AddProp(ss, "index", ToString_GLuint(index)); + AddProp(ss, "bufsize", ToString_GLsizei(bufsize)); + AddProp(ss, "length", PointerToString(length)); + AddProp(ss, "size", PointerToString(size)); + AddProp(ss, "type", PointerToString(type)); + AddProp(ss, "name", PointerToString(name)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectObjectAndGotoFirstProperty(); + iterator.skip(); + FromJSON_GLsizei_ptr_t(iterator, length); + iterator.skip(); + FromJSON_GLint_ptr_t(iterator, size); + iterator.skip(); + FromJSON_GLenum_ptr_t(iterator, type); + iterator.skip(); + FromJSON_str_t(iterator, name); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->GetActiveAttrib(context, program, index, bufsize, length, size, type, name); + printf("RPC response: ["); + printf("["); + std::stringstream os; + BeginProps(os); + AddProp(os, "length", ToString_GLsizei_ptr_t(length)); + AddProp(os, "size", ToString_GLint_ptr_t(size)); + AddProp(os, "type", ToString_GLenum_ptr_t(type)); + AddProp(os, "name", ToString_str_t(name)); + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); +#endif // !INTERPOSE +} +static void GetActiveUniform_1_0(PP_Resource context, GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"GetActiveUniform\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "program", ToString_GLuint(program)); + AddProp(ss, "index", ToString_GLuint(index)); + AddProp(ss, "bufsize", ToString_GLsizei(bufsize)); + AddProp(ss, "length", PointerToString(length)); + AddProp(ss, "size", PointerToString(size)); + AddProp(ss, "type", PointerToString(type)); + AddProp(ss, "name", PointerToString(name)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectObjectAndGotoFirstProperty(); + iterator.skip(); + FromJSON_GLsizei_ptr_t(iterator, length); + iterator.skip(); + FromJSON_GLint_ptr_t(iterator, size); + iterator.skip(); + FromJSON_GLenum_ptr_t(iterator, type); + iterator.skip(); + FromJSON_str_t(iterator, name); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->GetActiveUniform(context, program, index, bufsize, length, size, type, name); + printf("RPC response: ["); + printf("["); + std::stringstream os; + BeginProps(os); + AddProp(os, "length", ToString_GLsizei_ptr_t(length)); + AddProp(os, "size", ToString_GLint_ptr_t(size)); + AddProp(os, "type", ToString_GLenum_ptr_t(type)); + AddProp(os, "name", ToString_str_t(name)); + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); +#endif // !INTERPOSE +} +static void GetAttachedShaders_1_0(PP_Resource context, GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"GetAttachedShaders\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "program", ToString_GLuint(program)); + AddProp(ss, "maxcount", ToString_GLsizei(maxcount)); + AddProp(ss, "count", PointerToString(count)); + AddProp(ss, "shaders", PointerToString(shaders)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectObjectAndGotoFirstProperty(); + iterator.skip(); + FromJSON_GLsizei_ptr_t(iterator, count); + iterator.skip(); + FromJSON_GLuint_ptr_t(iterator, shaders); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->GetAttachedShaders(context, program, maxcount, count, shaders); + printf("RPC response: ["); + printf("["); + std::stringstream os; + BeginProps(os); + AddProp(os, "count", ToString_GLsizei_ptr_t(count)); + AddProp(os, "shaders", ToString_GLuint_ptr_t(shaders)); + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); +#endif // !INTERPOSE +} +static GLint GetAttribLocation_1_0(PP_Resource context, GLuint program, const char* name) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"GetAttribLocation\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "program", ToString_GLuint(program)); + AddProp(ss, "name", ToString_cstr_t(name)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + GLint rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_GLint(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + GLint rval = ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->GetAttribLocation(context, program, name); + printf("RPC response: ["); + printf("%s", ToString_GLint(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static void GetBooleanv_1_0(PP_Resource context, GLenum pname, GLboolean* params) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"GetBooleanv\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "pname", ToString_GLenum(pname)); + AddProp(ss, "params", PointerToString(params)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectObjectAndGotoFirstProperty(); + iterator.skip(); + FromJSON_GLboolean_ptr_t(iterator, params); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->GetBooleanv(context, pname, params); + printf("RPC response: ["); + printf("["); + std::stringstream os; + BeginProps(os); + AddProp(os, "params", ToString_GLboolean_ptr_t(params)); + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); +#endif // !INTERPOSE +} +static void GetBufferParameteriv_1_0(PP_Resource context, GLenum target, GLenum pname, GLint* params) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"GetBufferParameteriv\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "target", ToString_GLenum(target)); + AddProp(ss, "pname", ToString_GLenum(pname)); + AddProp(ss, "params", PointerToString(params)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectObjectAndGotoFirstProperty(); + iterator.skip(); + FromJSON_GLint_ptr_t(iterator, params); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->GetBufferParameteriv(context, target, pname, params); + printf("RPC response: ["); + printf("["); + std::stringstream os; + BeginProps(os); + AddProp(os, "params", ToString_GLint_ptr_t(params)); + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); +#endif // !INTERPOSE +} +static GLenum GetError_1_0(PP_Resource context) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"GetError\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + GLenum rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_GLenum(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + GLenum rval = ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->GetError(context); + printf("RPC response: ["); + printf("%s", ToString_GLenum(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static void GetFloatv_1_0(PP_Resource context, GLenum pname, GLfloat* params) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"GetFloatv\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "pname", ToString_GLenum(pname)); + AddProp(ss, "params", PointerToString(params)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectObjectAndGotoFirstProperty(); + iterator.skip(); + FromJSON_GLfloat_ptr_t(iterator, params); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->GetFloatv(context, pname, params); + printf("RPC response: ["); + printf("["); + std::stringstream os; + BeginProps(os); + AddProp(os, "params", ToString_GLfloat_ptr_t(params)); + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); +#endif // !INTERPOSE +} +static void GetFramebufferAttachmentParameteriv_1_0(PP_Resource context, GLenum target, GLenum attachment, GLenum pname, GLint* params) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"GetFramebufferAttachmentParameteriv\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "target", ToString_GLenum(target)); + AddProp(ss, "attachment", ToString_GLenum(attachment)); + AddProp(ss, "pname", ToString_GLenum(pname)); + AddProp(ss, "params", PointerToString(params)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectObjectAndGotoFirstProperty(); + iterator.skip(); + FromJSON_GLint_ptr_t(iterator, params); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->GetFramebufferAttachmentParameteriv(context, target, attachment, pname, params); + printf("RPC response: ["); + printf("["); + std::stringstream os; + BeginProps(os); + AddProp(os, "params", ToString_GLint_ptr_t(params)); + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); +#endif // !INTERPOSE +} +static void GetIntegerv_1_0(PP_Resource context, GLenum pname, GLint* params) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"GetIntegerv\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "pname", ToString_GLenum(pname)); + AddProp(ss, "params", PointerToString(params)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectObjectAndGotoFirstProperty(); + iterator.skip(); + FromJSON_GLint_ptr_t(iterator, params); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->GetIntegerv(context, pname, params); + printf("RPC response: ["); + printf("["); + std::stringstream os; + BeginProps(os); + AddProp(os, "params", ToString_GLint_ptr_t(params)); + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); +#endif // !INTERPOSE +} +static void GetProgramiv_1_0(PP_Resource context, GLuint program, GLenum pname, GLint* params) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"GetProgramiv\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "program", ToString_GLuint(program)); + AddProp(ss, "pname", ToString_GLenum(pname)); + AddProp(ss, "params", PointerToString(params)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectObjectAndGotoFirstProperty(); + iterator.skip(); + FromJSON_GLint_ptr_t(iterator, params); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->GetProgramiv(context, program, pname, params); + printf("RPC response: ["); + printf("["); + std::stringstream os; + BeginProps(os); + AddProp(os, "params", ToString_GLint_ptr_t(params)); + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); +#endif // !INTERPOSE +} +static void GetProgramInfoLog_1_0(PP_Resource context, GLuint program, GLsizei bufsize, GLsizei* length, char* infolog) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"GetProgramInfoLog\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "program", ToString_GLuint(program)); + AddProp(ss, "bufsize", ToString_GLsizei(bufsize)); + AddProp(ss, "length", PointerToString(length)); + AddProp(ss, "infolog", PointerToString(infolog)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectObjectAndGotoFirstProperty(); + iterator.skip(); + FromJSON_GLsizei_ptr_t(iterator, length); + iterator.skip(); + FromJSON_str_t(iterator, infolog); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->GetProgramInfoLog(context, program, bufsize, length, infolog); + printf("RPC response: ["); + printf("["); + std::stringstream os; + BeginProps(os); + AddProp(os, "length", ToString_GLsizei_ptr_t(length)); + AddProp(os, "infolog", ToString_str_t(infolog)); + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); +#endif // !INTERPOSE +} +static void GetRenderbufferParameteriv_1_0(PP_Resource context, GLenum target, GLenum pname, GLint* params) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"GetRenderbufferParameteriv\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "target", ToString_GLenum(target)); + AddProp(ss, "pname", ToString_GLenum(pname)); + AddProp(ss, "params", PointerToString(params)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectObjectAndGotoFirstProperty(); + iterator.skip(); + FromJSON_GLint_ptr_t(iterator, params); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->GetRenderbufferParameteriv(context, target, pname, params); + printf("RPC response: ["); + printf("["); + std::stringstream os; + BeginProps(os); + AddProp(os, "params", ToString_GLint_ptr_t(params)); + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); +#endif // !INTERPOSE +} +static void GetShaderiv_1_0(PP_Resource context, GLuint shader, GLenum pname, GLint* params) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"GetShaderiv\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "shader", ToString_GLuint(shader)); + AddProp(ss, "pname", ToString_GLenum(pname)); + AddProp(ss, "params", PointerToString(params)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectObjectAndGotoFirstProperty(); + iterator.skip(); + FromJSON_GLint_ptr_t(iterator, params); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->GetShaderiv(context, shader, pname, params); + printf("RPC response: ["); + printf("["); + std::stringstream os; + BeginProps(os); + AddProp(os, "params", ToString_GLint_ptr_t(params)); + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); +#endif // !INTERPOSE +} +static void GetShaderInfoLog_1_0(PP_Resource context, GLuint shader, GLsizei bufsize, GLsizei* length, char* infolog) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"GetShaderInfoLog\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "shader", ToString_GLuint(shader)); + AddProp(ss, "bufsize", ToString_GLsizei(bufsize)); + AddProp(ss, "length", PointerToString(length)); + AddProp(ss, "infolog", PointerToString(infolog)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectObjectAndGotoFirstProperty(); + iterator.skip(); + FromJSON_GLsizei_ptr_t(iterator, length); + iterator.skip(); + FromJSON_str_t(iterator, infolog); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->GetShaderInfoLog(context, shader, bufsize, length, infolog); + printf("RPC response: ["); + printf("["); + std::stringstream os; + BeginProps(os); + AddProp(os, "length", ToString_GLsizei_ptr_t(length)); + AddProp(os, "infolog", ToString_str_t(infolog)); + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); +#endif // !INTERPOSE +} +static void GetShaderPrecisionFormat_1_0(PP_Resource context, GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"GetShaderPrecisionFormat\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "shadertype", ToString_GLenum(shadertype)); + AddProp(ss, "precisiontype", ToString_GLenum(precisiontype)); + AddProp(ss, "range", PointerToString(range)); + AddProp(ss, "precision", PointerToString(precision)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectObjectAndGotoFirstProperty(); + iterator.skip(); + FromJSON_GLint_ptr_t(iterator, range); + iterator.skip(); + FromJSON_GLint_ptr_t(iterator, precision); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->GetShaderPrecisionFormat(context, shadertype, precisiontype, range, precision); + printf("RPC response: ["); + printf("["); + std::stringstream os; + BeginProps(os); + AddProp(os, "range", ToString_GLint_ptr_t(range)); + AddProp(os, "precision", ToString_GLint_ptr_t(precision)); + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); +#endif // !INTERPOSE +} +static void GetShaderSource_1_0(PP_Resource context, GLuint shader, GLsizei bufsize, GLsizei* length, char* source) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"GetShaderSource\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "shader", ToString_GLuint(shader)); + AddProp(ss, "bufsize", ToString_GLsizei(bufsize)); + AddProp(ss, "length", PointerToString(length)); + AddProp(ss, "source", PointerToString(source)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectObjectAndGotoFirstProperty(); + iterator.skip(); + FromJSON_GLsizei_ptr_t(iterator, length); + iterator.skip(); + FromJSON_str_t(iterator, source); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->GetShaderSource(context, shader, bufsize, length, source); + printf("RPC response: ["); + printf("["); + std::stringstream os; + BeginProps(os); + AddProp(os, "length", ToString_GLsizei_ptr_t(length)); + AddProp(os, "source", ToString_str_t(source)); + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); +#endif // !INTERPOSE +} +static const GLubyte* GetString_1_0(PP_Resource context, GLenum name) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"GetString\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "name", ToString_GLenum(name)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + GLubyte* rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_GLubyte_ptr_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + const GLubyte* rval = ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->GetString(context, name); + printf("RPC response: ["); + printf("%s", ToString_GLubyte_ptr_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static void GetTexParameterfv_1_0(PP_Resource context, GLenum target, GLenum pname, GLfloat* params) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"GetTexParameterfv\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "target", ToString_GLenum(target)); + AddProp(ss, "pname", ToString_GLenum(pname)); + AddProp(ss, "params", PointerToString(params)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectObjectAndGotoFirstProperty(); + iterator.skip(); + FromJSON_GLfloat_ptr_t(iterator, params); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->GetTexParameterfv(context, target, pname, params); + printf("RPC response: ["); + printf("["); + std::stringstream os; + BeginProps(os); + AddProp(os, "params", ToString_GLfloat_ptr_t(params)); + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); +#endif // !INTERPOSE +} +static void GetTexParameteriv_1_0(PP_Resource context, GLenum target, GLenum pname, GLint* params) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"GetTexParameteriv\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "target", ToString_GLenum(target)); + AddProp(ss, "pname", ToString_GLenum(pname)); + AddProp(ss, "params", PointerToString(params)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectObjectAndGotoFirstProperty(); + iterator.skip(); + FromJSON_GLint_ptr_t(iterator, params); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->GetTexParameteriv(context, target, pname, params); + printf("RPC response: ["); + printf("["); + std::stringstream os; + BeginProps(os); + AddProp(os, "params", ToString_GLint_ptr_t(params)); + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); +#endif // !INTERPOSE +} +static void GetUniformfv_1_0(PP_Resource context, GLuint program, GLint location, GLfloat* params) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"GetUniformfv\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "program", ToString_GLuint(program)); + AddProp(ss, "location", ToString_GLint(location)); + AddProp(ss, "params", PointerToString(params)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectObjectAndGotoFirstProperty(); + iterator.skip(); + FromJSON_GLfloat_ptr_t(iterator, params); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->GetUniformfv(context, program, location, params); + printf("RPC response: ["); + printf("["); + std::stringstream os; + BeginProps(os); + AddProp(os, "params", ToString_GLfloat_ptr_t(params)); + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); +#endif // !INTERPOSE +} +static void GetUniformiv_1_0(PP_Resource context, GLuint program, GLint location, GLint* params) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"GetUniformiv\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "program", ToString_GLuint(program)); + AddProp(ss, "location", ToString_GLint(location)); + AddProp(ss, "params", PointerToString(params)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectObjectAndGotoFirstProperty(); + iterator.skip(); + FromJSON_GLint_ptr_t(iterator, params); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->GetUniformiv(context, program, location, params); + printf("RPC response: ["); + printf("["); + std::stringstream os; + BeginProps(os); + AddProp(os, "params", ToString_GLint_ptr_t(params)); + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); +#endif // !INTERPOSE +} +static GLint GetUniformLocation_1_0(PP_Resource context, GLuint program, const char* name) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"GetUniformLocation\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "program", ToString_GLuint(program)); + AddProp(ss, "name", ToString_cstr_t(name)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + GLint rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_GLint(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + GLint rval = ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->GetUniformLocation(context, program, name); + printf("RPC response: ["); + printf("%s", ToString_GLint(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static void GetVertexAttribfv_1_0(PP_Resource context, GLuint index, GLenum pname, GLfloat* params) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"GetVertexAttribfv\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "index", ToString_GLuint(index)); + AddProp(ss, "pname", ToString_GLenum(pname)); + AddProp(ss, "params", PointerToString(params)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectObjectAndGotoFirstProperty(); + iterator.skip(); + FromJSON_GLfloat_ptr_t(iterator, params); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->GetVertexAttribfv(context, index, pname, params); + printf("RPC response: ["); + printf("["); + std::stringstream os; + BeginProps(os); + AddProp(os, "params", ToString_GLfloat_ptr_t(params)); + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); +#endif // !INTERPOSE +} +static void GetVertexAttribiv_1_0(PP_Resource context, GLuint index, GLenum pname, GLint* params) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"GetVertexAttribiv\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "index", ToString_GLuint(index)); + AddProp(ss, "pname", ToString_GLenum(pname)); + AddProp(ss, "params", PointerToString(params)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectObjectAndGotoFirstProperty(); + iterator.skip(); + FromJSON_GLint_ptr_t(iterator, params); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->GetVertexAttribiv(context, index, pname, params); + printf("RPC response: ["); + printf("["); + std::stringstream os; + BeginProps(os); + AddProp(os, "params", ToString_GLint_ptr_t(params)); + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); +#endif // !INTERPOSE +} +static void GetVertexAttribPointerv_1_0(PP_Resource context, GLuint index, GLenum pname, void** pointer) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"GetVertexAttribPointerv\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "index", ToString_GLuint(index)); + AddProp(ss, "pname", ToString_GLenum(pname)); + AddProp(ss, "pointer", PointerToString(pointer)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectObjectAndGotoFirstProperty(); + iterator.skip(); + FromJSON_mem_ptr_t(iterator, pointer); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->GetVertexAttribPointerv(context, index, pname, pointer); + printf("RPC response: ["); + printf("["); + std::stringstream os; + BeginProps(os); + AddProp(os, "pointer", ToString_mem_ptr_t(pointer)); + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); +#endif // !INTERPOSE +} +static void Hint_1_0(PP_Resource context, GLenum target, GLenum mode) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"Hint\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "target", ToString_GLenum(target)); + AddProp(ss, "mode", ToString_GLenum(mode)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->Hint(context, target, mode); +#endif // !INTERPOSE +} +static GLboolean IsBuffer_1_0(PP_Resource context, GLuint buffer) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"IsBuffer\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "buffer", ToString_GLuint(buffer)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + GLboolean rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_GLboolean(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + GLboolean rval = ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->IsBuffer(context, buffer); + printf("RPC response: ["); + printf("%s", ToString_GLboolean(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static GLboolean IsEnabled_1_0(PP_Resource context, GLenum cap) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"IsEnabled\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "cap", ToString_GLenum(cap)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + GLboolean rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_GLboolean(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + GLboolean rval = ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->IsEnabled(context, cap); + printf("RPC response: ["); + printf("%s", ToString_GLboolean(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static GLboolean IsFramebuffer_1_0(PP_Resource context, GLuint framebuffer) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"IsFramebuffer\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "framebuffer", ToString_GLuint(framebuffer)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + GLboolean rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_GLboolean(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + GLboolean rval = ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->IsFramebuffer(context, framebuffer); + printf("RPC response: ["); + printf("%s", ToString_GLboolean(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static GLboolean IsProgram_1_0(PP_Resource context, GLuint program) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"IsProgram\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "program", ToString_GLuint(program)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + GLboolean rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_GLboolean(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + GLboolean rval = ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->IsProgram(context, program); + printf("RPC response: ["); + printf("%s", ToString_GLboolean(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static GLboolean IsRenderbuffer_1_0(PP_Resource context, GLuint renderbuffer) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"IsRenderbuffer\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "renderbuffer", ToString_GLuint(renderbuffer)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + GLboolean rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_GLboolean(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + GLboolean rval = ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->IsRenderbuffer(context, renderbuffer); + printf("RPC response: ["); + printf("%s", ToString_GLboolean(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static GLboolean IsShader_1_0(PP_Resource context, GLuint shader) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"IsShader\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "shader", ToString_GLuint(shader)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + GLboolean rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_GLboolean(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + GLboolean rval = ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->IsShader(context, shader); + printf("RPC response: ["); + printf("%s", ToString_GLboolean(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static GLboolean IsTexture_1_0(PP_Resource context, GLuint texture) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"IsTexture\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "texture", ToString_GLuint(texture)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + GLboolean rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_GLboolean(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + GLboolean rval = ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->IsTexture(context, texture); + printf("RPC response: ["); + printf("%s", ToString_GLboolean(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static void LineWidth_1_0(PP_Resource context, GLfloat width) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"LineWidth\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "width", ToString_GLfloat(width)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->LineWidth(context, width); +#endif // !INTERPOSE +} +static void LinkProgram_1_0(PP_Resource context, GLuint program) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"LinkProgram\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "program", ToString_GLuint(program)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->LinkProgram(context, program); +#endif // !INTERPOSE +} +static void PixelStorei_1_0(PP_Resource context, GLenum pname, GLint param) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"PixelStorei\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "pname", ToString_GLenum(pname)); + AddProp(ss, "param", ToString_GLint(param)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->PixelStorei(context, pname, param); +#endif // !INTERPOSE +} +static void PolygonOffset_1_0(PP_Resource context, GLfloat factor, GLfloat units) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"PolygonOffset\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "factor", ToString_GLfloat(factor)); + AddProp(ss, "units", ToString_GLfloat(units)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->PolygonOffset(context, factor, units); +#endif // !INTERPOSE +} +static void ReadPixels_1_0(PP_Resource context, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void* pixels) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"ReadPixels\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "x", ToString_GLint(x)); + AddProp(ss, "y", ToString_GLint(y)); + AddProp(ss, "width", ToString_GLsizei(width)); + AddProp(ss, "height", ToString_GLsizei(height)); + AddProp(ss, "format", ToString_GLenum(format)); + AddProp(ss, "type", ToString_GLenum(type)); + AddProp(ss, "pixels", PointerToString(pixels)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectObjectAndGotoFirstProperty(); + iterator.skip(); + FromJSON_mem_t(iterator, pixels); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->ReadPixels(context, x, y, width, height, format, type, pixels); + printf("RPC response: ["); + printf("["); + std::stringstream os; + BeginProps(os); + AddProp(os, "pixels", ToString_mem_t(pixels)); + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); +#endif // !INTERPOSE +} +static void ReleaseShaderCompiler_1_0(PP_Resource context) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"ReleaseShaderCompiler\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->ReleaseShaderCompiler(context); +#endif // !INTERPOSE +} +static void RenderbufferStorage_1_0(PP_Resource context, GLenum target, GLenum internalformat, GLsizei width, GLsizei height) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"RenderbufferStorage\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "target", ToString_GLenum(target)); + AddProp(ss, "internalformat", ToString_GLenum(internalformat)); + AddProp(ss, "width", ToString_GLsizei(width)); + AddProp(ss, "height", ToString_GLsizei(height)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->RenderbufferStorage(context, target, internalformat, width, height); +#endif // !INTERPOSE +} +static void SampleCoverage_1_0(PP_Resource context, GLclampf value, GLboolean invert) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"SampleCoverage\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "value", ToString_GLclampf(value)); + AddProp(ss, "invert", ToString_GLboolean(invert)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->SampleCoverage(context, value, invert); +#endif // !INTERPOSE +} +static void Scissor_1_0(PP_Resource context, GLint x, GLint y, GLsizei width, GLsizei height) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"Scissor\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "x", ToString_GLint(x)); + AddProp(ss, "y", ToString_GLint(y)); + AddProp(ss, "width", ToString_GLsizei(width)); + AddProp(ss, "height", ToString_GLsizei(height)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->Scissor(context, x, y, width, height); +#endif // !INTERPOSE +} +static void ShaderBinary_1_0(PP_Resource context, GLsizei n, const GLuint* shaders, GLenum binaryformat, const void* binary, GLsizei length) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"ShaderBinary\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "n", ToString_GLsizei(n)); + AddProp(ss, "shaders", ToString_GLuint_ptr_t(shaders)); + AddProp(ss, "binaryformat", ToString_GLenum(binaryformat)); + AddProp(ss, "binary", ToString_mem_t(binary)); + AddProp(ss, "length", ToString_GLsizei(length)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->ShaderBinary(context, n, shaders, binaryformat, binary, length); +#endif // !INTERPOSE +} +static void ShaderSource_1_0(PP_Resource context, GLuint shader, GLsizei count, const char** str, const GLint* length) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"ShaderSource\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "shader", ToString_GLuint(shader)); + AddProp(ss, "count", ToString_GLsizei(count)); + { + BeginProp(ss, "str"); + BeginElements(ss); + for (uint32_t _n = 0; _n < count; ++_n) { + AddElement(ss, ToString_str_t(str[_n])); + } + EndElements(ss); + } + AddProp(ss, "length", ToString_GLint_ptr_t(length)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->ShaderSource(context, shader, count, str, length); +#endif // !INTERPOSE +} +static void StencilFunc_1_0(PP_Resource context, GLenum func, GLint ref, GLuint mask) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"StencilFunc\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "func", ToString_GLenum(func)); + AddProp(ss, "ref", ToString_GLint(ref)); + AddProp(ss, "mask", ToString_GLuint(mask)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->StencilFunc(context, func, ref, mask); +#endif // !INTERPOSE +} +static void StencilFuncSeparate_1_0(PP_Resource context, GLenum face, GLenum func, GLint ref, GLuint mask) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"StencilFuncSeparate\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "face", ToString_GLenum(face)); + AddProp(ss, "func", ToString_GLenum(func)); + AddProp(ss, "ref", ToString_GLint(ref)); + AddProp(ss, "mask", ToString_GLuint(mask)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->StencilFuncSeparate(context, face, func, ref, mask); +#endif // !INTERPOSE +} +static void StencilMask_1_0(PP_Resource context, GLuint mask) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"StencilMask\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "mask", ToString_GLuint(mask)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->StencilMask(context, mask); +#endif // !INTERPOSE +} +static void StencilMaskSeparate_1_0(PP_Resource context, GLenum face, GLuint mask) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"StencilMaskSeparate\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "face", ToString_GLenum(face)); + AddProp(ss, "mask", ToString_GLuint(mask)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->StencilMaskSeparate(context, face, mask); +#endif // !INTERPOSE +} +static void StencilOp_1_0(PP_Resource context, GLenum fail, GLenum zfail, GLenum zpass) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"StencilOp\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "fail", ToString_GLenum(fail)); + AddProp(ss, "zfail", ToString_GLenum(zfail)); + AddProp(ss, "zpass", ToString_GLenum(zpass)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->StencilOp(context, fail, zfail, zpass); +#endif // !INTERPOSE +} +static void StencilOpSeparate_1_0(PP_Resource context, GLenum face, GLenum fail, GLenum zfail, GLenum zpass) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"StencilOpSeparate\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "face", ToString_GLenum(face)); + AddProp(ss, "fail", ToString_GLenum(fail)); + AddProp(ss, "zfail", ToString_GLenum(zfail)); + AddProp(ss, "zpass", ToString_GLenum(zpass)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->StencilOpSeparate(context, face, fail, zfail, zpass); +#endif // !INTERPOSE +} +static void TexImage2D_1_0(PP_Resource context, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void* pixels) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"TexImage2D\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "target", ToString_GLenum(target)); + AddProp(ss, "level", ToString_GLint(level)); + AddProp(ss, "internalformat", ToString_GLint(internalformat)); + AddProp(ss, "width", ToString_GLsizei(width)); + AddProp(ss, "height", ToString_GLsizei(height)); + AddProp(ss, "border", ToString_GLint(border)); + AddProp(ss, "format", ToString_GLenum(format)); + AddProp(ss, "type", ToString_GLenum(type)); + AddProp(ss, "pixels", ToString_mem_t(pixels)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->TexImage2D(context, target, level, internalformat, width, height, border, format, type, pixels); +#endif // !INTERPOSE +} +static void TexParameterf_1_0(PP_Resource context, GLenum target, GLenum pname, GLfloat param) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"TexParameterf\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "target", ToString_GLenum(target)); + AddProp(ss, "pname", ToString_GLenum(pname)); + AddProp(ss, "param", ToString_GLfloat(param)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->TexParameterf(context, target, pname, param); +#endif // !INTERPOSE +} +static void TexParameterfv_1_0(PP_Resource context, GLenum target, GLenum pname, const GLfloat* params) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"TexParameterfv\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "target", ToString_GLenum(target)); + AddProp(ss, "pname", ToString_GLenum(pname)); + AddProp(ss, "params", ToString_GLfloat_ptr_t(params)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->TexParameterfv(context, target, pname, params); +#endif // !INTERPOSE +} +static void TexParameteri_1_0(PP_Resource context, GLenum target, GLenum pname, GLint param) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"TexParameteri\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "target", ToString_GLenum(target)); + AddProp(ss, "pname", ToString_GLenum(pname)); + AddProp(ss, "param", ToString_GLint(param)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->TexParameteri(context, target, pname, param); +#endif // !INTERPOSE +} +static void TexParameteriv_1_0(PP_Resource context, GLenum target, GLenum pname, const GLint* params) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"TexParameteriv\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "target", ToString_GLenum(target)); + AddProp(ss, "pname", ToString_GLenum(pname)); + AddProp(ss, "params", ToString_GLint_ptr_t(params)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->TexParameteriv(context, target, pname, params); +#endif // !INTERPOSE +} +static void TexSubImage2D_1_0(PP_Resource context, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void* pixels) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"TexSubImage2D\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "target", ToString_GLenum(target)); + AddProp(ss, "level", ToString_GLint(level)); + AddProp(ss, "xoffset", ToString_GLint(xoffset)); + AddProp(ss, "yoffset", ToString_GLint(yoffset)); + AddProp(ss, "width", ToString_GLsizei(width)); + AddProp(ss, "height", ToString_GLsizei(height)); + AddProp(ss, "format", ToString_GLenum(format)); + AddProp(ss, "type", ToString_GLenum(type)); + AddProp(ss, "pixels", ToString_mem_t(pixels)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->TexSubImage2D(context, target, level, xoffset, yoffset, width, height, format, type, pixels); +#endif // !INTERPOSE +} +static void Uniform1f_1_0(PP_Resource context, GLint location, GLfloat x) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"Uniform1f\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "location", ToString_GLint(location)); + AddProp(ss, "x", ToString_GLfloat(x)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->Uniform1f(context, location, x); +#endif // !INTERPOSE +} +static void Uniform1fv_1_0(PP_Resource context, GLint location, GLsizei count, const GLfloat* v) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"Uniform1fv\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "location", ToString_GLint(location)); + AddProp(ss, "count", ToString_GLsizei(count)); + AddProp(ss, "v", ToString_GLfloat_ptr_t(v)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->Uniform1fv(context, location, count, v); +#endif // !INTERPOSE +} +static void Uniform1i_1_0(PP_Resource context, GLint location, GLint x) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"Uniform1i\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "location", ToString_GLint(location)); + AddProp(ss, "x", ToString_GLint(x)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->Uniform1i(context, location, x); +#endif // !INTERPOSE +} +static void Uniform1iv_1_0(PP_Resource context, GLint location, GLsizei count, const GLint* v) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"Uniform1iv\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "location", ToString_GLint(location)); + AddProp(ss, "count", ToString_GLsizei(count)); + AddProp(ss, "v", ToString_GLint_ptr_t(v)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->Uniform1iv(context, location, count, v); +#endif // !INTERPOSE +} +static void Uniform2f_1_0(PP_Resource context, GLint location, GLfloat x, GLfloat y) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"Uniform2f\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "location", ToString_GLint(location)); + AddProp(ss, "x", ToString_GLfloat(x)); + AddProp(ss, "y", ToString_GLfloat(y)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->Uniform2f(context, location, x, y); +#endif // !INTERPOSE +} +static void Uniform2fv_1_0(PP_Resource context, GLint location, GLsizei count, const GLfloat* v) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"Uniform2fv\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "location", ToString_GLint(location)); + AddProp(ss, "count", ToString_GLsizei(count)); + AddProp(ss, "v", ToString_GLfloat_ptr_t(v)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->Uniform2fv(context, location, count, v); +#endif // !INTERPOSE +} +static void Uniform2i_1_0(PP_Resource context, GLint location, GLint x, GLint y) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"Uniform2i\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "location", ToString_GLint(location)); + AddProp(ss, "x", ToString_GLint(x)); + AddProp(ss, "y", ToString_GLint(y)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->Uniform2i(context, location, x, y); +#endif // !INTERPOSE +} +static void Uniform2iv_1_0(PP_Resource context, GLint location, GLsizei count, const GLint* v) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"Uniform2iv\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "location", ToString_GLint(location)); + AddProp(ss, "count", ToString_GLsizei(count)); + AddProp(ss, "v", ToString_GLint_ptr_t(v)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->Uniform2iv(context, location, count, v); +#endif // !INTERPOSE +} +static void Uniform3f_1_0(PP_Resource context, GLint location, GLfloat x, GLfloat y, GLfloat z) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"Uniform3f\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "location", ToString_GLint(location)); + AddProp(ss, "x", ToString_GLfloat(x)); + AddProp(ss, "y", ToString_GLfloat(y)); + AddProp(ss, "z", ToString_GLfloat(z)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->Uniform3f(context, location, x, y, z); +#endif // !INTERPOSE +} +static void Uniform3fv_1_0(PP_Resource context, GLint location, GLsizei count, const GLfloat* v) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"Uniform3fv\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "location", ToString_GLint(location)); + AddProp(ss, "count", ToString_GLsizei(count)); + AddProp(ss, "v", ToString_GLfloat_ptr_t(v)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->Uniform3fv(context, location, count, v); +#endif // !INTERPOSE +} +static void Uniform3i_1_0(PP_Resource context, GLint location, GLint x, GLint y, GLint z) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"Uniform3i\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "location", ToString_GLint(location)); + AddProp(ss, "x", ToString_GLint(x)); + AddProp(ss, "y", ToString_GLint(y)); + AddProp(ss, "z", ToString_GLint(z)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->Uniform3i(context, location, x, y, z); +#endif // !INTERPOSE +} +static void Uniform3iv_1_0(PP_Resource context, GLint location, GLsizei count, const GLint* v) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"Uniform3iv\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "location", ToString_GLint(location)); + AddProp(ss, "count", ToString_GLsizei(count)); + AddProp(ss, "v", ToString_GLint_ptr_t(v)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->Uniform3iv(context, location, count, v); +#endif // !INTERPOSE +} +static void Uniform4f_1_0(PP_Resource context, GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"Uniform4f\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "location", ToString_GLint(location)); + AddProp(ss, "x", ToString_GLfloat(x)); + AddProp(ss, "y", ToString_GLfloat(y)); + AddProp(ss, "z", ToString_GLfloat(z)); + AddProp(ss, "w", ToString_GLfloat(w)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->Uniform4f(context, location, x, y, z, w); +#endif // !INTERPOSE +} +static void Uniform4fv_1_0(PP_Resource context, GLint location, GLsizei count, const GLfloat* v) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"Uniform4fv\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "location", ToString_GLint(location)); + AddProp(ss, "count", ToString_GLsizei(count)); + AddProp(ss, "v", ToString_GLfloat_ptr_t(v)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->Uniform4fv(context, location, count, v); +#endif // !INTERPOSE +} +static void Uniform4i_1_0(PP_Resource context, GLint location, GLint x, GLint y, GLint z, GLint w) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"Uniform4i\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "location", ToString_GLint(location)); + AddProp(ss, "x", ToString_GLint(x)); + AddProp(ss, "y", ToString_GLint(y)); + AddProp(ss, "z", ToString_GLint(z)); + AddProp(ss, "w", ToString_GLint(w)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->Uniform4i(context, location, x, y, z, w); +#endif // !INTERPOSE +} +static void Uniform4iv_1_0(PP_Resource context, GLint location, GLsizei count, const GLint* v) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"Uniform4iv\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "location", ToString_GLint(location)); + AddProp(ss, "count", ToString_GLsizei(count)); + AddProp(ss, "v", ToString_GLint_ptr_t(v)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->Uniform4iv(context, location, count, v); +#endif // !INTERPOSE +} +static void UniformMatrix2fv_1_0(PP_Resource context, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"UniformMatrix2fv\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "location", ToString_GLint(location)); + AddProp(ss, "count", ToString_GLsizei(count)); + AddProp(ss, "transpose", ToString_GLboolean(transpose)); + AddProp(ss, "value", ToString_GLfloat_ptr_t(value)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->UniformMatrix2fv(context, location, count, transpose, value); +#endif // !INTERPOSE +} +static void UniformMatrix3fv_1_0(PP_Resource context, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"UniformMatrix3fv\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "location", ToString_GLint(location)); + AddProp(ss, "count", ToString_GLsizei(count)); + AddProp(ss, "transpose", ToString_GLboolean(transpose)); + { + BeginProp(ss, "value"); + BeginElements(ss); + for (uint32_t _n = 0; _n < count * 9; ++_n) { + AddElement(ss, ToString_GLfloat(value[_n])); + } + EndElements(ss); + } + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->UniformMatrix3fv(context, location, count, transpose, value); +#endif // !INTERPOSE +} +static void UniformMatrix4fv_1_0(PP_Resource context, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"UniformMatrix4fv\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "location", ToString_GLint(location)); + AddProp(ss, "count", ToString_GLsizei(count)); + AddProp(ss, "transpose", ToString_GLboolean(transpose)); + AddProp(ss, "value", ToString_GLfloat_ptr_t(value)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->UniformMatrix4fv(context, location, count, transpose, value); +#endif // !INTERPOSE +} +static void UseProgram_1_0(PP_Resource context, GLuint program) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"UseProgram\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "program", ToString_GLuint(program)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->UseProgram(context, program); +#endif // !INTERPOSE +} +static void ValidateProgram_1_0(PP_Resource context, GLuint program) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"ValidateProgram\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "program", ToString_GLuint(program)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->ValidateProgram(context, program); +#endif // !INTERPOSE +} +static void VertexAttrib1f_1_0(PP_Resource context, GLuint indx, GLfloat x) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"VertexAttrib1f\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "indx", ToString_GLuint(indx)); + AddProp(ss, "x", ToString_GLfloat(x)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->VertexAttrib1f(context, indx, x); +#endif // !INTERPOSE +} +static void VertexAttrib1fv_1_0(PP_Resource context, GLuint indx, const GLfloat* values) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"VertexAttrib1fv\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "indx", ToString_GLuint(indx)); + AddProp(ss, "values", ToString_GLfloat_ptr_t(values)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->VertexAttrib1fv(context, indx, values); +#endif // !INTERPOSE +} +static void VertexAttrib2f_1_0(PP_Resource context, GLuint indx, GLfloat x, GLfloat y) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"VertexAttrib2f\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "indx", ToString_GLuint(indx)); + AddProp(ss, "x", ToString_GLfloat(x)); + AddProp(ss, "y", ToString_GLfloat(y)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->VertexAttrib2f(context, indx, x, y); +#endif // !INTERPOSE +} +static void VertexAttrib2fv_1_0(PP_Resource context, GLuint indx, const GLfloat* values) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"VertexAttrib2fv\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "indx", ToString_GLuint(indx)); + AddProp(ss, "values", ToString_GLfloat_ptr_t(values)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->VertexAttrib2fv(context, indx, values); +#endif // !INTERPOSE +} +static void VertexAttrib3f_1_0(PP_Resource context, GLuint indx, GLfloat x, GLfloat y, GLfloat z) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"VertexAttrib3f\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "indx", ToString_GLuint(indx)); + AddProp(ss, "x", ToString_GLfloat(x)); + AddProp(ss, "y", ToString_GLfloat(y)); + AddProp(ss, "z", ToString_GLfloat(z)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->VertexAttrib3f(context, indx, x, y, z); +#endif // !INTERPOSE +} +static void VertexAttrib3fv_1_0(PP_Resource context, GLuint indx, const GLfloat* values) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"VertexAttrib3fv\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "indx", ToString_GLuint(indx)); + AddProp(ss, "values", ToString_GLfloat_ptr_t(values)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->VertexAttrib3fv(context, indx, values); +#endif // !INTERPOSE +} +static void VertexAttrib4f_1_0(PP_Resource context, GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"VertexAttrib4f\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "indx", ToString_GLuint(indx)); + AddProp(ss, "x", ToString_GLfloat(x)); + AddProp(ss, "y", ToString_GLfloat(y)); + AddProp(ss, "z", ToString_GLfloat(z)); + AddProp(ss, "w", ToString_GLfloat(w)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->VertexAttrib4f(context, indx, x, y, z, w); +#endif // !INTERPOSE +} +static void VertexAttrib4fv_1_0(PP_Resource context, GLuint indx, const GLfloat* values) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"VertexAttrib4fv\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "indx", ToString_GLuint(indx)); + AddProp(ss, "values", ToString_GLfloat_ptr_t(values)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->VertexAttrib4fv(context, indx, values); +#endif // !INTERPOSE +} +static void VertexAttribPointer_1_0(PP_Resource context, GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void* ptr) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"VertexAttribPointer\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "indx", ToString_GLuint(indx)); + AddProp(ss, "size", ToString_GLint(size)); + AddProp(ss, "type", ToString_GLenum(type)); + AddProp(ss, "normalized", ToString_GLboolean(normalized)); + AddProp(ss, "stride", ToString_GLsizei(stride)); + AddProp(ss, "ptr", ToString_mem_t(ptr)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->VertexAttribPointer(context, indx, size, type, normalized, stride, ptr); +#endif // !INTERPOSE +} +static void Viewport_1_0(PP_Resource context, GLint x, GLint y, GLsizei width, GLsizei height) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"Viewport\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "x", ToString_GLint(x)); + AddProp(ss, "y", ToString_GLint(y)); + AddProp(ss, "width", ToString_GLsizei(width)); + AddProp(ss, "height", ToString_GLsizei(height)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2_1_0*)RealGetInterface("PPB_OpenGLES2;1.0"))->Viewport(context, x, y, width, height); +#endif // !INTERPOSE +} +} +static PPB_OpenGLES2_1_0 _PPB_OpenGLES2_1_0 = { + ns_PPB_OpenGLES2_1_0::ActiveTexture_1_0, + ns_PPB_OpenGLES2_1_0::AttachShader_1_0, + ns_PPB_OpenGLES2_1_0::BindAttribLocation_1_0, + ns_PPB_OpenGLES2_1_0::BindBuffer_1_0, + ns_PPB_OpenGLES2_1_0::BindFramebuffer_1_0, + ns_PPB_OpenGLES2_1_0::BindRenderbuffer_1_0, + ns_PPB_OpenGLES2_1_0::BindTexture_1_0, + ns_PPB_OpenGLES2_1_0::BlendColor_1_0, + ns_PPB_OpenGLES2_1_0::BlendEquation_1_0, + ns_PPB_OpenGLES2_1_0::BlendEquationSeparate_1_0, + ns_PPB_OpenGLES2_1_0::BlendFunc_1_0, + ns_PPB_OpenGLES2_1_0::BlendFuncSeparate_1_0, + ns_PPB_OpenGLES2_1_0::BufferData_1_0, + ns_PPB_OpenGLES2_1_0::BufferSubData_1_0, + ns_PPB_OpenGLES2_1_0::CheckFramebufferStatus_1_0, + ns_PPB_OpenGLES2_1_0::Clear_1_0, + ns_PPB_OpenGLES2_1_0::ClearColor_1_0, + ns_PPB_OpenGLES2_1_0::ClearDepthf_1_0, + ns_PPB_OpenGLES2_1_0::ClearStencil_1_0, + ns_PPB_OpenGLES2_1_0::ColorMask_1_0, + ns_PPB_OpenGLES2_1_0::CompileShader_1_0, + ns_PPB_OpenGLES2_1_0::CompressedTexImage2D_1_0, + ns_PPB_OpenGLES2_1_0::CompressedTexSubImage2D_1_0, + ns_PPB_OpenGLES2_1_0::CopyTexImage2D_1_0, + ns_PPB_OpenGLES2_1_0::CopyTexSubImage2D_1_0, + ns_PPB_OpenGLES2_1_0::CreateProgram_1_0, + ns_PPB_OpenGLES2_1_0::CreateShader_1_0, + ns_PPB_OpenGLES2_1_0::CullFace_1_0, + ns_PPB_OpenGLES2_1_0::DeleteBuffers_1_0, + ns_PPB_OpenGLES2_1_0::DeleteFramebuffers_1_0, + ns_PPB_OpenGLES2_1_0::DeleteProgram_1_0, + ns_PPB_OpenGLES2_1_0::DeleteRenderbuffers_1_0, + ns_PPB_OpenGLES2_1_0::DeleteShader_1_0, + ns_PPB_OpenGLES2_1_0::DeleteTextures_1_0, + ns_PPB_OpenGLES2_1_0::DepthFunc_1_0, + ns_PPB_OpenGLES2_1_0::DepthMask_1_0, + ns_PPB_OpenGLES2_1_0::DepthRangef_1_0, + ns_PPB_OpenGLES2_1_0::DetachShader_1_0, + ns_PPB_OpenGLES2_1_0::Disable_1_0, + ns_PPB_OpenGLES2_1_0::DisableVertexAttribArray_1_0, + ns_PPB_OpenGLES2_1_0::DrawArrays_1_0, + ns_PPB_OpenGLES2_1_0::DrawElements_1_0, + ns_PPB_OpenGLES2_1_0::Enable_1_0, + ns_PPB_OpenGLES2_1_0::EnableVertexAttribArray_1_0, + ns_PPB_OpenGLES2_1_0::Finish_1_0, + ns_PPB_OpenGLES2_1_0::Flush_1_0, + ns_PPB_OpenGLES2_1_0::FramebufferRenderbuffer_1_0, + ns_PPB_OpenGLES2_1_0::FramebufferTexture2D_1_0, + ns_PPB_OpenGLES2_1_0::FrontFace_1_0, + ns_PPB_OpenGLES2_1_0::GenBuffers_1_0, + ns_PPB_OpenGLES2_1_0::GenerateMipmap_1_0, + ns_PPB_OpenGLES2_1_0::GenFramebuffers_1_0, + ns_PPB_OpenGLES2_1_0::GenRenderbuffers_1_0, + ns_PPB_OpenGLES2_1_0::GenTextures_1_0, + ns_PPB_OpenGLES2_1_0::GetActiveAttrib_1_0, + ns_PPB_OpenGLES2_1_0::GetActiveUniform_1_0, + ns_PPB_OpenGLES2_1_0::GetAttachedShaders_1_0, + ns_PPB_OpenGLES2_1_0::GetAttribLocation_1_0, + ns_PPB_OpenGLES2_1_0::GetBooleanv_1_0, + ns_PPB_OpenGLES2_1_0::GetBufferParameteriv_1_0, + ns_PPB_OpenGLES2_1_0::GetError_1_0, + ns_PPB_OpenGLES2_1_0::GetFloatv_1_0, + ns_PPB_OpenGLES2_1_0::GetFramebufferAttachmentParameteriv_1_0, + ns_PPB_OpenGLES2_1_0::GetIntegerv_1_0, + ns_PPB_OpenGLES2_1_0::GetProgramiv_1_0, + ns_PPB_OpenGLES2_1_0::GetProgramInfoLog_1_0, + ns_PPB_OpenGLES2_1_0::GetRenderbufferParameteriv_1_0, + ns_PPB_OpenGLES2_1_0::GetShaderiv_1_0, + ns_PPB_OpenGLES2_1_0::GetShaderInfoLog_1_0, + ns_PPB_OpenGLES2_1_0::GetShaderPrecisionFormat_1_0, + ns_PPB_OpenGLES2_1_0::GetShaderSource_1_0, + ns_PPB_OpenGLES2_1_0::GetString_1_0, + ns_PPB_OpenGLES2_1_0::GetTexParameterfv_1_0, + ns_PPB_OpenGLES2_1_0::GetTexParameteriv_1_0, + ns_PPB_OpenGLES2_1_0::GetUniformfv_1_0, + ns_PPB_OpenGLES2_1_0::GetUniformiv_1_0, + ns_PPB_OpenGLES2_1_0::GetUniformLocation_1_0, + ns_PPB_OpenGLES2_1_0::GetVertexAttribfv_1_0, + ns_PPB_OpenGLES2_1_0::GetVertexAttribiv_1_0, + ns_PPB_OpenGLES2_1_0::GetVertexAttribPointerv_1_0, + ns_PPB_OpenGLES2_1_0::Hint_1_0, + ns_PPB_OpenGLES2_1_0::IsBuffer_1_0, + ns_PPB_OpenGLES2_1_0::IsEnabled_1_0, + ns_PPB_OpenGLES2_1_0::IsFramebuffer_1_0, + ns_PPB_OpenGLES2_1_0::IsProgram_1_0, + ns_PPB_OpenGLES2_1_0::IsRenderbuffer_1_0, + ns_PPB_OpenGLES2_1_0::IsShader_1_0, + ns_PPB_OpenGLES2_1_0::IsTexture_1_0, + ns_PPB_OpenGLES2_1_0::LineWidth_1_0, + ns_PPB_OpenGLES2_1_0::LinkProgram_1_0, + ns_PPB_OpenGLES2_1_0::PixelStorei_1_0, + ns_PPB_OpenGLES2_1_0::PolygonOffset_1_0, + ns_PPB_OpenGLES2_1_0::ReadPixels_1_0, + ns_PPB_OpenGLES2_1_0::ReleaseShaderCompiler_1_0, + ns_PPB_OpenGLES2_1_0::RenderbufferStorage_1_0, + ns_PPB_OpenGLES2_1_0::SampleCoverage_1_0, + ns_PPB_OpenGLES2_1_0::Scissor_1_0, + ns_PPB_OpenGLES2_1_0::ShaderBinary_1_0, + ns_PPB_OpenGLES2_1_0::ShaderSource_1_0, + ns_PPB_OpenGLES2_1_0::StencilFunc_1_0, + ns_PPB_OpenGLES2_1_0::StencilFuncSeparate_1_0, + ns_PPB_OpenGLES2_1_0::StencilMask_1_0, + ns_PPB_OpenGLES2_1_0::StencilMaskSeparate_1_0, + ns_PPB_OpenGLES2_1_0::StencilOp_1_0, + ns_PPB_OpenGLES2_1_0::StencilOpSeparate_1_0, + ns_PPB_OpenGLES2_1_0::TexImage2D_1_0, + ns_PPB_OpenGLES2_1_0::TexParameterf_1_0, + ns_PPB_OpenGLES2_1_0::TexParameterfv_1_0, + ns_PPB_OpenGLES2_1_0::TexParameteri_1_0, + ns_PPB_OpenGLES2_1_0::TexParameteriv_1_0, + ns_PPB_OpenGLES2_1_0::TexSubImage2D_1_0, + ns_PPB_OpenGLES2_1_0::Uniform1f_1_0, + ns_PPB_OpenGLES2_1_0::Uniform1fv_1_0, + ns_PPB_OpenGLES2_1_0::Uniform1i_1_0, + ns_PPB_OpenGLES2_1_0::Uniform1iv_1_0, + ns_PPB_OpenGLES2_1_0::Uniform2f_1_0, + ns_PPB_OpenGLES2_1_0::Uniform2fv_1_0, + ns_PPB_OpenGLES2_1_0::Uniform2i_1_0, + ns_PPB_OpenGLES2_1_0::Uniform2iv_1_0, + ns_PPB_OpenGLES2_1_0::Uniform3f_1_0, + ns_PPB_OpenGLES2_1_0::Uniform3fv_1_0, + ns_PPB_OpenGLES2_1_0::Uniform3i_1_0, + ns_PPB_OpenGLES2_1_0::Uniform3iv_1_0, + ns_PPB_OpenGLES2_1_0::Uniform4f_1_0, + ns_PPB_OpenGLES2_1_0::Uniform4fv_1_0, + ns_PPB_OpenGLES2_1_0::Uniform4i_1_0, + ns_PPB_OpenGLES2_1_0::Uniform4iv_1_0, + ns_PPB_OpenGLES2_1_0::UniformMatrix2fv_1_0, + ns_PPB_OpenGLES2_1_0::UniformMatrix3fv_1_0, + ns_PPB_OpenGLES2_1_0::UniformMatrix4fv_1_0, + ns_PPB_OpenGLES2_1_0::UseProgram_1_0, + ns_PPB_OpenGLES2_1_0::ValidateProgram_1_0, + ns_PPB_OpenGLES2_1_0::VertexAttrib1f_1_0, + ns_PPB_OpenGLES2_1_0::VertexAttrib1fv_1_0, + ns_PPB_OpenGLES2_1_0::VertexAttrib2f_1_0, + ns_PPB_OpenGLES2_1_0::VertexAttrib2fv_1_0, + ns_PPB_OpenGLES2_1_0::VertexAttrib3f_1_0, + ns_PPB_OpenGLES2_1_0::VertexAttrib3fv_1_0, + ns_PPB_OpenGLES2_1_0::VertexAttrib4f_1_0, + ns_PPB_OpenGLES2_1_0::VertexAttrib4fv_1_0, + ns_PPB_OpenGLES2_1_0::VertexAttribPointer_1_0, + ns_PPB_OpenGLES2_1_0::Viewport_1_0, +}; +const string ToString_PPB_OpenGLES2(const PPB_OpenGLES2_1_0 *v) { + stringstream s; + s << v; + return s.str(); +} +namespace ns_PPB_OpenGLES2InstancedArrays_1_0 { +static void DrawArraysInstancedANGLE_1_0(PP_Resource context, GLenum mode, GLint first, GLsizei count, GLsizei primcount) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2InstancedArrays\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"DrawArraysInstancedANGLE\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "mode", ToString_GLenum(mode)); + AddProp(ss, "first", ToString_GLint(first)); + AddProp(ss, "count", ToString_GLsizei(count)); + AddProp(ss, "primcount", ToString_GLsizei(primcount)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2InstancedArrays_1_0*)RealGetInterface("PPB_OpenGLES2InstancedArrays;1.0"))->DrawArraysInstancedANGLE(context, mode, first, count, primcount); +#endif // !INTERPOSE +} +static void DrawElementsInstancedANGLE_1_0(PP_Resource context, GLenum mode, GLsizei count, GLenum type, const void* indices, GLsizei primcount) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2InstancedArrays\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"DrawElementsInstancedANGLE\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "mode", ToString_GLenum(mode)); + AddProp(ss, "count", ToString_GLsizei(count)); + AddProp(ss, "type", ToString_GLenum(type)); + AddProp(ss, "indices", ToString_mem_t(indices)); + AddProp(ss, "primcount", ToString_GLsizei(primcount)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2InstancedArrays_1_0*)RealGetInterface("PPB_OpenGLES2InstancedArrays;1.0"))->DrawElementsInstancedANGLE(context, mode, count, type, indices, primcount); +#endif // !INTERPOSE +} +static void VertexAttribDivisorANGLE_1_0(PP_Resource context, GLuint index, GLuint divisor) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2InstancedArrays\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"VertexAttribDivisorANGLE\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "index", ToString_GLuint(index)); + AddProp(ss, "divisor", ToString_GLuint(divisor)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2InstancedArrays_1_0*)RealGetInterface("PPB_OpenGLES2InstancedArrays;1.0"))->VertexAttribDivisorANGLE(context, index, divisor); +#endif // !INTERPOSE +} +} +static PPB_OpenGLES2InstancedArrays_1_0 _PPB_OpenGLES2InstancedArrays_1_0 = { + ns_PPB_OpenGLES2InstancedArrays_1_0::DrawArraysInstancedANGLE_1_0, + ns_PPB_OpenGLES2InstancedArrays_1_0::DrawElementsInstancedANGLE_1_0, + ns_PPB_OpenGLES2InstancedArrays_1_0::VertexAttribDivisorANGLE_1_0, +}; +const string ToString_PPB_OpenGLES2InstancedArrays(const PPB_OpenGLES2InstancedArrays_1_0 *v) { + stringstream s; + s << v; + return s.str(); +} +namespace ns_PPB_OpenGLES2FramebufferBlit_1_0 { +static void BlitFramebufferEXT_1_0(PP_Resource context, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2FramebufferBlit\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"BlitFramebufferEXT\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "srcX0", ToString_GLint(srcX0)); + AddProp(ss, "srcY0", ToString_GLint(srcY0)); + AddProp(ss, "srcX1", ToString_GLint(srcX1)); + AddProp(ss, "srcY1", ToString_GLint(srcY1)); + AddProp(ss, "dstX0", ToString_GLint(dstX0)); + AddProp(ss, "dstY0", ToString_GLint(dstY0)); + AddProp(ss, "dstX1", ToString_GLint(dstX1)); + AddProp(ss, "dstY1", ToString_GLint(dstY1)); + AddProp(ss, "mask", ToString_GLbitfield(mask)); + AddProp(ss, "filter", ToString_GLenum(filter)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2FramebufferBlit_1_0*)RealGetInterface("PPB_OpenGLES2FramebufferBlit;1.0"))->BlitFramebufferEXT(context, srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter); +#endif // !INTERPOSE +} +} +static PPB_OpenGLES2FramebufferBlit_1_0 _PPB_OpenGLES2FramebufferBlit_1_0 = { + ns_PPB_OpenGLES2FramebufferBlit_1_0::BlitFramebufferEXT_1_0, +}; +const string ToString_PPB_OpenGLES2FramebufferBlit(const PPB_OpenGLES2FramebufferBlit_1_0 *v) { + stringstream s; + s << v; + return s.str(); +} +namespace ns_PPB_OpenGLES2FramebufferMultisample_1_0 { +static void RenderbufferStorageMultisampleEXT_1_0(PP_Resource context, GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2FramebufferMultisample\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"RenderbufferStorageMultisampleEXT\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "target", ToString_GLenum(target)); + AddProp(ss, "samples", ToString_GLsizei(samples)); + AddProp(ss, "internalformat", ToString_GLenum(internalformat)); + AddProp(ss, "width", ToString_GLsizei(width)); + AddProp(ss, "height", ToString_GLsizei(height)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2FramebufferMultisample_1_0*)RealGetInterface("PPB_OpenGLES2FramebufferMultisample;1.0"))->RenderbufferStorageMultisampleEXT(context, target, samples, internalformat, width, height); +#endif // !INTERPOSE +} +} +static PPB_OpenGLES2FramebufferMultisample_1_0 _PPB_OpenGLES2FramebufferMultisample_1_0 = { + ns_PPB_OpenGLES2FramebufferMultisample_1_0::RenderbufferStorageMultisampleEXT_1_0, +}; +const string ToString_PPB_OpenGLES2FramebufferMultisample(const PPB_OpenGLES2FramebufferMultisample_1_0 *v) { + stringstream s; + s << v; + return s.str(); +} +namespace ns_PPB_OpenGLES2ChromiumEnableFeature_1_0 { +static GLboolean EnableFeatureCHROMIUM_1_0(PP_Resource context, const char* feature) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2ChromiumEnableFeature\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"EnableFeatureCHROMIUM\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "feature", ToString_cstr_t(feature)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + GLboolean rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_GLboolean(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + GLboolean rval = ((PPB_OpenGLES2ChromiumEnableFeature_1_0*)RealGetInterface("PPB_OpenGLES2ChromiumEnableFeature;1.0"))->EnableFeatureCHROMIUM(context, feature); + printf("RPC response: ["); + printf("%s", ToString_GLboolean(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +} +static PPB_OpenGLES2ChromiumEnableFeature_1_0 _PPB_OpenGLES2ChromiumEnableFeature_1_0 = { + ns_PPB_OpenGLES2ChromiumEnableFeature_1_0::EnableFeatureCHROMIUM_1_0, +}; +const string ToString_PPB_OpenGLES2ChromiumEnableFeature(const PPB_OpenGLES2ChromiumEnableFeature_1_0 *v) { + stringstream s; + s << v; + return s.str(); +} +namespace ns_PPB_OpenGLES2ChromiumMapSub_1_0 { +static void* MapBufferSubDataCHROMIUM_1_0(PP_Resource context, GLuint target, GLintptr offset, GLsizeiptr size, GLenum access) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2ChromiumMapSub\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"MapBufferSubDataCHROMIUM\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "target", ToString_GLuint(target)); + AddProp(ss, "offset", ToString_GLintptr(offset)); + AddProp(ss, "size", ToString_GLsizeiptr(size)); + AddProp(ss, "access", ToString_GLenum(access)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + void* rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_mem_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + void* rval = ((PPB_OpenGLES2ChromiumMapSub_1_0*)RealGetInterface("PPB_OpenGLES2ChromiumMapSub;1.0"))->MapBufferSubDataCHROMIUM(context, target, offset, size, access); + printf("RPC response: ["); + printf("%s", ToString_mem_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static void UnmapBufferSubDataCHROMIUM_1_0(PP_Resource context, const void* mem) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2ChromiumMapSub\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"UnmapBufferSubDataCHROMIUM\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "mem", ToString_mem_t(mem)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2ChromiumMapSub_1_0*)RealGetInterface("PPB_OpenGLES2ChromiumMapSub;1.0"))->UnmapBufferSubDataCHROMIUM(context, mem); +#endif // !INTERPOSE +} +static void* MapTexSubImage2DCHROMIUM_1_0(PP_Resource context, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, GLenum access) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2ChromiumMapSub\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"MapTexSubImage2DCHROMIUM\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "target", ToString_GLenum(target)); + AddProp(ss, "level", ToString_GLint(level)); + AddProp(ss, "xoffset", ToString_GLint(xoffset)); + AddProp(ss, "yoffset", ToString_GLint(yoffset)); + AddProp(ss, "width", ToString_GLsizei(width)); + AddProp(ss, "height", ToString_GLsizei(height)); + AddProp(ss, "format", ToString_GLenum(format)); + AddProp(ss, "type", ToString_GLenum(type)); + AddProp(ss, "access", ToString_GLenum(access)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + void* rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_mem_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + void* rval = ((PPB_OpenGLES2ChromiumMapSub_1_0*)RealGetInterface("PPB_OpenGLES2ChromiumMapSub;1.0"))->MapTexSubImage2DCHROMIUM(context, target, level, xoffset, yoffset, width, height, format, type, access); + printf("RPC response: ["); + printf("%s", ToString_mem_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static void UnmapTexSubImage2DCHROMIUM_1_0(PP_Resource context, const void* mem) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2ChromiumMapSub\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"UnmapTexSubImage2DCHROMIUM\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "mem", ToString_mem_t(mem)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2ChromiumMapSub_1_0*)RealGetInterface("PPB_OpenGLES2ChromiumMapSub;1.0"))->UnmapTexSubImage2DCHROMIUM(context, mem); +#endif // !INTERPOSE +} +} +static PPB_OpenGLES2ChromiumMapSub_1_0 _PPB_OpenGLES2ChromiumMapSub_1_0 = { + ns_PPB_OpenGLES2ChromiumMapSub_1_0::MapBufferSubDataCHROMIUM_1_0, + ns_PPB_OpenGLES2ChromiumMapSub_1_0::UnmapBufferSubDataCHROMIUM_1_0, + ns_PPB_OpenGLES2ChromiumMapSub_1_0::MapTexSubImage2DCHROMIUM_1_0, + ns_PPB_OpenGLES2ChromiumMapSub_1_0::UnmapTexSubImage2DCHROMIUM_1_0, +}; +const string ToString_PPB_OpenGLES2ChromiumMapSub(const PPB_OpenGLES2ChromiumMapSub_1_0 *v) { + stringstream s; + s << v; + return s.str(); +} +namespace ns_PPB_OpenGLES2Query_1_0 { +static void GenQueriesEXT_1_0(PP_Resource context, GLsizei n, GLuint* queries) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2Query\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"GenQueriesEXT\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "n", ToString_GLsizei(n)); + AddProp(ss, "queries", PointerToString(queries)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectObjectAndGotoFirstProperty(); + iterator.skip(); + FromJSON_GLuint_ptr_t(iterator, queries); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2Query_1_0*)RealGetInterface("PPB_OpenGLES2Query;1.0"))->GenQueriesEXT(context, n, queries); + printf("RPC response: ["); + printf("["); + std::stringstream os; + BeginProps(os); + AddProp(os, "queries", ToString_GLuint_ptr_t(queries)); + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); +#endif // !INTERPOSE +} +static void DeleteQueriesEXT_1_0(PP_Resource context, GLsizei n, const GLuint* queries) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2Query\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"DeleteQueriesEXT\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "n", ToString_GLsizei(n)); + AddProp(ss, "queries", ToString_GLuint_ptr_t(queries)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2Query_1_0*)RealGetInterface("PPB_OpenGLES2Query;1.0"))->DeleteQueriesEXT(context, n, queries); +#endif // !INTERPOSE +} +static GLboolean IsQueryEXT_1_0(PP_Resource context, GLuint id) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2Query\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"IsQueryEXT\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "id", ToString_GLuint(id)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + GLboolean rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_GLboolean(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + GLboolean rval = ((PPB_OpenGLES2Query_1_0*)RealGetInterface("PPB_OpenGLES2Query;1.0"))->IsQueryEXT(context, id); + printf("RPC response: ["); + printf("%s", ToString_GLboolean(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static void BeginQueryEXT_1_0(PP_Resource context, GLenum target, GLuint id) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2Query\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"BeginQueryEXT\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "target", ToString_GLenum(target)); + AddProp(ss, "id", ToString_GLuint(id)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2Query_1_0*)RealGetInterface("PPB_OpenGLES2Query;1.0"))->BeginQueryEXT(context, target, id); +#endif // !INTERPOSE +} +static void EndQueryEXT_1_0(PP_Resource context, GLenum target) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2Query\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"EndQueryEXT\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "target", ToString_GLenum(target)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2Query_1_0*)RealGetInterface("PPB_OpenGLES2Query;1.0"))->EndQueryEXT(context, target); +#endif // !INTERPOSE +} +static void GetQueryivEXT_1_0(PP_Resource context, GLenum target, GLenum pname, GLint* params) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2Query\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"GetQueryivEXT\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "target", ToString_GLenum(target)); + AddProp(ss, "pname", ToString_GLenum(pname)); + AddProp(ss, "params", PointerToString(params)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectObjectAndGotoFirstProperty(); + iterator.skip(); + FromJSON_GLint_ptr_t(iterator, params); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2Query_1_0*)RealGetInterface("PPB_OpenGLES2Query;1.0"))->GetQueryivEXT(context, target, pname, params); + printf("RPC response: ["); + printf("["); + std::stringstream os; + BeginProps(os); + AddProp(os, "params", ToString_GLint_ptr_t(params)); + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); +#endif // !INTERPOSE +} +static void GetQueryObjectuivEXT_1_0(PP_Resource context, GLuint id, GLenum pname, GLuint* params) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2Query\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"GetQueryObjectuivEXT\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "id", ToString_GLuint(id)); + AddProp(ss, "pname", ToString_GLenum(pname)); + AddProp(ss, "params", PointerToString(params)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectObjectAndGotoFirstProperty(); + iterator.skip(); + FromJSON_GLuint_ptr_t(iterator, params); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2Query_1_0*)RealGetInterface("PPB_OpenGLES2Query;1.0"))->GetQueryObjectuivEXT(context, id, pname, params); + printf("RPC response: ["); + printf("["); + std::stringstream os; + BeginProps(os); + AddProp(os, "params", ToString_GLuint_ptr_t(params)); + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); +#endif // !INTERPOSE +} +} +static PPB_OpenGLES2Query_1_0 _PPB_OpenGLES2Query_1_0 = { + ns_PPB_OpenGLES2Query_1_0::GenQueriesEXT_1_0, + ns_PPB_OpenGLES2Query_1_0::DeleteQueriesEXT_1_0, + ns_PPB_OpenGLES2Query_1_0::IsQueryEXT_1_0, + ns_PPB_OpenGLES2Query_1_0::BeginQueryEXT_1_0, + ns_PPB_OpenGLES2Query_1_0::EndQueryEXT_1_0, + ns_PPB_OpenGLES2Query_1_0::GetQueryivEXT_1_0, + ns_PPB_OpenGLES2Query_1_0::GetQueryObjectuivEXT_1_0, +}; +const string ToString_PPB_OpenGLES2Query(const PPB_OpenGLES2Query_1_0 *v) { + stringstream s; + s << v; + return s.str(); +} +namespace ns_PPB_OpenGLES2VertexArrayObject_1_0 { +static void GenVertexArraysOES_1_0(PP_Resource context, GLsizei n, GLuint* arrays) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2VertexArrayObject\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"GenVertexArraysOES\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "n", ToString_GLsizei(n)); + AddProp(ss, "arrays", PointerToString(arrays)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectObjectAndGotoFirstProperty(); + iterator.skip(); + FromJSON_GLuint_ptr_t(iterator, arrays); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2VertexArrayObject_1_0*)RealGetInterface("PPB_OpenGLES2VertexArrayObject;1.0"))->GenVertexArraysOES(context, n, arrays); + printf("RPC response: ["); + printf("["); + std::stringstream os; + BeginProps(os); + AddProp(os, "arrays", ToString_GLuint_ptr_t(arrays)); + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); +#endif // !INTERPOSE +} +static void DeleteVertexArraysOES_1_0(PP_Resource context, GLsizei n, const GLuint* arrays) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2VertexArrayObject\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"DeleteVertexArraysOES\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "n", ToString_GLsizei(n)); + AddProp(ss, "arrays", ToString_GLuint_ptr_t(arrays)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2VertexArrayObject_1_0*)RealGetInterface("PPB_OpenGLES2VertexArrayObject;1.0"))->DeleteVertexArraysOES(context, n, arrays); +#endif // !INTERPOSE +} +static GLboolean IsVertexArrayOES_1_0(PP_Resource context, GLuint array) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2VertexArrayObject\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"IsVertexArrayOES\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "array", ToString_GLuint(array)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + GLboolean rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_GLboolean(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + GLboolean rval = ((PPB_OpenGLES2VertexArrayObject_1_0*)RealGetInterface("PPB_OpenGLES2VertexArrayObject;1.0"))->IsVertexArrayOES(context, array); + printf("RPC response: ["); + printf("%s", ToString_GLboolean(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static void BindVertexArrayOES_1_0(PP_Resource context, GLuint array) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2VertexArrayObject\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"BindVertexArrayOES\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "array", ToString_GLuint(array)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2VertexArrayObject_1_0*)RealGetInterface("PPB_OpenGLES2VertexArrayObject;1.0"))->BindVertexArrayOES(context, array); +#endif // !INTERPOSE +} +} +static PPB_OpenGLES2VertexArrayObject_1_0 _PPB_OpenGLES2VertexArrayObject_1_0 = { + ns_PPB_OpenGLES2VertexArrayObject_1_0::GenVertexArraysOES_1_0, + ns_PPB_OpenGLES2VertexArrayObject_1_0::DeleteVertexArraysOES_1_0, + ns_PPB_OpenGLES2VertexArrayObject_1_0::IsVertexArrayOES_1_0, + ns_PPB_OpenGLES2VertexArrayObject_1_0::BindVertexArrayOES_1_0, +}; +const string ToString_PPB_OpenGLES2VertexArrayObject(const PPB_OpenGLES2VertexArrayObject_1_0 *v) { + stringstream s; + s << v; + return s.str(); +} +const string ToString_PP_TCPSocket_Option(const PP_TCPSocket_Option *v) { + switch (*v) { + case 0: + return "\"PP_TCPSOCKET_OPTION_NO_DELAY\""; + case 1: + return "\"PP_TCPSOCKET_OPTION_SEND_BUFFER_SIZE\""; + case 2: + return "\"PP_TCPSOCKET_OPTION_RECV_BUFFER_SIZE\""; + default: + return "\"???\""; + } +} +const string ToString_PP_TCPSocket_Option(const PP_TCPSocket_Option &v) { + return ToString_PP_TCPSocket_Option(&v); +} +void FromJSON_PP_TCPSocket_Option(JSONIterator& iterator, PP_TCPSocket_Option &value) { + long int v; + FromJSON_int(iterator, v); + value = PP_TCPSocket_Option(v); +} +namespace ns_PPB_TCPSocket_1_0 { +static PP_Resource Create_1_0(PP_Instance instance) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_TCPSocket\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"Create\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Resource(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_TCPSocket_1_0*)RealGetInterface("PPB_TCPSocket;1.0"))->Create(instance); + printf("RPC response: ["); + printf("%s", ToString_PP_Resource(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool IsTCPSocket_1_0(PP_Resource resource) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_TCPSocket\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"IsTCPSocket\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_TCPSocket_1_0*)RealGetInterface("PPB_TCPSocket;1.0"))->IsTCPSocket(resource); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +/* skipping Bind */ +static int32_t Connect_1_0(PP_Resource tcp_socket, PP_Resource addr, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_TCPSocket\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"Connect\""); + AddProp(ss, "tcp_socket", ToString_PP_Resource(tcp_socket)); + AddProp(ss, "addr", ToString_PP_Resource(addr)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_TCPSocket_1_0*)RealGetInterface("PPB_TCPSocket;1.0"))->Connect(tcp_socket, addr, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Resource GetLocalAddress_1_0(PP_Resource tcp_socket) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_TCPSocket\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"GetLocalAddress\""); + AddProp(ss, "tcp_socket", ToString_PP_Resource(tcp_socket)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Resource(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_TCPSocket_1_0*)RealGetInterface("PPB_TCPSocket;1.0"))->GetLocalAddress(tcp_socket); + printf("RPC response: ["); + printf("%s", ToString_PP_Resource(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Resource GetRemoteAddress_1_0(PP_Resource tcp_socket) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_TCPSocket\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"GetRemoteAddress\""); + AddProp(ss, "tcp_socket", ToString_PP_Resource(tcp_socket)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Resource(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_TCPSocket_1_0*)RealGetInterface("PPB_TCPSocket;1.0"))->GetRemoteAddress(tcp_socket); + printf("RPC response: ["); + printf("%s", ToString_PP_Resource(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t Read_1_0(PP_Resource tcp_socket, char* buffer, int32_t bytes_to_read, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_TCPSocket\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"Read\""); + AddProp(ss, "tcp_socket", ToString_PP_Resource(tcp_socket)); + AddProp(ss, "buffer", PointerToString(buffer)); + AddProp(ss, "bytes_to_read", ToString_int32_t(bytes_to_read)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + iterator.skip(); + FromJSON_str_t(iterator, buffer); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_TCPSocket_1_0*)RealGetInterface("PPB_TCPSocket;1.0"))->Read(tcp_socket, buffer, bytes_to_read, logging_callback); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_int32_t(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + AddProp(os, "buffer", ToString_str_t(buffer)); + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t Write_1_0(PP_Resource tcp_socket, const char* buffer, int32_t bytes_to_write, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_TCPSocket\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"Write\""); + AddProp(ss, "tcp_socket", ToString_PP_Resource(tcp_socket)); + AddProp(ss, "buffer", ToString_str_t(buffer)); + AddProp(ss, "bytes_to_write", ToString_int32_t(bytes_to_write)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_TCPSocket_1_0*)RealGetInterface("PPB_TCPSocket;1.0"))->Write(tcp_socket, buffer, bytes_to_write, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +/* skipping Listen */ +/* skipping Accept */ +static void Close_1_0(PP_Resource tcp_socket) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_TCPSocket\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"Close\""); + AddProp(ss, "tcp_socket", ToString_PP_Resource(tcp_socket)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_TCPSocket_1_0*)RealGetInterface("PPB_TCPSocket;1.0"))->Close(tcp_socket); +#endif // !INTERPOSE +} +static int32_t SetOption_1_0(PP_Resource tcp_socket, PP_TCPSocket_Option name, struct PP_Var value, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_TCPSocket\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"SetOption\""); + AddProp(ss, "tcp_socket", ToString_PP_Resource(tcp_socket)); + AddProp(ss, "name", ToString_PP_TCPSocket_Option(name)); + AddProp(ss, "value", ToString_PP_Var(value)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_TCPSocket_1_0*)RealGetInterface("PPB_TCPSocket;1.0"))->SetOption(tcp_socket, name, value, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +/* skipping SetOption */ +} +static PPB_TCPSocket_1_0 _PPB_TCPSocket_1_0 = { + ns_PPB_TCPSocket_1_0::Create_1_0, + ns_PPB_TCPSocket_1_0::IsTCPSocket_1_0, + ns_PPB_TCPSocket_1_0::Connect_1_0, + ns_PPB_TCPSocket_1_0::GetLocalAddress_1_0, + ns_PPB_TCPSocket_1_0::GetRemoteAddress_1_0, + ns_PPB_TCPSocket_1_0::Read_1_0, + ns_PPB_TCPSocket_1_0::Write_1_0, + ns_PPB_TCPSocket_1_0::Close_1_0, + ns_PPB_TCPSocket_1_0::SetOption_1_0, +}; +const string ToString_PPB_TCPSocket(const PPB_TCPSocket_1_0 *v) { + stringstream s; + s << v; + return s.str(); +} +namespace ns_PPB_TCPSocket_1_1 { +static PP_Resource Create_1_1(PP_Instance instance) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_TCPSocket\""); + AddProp(ss, "__version", "\"1.1\""); + AddProp(ss, "__method", "\"Create\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Resource(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_TCPSocket_1_1*)RealGetInterface("PPB_TCPSocket;1.1"))->Create(instance); + printf("RPC response: ["); + printf("%s", ToString_PP_Resource(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool IsTCPSocket_1_1(PP_Resource resource) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_TCPSocket\""); + AddProp(ss, "__version", "\"1.1\""); + AddProp(ss, "__method", "\"IsTCPSocket\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_TCPSocket_1_1*)RealGetInterface("PPB_TCPSocket;1.1"))->IsTCPSocket(resource); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t Bind_1_1(PP_Resource tcp_socket, PP_Resource addr, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_TCPSocket\""); + AddProp(ss, "__version", "\"1.1\""); + AddProp(ss, "__method", "\"Bind\""); + AddProp(ss, "tcp_socket", ToString_PP_Resource(tcp_socket)); + AddProp(ss, "addr", ToString_PP_Resource(addr)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_TCPSocket_1_1*)RealGetInterface("PPB_TCPSocket;1.1"))->Bind(tcp_socket, addr, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t Connect_1_1(PP_Resource tcp_socket, PP_Resource addr, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_TCPSocket\""); + AddProp(ss, "__version", "\"1.1\""); + AddProp(ss, "__method", "\"Connect\""); + AddProp(ss, "tcp_socket", ToString_PP_Resource(tcp_socket)); + AddProp(ss, "addr", ToString_PP_Resource(addr)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_TCPSocket_1_1*)RealGetInterface("PPB_TCPSocket;1.1"))->Connect(tcp_socket, addr, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Resource GetLocalAddress_1_1(PP_Resource tcp_socket) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_TCPSocket\""); + AddProp(ss, "__version", "\"1.1\""); + AddProp(ss, "__method", "\"GetLocalAddress\""); + AddProp(ss, "tcp_socket", ToString_PP_Resource(tcp_socket)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Resource(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_TCPSocket_1_1*)RealGetInterface("PPB_TCPSocket;1.1"))->GetLocalAddress(tcp_socket); + printf("RPC response: ["); + printf("%s", ToString_PP_Resource(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Resource GetRemoteAddress_1_1(PP_Resource tcp_socket) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_TCPSocket\""); + AddProp(ss, "__version", "\"1.1\""); + AddProp(ss, "__method", "\"GetRemoteAddress\""); + AddProp(ss, "tcp_socket", ToString_PP_Resource(tcp_socket)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Resource(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_TCPSocket_1_1*)RealGetInterface("PPB_TCPSocket;1.1"))->GetRemoteAddress(tcp_socket); + printf("RPC response: ["); + printf("%s", ToString_PP_Resource(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t Read_1_1(PP_Resource tcp_socket, char* buffer, int32_t bytes_to_read, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_TCPSocket\""); + AddProp(ss, "__version", "\"1.1\""); + AddProp(ss, "__method", "\"Read\""); + AddProp(ss, "tcp_socket", ToString_PP_Resource(tcp_socket)); + AddProp(ss, "buffer", PointerToString(buffer)); + AddProp(ss, "bytes_to_read", ToString_int32_t(bytes_to_read)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + iterator.skip(); + FromJSON_str_t(iterator, buffer); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_TCPSocket_1_1*)RealGetInterface("PPB_TCPSocket;1.1"))->Read(tcp_socket, buffer, bytes_to_read, logging_callback); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_int32_t(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + AddProp(os, "buffer", ToString_str_t(buffer)); + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t Write_1_1(PP_Resource tcp_socket, const char* buffer, int32_t bytes_to_write, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_TCPSocket\""); + AddProp(ss, "__version", "\"1.1\""); + AddProp(ss, "__method", "\"Write\""); + AddProp(ss, "tcp_socket", ToString_PP_Resource(tcp_socket)); + AddProp(ss, "buffer", ToString_str_t(buffer)); + AddProp(ss, "bytes_to_write", ToString_int32_t(bytes_to_write)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_TCPSocket_1_1*)RealGetInterface("PPB_TCPSocket;1.1"))->Write(tcp_socket, buffer, bytes_to_write, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t Listen_1_1(PP_Resource tcp_socket, int32_t backlog, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_TCPSocket\""); + AddProp(ss, "__version", "\"1.1\""); + AddProp(ss, "__method", "\"Listen\""); + AddProp(ss, "tcp_socket", ToString_PP_Resource(tcp_socket)); + AddProp(ss, "backlog", ToString_int32_t(backlog)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_TCPSocket_1_1*)RealGetInterface("PPB_TCPSocket;1.1"))->Listen(tcp_socket, backlog, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t Accept_1_1(PP_Resource tcp_socket, PP_Resource* accepted_tcp_socket, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_TCPSocket\""); + AddProp(ss, "__version", "\"1.1\""); + AddProp(ss, "__method", "\"Accept\""); + AddProp(ss, "tcp_socket", ToString_PP_Resource(tcp_socket)); + AddProp(ss, "accepted_tcp_socket", PointerToString(accepted_tcp_socket)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + iterator.skip(); + FromJSON_PP_Resource(iterator, *accepted_tcp_socket); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_TCPSocket_1_1*)RealGetInterface("PPB_TCPSocket;1.1"))->Accept(tcp_socket, accepted_tcp_socket, logging_callback); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_int32_t(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + if (!!accepted_tcp_socket) { + AddProp(os, "accepted_tcp_socket", ToString_PP_Resource(accepted_tcp_socket)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static void Close_1_1(PP_Resource tcp_socket) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_TCPSocket\""); + AddProp(ss, "__version", "\"1.1\""); + AddProp(ss, "__method", "\"Close\""); + AddProp(ss, "tcp_socket", ToString_PP_Resource(tcp_socket)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_TCPSocket_1_1*)RealGetInterface("PPB_TCPSocket;1.1"))->Close(tcp_socket); +#endif // !INTERPOSE +} +static int32_t SetOption_1_1(PP_Resource tcp_socket, PP_TCPSocket_Option name, struct PP_Var value, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_TCPSocket\""); + AddProp(ss, "__version", "\"1.1\""); + AddProp(ss, "__method", "\"SetOption\""); + AddProp(ss, "tcp_socket", ToString_PP_Resource(tcp_socket)); + AddProp(ss, "name", ToString_PP_TCPSocket_Option(name)); + AddProp(ss, "value", ToString_PP_Var(value)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_TCPSocket_1_1*)RealGetInterface("PPB_TCPSocket;1.1"))->SetOption(tcp_socket, name, value, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +/* skipping SetOption */ +} +static PPB_TCPSocket_1_1 _PPB_TCPSocket_1_1 = { + ns_PPB_TCPSocket_1_1::Create_1_1, + ns_PPB_TCPSocket_1_1::IsTCPSocket_1_1, + ns_PPB_TCPSocket_1_1::Bind_1_1, + ns_PPB_TCPSocket_1_1::Connect_1_1, + ns_PPB_TCPSocket_1_1::GetLocalAddress_1_1, + ns_PPB_TCPSocket_1_1::GetRemoteAddress_1_1, + ns_PPB_TCPSocket_1_1::Read_1_1, + ns_PPB_TCPSocket_1_1::Write_1_1, + ns_PPB_TCPSocket_1_1::Listen_1_1, + ns_PPB_TCPSocket_1_1::Accept_1_1, + ns_PPB_TCPSocket_1_1::Close_1_1, + ns_PPB_TCPSocket_1_1::SetOption_1_1, +}; +const string ToString_PPB_TCPSocket(const PPB_TCPSocket_1_1 *v) { + stringstream s; + s << v; + return s.str(); +} +namespace ns_PPB_TCPSocket_1_2 { +static PP_Resource Create_1_2(PP_Instance instance) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_TCPSocket\""); + AddProp(ss, "__version", "\"1.2\""); + AddProp(ss, "__method", "\"Create\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Resource(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_TCPSocket_1_2*)RealGetInterface("PPB_TCPSocket;1.2"))->Create(instance); + printf("RPC response: ["); + printf("%s", ToString_PP_Resource(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool IsTCPSocket_1_2(PP_Resource resource) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_TCPSocket\""); + AddProp(ss, "__version", "\"1.2\""); + AddProp(ss, "__method", "\"IsTCPSocket\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_TCPSocket_1_2*)RealGetInterface("PPB_TCPSocket;1.2"))->IsTCPSocket(resource); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t Bind_1_2(PP_Resource tcp_socket, PP_Resource addr, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_TCPSocket\""); + AddProp(ss, "__version", "\"1.2\""); + AddProp(ss, "__method", "\"Bind\""); + AddProp(ss, "tcp_socket", ToString_PP_Resource(tcp_socket)); + AddProp(ss, "addr", ToString_PP_Resource(addr)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_TCPSocket_1_2*)RealGetInterface("PPB_TCPSocket;1.2"))->Bind(tcp_socket, addr, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t Connect_1_2(PP_Resource tcp_socket, PP_Resource addr, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_TCPSocket\""); + AddProp(ss, "__version", "\"1.2\""); + AddProp(ss, "__method", "\"Connect\""); + AddProp(ss, "tcp_socket", ToString_PP_Resource(tcp_socket)); + AddProp(ss, "addr", ToString_PP_Resource(addr)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_TCPSocket_1_2*)RealGetInterface("PPB_TCPSocket;1.2"))->Connect(tcp_socket, addr, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Resource GetLocalAddress_1_2(PP_Resource tcp_socket) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_TCPSocket\""); + AddProp(ss, "__version", "\"1.2\""); + AddProp(ss, "__method", "\"GetLocalAddress\""); + AddProp(ss, "tcp_socket", ToString_PP_Resource(tcp_socket)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Resource(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_TCPSocket_1_2*)RealGetInterface("PPB_TCPSocket;1.2"))->GetLocalAddress(tcp_socket); + printf("RPC response: ["); + printf("%s", ToString_PP_Resource(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Resource GetRemoteAddress_1_2(PP_Resource tcp_socket) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_TCPSocket\""); + AddProp(ss, "__version", "\"1.2\""); + AddProp(ss, "__method", "\"GetRemoteAddress\""); + AddProp(ss, "tcp_socket", ToString_PP_Resource(tcp_socket)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Resource(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_TCPSocket_1_2*)RealGetInterface("PPB_TCPSocket;1.2"))->GetRemoteAddress(tcp_socket); + printf("RPC response: ["); + printf("%s", ToString_PP_Resource(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t Read_1_2(PP_Resource tcp_socket, char* buffer, int32_t bytes_to_read, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_TCPSocket\""); + AddProp(ss, "__version", "\"1.2\""); + AddProp(ss, "__method", "\"Read\""); + AddProp(ss, "tcp_socket", ToString_PP_Resource(tcp_socket)); + AddProp(ss, "buffer", PointerToString(buffer)); + AddProp(ss, "bytes_to_read", ToString_int32_t(bytes_to_read)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + iterator.skip(); + FromJSON_str_t(iterator, buffer); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_TCPSocket_1_2*)RealGetInterface("PPB_TCPSocket;1.2"))->Read(tcp_socket, buffer, bytes_to_read, logging_callback); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_int32_t(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + AddProp(os, "buffer", ToString_str_t(buffer)); + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t Write_1_2(PP_Resource tcp_socket, const char* buffer, int32_t bytes_to_write, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_TCPSocket\""); + AddProp(ss, "__version", "\"1.2\""); + AddProp(ss, "__method", "\"Write\""); + AddProp(ss, "tcp_socket", ToString_PP_Resource(tcp_socket)); + AddProp(ss, "buffer", ToString_str_t(buffer)); + AddProp(ss, "bytes_to_write", ToString_int32_t(bytes_to_write)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_TCPSocket_1_2*)RealGetInterface("PPB_TCPSocket;1.2"))->Write(tcp_socket, buffer, bytes_to_write, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t Listen_1_2(PP_Resource tcp_socket, int32_t backlog, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_TCPSocket\""); + AddProp(ss, "__version", "\"1.2\""); + AddProp(ss, "__method", "\"Listen\""); + AddProp(ss, "tcp_socket", ToString_PP_Resource(tcp_socket)); + AddProp(ss, "backlog", ToString_int32_t(backlog)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_TCPSocket_1_2*)RealGetInterface("PPB_TCPSocket;1.2"))->Listen(tcp_socket, backlog, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t Accept_1_2(PP_Resource tcp_socket, PP_Resource* accepted_tcp_socket, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_TCPSocket\""); + AddProp(ss, "__version", "\"1.2\""); + AddProp(ss, "__method", "\"Accept\""); + AddProp(ss, "tcp_socket", ToString_PP_Resource(tcp_socket)); + AddProp(ss, "accepted_tcp_socket", PointerToString(accepted_tcp_socket)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + iterator.skip(); + FromJSON_PP_Resource(iterator, *accepted_tcp_socket); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_TCPSocket_1_2*)RealGetInterface("PPB_TCPSocket;1.2"))->Accept(tcp_socket, accepted_tcp_socket, logging_callback); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_int32_t(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + if (!!accepted_tcp_socket) { + AddProp(os, "accepted_tcp_socket", ToString_PP_Resource(accepted_tcp_socket)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static void Close_1_2(PP_Resource tcp_socket) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_TCPSocket\""); + AddProp(ss, "__version", "\"1.2\""); + AddProp(ss, "__method", "\"Close\""); + AddProp(ss, "tcp_socket", ToString_PP_Resource(tcp_socket)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_TCPSocket_1_2*)RealGetInterface("PPB_TCPSocket;1.2"))->Close(tcp_socket); +#endif // !INTERPOSE +} +/* skipping SetOption */ +static int32_t SetOption_1_2(PP_Resource tcp_socket, PP_TCPSocket_Option name, struct PP_Var value, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_TCPSocket\""); + AddProp(ss, "__version", "\"1.2\""); + AddProp(ss, "__method", "\"SetOption\""); + AddProp(ss, "tcp_socket", ToString_PP_Resource(tcp_socket)); + AddProp(ss, "name", ToString_PP_TCPSocket_Option(name)); + AddProp(ss, "value", ToString_PP_Var(value)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_TCPSocket_1_2*)RealGetInterface("PPB_TCPSocket;1.2"))->SetOption(tcp_socket, name, value, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +} +static PPB_TCPSocket_1_2 _PPB_TCPSocket_1_2 = { + ns_PPB_TCPSocket_1_2::Create_1_2, + ns_PPB_TCPSocket_1_2::IsTCPSocket_1_2, + ns_PPB_TCPSocket_1_2::Bind_1_2, + ns_PPB_TCPSocket_1_2::Connect_1_2, + ns_PPB_TCPSocket_1_2::GetLocalAddress_1_2, + ns_PPB_TCPSocket_1_2::GetRemoteAddress_1_2, + ns_PPB_TCPSocket_1_2::Read_1_2, + ns_PPB_TCPSocket_1_2::Write_1_2, + ns_PPB_TCPSocket_1_2::Listen_1_2, + ns_PPB_TCPSocket_1_2::Accept_1_2, + ns_PPB_TCPSocket_1_2::Close_1_2, + ns_PPB_TCPSocket_1_2::SetOption_1_2, +}; +const string ToString_PPB_TCPSocket(const PPB_TCPSocket_1_2 *v) { + stringstream s; + s << v; + return s.str(); +} +const string ToString_PP_TextInput_Type(const PP_TextInput_Type *v) { + switch (*v) { + case 0: + return "\"PP_TEXTINPUT_TYPE_NONE\""; + case 1: + return "\"PP_TEXTINPUT_TYPE_TEXT\""; + case 2: + return "\"PP_TEXTINPUT_TYPE_PASSWORD\""; + case 3: + return "\"PP_TEXTINPUT_TYPE_SEARCH\""; + case 4: + return "\"PP_TEXTINPUT_TYPE_EMAIL\""; + case 5: + return "\"PP_TEXTINPUT_TYPE_NUMBER\""; + case 6: + return "\"PP_TEXTINPUT_TYPE_TELEPHONE\""; + case 7: + return "\"PP_TEXTINPUT_TYPE_URL\""; + default: + return "\"???\""; + } +} +const string ToString_PP_TextInput_Type(const PP_TextInput_Type &v) { + return ToString_PP_TextInput_Type(&v); +} +void FromJSON_PP_TextInput_Type(JSONIterator& iterator, PP_TextInput_Type &value) { + long int v; + FromJSON_int(iterator, v); + value = PP_TextInput_Type(v); +} +namespace ns_PPB_TextInputController_1_0 { +static void SetTextInputType_1_0(PP_Instance instance, PP_TextInput_Type type) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_TextInputController\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"SetTextInputType\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "type", ToString_PP_TextInput_Type(type)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_TextInputController_1_0*)RealGetInterface("PPB_TextInputController;1.0"))->SetTextInputType(instance, type); +#endif // !INTERPOSE +} +static void UpdateCaretPosition_1_0(PP_Instance instance, const struct PP_Rect* caret) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_TextInputController\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"UpdateCaretPosition\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "caret", ToString_PP_Rect(caret)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_TextInputController_1_0*)RealGetInterface("PPB_TextInputController;1.0"))->UpdateCaretPosition(instance, caret); +#endif // !INTERPOSE +} +static void CancelCompositionText_1_0(PP_Instance instance) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_TextInputController\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"CancelCompositionText\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_TextInputController_1_0*)RealGetInterface("PPB_TextInputController;1.0"))->CancelCompositionText(instance); +#endif // !INTERPOSE +} +static void UpdateSurroundingText_1_0(PP_Instance instance, struct PP_Var text, uint32_t caret, uint32_t anchor) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_TextInputController\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"UpdateSurroundingText\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "text", ToString_PP_Var(text)); + AddProp(ss, "caret", ToString_uint32_t(caret)); + AddProp(ss, "anchor", ToString_uint32_t(anchor)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_TextInputController_1_0*)RealGetInterface("PPB_TextInputController;1.0"))->UpdateSurroundingText(instance, text, caret, anchor); +#endif // !INTERPOSE +} +} +static PPB_TextInputController_1_0 _PPB_TextInputController_1_0 = { + ns_PPB_TextInputController_1_0::SetTextInputType_1_0, + ns_PPB_TextInputController_1_0::UpdateCaretPosition_1_0, + ns_PPB_TextInputController_1_0::CancelCompositionText_1_0, + ns_PPB_TextInputController_1_0::UpdateSurroundingText_1_0, +}; +const string ToString_PPB_TextInputController(const PPB_TextInputController_1_0 *v) { + stringstream s; + s << v; + return s.str(); +} +const string ToString_PP_UDPSocket_Option(const PP_UDPSocket_Option *v) { + switch (*v) { + case 0: + return "\"PP_UDPSOCKET_OPTION_ADDRESS_REUSE\""; + case 1: + return "\"PP_UDPSOCKET_OPTION_BROADCAST\""; + case 2: + return "\"PP_UDPSOCKET_OPTION_SEND_BUFFER_SIZE\""; + case 3: + return "\"PP_UDPSOCKET_OPTION_RECV_BUFFER_SIZE\""; + case 4: + return "\"PP_UDPSOCKET_OPTION_MULTICAST_LOOP\""; + case 5: + return "\"PP_UDPSOCKET_OPTION_MULTICAST_TTL\""; + default: + return "\"???\""; + } +} +const string ToString_PP_UDPSocket_Option(const PP_UDPSocket_Option &v) { + return ToString_PP_UDPSocket_Option(&v); +} +void FromJSON_PP_UDPSocket_Option(JSONIterator& iterator, PP_UDPSocket_Option &value) { + long int v; + FromJSON_int(iterator, v); + value = PP_UDPSocket_Option(v); +} +namespace ns_PPB_UDPSocket_1_0 { +static PP_Resource Create_1_0(PP_Instance instance) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_UDPSocket\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"Create\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Resource(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_UDPSocket_1_0*)RealGetInterface("PPB_UDPSocket;1.0"))->Create(instance); + printf("RPC response: ["); + printf("%s", ToString_PP_Resource(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool IsUDPSocket_1_0(PP_Resource resource) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_UDPSocket\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"IsUDPSocket\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_UDPSocket_1_0*)RealGetInterface("PPB_UDPSocket;1.0"))->IsUDPSocket(resource); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t Bind_1_0(PP_Resource udp_socket, PP_Resource addr, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_UDPSocket\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"Bind\""); + AddProp(ss, "udp_socket", ToString_PP_Resource(udp_socket)); + AddProp(ss, "addr", ToString_PP_Resource(addr)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_UDPSocket_1_0*)RealGetInterface("PPB_UDPSocket;1.0"))->Bind(udp_socket, addr, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Resource GetBoundAddress_1_0(PP_Resource udp_socket) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_UDPSocket\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"GetBoundAddress\""); + AddProp(ss, "udp_socket", ToString_PP_Resource(udp_socket)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Resource(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_UDPSocket_1_0*)RealGetInterface("PPB_UDPSocket;1.0"))->GetBoundAddress(udp_socket); + printf("RPC response: ["); + printf("%s", ToString_PP_Resource(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t RecvFrom_1_0(PP_Resource udp_socket, char* buffer, int32_t num_bytes, PP_Resource* addr, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_UDPSocket\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"RecvFrom\""); + AddProp(ss, "udp_socket", ToString_PP_Resource(udp_socket)); + AddProp(ss, "buffer", PointerToString(buffer)); + AddProp(ss, "num_bytes", ToString_int32_t(num_bytes)); + AddProp(ss, "addr", PointerToString(addr)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + iterator.skip(); + FromJSON_str_t(iterator, buffer); + iterator.skip(); + FromJSON_PP_Resource(iterator, *addr); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_UDPSocket_1_0*)RealGetInterface("PPB_UDPSocket;1.0"))->RecvFrom(udp_socket, buffer, num_bytes, addr, logging_callback); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_int32_t(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + AddProp(os, "buffer", ToString_str_t(buffer)); + if (!!addr) { + AddProp(os, "addr", ToString_PP_Resource(addr)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t SendTo_1_0(PP_Resource udp_socket, const char* buffer, int32_t num_bytes, PP_Resource addr, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_UDPSocket\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"SendTo\""); + AddProp(ss, "udp_socket", ToString_PP_Resource(udp_socket)); + AddProp(ss, "buffer", ToString_str_t(buffer)); + AddProp(ss, "num_bytes", ToString_int32_t(num_bytes)); + AddProp(ss, "addr", ToString_PP_Resource(addr)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_UDPSocket_1_0*)RealGetInterface("PPB_UDPSocket;1.0"))->SendTo(udp_socket, buffer, num_bytes, addr, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static void Close_1_0(PP_Resource udp_socket) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_UDPSocket\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"Close\""); + AddProp(ss, "udp_socket", ToString_PP_Resource(udp_socket)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_UDPSocket_1_0*)RealGetInterface("PPB_UDPSocket;1.0"))->Close(udp_socket); +#endif // !INTERPOSE +} +static int32_t SetOption_1_0(PP_Resource udp_socket, PP_UDPSocket_Option name, struct PP_Var value, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_UDPSocket\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"SetOption\""); + AddProp(ss, "udp_socket", ToString_PP_Resource(udp_socket)); + AddProp(ss, "name", ToString_PP_UDPSocket_Option(name)); + AddProp(ss, "value", ToString_PP_Var(value)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_UDPSocket_1_0*)RealGetInterface("PPB_UDPSocket;1.0"))->SetOption(udp_socket, name, value, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +/* skipping SetOption */ +/* skipping SetOption */ +/* skipping JoinGroup */ +/* skipping LeaveGroup */ +} +static PPB_UDPSocket_1_0 _PPB_UDPSocket_1_0 = { + ns_PPB_UDPSocket_1_0::Create_1_0, + ns_PPB_UDPSocket_1_0::IsUDPSocket_1_0, + ns_PPB_UDPSocket_1_0::Bind_1_0, + ns_PPB_UDPSocket_1_0::GetBoundAddress_1_0, + ns_PPB_UDPSocket_1_0::RecvFrom_1_0, + ns_PPB_UDPSocket_1_0::SendTo_1_0, + ns_PPB_UDPSocket_1_0::Close_1_0, + ns_PPB_UDPSocket_1_0::SetOption_1_0, +}; +const string ToString_PPB_UDPSocket(const PPB_UDPSocket_1_0 *v) { + stringstream s; + s << v; + return s.str(); +} +namespace ns_PPB_UDPSocket_1_1 { +static PP_Resource Create_1_1(PP_Instance instance) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_UDPSocket\""); + AddProp(ss, "__version", "\"1.1\""); + AddProp(ss, "__method", "\"Create\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Resource(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_UDPSocket_1_1*)RealGetInterface("PPB_UDPSocket;1.1"))->Create(instance); + printf("RPC response: ["); + printf("%s", ToString_PP_Resource(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool IsUDPSocket_1_1(PP_Resource resource) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_UDPSocket\""); + AddProp(ss, "__version", "\"1.1\""); + AddProp(ss, "__method", "\"IsUDPSocket\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_UDPSocket_1_1*)RealGetInterface("PPB_UDPSocket;1.1"))->IsUDPSocket(resource); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t Bind_1_1(PP_Resource udp_socket, PP_Resource addr, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_UDPSocket\""); + AddProp(ss, "__version", "\"1.1\""); + AddProp(ss, "__method", "\"Bind\""); + AddProp(ss, "udp_socket", ToString_PP_Resource(udp_socket)); + AddProp(ss, "addr", ToString_PP_Resource(addr)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_UDPSocket_1_1*)RealGetInterface("PPB_UDPSocket;1.1"))->Bind(udp_socket, addr, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Resource GetBoundAddress_1_1(PP_Resource udp_socket) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_UDPSocket\""); + AddProp(ss, "__version", "\"1.1\""); + AddProp(ss, "__method", "\"GetBoundAddress\""); + AddProp(ss, "udp_socket", ToString_PP_Resource(udp_socket)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Resource(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_UDPSocket_1_1*)RealGetInterface("PPB_UDPSocket;1.1"))->GetBoundAddress(udp_socket); + printf("RPC response: ["); + printf("%s", ToString_PP_Resource(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t RecvFrom_1_1(PP_Resource udp_socket, char* buffer, int32_t num_bytes, PP_Resource* addr, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_UDPSocket\""); + AddProp(ss, "__version", "\"1.1\""); + AddProp(ss, "__method", "\"RecvFrom\""); + AddProp(ss, "udp_socket", ToString_PP_Resource(udp_socket)); + AddProp(ss, "buffer", PointerToString(buffer)); + AddProp(ss, "num_bytes", ToString_int32_t(num_bytes)); + AddProp(ss, "addr", PointerToString(addr)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + iterator.skip(); + FromJSON_str_t(iterator, buffer); + iterator.skip(); + FromJSON_PP_Resource(iterator, *addr); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_UDPSocket_1_1*)RealGetInterface("PPB_UDPSocket;1.1"))->RecvFrom(udp_socket, buffer, num_bytes, addr, logging_callback); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_int32_t(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + AddProp(os, "buffer", ToString_str_t(buffer)); + if (!!addr) { + AddProp(os, "addr", ToString_PP_Resource(addr)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t SendTo_1_1(PP_Resource udp_socket, const char* buffer, int32_t num_bytes, PP_Resource addr, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_UDPSocket\""); + AddProp(ss, "__version", "\"1.1\""); + AddProp(ss, "__method", "\"SendTo\""); + AddProp(ss, "udp_socket", ToString_PP_Resource(udp_socket)); + AddProp(ss, "buffer", ToString_str_t(buffer)); + AddProp(ss, "num_bytes", ToString_int32_t(num_bytes)); + AddProp(ss, "addr", ToString_PP_Resource(addr)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_UDPSocket_1_1*)RealGetInterface("PPB_UDPSocket;1.1"))->SendTo(udp_socket, buffer, num_bytes, addr, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static void Close_1_1(PP_Resource udp_socket) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_UDPSocket\""); + AddProp(ss, "__version", "\"1.1\""); + AddProp(ss, "__method", "\"Close\""); + AddProp(ss, "udp_socket", ToString_PP_Resource(udp_socket)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_UDPSocket_1_1*)RealGetInterface("PPB_UDPSocket;1.1"))->Close(udp_socket); +#endif // !INTERPOSE +} +/* skipping SetOption */ +static int32_t SetOption_1_1(PP_Resource udp_socket, PP_UDPSocket_Option name, struct PP_Var value, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_UDPSocket\""); + AddProp(ss, "__version", "\"1.1\""); + AddProp(ss, "__method", "\"SetOption\""); + AddProp(ss, "udp_socket", ToString_PP_Resource(udp_socket)); + AddProp(ss, "name", ToString_PP_UDPSocket_Option(name)); + AddProp(ss, "value", ToString_PP_Var(value)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_UDPSocket_1_1*)RealGetInterface("PPB_UDPSocket;1.1"))->SetOption(udp_socket, name, value, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +/* skipping SetOption */ +/* skipping JoinGroup */ +/* skipping LeaveGroup */ +} +static PPB_UDPSocket_1_1 _PPB_UDPSocket_1_1 = { + ns_PPB_UDPSocket_1_1::Create_1_1, + ns_PPB_UDPSocket_1_1::IsUDPSocket_1_1, + ns_PPB_UDPSocket_1_1::Bind_1_1, + ns_PPB_UDPSocket_1_1::GetBoundAddress_1_1, + ns_PPB_UDPSocket_1_1::RecvFrom_1_1, + ns_PPB_UDPSocket_1_1::SendTo_1_1, + ns_PPB_UDPSocket_1_1::Close_1_1, + ns_PPB_UDPSocket_1_1::SetOption_1_1, +}; +const string ToString_PPB_UDPSocket(const PPB_UDPSocket_1_1 *v) { + stringstream s; + s << v; + return s.str(); +} +namespace ns_PPB_UDPSocket_1_2 { +static PP_Resource Create_1_2(PP_Instance instance) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_UDPSocket\""); + AddProp(ss, "__version", "\"1.2\""); + AddProp(ss, "__method", "\"Create\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Resource(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_UDPSocket_1_2*)RealGetInterface("PPB_UDPSocket;1.2"))->Create(instance); + printf("RPC response: ["); + printf("%s", ToString_PP_Resource(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool IsUDPSocket_1_2(PP_Resource resource) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_UDPSocket\""); + AddProp(ss, "__version", "\"1.2\""); + AddProp(ss, "__method", "\"IsUDPSocket\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_UDPSocket_1_2*)RealGetInterface("PPB_UDPSocket;1.2"))->IsUDPSocket(resource); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t Bind_1_2(PP_Resource udp_socket, PP_Resource addr, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_UDPSocket\""); + AddProp(ss, "__version", "\"1.2\""); + AddProp(ss, "__method", "\"Bind\""); + AddProp(ss, "udp_socket", ToString_PP_Resource(udp_socket)); + AddProp(ss, "addr", ToString_PP_Resource(addr)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_UDPSocket_1_2*)RealGetInterface("PPB_UDPSocket;1.2"))->Bind(udp_socket, addr, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Resource GetBoundAddress_1_2(PP_Resource udp_socket) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_UDPSocket\""); + AddProp(ss, "__version", "\"1.2\""); + AddProp(ss, "__method", "\"GetBoundAddress\""); + AddProp(ss, "udp_socket", ToString_PP_Resource(udp_socket)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Resource(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_UDPSocket_1_2*)RealGetInterface("PPB_UDPSocket;1.2"))->GetBoundAddress(udp_socket); + printf("RPC response: ["); + printf("%s", ToString_PP_Resource(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t RecvFrom_1_2(PP_Resource udp_socket, char* buffer, int32_t num_bytes, PP_Resource* addr, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_UDPSocket\""); + AddProp(ss, "__version", "\"1.2\""); + AddProp(ss, "__method", "\"RecvFrom\""); + AddProp(ss, "udp_socket", ToString_PP_Resource(udp_socket)); + AddProp(ss, "buffer", PointerToString(buffer)); + AddProp(ss, "num_bytes", ToString_int32_t(num_bytes)); + AddProp(ss, "addr", PointerToString(addr)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + iterator.skip(); + FromJSON_str_t(iterator, buffer); + iterator.skip(); + FromJSON_PP_Resource(iterator, *addr); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_UDPSocket_1_2*)RealGetInterface("PPB_UDPSocket;1.2"))->RecvFrom(udp_socket, buffer, num_bytes, addr, logging_callback); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_int32_t(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + AddProp(os, "buffer", ToString_str_t(buffer)); + if (!!addr) { + AddProp(os, "addr", ToString_PP_Resource(addr)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t SendTo_1_2(PP_Resource udp_socket, const char* buffer, int32_t num_bytes, PP_Resource addr, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_UDPSocket\""); + AddProp(ss, "__version", "\"1.2\""); + AddProp(ss, "__method", "\"SendTo\""); + AddProp(ss, "udp_socket", ToString_PP_Resource(udp_socket)); + AddProp(ss, "buffer", ToString_str_t(buffer)); + AddProp(ss, "num_bytes", ToString_int32_t(num_bytes)); + AddProp(ss, "addr", ToString_PP_Resource(addr)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_UDPSocket_1_2*)RealGetInterface("PPB_UDPSocket;1.2"))->SendTo(udp_socket, buffer, num_bytes, addr, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static void Close_1_2(PP_Resource udp_socket) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_UDPSocket\""); + AddProp(ss, "__version", "\"1.2\""); + AddProp(ss, "__method", "\"Close\""); + AddProp(ss, "udp_socket", ToString_PP_Resource(udp_socket)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_UDPSocket_1_2*)RealGetInterface("PPB_UDPSocket;1.2"))->Close(udp_socket); +#endif // !INTERPOSE +} +/* skipping SetOption */ +/* skipping SetOption */ +static int32_t SetOption_1_2(PP_Resource udp_socket, PP_UDPSocket_Option name, struct PP_Var value, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_UDPSocket\""); + AddProp(ss, "__version", "\"1.2\""); + AddProp(ss, "__method", "\"SetOption\""); + AddProp(ss, "udp_socket", ToString_PP_Resource(udp_socket)); + AddProp(ss, "name", ToString_PP_UDPSocket_Option(name)); + AddProp(ss, "value", ToString_PP_Var(value)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_UDPSocket_1_2*)RealGetInterface("PPB_UDPSocket;1.2"))->SetOption(udp_socket, name, value, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t JoinGroup_1_2(PP_Resource udp_socket, PP_Resource group, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_UDPSocket\""); + AddProp(ss, "__version", "\"1.2\""); + AddProp(ss, "__method", "\"JoinGroup\""); + AddProp(ss, "udp_socket", ToString_PP_Resource(udp_socket)); + AddProp(ss, "group", ToString_PP_Resource(group)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_UDPSocket_1_2*)RealGetInterface("PPB_UDPSocket;1.2"))->JoinGroup(udp_socket, group, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t LeaveGroup_1_2(PP_Resource udp_socket, PP_Resource group, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_UDPSocket\""); + AddProp(ss, "__version", "\"1.2\""); + AddProp(ss, "__method", "\"LeaveGroup\""); + AddProp(ss, "udp_socket", ToString_PP_Resource(udp_socket)); + AddProp(ss, "group", ToString_PP_Resource(group)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_UDPSocket_1_2*)RealGetInterface("PPB_UDPSocket;1.2"))->LeaveGroup(udp_socket, group, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +} +static PPB_UDPSocket_1_2 _PPB_UDPSocket_1_2 = { + ns_PPB_UDPSocket_1_2::Create_1_2, + ns_PPB_UDPSocket_1_2::IsUDPSocket_1_2, + ns_PPB_UDPSocket_1_2::Bind_1_2, + ns_PPB_UDPSocket_1_2::GetBoundAddress_1_2, + ns_PPB_UDPSocket_1_2::RecvFrom_1_2, + ns_PPB_UDPSocket_1_2::SendTo_1_2, + ns_PPB_UDPSocket_1_2::Close_1_2, + ns_PPB_UDPSocket_1_2::SetOption_1_2, + ns_PPB_UDPSocket_1_2::JoinGroup_1_2, + ns_PPB_UDPSocket_1_2::LeaveGroup_1_2, +}; +const string ToString_PPB_UDPSocket(const PPB_UDPSocket_1_2 *v) { + stringstream s; + s << v; + return s.str(); +} +namespace ns_PPB_URLLoader_1_0 { +static PP_Resource Create_1_0(PP_Instance instance) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_URLLoader\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"Create\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Resource(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_URLLoader_1_0*)RealGetInterface("PPB_URLLoader;1.0"))->Create(instance); + printf("RPC response: ["); + printf("%s", ToString_PP_Resource(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool IsURLLoader_1_0(PP_Resource resource) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_URLLoader\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"IsURLLoader\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_URLLoader_1_0*)RealGetInterface("PPB_URLLoader;1.0"))->IsURLLoader(resource); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t Open_1_0(PP_Resource loader, PP_Resource request_info, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_URLLoader\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"Open\""); + AddProp(ss, "loader", ToString_PP_Resource(loader)); + AddProp(ss, "request_info", ToString_PP_Resource(request_info)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_URLLoader_1_0*)RealGetInterface("PPB_URLLoader;1.0"))->Open(loader, request_info, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t FollowRedirect_1_0(PP_Resource loader, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_URLLoader\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"FollowRedirect\""); + AddProp(ss, "loader", ToString_PP_Resource(loader)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_URLLoader_1_0*)RealGetInterface("PPB_URLLoader;1.0"))->FollowRedirect(loader, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool GetUploadProgress_1_0(PP_Resource loader, int64_t* bytes_sent, int64_t* total_bytes_to_be_sent) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_URLLoader\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"GetUploadProgress\""); + AddProp(ss, "loader", ToString_PP_Resource(loader)); + AddProp(ss, "bytes_sent", PointerToString(bytes_sent)); + AddProp(ss, "total_bytes_to_be_sent", PointerToString(total_bytes_to_be_sent)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + iterator.skip(); + FromJSON_int64_t(iterator, *bytes_sent); + iterator.skip(); + FromJSON_int64_t(iterator, *total_bytes_to_be_sent); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_URLLoader_1_0*)RealGetInterface("PPB_URLLoader;1.0"))->GetUploadProgress(loader, bytes_sent, total_bytes_to_be_sent); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + if (!!bytes_sent) { + AddProp(os, "bytes_sent", ToString_int64_t(bytes_sent)); + } + if (!!total_bytes_to_be_sent) { + AddProp(os, "total_bytes_to_be_sent", ToString_int64_t(total_bytes_to_be_sent)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool GetDownloadProgress_1_0(PP_Resource loader, int64_t* bytes_received, int64_t* total_bytes_to_be_received) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_URLLoader\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"GetDownloadProgress\""); + AddProp(ss, "loader", ToString_PP_Resource(loader)); + AddProp(ss, "bytes_received", PointerToString(bytes_received)); + AddProp(ss, "total_bytes_to_be_received", PointerToString(total_bytes_to_be_received)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + iterator.skip(); + FromJSON_int64_t(iterator, *bytes_received); + iterator.skip(); + FromJSON_int64_t(iterator, *total_bytes_to_be_received); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_URLLoader_1_0*)RealGetInterface("PPB_URLLoader;1.0"))->GetDownloadProgress(loader, bytes_received, total_bytes_to_be_received); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + if (!!bytes_received) { + AddProp(os, "bytes_received", ToString_int64_t(bytes_received)); + } + if (!!total_bytes_to_be_received) { + AddProp(os, "total_bytes_to_be_received", ToString_int64_t(total_bytes_to_be_received)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Resource GetResponseInfo_1_0(PP_Resource loader) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_URLLoader\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"GetResponseInfo\""); + AddProp(ss, "loader", ToString_PP_Resource(loader)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Resource(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_URLLoader_1_0*)RealGetInterface("PPB_URLLoader;1.0"))->GetResponseInfo(loader); + printf("RPC response: ["); + printf("%s", ToString_PP_Resource(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t ReadResponseBody_1_0(PP_Resource loader, void* buffer, int32_t bytes_to_read, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_URLLoader\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"ReadResponseBody\""); + AddProp(ss, "loader", ToString_PP_Resource(loader)); + AddProp(ss, "buffer", PointerToString(buffer)); + AddProp(ss, "bytes_to_read", ToString_int32_t(bytes_to_read)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + iterator.skip(); + FromJSON_mem_t(iterator, buffer); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_URLLoader_1_0*)RealGetInterface("PPB_URLLoader;1.0"))->ReadResponseBody(loader, buffer, bytes_to_read, logging_callback); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_int32_t(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + AddProp(os, "buffer", ToString_mem_t(buffer)); + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t FinishStreamingToFile_1_0(PP_Resource loader, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_URLLoader\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"FinishStreamingToFile\""); + AddProp(ss, "loader", ToString_PP_Resource(loader)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_URLLoader_1_0*)RealGetInterface("PPB_URLLoader;1.0"))->FinishStreamingToFile(loader, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static void Close_1_0(PP_Resource loader) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_URLLoader\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"Close\""); + AddProp(ss, "loader", ToString_PP_Resource(loader)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_URLLoader_1_0*)RealGetInterface("PPB_URLLoader;1.0"))->Close(loader); +#endif // !INTERPOSE +} +} +static PPB_URLLoader_1_0 _PPB_URLLoader_1_0 = { + ns_PPB_URLLoader_1_0::Create_1_0, + ns_PPB_URLLoader_1_0::IsURLLoader_1_0, + ns_PPB_URLLoader_1_0::Open_1_0, + ns_PPB_URLLoader_1_0::FollowRedirect_1_0, + ns_PPB_URLLoader_1_0::GetUploadProgress_1_0, + ns_PPB_URLLoader_1_0::GetDownloadProgress_1_0, + ns_PPB_URLLoader_1_0::GetResponseInfo_1_0, + ns_PPB_URLLoader_1_0::ReadResponseBody_1_0, + ns_PPB_URLLoader_1_0::FinishStreamingToFile_1_0, + ns_PPB_URLLoader_1_0::Close_1_0, +}; +const string ToString_PPB_URLLoader(const PPB_URLLoader_1_0 *v) { + stringstream s; + s << v; + return s.str(); +} +const string ToString_PP_URLRequestProperty(const PP_URLRequestProperty *v) { + switch (*v) { + case 0: + return "\"PP_URLREQUESTPROPERTY_URL\""; + case 1: + return "\"PP_URLREQUESTPROPERTY_METHOD\""; + case 2: + return "\"PP_URLREQUESTPROPERTY_HEADERS\""; + case 3: + return "\"PP_URLREQUESTPROPERTY_STREAMTOFILE\""; + case 4: + return "\"PP_URLREQUESTPROPERTY_FOLLOWREDIRECTS\""; + case 5: + return "\"PP_URLREQUESTPROPERTY_RECORDDOWNLOADPROGRESS\""; + case 6: + return "\"PP_URLREQUESTPROPERTY_RECORDUPLOADPROGRESS\""; + case 7: + return "\"PP_URLREQUESTPROPERTY_CUSTOMREFERRERURL\""; + case 8: + return "\"PP_URLREQUESTPROPERTY_ALLOWCROSSORIGINREQUESTS\""; + case 9: + return "\"PP_URLREQUESTPROPERTY_ALLOWCREDENTIALS\""; + case 10: + return "\"PP_URLREQUESTPROPERTY_CUSTOMCONTENTTRANSFERENCODING\""; + case 11: + return "\"PP_URLREQUESTPROPERTY_PREFETCHBUFFERUPPERTHRESHOLD\""; + case 12: + return "\"PP_URLREQUESTPROPERTY_PREFETCHBUFFERLOWERTHRESHOLD\""; + case 13: + return "\"PP_URLREQUESTPROPERTY_CUSTOMUSERAGENT\""; + default: + return "\"???\""; + } +} +const string ToString_PP_URLRequestProperty(const PP_URLRequestProperty &v) { + return ToString_PP_URLRequestProperty(&v); +} +void FromJSON_PP_URLRequestProperty(JSONIterator& iterator, PP_URLRequestProperty &value) { + long int v; + FromJSON_int(iterator, v); + value = PP_URLRequestProperty(v); +} +namespace ns_PPB_URLRequestInfo_1_0 { +static PP_Resource Create_1_0(PP_Instance instance) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_URLRequestInfo\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"Create\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Resource(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_URLRequestInfo_1_0*)RealGetInterface("PPB_URLRequestInfo;1.0"))->Create(instance); + printf("RPC response: ["); + printf("%s", ToString_PP_Resource(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool IsURLRequestInfo_1_0(PP_Resource resource) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_URLRequestInfo\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"IsURLRequestInfo\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_URLRequestInfo_1_0*)RealGetInterface("PPB_URLRequestInfo;1.0"))->IsURLRequestInfo(resource); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool SetProperty_1_0(PP_Resource request, PP_URLRequestProperty property, struct PP_Var value) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_URLRequestInfo\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"SetProperty\""); + AddProp(ss, "request", ToString_PP_Resource(request)); + AddProp(ss, "property", ToString_PP_URLRequestProperty(property)); + AddProp(ss, "value", ToString_PP_Var(value)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_URLRequestInfo_1_0*)RealGetInterface("PPB_URLRequestInfo;1.0"))->SetProperty(request, property, value); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool AppendDataToBody_1_0(PP_Resource request, const void* data, uint32_t len) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_URLRequestInfo\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"AppendDataToBody\""); + AddProp(ss, "request", ToString_PP_Resource(request)); + AddProp(ss, "data", ToString_mem_t(data)); + AddProp(ss, "len", ToString_uint32_t(len)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_URLRequestInfo_1_0*)RealGetInterface("PPB_URLRequestInfo;1.0"))->AppendDataToBody(request, data, len); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool AppendFileToBody_1_0(PP_Resource request, PP_Resource file_ref, int64_t start_offset, int64_t number_of_bytes, PP_Time expected_last_modified_time) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_URLRequestInfo\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"AppendFileToBody\""); + AddProp(ss, "request", ToString_PP_Resource(request)); + AddProp(ss, "file_ref", ToString_PP_Resource(file_ref)); + AddProp(ss, "start_offset", ToString_int64_t(start_offset)); + AddProp(ss, "number_of_bytes", ToString_int64_t(number_of_bytes)); + AddProp(ss, "expected_last_modified_time", ToString_PP_Time(expected_last_modified_time)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_URLRequestInfo_1_0*)RealGetInterface("PPB_URLRequestInfo;1.0"))->AppendFileToBody(request, file_ref, start_offset, number_of_bytes, expected_last_modified_time); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +} +static PPB_URLRequestInfo_1_0 _PPB_URLRequestInfo_1_0 = { + ns_PPB_URLRequestInfo_1_0::Create_1_0, + ns_PPB_URLRequestInfo_1_0::IsURLRequestInfo_1_0, + ns_PPB_URLRequestInfo_1_0::SetProperty_1_0, + ns_PPB_URLRequestInfo_1_0::AppendDataToBody_1_0, + ns_PPB_URLRequestInfo_1_0::AppendFileToBody_1_0, +}; +const string ToString_PPB_URLRequestInfo(const PPB_URLRequestInfo_1_0 *v) { + stringstream s; + s << v; + return s.str(); +} +const string ToString_PP_URLResponseProperty(const PP_URLResponseProperty *v) { + switch (*v) { + case 0: + return "\"PP_URLRESPONSEPROPERTY_URL\""; + case 1: + return "\"PP_URLRESPONSEPROPERTY_REDIRECTURL\""; + case 2: + return "\"PP_URLRESPONSEPROPERTY_REDIRECTMETHOD\""; + case 3: + return "\"PP_URLRESPONSEPROPERTY_STATUSCODE\""; + case 4: + return "\"PP_URLRESPONSEPROPERTY_STATUSLINE\""; + case 5: + return "\"PP_URLRESPONSEPROPERTY_HEADERS\""; + default: + return "\"???\""; + } +} +const string ToString_PP_URLResponseProperty(const PP_URLResponseProperty &v) { + return ToString_PP_URLResponseProperty(&v); +} +void FromJSON_PP_URLResponseProperty(JSONIterator& iterator, PP_URLResponseProperty &value) { + long int v; + FromJSON_int(iterator, v); + value = PP_URLResponseProperty(v); +} +namespace ns_PPB_URLResponseInfo_1_0 { +static PP_Bool IsURLResponseInfo_1_0(PP_Resource resource) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_URLResponseInfo\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"IsURLResponseInfo\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_URLResponseInfo_1_0*)RealGetInterface("PPB_URLResponseInfo;1.0"))->IsURLResponseInfo(resource); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static struct PP_Var GetProperty_1_0(PP_Resource response, PP_URLResponseProperty property) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_URLResponseInfo\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"GetProperty\""); + AddProp(ss, "response", ToString_PP_Resource(response)); + AddProp(ss, "property", ToString_PP_URLResponseProperty(property)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + struct PP_Var rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Var(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + struct PP_Var rval = ((PPB_URLResponseInfo_1_0*)RealGetInterface("PPB_URLResponseInfo;1.0"))->GetProperty(response, property); + printf("RPC response: ["); + printf("%s", ToString_PP_Var(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Resource GetBodyAsFileRef_1_0(PP_Resource response) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_URLResponseInfo\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"GetBodyAsFileRef\""); + AddProp(ss, "response", ToString_PP_Resource(response)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Resource(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_URLResponseInfo_1_0*)RealGetInterface("PPB_URLResponseInfo;1.0"))->GetBodyAsFileRef(response); + printf("RPC response: ["); + printf("%s", ToString_PP_Resource(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +} +static PPB_URLResponseInfo_1_0 _PPB_URLResponseInfo_1_0 = { + ns_PPB_URLResponseInfo_1_0::IsURLResponseInfo_1_0, + ns_PPB_URLResponseInfo_1_0::GetProperty_1_0, + ns_PPB_URLResponseInfo_1_0::GetBodyAsFileRef_1_0, +}; +const string ToString_PPB_URLResponseInfo(const PPB_URLResponseInfo_1_0 *v) { + stringstream s; + s << v; + return s.str(); +} +namespace ns_PPB_Var_1_0 { +static void AddRef_1_0(struct PP_Var var) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Var\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"AddRef\""); + AddProp(ss, "var", ToString_PP_Var(var)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_Var_1_0*)RealGetInterface("PPB_Var;1.0"))->AddRef(var); +#endif // !INTERPOSE +} +static void Release_1_0(struct PP_Var var) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Var\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"Release\""); + AddProp(ss, "var", ToString_PP_Var(var)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_Var_1_0*)RealGetInterface("PPB_Var;1.0"))->Release(var); +#endif // !INTERPOSE +} +static struct PP_Var VarFromUtf8_1_0(PP_Module module, const char* data, uint32_t len) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Var\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"VarFromUtf8\""); + AddProp(ss, "module", ToString_PP_Module(module)); + AddProp(ss, "data", ToString_str_t(data)); + AddProp(ss, "len", ToString_uint32_t(len)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + struct PP_Var rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Var(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + struct PP_Var rval = ((PPB_Var_1_0*)RealGetInterface("PPB_Var;1.0"))->VarFromUtf8(module, data, len); + printf("RPC response: ["); + printf("%s", ToString_PP_Var(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +/* skipping VarFromUtf8 */ +static const char* VarToUtf8_1_0(struct PP_Var var, uint32_t* len) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Var\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"VarToUtf8\""); + AddProp(ss, "var", ToString_PP_Var(var)); + AddProp(ss, "len", PointerToString(len)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + char* rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_str_t(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + iterator.skip(); + FromJSON_uint32_t(iterator, *len); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + const char* rval = ((PPB_Var_1_0*)RealGetInterface("PPB_Var;1.0"))->VarToUtf8(var, len); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_str_t(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + if (!!len) { + AddProp(os, "len", ToString_uint32_t(len)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +/* skipping VarToResource */ +/* skipping VarFromResource */ +} +static PPB_Var_1_0 _PPB_Var_1_0 = { + ns_PPB_Var_1_0::AddRef_1_0, + ns_PPB_Var_1_0::Release_1_0, + ns_PPB_Var_1_0::VarFromUtf8_1_0, + ns_PPB_Var_1_0::VarToUtf8_1_0, +}; +const string ToString_PPB_Var(const PPB_Var_1_0 *v) { + stringstream s; + s << v; + return s.str(); +} +namespace ns_PPB_Var_1_1 { +static void AddRef_1_1(struct PP_Var var) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Var\""); + AddProp(ss, "__version", "\"1.1\""); + AddProp(ss, "__method", "\"AddRef\""); + AddProp(ss, "var", ToString_PP_Var(var)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_Var_1_1*)RealGetInterface("PPB_Var;1.1"))->AddRef(var); +#endif // !INTERPOSE +} +static void Release_1_1(struct PP_Var var) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Var\""); + AddProp(ss, "__version", "\"1.1\""); + AddProp(ss, "__method", "\"Release\""); + AddProp(ss, "var", ToString_PP_Var(var)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_Var_1_1*)RealGetInterface("PPB_Var;1.1"))->Release(var); +#endif // !INTERPOSE +} +/* skipping VarFromUtf8 */ +static struct PP_Var VarFromUtf8_1_1(const char* data, uint32_t len) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Var\""); + AddProp(ss, "__version", "\"1.1\""); + AddProp(ss, "__method", "\"VarFromUtf8\""); + AddProp(ss, "data", ToString_str_t(data)); + AddProp(ss, "len", ToString_uint32_t(len)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + struct PP_Var rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Var(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + struct PP_Var rval = ((PPB_Var_1_1*)RealGetInterface("PPB_Var;1.1"))->VarFromUtf8(data, len); + printf("RPC response: ["); + printf("%s", ToString_PP_Var(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static const char* VarToUtf8_1_1(struct PP_Var var, uint32_t* len) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Var\""); + AddProp(ss, "__version", "\"1.1\""); + AddProp(ss, "__method", "\"VarToUtf8\""); + AddProp(ss, "var", ToString_PP_Var(var)); + AddProp(ss, "len", PointerToString(len)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + char* rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_str_t(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + iterator.skip(); + FromJSON_uint32_t(iterator, *len); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + const char* rval = ((PPB_Var_1_1*)RealGetInterface("PPB_Var;1.1"))->VarToUtf8(var, len); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_str_t(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + if (!!len) { + AddProp(os, "len", ToString_uint32_t(len)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +/* skipping VarToResource */ +/* skipping VarFromResource */ +} +static PPB_Var_1_1 _PPB_Var_1_1 = { + ns_PPB_Var_1_1::AddRef_1_1, + ns_PPB_Var_1_1::Release_1_1, + ns_PPB_Var_1_1::VarFromUtf8_1_1, + ns_PPB_Var_1_1::VarToUtf8_1_1, +}; +const string ToString_PPB_Var(const PPB_Var_1_1 *v) { + stringstream s; + s << v; + return s.str(); +} +namespace ns_PPB_Var_1_2 { +static void AddRef_1_2(struct PP_Var var) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Var\""); + AddProp(ss, "__version", "\"1.2\""); + AddProp(ss, "__method", "\"AddRef\""); + AddProp(ss, "var", ToString_PP_Var(var)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_Var_1_2*)RealGetInterface("PPB_Var;1.2"))->AddRef(var); +#endif // !INTERPOSE +} +static void Release_1_2(struct PP_Var var) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Var\""); + AddProp(ss, "__version", "\"1.2\""); + AddProp(ss, "__method", "\"Release\""); + AddProp(ss, "var", ToString_PP_Var(var)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_Var_1_2*)RealGetInterface("PPB_Var;1.2"))->Release(var); +#endif // !INTERPOSE +} +/* skipping VarFromUtf8 */ +static struct PP_Var VarFromUtf8_1_2(const char* data, uint32_t len) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Var\""); + AddProp(ss, "__version", "\"1.2\""); + AddProp(ss, "__method", "\"VarFromUtf8\""); + AddProp(ss, "data", ToString_str_t(data)); + AddProp(ss, "len", ToString_uint32_t(len)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + struct PP_Var rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Var(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + struct PP_Var rval = ((PPB_Var_1_2*)RealGetInterface("PPB_Var;1.2"))->VarFromUtf8(data, len); + printf("RPC response: ["); + printf("%s", ToString_PP_Var(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static const char* VarToUtf8_1_2(struct PP_Var var, uint32_t* len) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Var\""); + AddProp(ss, "__version", "\"1.2\""); + AddProp(ss, "__method", "\"VarToUtf8\""); + AddProp(ss, "var", ToString_PP_Var(var)); + AddProp(ss, "len", PointerToString(len)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + char* rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_str_t(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + iterator.skip(); + FromJSON_uint32_t(iterator, *len); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + const char* rval = ((PPB_Var_1_2*)RealGetInterface("PPB_Var;1.2"))->VarToUtf8(var, len); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_str_t(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + if (!!len) { + AddProp(os, "len", ToString_uint32_t(len)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Resource VarToResource_1_2(struct PP_Var var) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Var\""); + AddProp(ss, "__version", "\"1.2\""); + AddProp(ss, "__method", "\"VarToResource\""); + AddProp(ss, "var", ToString_PP_Var(var)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Resource(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_Var_1_2*)RealGetInterface("PPB_Var;1.2"))->VarToResource(var); + printf("RPC response: ["); + printf("%s", ToString_PP_Resource(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static struct PP_Var VarFromResource_1_2(PP_Resource resource) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Var\""); + AddProp(ss, "__version", "\"1.2\""); + AddProp(ss, "__method", "\"VarFromResource\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + struct PP_Var rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Var(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + struct PP_Var rval = ((PPB_Var_1_2*)RealGetInterface("PPB_Var;1.2"))->VarFromResource(resource); + printf("RPC response: ["); + printf("%s", ToString_PP_Var(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +} +static PPB_Var_1_2 _PPB_Var_1_2 = { + ns_PPB_Var_1_2::AddRef_1_2, + ns_PPB_Var_1_2::Release_1_2, + ns_PPB_Var_1_2::VarFromUtf8_1_2, + ns_PPB_Var_1_2::VarToUtf8_1_2, + ns_PPB_Var_1_2::VarToResource_1_2, + ns_PPB_Var_1_2::VarFromResource_1_2, +}; +const string ToString_PPB_Var(const PPB_Var_1_2 *v) { + stringstream s; + s << v; + return s.str(); +} +namespace ns_PPB_VarArray_1_0 { +static struct PP_Var Create_1_0(void) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_VarArray\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"Create\""); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + struct PP_Var rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Var(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + struct PP_Var rval = ((PPB_VarArray_1_0*)RealGetInterface("PPB_VarArray;1.0"))->Create(); + printf("RPC response: ["); + printf("%s", ToString_PP_Var(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static struct PP_Var Get_1_0(struct PP_Var array, uint32_t index) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_VarArray\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"Get\""); + AddProp(ss, "array", ToString_PP_Var(array)); + AddProp(ss, "index", ToString_uint32_t(index)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + struct PP_Var rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Var(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + struct PP_Var rval = ((PPB_VarArray_1_0*)RealGetInterface("PPB_VarArray;1.0"))->Get(array, index); + printf("RPC response: ["); + printf("%s", ToString_PP_Var(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool Set_1_0(struct PP_Var array, uint32_t index, struct PP_Var value) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_VarArray\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"Set\""); + AddProp(ss, "array", ToString_PP_Var(array)); + AddProp(ss, "index", ToString_uint32_t(index)); + AddProp(ss, "value", ToString_PP_Var(value)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_VarArray_1_0*)RealGetInterface("PPB_VarArray;1.0"))->Set(array, index, value); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static uint32_t GetLength_1_0(struct PP_Var array) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_VarArray\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"GetLength\""); + AddProp(ss, "array", ToString_PP_Var(array)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + uint32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_uint32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + uint32_t rval = ((PPB_VarArray_1_0*)RealGetInterface("PPB_VarArray;1.0"))->GetLength(array); + printf("RPC response: ["); + printf("%s", ToString_uint32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool SetLength_1_0(struct PP_Var array, uint32_t length) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_VarArray\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"SetLength\""); + AddProp(ss, "array", ToString_PP_Var(array)); + AddProp(ss, "length", ToString_uint32_t(length)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_VarArray_1_0*)RealGetInterface("PPB_VarArray;1.0"))->SetLength(array, length); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +} +static PPB_VarArray_1_0 _PPB_VarArray_1_0 = { + ns_PPB_VarArray_1_0::Create_1_0, + ns_PPB_VarArray_1_0::Get_1_0, + ns_PPB_VarArray_1_0::Set_1_0, + ns_PPB_VarArray_1_0::GetLength_1_0, + ns_PPB_VarArray_1_0::SetLength_1_0, +}; +const string ToString_PPB_VarArray(const PPB_VarArray_1_0 *v) { + stringstream s; + s << v; + return s.str(); +} +namespace ns_PPB_VarArrayBuffer_1_0 { +static struct PP_Var Create_1_0(uint32_t size_in_bytes) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_VarArrayBuffer\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"Create\""); + AddProp(ss, "size_in_bytes", ToString_uint32_t(size_in_bytes)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + struct PP_Var rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Var(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + struct PP_Var rval = ((PPB_VarArrayBuffer_1_0*)RealGetInterface("PPB_VarArrayBuffer;1.0"))->Create(size_in_bytes); + printf("RPC response: ["); + printf("%s", ToString_PP_Var(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool ByteLength_1_0(struct PP_Var array, uint32_t* byte_length) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_VarArrayBuffer\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"ByteLength\""); + AddProp(ss, "array", ToString_PP_Var(array)); + AddProp(ss, "byte_length", PointerToString(byte_length)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + iterator.skip(); + FromJSON_uint32_t(iterator, *byte_length); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_VarArrayBuffer_1_0*)RealGetInterface("PPB_VarArrayBuffer;1.0"))->ByteLength(array, byte_length); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + if (!!byte_length) { + AddProp(os, "byte_length", ToString_uint32_t(byte_length)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static void* Map_1_0(struct PP_Var array) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_VarArrayBuffer\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"Map\""); + AddProp(ss, "array", ToString_PP_Var(array)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + void* rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_mem_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + void* rval = ((PPB_VarArrayBuffer_1_0*)RealGetInterface("PPB_VarArrayBuffer;1.0"))->Map(array); + printf("RPC response: ["); + printf("%s", ToString_mem_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static void Unmap_1_0(struct PP_Var array) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_VarArrayBuffer\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"Unmap\""); + AddProp(ss, "array", ToString_PP_Var(array)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_VarArrayBuffer_1_0*)RealGetInterface("PPB_VarArrayBuffer;1.0"))->Unmap(array); +#endif // !INTERPOSE +} +} +static PPB_VarArrayBuffer_1_0 _PPB_VarArrayBuffer_1_0 = { + ns_PPB_VarArrayBuffer_1_0::Create_1_0, + ns_PPB_VarArrayBuffer_1_0::ByteLength_1_0, + ns_PPB_VarArrayBuffer_1_0::Map_1_0, + ns_PPB_VarArrayBuffer_1_0::Unmap_1_0, +}; +const string ToString_PPB_VarArrayBuffer(const PPB_VarArrayBuffer_1_0 *v) { + stringstream s; + s << v; + return s.str(); +} +namespace ns_PPB_VarDictionary_1_0 { +static struct PP_Var Create_1_0(void) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_VarDictionary\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"Create\""); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + struct PP_Var rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Var(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + struct PP_Var rval = ((PPB_VarDictionary_1_0*)RealGetInterface("PPB_VarDictionary;1.0"))->Create(); + printf("RPC response: ["); + printf("%s", ToString_PP_Var(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static struct PP_Var Get_1_0(struct PP_Var dict, struct PP_Var key) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_VarDictionary\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"Get\""); + AddProp(ss, "dict", ToString_PP_Var(dict)); + AddProp(ss, "key", ToString_PP_Var(key)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + struct PP_Var rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Var(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + struct PP_Var rval = ((PPB_VarDictionary_1_0*)RealGetInterface("PPB_VarDictionary;1.0"))->Get(dict, key); + printf("RPC response: ["); + printf("%s", ToString_PP_Var(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool Set_1_0(struct PP_Var dict, struct PP_Var key, struct PP_Var value) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_VarDictionary\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"Set\""); + AddProp(ss, "dict", ToString_PP_Var(dict)); + AddProp(ss, "key", ToString_PP_Var(key)); + AddProp(ss, "value", ToString_PP_Var(value)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_VarDictionary_1_0*)RealGetInterface("PPB_VarDictionary;1.0"))->Set(dict, key, value); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static void Delete_1_0(struct PP_Var dict, struct PP_Var key) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_VarDictionary\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"Delete\""); + AddProp(ss, "dict", ToString_PP_Var(dict)); + AddProp(ss, "key", ToString_PP_Var(key)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_VarDictionary_1_0*)RealGetInterface("PPB_VarDictionary;1.0"))->Delete(dict, key); +#endif // !INTERPOSE +} +static PP_Bool HasKey_1_0(struct PP_Var dict, struct PP_Var key) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_VarDictionary\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"HasKey\""); + AddProp(ss, "dict", ToString_PP_Var(dict)); + AddProp(ss, "key", ToString_PP_Var(key)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_VarDictionary_1_0*)RealGetInterface("PPB_VarDictionary;1.0"))->HasKey(dict, key); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static struct PP_Var GetKeys_1_0(struct PP_Var dict) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_VarDictionary\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"GetKeys\""); + AddProp(ss, "dict", ToString_PP_Var(dict)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + struct PP_Var rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Var(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + struct PP_Var rval = ((PPB_VarDictionary_1_0*)RealGetInterface("PPB_VarDictionary;1.0"))->GetKeys(dict); + printf("RPC response: ["); + printf("%s", ToString_PP_Var(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +} +static PPB_VarDictionary_1_0 _PPB_VarDictionary_1_0 = { + ns_PPB_VarDictionary_1_0::Create_1_0, + ns_PPB_VarDictionary_1_0::Get_1_0, + ns_PPB_VarDictionary_1_0::Set_1_0, + ns_PPB_VarDictionary_1_0::Delete_1_0, + ns_PPB_VarDictionary_1_0::HasKey_1_0, + ns_PPB_VarDictionary_1_0::GetKeys_1_0, +}; +const string ToString_PPB_VarDictionary(const PPB_VarDictionary_1_0 *v) { + stringstream s; + s << v; + return s.str(); +} +namespace ns_PPB_VideoDecoder_0_1 { +static PP_Resource Create_0_1(PP_Instance instance) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_VideoDecoder\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"Create\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Resource(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_VideoDecoder_0_1*)RealGetInterface("PPB_VideoDecoder;0.1"))->Create(instance); + printf("RPC response: ["); + printf("%s", ToString_PP_Resource(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool IsVideoDecoder_0_1(PP_Resource resource) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_VideoDecoder\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"IsVideoDecoder\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_VideoDecoder_0_1*)RealGetInterface("PPB_VideoDecoder;0.1"))->IsVideoDecoder(resource); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t Initialize_0_1(PP_Resource video_decoder, PP_Resource graphics3d_context, PP_VideoProfile profile, PP_Bool allow_software_fallback, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_VideoDecoder\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"Initialize\""); + AddProp(ss, "video_decoder", ToString_PP_Resource(video_decoder)); + AddProp(ss, "graphics3d_context", ToString_PP_Resource(graphics3d_context)); + AddProp(ss, "profile", ToString_PP_VideoProfile(profile)); + AddProp(ss, "allow_software_fallback", ToString_PP_Bool(allow_software_fallback)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_VideoDecoder_0_1*)RealGetInterface("PPB_VideoDecoder;0.1"))->Initialize(video_decoder, graphics3d_context, profile, allow_software_fallback, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +/* skipping Initialize */ +/* skipping Initialize */ +static int32_t Decode_0_1(PP_Resource video_decoder, uint32_t decode_id, uint32_t size, const void* buffer, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_VideoDecoder\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"Decode\""); + AddProp(ss, "video_decoder", ToString_PP_Resource(video_decoder)); + AddProp(ss, "decode_id", ToString_uint32_t(decode_id)); + AddProp(ss, "size", ToString_uint32_t(size)); + AddProp(ss, "buffer", ToString_mem_t(buffer)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_VideoDecoder_0_1*)RealGetInterface("PPB_VideoDecoder;0.1"))->Decode(video_decoder, decode_id, size, buffer, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t GetPicture_0_1(PP_Resource video_decoder, struct PP_VideoPicture_0_1* picture, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_VideoDecoder\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"GetPicture\""); + AddProp(ss, "video_decoder", ToString_PP_Resource(video_decoder)); + AddProp(ss, "picture", PointerToString(picture)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + if (!!picture) { + iterator.skip(); + FromJSON_PP_VideoPicture_0_1(iterator, *picture); + } + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_VideoDecoder_0_1*)RealGetInterface("PPB_VideoDecoder;0.1"))->GetPicture(video_decoder, picture, logging_callback); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_int32_t(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + if (!!picture) { + AddProp(os, "picture", ToString_PP_VideoPicture_0_1(picture)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +/* skipping GetPicture */ +static void RecyclePicture_0_1(PP_Resource video_decoder, const struct PP_VideoPicture* picture) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_VideoDecoder\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"RecyclePicture\""); + AddProp(ss, "video_decoder", ToString_PP_Resource(video_decoder)); + AddProp(ss, "picture", ToString_PP_VideoPicture(picture)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_VideoDecoder_0_1*)RealGetInterface("PPB_VideoDecoder;0.1"))->RecyclePicture(video_decoder, picture); +#endif // !INTERPOSE +} +static int32_t Flush_0_1(PP_Resource video_decoder, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_VideoDecoder\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"Flush\""); + AddProp(ss, "video_decoder", ToString_PP_Resource(video_decoder)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_VideoDecoder_0_1*)RealGetInterface("PPB_VideoDecoder;0.1"))->Flush(video_decoder, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t Reset_0_1(PP_Resource video_decoder, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_VideoDecoder\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"Reset\""); + AddProp(ss, "video_decoder", ToString_PP_Resource(video_decoder)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_VideoDecoder_0_1*)RealGetInterface("PPB_VideoDecoder;0.1"))->Reset(video_decoder, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +} +static PPB_VideoDecoder_0_1 _PPB_VideoDecoder_0_1 = { + ns_PPB_VideoDecoder_0_1::Create_0_1, + ns_PPB_VideoDecoder_0_1::IsVideoDecoder_0_1, + ns_PPB_VideoDecoder_0_1::Initialize_0_1, + ns_PPB_VideoDecoder_0_1::Decode_0_1, + ns_PPB_VideoDecoder_0_1::GetPicture_0_1, + ns_PPB_VideoDecoder_0_1::RecyclePicture_0_1, + ns_PPB_VideoDecoder_0_1::Flush_0_1, + ns_PPB_VideoDecoder_0_1::Reset_0_1, +}; +const string ToString_PPB_VideoDecoder(const PPB_VideoDecoder_0_1 *v) { + stringstream s; + s << v; + return s.str(); +} +namespace ns_PPB_VideoDecoder_0_2 { +static PP_Resource Create_0_2(PP_Instance instance) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_VideoDecoder\""); + AddProp(ss, "__version", "\"0.2\""); + AddProp(ss, "__method", "\"Create\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Resource(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_VideoDecoder_0_2*)RealGetInterface("PPB_VideoDecoder;0.2"))->Create(instance); + printf("RPC response: ["); + printf("%s", ToString_PP_Resource(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool IsVideoDecoder_0_2(PP_Resource resource) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_VideoDecoder\""); + AddProp(ss, "__version", "\"0.2\""); + AddProp(ss, "__method", "\"IsVideoDecoder\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_VideoDecoder_0_2*)RealGetInterface("PPB_VideoDecoder;0.2"))->IsVideoDecoder(resource); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +/* skipping Initialize */ +static int32_t Initialize_0_2(PP_Resource video_decoder, PP_Resource graphics3d_context, PP_VideoProfile profile, PP_HardwareAcceleration acceleration, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_VideoDecoder\""); + AddProp(ss, "__version", "\"0.2\""); + AddProp(ss, "__method", "\"Initialize\""); + AddProp(ss, "video_decoder", ToString_PP_Resource(video_decoder)); + AddProp(ss, "graphics3d_context", ToString_PP_Resource(graphics3d_context)); + AddProp(ss, "profile", ToString_PP_VideoProfile(profile)); + AddProp(ss, "acceleration", ToString_PP_HardwareAcceleration(acceleration)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_VideoDecoder_0_2*)RealGetInterface("PPB_VideoDecoder;0.2"))->Initialize(video_decoder, graphics3d_context, profile, acceleration, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +/* skipping Initialize */ +static int32_t Decode_0_2(PP_Resource video_decoder, uint32_t decode_id, uint32_t size, const void* buffer, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_VideoDecoder\""); + AddProp(ss, "__version", "\"0.2\""); + AddProp(ss, "__method", "\"Decode\""); + AddProp(ss, "video_decoder", ToString_PP_Resource(video_decoder)); + AddProp(ss, "decode_id", ToString_uint32_t(decode_id)); + AddProp(ss, "size", ToString_uint32_t(size)); + AddProp(ss, "buffer", ToString_mem_t(buffer)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_VideoDecoder_0_2*)RealGetInterface("PPB_VideoDecoder;0.2"))->Decode(video_decoder, decode_id, size, buffer, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t GetPicture_0_2(PP_Resource video_decoder, struct PP_VideoPicture_0_1* picture, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_VideoDecoder\""); + AddProp(ss, "__version", "\"0.2\""); + AddProp(ss, "__method", "\"GetPicture\""); + AddProp(ss, "video_decoder", ToString_PP_Resource(video_decoder)); + AddProp(ss, "picture", PointerToString(picture)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + if (!!picture) { + iterator.skip(); + FromJSON_PP_VideoPicture_0_1(iterator, *picture); + } + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_VideoDecoder_0_2*)RealGetInterface("PPB_VideoDecoder;0.2"))->GetPicture(video_decoder, picture, logging_callback); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_int32_t(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + if (!!picture) { + AddProp(os, "picture", ToString_PP_VideoPicture_0_1(picture)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +/* skipping GetPicture */ +static void RecyclePicture_0_2(PP_Resource video_decoder, const struct PP_VideoPicture* picture) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_VideoDecoder\""); + AddProp(ss, "__version", "\"0.2\""); + AddProp(ss, "__method", "\"RecyclePicture\""); + AddProp(ss, "video_decoder", ToString_PP_Resource(video_decoder)); + AddProp(ss, "picture", ToString_PP_VideoPicture(picture)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_VideoDecoder_0_2*)RealGetInterface("PPB_VideoDecoder;0.2"))->RecyclePicture(video_decoder, picture); +#endif // !INTERPOSE +} +static int32_t Flush_0_2(PP_Resource video_decoder, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_VideoDecoder\""); + AddProp(ss, "__version", "\"0.2\""); + AddProp(ss, "__method", "\"Flush\""); + AddProp(ss, "video_decoder", ToString_PP_Resource(video_decoder)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_VideoDecoder_0_2*)RealGetInterface("PPB_VideoDecoder;0.2"))->Flush(video_decoder, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t Reset_0_2(PP_Resource video_decoder, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_VideoDecoder\""); + AddProp(ss, "__version", "\"0.2\""); + AddProp(ss, "__method", "\"Reset\""); + AddProp(ss, "video_decoder", ToString_PP_Resource(video_decoder)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_VideoDecoder_0_2*)RealGetInterface("PPB_VideoDecoder;0.2"))->Reset(video_decoder, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +} +static PPB_VideoDecoder_0_2 _PPB_VideoDecoder_0_2 = { + ns_PPB_VideoDecoder_0_2::Create_0_2, + ns_PPB_VideoDecoder_0_2::IsVideoDecoder_0_2, + ns_PPB_VideoDecoder_0_2::Initialize_0_2, + ns_PPB_VideoDecoder_0_2::Decode_0_2, + ns_PPB_VideoDecoder_0_2::GetPicture_0_2, + ns_PPB_VideoDecoder_0_2::RecyclePicture_0_2, + ns_PPB_VideoDecoder_0_2::Flush_0_2, + ns_PPB_VideoDecoder_0_2::Reset_0_2, +}; +const string ToString_PPB_VideoDecoder(const PPB_VideoDecoder_0_2 *v) { + stringstream s; + s << v; + return s.str(); +} +namespace ns_PPB_VideoDecoder_1_0 { +static PP_Resource Create_1_0(PP_Instance instance) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_VideoDecoder\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"Create\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Resource(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_VideoDecoder_1_0*)RealGetInterface("PPB_VideoDecoder;1.0"))->Create(instance); + printf("RPC response: ["); + printf("%s", ToString_PP_Resource(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool IsVideoDecoder_1_0(PP_Resource resource) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_VideoDecoder\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"IsVideoDecoder\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_VideoDecoder_1_0*)RealGetInterface("PPB_VideoDecoder;1.0"))->IsVideoDecoder(resource); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +/* skipping Initialize */ +static int32_t Initialize_1_0(PP_Resource video_decoder, PP_Resource graphics3d_context, PP_VideoProfile profile, PP_HardwareAcceleration acceleration, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_VideoDecoder\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"Initialize\""); + AddProp(ss, "video_decoder", ToString_PP_Resource(video_decoder)); + AddProp(ss, "graphics3d_context", ToString_PP_Resource(graphics3d_context)); + AddProp(ss, "profile", ToString_PP_VideoProfile(profile)); + AddProp(ss, "acceleration", ToString_PP_HardwareAcceleration(acceleration)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_VideoDecoder_1_0*)RealGetInterface("PPB_VideoDecoder;1.0"))->Initialize(video_decoder, graphics3d_context, profile, acceleration, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +/* skipping Initialize */ +static int32_t Decode_1_0(PP_Resource video_decoder, uint32_t decode_id, uint32_t size, const void* buffer, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_VideoDecoder\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"Decode\""); + AddProp(ss, "video_decoder", ToString_PP_Resource(video_decoder)); + AddProp(ss, "decode_id", ToString_uint32_t(decode_id)); + AddProp(ss, "size", ToString_uint32_t(size)); + AddProp(ss, "buffer", ToString_mem_t(buffer)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_VideoDecoder_1_0*)RealGetInterface("PPB_VideoDecoder;1.0"))->Decode(video_decoder, decode_id, size, buffer, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +/* skipping GetPicture */ +static int32_t GetPicture_1_0(PP_Resource video_decoder, struct PP_VideoPicture* picture, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_VideoDecoder\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"GetPicture\""); + AddProp(ss, "video_decoder", ToString_PP_Resource(video_decoder)); + AddProp(ss, "picture", PointerToString(picture)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + if (!!picture) { + iterator.skip(); + FromJSON_PP_VideoPicture(iterator, *picture); + } + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_VideoDecoder_1_0*)RealGetInterface("PPB_VideoDecoder;1.0"))->GetPicture(video_decoder, picture, logging_callback); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_int32_t(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + if (!!picture) { + AddProp(os, "picture", ToString_PP_VideoPicture(picture)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static void RecyclePicture_1_0(PP_Resource video_decoder, const struct PP_VideoPicture* picture) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_VideoDecoder\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"RecyclePicture\""); + AddProp(ss, "video_decoder", ToString_PP_Resource(video_decoder)); + AddProp(ss, "picture", ToString_PP_VideoPicture(picture)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_VideoDecoder_1_0*)RealGetInterface("PPB_VideoDecoder;1.0"))->RecyclePicture(video_decoder, picture); +#endif // !INTERPOSE +} +static int32_t Flush_1_0(PP_Resource video_decoder, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_VideoDecoder\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"Flush\""); + AddProp(ss, "video_decoder", ToString_PP_Resource(video_decoder)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_VideoDecoder_1_0*)RealGetInterface("PPB_VideoDecoder;1.0"))->Flush(video_decoder, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t Reset_1_0(PP_Resource video_decoder, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_VideoDecoder\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"Reset\""); + AddProp(ss, "video_decoder", ToString_PP_Resource(video_decoder)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_VideoDecoder_1_0*)RealGetInterface("PPB_VideoDecoder;1.0"))->Reset(video_decoder, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +} +static PPB_VideoDecoder_1_0 _PPB_VideoDecoder_1_0 = { + ns_PPB_VideoDecoder_1_0::Create_1_0, + ns_PPB_VideoDecoder_1_0::IsVideoDecoder_1_0, + ns_PPB_VideoDecoder_1_0::Initialize_1_0, + ns_PPB_VideoDecoder_1_0::Decode_1_0, + ns_PPB_VideoDecoder_1_0::GetPicture_1_0, + ns_PPB_VideoDecoder_1_0::RecyclePicture_1_0, + ns_PPB_VideoDecoder_1_0::Flush_1_0, + ns_PPB_VideoDecoder_1_0::Reset_1_0, +}; +const string ToString_PPB_VideoDecoder(const PPB_VideoDecoder_1_0 *v) { + stringstream s; + s << v; + return s.str(); +} +namespace ns_PPB_VideoDecoder_1_1 { +static PP_Resource Create_1_1(PP_Instance instance) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_VideoDecoder\""); + AddProp(ss, "__version", "\"1.1\""); + AddProp(ss, "__method", "\"Create\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Resource(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_VideoDecoder_1_1*)RealGetInterface("PPB_VideoDecoder;1.1"))->Create(instance); + printf("RPC response: ["); + printf("%s", ToString_PP_Resource(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool IsVideoDecoder_1_1(PP_Resource resource) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_VideoDecoder\""); + AddProp(ss, "__version", "\"1.1\""); + AddProp(ss, "__method", "\"IsVideoDecoder\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_VideoDecoder_1_1*)RealGetInterface("PPB_VideoDecoder;1.1"))->IsVideoDecoder(resource); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +/* skipping Initialize */ +/* skipping Initialize */ +static int32_t Initialize_1_1(PP_Resource video_decoder, PP_Resource graphics3d_context, PP_VideoProfile profile, PP_HardwareAcceleration acceleration, uint32_t min_picture_count, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_VideoDecoder\""); + AddProp(ss, "__version", "\"1.1\""); + AddProp(ss, "__method", "\"Initialize\""); + AddProp(ss, "video_decoder", ToString_PP_Resource(video_decoder)); + AddProp(ss, "graphics3d_context", ToString_PP_Resource(graphics3d_context)); + AddProp(ss, "profile", ToString_PP_VideoProfile(profile)); + AddProp(ss, "acceleration", ToString_PP_HardwareAcceleration(acceleration)); + AddProp(ss, "min_picture_count", ToString_uint32_t(min_picture_count)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_VideoDecoder_1_1*)RealGetInterface("PPB_VideoDecoder;1.1"))->Initialize(video_decoder, graphics3d_context, profile, acceleration, min_picture_count, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t Decode_1_1(PP_Resource video_decoder, uint32_t decode_id, uint32_t size, const void* buffer, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_VideoDecoder\""); + AddProp(ss, "__version", "\"1.1\""); + AddProp(ss, "__method", "\"Decode\""); + AddProp(ss, "video_decoder", ToString_PP_Resource(video_decoder)); + AddProp(ss, "decode_id", ToString_uint32_t(decode_id)); + AddProp(ss, "size", ToString_uint32_t(size)); + AddProp(ss, "buffer", ToString_mem_t(buffer)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_VideoDecoder_1_1*)RealGetInterface("PPB_VideoDecoder;1.1"))->Decode(video_decoder, decode_id, size, buffer, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +/* skipping GetPicture */ +static int32_t GetPicture_1_1(PP_Resource video_decoder, struct PP_VideoPicture* picture, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_VideoDecoder\""); + AddProp(ss, "__version", "\"1.1\""); + AddProp(ss, "__method", "\"GetPicture\""); + AddProp(ss, "video_decoder", ToString_PP_Resource(video_decoder)); + AddProp(ss, "picture", PointerToString(picture)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + if (!!picture) { + iterator.skip(); + FromJSON_PP_VideoPicture(iterator, *picture); + } + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_VideoDecoder_1_1*)RealGetInterface("PPB_VideoDecoder;1.1"))->GetPicture(video_decoder, picture, logging_callback); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_int32_t(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + if (!!picture) { + AddProp(os, "picture", ToString_PP_VideoPicture(picture)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static void RecyclePicture_1_1(PP_Resource video_decoder, const struct PP_VideoPicture* picture) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_VideoDecoder\""); + AddProp(ss, "__version", "\"1.1\""); + AddProp(ss, "__method", "\"RecyclePicture\""); + AddProp(ss, "video_decoder", ToString_PP_Resource(video_decoder)); + AddProp(ss, "picture", ToString_PP_VideoPicture(picture)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_VideoDecoder_1_1*)RealGetInterface("PPB_VideoDecoder;1.1"))->RecyclePicture(video_decoder, picture); +#endif // !INTERPOSE +} +static int32_t Flush_1_1(PP_Resource video_decoder, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_VideoDecoder\""); + AddProp(ss, "__version", "\"1.1\""); + AddProp(ss, "__method", "\"Flush\""); + AddProp(ss, "video_decoder", ToString_PP_Resource(video_decoder)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_VideoDecoder_1_1*)RealGetInterface("PPB_VideoDecoder;1.1"))->Flush(video_decoder, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t Reset_1_1(PP_Resource video_decoder, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_VideoDecoder\""); + AddProp(ss, "__version", "\"1.1\""); + AddProp(ss, "__method", "\"Reset\""); + AddProp(ss, "video_decoder", ToString_PP_Resource(video_decoder)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_VideoDecoder_1_1*)RealGetInterface("PPB_VideoDecoder;1.1"))->Reset(video_decoder, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +} +static PPB_VideoDecoder_1_1 _PPB_VideoDecoder_1_1 = { + ns_PPB_VideoDecoder_1_1::Create_1_1, + ns_PPB_VideoDecoder_1_1::IsVideoDecoder_1_1, + ns_PPB_VideoDecoder_1_1::Initialize_1_1, + ns_PPB_VideoDecoder_1_1::Decode_1_1, + ns_PPB_VideoDecoder_1_1::GetPicture_1_1, + ns_PPB_VideoDecoder_1_1::RecyclePicture_1_1, + ns_PPB_VideoDecoder_1_1::Flush_1_1, + ns_PPB_VideoDecoder_1_1::Reset_1_1, +}; +const string ToString_PPB_VideoDecoder(const PPB_VideoDecoder_1_1 *v) { + stringstream s; + s << v; + return s.str(); +} +namespace ns_PPB_VideoEncoder_0_1 { +static PP_Resource Create_0_1(PP_Instance instance) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_VideoEncoder\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"Create\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Resource(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_VideoEncoder_0_1*)RealGetInterface("PPB_VideoEncoder;0.1"))->Create(instance); + printf("RPC response: ["); + printf("%s", ToString_PP_Resource(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool IsVideoEncoder_0_1(PP_Resource resource) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_VideoEncoder\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"IsVideoEncoder\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_VideoEncoder_0_1*)RealGetInterface("PPB_VideoEncoder;0.1"))->IsVideoEncoder(resource); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t GetSupportedProfiles_0_1(PP_Resource video_encoder, struct PP_ArrayOutput output, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_VideoEncoder\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"GetSupportedProfiles\""); + AddProp(ss, "video_encoder", ToString_PP_Resource(video_encoder)); + AddProp(ss, "output", ToString_PP_ArrayOutput(output)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_VideoEncoder_0_1*)RealGetInterface("PPB_VideoEncoder;0.1"))->GetSupportedProfiles(video_encoder, output, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +/* skipping GetSupportedProfiles */ +static int32_t Initialize_0_1(PP_Resource video_encoder, PP_VideoFrame_Format input_format, const struct PP_Size* input_visible_size, PP_VideoProfile output_profile, uint32_t initial_bitrate, PP_HardwareAcceleration acceleration, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_VideoEncoder\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"Initialize\""); + AddProp(ss, "video_encoder", ToString_PP_Resource(video_encoder)); + AddProp(ss, "input_format", ToString_PP_VideoFrame_Format(input_format)); + AddProp(ss, "input_visible_size", ToString_PP_Size(input_visible_size)); + AddProp(ss, "output_profile", ToString_PP_VideoProfile(output_profile)); + AddProp(ss, "initial_bitrate", ToString_uint32_t(initial_bitrate)); + AddProp(ss, "acceleration", ToString_PP_HardwareAcceleration(acceleration)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_VideoEncoder_0_1*)RealGetInterface("PPB_VideoEncoder;0.1"))->Initialize(video_encoder, input_format, input_visible_size, output_profile, initial_bitrate, acceleration, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t GetFramesRequired_0_1(PP_Resource video_encoder) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_VideoEncoder\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"GetFramesRequired\""); + AddProp(ss, "video_encoder", ToString_PP_Resource(video_encoder)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_VideoEncoder_0_1*)RealGetInterface("PPB_VideoEncoder;0.1"))->GetFramesRequired(video_encoder); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t GetFrameCodedSize_0_1(PP_Resource video_encoder, struct PP_Size* coded_size) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_VideoEncoder\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"GetFrameCodedSize\""); + AddProp(ss, "video_encoder", ToString_PP_Resource(video_encoder)); + AddProp(ss, "coded_size", PointerToString(coded_size)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + if (!!coded_size) { + iterator.skip(); + FromJSON_PP_Size(iterator, *coded_size); + } + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_VideoEncoder_0_1*)RealGetInterface("PPB_VideoEncoder;0.1"))->GetFrameCodedSize(video_encoder, coded_size); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_int32_t(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + if (!!coded_size) { + AddProp(os, "coded_size", ToString_PP_Size(coded_size)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t GetVideoFrame_0_1(PP_Resource video_encoder, PP_Resource* video_frame, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_VideoEncoder\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"GetVideoFrame\""); + AddProp(ss, "video_encoder", ToString_PP_Resource(video_encoder)); + AddProp(ss, "video_frame", PointerToString(video_frame)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + iterator.skip(); + FromJSON_PP_Resource(iterator, *video_frame); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_VideoEncoder_0_1*)RealGetInterface("PPB_VideoEncoder;0.1"))->GetVideoFrame(video_encoder, video_frame, logging_callback); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_int32_t(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + if (!!video_frame) { + AddProp(os, "video_frame", ToString_PP_Resource(video_frame)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t Encode_0_1(PP_Resource video_encoder, PP_Resource video_frame, PP_Bool force_keyframe, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_VideoEncoder\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"Encode\""); + AddProp(ss, "video_encoder", ToString_PP_Resource(video_encoder)); + AddProp(ss, "video_frame", ToString_PP_Resource(video_frame)); + AddProp(ss, "force_keyframe", ToString_PP_Bool(force_keyframe)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_VideoEncoder_0_1*)RealGetInterface("PPB_VideoEncoder;0.1"))->Encode(video_encoder, video_frame, force_keyframe, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t GetBitstreamBuffer_0_1(PP_Resource video_encoder, struct PP_BitstreamBuffer* bitstream_buffer, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_VideoEncoder\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"GetBitstreamBuffer\""); + AddProp(ss, "video_encoder", ToString_PP_Resource(video_encoder)); + AddProp(ss, "bitstream_buffer", PointerToString(bitstream_buffer)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + if (!!bitstream_buffer) { + iterator.skip(); + FromJSON_PP_BitstreamBuffer(iterator, *bitstream_buffer); + } + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_VideoEncoder_0_1*)RealGetInterface("PPB_VideoEncoder;0.1"))->GetBitstreamBuffer(video_encoder, bitstream_buffer, logging_callback); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_int32_t(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + if (!!bitstream_buffer) { + AddProp(os, "bitstream_buffer", ToString_PP_BitstreamBuffer(bitstream_buffer)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static void RecycleBitstreamBuffer_0_1(PP_Resource video_encoder, const struct PP_BitstreamBuffer* bitstream_buffer) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_VideoEncoder\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"RecycleBitstreamBuffer\""); + AddProp(ss, "video_encoder", ToString_PP_Resource(video_encoder)); + AddProp(ss, "bitstream_buffer", ToString_PP_BitstreamBuffer(bitstream_buffer)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_VideoEncoder_0_1*)RealGetInterface("PPB_VideoEncoder;0.1"))->RecycleBitstreamBuffer(video_encoder, bitstream_buffer); +#endif // !INTERPOSE +} +static void RequestEncodingParametersChange_0_1(PP_Resource video_encoder, uint32_t bitrate, uint32_t framerate) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_VideoEncoder\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"RequestEncodingParametersChange\""); + AddProp(ss, "video_encoder", ToString_PP_Resource(video_encoder)); + AddProp(ss, "bitrate", ToString_uint32_t(bitrate)); + AddProp(ss, "framerate", ToString_uint32_t(framerate)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_VideoEncoder_0_1*)RealGetInterface("PPB_VideoEncoder;0.1"))->RequestEncodingParametersChange(video_encoder, bitrate, framerate); +#endif // !INTERPOSE +} +static void Close_0_1(PP_Resource video_encoder) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_VideoEncoder\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"Close\""); + AddProp(ss, "video_encoder", ToString_PP_Resource(video_encoder)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_VideoEncoder_0_1*)RealGetInterface("PPB_VideoEncoder;0.1"))->Close(video_encoder); +#endif // !INTERPOSE +} +} +static PPB_VideoEncoder_0_1 _PPB_VideoEncoder_0_1 = { + ns_PPB_VideoEncoder_0_1::Create_0_1, + ns_PPB_VideoEncoder_0_1::IsVideoEncoder_0_1, + ns_PPB_VideoEncoder_0_1::GetSupportedProfiles_0_1, + ns_PPB_VideoEncoder_0_1::Initialize_0_1, + ns_PPB_VideoEncoder_0_1::GetFramesRequired_0_1, + ns_PPB_VideoEncoder_0_1::GetFrameCodedSize_0_1, + ns_PPB_VideoEncoder_0_1::GetVideoFrame_0_1, + ns_PPB_VideoEncoder_0_1::Encode_0_1, + ns_PPB_VideoEncoder_0_1::GetBitstreamBuffer_0_1, + ns_PPB_VideoEncoder_0_1::RecycleBitstreamBuffer_0_1, + ns_PPB_VideoEncoder_0_1::RequestEncodingParametersChange_0_1, + ns_PPB_VideoEncoder_0_1::Close_0_1, +}; +const string ToString_PPB_VideoEncoder(const PPB_VideoEncoder_0_1 *v) { + stringstream s; + s << v; + return s.str(); +} +namespace ns_PPB_VideoEncoder_0_2 { +static PP_Resource Create_0_2(PP_Instance instance) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_VideoEncoder\""); + AddProp(ss, "__version", "\"0.2\""); + AddProp(ss, "__method", "\"Create\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Resource(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_VideoEncoder_0_2*)RealGetInterface("PPB_VideoEncoder;0.2"))->Create(instance); + printf("RPC response: ["); + printf("%s", ToString_PP_Resource(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool IsVideoEncoder_0_2(PP_Resource resource) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_VideoEncoder\""); + AddProp(ss, "__version", "\"0.2\""); + AddProp(ss, "__method", "\"IsVideoEncoder\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_VideoEncoder_0_2*)RealGetInterface("PPB_VideoEncoder;0.2"))->IsVideoEncoder(resource); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +/* skipping GetSupportedProfiles */ +static int32_t GetSupportedProfiles_0_2(PP_Resource video_encoder, struct PP_ArrayOutput output, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_VideoEncoder\""); + AddProp(ss, "__version", "\"0.2\""); + AddProp(ss, "__method", "\"GetSupportedProfiles\""); + AddProp(ss, "video_encoder", ToString_PP_Resource(video_encoder)); + AddProp(ss, "output", ToString_PP_ArrayOutput(output)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_VideoEncoder_0_2*)RealGetInterface("PPB_VideoEncoder;0.2"))->GetSupportedProfiles(video_encoder, output, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t Initialize_0_2(PP_Resource video_encoder, PP_VideoFrame_Format input_format, const struct PP_Size* input_visible_size, PP_VideoProfile output_profile, uint32_t initial_bitrate, PP_HardwareAcceleration acceleration, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_VideoEncoder\""); + AddProp(ss, "__version", "\"0.2\""); + AddProp(ss, "__method", "\"Initialize\""); + AddProp(ss, "video_encoder", ToString_PP_Resource(video_encoder)); + AddProp(ss, "input_format", ToString_PP_VideoFrame_Format(input_format)); + AddProp(ss, "input_visible_size", ToString_PP_Size(input_visible_size)); + AddProp(ss, "output_profile", ToString_PP_VideoProfile(output_profile)); + AddProp(ss, "initial_bitrate", ToString_uint32_t(initial_bitrate)); + AddProp(ss, "acceleration", ToString_PP_HardwareAcceleration(acceleration)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_VideoEncoder_0_2*)RealGetInterface("PPB_VideoEncoder;0.2"))->Initialize(video_encoder, input_format, input_visible_size, output_profile, initial_bitrate, acceleration, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t GetFramesRequired_0_2(PP_Resource video_encoder) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_VideoEncoder\""); + AddProp(ss, "__version", "\"0.2\""); + AddProp(ss, "__method", "\"GetFramesRequired\""); + AddProp(ss, "video_encoder", ToString_PP_Resource(video_encoder)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_VideoEncoder_0_2*)RealGetInterface("PPB_VideoEncoder;0.2"))->GetFramesRequired(video_encoder); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t GetFrameCodedSize_0_2(PP_Resource video_encoder, struct PP_Size* coded_size) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_VideoEncoder\""); + AddProp(ss, "__version", "\"0.2\""); + AddProp(ss, "__method", "\"GetFrameCodedSize\""); + AddProp(ss, "video_encoder", ToString_PP_Resource(video_encoder)); + AddProp(ss, "coded_size", PointerToString(coded_size)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + if (!!coded_size) { + iterator.skip(); + FromJSON_PP_Size(iterator, *coded_size); + } + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_VideoEncoder_0_2*)RealGetInterface("PPB_VideoEncoder;0.2"))->GetFrameCodedSize(video_encoder, coded_size); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_int32_t(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + if (!!coded_size) { + AddProp(os, "coded_size", ToString_PP_Size(coded_size)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t GetVideoFrame_0_2(PP_Resource video_encoder, PP_Resource* video_frame, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_VideoEncoder\""); + AddProp(ss, "__version", "\"0.2\""); + AddProp(ss, "__method", "\"GetVideoFrame\""); + AddProp(ss, "video_encoder", ToString_PP_Resource(video_encoder)); + AddProp(ss, "video_frame", PointerToString(video_frame)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + iterator.skip(); + FromJSON_PP_Resource(iterator, *video_frame); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_VideoEncoder_0_2*)RealGetInterface("PPB_VideoEncoder;0.2"))->GetVideoFrame(video_encoder, video_frame, logging_callback); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_int32_t(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + if (!!video_frame) { + AddProp(os, "video_frame", ToString_PP_Resource(video_frame)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t Encode_0_2(PP_Resource video_encoder, PP_Resource video_frame, PP_Bool force_keyframe, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_VideoEncoder\""); + AddProp(ss, "__version", "\"0.2\""); + AddProp(ss, "__method", "\"Encode\""); + AddProp(ss, "video_encoder", ToString_PP_Resource(video_encoder)); + AddProp(ss, "video_frame", ToString_PP_Resource(video_frame)); + AddProp(ss, "force_keyframe", ToString_PP_Bool(force_keyframe)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_VideoEncoder_0_2*)RealGetInterface("PPB_VideoEncoder;0.2"))->Encode(video_encoder, video_frame, force_keyframe, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t GetBitstreamBuffer_0_2(PP_Resource video_encoder, struct PP_BitstreamBuffer* bitstream_buffer, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_VideoEncoder\""); + AddProp(ss, "__version", "\"0.2\""); + AddProp(ss, "__method", "\"GetBitstreamBuffer\""); + AddProp(ss, "video_encoder", ToString_PP_Resource(video_encoder)); + AddProp(ss, "bitstream_buffer", PointerToString(bitstream_buffer)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + if (!!bitstream_buffer) { + iterator.skip(); + FromJSON_PP_BitstreamBuffer(iterator, *bitstream_buffer); + } + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_VideoEncoder_0_2*)RealGetInterface("PPB_VideoEncoder;0.2"))->GetBitstreamBuffer(video_encoder, bitstream_buffer, logging_callback); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_int32_t(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + if (!!bitstream_buffer) { + AddProp(os, "bitstream_buffer", ToString_PP_BitstreamBuffer(bitstream_buffer)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static void RecycleBitstreamBuffer_0_2(PP_Resource video_encoder, const struct PP_BitstreamBuffer* bitstream_buffer) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_VideoEncoder\""); + AddProp(ss, "__version", "\"0.2\""); + AddProp(ss, "__method", "\"RecycleBitstreamBuffer\""); + AddProp(ss, "video_encoder", ToString_PP_Resource(video_encoder)); + AddProp(ss, "bitstream_buffer", ToString_PP_BitstreamBuffer(bitstream_buffer)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_VideoEncoder_0_2*)RealGetInterface("PPB_VideoEncoder;0.2"))->RecycleBitstreamBuffer(video_encoder, bitstream_buffer); +#endif // !INTERPOSE +} +static void RequestEncodingParametersChange_0_2(PP_Resource video_encoder, uint32_t bitrate, uint32_t framerate) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_VideoEncoder\""); + AddProp(ss, "__version", "\"0.2\""); + AddProp(ss, "__method", "\"RequestEncodingParametersChange\""); + AddProp(ss, "video_encoder", ToString_PP_Resource(video_encoder)); + AddProp(ss, "bitrate", ToString_uint32_t(bitrate)); + AddProp(ss, "framerate", ToString_uint32_t(framerate)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_VideoEncoder_0_2*)RealGetInterface("PPB_VideoEncoder;0.2"))->RequestEncodingParametersChange(video_encoder, bitrate, framerate); +#endif // !INTERPOSE +} +static void Close_0_2(PP_Resource video_encoder) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_VideoEncoder\""); + AddProp(ss, "__version", "\"0.2\""); + AddProp(ss, "__method", "\"Close\""); + AddProp(ss, "video_encoder", ToString_PP_Resource(video_encoder)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_VideoEncoder_0_2*)RealGetInterface("PPB_VideoEncoder;0.2"))->Close(video_encoder); +#endif // !INTERPOSE +} +} +static PPB_VideoEncoder_0_2 _PPB_VideoEncoder_0_2 = { + ns_PPB_VideoEncoder_0_2::Create_0_2, + ns_PPB_VideoEncoder_0_2::IsVideoEncoder_0_2, + ns_PPB_VideoEncoder_0_2::GetSupportedProfiles_0_2, + ns_PPB_VideoEncoder_0_2::Initialize_0_2, + ns_PPB_VideoEncoder_0_2::GetFramesRequired_0_2, + ns_PPB_VideoEncoder_0_2::GetFrameCodedSize_0_2, + ns_PPB_VideoEncoder_0_2::GetVideoFrame_0_2, + ns_PPB_VideoEncoder_0_2::Encode_0_2, + ns_PPB_VideoEncoder_0_2::GetBitstreamBuffer_0_2, + ns_PPB_VideoEncoder_0_2::RecycleBitstreamBuffer_0_2, + ns_PPB_VideoEncoder_0_2::RequestEncodingParametersChange_0_2, + ns_PPB_VideoEncoder_0_2::Close_0_2, +}; +const string ToString_PPB_VideoEncoder(const PPB_VideoEncoder_0_2 *v) { + stringstream s; + s << v; + return s.str(); +} +const string ToString_PP_VideoFrame_Format(const PP_VideoFrame_Format *v) { + switch (*v) { + case 0: + return "\"PP_VIDEOFRAME_FORMAT_UNKNOWN\""; + case 1: + return "\"PP_VIDEOFRAME_FORMAT_YV12\""; + case 2: + return "\"PP_VIDEOFRAME_FORMAT_I420\""; + case 3: + return "\"PP_VIDEOFRAME_FORMAT_BGRA\""; + default: + return "\"???\""; + } +} +const string ToString_PP_VideoFrame_Format(const PP_VideoFrame_Format &v) { + return ToString_PP_VideoFrame_Format(&v); +} +void FromJSON_PP_VideoFrame_Format(JSONIterator& iterator, PP_VideoFrame_Format &value) { + long int v; + FromJSON_int(iterator, v); + value = PP_VideoFrame_Format(v); +} +namespace ns_PPB_VideoFrame_0_1 { +static PP_Bool IsVideoFrame_0_1(PP_Resource resource) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_VideoFrame\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"IsVideoFrame\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_VideoFrame_0_1*)RealGetInterface("PPB_VideoFrame;0.1"))->IsVideoFrame(resource); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_TimeDelta GetTimestamp_0_1(PP_Resource frame) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_VideoFrame\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"GetTimestamp\""); + AddProp(ss, "frame", ToString_PP_Resource(frame)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + double rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_TimeDelta(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + double rval = ((PPB_VideoFrame_0_1*)RealGetInterface("PPB_VideoFrame;0.1"))->GetTimestamp(frame); + printf("RPC response: ["); + printf("%s", ToString_PP_TimeDelta(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static void SetTimestamp_0_1(PP_Resource frame, PP_TimeDelta timestamp) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_VideoFrame\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"SetTimestamp\""); + AddProp(ss, "frame", ToString_PP_Resource(frame)); + AddProp(ss, "timestamp", ToString_PP_TimeDelta(timestamp)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_VideoFrame_0_1*)RealGetInterface("PPB_VideoFrame;0.1"))->SetTimestamp(frame, timestamp); +#endif // !INTERPOSE +} +static PP_VideoFrame_Format GetFormat_0_1(PP_Resource frame) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_VideoFrame\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"GetFormat\""); + AddProp(ss, "frame", ToString_PP_Resource(frame)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_VideoFrame_Format rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_VideoFrame_Format(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_VideoFrame_Format rval = ((PPB_VideoFrame_0_1*)RealGetInterface("PPB_VideoFrame;0.1"))->GetFormat(frame); + printf("RPC response: ["); + printf("%s", ToString_PP_VideoFrame_Format(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool GetSize_0_1(PP_Resource frame, struct PP_Size* size) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_VideoFrame\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"GetSize\""); + AddProp(ss, "frame", ToString_PP_Resource(frame)); + AddProp(ss, "size", PointerToString(size)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + if (!!size) { + iterator.skip(); + FromJSON_PP_Size(iterator, *size); + } + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_VideoFrame_0_1*)RealGetInterface("PPB_VideoFrame;0.1"))->GetSize(frame, size); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + if (!!size) { + AddProp(os, "size", ToString_PP_Size(size)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static void* GetDataBuffer_0_1(PP_Resource frame) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_VideoFrame\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"GetDataBuffer\""); + AddProp(ss, "frame", ToString_PP_Resource(frame)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + void* rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_mem_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + void* rval = ((PPB_VideoFrame_0_1*)RealGetInterface("PPB_VideoFrame;0.1"))->GetDataBuffer(frame); + printf("RPC response: ["); + printf("%s", ToString_mem_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static uint32_t GetDataBufferSize_0_1(PP_Resource frame) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_VideoFrame\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"GetDataBufferSize\""); + AddProp(ss, "frame", ToString_PP_Resource(frame)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + uint32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_uint32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + uint32_t rval = ((PPB_VideoFrame_0_1*)RealGetInterface("PPB_VideoFrame;0.1"))->GetDataBufferSize(frame); + printf("RPC response: ["); + printf("%s", ToString_uint32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +} +static PPB_VideoFrame_0_1 _PPB_VideoFrame_0_1 = { + ns_PPB_VideoFrame_0_1::IsVideoFrame_0_1, + ns_PPB_VideoFrame_0_1::GetTimestamp_0_1, + ns_PPB_VideoFrame_0_1::SetTimestamp_0_1, + ns_PPB_VideoFrame_0_1::GetFormat_0_1, + ns_PPB_VideoFrame_0_1::GetSize_0_1, + ns_PPB_VideoFrame_0_1::GetDataBuffer_0_1, + ns_PPB_VideoFrame_0_1::GetDataBufferSize_0_1, +}; +const string ToString_PPB_VideoFrame(const PPB_VideoFrame_0_1 *v) { + stringstream s; + s << v; + return s.str(); +} +namespace ns_PPB_View_1_0 { +static PP_Bool IsView_1_0(PP_Resource resource) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_View\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"IsView\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_View_1_0*)RealGetInterface("PPB_View;1.0"))->IsView(resource); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool GetRect_1_0(PP_Resource resource, struct PP_Rect* rect) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_View\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"GetRect\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + AddProp(ss, "rect", PointerToString(rect)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + if (!!rect) { + iterator.skip(); + FromJSON_PP_Rect(iterator, *rect); + } + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_View_1_0*)RealGetInterface("PPB_View;1.0"))->GetRect(resource, rect); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + if (!!rect) { + AddProp(os, "rect", ToString_PP_Rect(rect)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool IsFullscreen_1_0(PP_Resource resource) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_View\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"IsFullscreen\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_View_1_0*)RealGetInterface("PPB_View;1.0"))->IsFullscreen(resource); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool IsVisible_1_0(PP_Resource resource) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_View\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"IsVisible\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_View_1_0*)RealGetInterface("PPB_View;1.0"))->IsVisible(resource); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool IsPageVisible_1_0(PP_Resource resource) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_View\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"IsPageVisible\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_View_1_0*)RealGetInterface("PPB_View;1.0"))->IsPageVisible(resource); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool GetClipRect_1_0(PP_Resource resource, struct PP_Rect* clip) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_View\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"GetClipRect\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + AddProp(ss, "clip", PointerToString(clip)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + if (!!clip) { + iterator.skip(); + FromJSON_PP_Rect(iterator, *clip); + } + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_View_1_0*)RealGetInterface("PPB_View;1.0"))->GetClipRect(resource, clip); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + if (!!clip) { + AddProp(os, "clip", ToString_PP_Rect(clip)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +/* skipping GetDeviceScale */ +/* skipping GetCSSScale */ +/* skipping GetScrollOffset */ +} +static PPB_View_1_0 _PPB_View_1_0 = { + ns_PPB_View_1_0::IsView_1_0, + ns_PPB_View_1_0::GetRect_1_0, + ns_PPB_View_1_0::IsFullscreen_1_0, + ns_PPB_View_1_0::IsVisible_1_0, + ns_PPB_View_1_0::IsPageVisible_1_0, + ns_PPB_View_1_0::GetClipRect_1_0, +}; +const string ToString_PPB_View(const PPB_View_1_0 *v) { + stringstream s; + s << v; + return s.str(); +} +namespace ns_PPB_View_1_1 { +static PP_Bool IsView_1_1(PP_Resource resource) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_View\""); + AddProp(ss, "__version", "\"1.1\""); + AddProp(ss, "__method", "\"IsView\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_View_1_1*)RealGetInterface("PPB_View;1.1"))->IsView(resource); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool GetRect_1_1(PP_Resource resource, struct PP_Rect* rect) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_View\""); + AddProp(ss, "__version", "\"1.1\""); + AddProp(ss, "__method", "\"GetRect\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + AddProp(ss, "rect", PointerToString(rect)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + if (!!rect) { + iterator.skip(); + FromJSON_PP_Rect(iterator, *rect); + } + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_View_1_1*)RealGetInterface("PPB_View;1.1"))->GetRect(resource, rect); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + if (!!rect) { + AddProp(os, "rect", ToString_PP_Rect(rect)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool IsFullscreen_1_1(PP_Resource resource) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_View\""); + AddProp(ss, "__version", "\"1.1\""); + AddProp(ss, "__method", "\"IsFullscreen\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_View_1_1*)RealGetInterface("PPB_View;1.1"))->IsFullscreen(resource); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool IsVisible_1_1(PP_Resource resource) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_View\""); + AddProp(ss, "__version", "\"1.1\""); + AddProp(ss, "__method", "\"IsVisible\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_View_1_1*)RealGetInterface("PPB_View;1.1"))->IsVisible(resource); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool IsPageVisible_1_1(PP_Resource resource) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_View\""); + AddProp(ss, "__version", "\"1.1\""); + AddProp(ss, "__method", "\"IsPageVisible\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_View_1_1*)RealGetInterface("PPB_View;1.1"))->IsPageVisible(resource); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool GetClipRect_1_1(PP_Resource resource, struct PP_Rect* clip) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_View\""); + AddProp(ss, "__version", "\"1.1\""); + AddProp(ss, "__method", "\"GetClipRect\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + AddProp(ss, "clip", PointerToString(clip)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + if (!!clip) { + iterator.skip(); + FromJSON_PP_Rect(iterator, *clip); + } + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_View_1_1*)RealGetInterface("PPB_View;1.1"))->GetClipRect(resource, clip); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + if (!!clip) { + AddProp(os, "clip", ToString_PP_Rect(clip)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static float GetDeviceScale_1_1(PP_Resource resource) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_View\""); + AddProp(ss, "__version", "\"1.1\""); + AddProp(ss, "__method", "\"GetDeviceScale\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + float rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_float_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + float rval = ((PPB_View_1_1*)RealGetInterface("PPB_View;1.1"))->GetDeviceScale(resource); + printf("RPC response: ["); + printf("%s", ToString_float_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static float GetCSSScale_1_1(PP_Resource resource) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_View\""); + AddProp(ss, "__version", "\"1.1\""); + AddProp(ss, "__method", "\"GetCSSScale\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + float rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_float_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + float rval = ((PPB_View_1_1*)RealGetInterface("PPB_View;1.1"))->GetCSSScale(resource); + printf("RPC response: ["); + printf("%s", ToString_float_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +/* skipping GetScrollOffset */ +} +static PPB_View_1_1 _PPB_View_1_1 = { + ns_PPB_View_1_1::IsView_1_1, + ns_PPB_View_1_1::GetRect_1_1, + ns_PPB_View_1_1::IsFullscreen_1_1, + ns_PPB_View_1_1::IsVisible_1_1, + ns_PPB_View_1_1::IsPageVisible_1_1, + ns_PPB_View_1_1::GetClipRect_1_1, + ns_PPB_View_1_1::GetDeviceScale_1_1, + ns_PPB_View_1_1::GetCSSScale_1_1, +}; +const string ToString_PPB_View(const PPB_View_1_1 *v) { + stringstream s; + s << v; + return s.str(); +} +namespace ns_PPB_View_1_2 { +static PP_Bool IsView_1_2(PP_Resource resource) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_View\""); + AddProp(ss, "__version", "\"1.2\""); + AddProp(ss, "__method", "\"IsView\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_View_1_2*)RealGetInterface("PPB_View;1.2"))->IsView(resource); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool GetRect_1_2(PP_Resource resource, struct PP_Rect* rect) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_View\""); + AddProp(ss, "__version", "\"1.2\""); + AddProp(ss, "__method", "\"GetRect\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + AddProp(ss, "rect", PointerToString(rect)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + if (!!rect) { + iterator.skip(); + FromJSON_PP_Rect(iterator, *rect); + } + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_View_1_2*)RealGetInterface("PPB_View;1.2"))->GetRect(resource, rect); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + if (!!rect) { + AddProp(os, "rect", ToString_PP_Rect(rect)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool IsFullscreen_1_2(PP_Resource resource) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_View\""); + AddProp(ss, "__version", "\"1.2\""); + AddProp(ss, "__method", "\"IsFullscreen\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_View_1_2*)RealGetInterface("PPB_View;1.2"))->IsFullscreen(resource); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool IsVisible_1_2(PP_Resource resource) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_View\""); + AddProp(ss, "__version", "\"1.2\""); + AddProp(ss, "__method", "\"IsVisible\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_View_1_2*)RealGetInterface("PPB_View;1.2"))->IsVisible(resource); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool IsPageVisible_1_2(PP_Resource resource) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_View\""); + AddProp(ss, "__version", "\"1.2\""); + AddProp(ss, "__method", "\"IsPageVisible\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_View_1_2*)RealGetInterface("PPB_View;1.2"))->IsPageVisible(resource); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool GetClipRect_1_2(PP_Resource resource, struct PP_Rect* clip) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_View\""); + AddProp(ss, "__version", "\"1.2\""); + AddProp(ss, "__method", "\"GetClipRect\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + AddProp(ss, "clip", PointerToString(clip)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + if (!!clip) { + iterator.skip(); + FromJSON_PP_Rect(iterator, *clip); + } + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_View_1_2*)RealGetInterface("PPB_View;1.2"))->GetClipRect(resource, clip); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + if (!!clip) { + AddProp(os, "clip", ToString_PP_Rect(clip)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static float GetDeviceScale_1_2(PP_Resource resource) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_View\""); + AddProp(ss, "__version", "\"1.2\""); + AddProp(ss, "__method", "\"GetDeviceScale\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + float rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_float_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + float rval = ((PPB_View_1_2*)RealGetInterface("PPB_View;1.2"))->GetDeviceScale(resource); + printf("RPC response: ["); + printf("%s", ToString_float_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static float GetCSSScale_1_2(PP_Resource resource) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_View\""); + AddProp(ss, "__version", "\"1.2\""); + AddProp(ss, "__method", "\"GetCSSScale\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + float rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_float_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + float rval = ((PPB_View_1_2*)RealGetInterface("PPB_View;1.2"))->GetCSSScale(resource); + printf("RPC response: ["); + printf("%s", ToString_float_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool GetScrollOffset_1_2(PP_Resource resource, struct PP_Point* offset) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_View\""); + AddProp(ss, "__version", "\"1.2\""); + AddProp(ss, "__method", "\"GetScrollOffset\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + AddProp(ss, "offset", PointerToString(offset)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + if (!!offset) { + iterator.skip(); + FromJSON_PP_Point(iterator, *offset); + } + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_View_1_2*)RealGetInterface("PPB_View;1.2"))->GetScrollOffset(resource, offset); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + if (!!offset) { + AddProp(os, "offset", ToString_PP_Point(offset)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +} +static PPB_View_1_2 _PPB_View_1_2 = { + ns_PPB_View_1_2::IsView_1_2, + ns_PPB_View_1_2::GetRect_1_2, + ns_PPB_View_1_2::IsFullscreen_1_2, + ns_PPB_View_1_2::IsVisible_1_2, + ns_PPB_View_1_2::IsPageVisible_1_2, + ns_PPB_View_1_2::GetClipRect_1_2, + ns_PPB_View_1_2::GetDeviceScale_1_2, + ns_PPB_View_1_2::GetCSSScale_1_2, + ns_PPB_View_1_2::GetScrollOffset_1_2, +}; +const string ToString_PPB_View(const PPB_View_1_2 *v) { + stringstream s; + s << v; + return s.str(); +} +namespace ns_PPB_VpnProvider_0_1 { +static PP_Resource Create_0_1(PP_Instance instance) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_VpnProvider\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"Create\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Resource(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_VpnProvider_0_1*)RealGetInterface("PPB_VpnProvider;0.1"))->Create(instance); + printf("RPC response: ["); + printf("%s", ToString_PP_Resource(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool IsVpnProvider_0_1(PP_Resource resource) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_VpnProvider\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"IsVpnProvider\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_VpnProvider_0_1*)RealGetInterface("PPB_VpnProvider;0.1"))->IsVpnProvider(resource); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t Bind_0_1(PP_Resource vpn_provider, struct PP_Var configuration_id, struct PP_Var configuration_name, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_VpnProvider\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"Bind\""); + AddProp(ss, "vpn_provider", ToString_PP_Resource(vpn_provider)); + AddProp(ss, "configuration_id", ToString_PP_Var(configuration_id)); + AddProp(ss, "configuration_name", ToString_PP_Var(configuration_name)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_VpnProvider_0_1*)RealGetInterface("PPB_VpnProvider;0.1"))->Bind(vpn_provider, configuration_id, configuration_name, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t SendPacket_0_1(PP_Resource vpn_provider, struct PP_Var packet, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_VpnProvider\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"SendPacket\""); + AddProp(ss, "vpn_provider", ToString_PP_Resource(vpn_provider)); + AddProp(ss, "packet", ToString_PP_Var(packet)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_VpnProvider_0_1*)RealGetInterface("PPB_VpnProvider;0.1"))->SendPacket(vpn_provider, packet, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t ReceivePacket_0_1(PP_Resource vpn_provider, struct PP_Var* packet, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_VpnProvider\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"ReceivePacket\""); + AddProp(ss, "vpn_provider", ToString_PP_Resource(vpn_provider)); + AddProp(ss, "packet", PointerToString(packet)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + iterator.skip(); + FromJSON_PP_Var(iterator, *packet); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_VpnProvider_0_1*)RealGetInterface("PPB_VpnProvider;0.1"))->ReceivePacket(vpn_provider, packet, logging_callback); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_int32_t(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + if (!!packet) { + AddProp(os, "packet", ToString_PP_Var(packet)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +} +static PPB_VpnProvider_0_1 _PPB_VpnProvider_0_1 = { + ns_PPB_VpnProvider_0_1::Create_0_1, + ns_PPB_VpnProvider_0_1::IsVpnProvider_0_1, + ns_PPB_VpnProvider_0_1::Bind_0_1, + ns_PPB_VpnProvider_0_1::SendPacket_0_1, + ns_PPB_VpnProvider_0_1::ReceivePacket_0_1, +}; +const string ToString_PPB_VpnProvider(const PPB_VpnProvider_0_1 *v) { + stringstream s; + s << v; + return s.str(); +} +const string ToString_PP_WebSocketReadyState(const PP_WebSocketReadyState *v) { + switch (*v) { + case -1: + return "\"PP_WEBSOCKETREADYSTATE_INVALID\""; + case 0: + return "\"PP_WEBSOCKETREADYSTATE_CONNECTING\""; + case 1: + return "\"PP_WEBSOCKETREADYSTATE_OPEN\""; + case 2: + return "\"PP_WEBSOCKETREADYSTATE_CLOSING\""; + case 3: + return "\"PP_WEBSOCKETREADYSTATE_CLOSED\""; + default: + return "\"???\""; + } +} +const string ToString_PP_WebSocketReadyState(const PP_WebSocketReadyState &v) { + return ToString_PP_WebSocketReadyState(&v); +} +void FromJSON_PP_WebSocketReadyState(JSONIterator& iterator, PP_WebSocketReadyState &value) { + long int v; + FromJSON_int(iterator, v); + value = PP_WebSocketReadyState(v); +} +const string ToString_PP_WebSocketCloseCode(const PP_WebSocketCloseCode *v) { + switch (*v) { + case 1005: + return "\"PP_WEBSOCKETSTATUSCODE_NOT_SPECIFIED\""; + case 1000: + return "\"PP_WEBSOCKETSTATUSCODE_NORMAL_CLOSURE\""; + case 1001: + return "\"PP_WEBSOCKETSTATUSCODE_GOING_AWAY\""; + case 1002: + return "\"PP_WEBSOCKETSTATUSCODE_PROTOCOL_ERROR\""; + case 1003: + return "\"PP_WEBSOCKETSTATUSCODE_UNSUPPORTED_DATA\""; + case 1006: + return "\"PP_WEBSOCKETSTATUSCODE_ABNORMAL_CLOSURE\""; + case 1007: + return "\"PP_WEBSOCKETSTATUSCODE_INVALID_FRAME_PAYLOAD_DATA\""; + case 1008: + return "\"PP_WEBSOCKETSTATUSCODE_POLICY_VIOLATION\""; + case 1009: + return "\"PP_WEBSOCKETSTATUSCODE_MESSAGE_TOO_BIG\""; + case 1010: + return "\"PP_WEBSOCKETSTATUSCODE_MANDATORY_EXTENSION\""; + case 1011: + return "\"PP_WEBSOCKETSTATUSCODE_INTERNAL_SERVER_ERROR\""; + case 1015: + return "\"PP_WEBSOCKETSTATUSCODE_TLS_HANDSHAKE\""; + case 3000: + return "\"PP_WEBSOCKETSTATUSCODE_USER_REGISTERED_MIN\""; + case 3999: + return "\"PP_WEBSOCKETSTATUSCODE_USER_REGISTERED_MAX\""; + case 4000: + return "\"PP_WEBSOCKETSTATUSCODE_USER_PRIVATE_MIN\""; + case 4999: + return "\"PP_WEBSOCKETSTATUSCODE_USER_PRIVATE_MAX\""; + default: + return "\"???\""; + } +} +const string ToString_PP_WebSocketCloseCode(const PP_WebSocketCloseCode &v) { + return ToString_PP_WebSocketCloseCode(&v); +} +void FromJSON_PP_WebSocketCloseCode(JSONIterator& iterator, PP_WebSocketCloseCode &value) { + long int v; + FromJSON_int(iterator, v); + value = PP_WebSocketCloseCode(v); +} +namespace ns_PPB_WebSocket_1_0 { +static PP_Resource Create_1_0(PP_Instance instance) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_WebSocket\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"Create\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Resource(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_WebSocket_1_0*)RealGetInterface("PPB_WebSocket;1.0"))->Create(instance); + printf("RPC response: ["); + printf("%s", ToString_PP_Resource(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool IsWebSocket_1_0(PP_Resource resource) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_WebSocket\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"IsWebSocket\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_WebSocket_1_0*)RealGetInterface("PPB_WebSocket;1.0"))->IsWebSocket(resource); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t Connect_1_0(PP_Resource web_socket, struct PP_Var url, const struct PP_Var protocols[], uint32_t protocol_count, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_WebSocket\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"Connect\""); + AddProp(ss, "web_socket", ToString_PP_Resource(web_socket)); + AddProp(ss, "url", ToString_PP_Var(url)); + { + BeginProp(ss, "protocols"); + BeginElements(ss); + for (uint32_t _n = 0; _n < protocol_count; ++_n) { + AddElement(ss, ToString_PP_Var(protocols[_n])); + } + EndElements(ss); + } + AddProp(ss, "protocol_count", ToString_uint32_t(protocol_count)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_WebSocket_1_0*)RealGetInterface("PPB_WebSocket;1.0"))->Connect(web_socket, url, protocols, protocol_count, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t Close_1_0(PP_Resource web_socket, uint16_t code, struct PP_Var reason, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_WebSocket\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"Close\""); + AddProp(ss, "web_socket", ToString_PP_Resource(web_socket)); + AddProp(ss, "code", ToString_uint16_t(code)); + AddProp(ss, "reason", ToString_PP_Var(reason)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_WebSocket_1_0*)RealGetInterface("PPB_WebSocket;1.0"))->Close(web_socket, code, reason, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t ReceiveMessage_1_0(PP_Resource web_socket, struct PP_Var* message, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_WebSocket\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"ReceiveMessage\""); + AddProp(ss, "web_socket", ToString_PP_Resource(web_socket)); + AddProp(ss, "message", PointerToString(message)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + iterator.skip(); + FromJSON_PP_Var(iterator, *message); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_WebSocket_1_0*)RealGetInterface("PPB_WebSocket;1.0"))->ReceiveMessage(web_socket, message, logging_callback); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_int32_t(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + if (!!message) { + AddProp(os, "message", ToString_PP_Var(message)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t SendMessage_1_0(PP_Resource web_socket, struct PP_Var message) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_WebSocket\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"SendMessage\""); + AddProp(ss, "web_socket", ToString_PP_Resource(web_socket)); + AddProp(ss, "message", ToString_PP_Var(message)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_WebSocket_1_0*)RealGetInterface("PPB_WebSocket;1.0"))->SendMessage(web_socket, message); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static uint64_t GetBufferedAmount_1_0(PP_Resource web_socket) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_WebSocket\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"GetBufferedAmount\""); + AddProp(ss, "web_socket", ToString_PP_Resource(web_socket)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + uint64_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_uint64_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + uint64_t rval = ((PPB_WebSocket_1_0*)RealGetInterface("PPB_WebSocket;1.0"))->GetBufferedAmount(web_socket); + printf("RPC response: ["); + printf("%s", ToString_uint64_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static uint16_t GetCloseCode_1_0(PP_Resource web_socket) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_WebSocket\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"GetCloseCode\""); + AddProp(ss, "web_socket", ToString_PP_Resource(web_socket)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + uint16_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_uint16_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + uint16_t rval = ((PPB_WebSocket_1_0*)RealGetInterface("PPB_WebSocket;1.0"))->GetCloseCode(web_socket); + printf("RPC response: ["); + printf("%s", ToString_uint16_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static struct PP_Var GetCloseReason_1_0(PP_Resource web_socket) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_WebSocket\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"GetCloseReason\""); + AddProp(ss, "web_socket", ToString_PP_Resource(web_socket)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + struct PP_Var rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Var(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + struct PP_Var rval = ((PPB_WebSocket_1_0*)RealGetInterface("PPB_WebSocket;1.0"))->GetCloseReason(web_socket); + printf("RPC response: ["); + printf("%s", ToString_PP_Var(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool GetCloseWasClean_1_0(PP_Resource web_socket) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_WebSocket\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"GetCloseWasClean\""); + AddProp(ss, "web_socket", ToString_PP_Resource(web_socket)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_WebSocket_1_0*)RealGetInterface("PPB_WebSocket;1.0"))->GetCloseWasClean(web_socket); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static struct PP_Var GetExtensions_1_0(PP_Resource web_socket) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_WebSocket\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"GetExtensions\""); + AddProp(ss, "web_socket", ToString_PP_Resource(web_socket)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + struct PP_Var rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Var(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + struct PP_Var rval = ((PPB_WebSocket_1_0*)RealGetInterface("PPB_WebSocket;1.0"))->GetExtensions(web_socket); + printf("RPC response: ["); + printf("%s", ToString_PP_Var(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static struct PP_Var GetProtocol_1_0(PP_Resource web_socket) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_WebSocket\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"GetProtocol\""); + AddProp(ss, "web_socket", ToString_PP_Resource(web_socket)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + struct PP_Var rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Var(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + struct PP_Var rval = ((PPB_WebSocket_1_0*)RealGetInterface("PPB_WebSocket;1.0"))->GetProtocol(web_socket); + printf("RPC response: ["); + printf("%s", ToString_PP_Var(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_WebSocketReadyState GetReadyState_1_0(PP_Resource web_socket) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_WebSocket\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"GetReadyState\""); + AddProp(ss, "web_socket", ToString_PP_Resource(web_socket)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_WebSocketReadyState rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_WebSocketReadyState(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_WebSocketReadyState rval = ((PPB_WebSocket_1_0*)RealGetInterface("PPB_WebSocket;1.0"))->GetReadyState(web_socket); + printf("RPC response: ["); + printf("%s", ToString_PP_WebSocketReadyState(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static struct PP_Var GetURL_1_0(PP_Resource web_socket) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_WebSocket\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"GetURL\""); + AddProp(ss, "web_socket", ToString_PP_Resource(web_socket)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + struct PP_Var rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Var(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + struct PP_Var rval = ((PPB_WebSocket_1_0*)RealGetInterface("PPB_WebSocket;1.0"))->GetURL(web_socket); + printf("RPC response: ["); + printf("%s", ToString_PP_Var(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +} +static PPB_WebSocket_1_0 _PPB_WebSocket_1_0 = { + ns_PPB_WebSocket_1_0::Create_1_0, + ns_PPB_WebSocket_1_0::IsWebSocket_1_0, + ns_PPB_WebSocket_1_0::Connect_1_0, + ns_PPB_WebSocket_1_0::Close_1_0, + ns_PPB_WebSocket_1_0::ReceiveMessage_1_0, + ns_PPB_WebSocket_1_0::SendMessage_1_0, + ns_PPB_WebSocket_1_0::GetBufferedAmount_1_0, + ns_PPB_WebSocket_1_0::GetCloseCode_1_0, + ns_PPB_WebSocket_1_0::GetCloseReason_1_0, + ns_PPB_WebSocket_1_0::GetCloseWasClean_1_0, + ns_PPB_WebSocket_1_0::GetExtensions_1_0, + ns_PPB_WebSocket_1_0::GetProtocol_1_0, + ns_PPB_WebSocket_1_0::GetReadyState_1_0, + ns_PPB_WebSocket_1_0::GetURL_1_0, +}; +const string ToString_PPB_WebSocket(const PPB_WebSocket_1_0 *v) { + stringstream s; + s << v; + return s.str(); +} +const string ToString_PP_InitializeModule_Func(const PP_InitializeModule_Func &v) { + return PointerToString(v); +} +void FromJSON_PP_InitializeModule_Func(JSONIterator& iterator, PP_InitializeModule_Func &value) { + PointerValueFromJSON(iterator, value); +} +const string ToString_PP_ShutdownModule_Func(const PP_ShutdownModule_Func &v) { + return PointerToString(v); +} +void FromJSON_PP_ShutdownModule_Func(JSONIterator& iterator, PP_ShutdownModule_Func &value) { + PointerValueFromJSON(iterator, value); +} +const string ToString_PP_GetInterface_Func(const PP_GetInterface_Func &v) { + return PointerToString(v); +} +void FromJSON_PP_GetInterface_Func(JSONIterator& iterator, PP_GetInterface_Func &value) { + PointerValueFromJSON(iterator, value); +} +char* Call_PPP_Graphics3D_Graphics3DContextLost(const PPP_Graphics3D* _interface, JSONIterator& iterator) { + PP_Instance instance; + iterator.skip(); + FromJSON_PP_Instance(iterator, instance); + _interface->Graphics3DContextLost((PP_Instance )instance); + return nullptr; +} +char* Call_PPP_Graphics3D(const void* _interface, JSONIterator& iterator) { + iterator.skip(); + const Token& member = iterator.getCurrentStringAndGotoNext(); + string memberName = member.value(); + if (!memberName.compare("Graphics3DContextLost")) { + return Call_PPP_Graphics3D_Graphics3DContextLost((const PPP_Graphics3D*)_interface, iterator); + } + return nullptr; +} +char* Call_PPP_InputEvent_HandleInputEvent(const PPP_InputEvent* _interface, JSONIterator& iterator) { + PP_Instance instance; + iterator.skip(); + FromJSON_PP_Instance(iterator, instance); + PP_Resource input_event; + iterator.skip(); + FromJSON_PP_Resource(iterator, input_event); + PP_Bool rval; + rval = _interface->HandleInputEvent((PP_Instance )instance, (PP_Resource )input_event); + return strdup(ToString_PP_Bool(rval).c_str()); +} +char* Call_PPP_InputEvent(const void* _interface, JSONIterator& iterator) { + iterator.skip(); + const Token& member = iterator.getCurrentStringAndGotoNext(); + string memberName = member.value(); + if (!memberName.compare("HandleInputEvent")) { + return Call_PPP_InputEvent_HandleInputEvent((const PPP_InputEvent*)_interface, iterator); + } + return nullptr; +} +char* Call_PPP_Instance_DidCreate(const PPP_Instance_1_0* _interface, JSONIterator& iterator) { + PP_Instance instance; + iterator.skip(); + FromJSON_PP_Instance(iterator, instance); + uint32_t argc; + iterator.skip(); + FromJSON_uint32_t(iterator, argc); + char* *argn; + iterator.skip(); + + { + size_t children = iterator.expectArrayAndGotoFirstItem(); + if (children > argc) { + Fail("Too many items in array\n", ""); + } + argn = new char*[argc]; + for (uint32_t _n = 0; _n < children; ++_n) { + FromJSON_str_t(iterator, (argn)[_n]); + } + // FIXME Null out remaining items? + } + char* *argv; + iterator.skip(); + + { + size_t children = iterator.expectArrayAndGotoFirstItem(); + if (children > argc) { + Fail("Too many items in array\n", ""); + } + argv = new char*[argc]; + for (uint32_t _n = 0; _n < children; ++_n) { + FromJSON_str_t(iterator, (argv)[_n]); + } + // FIXME Null out remaining items? + } + PP_Bool rval; + rval = _interface->DidCreate((PP_Instance )instance, (uint32_t )argc, (const char* *)argn, (const char* *)argv); + return strdup(ToString_PP_Bool(rval).c_str()); +} +char* Call_PPP_Instance_DidDestroy(const PPP_Instance_1_0* _interface, JSONIterator& iterator) { + PP_Instance instance; + iterator.skip(); + FromJSON_PP_Instance(iterator, instance); + _interface->DidDestroy((PP_Instance )instance); + return nullptr; +} +char* Call_PPP_Instance_DidChangeView(const PPP_Instance_1_0* _interface, JSONIterator& iterator) { + PP_Instance instance; + iterator.skip(); + FromJSON_PP_Instance(iterator, instance); + struct PP_Rect position; + iterator.skip(); + FromJSON_PP_Rect(iterator, position); + struct PP_Rect clip; + iterator.skip(); + FromJSON_PP_Rect(iterator, clip); + _interface->DidChangeView((PP_Instance )instance, (const struct PP_Rect* )&position, (const struct PP_Rect* )&clip); + return nullptr; +} +/* skipping DidChangeView */ +char* Call_PPP_Instance_DidChangeFocus(const PPP_Instance_1_0* _interface, JSONIterator& iterator) { + PP_Instance instance; + iterator.skip(); + FromJSON_PP_Instance(iterator, instance); + PP_Bool has_focus; + iterator.skip(); + FromJSON_PP_Bool(iterator, has_focus); + _interface->DidChangeFocus((PP_Instance )instance, (PP_Bool )has_focus); + return nullptr; +} +char* Call_PPP_Instance_HandleDocumentLoad(const PPP_Instance_1_0* _interface, JSONIterator& iterator) { + PP_Instance instance; + iterator.skip(); + FromJSON_PP_Instance(iterator, instance); + PP_Resource url_loader; + iterator.skip(); + FromJSON_PP_Resource(iterator, url_loader); + PP_Bool rval; + rval = _interface->HandleDocumentLoad((PP_Instance )instance, (PP_Resource )url_loader); + return strdup(ToString_PP_Bool(rval).c_str()); +} +char* Call_PPP_Instance_1_0(const void* _interface, JSONIterator& iterator) { + iterator.skip(); + const Token& member = iterator.getCurrentStringAndGotoNext(); + string memberName = member.value(); + if (!memberName.compare("DidCreate")) { + return Call_PPP_Instance_DidCreate((const PPP_Instance_1_0*)_interface, iterator); + } + if (!memberName.compare("DidDestroy")) { + return Call_PPP_Instance_DidDestroy((const PPP_Instance_1_0*)_interface, iterator); + } + if (!memberName.compare("DidChangeView")) { + return Call_PPP_Instance_DidChangeView((const PPP_Instance_1_0*)_interface, iterator); + } +/* skipping DidChangeView */ + if (!memberName.compare("DidChangeFocus")) { + return Call_PPP_Instance_DidChangeFocus((const PPP_Instance_1_0*)_interface, iterator); + } + if (!memberName.compare("HandleDocumentLoad")) { + return Call_PPP_Instance_HandleDocumentLoad((const PPP_Instance_1_0*)_interface, iterator); + } + return nullptr; +} +char* Call_PPP_Instance_DidCreate(const PPP_Instance* _interface, JSONIterator& iterator) { + PP_Instance instance; + iterator.skip(); + FromJSON_PP_Instance(iterator, instance); + uint32_t argc; + iterator.skip(); + FromJSON_uint32_t(iterator, argc); + char* *argn; + iterator.skip(); + + { + size_t children = iterator.expectArrayAndGotoFirstItem(); + if (children > argc) { + Fail("Too many items in array\n", ""); + } + argn = new char*[argc]; + for (uint32_t _n = 0; _n < children; ++_n) { + FromJSON_str_t(iterator, (argn)[_n]); + } + // FIXME Null out remaining items? + } + char* *argv; + iterator.skip(); + + { + size_t children = iterator.expectArrayAndGotoFirstItem(); + if (children > argc) { + Fail("Too many items in array\n", ""); + } + argv = new char*[argc]; + for (uint32_t _n = 0; _n < children; ++_n) { + FromJSON_str_t(iterator, (argv)[_n]); + } + // FIXME Null out remaining items? + } + PP_Bool rval; + rval = _interface->DidCreate((PP_Instance )instance, (uint32_t )argc, (const char* *)argn, (const char* *)argv); + return strdup(ToString_PP_Bool(rval).c_str()); +} +char* Call_PPP_Instance_DidDestroy(const PPP_Instance* _interface, JSONIterator& iterator) { + PP_Instance instance; + iterator.skip(); + FromJSON_PP_Instance(iterator, instance); + _interface->DidDestroy((PP_Instance )instance); + return nullptr; +} +/* skipping DidChangeView */ +char* Call_PPP_Instance_DidChangeView(const PPP_Instance* _interface, JSONIterator& iterator) { + PP_Instance instance; + iterator.skip(); + FromJSON_PP_Instance(iterator, instance); + PP_Resource view; + iterator.skip(); + FromJSON_PP_Resource(iterator, view); + _interface->DidChangeView((PP_Instance )instance, (PP_Resource )view); + return nullptr; +} +char* Call_PPP_Instance_DidChangeFocus(const PPP_Instance* _interface, JSONIterator& iterator) { + PP_Instance instance; + iterator.skip(); + FromJSON_PP_Instance(iterator, instance); + PP_Bool has_focus; + iterator.skip(); + FromJSON_PP_Bool(iterator, has_focus); + _interface->DidChangeFocus((PP_Instance )instance, (PP_Bool )has_focus); + return nullptr; +} +char* Call_PPP_Instance_HandleDocumentLoad(const PPP_Instance* _interface, JSONIterator& iterator) { + PP_Instance instance; + iterator.skip(); + FromJSON_PP_Instance(iterator, instance); + PP_Resource url_loader; + iterator.skip(); + FromJSON_PP_Resource(iterator, url_loader); + PP_Bool rval; + rval = _interface->HandleDocumentLoad((PP_Instance )instance, (PP_Resource )url_loader); + return strdup(ToString_PP_Bool(rval).c_str()); +} +char* Call_PPP_Instance(const void* _interface, JSONIterator& iterator) { + iterator.skip(); + const Token& member = iterator.getCurrentStringAndGotoNext(); + string memberName = member.value(); + if (!memberName.compare("DidCreate")) { + return Call_PPP_Instance_DidCreate((const PPP_Instance*)_interface, iterator); + } + if (!memberName.compare("DidDestroy")) { + return Call_PPP_Instance_DidDestroy((const PPP_Instance*)_interface, iterator); + } +/* skipping DidChangeView */ + if (!memberName.compare("DidChangeView")) { + return Call_PPP_Instance_DidChangeView((const PPP_Instance*)_interface, iterator); + } + if (!memberName.compare("DidChangeFocus")) { + return Call_PPP_Instance_DidChangeFocus((const PPP_Instance*)_interface, iterator); + } + if (!memberName.compare("HandleDocumentLoad")) { + return Call_PPP_Instance_HandleDocumentLoad((const PPP_Instance*)_interface, iterator); + } + return nullptr; +} +char* Call_PPP_MessageHandler_HandleMessage(const PPP_MessageHandler* _interface, JSONIterator& iterator) { + PP_Instance instance; + iterator.skip(); + FromJSON_PP_Instance(iterator, instance); + void* user_data; + iterator.skip(); + FromJSON_mem_t(iterator, user_data); + struct PP_Var message; + iterator.skip(); + FromJSON_PP_Var(iterator, message); + _interface->HandleMessage((PP_Instance )instance, (void* )user_data, (const struct PP_Var* )&message); + stringstream os; + BeginElements(os); + BeginProps(os); + AddProp(os, "user_data", ToString_mem_t(user_data)); + EndProps(os); + EndElements(os); + return strdup(os.str().c_str()); +} +char* Call_PPP_MessageHandler_HandleBlockingMessage(const PPP_MessageHandler* _interface, JSONIterator& iterator) { + PP_Instance instance; + iterator.skip(); + FromJSON_PP_Instance(iterator, instance); + void* user_data; + iterator.skip(); + FromJSON_mem_t(iterator, user_data); + struct PP_Var message; + iterator.skip(); + FromJSON_PP_Var(iterator, message); + struct PP_Var response; + _interface->HandleBlockingMessage((PP_Instance )instance, (void* )user_data, (const struct PP_Var* )&message, (struct PP_Var* )&response); + stringstream os; + BeginElements(os); + BeginProps(os); + AddProp(os, "user_data", ToString_mem_t(user_data)); + AddProp(os, "response", ToString_PP_Var(response)); + EndProps(os); + EndElements(os); + return strdup(os.str().c_str()); +} +char* Call_PPP_MessageHandler_Destroy(const PPP_MessageHandler* _interface, JSONIterator& iterator) { + PP_Instance instance; + iterator.skip(); + FromJSON_PP_Instance(iterator, instance); + void* user_data; + iterator.skip(); + FromJSON_mem_t(iterator, user_data); + _interface->Destroy((PP_Instance )instance, (void* )user_data); + stringstream os; + BeginElements(os); + BeginProps(os); + AddProp(os, "user_data", ToString_mem_t(user_data)); + EndProps(os); + EndElements(os); + return strdup(os.str().c_str()); +} +char* Call_PPP_MessageHandler(const void* _interface, JSONIterator& iterator) { + iterator.skip(); + const Token& member = iterator.getCurrentStringAndGotoNext(); + string memberName = member.value(); + if (!memberName.compare("HandleMessage")) { + return Call_PPP_MessageHandler_HandleMessage((const PPP_MessageHandler*)_interface, iterator); + } + if (!memberName.compare("HandleBlockingMessage")) { + return Call_PPP_MessageHandler_HandleBlockingMessage((const PPP_MessageHandler*)_interface, iterator); + } + if (!memberName.compare("Destroy")) { + return Call_PPP_MessageHandler_Destroy((const PPP_MessageHandler*)_interface, iterator); + } + return nullptr; +} +char* Call_PPP_Messaging_HandleMessage(const PPP_Messaging* _interface, JSONIterator& iterator) { + PP_Instance instance; + iterator.skip(); + FromJSON_PP_Instance(iterator, instance); + struct PP_Var message; + iterator.skip(); + FromJSON_PP_Var(iterator, message); + _interface->HandleMessage((PP_Instance )instance, (struct PP_Var )message); + return nullptr; +} +char* Call_PPP_Messaging(const void* _interface, JSONIterator& iterator) { + iterator.skip(); + const Token& member = iterator.getCurrentStringAndGotoNext(); + string memberName = member.value(); + if (!memberName.compare("HandleMessage")) { + return Call_PPP_Messaging_HandleMessage((const PPP_Messaging*)_interface, iterator); + } + return nullptr; +} +char* Call_PPP_MouseLock_MouseLockLost(const PPP_MouseLock* _interface, JSONIterator& iterator) { + PP_Instance instance; + iterator.skip(); + FromJSON_PP_Instance(iterator, instance); + _interface->MouseLockLost((PP_Instance )instance); + return nullptr; +} +char* Call_PPP_MouseLock(const void* _interface, JSONIterator& iterator) { + iterator.skip(); + const Token& member = iterator.getCurrentStringAndGotoNext(); + string memberName = member.value(); + if (!memberName.compare("MouseLockLost")) { + return Call_PPP_MouseLock_MouseLockLost((const PPP_MouseLock*)_interface, iterator); + } + return nullptr; +} +namespace ns_PPB_BrokerTrusted_0_2 { +static PP_Resource CreateTrusted_0_2(PP_Instance instance) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_BrokerTrusted\""); + AddProp(ss, "__version", "\"0.2\""); + AddProp(ss, "__method", "\"CreateTrusted\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Resource(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_BrokerTrusted_0_2*)RealGetInterface("PPB_BrokerTrusted;0.2"))->CreateTrusted(instance); + printf("RPC response: ["); + printf("%s", ToString_PP_Resource(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool IsBrokerTrusted_0_2(PP_Resource resource) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_BrokerTrusted\""); + AddProp(ss, "__version", "\"0.2\""); + AddProp(ss, "__method", "\"IsBrokerTrusted\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_BrokerTrusted_0_2*)RealGetInterface("PPB_BrokerTrusted;0.2"))->IsBrokerTrusted(resource); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t Connect_0_2(PP_Resource broker, struct PP_CompletionCallback connect_callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_BrokerTrusted\""); + AddProp(ss, "__version", "\"0.2\""); + AddProp(ss, "__method", "\"Connect\""); + AddProp(ss, "broker", ToString_PP_Resource(broker)); + AddProp(ss, "connect_callback", ToString_PP_CompletionCallback(connect_callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_connect_callback; + logging_connect_callback.func = &Logging_PP_CompletionCallback; + logging_connect_callback.user_data = new PP_CompletionCallback(connect_callback); + logging_connect_callback.flags = connect_callback.flags; + int32_t rval = ((PPB_BrokerTrusted_0_2*)RealGetInterface("PPB_BrokerTrusted;0.2"))->Connect(broker, logging_connect_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t GetHandle_0_2(PP_Resource broker, int32_t* handle) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_BrokerTrusted\""); + AddProp(ss, "__version", "\"0.2\""); + AddProp(ss, "__method", "\"GetHandle\""); + AddProp(ss, "broker", ToString_PP_Resource(broker)); + AddProp(ss, "handle", PointerToString(handle)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + iterator.skip(); + FromJSON_int32_t(iterator, *handle); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_BrokerTrusted_0_2*)RealGetInterface("PPB_BrokerTrusted;0.2"))->GetHandle(broker, handle); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_int32_t(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + if (!!handle) { + AddProp(os, "handle", ToString_int32_t(handle)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +/* skipping IsAllowed */ +} +static PPB_BrokerTrusted_0_2 _PPB_BrokerTrusted_0_2 = { + ns_PPB_BrokerTrusted_0_2::CreateTrusted_0_2, + ns_PPB_BrokerTrusted_0_2::IsBrokerTrusted_0_2, + ns_PPB_BrokerTrusted_0_2::Connect_0_2, + ns_PPB_BrokerTrusted_0_2::GetHandle_0_2, +}; +const string ToString_PPB_BrokerTrusted(const PPB_BrokerTrusted_0_2 *v) { + stringstream s; + s << v; + return s.str(); +} +namespace ns_PPB_BrokerTrusted_0_3 { +static PP_Resource CreateTrusted_0_3(PP_Instance instance) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_BrokerTrusted\""); + AddProp(ss, "__version", "\"0.3\""); + AddProp(ss, "__method", "\"CreateTrusted\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Resource(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_BrokerTrusted_0_3*)RealGetInterface("PPB_BrokerTrusted;0.3"))->CreateTrusted(instance); + printf("RPC response: ["); + printf("%s", ToString_PP_Resource(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool IsBrokerTrusted_0_3(PP_Resource resource) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_BrokerTrusted\""); + AddProp(ss, "__version", "\"0.3\""); + AddProp(ss, "__method", "\"IsBrokerTrusted\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_BrokerTrusted_0_3*)RealGetInterface("PPB_BrokerTrusted;0.3"))->IsBrokerTrusted(resource); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t Connect_0_3(PP_Resource broker, struct PP_CompletionCallback connect_callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_BrokerTrusted\""); + AddProp(ss, "__version", "\"0.3\""); + AddProp(ss, "__method", "\"Connect\""); + AddProp(ss, "broker", ToString_PP_Resource(broker)); + AddProp(ss, "connect_callback", ToString_PP_CompletionCallback(connect_callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_connect_callback; + logging_connect_callback.func = &Logging_PP_CompletionCallback; + logging_connect_callback.user_data = new PP_CompletionCallback(connect_callback); + logging_connect_callback.flags = connect_callback.flags; + int32_t rval = ((PPB_BrokerTrusted_0_3*)RealGetInterface("PPB_BrokerTrusted;0.3"))->Connect(broker, logging_connect_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t GetHandle_0_3(PP_Resource broker, int32_t* handle) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_BrokerTrusted\""); + AddProp(ss, "__version", "\"0.3\""); + AddProp(ss, "__method", "\"GetHandle\""); + AddProp(ss, "broker", ToString_PP_Resource(broker)); + AddProp(ss, "handle", PointerToString(handle)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + iterator.skip(); + FromJSON_int32_t(iterator, *handle); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_BrokerTrusted_0_3*)RealGetInterface("PPB_BrokerTrusted;0.3"))->GetHandle(broker, handle); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_int32_t(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + if (!!handle) { + AddProp(os, "handle", ToString_int32_t(handle)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool IsAllowed_0_3(PP_Resource broker) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_BrokerTrusted\""); + AddProp(ss, "__version", "\"0.3\""); + AddProp(ss, "__method", "\"IsAllowed\""); + AddProp(ss, "broker", ToString_PP_Resource(broker)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_BrokerTrusted_0_3*)RealGetInterface("PPB_BrokerTrusted;0.3"))->IsAllowed(broker); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +} +static PPB_BrokerTrusted_0_3 _PPB_BrokerTrusted_0_3 = { + ns_PPB_BrokerTrusted_0_3::CreateTrusted_0_3, + ns_PPB_BrokerTrusted_0_3::IsBrokerTrusted_0_3, + ns_PPB_BrokerTrusted_0_3::Connect_0_3, + ns_PPB_BrokerTrusted_0_3::GetHandle_0_3, + ns_PPB_BrokerTrusted_0_3::IsAllowed_0_3, +}; +const string ToString_PPB_BrokerTrusted(const PPB_BrokerTrusted_0_3 *v) { + stringstream s; + s << v; + return s.str(); +} +const string ToString_PP_BrowserFont_Trusted_Family(const PP_BrowserFont_Trusted_Family *v) { + switch (*v) { + case 0: + return "\"PP_BROWSERFONT_TRUSTED_FAMILY_DEFAULT\""; + case 1: + return "\"PP_BROWSERFONT_TRUSTED_FAMILY_SERIF\""; + case 2: + return "\"PP_BROWSERFONT_TRUSTED_FAMILY_SANSSERIF\""; + case 3: + return "\"PP_BROWSERFONT_TRUSTED_FAMILY_MONOSPACE\""; + default: + return "\"???\""; + } +} +const string ToString_PP_BrowserFont_Trusted_Family(const PP_BrowserFont_Trusted_Family &v) { + return ToString_PP_BrowserFont_Trusted_Family(&v); +} +void FromJSON_PP_BrowserFont_Trusted_Family(JSONIterator& iterator, PP_BrowserFont_Trusted_Family &value) { + long int v; + FromJSON_int(iterator, v); + value = PP_BrowserFont_Trusted_Family(v); +} +const string ToString_PP_BrowserFont_Trusted_Weight(const PP_BrowserFont_Trusted_Weight *v) { + switch (*v) { + case 0: + return "\"PP_BROWSERFONT_TRUSTED_WEIGHT_100\""; + case 1: + return "\"PP_BROWSERFONT_TRUSTED_WEIGHT_200\""; + case 2: + return "\"PP_BROWSERFONT_TRUSTED_WEIGHT_300\""; + case 3: + return "\"PP_BROWSERFONT_TRUSTED_WEIGHT_400\""; + case 4: + return "\"PP_BROWSERFONT_TRUSTED_WEIGHT_500\""; + case 5: + return "\"PP_BROWSERFONT_TRUSTED_WEIGHT_600\""; + case 6: + return "\"PP_BROWSERFONT_TRUSTED_WEIGHT_700\""; + case 7: + return "\"PP_BROWSERFONT_TRUSTED_WEIGHT_800\""; + case 8: + return "\"PP_BROWSERFONT_TRUSTED_WEIGHT_900\""; + default: + return "\"???\""; + } +} +const string ToString_PP_BrowserFont_Trusted_Weight(const PP_BrowserFont_Trusted_Weight &v) { + return ToString_PP_BrowserFont_Trusted_Weight(&v); +} +void FromJSON_PP_BrowserFont_Trusted_Weight(JSONIterator& iterator, PP_BrowserFont_Trusted_Weight &value) { + long int v; + FromJSON_int(iterator, v); + value = PP_BrowserFont_Trusted_Weight(v); +} +const string ToString_PP_BrowserFont_Trusted_Description(const PP_BrowserFont_Trusted_Description *v) { + if (!v) { + return "null"; + } + return ToString_PP_BrowserFont_Trusted_Description(*v); +} +const string ToString_PP_BrowserFont_Trusted_Description(const PP_BrowserFont_Trusted_Description &v) { + stringstream x; + BeginProps(x); + AddProp(x, "face", ToString_PP_Var(v.face)); + AddProp(x, "family", ToString_PP_BrowserFont_Trusted_Family(v.family)); + AddProp(x, "size", ToString_uint32_t(v.size)); + AddProp(x, "weight", ToString_PP_BrowserFont_Trusted_Weight(v.weight)); + AddProp(x, "italic", ToString_PP_Bool(v.italic)); + AddProp(x, "small_caps", ToString_PP_Bool(v.small_caps)); + AddProp(x, "letter_spacing", ToString_int32_t(v.letter_spacing)); + AddProp(x, "word_spacing", ToString_int32_t(v.word_spacing)); + AddProp(x, "padding", ToString_int32_t(v.padding)); + EndProps(x); + return x.str(); +} +void FromJSON_PP_BrowserFont_Trusted_Description(JSONIterator& iterator, PP_BrowserFont_Trusted_Description &value) { + const JSON::Token& current = iterator.getCurrentAndGotoNext(); + if (current.isPrimitive() && !current.value().compare("null")) { + return; + } + if (!current.isObject()) { + Fail("Expected object!", ""); + } + iterator.skip(); + FromJSON_PP_Var(iterator, value.face); + iterator.skip(); + FromJSON_PP_BrowserFont_Trusted_Family(iterator, value.family); + iterator.skip(); + FromJSON_uint32_t(iterator, value.size); + iterator.skip(); + FromJSON_PP_BrowserFont_Trusted_Weight(iterator, value.weight); + iterator.skip(); + FromJSON_PP_Bool(iterator, value.italic); + iterator.skip(); + FromJSON_PP_Bool(iterator, value.small_caps); + iterator.skip(); + FromJSON_int32_t(iterator, value.letter_spacing); + iterator.skip(); + FromJSON_int32_t(iterator, value.word_spacing); + iterator.skip(); + FromJSON_int32_t(iterator, value.padding); +} +const string ToString_PP_BrowserFont_Trusted_Metrics(const PP_BrowserFont_Trusted_Metrics *v) { + if (!v) { + return "null"; + } + return ToString_PP_BrowserFont_Trusted_Metrics(*v); +} +const string ToString_PP_BrowserFont_Trusted_Metrics(const PP_BrowserFont_Trusted_Metrics &v) { + stringstream x; + BeginProps(x); + AddProp(x, "height", ToString_int32_t(v.height)); + AddProp(x, "ascent", ToString_int32_t(v.ascent)); + AddProp(x, "descent", ToString_int32_t(v.descent)); + AddProp(x, "line_spacing", ToString_int32_t(v.line_spacing)); + AddProp(x, "x_height", ToString_int32_t(v.x_height)); + EndProps(x); + return x.str(); +} +void FromJSON_PP_BrowserFont_Trusted_Metrics(JSONIterator& iterator, PP_BrowserFont_Trusted_Metrics &value) { + const JSON::Token& current = iterator.getCurrentAndGotoNext(); + if (current.isPrimitive() && !current.value().compare("null")) { + return; + } + if (!current.isObject()) { + Fail("Expected object!", ""); + } + iterator.skip(); + FromJSON_int32_t(iterator, value.height); + iterator.skip(); + FromJSON_int32_t(iterator, value.ascent); + iterator.skip(); + FromJSON_int32_t(iterator, value.descent); + iterator.skip(); + FromJSON_int32_t(iterator, value.line_spacing); + iterator.skip(); + FromJSON_int32_t(iterator, value.x_height); +} +const string ToString_PP_BrowserFont_Trusted_TextRun(const PP_BrowserFont_Trusted_TextRun *v) { + if (!v) { + return "null"; + } + return ToString_PP_BrowserFont_Trusted_TextRun(*v); +} +const string ToString_PP_BrowserFont_Trusted_TextRun(const PP_BrowserFont_Trusted_TextRun &v) { + stringstream x; + BeginProps(x); + AddProp(x, "text", ToString_PP_Var(v.text)); + AddProp(x, "rtl", ToString_PP_Bool(v.rtl)); + AddProp(x, "override_direction", ToString_PP_Bool(v.override_direction)); + EndProps(x); + return x.str(); +} +void FromJSON_PP_BrowserFont_Trusted_TextRun(JSONIterator& iterator, PP_BrowserFont_Trusted_TextRun &value) { + const JSON::Token& current = iterator.getCurrentAndGotoNext(); + if (current.isPrimitive() && !current.value().compare("null")) { + return; + } + if (!current.isObject()) { + Fail("Expected object!", ""); + } + iterator.skip(); + FromJSON_PP_Var(iterator, value.text); + iterator.skip(); + FromJSON_PP_Bool(iterator, value.rtl); + iterator.skip(); + FromJSON_PP_Bool(iterator, value.override_direction); +} +namespace ns_PPB_BrowserFont_Trusted_1_0 { +static struct PP_Var GetFontFamilies_1_0(PP_Instance instance) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_BrowserFont_Trusted\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"GetFontFamilies\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + struct PP_Var rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Var(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + struct PP_Var rval = ((PPB_BrowserFont_Trusted_1_0*)RealGetInterface("PPB_BrowserFont_Trusted;1.0"))->GetFontFamilies(instance); + printf("RPC response: ["); + printf("%s", ToString_PP_Var(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Resource Create_1_0(PP_Instance instance, const struct PP_BrowserFont_Trusted_Description* description) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_BrowserFont_Trusted\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"Create\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "description", ToString_PP_BrowserFont_Trusted_Description(description)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Resource(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_BrowserFont_Trusted_1_0*)RealGetInterface("PPB_BrowserFont_Trusted;1.0"))->Create(instance, description); + printf("RPC response: ["); + printf("%s", ToString_PP_Resource(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool IsFont_1_0(PP_Resource resource) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_BrowserFont_Trusted\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"IsFont\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_BrowserFont_Trusted_1_0*)RealGetInterface("PPB_BrowserFont_Trusted;1.0"))->IsFont(resource); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool Describe_1_0(PP_Resource font, struct PP_BrowserFont_Trusted_Description* description, struct PP_BrowserFont_Trusted_Metrics* metrics) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_BrowserFont_Trusted\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"Describe\""); + AddProp(ss, "font", ToString_PP_Resource(font)); + AddProp(ss, "description", PointerToString(description)); + AddProp(ss, "metrics", PointerToString(metrics)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + if (!!description) { + iterator.skip(); + FromJSON_PP_BrowserFont_Trusted_Description(iterator, *description); + } + if (!!metrics) { + iterator.skip(); + FromJSON_PP_BrowserFont_Trusted_Metrics(iterator, *metrics); + } + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_BrowserFont_Trusted_1_0*)RealGetInterface("PPB_BrowserFont_Trusted;1.0"))->Describe(font, description, metrics); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + if (!!description) { + AddProp(os, "description", ToString_PP_BrowserFont_Trusted_Description(description)); + } + if (!!metrics) { + AddProp(os, "metrics", ToString_PP_BrowserFont_Trusted_Metrics(metrics)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool DrawTextAt_1_0(PP_Resource font, PP_Resource image_data, const struct PP_BrowserFont_Trusted_TextRun* text, const struct PP_Point* position, uint32_t color, const struct PP_Rect* clip, PP_Bool image_data_is_opaque) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_BrowserFont_Trusted\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"DrawTextAt\""); + AddProp(ss, "font", ToString_PP_Resource(font)); + AddProp(ss, "image_data", ToString_PP_Resource(image_data)); + AddProp(ss, "text", ToString_PP_BrowserFont_Trusted_TextRun(text)); + AddProp(ss, "position", ToString_PP_Point(position)); + AddProp(ss, "color", ToString_uint32_t(color)); + AddProp(ss, "clip", ToString_PP_Rect(clip)); + AddProp(ss, "image_data_is_opaque", ToString_PP_Bool(image_data_is_opaque)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_BrowserFont_Trusted_1_0*)RealGetInterface("PPB_BrowserFont_Trusted;1.0"))->DrawTextAt(font, image_data, text, position, color, clip, image_data_is_opaque); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t MeasureText_1_0(PP_Resource font, const struct PP_BrowserFont_Trusted_TextRun* text) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_BrowserFont_Trusted\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"MeasureText\""); + AddProp(ss, "font", ToString_PP_Resource(font)); + AddProp(ss, "text", ToString_PP_BrowserFont_Trusted_TextRun(text)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_BrowserFont_Trusted_1_0*)RealGetInterface("PPB_BrowserFont_Trusted;1.0"))->MeasureText(font, text); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static uint32_t CharacterOffsetForPixel_1_0(PP_Resource font, const struct PP_BrowserFont_Trusted_TextRun* text, int32_t pixel_position) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_BrowserFont_Trusted\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"CharacterOffsetForPixel\""); + AddProp(ss, "font", ToString_PP_Resource(font)); + AddProp(ss, "text", ToString_PP_BrowserFont_Trusted_TextRun(text)); + AddProp(ss, "pixel_position", ToString_int32_t(pixel_position)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + uint32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_uint32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + uint32_t rval = ((PPB_BrowserFont_Trusted_1_0*)RealGetInterface("PPB_BrowserFont_Trusted;1.0"))->CharacterOffsetForPixel(font, text, pixel_position); + printf("RPC response: ["); + printf("%s", ToString_uint32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t PixelOffsetForCharacter_1_0(PP_Resource font, const struct PP_BrowserFont_Trusted_TextRun* text, uint32_t char_offset) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_BrowserFont_Trusted\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"PixelOffsetForCharacter\""); + AddProp(ss, "font", ToString_PP_Resource(font)); + AddProp(ss, "text", ToString_PP_BrowserFont_Trusted_TextRun(text)); + AddProp(ss, "char_offset", ToString_uint32_t(char_offset)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_BrowserFont_Trusted_1_0*)RealGetInterface("PPB_BrowserFont_Trusted;1.0"))->PixelOffsetForCharacter(font, text, char_offset); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +} +static PPB_BrowserFont_Trusted_1_0 _PPB_BrowserFont_Trusted_1_0 = { + ns_PPB_BrowserFont_Trusted_1_0::GetFontFamilies_1_0, + ns_PPB_BrowserFont_Trusted_1_0::Create_1_0, + ns_PPB_BrowserFont_Trusted_1_0::IsFont_1_0, + ns_PPB_BrowserFont_Trusted_1_0::Describe_1_0, + ns_PPB_BrowserFont_Trusted_1_0::DrawTextAt_1_0, + ns_PPB_BrowserFont_Trusted_1_0::MeasureText_1_0, + ns_PPB_BrowserFont_Trusted_1_0::CharacterOffsetForPixel_1_0, + ns_PPB_BrowserFont_Trusted_1_0::PixelOffsetForCharacter_1_0, +}; +const string ToString_PPB_BrowserFont_Trusted(const PPB_BrowserFont_Trusted_1_0 *v) { + stringstream s; + s << v; + return s.str(); +} +const string ToString_PP_CharSet_Trusted_ConversionError(const PP_CharSet_Trusted_ConversionError *v) { + switch (*v) { + case 0: + return "\"PP_CHARSET_TRUSTED_CONVERSIONERROR_FAIL\""; + case 1: + return "\"PP_CHARSET_TRUSTED_CONVERSIONERROR_SKIP\""; + case 2: + return "\"PP_CHARSET_TRUSTED_CONVERSIONERROR_SUBSTITUTE\""; + default: + return "\"???\""; + } +} +const string ToString_PP_CharSet_Trusted_ConversionError(const PP_CharSet_Trusted_ConversionError &v) { + return ToString_PP_CharSet_Trusted_ConversionError(&v); +} +void FromJSON_PP_CharSet_Trusted_ConversionError(JSONIterator& iterator, PP_CharSet_Trusted_ConversionError &value) { + long int v; + FromJSON_int(iterator, v); + value = PP_CharSet_Trusted_ConversionError(v); +} +namespace ns_PPB_CharSet_Trusted_1_0 { +static PP_Bool UTF16ToCharSet_1_0(const uint16_t utf16[], uint32_t utf16_len, const char* output_char_set, PP_CharSet_Trusted_ConversionError on_error, char* output_buffer, uint32_t* output_length) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_CharSet_Trusted\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"UTF16ToCharSet\""); + { + BeginProp(ss, "utf16"); + BeginElements(ss); + for (uint32_t _n = 0; _n < utf16_len; ++_n) { + AddElement(ss, ToString_uint16_t(utf16[_n])); + } + EndElements(ss); + } + AddProp(ss, "utf16_len", ToString_uint32_t(utf16_len)); + AddProp(ss, "output_char_set", ToString_str_t(output_char_set)); + AddProp(ss, "on_error", ToString_PP_CharSet_Trusted_ConversionError(on_error)); + AddProp(ss, "output_buffer", PointerToString(output_buffer)); + AddProp(ss, "output_length", ToString_uint32_t(output_length)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + iterator.skip(); + FromJSON_str_t(iterator, output_buffer); + iterator.skip(); + FromJSON_uint32_t(iterator, *output_length); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_CharSet_Trusted_1_0*)RealGetInterface("PPB_CharSet_Trusted;1.0"))->UTF16ToCharSet(utf16, utf16_len, output_char_set, on_error, output_buffer, output_length); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + AddProp(os, "output_buffer", ToString_str_t(output_buffer)); + AddProp(os, "output_length", ToString_uint32_t(output_length)); + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool CharSetToUTF16_1_0(const char* input, uint32_t input_len, const char* input_char_set, PP_CharSet_Trusted_ConversionError on_error, uint16_t* output_buffer, uint32_t* output_utf16_length) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_CharSet_Trusted\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"CharSetToUTF16\""); + AddProp(ss, "input", ToString_str_t(input)); + AddProp(ss, "input_len", ToString_uint32_t(input_len)); + AddProp(ss, "input_char_set", ToString_str_t(input_char_set)); + AddProp(ss, "on_error", ToString_PP_CharSet_Trusted_ConversionError(on_error)); + AddProp(ss, "output_buffer", PointerToString(output_buffer)); + AddProp(ss, "output_utf16_length", ToString_uint32_t(output_utf16_length)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + iterator.skip(); + FromJSON_uint16_t(iterator, *output_buffer); + iterator.skip(); + FromJSON_uint32_t(iterator, *output_utf16_length); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_CharSet_Trusted_1_0*)RealGetInterface("PPB_CharSet_Trusted;1.0"))->CharSetToUTF16(input, input_len, input_char_set, on_error, output_buffer, output_utf16_length); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + if (!!output_buffer) { + AddProp(os, "output_buffer", ToString_uint16_t(output_buffer)); + } + AddProp(os, "output_utf16_length", ToString_uint32_t(output_utf16_length)); + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static struct PP_Var GetDefaultCharSet_1_0(PP_Instance instance) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_CharSet_Trusted\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"GetDefaultCharSet\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + struct PP_Var rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Var(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + struct PP_Var rval = ((PPB_CharSet_Trusted_1_0*)RealGetInterface("PPB_CharSet_Trusted;1.0"))->GetDefaultCharSet(instance); + printf("RPC response: ["); + printf("%s", ToString_PP_Var(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +} +static PPB_CharSet_Trusted_1_0 _PPB_CharSet_Trusted_1_0 = { + ns_PPB_CharSet_Trusted_1_0::UTF16ToCharSet_1_0, + ns_PPB_CharSet_Trusted_1_0::CharSetToUTF16_1_0, + ns_PPB_CharSet_Trusted_1_0::GetDefaultCharSet_1_0, +}; +const string ToString_PPB_CharSet_Trusted(const PPB_CharSet_Trusted_1_0 *v) { + stringstream s; + s << v; + return s.str(); +} +namespace ns_PPB_FileChooserTrusted_0_5 { +static int32_t ShowWithoutUserGesture_0_5(PP_Resource chooser, PP_Bool save_as, struct PP_Var suggested_file_name, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_FileChooserTrusted\""); + AddProp(ss, "__version", "\"0.5\""); + AddProp(ss, "__method", "\"ShowWithoutUserGesture\""); + AddProp(ss, "chooser", ToString_PP_Resource(chooser)); + AddProp(ss, "save_as", ToString_PP_Bool(save_as)); + AddProp(ss, "suggested_file_name", ToString_PP_Var(suggested_file_name)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_FileChooserTrusted_0_5*)RealGetInterface("PPB_FileChooserTrusted;0.5"))->ShowWithoutUserGesture(chooser, save_as, suggested_file_name, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +/* skipping ShowWithoutUserGesture */ +} +static PPB_FileChooserTrusted_0_5 _PPB_FileChooserTrusted_0_5 = { + ns_PPB_FileChooserTrusted_0_5::ShowWithoutUserGesture_0_5, +}; +const string ToString_PPB_FileChooserTrusted(const PPB_FileChooserTrusted_0_5 *v) { + stringstream s; + s << v; + return s.str(); +} +namespace ns_PPB_FileChooserTrusted_0_6 { +/* skipping ShowWithoutUserGesture */ +static int32_t ShowWithoutUserGesture_0_6(PP_Resource chooser, PP_Bool save_as, struct PP_Var suggested_file_name, struct PP_ArrayOutput output, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_FileChooserTrusted\""); + AddProp(ss, "__version", "\"0.6\""); + AddProp(ss, "__method", "\"ShowWithoutUserGesture\""); + AddProp(ss, "chooser", ToString_PP_Resource(chooser)); + AddProp(ss, "save_as", ToString_PP_Bool(save_as)); + AddProp(ss, "suggested_file_name", ToString_PP_Var(suggested_file_name)); + AddProp(ss, "output", ToString_PP_ArrayOutput(output)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_FileChooserTrusted_0_6*)RealGetInterface("PPB_FileChooserTrusted;0.6"))->ShowWithoutUserGesture(chooser, save_as, suggested_file_name, output, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +} +static PPB_FileChooserTrusted_0_6 _PPB_FileChooserTrusted_0_6 = { + ns_PPB_FileChooserTrusted_0_6::ShowWithoutUserGesture_0_6, +}; +const string ToString_PPB_FileChooserTrusted(const PPB_FileChooserTrusted_0_6 *v) { + stringstream s; + s << v; + return s.str(); +} +const string ToString_PP_URLLoaderTrusted_StatusCallback(const PP_URLLoaderTrusted_StatusCallback &v) { + return PointerToString(v); +} +void FromJSON_PP_URLLoaderTrusted_StatusCallback(JSONIterator& iterator, PP_URLLoaderTrusted_StatusCallback &value) { + PointerValueFromJSON(iterator, value); +} +namespace ns_PPB_URLLoaderTrusted_0_3 { +static void GrantUniversalAccess_0_3(PP_Resource loader) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_URLLoaderTrusted\""); + AddProp(ss, "__version", "\"0.3\""); + AddProp(ss, "__method", "\"GrantUniversalAccess\""); + AddProp(ss, "loader", ToString_PP_Resource(loader)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_URLLoaderTrusted_0_3*)RealGetInterface("PPB_URLLoaderTrusted;0.3"))->GrantUniversalAccess(loader); +#endif // !INTERPOSE +} +static void RegisterStatusCallback_0_3(PP_Resource loader, PP_URLLoaderTrusted_StatusCallback cb) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_URLLoaderTrusted\""); + AddProp(ss, "__version", "\"0.3\""); + AddProp(ss, "__method", "\"RegisterStatusCallback\""); + AddProp(ss, "loader", ToString_PP_Resource(loader)); + AddProp(ss, "cb", ToString_PP_URLLoaderTrusted_StatusCallback(cb)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_URLLoaderTrusted_0_3*)RealGetInterface("PPB_URLLoaderTrusted;0.3"))->RegisterStatusCallback(loader, cb); +#endif // !INTERPOSE +} +} +static PPB_URLLoaderTrusted_0_3 _PPB_URLLoaderTrusted_0_3 = { + ns_PPB_URLLoaderTrusted_0_3::GrantUniversalAccess_0_3, + ns_PPB_URLLoaderTrusted_0_3::RegisterStatusCallback_0_3, +}; +const string ToString_PPB_URLLoaderTrusted(const PPB_URLLoaderTrusted_0_3 *v) { + stringstream s; + s << v; + return s.str(); +} +const string ToString_PP_CursorType_Dev(const PP_CursorType_Dev *v) { + switch (*v) { + case -1: + return "\"PP_CURSORTYPE_CUSTOM\""; + case 0: + return "\"PP_CURSORTYPE_POINTER\""; + case 1: + return "\"PP_CURSORTYPE_CROSS\""; + case 2: + return "\"PP_CURSORTYPE_HAND\""; + case 3: + return "\"PP_CURSORTYPE_IBEAM\""; + case 4: + return "\"PP_CURSORTYPE_WAIT\""; + case 5: + return "\"PP_CURSORTYPE_HELP\""; + case 6: + return "\"PP_CURSORTYPE_EASTRESIZE\""; + case 7: + return "\"PP_CURSORTYPE_NORTHRESIZE\""; + case 8: + return "\"PP_CURSORTYPE_NORTHEASTRESIZE\""; + case 9: + return "\"PP_CURSORTYPE_NORTHWESTRESIZE\""; + case 10: + return "\"PP_CURSORTYPE_SOUTHRESIZE\""; + case 11: + return "\"PP_CURSORTYPE_SOUTHEASTRESIZE\""; + case 12: + return "\"PP_CURSORTYPE_SOUTHWESTRESIZE\""; + case 13: + return "\"PP_CURSORTYPE_WESTRESIZE\""; + case 14: + return "\"PP_CURSORTYPE_NORTHSOUTHRESIZE\""; + case 15: + return "\"PP_CURSORTYPE_EASTWESTRESIZE\""; + case 16: + return "\"PP_CURSORTYPE_NORTHEASTSOUTHWESTRESIZE\""; + case 17: + return "\"PP_CURSORTYPE_NORTHWESTSOUTHEASTRESIZE\""; + case 18: + return "\"PP_CURSORTYPE_COLUMNRESIZE\""; + case 19: + return "\"PP_CURSORTYPE_ROWRESIZE\""; + case 20: + return "\"PP_CURSORTYPE_MIDDLEPANNING\""; + case 21: + return "\"PP_CURSORTYPE_EASTPANNING\""; + case 22: + return "\"PP_CURSORTYPE_NORTHPANNING\""; + case 23: + return "\"PP_CURSORTYPE_NORTHEASTPANNING\""; + case 24: + return "\"PP_CURSORTYPE_NORTHWESTPANNING\""; + case 25: + return "\"PP_CURSORTYPE_SOUTHPANNING\""; + case 26: + return "\"PP_CURSORTYPE_SOUTHEASTPANNING\""; + case 27: + return "\"PP_CURSORTYPE_SOUTHWESTPANNING\""; + case 28: + return "\"PP_CURSORTYPE_WESTPANNING\""; + case 29: + return "\"PP_CURSORTYPE_MOVE\""; + case 30: + return "\"PP_CURSORTYPE_VERTICALTEXT\""; + case 31: + return "\"PP_CURSORTYPE_CELL\""; + case 32: + return "\"PP_CURSORTYPE_CONTEXTMENU\""; + case 33: + return "\"PP_CURSORTYPE_ALIAS\""; + case 34: + return "\"PP_CURSORTYPE_PROGRESS\""; + case 35: + return "\"PP_CURSORTYPE_NODROP\""; + case 36: + return "\"PP_CURSORTYPE_COPY\""; + case 37: + return "\"PP_CURSORTYPE_NONE\""; + case 38: + return "\"PP_CURSORTYPE_NOTALLOWED\""; + case 39: + return "\"PP_CURSORTYPE_ZOOMIN\""; + case 40: + return "\"PP_CURSORTYPE_ZOOMOUT\""; + case 41: + return "\"PP_CURSORTYPE_GRAB\""; + case 42: + return "\"PP_CURSORTYPE_GRABBING\""; + default: + return "\"???\""; + } +} +const string ToString_PP_CursorType_Dev(const PP_CursorType_Dev &v) { + return ToString_PP_CursorType_Dev(&v); +} +void FromJSON_PP_CursorType_Dev(JSONIterator& iterator, PP_CursorType_Dev &value) { + long int v; + FromJSON_int(iterator, v); + value = PP_CursorType_Dev(v); +} +const string ToString_PP_PrintOrientation_Dev(const PP_PrintOrientation_Dev *v) { + switch (*v) { + case 0: + return "\"PP_PRINTORIENTATION_NORMAL\""; + case 1: + return "\"PP_PRINTORIENTATION_ROTATED_90_CW\""; + case 2: + return "\"PP_PRINTORIENTATION_ROTATED_180\""; + case 3: + return "\"PP_PRINTORIENTATION_ROTATED_90_CCW\""; + default: + return "\"???\""; + } +} +const string ToString_PP_PrintOrientation_Dev(const PP_PrintOrientation_Dev &v) { + return ToString_PP_PrintOrientation_Dev(&v); +} +void FromJSON_PP_PrintOrientation_Dev(JSONIterator& iterator, PP_PrintOrientation_Dev &value) { + long int v; + FromJSON_int(iterator, v); + value = PP_PrintOrientation_Dev(v); +} +const string ToString_PP_PrintOutputFormat_Dev(const PP_PrintOutputFormat_Dev *v) { + switch (*v) { + case 1u << 0: + return "\"PP_PRINTOUTPUTFORMAT_RASTER\""; + case 1u << 1: + return "\"PP_PRINTOUTPUTFORMAT_PDF\""; + case 1u << 2: + return "\"PP_PRINTOUTPUTFORMAT_POSTSCRIPT\""; + case 1u << 3: + return "\"PP_PRINTOUTPUTFORMAT_EMF\""; + default: + return "\"???\""; + } +} +const string ToString_PP_PrintOutputFormat_Dev(const PP_PrintOutputFormat_Dev &v) { + return ToString_PP_PrintOutputFormat_Dev(&v); +} +void FromJSON_PP_PrintOutputFormat_Dev(JSONIterator& iterator, PP_PrintOutputFormat_Dev &value) { + long int v; + FromJSON_int(iterator, v); + value = PP_PrintOutputFormat_Dev(v); +} +const string ToString_PP_PrintScalingOption_Dev(const PP_PrintScalingOption_Dev *v) { + switch (*v) { + case 0: + return "\"PP_PRINTSCALINGOPTION_NONE\""; + case 1: + return "\"PP_PRINTSCALINGOPTION_FIT_TO_PRINTABLE_AREA\""; + case 2: + return "\"PP_PRINTSCALINGOPTION_SOURCE_SIZE\""; + default: + return "\"???\""; + } +} +const string ToString_PP_PrintScalingOption_Dev(const PP_PrintScalingOption_Dev &v) { + return ToString_PP_PrintScalingOption_Dev(&v); +} +void FromJSON_PP_PrintScalingOption_Dev(JSONIterator& iterator, PP_PrintScalingOption_Dev &value) { + long int v; + FromJSON_int(iterator, v); + value = PP_PrintScalingOption_Dev(v); +} +const string ToString_PP_PrintSettings_Dev(const PP_PrintSettings_Dev *v) { + if (!v) { + return "null"; + } + return ToString_PP_PrintSettings_Dev(*v); +} +const string ToString_PP_PrintSettings_Dev(const PP_PrintSettings_Dev &v) { + stringstream x; + BeginProps(x); + AddProp(x, "printable_area", ToString_PP_Rect(v.printable_area)); + AddProp(x, "content_area", ToString_PP_Rect(v.content_area)); + AddProp(x, "paper_size", ToString_PP_Size(v.paper_size)); + AddProp(x, "dpi", ToString_int32_t(v.dpi)); + AddProp(x, "orientation", ToString_PP_PrintOrientation_Dev(v.orientation)); + AddProp(x, "print_scaling_option", ToString_PP_PrintScalingOption_Dev(v.print_scaling_option)); + AddProp(x, "grayscale", ToString_PP_Bool(v.grayscale)); + AddProp(x, "format", ToString_PP_PrintOutputFormat_Dev(v.format)); + EndProps(x); + return x.str(); +} +void FromJSON_PP_PrintSettings_Dev(JSONIterator& iterator, PP_PrintSettings_Dev &value) { + const JSON::Token& current = iterator.getCurrentAndGotoNext(); + if (current.isPrimitive() && !current.value().compare("null")) { + return; + } + if (!current.isObject()) { + Fail("Expected object!", ""); + } + iterator.skip(); + FromJSON_PP_Rect(iterator, value.printable_area); + iterator.skip(); + FromJSON_PP_Rect(iterator, value.content_area); + iterator.skip(); + FromJSON_PP_Size(iterator, value.paper_size); + iterator.skip(); + FromJSON_int32_t(iterator, value.dpi); + iterator.skip(); + FromJSON_PP_PrintOrientation_Dev(iterator, value.orientation); + iterator.skip(); + FromJSON_PP_PrintScalingOption_Dev(iterator, value.print_scaling_option); + iterator.skip(); + FromJSON_PP_Bool(iterator, value.grayscale); + iterator.skip(); + FromJSON_PP_PrintOutputFormat_Dev(iterator, value.format); +} +const string ToString_PP_VideoCaptureDeviceInfo_Dev(const PP_VideoCaptureDeviceInfo_Dev *v) { + if (!v) { + return "null"; + } + return ToString_PP_VideoCaptureDeviceInfo_Dev(*v); +} +const string ToString_PP_VideoCaptureDeviceInfo_Dev(const PP_VideoCaptureDeviceInfo_Dev &v) { + stringstream x; + BeginProps(x); + AddProp(x, "width", ToString_uint32_t(v.width)); + AddProp(x, "height", ToString_uint32_t(v.height)); + AddProp(x, "frames_per_second", ToString_uint32_t(v.frames_per_second)); + EndProps(x); + return x.str(); +} +void FromJSON_PP_VideoCaptureDeviceInfo_Dev(JSONIterator& iterator, PP_VideoCaptureDeviceInfo_Dev &value) { + const JSON::Token& current = iterator.getCurrentAndGotoNext(); + if (current.isPrimitive() && !current.value().compare("null")) { + return; + } + if (!current.isObject()) { + Fail("Expected object!", ""); + } + iterator.skip(); + FromJSON_uint32_t(iterator, value.width); + iterator.skip(); + FromJSON_uint32_t(iterator, value.height); + iterator.skip(); + FromJSON_uint32_t(iterator, value.frames_per_second); +} +const string ToString_PP_VideoCaptureStatus_Dev(const PP_VideoCaptureStatus_Dev *v) { + switch (*v) { + case 0: + return "\"PP_VIDEO_CAPTURE_STATUS_STOPPED\""; + case 1: + return "\"PP_VIDEO_CAPTURE_STATUS_STARTING\""; + case 2: + return "\"PP_VIDEO_CAPTURE_STATUS_STARTED\""; + case 3: + return "\"PP_VIDEO_CAPTURE_STATUS_PAUSED\""; + case 4: + return "\"PP_VIDEO_CAPTURE_STATUS_STOPPING\""; + default: + return "\"???\""; + } +} +const string ToString_PP_VideoCaptureStatus_Dev(const PP_VideoCaptureStatus_Dev &v) { + return ToString_PP_VideoCaptureStatus_Dev(&v); +} +void FromJSON_PP_VideoCaptureStatus_Dev(JSONIterator& iterator, PP_VideoCaptureStatus_Dev &value) { + long int v; + FromJSON_int(iterator, v); + value = PP_VideoCaptureStatus_Dev(v); +} +const string ToString_PP_VideoDecoder_Profile(const PP_VideoDecoder_Profile *v) { + switch (*v) { + case -1: + return "\"PP_VIDEODECODER_PROFILE_UNKNOWN\""; + case 0: + return "\"PP_VIDEODECODER_H264PROFILE_NONE\""; + case 1: + return "\"PP_VIDEODECODER_H264PROFILE_BASELINE\""; + case 2: + return "\"PP_VIDEODECODER_H264PROFILE_MAIN\""; + case 3: + return "\"PP_VIDEODECODER_H264PROFILE_EXTENDED\""; + case 4: + return "\"PP_VIDEODECODER_H264PROFILE_HIGH\""; + case 5: + return "\"PP_VIDEODECODER_H264PROFILE_HIGH10PROFILE\""; + case 6: + return "\"PP_VIDEODECODER_H264PROFILE_HIGH422PROFILE\""; + case 7: + return "\"PP_VIDEODECODER_H264PROFILE_HIGH444PREDICTIVEPROFILE\""; + case 8: + return "\"PP_VIDEODECODER_H264PROFILE_SCALABLEBASELINE\""; + case 9: + return "\"PP_VIDEODECODER_H264PROFILE_SCALABLEHIGH\""; + case 10: + return "\"PP_VIDEODECODER_H264PROFILE_STEREOHIGH\""; + case 11: + return "\"PP_VIDEODECODER_H264PROFILE_MULTIVIEWHIGH\""; + case 12: + return "\"PP_VIDEODECODER_VP8PROFILE_ANY\""; + default: + return "\"???\""; + } +} +const string ToString_PP_VideoDecoder_Profile(const PP_VideoDecoder_Profile &v) { + return ToString_PP_VideoDecoder_Profile(&v); +} +void FromJSON_PP_VideoDecoder_Profile(JSONIterator& iterator, PP_VideoDecoder_Profile &value) { + long int v; + FromJSON_int(iterator, v); + value = PP_VideoDecoder_Profile(v); +} +const string ToString_PP_VideoBitstreamBuffer_Dev(const PP_VideoBitstreamBuffer_Dev *v) { + if (!v) { + return "null"; + } + return ToString_PP_VideoBitstreamBuffer_Dev(*v); +} +const string ToString_PP_VideoBitstreamBuffer_Dev(const PP_VideoBitstreamBuffer_Dev &v) { + stringstream x; + BeginProps(x); + AddProp(x, "id", ToString_int32_t(v.id)); + AddProp(x, "data", ToString_PP_Resource(v.data)); + AddProp(x, "size", ToString_uint32_t(v.size)); + EndProps(x); + return x.str(); +} +void FromJSON_PP_VideoBitstreamBuffer_Dev(JSONIterator& iterator, PP_VideoBitstreamBuffer_Dev &value) { + const JSON::Token& current = iterator.getCurrentAndGotoNext(); + if (current.isPrimitive() && !current.value().compare("null")) { + return; + } + if (!current.isObject()) { + Fail("Expected object!", ""); + } + iterator.skip(); + FromJSON_int32_t(iterator, value.id); + iterator.skip(); + FromJSON_PP_Resource(iterator, value.data); + iterator.skip(); + FromJSON_uint32_t(iterator, value.size); +} +const string ToString_PP_PictureBuffer_Dev(const PP_PictureBuffer_Dev *v) { + if (!v) { + return "null"; + } + return ToString_PP_PictureBuffer_Dev(*v); +} +const string ToString_PP_PictureBuffer_Dev(const PP_PictureBuffer_Dev &v) { + stringstream x; + BeginProps(x); + AddProp(x, "id", ToString_int32_t(v.id)); + AddProp(x, "size", ToString_PP_Size(v.size)); + AddProp(x, "texture_id", ToString_uint32_t(v.texture_id)); + EndProps(x); + return x.str(); +} +void FromJSON_PP_PictureBuffer_Dev(JSONIterator& iterator, PP_PictureBuffer_Dev &value) { + const JSON::Token& current = iterator.getCurrentAndGotoNext(); + if (current.isPrimitive() && !current.value().compare("null")) { + return; + } + if (!current.isObject()) { + Fail("Expected object!", ""); + } + iterator.skip(); + FromJSON_int32_t(iterator, value.id); + iterator.skip(); + FromJSON_PP_Size(iterator, value.size); + iterator.skip(); + FromJSON_uint32_t(iterator, value.texture_id); +} +const string ToString_PP_Picture_Dev(const PP_Picture_Dev *v) { + if (!v) { + return "null"; + } + return ToString_PP_Picture_Dev(*v); +} +const string ToString_PP_Picture_Dev(const PP_Picture_Dev &v) { + stringstream x; + BeginProps(x); + AddProp(x, "picture_buffer_id", ToString_int32_t(v.picture_buffer_id)); + AddProp(x, "bitstream_buffer_id", ToString_int32_t(v.bitstream_buffer_id)); + EndProps(x); + return x.str(); +} +void FromJSON_PP_Picture_Dev(JSONIterator& iterator, PP_Picture_Dev &value) { + const JSON::Token& current = iterator.getCurrentAndGotoNext(); + if (current.isPrimitive() && !current.value().compare("null")) { + return; + } + if (!current.isObject()) { + Fail("Expected object!", ""); + } + iterator.skip(); + FromJSON_int32_t(iterator, value.picture_buffer_id); + iterator.skip(); + FromJSON_int32_t(iterator, value.bitstream_buffer_id); +} +const string ToString_PP_VideoDecodeError_Dev(const PP_VideoDecodeError_Dev *v) { + switch (*v) { + case 1: + return "\"PP_VIDEODECODERERROR_ILLEGAL_STATE\""; + case 2: + return "\"PP_VIDEODECODERERROR_INVALID_ARGUMENT\""; + case 3: + return "\"PP_VIDEODECODERERROR_UNREADABLE_INPUT\""; + case 4: + return "\"PP_VIDEODECODERERROR_PLATFORM_FAILURE\""; + default: + return "\"???\""; + } +} +const string ToString_PP_VideoDecodeError_Dev(const PP_VideoDecodeError_Dev &v) { + return ToString_PP_VideoDecodeError_Dev(&v); +} +void FromJSON_PP_VideoDecodeError_Dev(JSONIterator& iterator, PP_VideoDecodeError_Dev &value) { + long int v; + FromJSON_int(iterator, v); + value = PP_VideoDecodeError_Dev(v); +} +const string ToString_PPB_AudioInput_Callback(const PPB_AudioInput_Callback_0_3 &v) { + return PointerToString(v); +} +void FromJSON_PPB_AudioInput_Callback(JSONIterator& iterator, PPB_AudioInput_Callback_0_3 &value) { + PointerValueFromJSON(iterator, value); +} +const string ToString_PPB_AudioInput_Callback(const PPB_AudioInput_Callback &v) { + return PointerToString(v); +} +void FromJSON_PPB_AudioInput_Callback(JSONIterator& iterator, PPB_AudioInput_Callback &value) { + PointerValueFromJSON(iterator, value); +} +namespace ns_PPB_AudioInput_Dev_0_3 { +static PP_Resource Create_0_3(PP_Instance instance) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_AudioInput_Dev\""); + AddProp(ss, "__version", "\"0.3\""); + AddProp(ss, "__method", "\"Create\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Resource(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_AudioInput_Dev_0_3*)RealGetInterface("PPB_AudioInput(Dev);0.3"))->Create(instance); + printf("RPC response: ["); + printf("%s", ToString_PP_Resource(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool IsAudioInput_0_3(PP_Resource resource) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_AudioInput_Dev\""); + AddProp(ss, "__version", "\"0.3\""); + AddProp(ss, "__method", "\"IsAudioInput\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_AudioInput_Dev_0_3*)RealGetInterface("PPB_AudioInput(Dev);0.3"))->IsAudioInput(resource); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t EnumerateDevices_0_3(PP_Resource audio_input, struct PP_ArrayOutput output, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_AudioInput_Dev\""); + AddProp(ss, "__version", "\"0.3\""); + AddProp(ss, "__method", "\"EnumerateDevices\""); + AddProp(ss, "audio_input", ToString_PP_Resource(audio_input)); + AddProp(ss, "output", ToString_PP_ArrayOutput(output)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_AudioInput_Dev_0_3*)RealGetInterface("PPB_AudioInput(Dev);0.3"))->EnumerateDevices(audio_input, output, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t MonitorDeviceChange_0_3(PP_Resource audio_input, PP_MonitorDeviceChangeCallback callback, void* user_data) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_AudioInput_Dev\""); + AddProp(ss, "__version", "\"0.3\""); + AddProp(ss, "__method", "\"MonitorDeviceChange\""); + AddProp(ss, "audio_input", ToString_PP_Resource(audio_input)); + AddProp(ss, "callback", ToString_PP_MonitorDeviceChangeCallback(callback)); + AddProp(ss, "user_data", ToString_mem_t(user_data)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_AudioInput_Dev_0_3*)RealGetInterface("PPB_AudioInput(Dev);0.3"))->MonitorDeviceChange(audio_input, callback, user_data); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t Open_0_3(PP_Resource audio_input, PP_Resource device_ref, PP_Resource config, PPB_AudioInput_Callback_0_3 audio_input_callback, void* user_data, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_AudioInput_Dev\""); + AddProp(ss, "__version", "\"0.3\""); + AddProp(ss, "__method", "\"Open\""); + AddProp(ss, "audio_input", ToString_PP_Resource(audio_input)); + AddProp(ss, "device_ref", ToString_PP_Resource(device_ref)); + AddProp(ss, "config", ToString_PP_Resource(config)); + AddProp(ss, "audio_input_callback", ToString_PPB_AudioInput_Callback(audio_input_callback)); + AddProp(ss, "user_data", ToString_mem_t(user_data)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_AudioInput_Dev_0_3*)RealGetInterface("PPB_AudioInput(Dev);0.3"))->Open(audio_input, device_ref, config, audio_input_callback, user_data, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Resource GetCurrentConfig_0_3(PP_Resource audio_input) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_AudioInput_Dev\""); + AddProp(ss, "__version", "\"0.3\""); + AddProp(ss, "__method", "\"GetCurrentConfig\""); + AddProp(ss, "audio_input", ToString_PP_Resource(audio_input)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Resource(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_AudioInput_Dev_0_3*)RealGetInterface("PPB_AudioInput(Dev);0.3"))->GetCurrentConfig(audio_input); + printf("RPC response: ["); + printf("%s", ToString_PP_Resource(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool StartCapture_0_3(PP_Resource audio_input) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_AudioInput_Dev\""); + AddProp(ss, "__version", "\"0.3\""); + AddProp(ss, "__method", "\"StartCapture\""); + AddProp(ss, "audio_input", ToString_PP_Resource(audio_input)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_AudioInput_Dev_0_3*)RealGetInterface("PPB_AudioInput(Dev);0.3"))->StartCapture(audio_input); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool StopCapture_0_3(PP_Resource audio_input) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_AudioInput_Dev\""); + AddProp(ss, "__version", "\"0.3\""); + AddProp(ss, "__method", "\"StopCapture\""); + AddProp(ss, "audio_input", ToString_PP_Resource(audio_input)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_AudioInput_Dev_0_3*)RealGetInterface("PPB_AudioInput(Dev);0.3"))->StopCapture(audio_input); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static void Close_0_3(PP_Resource audio_input) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_AudioInput_Dev\""); + AddProp(ss, "__version", "\"0.3\""); + AddProp(ss, "__method", "\"Close\""); + AddProp(ss, "audio_input", ToString_PP_Resource(audio_input)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_AudioInput_Dev_0_3*)RealGetInterface("PPB_AudioInput(Dev);0.3"))->Close(audio_input); +#endif // !INTERPOSE +} +} +static PPB_AudioInput_Dev_0_3 _PPB_AudioInput_Dev_0_3 = { + ns_PPB_AudioInput_Dev_0_3::Create_0_3, + ns_PPB_AudioInput_Dev_0_3::IsAudioInput_0_3, + ns_PPB_AudioInput_Dev_0_3::EnumerateDevices_0_3, + ns_PPB_AudioInput_Dev_0_3::MonitorDeviceChange_0_3, + ns_PPB_AudioInput_Dev_0_3::Open_0_3, + ns_PPB_AudioInput_Dev_0_3::GetCurrentConfig_0_3, + ns_PPB_AudioInput_Dev_0_3::StartCapture_0_3, + ns_PPB_AudioInput_Dev_0_3::StopCapture_0_3, + ns_PPB_AudioInput_Dev_0_3::Close_0_3, +}; +const string ToString_PPB_AudioInput_Dev(const PPB_AudioInput_Dev_0_3 *v) { + stringstream s; + s << v; + return s.str(); +} +namespace ns_PPB_AudioInput_Dev_0_4 { +static PP_Resource Create_0_4(PP_Instance instance) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_AudioInput_Dev\""); + AddProp(ss, "__version", "\"0.4\""); + AddProp(ss, "__method", "\"Create\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Resource(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_AudioInput_Dev_0_4*)RealGetInterface("PPB_AudioInput(Dev);0.4"))->Create(instance); + printf("RPC response: ["); + printf("%s", ToString_PP_Resource(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool IsAudioInput_0_4(PP_Resource resource) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_AudioInput_Dev\""); + AddProp(ss, "__version", "\"0.4\""); + AddProp(ss, "__method", "\"IsAudioInput\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_AudioInput_Dev_0_4*)RealGetInterface("PPB_AudioInput(Dev);0.4"))->IsAudioInput(resource); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t EnumerateDevices_0_4(PP_Resource audio_input, struct PP_ArrayOutput output, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_AudioInput_Dev\""); + AddProp(ss, "__version", "\"0.4\""); + AddProp(ss, "__method", "\"EnumerateDevices\""); + AddProp(ss, "audio_input", ToString_PP_Resource(audio_input)); + AddProp(ss, "output", ToString_PP_ArrayOutput(output)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_AudioInput_Dev_0_4*)RealGetInterface("PPB_AudioInput(Dev);0.4"))->EnumerateDevices(audio_input, output, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t MonitorDeviceChange_0_4(PP_Resource audio_input, PP_MonitorDeviceChangeCallback callback, void* user_data) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_AudioInput_Dev\""); + AddProp(ss, "__version", "\"0.4\""); + AddProp(ss, "__method", "\"MonitorDeviceChange\""); + AddProp(ss, "audio_input", ToString_PP_Resource(audio_input)); + AddProp(ss, "callback", ToString_PP_MonitorDeviceChangeCallback(callback)); + AddProp(ss, "user_data", ToString_mem_t(user_data)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_AudioInput_Dev_0_4*)RealGetInterface("PPB_AudioInput(Dev);0.4"))->MonitorDeviceChange(audio_input, callback, user_data); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t Open_0_4(PP_Resource audio_input, PP_Resource device_ref, PP_Resource config, PPB_AudioInput_Callback audio_input_callback, void* user_data, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_AudioInput_Dev\""); + AddProp(ss, "__version", "\"0.4\""); + AddProp(ss, "__method", "\"Open\""); + AddProp(ss, "audio_input", ToString_PP_Resource(audio_input)); + AddProp(ss, "device_ref", ToString_PP_Resource(device_ref)); + AddProp(ss, "config", ToString_PP_Resource(config)); + AddProp(ss, "audio_input_callback", ToString_PPB_AudioInput_Callback(audio_input_callback)); + AddProp(ss, "user_data", ToString_mem_t(user_data)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_AudioInput_Dev_0_4*)RealGetInterface("PPB_AudioInput(Dev);0.4"))->Open(audio_input, device_ref, config, audio_input_callback, user_data, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Resource GetCurrentConfig_0_4(PP_Resource audio_input) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_AudioInput_Dev\""); + AddProp(ss, "__version", "\"0.4\""); + AddProp(ss, "__method", "\"GetCurrentConfig\""); + AddProp(ss, "audio_input", ToString_PP_Resource(audio_input)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Resource(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_AudioInput_Dev_0_4*)RealGetInterface("PPB_AudioInput(Dev);0.4"))->GetCurrentConfig(audio_input); + printf("RPC response: ["); + printf("%s", ToString_PP_Resource(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool StartCapture_0_4(PP_Resource audio_input) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_AudioInput_Dev\""); + AddProp(ss, "__version", "\"0.4\""); + AddProp(ss, "__method", "\"StartCapture\""); + AddProp(ss, "audio_input", ToString_PP_Resource(audio_input)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_AudioInput_Dev_0_4*)RealGetInterface("PPB_AudioInput(Dev);0.4"))->StartCapture(audio_input); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool StopCapture_0_4(PP_Resource audio_input) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_AudioInput_Dev\""); + AddProp(ss, "__version", "\"0.4\""); + AddProp(ss, "__method", "\"StopCapture\""); + AddProp(ss, "audio_input", ToString_PP_Resource(audio_input)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_AudioInput_Dev_0_4*)RealGetInterface("PPB_AudioInput(Dev);0.4"))->StopCapture(audio_input); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static void Close_0_4(PP_Resource audio_input) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_AudioInput_Dev\""); + AddProp(ss, "__version", "\"0.4\""); + AddProp(ss, "__method", "\"Close\""); + AddProp(ss, "audio_input", ToString_PP_Resource(audio_input)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_AudioInput_Dev_0_4*)RealGetInterface("PPB_AudioInput(Dev);0.4"))->Close(audio_input); +#endif // !INTERPOSE +} +} +static PPB_AudioInput_Dev_0_4 _PPB_AudioInput_Dev_0_4 = { + ns_PPB_AudioInput_Dev_0_4::Create_0_4, + ns_PPB_AudioInput_Dev_0_4::IsAudioInput_0_4, + ns_PPB_AudioInput_Dev_0_4::EnumerateDevices_0_4, + ns_PPB_AudioInput_Dev_0_4::MonitorDeviceChange_0_4, + ns_PPB_AudioInput_Dev_0_4::Open_0_4, + ns_PPB_AudioInput_Dev_0_4::GetCurrentConfig_0_4, + ns_PPB_AudioInput_Dev_0_4::StartCapture_0_4, + ns_PPB_AudioInput_Dev_0_4::StopCapture_0_4, + ns_PPB_AudioInput_Dev_0_4::Close_0_4, +}; +const string ToString_PPB_AudioInput_Dev(const PPB_AudioInput_Dev_0_4 *v) { + stringstream s; + s << v; + return s.str(); +} +namespace ns_PPB_Buffer_Dev_0_4 { +static PP_Resource Create_0_4(PP_Instance instance, uint32_t size_in_bytes) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Buffer_Dev\""); + AddProp(ss, "__version", "\"0.4\""); + AddProp(ss, "__method", "\"Create\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "size_in_bytes", ToString_uint32_t(size_in_bytes)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Resource(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_Buffer_Dev_0_4*)RealGetInterface("PPB_Buffer(Dev);0.4"))->Create(instance, size_in_bytes); + printf("RPC response: ["); + printf("%s", ToString_PP_Resource(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool IsBuffer_0_4(PP_Resource resource) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Buffer_Dev\""); + AddProp(ss, "__version", "\"0.4\""); + AddProp(ss, "__method", "\"IsBuffer\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_Buffer_Dev_0_4*)RealGetInterface("PPB_Buffer(Dev);0.4"))->IsBuffer(resource); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool Describe_0_4(PP_Resource resource, uint32_t* size_in_bytes) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Buffer_Dev\""); + AddProp(ss, "__version", "\"0.4\""); + AddProp(ss, "__method", "\"Describe\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + AddProp(ss, "size_in_bytes", PointerToString(size_in_bytes)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + iterator.skip(); + FromJSON_uint32_t(iterator, *size_in_bytes); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_Buffer_Dev_0_4*)RealGetInterface("PPB_Buffer(Dev);0.4"))->Describe(resource, size_in_bytes); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + if (!!size_in_bytes) { + AddProp(os, "size_in_bytes", ToString_uint32_t(size_in_bytes)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static void* Map_0_4(PP_Resource resource) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Buffer_Dev\""); + AddProp(ss, "__version", "\"0.4\""); + AddProp(ss, "__method", "\"Map\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + void* rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_mem_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + void* rval = ((PPB_Buffer_Dev_0_4*)RealGetInterface("PPB_Buffer(Dev);0.4"))->Map(resource); + printf("RPC response: ["); + printf("%s", ToString_mem_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static void Unmap_0_4(PP_Resource resource) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Buffer_Dev\""); + AddProp(ss, "__version", "\"0.4\""); + AddProp(ss, "__method", "\"Unmap\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_Buffer_Dev_0_4*)RealGetInterface("PPB_Buffer(Dev);0.4"))->Unmap(resource); +#endif // !INTERPOSE +} +} +static PPB_Buffer_Dev_0_4 _PPB_Buffer_Dev_0_4 = { + ns_PPB_Buffer_Dev_0_4::Create_0_4, + ns_PPB_Buffer_Dev_0_4::IsBuffer_0_4, + ns_PPB_Buffer_Dev_0_4::Describe_0_4, + ns_PPB_Buffer_Dev_0_4::Map_0_4, + ns_PPB_Buffer_Dev_0_4::Unmap_0_4, +}; +const string ToString_PPB_Buffer_Dev(const PPB_Buffer_Dev_0_4 *v) { + stringstream s; + s << v; + return s.str(); +} +const string ToString_PP_CharSet_ConversionError(const PP_CharSet_ConversionError *v) { + switch (*v) { + case 0: + return "\"PP_CHARSET_CONVERSIONERROR_FAIL\""; + case 1: + return "\"PP_CHARSET_CONVERSIONERROR_SKIP\""; + case 2: + return "\"PP_CHARSET_CONVERSIONERROR_SUBSTITUTE\""; + default: + return "\"???\""; + } +} +const string ToString_PP_CharSet_ConversionError(const PP_CharSet_ConversionError &v) { + return ToString_PP_CharSet_ConversionError(&v); +} +void FromJSON_PP_CharSet_ConversionError(JSONIterator& iterator, PP_CharSet_ConversionError &value) { + long int v; + FromJSON_int(iterator, v); + value = PP_CharSet_ConversionError(v); +} +namespace ns_PPB_CharSet_Dev_0_4 { +static const char* UTF16ToCharSet_0_4(PP_Instance instance, const uint16_t utf16[], uint32_t utf16_len, const char* output_char_set, PP_CharSet_ConversionError on_error, uint32_t* output_length) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_CharSet_Dev\""); + AddProp(ss, "__version", "\"0.4\""); + AddProp(ss, "__method", "\"UTF16ToCharSet\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + { + BeginProp(ss, "utf16"); + BeginElements(ss); + for (uint32_t _n = 0; _n < utf16_len; ++_n) { + AddElement(ss, ToString_uint16_t(utf16[_n])); + } + EndElements(ss); + } + AddProp(ss, "utf16_len", ToString_uint32_t(utf16_len)); + AddProp(ss, "output_char_set", ToString_str_t(output_char_set)); + AddProp(ss, "on_error", ToString_PP_CharSet_ConversionError(on_error)); + AddProp(ss, "output_length", PointerToString(output_length)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + char* rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_str_t(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + iterator.skip(); + FromJSON_uint32_t(iterator, *output_length); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + const char* rval = ((PPB_CharSet_Dev_0_4*)RealGetInterface("PPB_CharSet(Dev);0.4"))->UTF16ToCharSet(instance, utf16, utf16_len, output_char_set, on_error, output_length); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_str_t(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + if (!!output_length) { + AddProp(os, "output_length", ToString_uint32_t(output_length)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static uint16_ptr_t CharSetToUTF16_0_4(PP_Instance instance, const char* input, uint32_t input_len, const char* input_char_set, PP_CharSet_ConversionError on_error, uint32_t* output_utf16_length) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_CharSet_Dev\""); + AddProp(ss, "__version", "\"0.4\""); + AddProp(ss, "__method", "\"CharSetToUTF16\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + { + BeginProp(ss, "input"); + BeginElements(ss); + for (uint32_t _n = 0; _n < input_len; ++_n) { + AddElement(ss, ToString_uint8_t(input[_n])); + } + EndElements(ss); + } + AddProp(ss, "input_len", ToString_uint32_t(input_len)); + AddProp(ss, "input_char_set", ToString_str_t(input_char_set)); + AddProp(ss, "on_error", ToString_PP_CharSet_ConversionError(on_error)); + AddProp(ss, "output_utf16_length", PointerToString(output_utf16_length)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + uint16_ptr_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + size_t length = iterator.expectArrayAndGotoFirstItem(); + rval = new uint16_t[length]; + for (size_t i = 0; i < length; ++i) { + FromJSON_uint16_t(iterator, rval[i]); + } + iterator.expectObjectAndGotoFirstProperty(); + iterator.skip(); + FromJSON_uint32_t(iterator, *output_utf16_length); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + uint16_ptr_t rval = ((PPB_CharSet_Dev_0_4*)RealGetInterface("PPB_CharSet(Dev);0.4"))->CharSetToUTF16(instance, input, input_len, input_char_set, on_error, output_utf16_length); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_uint16_ptr_t(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + if (!!output_utf16_length) { + AddProp(os, "output_utf16_length", ToString_uint32_t(output_utf16_length)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static struct PP_Var GetDefaultCharSet_0_4(PP_Instance instance) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_CharSet_Dev\""); + AddProp(ss, "__version", "\"0.4\""); + AddProp(ss, "__method", "\"GetDefaultCharSet\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + struct PP_Var rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Var(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + struct PP_Var rval = ((PPB_CharSet_Dev_0_4*)RealGetInterface("PPB_CharSet(Dev);0.4"))->GetDefaultCharSet(instance); + printf("RPC response: ["); + printf("%s", ToString_PP_Var(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +} +static PPB_CharSet_Dev_0_4 _PPB_CharSet_Dev_0_4 = { + ns_PPB_CharSet_Dev_0_4::UTF16ToCharSet_0_4, + ns_PPB_CharSet_Dev_0_4::CharSetToUTF16_0_4, + ns_PPB_CharSet_Dev_0_4::GetDefaultCharSet_0_4, +}; +const string ToString_PPB_CharSet_Dev(const PPB_CharSet_Dev_0_4 *v) { + stringstream s; + s << v; + return s.str(); +} +namespace ns_PPB_Crypto_Dev_0_1 { +static void GetRandomBytes_0_1(char* buffer, uint32_t num_bytes) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Crypto_Dev\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"GetRandomBytes\""); + AddProp(ss, "buffer", PointerToString(buffer)); + AddProp(ss, "num_bytes", ToString_uint32_t(num_bytes)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectObjectAndGotoFirstProperty(); + iterator.skip(); + FromJSON_str_t(iterator, buffer); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_Crypto_Dev_0_1*)RealGetInterface("PPB_Crypto(Dev);0.1"))->GetRandomBytes(buffer, num_bytes); + printf("RPC response: ["); + printf("["); + std::stringstream os; + BeginProps(os); + AddProp(os, "buffer", ToString_str_t(buffer)); + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); +#endif // !INTERPOSE +} +} +static PPB_Crypto_Dev_0_1 _PPB_Crypto_Dev_0_1 = { + ns_PPB_Crypto_Dev_0_1::GetRandomBytes_0_1, +}; +const string ToString_PPB_Crypto_Dev(const PPB_Crypto_Dev_0_1 *v) { + stringstream s; + s << v; + return s.str(); +} +namespace ns_PPB_CursorControl_Dev_0_4 { +static PP_Bool SetCursor_0_4(PP_Instance instance, enum PP_CursorType_Dev type, PP_Resource custom_image, const struct PP_Point* hot_spot) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_CursorControl_Dev\""); + AddProp(ss, "__version", "\"0.4\""); + AddProp(ss, "__method", "\"SetCursor\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "type", ToString_PP_CursorType_Dev(type)); + AddProp(ss, "custom_image", ToString_PP_Resource(custom_image)); + AddProp(ss, "hot_spot", ToString_PP_Point(hot_spot)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_CursorControl_Dev_0_4*)RealGetInterface("PPB_CursorControl(Dev);0.4"))->SetCursor(instance, type, custom_image, hot_spot); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool LockCursor_0_4(PP_Instance instance) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_CursorControl_Dev\""); + AddProp(ss, "__version", "\"0.4\""); + AddProp(ss, "__method", "\"LockCursor\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_CursorControl_Dev_0_4*)RealGetInterface("PPB_CursorControl(Dev);0.4"))->LockCursor(instance); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool UnlockCursor_0_4(PP_Instance instance) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_CursorControl_Dev\""); + AddProp(ss, "__version", "\"0.4\""); + AddProp(ss, "__method", "\"UnlockCursor\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_CursorControl_Dev_0_4*)RealGetInterface("PPB_CursorControl(Dev);0.4"))->UnlockCursor(instance); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool HasCursorLock_0_4(PP_Instance instance) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_CursorControl_Dev\""); + AddProp(ss, "__version", "\"0.4\""); + AddProp(ss, "__method", "\"HasCursorLock\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_CursorControl_Dev_0_4*)RealGetInterface("PPB_CursorControl(Dev);0.4"))->HasCursorLock(instance); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool CanLockCursor_0_4(PP_Instance instance) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_CursorControl_Dev\""); + AddProp(ss, "__version", "\"0.4\""); + AddProp(ss, "__method", "\"CanLockCursor\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_CursorControl_Dev_0_4*)RealGetInterface("PPB_CursorControl(Dev);0.4"))->CanLockCursor(instance); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +} +static PPB_CursorControl_Dev_0_4 _PPB_CursorControl_Dev_0_4 = { + ns_PPB_CursorControl_Dev_0_4::SetCursor_0_4, + ns_PPB_CursorControl_Dev_0_4::LockCursor_0_4, + ns_PPB_CursorControl_Dev_0_4::UnlockCursor_0_4, + ns_PPB_CursorControl_Dev_0_4::HasCursorLock_0_4, + ns_PPB_CursorControl_Dev_0_4::CanLockCursor_0_4, +}; +const string ToString_PPB_CursorControl_Dev(const PPB_CursorControl_Dev_0_4 *v) { + stringstream s; + s << v; + return s.str(); +} +const string ToString_PP_MonitorDeviceChangeCallback(const PP_MonitorDeviceChangeCallback &v) { + return PointerToString(v); +} +void FromJSON_PP_MonitorDeviceChangeCallback(JSONIterator& iterator, PP_MonitorDeviceChangeCallback &value) { + PointerValueFromJSON(iterator, value); +} +const string ToString_PP_DeviceType_Dev(const PP_DeviceType_Dev *v) { + switch (*v) { + case 0: + return "\"PP_DEVICETYPE_DEV_INVALID\""; + case 1: + return "\"PP_DEVICETYPE_DEV_AUDIOCAPTURE\""; + case 2: + return "\"PP_DEVICETYPE_DEV_VIDEOCAPTURE\""; + default: + return "\"???\""; + } +} +const string ToString_PP_DeviceType_Dev(const PP_DeviceType_Dev &v) { + return ToString_PP_DeviceType_Dev(&v); +} +void FromJSON_PP_DeviceType_Dev(JSONIterator& iterator, PP_DeviceType_Dev &value) { + long int v; + FromJSON_int(iterator, v); + value = PP_DeviceType_Dev(v); +} +namespace ns_PPB_DeviceRef_Dev_0_1 { +static PP_Bool IsDeviceRef_0_1(PP_Resource resource) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_DeviceRef_Dev\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"IsDeviceRef\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_DeviceRef_Dev_0_1*)RealGetInterface("PPB_DeviceRef(Dev);0.1"))->IsDeviceRef(resource); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_DeviceType_Dev GetType_0_1(PP_Resource device_ref) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_DeviceRef_Dev\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"GetType\""); + AddProp(ss, "device_ref", ToString_PP_Resource(device_ref)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_DeviceType_Dev rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_DeviceType_Dev(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_DeviceType_Dev rval = ((PPB_DeviceRef_Dev_0_1*)RealGetInterface("PPB_DeviceRef(Dev);0.1"))->GetType(device_ref); + printf("RPC response: ["); + printf("%s", ToString_PP_DeviceType_Dev(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static struct PP_Var GetName_0_1(PP_Resource device_ref) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_DeviceRef_Dev\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"GetName\""); + AddProp(ss, "device_ref", ToString_PP_Resource(device_ref)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + struct PP_Var rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Var(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + struct PP_Var rval = ((PPB_DeviceRef_Dev_0_1*)RealGetInterface("PPB_DeviceRef(Dev);0.1"))->GetName(device_ref); + printf("RPC response: ["); + printf("%s", ToString_PP_Var(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +} +static PPB_DeviceRef_Dev_0_1 _PPB_DeviceRef_Dev_0_1 = { + ns_PPB_DeviceRef_Dev_0_1::IsDeviceRef_0_1, + ns_PPB_DeviceRef_Dev_0_1::GetType_0_1, + ns_PPB_DeviceRef_Dev_0_1::GetName_0_1, +}; +const string ToString_PPB_DeviceRef_Dev(const PPB_DeviceRef_Dev_0_1 *v) { + stringstream s; + s << v; + return s.str(); +} +const string ToString_PP_FileChooserMode_Dev(const PP_FileChooserMode_Dev *v) { + switch (*v) { + case 0: + return "\"PP_FILECHOOSERMODE_OPEN\""; + case 1: + return "\"PP_FILECHOOSERMODE_OPENMULTIPLE\""; + default: + return "\"???\""; + } +} +const string ToString_PP_FileChooserMode_Dev(const PP_FileChooserMode_Dev &v) { + return ToString_PP_FileChooserMode_Dev(&v); +} +void FromJSON_PP_FileChooserMode_Dev(JSONIterator& iterator, PP_FileChooserMode_Dev &value) { + long int v; + FromJSON_int(iterator, v); + value = PP_FileChooserMode_Dev(v); +} +namespace ns_PPB_FileChooser_Dev_0_5 { +static PP_Resource Create_0_5(PP_Instance instance, PP_FileChooserMode_Dev mode, struct PP_Var accept_types) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_FileChooser_Dev\""); + AddProp(ss, "__version", "\"0.5\""); + AddProp(ss, "__method", "\"Create\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "mode", ToString_PP_FileChooserMode_Dev(mode)); + AddProp(ss, "accept_types", ToString_PP_Var(accept_types)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Resource(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_FileChooser_Dev_0_5*)RealGetInterface("PPB_FileChooser(Dev);0.5"))->Create(instance, mode, accept_types); + printf("RPC response: ["); + printf("%s", ToString_PP_Resource(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool IsFileChooser_0_5(PP_Resource resource) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_FileChooser_Dev\""); + AddProp(ss, "__version", "\"0.5\""); + AddProp(ss, "__method", "\"IsFileChooser\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_FileChooser_Dev_0_5*)RealGetInterface("PPB_FileChooser(Dev);0.5"))->IsFileChooser(resource); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t Show_0_5(PP_Resource chooser, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_FileChooser_Dev\""); + AddProp(ss, "__version", "\"0.5\""); + AddProp(ss, "__method", "\"Show\""); + AddProp(ss, "chooser", ToString_PP_Resource(chooser)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_FileChooser_Dev_0_5*)RealGetInterface("PPB_FileChooser(Dev);0.5"))->Show(chooser, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Resource GetNextChosenFile_0_5(PP_Resource chooser) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_FileChooser_Dev\""); + AddProp(ss, "__version", "\"0.5\""); + AddProp(ss, "__method", "\"GetNextChosenFile\""); + AddProp(ss, "chooser", ToString_PP_Resource(chooser)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Resource(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_FileChooser_Dev_0_5*)RealGetInterface("PPB_FileChooser(Dev);0.5"))->GetNextChosenFile(chooser); + printf("RPC response: ["); + printf("%s", ToString_PP_Resource(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +/* skipping Show */ +} +static PPB_FileChooser_Dev_0_5 _PPB_FileChooser_Dev_0_5 = { + ns_PPB_FileChooser_Dev_0_5::Create_0_5, + ns_PPB_FileChooser_Dev_0_5::IsFileChooser_0_5, + ns_PPB_FileChooser_Dev_0_5::Show_0_5, + ns_PPB_FileChooser_Dev_0_5::GetNextChosenFile_0_5, +}; +const string ToString_PPB_FileChooser_Dev(const PPB_FileChooser_Dev_0_5 *v) { + stringstream s; + s << v; + return s.str(); +} +namespace ns_PPB_FileChooser_Dev_0_6 { +static PP_Resource Create_0_6(PP_Instance instance, PP_FileChooserMode_Dev mode, struct PP_Var accept_types) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_FileChooser_Dev\""); + AddProp(ss, "__version", "\"0.6\""); + AddProp(ss, "__method", "\"Create\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "mode", ToString_PP_FileChooserMode_Dev(mode)); + AddProp(ss, "accept_types", ToString_PP_Var(accept_types)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Resource(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_FileChooser_Dev_0_6*)RealGetInterface("PPB_FileChooser(Dev);0.6"))->Create(instance, mode, accept_types); + printf("RPC response: ["); + printf("%s", ToString_PP_Resource(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool IsFileChooser_0_6(PP_Resource resource) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_FileChooser_Dev\""); + AddProp(ss, "__version", "\"0.6\""); + AddProp(ss, "__method", "\"IsFileChooser\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_FileChooser_Dev_0_6*)RealGetInterface("PPB_FileChooser(Dev);0.6"))->IsFileChooser(resource); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +/* skipping Show */ +/* skipping GetNextChosenFile */ +static int32_t Show_0_6(PP_Resource chooser, struct PP_ArrayOutput output, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_FileChooser_Dev\""); + AddProp(ss, "__version", "\"0.6\""); + AddProp(ss, "__method", "\"Show\""); + AddProp(ss, "chooser", ToString_PP_Resource(chooser)); + AddProp(ss, "output", ToString_PP_ArrayOutput(output)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_FileChooser_Dev_0_6*)RealGetInterface("PPB_FileChooser(Dev);0.6"))->Show(chooser, output, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +} +static PPB_FileChooser_Dev_0_6 _PPB_FileChooser_Dev_0_6 = { + ns_PPB_FileChooser_Dev_0_6::Create_0_6, + ns_PPB_FileChooser_Dev_0_6::IsFileChooser_0_6, + ns_PPB_FileChooser_Dev_0_6::Show_0_6, +}; +const string ToString_PPB_FileChooser_Dev(const PPB_FileChooser_Dev_0_6 *v) { + stringstream s; + s << v; + return s.str(); +} +const string ToString_PP_FontFamily_Dev(const PP_FontFamily_Dev *v) { + switch (*v) { + case 0: + return "\"PP_FONTFAMILY_DEFAULT\""; + case 1: + return "\"PP_FONTFAMILY_SERIF\""; + case 2: + return "\"PP_FONTFAMILY_SANSSERIF\""; + case 3: + return "\"PP_FONTFAMILY_MONOSPACE\""; + default: + return "\"???\""; + } +} +const string ToString_PP_FontFamily_Dev(const PP_FontFamily_Dev &v) { + return ToString_PP_FontFamily_Dev(&v); +} +void FromJSON_PP_FontFamily_Dev(JSONIterator& iterator, PP_FontFamily_Dev &value) { + long int v; + FromJSON_int(iterator, v); + value = PP_FontFamily_Dev(v); +} +const string ToString_PP_FontWeight_Dev(const PP_FontWeight_Dev *v) { + switch (*v) { + case 0: + return "\"PP_FONTWEIGHT_100\""; + case 1: + return "\"PP_FONTWEIGHT_200\""; + case 2: + return "\"PP_FONTWEIGHT_300\""; + case 3: + return "\"PP_FONTWEIGHT_400\""; + case 4: + return "\"PP_FONTWEIGHT_500\""; + case 5: + return "\"PP_FONTWEIGHT_600\""; + case 6: + return "\"PP_FONTWEIGHT_700\""; + case 7: + return "\"PP_FONTWEIGHT_800\""; + case 8: + return "\"PP_FONTWEIGHT_900\""; + default: + return "\"???\""; + } +} +const string ToString_PP_FontWeight_Dev(const PP_FontWeight_Dev &v) { + return ToString_PP_FontWeight_Dev(&v); +} +void FromJSON_PP_FontWeight_Dev(JSONIterator& iterator, PP_FontWeight_Dev &value) { + long int v; + FromJSON_int(iterator, v); + value = PP_FontWeight_Dev(v); +} +const string ToString_PP_FontDescription_Dev(const PP_FontDescription_Dev *v) { + if (!v) { + return "null"; + } + return ToString_PP_FontDescription_Dev(*v); +} +const string ToString_PP_FontDescription_Dev(const PP_FontDescription_Dev &v) { + stringstream x; + BeginProps(x); + AddProp(x, "face", ToString_PP_Var(v.face)); + AddProp(x, "family", ToString_PP_FontFamily_Dev(v.family)); + AddProp(x, "size", ToString_uint32_t(v.size)); + AddProp(x, "weight", ToString_PP_FontWeight_Dev(v.weight)); + AddProp(x, "italic", ToString_PP_Bool(v.italic)); + AddProp(x, "small_caps", ToString_PP_Bool(v.small_caps)); + AddProp(x, "letter_spacing", ToString_int32_t(v.letter_spacing)); + AddProp(x, "word_spacing", ToString_int32_t(v.word_spacing)); + AddProp(x, "padding", ToString_int32_t(v.padding)); + EndProps(x); + return x.str(); +} +void FromJSON_PP_FontDescription_Dev(JSONIterator& iterator, PP_FontDescription_Dev &value) { + const JSON::Token& current = iterator.getCurrentAndGotoNext(); + if (current.isPrimitive() && !current.value().compare("null")) { + return; + } + if (!current.isObject()) { + Fail("Expected object!", ""); + } + iterator.skip(); + FromJSON_PP_Var(iterator, value.face); + iterator.skip(); + FromJSON_PP_FontFamily_Dev(iterator, value.family); + iterator.skip(); + FromJSON_uint32_t(iterator, value.size); + iterator.skip(); + FromJSON_PP_FontWeight_Dev(iterator, value.weight); + iterator.skip(); + FromJSON_PP_Bool(iterator, value.italic); + iterator.skip(); + FromJSON_PP_Bool(iterator, value.small_caps); + iterator.skip(); + FromJSON_int32_t(iterator, value.letter_spacing); + iterator.skip(); + FromJSON_int32_t(iterator, value.word_spacing); + iterator.skip(); + FromJSON_int32_t(iterator, value.padding); +} +const string ToString_PP_FontMetrics_Dev(const PP_FontMetrics_Dev *v) { + if (!v) { + return "null"; + } + return ToString_PP_FontMetrics_Dev(*v); +} +const string ToString_PP_FontMetrics_Dev(const PP_FontMetrics_Dev &v) { + stringstream x; + BeginProps(x); + AddProp(x, "height", ToString_int32_t(v.height)); + AddProp(x, "ascent", ToString_int32_t(v.ascent)); + AddProp(x, "descent", ToString_int32_t(v.descent)); + AddProp(x, "line_spacing", ToString_int32_t(v.line_spacing)); + AddProp(x, "x_height", ToString_int32_t(v.x_height)); + EndProps(x); + return x.str(); +} +void FromJSON_PP_FontMetrics_Dev(JSONIterator& iterator, PP_FontMetrics_Dev &value) { + const JSON::Token& current = iterator.getCurrentAndGotoNext(); + if (current.isPrimitive() && !current.value().compare("null")) { + return; + } + if (!current.isObject()) { + Fail("Expected object!", ""); + } + iterator.skip(); + FromJSON_int32_t(iterator, value.height); + iterator.skip(); + FromJSON_int32_t(iterator, value.ascent); + iterator.skip(); + FromJSON_int32_t(iterator, value.descent); + iterator.skip(); + FromJSON_int32_t(iterator, value.line_spacing); + iterator.skip(); + FromJSON_int32_t(iterator, value.x_height); +} +const string ToString_PP_TextRun_Dev(const PP_TextRun_Dev *v) { + if (!v) { + return "null"; + } + return ToString_PP_TextRun_Dev(*v); +} +const string ToString_PP_TextRun_Dev(const PP_TextRun_Dev &v) { + stringstream x; + BeginProps(x); + AddProp(x, "text", ToString_PP_Var(v.text)); + AddProp(x, "rtl", ToString_PP_Bool(v.rtl)); + AddProp(x, "override_direction", ToString_PP_Bool(v.override_direction)); + EndProps(x); + return x.str(); +} +void FromJSON_PP_TextRun_Dev(JSONIterator& iterator, PP_TextRun_Dev &value) { + const JSON::Token& current = iterator.getCurrentAndGotoNext(); + if (current.isPrimitive() && !current.value().compare("null")) { + return; + } + if (!current.isObject()) { + Fail("Expected object!", ""); + } + iterator.skip(); + FromJSON_PP_Var(iterator, value.text); + iterator.skip(); + FromJSON_PP_Bool(iterator, value.rtl); + iterator.skip(); + FromJSON_PP_Bool(iterator, value.override_direction); +} +namespace ns_PPB_Font_Dev_0_6 { +static struct PP_Var GetFontFamilies_0_6(PP_Instance instance) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Font_Dev\""); + AddProp(ss, "__version", "\"0.6\""); + AddProp(ss, "__method", "\"GetFontFamilies\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + struct PP_Var rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Var(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + struct PP_Var rval = ((PPB_Font_Dev_0_6*)RealGetInterface("PPB_Font(Dev);0.6"))->GetFontFamilies(instance); + printf("RPC response: ["); + printf("%s", ToString_PP_Var(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Resource Create_0_6(PP_Instance instance, const struct PP_FontDescription_Dev* description) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Font_Dev\""); + AddProp(ss, "__version", "\"0.6\""); + AddProp(ss, "__method", "\"Create\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "description", ToString_PP_FontDescription_Dev(description)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Resource(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_Font_Dev_0_6*)RealGetInterface("PPB_Font(Dev);0.6"))->Create(instance, description); + printf("RPC response: ["); + printf("%s", ToString_PP_Resource(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool IsFont_0_6(PP_Resource resource) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Font_Dev\""); + AddProp(ss, "__version", "\"0.6\""); + AddProp(ss, "__method", "\"IsFont\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_Font_Dev_0_6*)RealGetInterface("PPB_Font(Dev);0.6"))->IsFont(resource); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool Describe_0_6(PP_Resource font, struct PP_FontDescription_Dev* description, struct PP_FontMetrics_Dev* metrics) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Font_Dev\""); + AddProp(ss, "__version", "\"0.6\""); + AddProp(ss, "__method", "\"Describe\""); + AddProp(ss, "font", ToString_PP_Resource(font)); + AddProp(ss, "description", PointerToString(description)); + AddProp(ss, "metrics", PointerToString(metrics)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + if (!!description) { + iterator.skip(); + FromJSON_PP_FontDescription_Dev(iterator, *description); + } + if (!!metrics) { + iterator.skip(); + FromJSON_PP_FontMetrics_Dev(iterator, *metrics); + } + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_Font_Dev_0_6*)RealGetInterface("PPB_Font(Dev);0.6"))->Describe(font, description, metrics); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + if (!!description) { + AddProp(os, "description", ToString_PP_FontDescription_Dev(description)); + } + if (!!metrics) { + AddProp(os, "metrics", ToString_PP_FontMetrics_Dev(metrics)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool DrawTextAt_0_6(PP_Resource font, PP_Resource image_data, const struct PP_TextRun_Dev* text, const struct PP_Point* position, uint32_t color, const struct PP_Rect* clip, PP_Bool image_data_is_opaque) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Font_Dev\""); + AddProp(ss, "__version", "\"0.6\""); + AddProp(ss, "__method", "\"DrawTextAt\""); + AddProp(ss, "font", ToString_PP_Resource(font)); + AddProp(ss, "image_data", ToString_PP_Resource(image_data)); + AddProp(ss, "text", ToString_PP_TextRun_Dev(text)); + AddProp(ss, "position", ToString_PP_Point(position)); + AddProp(ss, "color", ToString_uint32_t(color)); + AddProp(ss, "clip", ToString_PP_Rect(clip)); + AddProp(ss, "image_data_is_opaque", ToString_PP_Bool(image_data_is_opaque)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_Font_Dev_0_6*)RealGetInterface("PPB_Font(Dev);0.6"))->DrawTextAt(font, image_data, text, position, color, clip, image_data_is_opaque); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t MeasureText_0_6(PP_Resource font, const struct PP_TextRun_Dev* text) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Font_Dev\""); + AddProp(ss, "__version", "\"0.6\""); + AddProp(ss, "__method", "\"MeasureText\""); + AddProp(ss, "font", ToString_PP_Resource(font)); + AddProp(ss, "text", ToString_PP_TextRun_Dev(text)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_Font_Dev_0_6*)RealGetInterface("PPB_Font(Dev);0.6"))->MeasureText(font, text); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static uint32_t CharacterOffsetForPixel_0_6(PP_Resource font, const struct PP_TextRun_Dev* text, int32_t pixel_position) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Font_Dev\""); + AddProp(ss, "__version", "\"0.6\""); + AddProp(ss, "__method", "\"CharacterOffsetForPixel\""); + AddProp(ss, "font", ToString_PP_Resource(font)); + AddProp(ss, "text", ToString_PP_TextRun_Dev(text)); + AddProp(ss, "pixel_position", ToString_int32_t(pixel_position)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + uint32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_uint32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + uint32_t rval = ((PPB_Font_Dev_0_6*)RealGetInterface("PPB_Font(Dev);0.6"))->CharacterOffsetForPixel(font, text, pixel_position); + printf("RPC response: ["); + printf("%s", ToString_uint32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t PixelOffsetForCharacter_0_6(PP_Resource font, const struct PP_TextRun_Dev* text, uint32_t char_offset) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Font_Dev\""); + AddProp(ss, "__version", "\"0.6\""); + AddProp(ss, "__method", "\"PixelOffsetForCharacter\""); + AddProp(ss, "font", ToString_PP_Resource(font)); + AddProp(ss, "text", ToString_PP_TextRun_Dev(text)); + AddProp(ss, "char_offset", ToString_uint32_t(char_offset)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_Font_Dev_0_6*)RealGetInterface("PPB_Font(Dev);0.6"))->PixelOffsetForCharacter(font, text, char_offset); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +} +static PPB_Font_Dev_0_6 _PPB_Font_Dev_0_6 = { + ns_PPB_Font_Dev_0_6::GetFontFamilies_0_6, + ns_PPB_Font_Dev_0_6::Create_0_6, + ns_PPB_Font_Dev_0_6::IsFont_0_6, + ns_PPB_Font_Dev_0_6::Describe_0_6, + ns_PPB_Font_Dev_0_6::DrawTextAt_0_6, + ns_PPB_Font_Dev_0_6::MeasureText_0_6, + ns_PPB_Font_Dev_0_6::CharacterOffsetForPixel_0_6, + ns_PPB_Font_Dev_0_6::PixelOffsetForCharacter_0_6, +}; +const string ToString_PPB_Font_Dev(const PPB_Font_Dev_0_6 *v) { + stringstream s; + s << v; + return s.str(); +} +namespace ns_PPB_IMEInputEvent_Dev_0_1 { +/* skipping Create */ +static PP_Bool IsIMEInputEvent_0_1(PP_Resource resource) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_IMEInputEvent_Dev\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"IsIMEInputEvent\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_IMEInputEvent_Dev_0_1*)RealGetInterface("PPB_IMEInputEvent(Dev);0.1"))->IsIMEInputEvent(resource); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static struct PP_Var GetText_0_1(PP_Resource ime_event) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_IMEInputEvent_Dev\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"GetText\""); + AddProp(ss, "ime_event", ToString_PP_Resource(ime_event)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + struct PP_Var rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Var(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + struct PP_Var rval = ((PPB_IMEInputEvent_Dev_0_1*)RealGetInterface("PPB_IMEInputEvent(Dev);0.1"))->GetText(ime_event); + printf("RPC response: ["); + printf("%s", ToString_PP_Var(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static uint32_t GetSegmentNumber_0_1(PP_Resource ime_event) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_IMEInputEvent_Dev\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"GetSegmentNumber\""); + AddProp(ss, "ime_event", ToString_PP_Resource(ime_event)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + uint32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_uint32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + uint32_t rval = ((PPB_IMEInputEvent_Dev_0_1*)RealGetInterface("PPB_IMEInputEvent(Dev);0.1"))->GetSegmentNumber(ime_event); + printf("RPC response: ["); + printf("%s", ToString_uint32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static uint32_t GetSegmentOffset_0_1(PP_Resource ime_event, uint32_t index) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_IMEInputEvent_Dev\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"GetSegmentOffset\""); + AddProp(ss, "ime_event", ToString_PP_Resource(ime_event)); + AddProp(ss, "index", ToString_uint32_t(index)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + uint32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_uint32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + uint32_t rval = ((PPB_IMEInputEvent_Dev_0_1*)RealGetInterface("PPB_IMEInputEvent(Dev);0.1"))->GetSegmentOffset(ime_event, index); + printf("RPC response: ["); + printf("%s", ToString_uint32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t GetTargetSegment_0_1(PP_Resource ime_event) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_IMEInputEvent_Dev\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"GetTargetSegment\""); + AddProp(ss, "ime_event", ToString_PP_Resource(ime_event)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_IMEInputEvent_Dev_0_1*)RealGetInterface("PPB_IMEInputEvent(Dev);0.1"))->GetTargetSegment(ime_event); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static void GetSelection_0_1(PP_Resource ime_event, uint32_t* start, uint32_t* end) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_IMEInputEvent_Dev\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"GetSelection\""); + AddProp(ss, "ime_event", ToString_PP_Resource(ime_event)); + AddProp(ss, "start", PointerToString(start)); + AddProp(ss, "end", PointerToString(end)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectObjectAndGotoFirstProperty(); + iterator.skip(); + FromJSON_uint32_t(iterator, *start); + iterator.skip(); + FromJSON_uint32_t(iterator, *end); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_IMEInputEvent_Dev_0_1*)RealGetInterface("PPB_IMEInputEvent(Dev);0.1"))->GetSelection(ime_event, start, end); + printf("RPC response: ["); + printf("["); + std::stringstream os; + BeginProps(os); + if (!!start) { + AddProp(os, "start", ToString_uint32_t(start)); + } + if (!!end) { + AddProp(os, "end", ToString_uint32_t(end)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); +#endif // !INTERPOSE +} +} +static PPB_IMEInputEvent_Dev_0_1 _PPB_IMEInputEvent_Dev_0_1 = { + ns_PPB_IMEInputEvent_Dev_0_1::IsIMEInputEvent_0_1, + ns_PPB_IMEInputEvent_Dev_0_1::GetText_0_1, + ns_PPB_IMEInputEvent_Dev_0_1::GetSegmentNumber_0_1, + ns_PPB_IMEInputEvent_Dev_0_1::GetSegmentOffset_0_1, + ns_PPB_IMEInputEvent_Dev_0_1::GetTargetSegment_0_1, + ns_PPB_IMEInputEvent_Dev_0_1::GetSelection_0_1, +}; +const string ToString_PPB_IMEInputEvent_Dev(const PPB_IMEInputEvent_Dev_0_1 *v) { + stringstream s; + s << v; + return s.str(); +} +namespace ns_PPB_IMEInputEvent_Dev_0_2 { +static PP_Resource Create_0_2(PP_Instance instance, PP_InputEvent_Type type, PP_TimeTicks time_stamp, struct PP_Var text, uint32_t segment_number, const uint32_t segment_offsets[], int32_t target_segment, uint32_t selection_start, uint32_t selection_end) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_IMEInputEvent_Dev\""); + AddProp(ss, "__version", "\"0.2\""); + AddProp(ss, "__method", "\"Create\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "type", ToString_PP_InputEvent_Type(type)); + AddProp(ss, "time_stamp", ToString_PP_TimeTicks(time_stamp)); + AddProp(ss, "text", ToString_PP_Var(text)); + AddProp(ss, "segment_number", ToString_uint32_t(segment_number)); + { + BeginProp(ss, "segment_offsets"); + BeginElements(ss); + for (uint32_t _n = 0; segment_offsets[_n] != 0; ++_n) { + AddElement(ss, ToString_uint32_t(segment_offsets[_n])); + } + EndElements(ss); + } + AddProp(ss, "target_segment", ToString_int32_t(target_segment)); + AddProp(ss, "selection_start", ToString_uint32_t(selection_start)); + AddProp(ss, "selection_end", ToString_uint32_t(selection_end)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Resource(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_IMEInputEvent_Dev_0_2*)RealGetInterface("PPB_IMEInputEvent(Dev);0.2"))->Create(instance, type, time_stamp, text, segment_number, segment_offsets, target_segment, selection_start, selection_end); + printf("RPC response: ["); + printf("%s", ToString_PP_Resource(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool IsIMEInputEvent_0_2(PP_Resource resource) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_IMEInputEvent_Dev\""); + AddProp(ss, "__version", "\"0.2\""); + AddProp(ss, "__method", "\"IsIMEInputEvent\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_IMEInputEvent_Dev_0_2*)RealGetInterface("PPB_IMEInputEvent(Dev);0.2"))->IsIMEInputEvent(resource); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static struct PP_Var GetText_0_2(PP_Resource ime_event) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_IMEInputEvent_Dev\""); + AddProp(ss, "__version", "\"0.2\""); + AddProp(ss, "__method", "\"GetText\""); + AddProp(ss, "ime_event", ToString_PP_Resource(ime_event)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + struct PP_Var rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Var(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + struct PP_Var rval = ((PPB_IMEInputEvent_Dev_0_2*)RealGetInterface("PPB_IMEInputEvent(Dev);0.2"))->GetText(ime_event); + printf("RPC response: ["); + printf("%s", ToString_PP_Var(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static uint32_t GetSegmentNumber_0_2(PP_Resource ime_event) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_IMEInputEvent_Dev\""); + AddProp(ss, "__version", "\"0.2\""); + AddProp(ss, "__method", "\"GetSegmentNumber\""); + AddProp(ss, "ime_event", ToString_PP_Resource(ime_event)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + uint32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_uint32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + uint32_t rval = ((PPB_IMEInputEvent_Dev_0_2*)RealGetInterface("PPB_IMEInputEvent(Dev);0.2"))->GetSegmentNumber(ime_event); + printf("RPC response: ["); + printf("%s", ToString_uint32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static uint32_t GetSegmentOffset_0_2(PP_Resource ime_event, uint32_t index) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_IMEInputEvent_Dev\""); + AddProp(ss, "__version", "\"0.2\""); + AddProp(ss, "__method", "\"GetSegmentOffset\""); + AddProp(ss, "ime_event", ToString_PP_Resource(ime_event)); + AddProp(ss, "index", ToString_uint32_t(index)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + uint32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_uint32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + uint32_t rval = ((PPB_IMEInputEvent_Dev_0_2*)RealGetInterface("PPB_IMEInputEvent(Dev);0.2"))->GetSegmentOffset(ime_event, index); + printf("RPC response: ["); + printf("%s", ToString_uint32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t GetTargetSegment_0_2(PP_Resource ime_event) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_IMEInputEvent_Dev\""); + AddProp(ss, "__version", "\"0.2\""); + AddProp(ss, "__method", "\"GetTargetSegment\""); + AddProp(ss, "ime_event", ToString_PP_Resource(ime_event)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_IMEInputEvent_Dev_0_2*)RealGetInterface("PPB_IMEInputEvent(Dev);0.2"))->GetTargetSegment(ime_event); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static void GetSelection_0_2(PP_Resource ime_event, uint32_t* start, uint32_t* end) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_IMEInputEvent_Dev\""); + AddProp(ss, "__version", "\"0.2\""); + AddProp(ss, "__method", "\"GetSelection\""); + AddProp(ss, "ime_event", ToString_PP_Resource(ime_event)); + AddProp(ss, "start", PointerToString(start)); + AddProp(ss, "end", PointerToString(end)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectObjectAndGotoFirstProperty(); + iterator.skip(); + FromJSON_uint32_t(iterator, *start); + iterator.skip(); + FromJSON_uint32_t(iterator, *end); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_IMEInputEvent_Dev_0_2*)RealGetInterface("PPB_IMEInputEvent(Dev);0.2"))->GetSelection(ime_event, start, end); + printf("RPC response: ["); + printf("["); + std::stringstream os; + BeginProps(os); + if (!!start) { + AddProp(os, "start", ToString_uint32_t(start)); + } + if (!!end) { + AddProp(os, "end", ToString_uint32_t(end)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); +#endif // !INTERPOSE +} +} +static PPB_IMEInputEvent_Dev_0_2 _PPB_IMEInputEvent_Dev_0_2 = { + ns_PPB_IMEInputEvent_Dev_0_2::Create_0_2, + ns_PPB_IMEInputEvent_Dev_0_2::IsIMEInputEvent_0_2, + ns_PPB_IMEInputEvent_Dev_0_2::GetText_0_2, + ns_PPB_IMEInputEvent_Dev_0_2::GetSegmentNumber_0_2, + ns_PPB_IMEInputEvent_Dev_0_2::GetSegmentOffset_0_2, + ns_PPB_IMEInputEvent_Dev_0_2::GetTargetSegment_0_2, + ns_PPB_IMEInputEvent_Dev_0_2::GetSelection_0_2, +}; +const string ToString_PPB_IMEInputEvent_Dev(const PPB_IMEInputEvent_Dev_0_2 *v) { + stringstream s; + s << v; + return s.str(); +} +namespace ns_PPB_Memory_Dev_0_1 { +static void* MemAlloc_0_1(uint32_t num_bytes) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Memory_Dev\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"MemAlloc\""); + AddProp(ss, "num_bytes", ToString_uint32_t(num_bytes)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + void* rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_mem_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + void* rval = ((PPB_Memory_Dev_0_1*)RealGetInterface("PPB_Memory(Dev);0.1"))->MemAlloc(num_bytes); + printf("RPC response: ["); + printf("%s", ToString_mem_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static void MemFree_0_1(void* ptr) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Memory_Dev\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"MemFree\""); + AddProp(ss, "ptr", ToString_mem_t(ptr)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_Memory_Dev_0_1*)RealGetInterface("PPB_Memory(Dev);0.1"))->MemFree(ptr); +#endif // !INTERPOSE +} +} +static PPB_Memory_Dev_0_1 _PPB_Memory_Dev_0_1 = { + ns_PPB_Memory_Dev_0_1::MemAlloc_0_1, + ns_PPB_Memory_Dev_0_1::MemFree_0_1, +}; +const string ToString_PPB_Memory_Dev(const PPB_Memory_Dev_0_1 *v) { + stringstream s; + s << v; + return s.str(); +} +namespace ns_PPB_OpenGLES2DrawBuffers_Dev_1_0 { +static void DrawBuffersEXT_1_0(PP_Resource context, GLsizei count, const GLenum* bufs) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OpenGLES2DrawBuffers_Dev\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"DrawBuffersEXT\""); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "count", ToString_GLsizei(count)); + AddProp(ss, "bufs", ToString_GLenum_ptr_t(bufs)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_OpenGLES2DrawBuffers_Dev_1_0*)RealGetInterface("PPB_OpenGLES2DrawBuffers(Dev);1.0"))->DrawBuffersEXT(context, count, bufs); +#endif // !INTERPOSE +} +} +static PPB_OpenGLES2DrawBuffers_Dev_1_0 _PPB_OpenGLES2DrawBuffers_Dev_1_0 = { + ns_PPB_OpenGLES2DrawBuffers_Dev_1_0::DrawBuffersEXT_1_0, +}; +const string ToString_PPB_OpenGLES2DrawBuffers_Dev(const PPB_OpenGLES2DrawBuffers_Dev_1_0 *v) { + stringstream s; + s << v; + return s.str(); +} +namespace ns_PPB_Printing_Dev_0_7 { +static PP_Resource Create_0_7(PP_Instance instance) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Printing_Dev\""); + AddProp(ss, "__version", "\"0.7\""); + AddProp(ss, "__method", "\"Create\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Resource(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_Printing_Dev_0_7*)RealGetInterface("PPB_Printing(Dev);0.7"))->Create(instance); + printf("RPC response: ["); + printf("%s", ToString_PP_Resource(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t GetDefaultPrintSettings_0_7(PP_Resource resource, struct PP_PrintSettings_Dev* print_settings, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Printing_Dev\""); + AddProp(ss, "__version", "\"0.7\""); + AddProp(ss, "__method", "\"GetDefaultPrintSettings\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + AddProp(ss, "print_settings", PointerToString(print_settings)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + if (!!print_settings) { + iterator.skip(); + FromJSON_PP_PrintSettings_Dev(iterator, *print_settings); + } + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_Printing_Dev_0_7*)RealGetInterface("PPB_Printing(Dev);0.7"))->GetDefaultPrintSettings(resource, print_settings, logging_callback); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_int32_t(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + if (!!print_settings) { + AddProp(os, "print_settings", ToString_PP_PrintSettings_Dev(print_settings)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +} +static PPB_Printing_Dev_0_7 _PPB_Printing_Dev_0_7 = { + ns_PPB_Printing_Dev_0_7::Create_0_7, + ns_PPB_Printing_Dev_0_7::GetDefaultPrintSettings_0_7, +}; +const string ToString_PPB_Printing_Dev(const PPB_Printing_Dev_0_7 *v) { + stringstream s; + s << v; + return s.str(); +} +const string ToString_PP_TextInput_Type_Dev(const PP_TextInput_Type_Dev *v) { + switch (*v) { + case 0: + return "\"PP_TEXTINPUT_TYPE_DEV_NONE\""; + case 1: + return "\"PP_TEXTINPUT_TYPE_DEV_TEXT\""; + case 2: + return "\"PP_TEXTINPUT_TYPE_DEV_PASSWORD\""; + case 3: + return "\"PP_TEXTINPUT_TYPE_DEV_SEARCH\""; + case 4: + return "\"PP_TEXTINPUT_TYPE_DEV_EMAIL\""; + case 5: + return "\"PP_TEXTINPUT_TYPE_DEV_NUMBER\""; + case 6: + return "\"PP_TEXTINPUT_TYPE_DEV_TELEPHONE\""; + case 7: + return "\"PP_TEXTINPUT_TYPE_DEV_URL\""; + default: + return "\"???\""; + } +} +const string ToString_PP_TextInput_Type_Dev(const PP_TextInput_Type_Dev &v) { + return ToString_PP_TextInput_Type_Dev(&v); +} +void FromJSON_PP_TextInput_Type_Dev(JSONIterator& iterator, PP_TextInput_Type_Dev &value) { + long int v; + FromJSON_int(iterator, v); + value = PP_TextInput_Type_Dev(v); +} +namespace ns_PPB_TextInput_Dev_0_1 { +static void SetTextInputType_0_1(PP_Instance instance, PP_TextInput_Type_Dev type) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_TextInput_Dev\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"SetTextInputType\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "type", ToString_PP_TextInput_Type_Dev(type)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_TextInput_Dev_0_1*)RealGetInterface("PPB_TextInput(Dev);0.1"))->SetTextInputType(instance, type); +#endif // !INTERPOSE +} +static void UpdateCaretPosition_0_1(PP_Instance instance, const struct PP_Rect* caret, const struct PP_Rect* bounding_box) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_TextInput_Dev\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"UpdateCaretPosition\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "caret", ToString_PP_Rect(caret)); + AddProp(ss, "bounding_box", ToString_PP_Rect(bounding_box)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_TextInput_Dev_0_1*)RealGetInterface("PPB_TextInput(Dev);0.1"))->UpdateCaretPosition(instance, caret, bounding_box); +#endif // !INTERPOSE +} +static void CancelCompositionText_0_1(PP_Instance instance) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_TextInput_Dev\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"CancelCompositionText\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_TextInput_Dev_0_1*)RealGetInterface("PPB_TextInput(Dev);0.1"))->CancelCompositionText(instance); +#endif // !INTERPOSE +} +/* skipping UpdateSurroundingText */ +/* skipping SelectionChanged */ +} +static PPB_TextInput_Dev_0_1 _PPB_TextInput_Dev_0_1 = { + ns_PPB_TextInput_Dev_0_1::SetTextInputType_0_1, + ns_PPB_TextInput_Dev_0_1::UpdateCaretPosition_0_1, + ns_PPB_TextInput_Dev_0_1::CancelCompositionText_0_1, +}; +const string ToString_PPB_TextInput_Dev(const PPB_TextInput_Dev_0_1 *v) { + stringstream s; + s << v; + return s.str(); +} +namespace ns_PPB_TextInput_Dev_0_2 { +static void SetTextInputType_0_2(PP_Instance instance, PP_TextInput_Type_Dev type) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_TextInput_Dev\""); + AddProp(ss, "__version", "\"0.2\""); + AddProp(ss, "__method", "\"SetTextInputType\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "type", ToString_PP_TextInput_Type_Dev(type)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_TextInput_Dev_0_2*)RealGetInterface("PPB_TextInput(Dev);0.2"))->SetTextInputType(instance, type); +#endif // !INTERPOSE +} +static void UpdateCaretPosition_0_2(PP_Instance instance, const struct PP_Rect* caret, const struct PP_Rect* bounding_box) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_TextInput_Dev\""); + AddProp(ss, "__version", "\"0.2\""); + AddProp(ss, "__method", "\"UpdateCaretPosition\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "caret", ToString_PP_Rect(caret)); + AddProp(ss, "bounding_box", ToString_PP_Rect(bounding_box)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_TextInput_Dev_0_2*)RealGetInterface("PPB_TextInput(Dev);0.2"))->UpdateCaretPosition(instance, caret, bounding_box); +#endif // !INTERPOSE +} +static void CancelCompositionText_0_2(PP_Instance instance) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_TextInput_Dev\""); + AddProp(ss, "__version", "\"0.2\""); + AddProp(ss, "__method", "\"CancelCompositionText\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_TextInput_Dev_0_2*)RealGetInterface("PPB_TextInput(Dev);0.2"))->CancelCompositionText(instance); +#endif // !INTERPOSE +} +static void UpdateSurroundingText_0_2(PP_Instance instance, const char* text, uint32_t caret, uint32_t anchor) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_TextInput_Dev\""); + AddProp(ss, "__version", "\"0.2\""); + AddProp(ss, "__method", "\"UpdateSurroundingText\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "text", ToString_str_t(text)); + AddProp(ss, "caret", ToString_uint32_t(caret)); + AddProp(ss, "anchor", ToString_uint32_t(anchor)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_TextInput_Dev_0_2*)RealGetInterface("PPB_TextInput(Dev);0.2"))->UpdateSurroundingText(instance, text, caret, anchor); +#endif // !INTERPOSE +} +static void SelectionChanged_0_2(PP_Instance instance) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_TextInput_Dev\""); + AddProp(ss, "__version", "\"0.2\""); + AddProp(ss, "__method", "\"SelectionChanged\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_TextInput_Dev_0_2*)RealGetInterface("PPB_TextInput(Dev);0.2"))->SelectionChanged(instance); +#endif // !INTERPOSE +} +} +static PPB_TextInput_Dev_0_2 _PPB_TextInput_Dev_0_2 = { + ns_PPB_TextInput_Dev_0_2::SetTextInputType_0_2, + ns_PPB_TextInput_Dev_0_2::UpdateCaretPosition_0_2, + ns_PPB_TextInput_Dev_0_2::CancelCompositionText_0_2, + ns_PPB_TextInput_Dev_0_2::UpdateSurroundingText_0_2, + ns_PPB_TextInput_Dev_0_2::SelectionChanged_0_2, +}; +const string ToString_PPB_TextInput_Dev(const PPB_TextInput_Dev_0_2 *v) { + stringstream s; + s << v; + return s.str(); +} +const string ToString_PP_TraceEventTime(const PP_TraceEventTime *v) { + return ToString_int64_t(v); +} +const string ToString_PP_TraceEventTime(const PP_TraceEventTime &v) { + return ToString_PP_TraceEventTime(&v); +} +void FromJSON_PP_TraceEventTime(JSONIterator& iterator, PP_TraceEventTime &value) { + FromJSON_int64_t(iterator, value); +} +namespace ns_PPB_Trace_Event_Dev_0_1 { +static void* GetCategoryEnabled_0_1(const char* category_name) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Trace_Event_Dev\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"GetCategoryEnabled\""); + AddProp(ss, "category_name", ToString_cstr_t(category_name)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + void* rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_mem_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + void* rval = ((PPB_Trace_Event_Dev_0_1*)RealGetInterface("PPB_Trace_Event(Dev);0.1"))->GetCategoryEnabled(category_name); + printf("RPC response: ["); + printf("%s", ToString_mem_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static void AddTraceEvent_0_1(int8_t phase, const void* category_enabled, const char* name, uint64_t id, uint32_t num_args, const char* arg_names[], const uint8_t arg_types[], const uint64_t arg_values[], uint8_t flags) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Trace_Event_Dev\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"AddTraceEvent\""); + AddProp(ss, "phase", ToString_int8_t(phase)); + AddProp(ss, "category_enabled", ToString_mem_t(category_enabled)); + AddProp(ss, "name", ToString_cstr_t(name)); + AddProp(ss, "id", ToString_uint64_t(id)); + AddProp(ss, "num_args", ToString_uint32_t(num_args)); + { + BeginProp(ss, "arg_names"); + BeginElements(ss); + for (uint32_t _n = 0; _n < num_args; ++_n) { + AddElement(ss, ToString_str_t(arg_names[_n])); + } + EndElements(ss); + } + { + BeginProp(ss, "arg_types"); + BeginElements(ss); + for (uint32_t _n = 0; _n < num_args; ++_n) { + AddElement(ss, ToString_uint8_t(arg_types[_n])); + } + EndElements(ss); + } + { + BeginProp(ss, "arg_values"); + BeginElements(ss); + for (uint32_t _n = 0; _n < num_args; ++_n) { + AddElement(ss, ToString_uint64_t(arg_values[_n])); + } + EndElements(ss); + } + AddProp(ss, "flags", ToString_uint8_t(flags)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_Trace_Event_Dev_0_1*)RealGetInterface("PPB_Trace_Event(Dev);0.1"))->AddTraceEvent(phase, category_enabled, name, id, num_args, arg_names, arg_types, arg_values, flags); +#endif // !INTERPOSE +} +/* skipping AddTraceEventWithThreadIdAndTimestamp */ +/* skipping Now */ +static void SetThreadName_0_1(const char* thread_name) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Trace_Event_Dev\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"SetThreadName\""); + AddProp(ss, "thread_name", ToString_cstr_t(thread_name)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_Trace_Event_Dev_0_1*)RealGetInterface("PPB_Trace_Event(Dev);0.1"))->SetThreadName(thread_name); +#endif // !INTERPOSE +} +} +static PPB_Trace_Event_Dev_0_1 _PPB_Trace_Event_Dev_0_1 = { + ns_PPB_Trace_Event_Dev_0_1::GetCategoryEnabled_0_1, + ns_PPB_Trace_Event_Dev_0_1::AddTraceEvent_0_1, + ns_PPB_Trace_Event_Dev_0_1::SetThreadName_0_1, +}; +const string ToString_PPB_Trace_Event_Dev(const PPB_Trace_Event_Dev_0_1 *v) { + stringstream s; + s << v; + return s.str(); +} +namespace ns_PPB_Trace_Event_Dev_0_2 { +static void* GetCategoryEnabled_0_2(const char* category_name) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Trace_Event_Dev\""); + AddProp(ss, "__version", "\"0.2\""); + AddProp(ss, "__method", "\"GetCategoryEnabled\""); + AddProp(ss, "category_name", ToString_cstr_t(category_name)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + void* rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_mem_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + void* rval = ((PPB_Trace_Event_Dev_0_2*)RealGetInterface("PPB_Trace_Event(Dev);0.2"))->GetCategoryEnabled(category_name); + printf("RPC response: ["); + printf("%s", ToString_mem_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static void AddTraceEvent_0_2(int8_t phase, const void* category_enabled, const char* name, uint64_t id, uint32_t num_args, const char* arg_names[], const uint8_t arg_types[], const uint64_t arg_values[], uint8_t flags) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Trace_Event_Dev\""); + AddProp(ss, "__version", "\"0.2\""); + AddProp(ss, "__method", "\"AddTraceEvent\""); + AddProp(ss, "phase", ToString_int8_t(phase)); + AddProp(ss, "category_enabled", ToString_mem_t(category_enabled)); + AddProp(ss, "name", ToString_cstr_t(name)); + AddProp(ss, "id", ToString_uint64_t(id)); + AddProp(ss, "num_args", ToString_uint32_t(num_args)); + { + BeginProp(ss, "arg_names"); + BeginElements(ss); + for (uint32_t _n = 0; _n < num_args; ++_n) { + AddElement(ss, ToString_str_t(arg_names[_n])); + } + EndElements(ss); + } + { + BeginProp(ss, "arg_types"); + BeginElements(ss); + for (uint32_t _n = 0; _n < num_args; ++_n) { + AddElement(ss, ToString_uint8_t(arg_types[_n])); + } + EndElements(ss); + } + { + BeginProp(ss, "arg_values"); + BeginElements(ss); + for (uint32_t _n = 0; _n < num_args; ++_n) { + AddElement(ss, ToString_uint64_t(arg_values[_n])); + } + EndElements(ss); + } + AddProp(ss, "flags", ToString_uint8_t(flags)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_Trace_Event_Dev_0_2*)RealGetInterface("PPB_Trace_Event(Dev);0.2"))->AddTraceEvent(phase, category_enabled, name, id, num_args, arg_names, arg_types, arg_values, flags); +#endif // !INTERPOSE +} +static void AddTraceEventWithThreadIdAndTimestamp_0_2(int8_t phase, const void* category_enabled, const char* name, uint64_t id, int32_t thread_id, PP_TraceEventTime timestamp, uint32_t num_args, const char* arg_names[], const uint8_t arg_types[], const uint64_t arg_values[], uint8_t flags) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Trace_Event_Dev\""); + AddProp(ss, "__version", "\"0.2\""); + AddProp(ss, "__method", "\"AddTraceEventWithThreadIdAndTimestamp\""); + AddProp(ss, "phase", ToString_int8_t(phase)); + AddProp(ss, "category_enabled", ToString_mem_t(category_enabled)); + AddProp(ss, "name", ToString_cstr_t(name)); + AddProp(ss, "id", ToString_uint64_t(id)); + AddProp(ss, "thread_id", ToString_int32_t(thread_id)); + AddProp(ss, "timestamp", ToString_PP_TraceEventTime(timestamp)); + AddProp(ss, "num_args", ToString_uint32_t(num_args)); + { + BeginProp(ss, "arg_names"); + BeginElements(ss); + for (uint32_t _n = 0; _n < num_args; ++_n) { + AddElement(ss, ToString_str_t(arg_names[_n])); + } + EndElements(ss); + } + { + BeginProp(ss, "arg_types"); + BeginElements(ss); + for (uint32_t _n = 0; _n < num_args; ++_n) { + AddElement(ss, ToString_uint8_t(arg_types[_n])); + } + EndElements(ss); + } + { + BeginProp(ss, "arg_values"); + BeginElements(ss); + for (uint32_t _n = 0; _n < num_args; ++_n) { + AddElement(ss, ToString_uint64_t(arg_values[_n])); + } + EndElements(ss); + } + AddProp(ss, "flags", ToString_uint8_t(flags)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_Trace_Event_Dev_0_2*)RealGetInterface("PPB_Trace_Event(Dev);0.2"))->AddTraceEventWithThreadIdAndTimestamp(phase, category_enabled, name, id, thread_id, timestamp, num_args, arg_names, arg_types, arg_values, flags); +#endif // !INTERPOSE +} +static PP_TraceEventTime Now_0_2(void) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Trace_Event_Dev\""); + AddProp(ss, "__version", "\"0.2\""); + AddProp(ss, "__method", "\"Now\""); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int64_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_TraceEventTime(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int64_t rval = ((PPB_Trace_Event_Dev_0_2*)RealGetInterface("PPB_Trace_Event(Dev);0.2"))->Now(); + printf("RPC response: ["); + printf("%s", ToString_PP_TraceEventTime(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static void SetThreadName_0_2(const char* thread_name) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Trace_Event_Dev\""); + AddProp(ss, "__version", "\"0.2\""); + AddProp(ss, "__method", "\"SetThreadName\""); + AddProp(ss, "thread_name", ToString_cstr_t(thread_name)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_Trace_Event_Dev_0_2*)RealGetInterface("PPB_Trace_Event(Dev);0.2"))->SetThreadName(thread_name); +#endif // !INTERPOSE +} +} +static PPB_Trace_Event_Dev_0_2 _PPB_Trace_Event_Dev_0_2 = { + ns_PPB_Trace_Event_Dev_0_2::GetCategoryEnabled_0_2, + ns_PPB_Trace_Event_Dev_0_2::AddTraceEvent_0_2, + ns_PPB_Trace_Event_Dev_0_2::AddTraceEventWithThreadIdAndTimestamp_0_2, + ns_PPB_Trace_Event_Dev_0_2::Now_0_2, + ns_PPB_Trace_Event_Dev_0_2::SetThreadName_0_2, +}; +const string ToString_PPB_Trace_Event_Dev(const PPB_Trace_Event_Dev_0_2 *v) { + stringstream s; + s << v; + return s.str(); +} +const string ToString_PP_TrueTypeFontFamily_Dev(const PP_TrueTypeFontFamily_Dev *v) { + switch (*v) { + case 0: + return "\"PP_TRUETYPEFONTFAMILY_SERIF\""; + case 1: + return "\"PP_TRUETYPEFONTFAMILY_SANSSERIF\""; + case 2: + return "\"PP_TRUETYPEFONTFAMILY_CURSIVE\""; + case 3: + return "\"PP_TRUETYPEFONTFAMILY_FANTASY\""; + case 4: + return "\"PP_TRUETYPEFONTFAMILY_MONOSPACE\""; + default: + return "\"???\""; + } +} +const string ToString_PP_TrueTypeFontFamily_Dev(const PP_TrueTypeFontFamily_Dev &v) { + return ToString_PP_TrueTypeFontFamily_Dev(&v); +} +void FromJSON_PP_TrueTypeFontFamily_Dev(JSONIterator& iterator, PP_TrueTypeFontFamily_Dev &value) { + long int v; + FromJSON_int(iterator, v); + value = PP_TrueTypeFontFamily_Dev(v); +} +const string ToString_PP_TrueTypeFontStyle_Dev(const PP_TrueTypeFontStyle_Dev *v) { + switch (*v) { + case 0: + return "\"PP_TRUETYPEFONTSTYLE_NORMAL\""; + case 1: + return "\"PP_TRUETYPEFONTSTYLE_ITALIC\""; + default: + return "\"???\""; + } +} +const string ToString_PP_TrueTypeFontStyle_Dev(const PP_TrueTypeFontStyle_Dev &v) { + return ToString_PP_TrueTypeFontStyle_Dev(&v); +} +void FromJSON_PP_TrueTypeFontStyle_Dev(JSONIterator& iterator, PP_TrueTypeFontStyle_Dev &value) { + long int v; + FromJSON_int(iterator, v); + value = PP_TrueTypeFontStyle_Dev(v); +} +const string ToString_PP_TrueTypeFontWeight_Dev(const PP_TrueTypeFontWeight_Dev *v) { + switch (*v) { + case 100: + return "\"PP_TRUETYPEFONTWEIGHT_THIN\""; + case 200: + return "\"PP_TRUETYPEFONTWEIGHT_ULTRALIGHT\""; + case 300: + return "\"PP_TRUETYPEFONTWEIGHT_LIGHT\""; + case 400: + return "\"PP_TRUETYPEFONTWEIGHT_NORMAL\""; + case 500: + return "\"PP_TRUETYPEFONTWEIGHT_MEDIUM\""; + case 600: + return "\"PP_TRUETYPEFONTWEIGHT_SEMIBOLD\""; + case 700: + return "\"PP_TRUETYPEFONTWEIGHT_BOLD\""; + case 800: + return "\"PP_TRUETYPEFONTWEIGHT_ULTRABOLD\""; + case 900: + return "\"PP_TRUETYPEFONTWEIGHT_HEAVY\""; + default: + return "\"???\""; + } +} +const string ToString_PP_TrueTypeFontWeight_Dev(const PP_TrueTypeFontWeight_Dev &v) { + return ToString_PP_TrueTypeFontWeight_Dev(&v); +} +void FromJSON_PP_TrueTypeFontWeight_Dev(JSONIterator& iterator, PP_TrueTypeFontWeight_Dev &value) { + long int v; + FromJSON_int(iterator, v); + value = PP_TrueTypeFontWeight_Dev(v); +} +const string ToString_PP_TrueTypeFontWidth_Dev(const PP_TrueTypeFontWidth_Dev *v) { + switch (*v) { + case 0: + return "\"PP_TRUETYPEFONTWIDTH_ULTRACONDENSED\""; + case 1: + return "\"PP_TRUETYPEFONTWIDTH_EXTRACONDENSED\""; + case 2: + return "\"PP_TRUETYPEFONTWIDTH_CONDENSED\""; + case 3: + return "\"PP_TRUETYPEFONTWIDTH_SEMICONDENSED\""; + case 4: + return "\"PP_TRUETYPEFONTWIDTH_NORMAL\""; + case 5: + return "\"PP_TRUETYPEFONTWIDTH_SEMIEXPANDED\""; + case 6: + return "\"PP_TRUETYPEFONTWIDTH_EXPANDED\""; + case 7: + return "\"PP_TRUETYPEFONTWIDTH_EXTRAEXPANDED\""; + case 8: + return "\"PP_TRUETYPEFONTWIDTH_ULTRAEXPANDED\""; + default: + return "\"???\""; + } +} +const string ToString_PP_TrueTypeFontWidth_Dev(const PP_TrueTypeFontWidth_Dev &v) { + return ToString_PP_TrueTypeFontWidth_Dev(&v); +} +void FromJSON_PP_TrueTypeFontWidth_Dev(JSONIterator& iterator, PP_TrueTypeFontWidth_Dev &value) { + long int v; + FromJSON_int(iterator, v); + value = PP_TrueTypeFontWidth_Dev(v); +} +const string ToString_PP_TrueTypeFontCharset_Dev(const PP_TrueTypeFontCharset_Dev *v) { + switch (*v) { + case 0: + return "\"PP_TRUETYPEFONTCHARSET_ANSI\""; + case 1: + return "\"PP_TRUETYPEFONTCHARSET_DEFAULT\""; + case 2: + return "\"PP_TRUETYPEFONTCHARSET_SYMBOL\""; + case 77: + return "\"PP_TRUETYPEFONTCHARSET_MAC\""; + case 128: + return "\"PP_TRUETYPEFONTCHARSET_SHIFTJIS\""; + case 129: + return "\"PP_TRUETYPEFONTCHARSET_HANGUL\""; + case 130: + return "\"PP_TRUETYPEFONTCHARSET_JOHAB\""; + case 134: + return "\"PP_TRUETYPEFONTCHARSET_GB2312\""; + case 136: + return "\"PP_TRUETYPEFONTCHARSET_CHINESEBIG5\""; + case 161: + return "\"PP_TRUETYPEFONTCHARSET_GREEK\""; + case 162: + return "\"PP_TRUETYPEFONTCHARSET_TURKISH\""; + case 163: + return "\"PP_TRUETYPEFONTCHARSET_VIETNAMESE\""; + case 177: + return "\"PP_TRUETYPEFONTCHARSET_HEBREW\""; + case 178: + return "\"PP_TRUETYPEFONTCHARSET_ARABIC\""; + case 186: + return "\"PP_TRUETYPEFONTCHARSET_BALTIC\""; + case 204: + return "\"PP_TRUETYPEFONTCHARSET_RUSSIAN\""; + case 222: + return "\"PP_TRUETYPEFONTCHARSET_THAI\""; + case 238: + return "\"PP_TRUETYPEFONTCHARSET_EASTEUROPE\""; + case 255: + return "\"PP_TRUETYPEFONTCHARSET_OEM\""; + default: + return "\"???\""; + } +} +const string ToString_PP_TrueTypeFontCharset_Dev(const PP_TrueTypeFontCharset_Dev &v) { + return ToString_PP_TrueTypeFontCharset_Dev(&v); +} +void FromJSON_PP_TrueTypeFontCharset_Dev(JSONIterator& iterator, PP_TrueTypeFontCharset_Dev &value) { + long int v; + FromJSON_int(iterator, v); + value = PP_TrueTypeFontCharset_Dev(v); +} +const string ToString_PP_TrueTypeFontDesc_Dev(const PP_TrueTypeFontDesc_Dev *v) { + if (!v) { + return "null"; + } + return ToString_PP_TrueTypeFontDesc_Dev(*v); +} +const string ToString_PP_TrueTypeFontDesc_Dev(const PP_TrueTypeFontDesc_Dev &v) { + stringstream x; + BeginProps(x); + AddProp(x, "family", ToString_PP_Var(v.family)); + AddProp(x, "generic_family", ToString_PP_TrueTypeFontFamily_Dev(v.generic_family)); + AddProp(x, "style", ToString_PP_TrueTypeFontStyle_Dev(v.style)); + AddProp(x, "weight", ToString_PP_TrueTypeFontWeight_Dev(v.weight)); + AddProp(x, "width", ToString_PP_TrueTypeFontWidth_Dev(v.width)); + AddProp(x, "charset", ToString_PP_TrueTypeFontCharset_Dev(v.charset)); + AddProp(x, "padding", ToString_int32_t(v.padding)); + EndProps(x); + return x.str(); +} +void FromJSON_PP_TrueTypeFontDesc_Dev(JSONIterator& iterator, PP_TrueTypeFontDesc_Dev &value) { + const JSON::Token& current = iterator.getCurrentAndGotoNext(); + if (current.isPrimitive() && !current.value().compare("null")) { + return; + } + if (!current.isObject()) { + Fail("Expected object!", ""); + } + iterator.skip(); + FromJSON_PP_Var(iterator, value.family); + iterator.skip(); + FromJSON_PP_TrueTypeFontFamily_Dev(iterator, value.generic_family); + iterator.skip(); + FromJSON_PP_TrueTypeFontStyle_Dev(iterator, value.style); + iterator.skip(); + FromJSON_PP_TrueTypeFontWeight_Dev(iterator, value.weight); + iterator.skip(); + FromJSON_PP_TrueTypeFontWidth_Dev(iterator, value.width); + iterator.skip(); + FromJSON_PP_TrueTypeFontCharset_Dev(iterator, value.charset); + iterator.skip(); + FromJSON_int32_t(iterator, value.padding); +} +namespace ns_PPB_TrueTypeFont_Dev_0_1 { +static int32_t GetFontFamilies_0_1(PP_Instance instance, struct PP_ArrayOutput output, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_TrueTypeFont_Dev\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"GetFontFamilies\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "output", ToString_PP_ArrayOutput(output)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_TrueTypeFont_Dev_0_1*)RealGetInterface("PPB_TrueTypeFont(Dev);0.1"))->GetFontFamilies(instance, output, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t GetFontsInFamily_0_1(PP_Instance instance, struct PP_Var family, struct PP_ArrayOutput output, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_TrueTypeFont_Dev\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"GetFontsInFamily\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "family", ToString_PP_Var(family)); + AddProp(ss, "output", ToString_PP_ArrayOutput(output)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_TrueTypeFont_Dev_0_1*)RealGetInterface("PPB_TrueTypeFont(Dev);0.1"))->GetFontsInFamily(instance, family, output, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Resource Create_0_1(PP_Instance instance, const struct PP_TrueTypeFontDesc_Dev* desc) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_TrueTypeFont_Dev\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"Create\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "desc", ToString_PP_TrueTypeFontDesc_Dev(desc)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Resource(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_TrueTypeFont_Dev_0_1*)RealGetInterface("PPB_TrueTypeFont(Dev);0.1"))->Create(instance, desc); + printf("RPC response: ["); + printf("%s", ToString_PP_Resource(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool IsTrueTypeFont_0_1(PP_Resource resource) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_TrueTypeFont_Dev\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"IsTrueTypeFont\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_TrueTypeFont_Dev_0_1*)RealGetInterface("PPB_TrueTypeFont(Dev);0.1"))->IsTrueTypeFont(resource); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t Describe_0_1(PP_Resource font, struct PP_TrueTypeFontDesc_Dev* desc, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_TrueTypeFont_Dev\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"Describe\""); + AddProp(ss, "font", ToString_PP_Resource(font)); + AddProp(ss, "desc", PointerToString(desc)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + if (!!desc) { + iterator.skip(); + FromJSON_PP_TrueTypeFontDesc_Dev(iterator, *desc); + } + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_TrueTypeFont_Dev_0_1*)RealGetInterface("PPB_TrueTypeFont(Dev);0.1"))->Describe(font, desc, logging_callback); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_int32_t(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + if (!!desc) { + AddProp(os, "desc", ToString_PP_TrueTypeFontDesc_Dev(desc)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t GetTableTags_0_1(PP_Resource font, struct PP_ArrayOutput output, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_TrueTypeFont_Dev\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"GetTableTags\""); + AddProp(ss, "font", ToString_PP_Resource(font)); + AddProp(ss, "output", ToString_PP_ArrayOutput(output)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_TrueTypeFont_Dev_0_1*)RealGetInterface("PPB_TrueTypeFont(Dev);0.1"))->GetTableTags(font, output, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t GetTable_0_1(PP_Resource font, uint32_t table, int32_t offset, int32_t max_data_length, struct PP_ArrayOutput output, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_TrueTypeFont_Dev\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"GetTable\""); + AddProp(ss, "font", ToString_PP_Resource(font)); + AddProp(ss, "table", ToString_uint32_t(table)); + AddProp(ss, "offset", ToString_int32_t(offset)); + AddProp(ss, "max_data_length", ToString_int32_t(max_data_length)); + AddProp(ss, "output", ToString_PP_ArrayOutput(output)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_TrueTypeFont_Dev_0_1*)RealGetInterface("PPB_TrueTypeFont(Dev);0.1"))->GetTable(font, table, offset, max_data_length, output, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +} +static PPB_TrueTypeFont_Dev_0_1 _PPB_TrueTypeFont_Dev_0_1 = { + ns_PPB_TrueTypeFont_Dev_0_1::GetFontFamilies_0_1, + ns_PPB_TrueTypeFont_Dev_0_1::GetFontsInFamily_0_1, + ns_PPB_TrueTypeFont_Dev_0_1::Create_0_1, + ns_PPB_TrueTypeFont_Dev_0_1::IsTrueTypeFont_0_1, + ns_PPB_TrueTypeFont_Dev_0_1::Describe_0_1, + ns_PPB_TrueTypeFont_Dev_0_1::GetTableTags_0_1, + ns_PPB_TrueTypeFont_Dev_0_1::GetTable_0_1, +}; +const string ToString_PPB_TrueTypeFont_Dev(const PPB_TrueTypeFont_Dev_0_1 *v) { + stringstream s; + s << v; + return s.str(); +} +const string ToString_PP_URLComponent_Dev(const PP_URLComponent_Dev *v) { + if (!v) { + return "null"; + } + return ToString_PP_URLComponent_Dev(*v); +} +const string ToString_PP_URLComponent_Dev(const PP_URLComponent_Dev &v) { + stringstream x; + BeginProps(x); + AddProp(x, "begin", ToString_int32_t(v.begin)); + AddProp(x, "len", ToString_int32_t(v.len)); + EndProps(x); + return x.str(); +} +void FromJSON_PP_URLComponent_Dev(JSONIterator& iterator, PP_URLComponent_Dev &value) { + const JSON::Token& current = iterator.getCurrentAndGotoNext(); + if (current.isPrimitive() && !current.value().compare("null")) { + return; + } + if (!current.isObject()) { + Fail("Expected object!", ""); + } + iterator.skip(); + FromJSON_int32_t(iterator, value.begin); + iterator.skip(); + FromJSON_int32_t(iterator, value.len); +} +const string ToString_PP_URLComponents_Dev(const PP_URLComponents_Dev *v) { + if (!v) { + return "null"; + } + return ToString_PP_URLComponents_Dev(*v); +} +const string ToString_PP_URLComponents_Dev(const PP_URLComponents_Dev &v) { + stringstream x; + BeginProps(x); + AddProp(x, "scheme", ToString_PP_URLComponent_Dev(v.scheme)); + AddProp(x, "username", ToString_PP_URLComponent_Dev(v.username)); + AddProp(x, "password", ToString_PP_URLComponent_Dev(v.password)); + AddProp(x, "host", ToString_PP_URLComponent_Dev(v.host)); + AddProp(x, "port", ToString_PP_URLComponent_Dev(v.port)); + AddProp(x, "path", ToString_PP_URLComponent_Dev(v.path)); + AddProp(x, "query", ToString_PP_URLComponent_Dev(v.query)); + AddProp(x, "ref", ToString_PP_URLComponent_Dev(v.ref)); + EndProps(x); + return x.str(); +} +void FromJSON_PP_URLComponents_Dev(JSONIterator& iterator, PP_URLComponents_Dev &value) { + const JSON::Token& current = iterator.getCurrentAndGotoNext(); + if (current.isPrimitive() && !current.value().compare("null")) { + return; + } + if (!current.isObject()) { + Fail("Expected object!", ""); + } + iterator.skip(); + FromJSON_PP_URLComponent_Dev(iterator, value.scheme); + iterator.skip(); + FromJSON_PP_URLComponent_Dev(iterator, value.username); + iterator.skip(); + FromJSON_PP_URLComponent_Dev(iterator, value.password); + iterator.skip(); + FromJSON_PP_URLComponent_Dev(iterator, value.host); + iterator.skip(); + FromJSON_PP_URLComponent_Dev(iterator, value.port); + iterator.skip(); + FromJSON_PP_URLComponent_Dev(iterator, value.path); + iterator.skip(); + FromJSON_PP_URLComponent_Dev(iterator, value.query); + iterator.skip(); + FromJSON_PP_URLComponent_Dev(iterator, value.ref); +} +namespace ns_PPB_URLUtil_Dev_0_6 { +static struct PP_Var Canonicalize_0_6(struct PP_Var url, struct PP_URLComponents_Dev* components) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_URLUtil_Dev\""); + AddProp(ss, "__version", "\"0.6\""); + AddProp(ss, "__method", "\"Canonicalize\""); + AddProp(ss, "url", ToString_PP_Var(url)); + AddProp(ss, "components", PointerToString(components)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + struct PP_Var rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Var(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + if (!!components) { + iterator.skip(); + FromJSON_PP_URLComponents_Dev(iterator, *components); + } + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + struct PP_Var rval = ((PPB_URLUtil_Dev_0_6*)RealGetInterface("PPB_URLUtil(Dev);0.6"))->Canonicalize(url, components); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_PP_Var(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + if (!!components) { + AddProp(os, "components", ToString_PP_URLComponents_Dev(components)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static struct PP_Var ResolveRelativeToURL_0_6(struct PP_Var base_url, struct PP_Var relative_string, struct PP_URLComponents_Dev* components) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_URLUtil_Dev\""); + AddProp(ss, "__version", "\"0.6\""); + AddProp(ss, "__method", "\"ResolveRelativeToURL\""); + AddProp(ss, "base_url", ToString_PP_Var(base_url)); + AddProp(ss, "relative_string", ToString_PP_Var(relative_string)); + AddProp(ss, "components", PointerToString(components)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + struct PP_Var rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Var(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + if (!!components) { + iterator.skip(); + FromJSON_PP_URLComponents_Dev(iterator, *components); + } + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + struct PP_Var rval = ((PPB_URLUtil_Dev_0_6*)RealGetInterface("PPB_URLUtil(Dev);0.6"))->ResolveRelativeToURL(base_url, relative_string, components); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_PP_Var(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + if (!!components) { + AddProp(os, "components", ToString_PP_URLComponents_Dev(components)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static struct PP_Var ResolveRelativeToDocument_0_6(PP_Instance instance, struct PP_Var relative_string, struct PP_URLComponents_Dev* components) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_URLUtil_Dev\""); + AddProp(ss, "__version", "\"0.6\""); + AddProp(ss, "__method", "\"ResolveRelativeToDocument\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "relative_string", ToString_PP_Var(relative_string)); + AddProp(ss, "components", PointerToString(components)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + struct PP_Var rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Var(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + if (!!components) { + iterator.skip(); + FromJSON_PP_URLComponents_Dev(iterator, *components); + } + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + struct PP_Var rval = ((PPB_URLUtil_Dev_0_6*)RealGetInterface("PPB_URLUtil(Dev);0.6"))->ResolveRelativeToDocument(instance, relative_string, components); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_PP_Var(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + if (!!components) { + AddProp(os, "components", ToString_PP_URLComponents_Dev(components)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool IsSameSecurityOrigin_0_6(struct PP_Var url_a, struct PP_Var url_b) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_URLUtil_Dev\""); + AddProp(ss, "__version", "\"0.6\""); + AddProp(ss, "__method", "\"IsSameSecurityOrigin\""); + AddProp(ss, "url_a", ToString_PP_Var(url_a)); + AddProp(ss, "url_b", ToString_PP_Var(url_b)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_URLUtil_Dev_0_6*)RealGetInterface("PPB_URLUtil(Dev);0.6"))->IsSameSecurityOrigin(url_a, url_b); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool DocumentCanRequest_0_6(PP_Instance instance, struct PP_Var url) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_URLUtil_Dev\""); + AddProp(ss, "__version", "\"0.6\""); + AddProp(ss, "__method", "\"DocumentCanRequest\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "url", ToString_PP_Var(url)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_URLUtil_Dev_0_6*)RealGetInterface("PPB_URLUtil(Dev);0.6"))->DocumentCanRequest(instance, url); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool DocumentCanAccessDocument_0_6(PP_Instance active, PP_Instance target) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_URLUtil_Dev\""); + AddProp(ss, "__version", "\"0.6\""); + AddProp(ss, "__method", "\"DocumentCanAccessDocument\""); + AddProp(ss, "active", ToString_PP_Instance(active)); + AddProp(ss, "target", ToString_PP_Instance(target)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_URLUtil_Dev_0_6*)RealGetInterface("PPB_URLUtil(Dev);0.6"))->DocumentCanAccessDocument(active, target); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static struct PP_Var GetDocumentURL_0_6(PP_Instance instance, struct PP_URLComponents_Dev* components) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_URLUtil_Dev\""); + AddProp(ss, "__version", "\"0.6\""); + AddProp(ss, "__method", "\"GetDocumentURL\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "components", PointerToString(components)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + struct PP_Var rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Var(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + if (!!components) { + iterator.skip(); + FromJSON_PP_URLComponents_Dev(iterator, *components); + } + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + struct PP_Var rval = ((PPB_URLUtil_Dev_0_6*)RealGetInterface("PPB_URLUtil(Dev);0.6"))->GetDocumentURL(instance, components); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_PP_Var(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + if (!!components) { + AddProp(os, "components", ToString_PP_URLComponents_Dev(components)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static struct PP_Var GetPluginInstanceURL_0_6(PP_Instance instance, struct PP_URLComponents_Dev* components) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_URLUtil_Dev\""); + AddProp(ss, "__version", "\"0.6\""); + AddProp(ss, "__method", "\"GetPluginInstanceURL\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "components", PointerToString(components)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + struct PP_Var rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Var(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + if (!!components) { + iterator.skip(); + FromJSON_PP_URLComponents_Dev(iterator, *components); + } + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + struct PP_Var rval = ((PPB_URLUtil_Dev_0_6*)RealGetInterface("PPB_URLUtil(Dev);0.6"))->GetPluginInstanceURL(instance, components); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_PP_Var(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + if (!!components) { + AddProp(os, "components", ToString_PP_URLComponents_Dev(components)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +/* skipping GetPluginReferrerURL */ +} +static PPB_URLUtil_Dev_0_6 _PPB_URLUtil_Dev_0_6 = { + ns_PPB_URLUtil_Dev_0_6::Canonicalize_0_6, + ns_PPB_URLUtil_Dev_0_6::ResolveRelativeToURL_0_6, + ns_PPB_URLUtil_Dev_0_6::ResolveRelativeToDocument_0_6, + ns_PPB_URLUtil_Dev_0_6::IsSameSecurityOrigin_0_6, + ns_PPB_URLUtil_Dev_0_6::DocumentCanRequest_0_6, + ns_PPB_URLUtil_Dev_0_6::DocumentCanAccessDocument_0_6, + ns_PPB_URLUtil_Dev_0_6::GetDocumentURL_0_6, + ns_PPB_URLUtil_Dev_0_6::GetPluginInstanceURL_0_6, +}; +const string ToString_PPB_URLUtil_Dev(const PPB_URLUtil_Dev_0_6 *v) { + stringstream s; + s << v; + return s.str(); +} +namespace ns_PPB_URLUtil_Dev_0_7 { +static struct PP_Var Canonicalize_0_7(struct PP_Var url, struct PP_URLComponents_Dev* components) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_URLUtil_Dev\""); + AddProp(ss, "__version", "\"0.7\""); + AddProp(ss, "__method", "\"Canonicalize\""); + AddProp(ss, "url", ToString_PP_Var(url)); + AddProp(ss, "components", PointerToString(components)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + struct PP_Var rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Var(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + if (!!components) { + iterator.skip(); + FromJSON_PP_URLComponents_Dev(iterator, *components); + } + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + struct PP_Var rval = ((PPB_URLUtil_Dev_0_7*)RealGetInterface("PPB_URLUtil(Dev);0.7"))->Canonicalize(url, components); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_PP_Var(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + if (!!components) { + AddProp(os, "components", ToString_PP_URLComponents_Dev(components)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static struct PP_Var ResolveRelativeToURL_0_7(struct PP_Var base_url, struct PP_Var relative_string, struct PP_URLComponents_Dev* components) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_URLUtil_Dev\""); + AddProp(ss, "__version", "\"0.7\""); + AddProp(ss, "__method", "\"ResolveRelativeToURL\""); + AddProp(ss, "base_url", ToString_PP_Var(base_url)); + AddProp(ss, "relative_string", ToString_PP_Var(relative_string)); + AddProp(ss, "components", PointerToString(components)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + struct PP_Var rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Var(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + if (!!components) { + iterator.skip(); + FromJSON_PP_URLComponents_Dev(iterator, *components); + } + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + struct PP_Var rval = ((PPB_URLUtil_Dev_0_7*)RealGetInterface("PPB_URLUtil(Dev);0.7"))->ResolveRelativeToURL(base_url, relative_string, components); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_PP_Var(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + if (!!components) { + AddProp(os, "components", ToString_PP_URLComponents_Dev(components)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static struct PP_Var ResolveRelativeToDocument_0_7(PP_Instance instance, struct PP_Var relative_string, struct PP_URLComponents_Dev* components) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_URLUtil_Dev\""); + AddProp(ss, "__version", "\"0.7\""); + AddProp(ss, "__method", "\"ResolveRelativeToDocument\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "relative_string", ToString_PP_Var(relative_string)); + AddProp(ss, "components", PointerToString(components)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + struct PP_Var rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Var(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + if (!!components) { + iterator.skip(); + FromJSON_PP_URLComponents_Dev(iterator, *components); + } + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + struct PP_Var rval = ((PPB_URLUtil_Dev_0_7*)RealGetInterface("PPB_URLUtil(Dev);0.7"))->ResolveRelativeToDocument(instance, relative_string, components); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_PP_Var(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + if (!!components) { + AddProp(os, "components", ToString_PP_URLComponents_Dev(components)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool IsSameSecurityOrigin_0_7(struct PP_Var url_a, struct PP_Var url_b) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_URLUtil_Dev\""); + AddProp(ss, "__version", "\"0.7\""); + AddProp(ss, "__method", "\"IsSameSecurityOrigin\""); + AddProp(ss, "url_a", ToString_PP_Var(url_a)); + AddProp(ss, "url_b", ToString_PP_Var(url_b)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_URLUtil_Dev_0_7*)RealGetInterface("PPB_URLUtil(Dev);0.7"))->IsSameSecurityOrigin(url_a, url_b); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool DocumentCanRequest_0_7(PP_Instance instance, struct PP_Var url) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_URLUtil_Dev\""); + AddProp(ss, "__version", "\"0.7\""); + AddProp(ss, "__method", "\"DocumentCanRequest\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "url", ToString_PP_Var(url)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_URLUtil_Dev_0_7*)RealGetInterface("PPB_URLUtil(Dev);0.7"))->DocumentCanRequest(instance, url); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool DocumentCanAccessDocument_0_7(PP_Instance active, PP_Instance target) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_URLUtil_Dev\""); + AddProp(ss, "__version", "\"0.7\""); + AddProp(ss, "__method", "\"DocumentCanAccessDocument\""); + AddProp(ss, "active", ToString_PP_Instance(active)); + AddProp(ss, "target", ToString_PP_Instance(target)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_URLUtil_Dev_0_7*)RealGetInterface("PPB_URLUtil(Dev);0.7"))->DocumentCanAccessDocument(active, target); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static struct PP_Var GetDocumentURL_0_7(PP_Instance instance, struct PP_URLComponents_Dev* components) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_URLUtil_Dev\""); + AddProp(ss, "__version", "\"0.7\""); + AddProp(ss, "__method", "\"GetDocumentURL\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "components", PointerToString(components)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + struct PP_Var rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Var(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + if (!!components) { + iterator.skip(); + FromJSON_PP_URLComponents_Dev(iterator, *components); + } + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + struct PP_Var rval = ((PPB_URLUtil_Dev_0_7*)RealGetInterface("PPB_URLUtil(Dev);0.7"))->GetDocumentURL(instance, components); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_PP_Var(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + if (!!components) { + AddProp(os, "components", ToString_PP_URLComponents_Dev(components)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static struct PP_Var GetPluginInstanceURL_0_7(PP_Instance instance, struct PP_URLComponents_Dev* components) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_URLUtil_Dev\""); + AddProp(ss, "__version", "\"0.7\""); + AddProp(ss, "__method", "\"GetPluginInstanceURL\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "components", PointerToString(components)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + struct PP_Var rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Var(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + if (!!components) { + iterator.skip(); + FromJSON_PP_URLComponents_Dev(iterator, *components); + } + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + struct PP_Var rval = ((PPB_URLUtil_Dev_0_7*)RealGetInterface("PPB_URLUtil(Dev);0.7"))->GetPluginInstanceURL(instance, components); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_PP_Var(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + if (!!components) { + AddProp(os, "components", ToString_PP_URLComponents_Dev(components)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static struct PP_Var GetPluginReferrerURL_0_7(PP_Instance instance, struct PP_URLComponents_Dev* components) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_URLUtil_Dev\""); + AddProp(ss, "__version", "\"0.7\""); + AddProp(ss, "__method", "\"GetPluginReferrerURL\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "components", PointerToString(components)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + struct PP_Var rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Var(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + if (!!components) { + iterator.skip(); + FromJSON_PP_URLComponents_Dev(iterator, *components); + } + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + struct PP_Var rval = ((PPB_URLUtil_Dev_0_7*)RealGetInterface("PPB_URLUtil(Dev);0.7"))->GetPluginReferrerURL(instance, components); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_PP_Var(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + if (!!components) { + AddProp(os, "components", ToString_PP_URLComponents_Dev(components)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +} +static PPB_URLUtil_Dev_0_7 _PPB_URLUtil_Dev_0_7 = { + ns_PPB_URLUtil_Dev_0_7::Canonicalize_0_7, + ns_PPB_URLUtil_Dev_0_7::ResolveRelativeToURL_0_7, + ns_PPB_URLUtil_Dev_0_7::ResolveRelativeToDocument_0_7, + ns_PPB_URLUtil_Dev_0_7::IsSameSecurityOrigin_0_7, + ns_PPB_URLUtil_Dev_0_7::DocumentCanRequest_0_7, + ns_PPB_URLUtil_Dev_0_7::DocumentCanAccessDocument_0_7, + ns_PPB_URLUtil_Dev_0_7::GetDocumentURL_0_7, + ns_PPB_URLUtil_Dev_0_7::GetPluginInstanceURL_0_7, + ns_PPB_URLUtil_Dev_0_7::GetPluginReferrerURL_0_7, +}; +const string ToString_PPB_URLUtil_Dev(const PPB_URLUtil_Dev_0_7 *v) { + stringstream s; + s << v; + return s.str(); +} +namespace ns_PPB_Var_Deprecated_0_3 { +static void AddRef_0_3(struct PP_Var var) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Var_Deprecated\""); + AddProp(ss, "__version", "\"0.3\""); + AddProp(ss, "__method", "\"AddRef\""); + AddProp(ss, "var", ToString_PP_Var(var)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_Var_Deprecated_0_3*)RealGetInterface("PPB_Var(Deprecated);0.3"))->AddRef(var); +#endif // !INTERPOSE +} +static void Release_0_3(struct PP_Var var) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Var_Deprecated\""); + AddProp(ss, "__version", "\"0.3\""); + AddProp(ss, "__method", "\"Release\""); + AddProp(ss, "var", ToString_PP_Var(var)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_Var_Deprecated_0_3*)RealGetInterface("PPB_Var(Deprecated);0.3"))->Release(var); +#endif // !INTERPOSE +} +static struct PP_Var VarFromUtf8_0_3(PP_Module module, const char* data, uint32_t len) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Var_Deprecated\""); + AddProp(ss, "__version", "\"0.3\""); + AddProp(ss, "__method", "\"VarFromUtf8\""); + AddProp(ss, "module", ToString_PP_Module(module)); + AddProp(ss, "data", ToString_str_t(data)); + AddProp(ss, "len", ToString_uint32_t(len)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + struct PP_Var rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Var(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + struct PP_Var rval = ((PPB_Var_Deprecated_0_3*)RealGetInterface("PPB_Var(Deprecated);0.3"))->VarFromUtf8(module, data, len); + printf("RPC response: ["); + printf("%s", ToString_PP_Var(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static const char* VarToUtf8_0_3(struct PP_Var var, uint32_t* len) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Var_Deprecated\""); + AddProp(ss, "__version", "\"0.3\""); + AddProp(ss, "__method", "\"VarToUtf8\""); + AddProp(ss, "var", ToString_PP_Var(var)); + AddProp(ss, "len", PointerToString(len)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + char* rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_str_t(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + iterator.skip(); + FromJSON_uint32_t(iterator, *len); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + const char* rval = ((PPB_Var_Deprecated_0_3*)RealGetInterface("PPB_Var(Deprecated);0.3"))->VarToUtf8(var, len); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_str_t(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + if (!!len) { + AddProp(os, "len", ToString_uint32_t(len)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool HasProperty_0_3(struct PP_Var object, struct PP_Var name, struct PP_Var* exception) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Var_Deprecated\""); + AddProp(ss, "__version", "\"0.3\""); + AddProp(ss, "__method", "\"HasProperty\""); + AddProp(ss, "object", ToString_PP_Var(object)); + AddProp(ss, "name", ToString_PP_Var(name)); + AddProp(ss, "exception", PointerToString(exception)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + iterator.skip(); + FromJSON_PP_Var(iterator, *exception); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_Var_Deprecated_0_3*)RealGetInterface("PPB_Var(Deprecated);0.3"))->HasProperty(object, name, exception); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + if (!!exception) { + AddProp(os, "exception", ToString_PP_Var(exception)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool HasMethod_0_3(struct PP_Var object, struct PP_Var name, struct PP_Var* exception) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Var_Deprecated\""); + AddProp(ss, "__version", "\"0.3\""); + AddProp(ss, "__method", "\"HasMethod\""); + AddProp(ss, "object", ToString_PP_Var(object)); + AddProp(ss, "name", ToString_PP_Var(name)); + AddProp(ss, "exception", PointerToString(exception)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + iterator.skip(); + FromJSON_PP_Var(iterator, *exception); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_Var_Deprecated_0_3*)RealGetInterface("PPB_Var(Deprecated);0.3"))->HasMethod(object, name, exception); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + if (!!exception) { + AddProp(os, "exception", ToString_PP_Var(exception)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static struct PP_Var GetProperty_0_3(struct PP_Var object, struct PP_Var name, struct PP_Var* exception) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Var_Deprecated\""); + AddProp(ss, "__version", "\"0.3\""); + AddProp(ss, "__method", "\"GetProperty\""); + AddProp(ss, "object", ToString_PP_Var(object)); + AddProp(ss, "name", ToString_PP_Var(name)); + AddProp(ss, "exception", PointerToString(exception)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + struct PP_Var rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Var(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + iterator.skip(); + FromJSON_PP_Var(iterator, *exception); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + struct PP_Var rval = ((PPB_Var_Deprecated_0_3*)RealGetInterface("PPB_Var(Deprecated);0.3"))->GetProperty(object, name, exception); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_PP_Var(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + if (!!exception) { + AddProp(os, "exception", ToString_PP_Var(exception)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static void GetAllPropertyNames_0_3(struct PP_Var object, uint32_t* property_count, struct PP_Var** properties, struct PP_Var* exception) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Var_Deprecated\""); + AddProp(ss, "__version", "\"0.3\""); + AddProp(ss, "__method", "\"GetAllPropertyNames\""); + AddProp(ss, "object", ToString_PP_Var(object)); + AddProp(ss, "property_count", PointerToString(property_count)); + AddProp(ss, "properties", PointerToString(properties)); + AddProp(ss, "exception", PointerToString(exception)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectObjectAndGotoFirstProperty(); + iterator.skip(); + FromJSON_uint32_t(iterator, *property_count); + iterator.skip(); + + { + size_t children = iterator.expectArrayAndGotoFirstItem(); + if (children > *property_count) { + Fail("Too many items in array\n", ""); + } + *properties = new struct PP_Var[*property_count]; + for (uint32_t _n = 0; _n < children; ++_n) { + FromJSON_PP_Var(iterator, (*properties)[_n]); + } + // FIXME Null out remaining items? + } + iterator.skip(); + FromJSON_PP_Var(iterator, *exception); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_Var_Deprecated_0_3*)RealGetInterface("PPB_Var(Deprecated);0.3"))->GetAllPropertyNames(object, property_count, properties, exception); + printf("RPC response: ["); + printf("["); + std::stringstream os; + BeginProps(os); + if (!!property_count) { + AddProp(os, "property_count", ToString_uint32_t(property_count)); + } + { + BeginProp(os, "properties"); + BeginElements(os); + for (uint32_t _n = 0; _n < *property_count; ++_n) { + AddElement(os, ToString_PP_Var(properties[_n])); + } + EndElements(os); + } + if (!!exception) { + AddProp(os, "exception", ToString_PP_Var(exception)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); +#endif // !INTERPOSE +} +static void SetProperty_0_3(struct PP_Var object, struct PP_Var name, struct PP_Var value, struct PP_Var* exception) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Var_Deprecated\""); + AddProp(ss, "__version", "\"0.3\""); + AddProp(ss, "__method", "\"SetProperty\""); + AddProp(ss, "object", ToString_PP_Var(object)); + AddProp(ss, "name", ToString_PP_Var(name)); + AddProp(ss, "value", ToString_PP_Var(value)); + AddProp(ss, "exception", PointerToString(exception)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectObjectAndGotoFirstProperty(); + iterator.skip(); + FromJSON_PP_Var(iterator, *exception); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_Var_Deprecated_0_3*)RealGetInterface("PPB_Var(Deprecated);0.3"))->SetProperty(object, name, value, exception); + printf("RPC response: ["); + printf("["); + std::stringstream os; + BeginProps(os); + if (!!exception) { + AddProp(os, "exception", ToString_PP_Var(exception)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); +#endif // !INTERPOSE +} +static void RemoveProperty_0_3(struct PP_Var object, struct PP_Var name, struct PP_Var* exception) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Var_Deprecated\""); + AddProp(ss, "__version", "\"0.3\""); + AddProp(ss, "__method", "\"RemoveProperty\""); + AddProp(ss, "object", ToString_PP_Var(object)); + AddProp(ss, "name", ToString_PP_Var(name)); + AddProp(ss, "exception", PointerToString(exception)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectObjectAndGotoFirstProperty(); + iterator.skip(); + FromJSON_PP_Var(iterator, *exception); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_Var_Deprecated_0_3*)RealGetInterface("PPB_Var(Deprecated);0.3"))->RemoveProperty(object, name, exception); + printf("RPC response: ["); + printf("["); + std::stringstream os; + BeginProps(os); + if (!!exception) { + AddProp(os, "exception", ToString_PP_Var(exception)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); +#endif // !INTERPOSE +} +static struct PP_Var Call_0_3(struct PP_Var object, struct PP_Var method_name, uint32_t argc, const struct PP_Var argv[], struct PP_Var* exception) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Var_Deprecated\""); + AddProp(ss, "__version", "\"0.3\""); + AddProp(ss, "__method", "\"Call\""); + AddProp(ss, "object", ToString_PP_Var(object)); + AddProp(ss, "method_name", ToString_PP_Var(method_name)); + AddProp(ss, "argc", ToString_uint32_t(argc)); + { + BeginProp(ss, "argv"); + BeginElements(ss); + for (uint32_t _n = 0; _n < argc; ++_n) { + AddElement(ss, ToString_PP_Var(argv[_n])); + } + EndElements(ss); + } + AddProp(ss, "exception", PointerToString(exception)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + struct PP_Var rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Var(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + iterator.skip(); + FromJSON_PP_Var(iterator, *exception); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + struct PP_Var rval = ((PPB_Var_Deprecated_0_3*)RealGetInterface("PPB_Var(Deprecated);0.3"))->Call(object, method_name, argc, argv, exception); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_PP_Var(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + if (!!exception) { + AddProp(os, "exception", ToString_PP_Var(exception)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static struct PP_Var Construct_0_3(struct PP_Var object, uint32_t argc, const struct PP_Var argv[], struct PP_Var* exception) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Var_Deprecated\""); + AddProp(ss, "__version", "\"0.3\""); + AddProp(ss, "__method", "\"Construct\""); + AddProp(ss, "object", ToString_PP_Var(object)); + AddProp(ss, "argc", ToString_uint32_t(argc)); + { + BeginProp(ss, "argv"); + BeginElements(ss); + for (uint32_t _n = 0; _n < argc; ++_n) { + AddElement(ss, ToString_PP_Var(argv[_n])); + } + EndElements(ss); + } + AddProp(ss, "exception", PointerToString(exception)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + struct PP_Var rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Var(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + iterator.skip(); + FromJSON_PP_Var(iterator, *exception); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + struct PP_Var rval = ((PPB_Var_Deprecated_0_3*)RealGetInterface("PPB_Var(Deprecated);0.3"))->Construct(object, argc, argv, exception); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_PP_Var(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + if (!!exception) { + AddProp(os, "exception", ToString_PP_Var(exception)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool IsInstanceOf_0_3(struct PP_Var var, const struct PPP_Class_Deprecated_1_0* object_class, void* object_data) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Var_Deprecated\""); + AddProp(ss, "__version", "\"0.3\""); + AddProp(ss, "__method", "\"IsInstanceOf\""); + AddProp(ss, "var", ToString_PP_Var(var)); + AddProp(ss, "object_class", ToString_PPP_Class_Deprecated(object_class)); + AddProp(ss, "object_data", PointerToString(object_data)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + iterator.skip(); + FromJSON_mem_t(iterator, object_data); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + Logging_PPP_Class_Deprecated_holder* logging_object_class = new Logging_PPP_Class_Deprecated_holder(); + logging_object_class->_real_PPP_Class_Deprecated = object_class; + logging_object_class->object = object_data; + object_data = logging_object_class; + PP_Bool rval = ((PPB_Var_Deprecated_0_3*)RealGetInterface("PPB_Var(Deprecated);0.3"))->IsInstanceOf(var, &_interpose_PPP_Class_Deprecated_1_0, object_data); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + AddProp(os, "object_data", ToString_mem_t(object_data)); + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static struct PP_Var CreateObject_0_3(PP_Instance instance, const struct PPP_Class_Deprecated_1_0* object_class, void* object_data) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Var_Deprecated\""); + AddProp(ss, "__version", "\"0.3\""); + AddProp(ss, "__method", "\"CreateObject\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "object_class", ToString_PPP_Class_Deprecated(object_class)); + AddProp(ss, "object_data", ToString_mem_t(object_data)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + struct PP_Var rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Var(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + Logging_PPP_Class_Deprecated_holder* logging_object_class = new Logging_PPP_Class_Deprecated_holder(); + logging_object_class->_real_PPP_Class_Deprecated = object_class; + logging_object_class->object = object_data; + object_data = logging_object_class; + struct PP_Var rval = ((PPB_Var_Deprecated_0_3*)RealGetInterface("PPB_Var(Deprecated);0.3"))->CreateObject(instance, &_interpose_PPP_Class_Deprecated_1_0, object_data); + printf("RPC response: ["); + printf("%s", ToString_PP_Var(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static struct PP_Var CreateObjectWithModuleDeprecated_0_3(PP_Module module, const struct PPP_Class_Deprecated_1_0* object_class, void* object_data) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Var_Deprecated\""); + AddProp(ss, "__version", "\"0.3\""); + AddProp(ss, "__method", "\"CreateObjectWithModuleDeprecated\""); + AddProp(ss, "module", ToString_PP_Module(module)); + AddProp(ss, "object_class", ToString_PPP_Class_Deprecated(object_class)); + AddProp(ss, "object_data", ToString_mem_t(object_data)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + struct PP_Var rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Var(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + Logging_PPP_Class_Deprecated_holder* logging_object_class = new Logging_PPP_Class_Deprecated_holder(); + logging_object_class->_real_PPP_Class_Deprecated = object_class; + logging_object_class->object = object_data; + object_data = logging_object_class; + struct PP_Var rval = ((PPB_Var_Deprecated_0_3*)RealGetInterface("PPB_Var(Deprecated);0.3"))->CreateObjectWithModuleDeprecated(module, &_interpose_PPP_Class_Deprecated_1_0, object_data); + printf("RPC response: ["); + printf("%s", ToString_PP_Var(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +} +static PPB_Var_Deprecated_0_3 _PPB_Var_Deprecated_0_3 = { + ns_PPB_Var_Deprecated_0_3::AddRef_0_3, + ns_PPB_Var_Deprecated_0_3::Release_0_3, + ns_PPB_Var_Deprecated_0_3::VarFromUtf8_0_3, + ns_PPB_Var_Deprecated_0_3::VarToUtf8_0_3, + ns_PPB_Var_Deprecated_0_3::HasProperty_0_3, + ns_PPB_Var_Deprecated_0_3::HasMethod_0_3, + ns_PPB_Var_Deprecated_0_3::GetProperty_0_3, + ns_PPB_Var_Deprecated_0_3::GetAllPropertyNames_0_3, + ns_PPB_Var_Deprecated_0_3::SetProperty_0_3, + ns_PPB_Var_Deprecated_0_3::RemoveProperty_0_3, + ns_PPB_Var_Deprecated_0_3::Call_0_3, + ns_PPB_Var_Deprecated_0_3::Construct_0_3, + ns_PPB_Var_Deprecated_0_3::IsInstanceOf_0_3, + ns_PPB_Var_Deprecated_0_3::CreateObject_0_3, + ns_PPB_Var_Deprecated_0_3::CreateObjectWithModuleDeprecated_0_3, +}; +const string ToString_PPB_Var_Deprecated(const PPB_Var_Deprecated_0_3 *v) { + stringstream s; + s << v; + return s.str(); +} +namespace ns_PPB_VideoCapture_Dev_0_3 { +static PP_Resource Create_0_3(PP_Instance instance) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_VideoCapture_Dev\""); + AddProp(ss, "__version", "\"0.3\""); + AddProp(ss, "__method", "\"Create\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Resource(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_VideoCapture_Dev_0_3*)RealGetInterface("PPB_VideoCapture(Dev);0.3"))->Create(instance); + printf("RPC response: ["); + printf("%s", ToString_PP_Resource(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool IsVideoCapture_0_3(PP_Resource video_capture) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_VideoCapture_Dev\""); + AddProp(ss, "__version", "\"0.3\""); + AddProp(ss, "__method", "\"IsVideoCapture\""); + AddProp(ss, "video_capture", ToString_PP_Resource(video_capture)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_VideoCapture_Dev_0_3*)RealGetInterface("PPB_VideoCapture(Dev);0.3"))->IsVideoCapture(video_capture); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t EnumerateDevices_0_3(PP_Resource video_capture, struct PP_ArrayOutput output, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_VideoCapture_Dev\""); + AddProp(ss, "__version", "\"0.3\""); + AddProp(ss, "__method", "\"EnumerateDevices\""); + AddProp(ss, "video_capture", ToString_PP_Resource(video_capture)); + AddProp(ss, "output", ToString_PP_ArrayOutput(output)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_VideoCapture_Dev_0_3*)RealGetInterface("PPB_VideoCapture(Dev);0.3"))->EnumerateDevices(video_capture, output, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t MonitorDeviceChange_0_3(PP_Resource video_capture, PP_MonitorDeviceChangeCallback callback, void* user_data) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_VideoCapture_Dev\""); + AddProp(ss, "__version", "\"0.3\""); + AddProp(ss, "__method", "\"MonitorDeviceChange\""); + AddProp(ss, "video_capture", ToString_PP_Resource(video_capture)); + AddProp(ss, "callback", ToString_PP_MonitorDeviceChangeCallback(callback)); + AddProp(ss, "user_data", ToString_mem_t(user_data)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_VideoCapture_Dev_0_3*)RealGetInterface("PPB_VideoCapture(Dev);0.3"))->MonitorDeviceChange(video_capture, callback, user_data); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t Open_0_3(PP_Resource video_capture, PP_Resource device_ref, const struct PP_VideoCaptureDeviceInfo_Dev* requested_info, uint32_t buffer_count, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_VideoCapture_Dev\""); + AddProp(ss, "__version", "\"0.3\""); + AddProp(ss, "__method", "\"Open\""); + AddProp(ss, "video_capture", ToString_PP_Resource(video_capture)); + AddProp(ss, "device_ref", ToString_PP_Resource(device_ref)); + AddProp(ss, "requested_info", ToString_PP_VideoCaptureDeviceInfo_Dev(requested_info)); + AddProp(ss, "buffer_count", ToString_uint32_t(buffer_count)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_VideoCapture_Dev_0_3*)RealGetInterface("PPB_VideoCapture(Dev);0.3"))->Open(video_capture, device_ref, requested_info, buffer_count, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t StartCapture_0_3(PP_Resource video_capture) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_VideoCapture_Dev\""); + AddProp(ss, "__version", "\"0.3\""); + AddProp(ss, "__method", "\"StartCapture\""); + AddProp(ss, "video_capture", ToString_PP_Resource(video_capture)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_VideoCapture_Dev_0_3*)RealGetInterface("PPB_VideoCapture(Dev);0.3"))->StartCapture(video_capture); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t ReuseBuffer_0_3(PP_Resource video_capture, uint32_t buffer) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_VideoCapture_Dev\""); + AddProp(ss, "__version", "\"0.3\""); + AddProp(ss, "__method", "\"ReuseBuffer\""); + AddProp(ss, "video_capture", ToString_PP_Resource(video_capture)); + AddProp(ss, "buffer", ToString_uint32_t(buffer)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_VideoCapture_Dev_0_3*)RealGetInterface("PPB_VideoCapture(Dev);0.3"))->ReuseBuffer(video_capture, buffer); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t StopCapture_0_3(PP_Resource video_capture) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_VideoCapture_Dev\""); + AddProp(ss, "__version", "\"0.3\""); + AddProp(ss, "__method", "\"StopCapture\""); + AddProp(ss, "video_capture", ToString_PP_Resource(video_capture)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_VideoCapture_Dev_0_3*)RealGetInterface("PPB_VideoCapture(Dev);0.3"))->StopCapture(video_capture); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static void Close_0_3(PP_Resource video_capture) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_VideoCapture_Dev\""); + AddProp(ss, "__version", "\"0.3\""); + AddProp(ss, "__method", "\"Close\""); + AddProp(ss, "video_capture", ToString_PP_Resource(video_capture)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_VideoCapture_Dev_0_3*)RealGetInterface("PPB_VideoCapture(Dev);0.3"))->Close(video_capture); +#endif // !INTERPOSE +} +} +static PPB_VideoCapture_Dev_0_3 _PPB_VideoCapture_Dev_0_3 = { + ns_PPB_VideoCapture_Dev_0_3::Create_0_3, + ns_PPB_VideoCapture_Dev_0_3::IsVideoCapture_0_3, + ns_PPB_VideoCapture_Dev_0_3::EnumerateDevices_0_3, + ns_PPB_VideoCapture_Dev_0_3::MonitorDeviceChange_0_3, + ns_PPB_VideoCapture_Dev_0_3::Open_0_3, + ns_PPB_VideoCapture_Dev_0_3::StartCapture_0_3, + ns_PPB_VideoCapture_Dev_0_3::ReuseBuffer_0_3, + ns_PPB_VideoCapture_Dev_0_3::StopCapture_0_3, + ns_PPB_VideoCapture_Dev_0_3::Close_0_3, +}; +const string ToString_PPB_VideoCapture_Dev(const PPB_VideoCapture_Dev_0_3 *v) { + stringstream s; + s << v; + return s.str(); +} +namespace ns_PPB_VideoDecoder_Dev_0_16 { +static PP_Resource Create_0_16(PP_Instance instance, PP_Resource context, PP_VideoDecoder_Profile profile) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_VideoDecoder_Dev\""); + AddProp(ss, "__version", "\"0.16\""); + AddProp(ss, "__method", "\"Create\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "context", ToString_PP_Resource(context)); + AddProp(ss, "profile", ToString_PP_VideoDecoder_Profile(profile)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Resource(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_VideoDecoder_Dev_0_16*)RealGetInterface("PPB_VideoDecoder(Dev);0.16"))->Create(instance, context, profile); + printf("RPC response: ["); + printf("%s", ToString_PP_Resource(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool IsVideoDecoder_0_16(PP_Resource resource) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_VideoDecoder_Dev\""); + AddProp(ss, "__version", "\"0.16\""); + AddProp(ss, "__method", "\"IsVideoDecoder\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_VideoDecoder_Dev_0_16*)RealGetInterface("PPB_VideoDecoder(Dev);0.16"))->IsVideoDecoder(resource); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t Decode_0_16(PP_Resource video_decoder, const struct PP_VideoBitstreamBuffer_Dev* bitstream_buffer, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_VideoDecoder_Dev\""); + AddProp(ss, "__version", "\"0.16\""); + AddProp(ss, "__method", "\"Decode\""); + AddProp(ss, "video_decoder", ToString_PP_Resource(video_decoder)); + AddProp(ss, "bitstream_buffer", ToString_PP_VideoBitstreamBuffer_Dev(bitstream_buffer)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_VideoDecoder_Dev_0_16*)RealGetInterface("PPB_VideoDecoder(Dev);0.16"))->Decode(video_decoder, bitstream_buffer, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static void AssignPictureBuffers_0_16(PP_Resource video_decoder, uint32_t no_of_buffers, const struct PP_PictureBuffer_Dev buffers[]) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_VideoDecoder_Dev\""); + AddProp(ss, "__version", "\"0.16\""); + AddProp(ss, "__method", "\"AssignPictureBuffers\""); + AddProp(ss, "video_decoder", ToString_PP_Resource(video_decoder)); + AddProp(ss, "no_of_buffers", ToString_uint32_t(no_of_buffers)); + { + BeginProp(ss, "buffers"); + BeginElements(ss); + for (uint32_t _n = 0; _n < no_of_buffers; ++_n) { + AddElement(ss, ToString_PP_PictureBuffer_Dev(buffers[_n])); + } + EndElements(ss); + } + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_VideoDecoder_Dev_0_16*)RealGetInterface("PPB_VideoDecoder(Dev);0.16"))->AssignPictureBuffers(video_decoder, no_of_buffers, buffers); +#endif // !INTERPOSE +} +static void ReusePictureBuffer_0_16(PP_Resource video_decoder, int32_t picture_buffer_id) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_VideoDecoder_Dev\""); + AddProp(ss, "__version", "\"0.16\""); + AddProp(ss, "__method", "\"ReusePictureBuffer\""); + AddProp(ss, "video_decoder", ToString_PP_Resource(video_decoder)); + AddProp(ss, "picture_buffer_id", ToString_int32_t(picture_buffer_id)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_VideoDecoder_Dev_0_16*)RealGetInterface("PPB_VideoDecoder(Dev);0.16"))->ReusePictureBuffer(video_decoder, picture_buffer_id); +#endif // !INTERPOSE +} +static int32_t Flush_0_16(PP_Resource video_decoder, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_VideoDecoder_Dev\""); + AddProp(ss, "__version", "\"0.16\""); + AddProp(ss, "__method", "\"Flush\""); + AddProp(ss, "video_decoder", ToString_PP_Resource(video_decoder)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_VideoDecoder_Dev_0_16*)RealGetInterface("PPB_VideoDecoder(Dev);0.16"))->Flush(video_decoder, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t Reset_0_16(PP_Resource video_decoder, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_VideoDecoder_Dev\""); + AddProp(ss, "__version", "\"0.16\""); + AddProp(ss, "__method", "\"Reset\""); + AddProp(ss, "video_decoder", ToString_PP_Resource(video_decoder)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_VideoDecoder_Dev_0_16*)RealGetInterface("PPB_VideoDecoder(Dev);0.16"))->Reset(video_decoder, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static void Destroy_0_16(PP_Resource video_decoder) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_VideoDecoder_Dev\""); + AddProp(ss, "__version", "\"0.16\""); + AddProp(ss, "__method", "\"Destroy\""); + AddProp(ss, "video_decoder", ToString_PP_Resource(video_decoder)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_VideoDecoder_Dev_0_16*)RealGetInterface("PPB_VideoDecoder(Dev);0.16"))->Destroy(video_decoder); +#endif // !INTERPOSE +} +} +static PPB_VideoDecoder_Dev_0_16 _PPB_VideoDecoder_Dev_0_16 = { + ns_PPB_VideoDecoder_Dev_0_16::Create_0_16, + ns_PPB_VideoDecoder_Dev_0_16::IsVideoDecoder_0_16, + ns_PPB_VideoDecoder_Dev_0_16::Decode_0_16, + ns_PPB_VideoDecoder_Dev_0_16::AssignPictureBuffers_0_16, + ns_PPB_VideoDecoder_Dev_0_16::ReusePictureBuffer_0_16, + ns_PPB_VideoDecoder_Dev_0_16::Flush_0_16, + ns_PPB_VideoDecoder_Dev_0_16::Reset_0_16, + ns_PPB_VideoDecoder_Dev_0_16::Destroy_0_16, +}; +const string ToString_PPB_VideoDecoder_Dev(const PPB_VideoDecoder_Dev_0_16 *v) { + stringstream s; + s << v; + return s.str(); +} +namespace ns_PPB_View_Dev_0_1 { +static float GetDeviceScale_0_1(PP_Resource resource) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_View_Dev\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"GetDeviceScale\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + float rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_float_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + float rval = ((PPB_View_Dev_0_1*)RealGetInterface("PPB_View(Dev);0.1"))->GetDeviceScale(resource); + printf("RPC response: ["); + printf("%s", ToString_float_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static float GetCSSScale_0_1(PP_Resource resource) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_View_Dev\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"GetCSSScale\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + float rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_float_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + float rval = ((PPB_View_Dev_0_1*)RealGetInterface("PPB_View(Dev);0.1"))->GetCSSScale(resource); + printf("RPC response: ["); + printf("%s", ToString_float_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +} +static PPB_View_Dev_0_1 _PPB_View_Dev_0_1 = { + ns_PPB_View_Dev_0_1::GetDeviceScale_0_1, + ns_PPB_View_Dev_0_1::GetCSSScale_0_1, +}; +const string ToString_PPB_View_Dev(const PPB_View_Dev_0_1 *v) { + stringstream s; + s << v; + return s.str(); +} +char* Call_PPP_Class_Deprecated_HasProperty(const PPP_Class_Deprecated* _interface, JSONIterator& iterator) { + void* object; + iterator.skip(); + FromJSON_mem_t(iterator, object); + struct PP_Var name; + iterator.skip(); + FromJSON_PP_Var(iterator, name); + struct PP_Var exception; + PP_Bool rval; + rval = _interface->HasProperty((const void* )object, (struct PP_Var )name, (struct PP_Var* )&exception); + stringstream os; + BeginElements(os); + AddElement(os, ToString_PP_Bool(rval).c_str()); + BeginElement(os); + BeginProps(os); + AddProp(os, "exception", ToString_PP_Var(exception)); + EndProps(os); + EndElements(os); + return strdup(os.str().c_str()); +} +char* Call_PPP_Class_Deprecated_HasMethod(const PPP_Class_Deprecated* _interface, JSONIterator& iterator) { + void* object; + iterator.skip(); + FromJSON_mem_t(iterator, object); + struct PP_Var name; + iterator.skip(); + FromJSON_PP_Var(iterator, name); + struct PP_Var exception; + PP_Bool rval; + rval = _interface->HasMethod((const void* )object, (struct PP_Var )name, (struct PP_Var* )&exception); + stringstream os; + BeginElements(os); + AddElement(os, ToString_PP_Bool(rval).c_str()); + BeginElement(os); + BeginProps(os); + AddProp(os, "exception", ToString_PP_Var(exception)); + EndProps(os); + EndElements(os); + return strdup(os.str().c_str()); +} +char* Call_PPP_Class_Deprecated_GetProperty(const PPP_Class_Deprecated* _interface, JSONIterator& iterator) { + void* object; + iterator.skip(); + FromJSON_mem_t(iterator, object); + struct PP_Var name; + iterator.skip(); + FromJSON_PP_Var(iterator, name); + struct PP_Var exception; + struct PP_Var rval; + rval = _interface->GetProperty((const void* )object, (struct PP_Var )name, (struct PP_Var* )&exception); + stringstream os; + BeginElements(os); + AddElement(os, ToString_PP_Var(rval).c_str()); + BeginElement(os); + BeginProps(os); + AddProp(os, "exception", ToString_PP_Var(exception)); + EndProps(os); + EndElements(os); + return strdup(os.str().c_str()); +} +char* Call_PPP_Class_Deprecated_GetAllPropertyNames(const PPP_Class_Deprecated* _interface, JSONIterator& iterator) { + void* object; + iterator.skip(); + FromJSON_mem_t(iterator, object); + uint32_t property_count; + struct PP_Var *properties; + iterator.skip(); + PointerValueFromJSON(iterator, properties); + struct PP_Var exception; + _interface->GetAllPropertyNames((const void* )object, (uint32_t* )&property_count, (struct PP_Var** )&properties, (struct PP_Var* )&exception); + stringstream os; + BeginElements(os); + BeginProps(os); + AddProp(os, "property_count", ToString_uint32_t(property_count)); + { + BeginProp(os, "properties"); + BeginElements(os); + for (uint32_t _n = 0; _n < property_count; ++_n) { + AddElement(os, ToString_PP_Var(properties[_n])); + } + EndElements(os); + } + AddProp(os, "exception", ToString_PP_Var(exception)); + EndProps(os); + EndElements(os); + return strdup(os.str().c_str()); +} +char* Call_PPP_Class_Deprecated_SetProperty(const PPP_Class_Deprecated* _interface, JSONIterator& iterator) { + void* object; + iterator.skip(); + FromJSON_mem_t(iterator, object); + struct PP_Var name; + iterator.skip(); + FromJSON_PP_Var(iterator, name); + struct PP_Var value; + iterator.skip(); + FromJSON_PP_Var(iterator, value); + struct PP_Var exception; + _interface->SetProperty((const void* )object, (struct PP_Var )name, (struct PP_Var )value, (struct PP_Var* )&exception); + stringstream os; + BeginElements(os); + BeginProps(os); + AddProp(os, "exception", ToString_PP_Var(exception)); + EndProps(os); + EndElements(os); + return strdup(os.str().c_str()); +} +char* Call_PPP_Class_Deprecated_RemoveProperty(const PPP_Class_Deprecated* _interface, JSONIterator& iterator) { + void* object; + iterator.skip(); + FromJSON_mem_t(iterator, object); + struct PP_Var name; + iterator.skip(); + FromJSON_PP_Var(iterator, name); + struct PP_Var exception; + _interface->RemoveProperty((const void* )object, (struct PP_Var )name, (struct PP_Var* )&exception); + stringstream os; + BeginElements(os); + BeginProps(os); + AddProp(os, "exception", ToString_PP_Var(exception)); + EndProps(os); + EndElements(os); + return strdup(os.str().c_str()); +} +char* Call_PPP_Class_Deprecated_Call(const PPP_Class_Deprecated* _interface, JSONIterator& iterator) { + void* object; + iterator.skip(); + FromJSON_mem_t(iterator, object); + struct PP_Var method_name; + iterator.skip(); + FromJSON_PP_Var(iterator, method_name); + uint32_t argc; + iterator.skip(); + FromJSON_uint32_t(iterator, argc); + struct PP_Var *argv; + iterator.skip(); + + { + size_t children = iterator.expectArrayAndGotoFirstItem(); + if (children > argc) { + Fail("Too many items in array\n", ""); + } + argv = new struct PP_Var[argc]; + for (uint32_t _n = 0; _n < children; ++_n) { + FromJSON_PP_Var(iterator, (argv)[_n]); + } + // FIXME Null out remaining items? + } + struct PP_Var exception; + struct PP_Var rval; + rval = _interface->Call((const void* )object, (struct PP_Var )method_name, (uint32_t )argc, (const struct PP_Var *)argv, (struct PP_Var* )&exception); + stringstream os; + BeginElements(os); + AddElement(os, ToString_PP_Var(rval).c_str()); + BeginElement(os); + BeginProps(os); + AddProp(os, "exception", ToString_PP_Var(exception)); + EndProps(os); + EndElements(os); + return strdup(os.str().c_str()); +} +char* Call_PPP_Class_Deprecated_Construct(const PPP_Class_Deprecated* _interface, JSONIterator& iterator) { + void* object; + iterator.skip(); + FromJSON_mem_t(iterator, object); + uint32_t argc; + iterator.skip(); + FromJSON_uint32_t(iterator, argc); + struct PP_Var *argv; + iterator.skip(); + + { + size_t children = iterator.expectArrayAndGotoFirstItem(); + if (children > argc) { + Fail("Too many items in array\n", ""); + } + argv = new struct PP_Var[argc]; + for (uint32_t _n = 0; _n < children; ++_n) { + FromJSON_PP_Var(iterator, (argv)[_n]); + } + // FIXME Null out remaining items? + } + struct PP_Var exception; + struct PP_Var rval; + rval = _interface->Construct((const void* )object, (uint32_t )argc, (const struct PP_Var *)argv, (struct PP_Var* )&exception); + stringstream os; + BeginElements(os); + AddElement(os, ToString_PP_Var(rval).c_str()); + BeginElement(os); + BeginProps(os); + AddProp(os, "exception", ToString_PP_Var(exception)); + EndProps(os); + EndElements(os); + return strdup(os.str().c_str()); +} +char* Call_PPP_Class_Deprecated_Deallocate(const PPP_Class_Deprecated* _interface, JSONIterator& iterator) { + void* object; + iterator.skip(); + FromJSON_mem_t(iterator, object); + _interface->Deallocate((const void* )object); + return nullptr; +} +char* Call_PPP_Class_Deprecated(const void* _interface, JSONIterator& iterator) { + iterator.skip(); + const Token& member = iterator.getCurrentStringAndGotoNext(); + string memberName = member.value(); + if (!memberName.compare("HasProperty")) { + return Call_PPP_Class_Deprecated_HasProperty((const PPP_Class_Deprecated*)_interface, iterator); + } + if (!memberName.compare("HasMethod")) { + return Call_PPP_Class_Deprecated_HasMethod((const PPP_Class_Deprecated*)_interface, iterator); + } + if (!memberName.compare("GetProperty")) { + return Call_PPP_Class_Deprecated_GetProperty((const PPP_Class_Deprecated*)_interface, iterator); + } + if (!memberName.compare("GetAllPropertyNames")) { + return Call_PPP_Class_Deprecated_GetAllPropertyNames((const PPP_Class_Deprecated*)_interface, iterator); + } + if (!memberName.compare("SetProperty")) { + return Call_PPP_Class_Deprecated_SetProperty((const PPP_Class_Deprecated*)_interface, iterator); + } + if (!memberName.compare("RemoveProperty")) { + return Call_PPP_Class_Deprecated_RemoveProperty((const PPP_Class_Deprecated*)_interface, iterator); + } + if (!memberName.compare("Call")) { + return Call_PPP_Class_Deprecated_Call((const PPP_Class_Deprecated*)_interface, iterator); + } + if (!memberName.compare("Construct")) { + return Call_PPP_Class_Deprecated_Construct((const PPP_Class_Deprecated*)_interface, iterator); + } + if (!memberName.compare("Deallocate")) { + return Call_PPP_Class_Deprecated_Deallocate((const PPP_Class_Deprecated*)_interface, iterator); + } + return nullptr; +} +char* Call_PPP_NetworkState_Dev_SetOnLine(const PPP_NetworkState_Dev* _interface, JSONIterator& iterator) { + PP_Bool is_online; + iterator.skip(); + FromJSON_PP_Bool(iterator, is_online); + _interface->SetOnLine((PP_Bool )is_online); + return nullptr; +} +char* Call_PPP_NetworkState_Dev(const void* _interface, JSONIterator& iterator) { + iterator.skip(); + const Token& member = iterator.getCurrentStringAndGotoNext(); + string memberName = member.value(); + if (!memberName.compare("SetOnLine")) { + return Call_PPP_NetworkState_Dev_SetOnLine((const PPP_NetworkState_Dev*)_interface, iterator); + } + return nullptr; +} +const string ToString_PP_PrintPageNumberRange_Dev(const PP_PrintPageNumberRange_Dev *v) { + if (!v) { + return "null"; + } + return ToString_PP_PrintPageNumberRange_Dev(*v); +} +const string ToString_PP_PrintPageNumberRange_Dev(const PP_PrintPageNumberRange_Dev &v) { + stringstream x; + BeginProps(x); + AddProp(x, "first_page_number", ToString_uint32_t(v.first_page_number)); + AddProp(x, "last_page_number", ToString_uint32_t(v.last_page_number)); + EndProps(x); + return x.str(); +} +void FromJSON_PP_PrintPageNumberRange_Dev(JSONIterator& iterator, PP_PrintPageNumberRange_Dev &value) { + const JSON::Token& current = iterator.getCurrentAndGotoNext(); + if (current.isPrimitive() && !current.value().compare("null")) { + return; + } + if (!current.isObject()) { + Fail("Expected object!", ""); + } + iterator.skip(); + FromJSON_uint32_t(iterator, value.first_page_number); + iterator.skip(); + FromJSON_uint32_t(iterator, value.last_page_number); +} +char* Call_PPP_Printing_Dev_QuerySupportedFormats(const PPP_Printing_Dev* _interface, JSONIterator& iterator) { + PP_Instance instance; + iterator.skip(); + FromJSON_PP_Instance(iterator, instance); + uint32_t rval; + rval = _interface->QuerySupportedFormats((PP_Instance )instance); + return strdup(ToString_uint32_t(rval).c_str()); +} +char* Call_PPP_Printing_Dev_Begin(const PPP_Printing_Dev* _interface, JSONIterator& iterator) { + PP_Instance instance; + iterator.skip(); + FromJSON_PP_Instance(iterator, instance); + struct PP_PrintSettings_Dev print_settings; + iterator.skip(); + FromJSON_PP_PrintSettings_Dev(iterator, print_settings); + int32_t rval; + rval = _interface->Begin((PP_Instance )instance, (const struct PP_PrintSettings_Dev* )&print_settings); + return strdup(ToString_int32_t(rval).c_str()); +} +char* Call_PPP_Printing_Dev_PrintPages(const PPP_Printing_Dev* _interface, JSONIterator& iterator) { + PP_Instance instance; + iterator.skip(); + FromJSON_PP_Instance(iterator, instance); + struct PP_PrintPageNumberRange_Dev page_ranges; + iterator.skip(); + FromJSON_PP_PrintPageNumberRange_Dev(iterator, page_ranges); + uint32_t page_range_count; + iterator.skip(); + FromJSON_uint32_t(iterator, page_range_count); + int32_t rval; + rval = _interface->PrintPages((PP_Instance )instance, (const struct PP_PrintPageNumberRange_Dev* )&page_ranges, (uint32_t )page_range_count); + return strdup(ToString_PP_Resource(rval).c_str()); +} +char* Call_PPP_Printing_Dev_End(const PPP_Printing_Dev* _interface, JSONIterator& iterator) { + PP_Instance instance; + iterator.skip(); + FromJSON_PP_Instance(iterator, instance); + _interface->End((PP_Instance )instance); + return nullptr; +} +char* Call_PPP_Printing_Dev_IsScalingDisabled(const PPP_Printing_Dev* _interface, JSONIterator& iterator) { + PP_Instance instance; + iterator.skip(); + FromJSON_PP_Instance(iterator, instance); + PP_Bool rval; + rval = _interface->IsScalingDisabled((PP_Instance )instance); + return strdup(ToString_PP_Bool(rval).c_str()); +} +char* Call_PPP_Printing_Dev(const void* _interface, JSONIterator& iterator) { + iterator.skip(); + const Token& member = iterator.getCurrentStringAndGotoNext(); + string memberName = member.value(); + if (!memberName.compare("QuerySupportedFormats")) { + return Call_PPP_Printing_Dev_QuerySupportedFormats((const PPP_Printing_Dev*)_interface, iterator); + } + if (!memberName.compare("Begin")) { + return Call_PPP_Printing_Dev_Begin((const PPP_Printing_Dev*)_interface, iterator); + } + if (!memberName.compare("PrintPages")) { + return Call_PPP_Printing_Dev_PrintPages((const PPP_Printing_Dev*)_interface, iterator); + } + if (!memberName.compare("End")) { + return Call_PPP_Printing_Dev_End((const PPP_Printing_Dev*)_interface, iterator); + } + if (!memberName.compare("IsScalingDisabled")) { + return Call_PPP_Printing_Dev_IsScalingDisabled((const PPP_Printing_Dev*)_interface, iterator); + } + return nullptr; +} +char* Call_PPP_TextInput_Dev_RequestSurroundingText(const PPP_TextInput_Dev* _interface, JSONIterator& iterator) { + PP_Instance instance; + iterator.skip(); + FromJSON_PP_Instance(iterator, instance); + uint32_t desired_number_of_characters; + iterator.skip(); + FromJSON_uint32_t(iterator, desired_number_of_characters); + _interface->RequestSurroundingText((PP_Instance )instance, (uint32_t )desired_number_of_characters); + return nullptr; +} +char* Call_PPP_TextInput_Dev(const void* _interface, JSONIterator& iterator) { + iterator.skip(); + const Token& member = iterator.getCurrentStringAndGotoNext(); + string memberName = member.value(); + if (!memberName.compare("RequestSurroundingText")) { + return Call_PPP_TextInput_Dev_RequestSurroundingText((const PPP_TextInput_Dev*)_interface, iterator); + } + return nullptr; +} +char* Call_PPP_VideoCapture_Dev_OnDeviceInfo(const PPP_VideoCapture_Dev* _interface, JSONIterator& iterator) { + PP_Instance instance; + iterator.skip(); + FromJSON_PP_Instance(iterator, instance); + PP_Resource video_capture; + iterator.skip(); + FromJSON_PP_Resource(iterator, video_capture); + struct PP_VideoCaptureDeviceInfo_Dev info; + iterator.skip(); + FromJSON_PP_VideoCaptureDeviceInfo_Dev(iterator, info); + uint32_t buffer_count; + iterator.skip(); + FromJSON_uint32_t(iterator, buffer_count); + PP_Resource *buffers; + iterator.skip(); + + { + size_t children = iterator.expectArrayAndGotoFirstItem(); + if (children > buffer_count) { + Fail("Too many items in array\n", ""); + } + buffers = new PP_Resource[buffer_count]; + for (uint32_t _n = 0; _n < children; ++_n) { + FromJSON_PP_Resource(iterator, (buffers)[_n]); + } + // FIXME Null out remaining items? + } + _interface->OnDeviceInfo((PP_Instance )instance, (PP_Resource )video_capture, (const struct PP_VideoCaptureDeviceInfo_Dev* )&info, (uint32_t )buffer_count, (const PP_Resource *)buffers); + return nullptr; +} +char* Call_PPP_VideoCapture_Dev_OnStatus(const PPP_VideoCapture_Dev* _interface, JSONIterator& iterator) { + PP_Instance instance; + iterator.skip(); + FromJSON_PP_Instance(iterator, instance); + PP_Resource video_capture; + iterator.skip(); + FromJSON_PP_Resource(iterator, video_capture); + uint32_t status; + iterator.skip(); + FromJSON_uint32_t(iterator, status); + _interface->OnStatus((PP_Instance )instance, (PP_Resource )video_capture, (uint32_t )status); + return nullptr; +} +char* Call_PPP_VideoCapture_Dev_OnError(const PPP_VideoCapture_Dev* _interface, JSONIterator& iterator) { + PP_Instance instance; + iterator.skip(); + FromJSON_PP_Instance(iterator, instance); + PP_Resource video_capture; + iterator.skip(); + FromJSON_PP_Resource(iterator, video_capture); + uint32_t error_code; + iterator.skip(); + FromJSON_uint32_t(iterator, error_code); + _interface->OnError((PP_Instance )instance, (PP_Resource )video_capture, (uint32_t )error_code); + return nullptr; +} +char* Call_PPP_VideoCapture_Dev_OnBufferReady(const PPP_VideoCapture_Dev* _interface, JSONIterator& iterator) { + PP_Instance instance; + iterator.skip(); + FromJSON_PP_Instance(iterator, instance); + PP_Resource video_capture; + iterator.skip(); + FromJSON_PP_Resource(iterator, video_capture); + uint32_t buffer; + iterator.skip(); + FromJSON_uint32_t(iterator, buffer); + _interface->OnBufferReady((PP_Instance )instance, (PP_Resource )video_capture, (uint32_t )buffer); + return nullptr; +} +char* Call_PPP_VideoCapture_Dev(const void* _interface, JSONIterator& iterator) { + iterator.skip(); + const Token& member = iterator.getCurrentStringAndGotoNext(); + string memberName = member.value(); + if (!memberName.compare("OnDeviceInfo")) { + return Call_PPP_VideoCapture_Dev_OnDeviceInfo((const PPP_VideoCapture_Dev*)_interface, iterator); + } + if (!memberName.compare("OnStatus")) { + return Call_PPP_VideoCapture_Dev_OnStatus((const PPP_VideoCapture_Dev*)_interface, iterator); + } + if (!memberName.compare("OnError")) { + return Call_PPP_VideoCapture_Dev_OnError((const PPP_VideoCapture_Dev*)_interface, iterator); + } + if (!memberName.compare("OnBufferReady")) { + return Call_PPP_VideoCapture_Dev_OnBufferReady((const PPP_VideoCapture_Dev*)_interface, iterator); + } + return nullptr; +} +char* Call_PPP_VideoDecoder_Dev_ProvidePictureBuffers(const PPP_VideoDecoder_Dev* _interface, JSONIterator& iterator) { + PP_Instance instance; + iterator.skip(); + FromJSON_PP_Instance(iterator, instance); + PP_Resource decoder; + iterator.skip(); + FromJSON_PP_Resource(iterator, decoder); + uint32_t req_num_of_bufs; + iterator.skip(); + FromJSON_uint32_t(iterator, req_num_of_bufs); + struct PP_Size dimensions; + iterator.skip(); + FromJSON_PP_Size(iterator, dimensions); + uint32_t texture_target; + iterator.skip(); + FromJSON_uint32_t(iterator, texture_target); + _interface->ProvidePictureBuffers((PP_Instance )instance, (PP_Resource )decoder, (uint32_t )req_num_of_bufs, (const struct PP_Size* )&dimensions, (uint32_t )texture_target); + return nullptr; +} +char* Call_PPP_VideoDecoder_Dev_DismissPictureBuffer(const PPP_VideoDecoder_Dev* _interface, JSONIterator& iterator) { + PP_Instance instance; + iterator.skip(); + FromJSON_PP_Instance(iterator, instance); + PP_Resource decoder; + iterator.skip(); + FromJSON_PP_Resource(iterator, decoder); + int32_t picture_buffer_id; + iterator.skip(); + FromJSON_int32_t(iterator, picture_buffer_id); + _interface->DismissPictureBuffer((PP_Instance )instance, (PP_Resource )decoder, (int32_t )picture_buffer_id); + return nullptr; +} +char* Call_PPP_VideoDecoder_Dev_PictureReady(const PPP_VideoDecoder_Dev* _interface, JSONIterator& iterator) { + PP_Instance instance; + iterator.skip(); + FromJSON_PP_Instance(iterator, instance); + PP_Resource decoder; + iterator.skip(); + FromJSON_PP_Resource(iterator, decoder); + struct PP_Picture_Dev picture; + iterator.skip(); + FromJSON_PP_Picture_Dev(iterator, picture); + _interface->PictureReady((PP_Instance )instance, (PP_Resource )decoder, (const struct PP_Picture_Dev* )&picture); + return nullptr; +} +char* Call_PPP_VideoDecoder_Dev_NotifyError(const PPP_VideoDecoder_Dev* _interface, JSONIterator& iterator) { + PP_Instance instance; + iterator.skip(); + FromJSON_PP_Instance(iterator, instance); + PP_Resource decoder; + iterator.skip(); + FromJSON_PP_Resource(iterator, decoder); + PP_VideoDecodeError_Dev error; + iterator.skip(); + FromJSON_PP_VideoDecodeError_Dev(iterator, error); + _interface->NotifyError((PP_Instance )instance, (PP_Resource )decoder, (PP_VideoDecodeError_Dev )error); + return nullptr; +} +char* Call_PPP_VideoDecoder_Dev(const void* _interface, JSONIterator& iterator) { + iterator.skip(); + const Token& member = iterator.getCurrentStringAndGotoNext(); + string memberName = member.value(); + if (!memberName.compare("ProvidePictureBuffers")) { + return Call_PPP_VideoDecoder_Dev_ProvidePictureBuffers((const PPP_VideoDecoder_Dev*)_interface, iterator); + } + if (!memberName.compare("DismissPictureBuffer")) { + return Call_PPP_VideoDecoder_Dev_DismissPictureBuffer((const PPP_VideoDecoder_Dev*)_interface, iterator); + } + if (!memberName.compare("PictureReady")) { + return Call_PPP_VideoDecoder_Dev_PictureReady((const PPP_VideoDecoder_Dev*)_interface, iterator); + } + if (!memberName.compare("NotifyError")) { + return Call_PPP_VideoDecoder_Dev_NotifyError((const PPP_VideoDecoder_Dev*)_interface, iterator); + } + return nullptr; +} +const string ToString_PP_DecryptTrackingInfo(const PP_DecryptTrackingInfo *v) { + if (!v) { + return "null"; + } + return ToString_PP_DecryptTrackingInfo(*v); +} +const string ToString_PP_DecryptTrackingInfo(const PP_DecryptTrackingInfo &v) { + stringstream x; + BeginProps(x); + AddProp(x, "request_id", ToString_uint32_t(v.request_id)); + AddProp(x, "buffer_id", ToString_uint32_t(v.buffer_id)); + AddProp(x, "timestamp", ToString_int64_t(v.timestamp)); + EndProps(x); + return x.str(); +} +void FromJSON_PP_DecryptTrackingInfo(JSONIterator& iterator, PP_DecryptTrackingInfo &value) { + const JSON::Token& current = iterator.getCurrentAndGotoNext(); + if (current.isPrimitive() && !current.value().compare("null")) { + return; + } + if (!current.isObject()) { + Fail("Expected object!", ""); + } + iterator.skip(); + FromJSON_uint32_t(iterator, value.request_id); + iterator.skip(); + FromJSON_uint32_t(iterator, value.buffer_id); + iterator.skip(); + FromJSON_int64_t(iterator, value.timestamp); +} +const string ToString_PP_DecryptSubsampleDescription(const PP_DecryptSubsampleDescription *v) { + if (!v) { + return "null"; + } + return ToString_PP_DecryptSubsampleDescription(*v); +} +const string ToString_PP_DecryptSubsampleDescription(const PP_DecryptSubsampleDescription &v) { + stringstream x; + BeginProps(x); + AddProp(x, "clear_bytes", ToString_uint32_t(v.clear_bytes)); + AddProp(x, "cipher_bytes", ToString_uint32_t(v.cipher_bytes)); + EndProps(x); + return x.str(); +} +void FromJSON_PP_DecryptSubsampleDescription(JSONIterator& iterator, PP_DecryptSubsampleDescription &value) { + const JSON::Token& current = iterator.getCurrentAndGotoNext(); + if (current.isPrimitive() && !current.value().compare("null")) { + return; + } + if (!current.isObject()) { + Fail("Expected object!", ""); + } + iterator.skip(); + FromJSON_uint32_t(iterator, value.clear_bytes); + iterator.skip(); + FromJSON_uint32_t(iterator, value.cipher_bytes); +} +const string ToString_PP_EncryptedBlockInfo(const PP_EncryptedBlockInfo *v) { + if (!v) { + return "null"; + } + return ToString_PP_EncryptedBlockInfo(*v); +} +const string ToString_PP_EncryptedBlockInfo(const PP_EncryptedBlockInfo &v) { + stringstream x; + BeginProps(x); + AddProp(x, "tracking_info", ToString_PP_DecryptTrackingInfo(v.tracking_info)); + AddProp(x, "data_size", ToString_uint32_t(v.data_size)); + { + BeginProp(x, "key_id"); + BeginElements(x); + for (uint32_t _n = 0; _n < 64; ++_n) { + AddElement(x, ToString_uint8_t(v.key_id[_n])); + } + EndElements(x); + } + AddProp(x, "key_id_size", ToString_uint32_t(v.key_id_size)); + { + BeginProp(x, "iv"); + BeginElements(x); + for (uint32_t _n = 0; _n < 16; ++_n) { + AddElement(x, ToString_uint8_t(v.iv[_n])); + } + EndElements(x); + } + AddProp(x, "iv_size", ToString_uint32_t(v.iv_size)); + { + BeginProp(x, "subsamples"); + BeginElements(x); + for (uint32_t _n = 0; _n < 32; ++_n) { + AddElement(x, ToString_PP_DecryptSubsampleDescription(v.subsamples[_n])); + } + EndElements(x); + } + AddProp(x, "num_subsamples", ToString_uint32_t(v.num_subsamples)); + EndProps(x); + return x.str(); +} +void FromJSON_PP_EncryptedBlockInfo(JSONIterator& iterator, PP_EncryptedBlockInfo &value) { + const JSON::Token& current = iterator.getCurrentAndGotoNext(); + if (current.isPrimitive() && !current.value().compare("null")) { + return; + } + if (!current.isObject()) { + Fail("Expected object!", ""); + } + iterator.skip(); + FromJSON_PP_DecryptTrackingInfo(iterator, value.tracking_info); + iterator.skip(); + FromJSON_uint32_t(iterator, value.data_size); + iterator.skip(); + + { + size_t children = iterator.expectArrayAndGotoFirstItem(); + if (children > 64) { + Fail("Too many items in array\n", ""); + } + for (uint32_t _n = 0; _n < children; ++_n) { + FromJSON_uint8_t(iterator, (value.key_id)[_n]); + } + // FIXME Null out remaining items? + } + iterator.skip(); + FromJSON_uint32_t(iterator, value.key_id_size); + iterator.skip(); + + { + size_t children = iterator.expectArrayAndGotoFirstItem(); + if (children > 16) { + Fail("Too many items in array\n", ""); + } + for (uint32_t _n = 0; _n < children; ++_n) { + FromJSON_uint8_t(iterator, (value.iv)[_n]); + } + // FIXME Null out remaining items? + } + iterator.skip(); + FromJSON_uint32_t(iterator, value.iv_size); + iterator.skip(); + + { + size_t children = iterator.expectArrayAndGotoFirstItem(); + if (children > 32) { + Fail("Too many items in array\n", ""); + } + for (uint32_t _n = 0; _n < children; ++_n) { + FromJSON_PP_DecryptSubsampleDescription(iterator, (value.subsamples)[_n]); + } + // FIXME Null out remaining items? + } + iterator.skip(); + FromJSON_uint32_t(iterator, value.num_subsamples); +} +const string ToString_PP_DecryptedFrameFormat(const PP_DecryptedFrameFormat *v) { + switch (*v) { + case 0: + return "\"PP_DECRYPTEDFRAMEFORMAT_UNKNOWN\""; + case 1: + return "\"PP_DECRYPTEDFRAMEFORMAT_YV12\""; + case 2: + return "\"PP_DECRYPTEDFRAMEFORMAT_I420\""; + default: + return "\"???\""; + } +} +const string ToString_PP_DecryptedFrameFormat(const PP_DecryptedFrameFormat &v) { + return ToString_PP_DecryptedFrameFormat(&v); +} +void FromJSON_PP_DecryptedFrameFormat(JSONIterator& iterator, PP_DecryptedFrameFormat &value) { + long int v; + FromJSON_int(iterator, v); + value = PP_DecryptedFrameFormat(v); +} +const string ToString_PP_DecryptedSampleFormat(const PP_DecryptedSampleFormat *v) { + switch (*v) { + case 0: + return "\"PP_DECRYPTEDSAMPLEFORMAT_UNKNOWN\""; + case 1: + return "\"PP_DECRYPTEDSAMPLEFORMAT_U8\""; + case 2: + return "\"PP_DECRYPTEDSAMPLEFORMAT_S16\""; + case 3: + return "\"PP_DECRYPTEDSAMPLEFORMAT_S32\""; + case 4: + return "\"PP_DECRYPTEDSAMPLEFORMAT_F32\""; + case 5: + return "\"PP_DECRYPTEDSAMPLEFORMAT_PLANAR_S16\""; + case 6: + return "\"PP_DECRYPTEDSAMPLEFORMAT_PLANAR_F32\""; + default: + return "\"???\""; + } +} +const string ToString_PP_DecryptedSampleFormat(const PP_DecryptedSampleFormat &v) { + return ToString_PP_DecryptedSampleFormat(&v); +} +void FromJSON_PP_DecryptedSampleFormat(JSONIterator& iterator, PP_DecryptedSampleFormat &value) { + long int v; + FromJSON_int(iterator, v); + value = PP_DecryptedSampleFormat(v); +} +const string ToString_PP_DecryptResult(const PP_DecryptResult *v) { + switch (*v) { + case 0: + return "\"PP_DECRYPTRESULT_SUCCESS\""; + case 1: + return "\"PP_DECRYPTRESULT_DECRYPT_NOKEY\""; + case 2: + return "\"PP_DECRYPTRESULT_NEEDMOREDATA\""; + case 3: + return "\"PP_DECRYPTRESULT_DECRYPT_ERROR\""; + case 4: + return "\"PP_DECRYPTRESULT_DECODE_ERROR\""; + default: + return "\"???\""; + } +} +const string ToString_PP_DecryptResult(const PP_DecryptResult &v) { + return ToString_PP_DecryptResult(&v); +} +void FromJSON_PP_DecryptResult(JSONIterator& iterator, PP_DecryptResult &value) { + long int v; + FromJSON_int(iterator, v); + value = PP_DecryptResult(v); +} +const string ToString_PP_DecryptedBlockInfo(const PP_DecryptedBlockInfo *v) { + if (!v) { + return "null"; + } + return ToString_PP_DecryptedBlockInfo(*v); +} +const string ToString_PP_DecryptedBlockInfo(const PP_DecryptedBlockInfo &v) { + stringstream x; + BeginProps(x); + AddProp(x, "result", ToString_PP_DecryptResult(v.result)); + AddProp(x, "data_size", ToString_uint32_t(v.data_size)); + AddProp(x, "tracking_info", ToString_PP_DecryptTrackingInfo(v.tracking_info)); + EndProps(x); + return x.str(); +} +void FromJSON_PP_DecryptedBlockInfo(JSONIterator& iterator, PP_DecryptedBlockInfo &value) { + const JSON::Token& current = iterator.getCurrentAndGotoNext(); + if (current.isPrimitive() && !current.value().compare("null")) { + return; + } + if (!current.isObject()) { + Fail("Expected object!", ""); + } + iterator.skip(); + FromJSON_PP_DecryptResult(iterator, value.result); + iterator.skip(); + FromJSON_uint32_t(iterator, value.data_size); + iterator.skip(); + FromJSON_PP_DecryptTrackingInfo(iterator, value.tracking_info); +} +const string ToString_PP_DecryptedFramePlanes(const PP_DecryptedFramePlanes *v) { + switch (*v) { + case 0: + return "\"PP_DECRYPTEDFRAMEPLANES_Y\""; + case 1: + return "\"PP_DECRYPTEDFRAMEPLANES_U\""; + case 2: + return "\"PP_DECRYPTEDFRAMEPLANES_V\""; + default: + return "\"???\""; + } +} +const string ToString_PP_DecryptedFramePlanes(const PP_DecryptedFramePlanes &v) { + return ToString_PP_DecryptedFramePlanes(&v); +} +void FromJSON_PP_DecryptedFramePlanes(JSONIterator& iterator, PP_DecryptedFramePlanes &value) { + long int v; + FromJSON_int(iterator, v); + value = PP_DecryptedFramePlanes(v); +} +const string ToString_PP_DecryptedFrameInfo(const PP_DecryptedFrameInfo *v) { + if (!v) { + return "null"; + } + return ToString_PP_DecryptedFrameInfo(*v); +} +const string ToString_PP_DecryptedFrameInfo(const PP_DecryptedFrameInfo &v) { + stringstream x; + BeginProps(x); + AddProp(x, "result", ToString_PP_DecryptResult(v.result)); + AddProp(x, "format", ToString_PP_DecryptedFrameFormat(v.format)); + { + BeginProp(x, "plane_offsets"); + BeginElements(x); + for (uint32_t _n = 0; _n < 3; ++_n) { + AddElement(x, ToString_int32_t(v.plane_offsets[_n])); + } + EndElements(x); + } + { + BeginProp(x, "strides"); + BeginElements(x); + for (uint32_t _n = 0; _n < 3; ++_n) { + AddElement(x, ToString_int32_t(v.strides[_n])); + } + EndElements(x); + } + AddProp(x, "width", ToString_int32_t(v.width)); + AddProp(x, "height", ToString_int32_t(v.height)); + AddProp(x, "tracking_info", ToString_PP_DecryptTrackingInfo(v.tracking_info)); + EndProps(x); + return x.str(); +} +void FromJSON_PP_DecryptedFrameInfo(JSONIterator& iterator, PP_DecryptedFrameInfo &value) { + const JSON::Token& current = iterator.getCurrentAndGotoNext(); + if (current.isPrimitive() && !current.value().compare("null")) { + return; + } + if (!current.isObject()) { + Fail("Expected object!", ""); + } + iterator.skip(); + FromJSON_PP_DecryptResult(iterator, value.result); + iterator.skip(); + FromJSON_PP_DecryptedFrameFormat(iterator, value.format); + iterator.skip(); + + { + size_t children = iterator.expectArrayAndGotoFirstItem(); + if (children > 3) { + Fail("Too many items in array\n", ""); + } + for (uint32_t _n = 0; _n < children; ++_n) { + FromJSON_int32_t(iterator, (value.plane_offsets)[_n]); + } + // FIXME Null out remaining items? + } + iterator.skip(); + + { + size_t children = iterator.expectArrayAndGotoFirstItem(); + if (children > 3) { + Fail("Too many items in array\n", ""); + } + for (uint32_t _n = 0; _n < children; ++_n) { + FromJSON_int32_t(iterator, (value.strides)[_n]); + } + // FIXME Null out remaining items? + } + iterator.skip(); + FromJSON_int32_t(iterator, value.width); + iterator.skip(); + FromJSON_int32_t(iterator, value.height); + iterator.skip(); + FromJSON_PP_DecryptTrackingInfo(iterator, value.tracking_info); +} +const string ToString_PP_DecryptedSampleInfo(const PP_DecryptedSampleInfo *v) { + if (!v) { + return "null"; + } + return ToString_PP_DecryptedSampleInfo(*v); +} +const string ToString_PP_DecryptedSampleInfo(const PP_DecryptedSampleInfo &v) { + stringstream x; + BeginProps(x); + AddProp(x, "result", ToString_PP_DecryptResult(v.result)); + AddProp(x, "format", ToString_PP_DecryptedSampleFormat(v.format)); + AddProp(x, "data_size", ToString_uint32_t(v.data_size)); + AddProp(x, "padding", ToString_uint32_t(v.padding)); + AddProp(x, "tracking_info", ToString_PP_DecryptTrackingInfo(v.tracking_info)); + EndProps(x); + return x.str(); +} +void FromJSON_PP_DecryptedSampleInfo(JSONIterator& iterator, PP_DecryptedSampleInfo &value) { + const JSON::Token& current = iterator.getCurrentAndGotoNext(); + if (current.isPrimitive() && !current.value().compare("null")) { + return; + } + if (!current.isObject()) { + Fail("Expected object!", ""); + } + iterator.skip(); + FromJSON_PP_DecryptResult(iterator, value.result); + iterator.skip(); + FromJSON_PP_DecryptedSampleFormat(iterator, value.format); + iterator.skip(); + FromJSON_uint32_t(iterator, value.data_size); + iterator.skip(); + FromJSON_uint32_t(iterator, value.padding); + iterator.skip(); + FromJSON_PP_DecryptTrackingInfo(iterator, value.tracking_info); +} +const string ToString_PP_AudioCodec(const PP_AudioCodec *v) { + switch (*v) { + case 0: + return "\"PP_AUDIOCODEC_UNKNOWN\""; + case 1: + return "\"PP_AUDIOCODEC_VORBIS\""; + case 2: + return "\"PP_AUDIOCODEC_AAC\""; + default: + return "\"???\""; + } +} +const string ToString_PP_AudioCodec(const PP_AudioCodec &v) { + return ToString_PP_AudioCodec(&v); +} +void FromJSON_PP_AudioCodec(JSONIterator& iterator, PP_AudioCodec &value) { + long int v; + FromJSON_int(iterator, v); + value = PP_AudioCodec(v); +} +const string ToString_PP_AudioDecoderConfig(const PP_AudioDecoderConfig *v) { + if (!v) { + return "null"; + } + return ToString_PP_AudioDecoderConfig(*v); +} +const string ToString_PP_AudioDecoderConfig(const PP_AudioDecoderConfig &v) { + stringstream x; + BeginProps(x); + AddProp(x, "codec", ToString_PP_AudioCodec(v.codec)); + AddProp(x, "channel_count", ToString_int32_t(v.channel_count)); + AddProp(x, "bits_per_channel", ToString_int32_t(v.bits_per_channel)); + AddProp(x, "samples_per_second", ToString_int32_t(v.samples_per_second)); + AddProp(x, "request_id", ToString_uint32_t(v.request_id)); + EndProps(x); + return x.str(); +} +void FromJSON_PP_AudioDecoderConfig(JSONIterator& iterator, PP_AudioDecoderConfig &value) { + const JSON::Token& current = iterator.getCurrentAndGotoNext(); + if (current.isPrimitive() && !current.value().compare("null")) { + return; + } + if (!current.isObject()) { + Fail("Expected object!", ""); + } + iterator.skip(); + FromJSON_PP_AudioCodec(iterator, value.codec); + iterator.skip(); + FromJSON_int32_t(iterator, value.channel_count); + iterator.skip(); + FromJSON_int32_t(iterator, value.bits_per_channel); + iterator.skip(); + FromJSON_int32_t(iterator, value.samples_per_second); + iterator.skip(); + FromJSON_uint32_t(iterator, value.request_id); +} +const string ToString_PP_VideoCodec(const PP_VideoCodec *v) { + switch (*v) { + case 0: + return "\"PP_VIDEOCODEC_UNKNOWN\""; + case 1: + return "\"PP_VIDEOCODEC_VP8\""; + case 2: + return "\"PP_VIDEOCODEC_H264\""; + case 3: + return "\"PP_VIDEOCODEC_VP9\""; + default: + return "\"???\""; + } +} +const string ToString_PP_VideoCodec(const PP_VideoCodec &v) { + return ToString_PP_VideoCodec(&v); +} +void FromJSON_PP_VideoCodec(JSONIterator& iterator, PP_VideoCodec &value) { + long int v; + FromJSON_int(iterator, v); + value = PP_VideoCodec(v); +} +const string ToString_PP_VideoCodecProfile(const PP_VideoCodecProfile *v) { + switch (*v) { + case 0: + return "\"PP_VIDEOCODECPROFILE_UNKNOWN\""; + case 1: + return "\"PP_VIDEOCODECPROFILE_NOT_NEEDED\""; + case 2: + return "\"PP_VIDEOCODECPROFILE_H264_BASELINE\""; + case 3: + return "\"PP_VIDEOCODECPROFILE_H264_MAIN\""; + case 4: + return "\"PP_VIDEOCODECPROFILE_H264_EXTENDED\""; + case 5: + return "\"PP_VIDEOCODECPROFILE_H264_HIGH\""; + case 6: + return "\"PP_VIDEOCODECPROFILE_H264_HIGH_10\""; + case 7: + return "\"PP_VIDEOCODECPROFILE_H264_HIGH_422\""; + case 8: + return "\"PP_VIDEOCODECPROFILE_H264_HIGH_444_PREDICTIVE\""; + default: + return "\"???\""; + } +} +const string ToString_PP_VideoCodecProfile(const PP_VideoCodecProfile &v) { + return ToString_PP_VideoCodecProfile(&v); +} +void FromJSON_PP_VideoCodecProfile(JSONIterator& iterator, PP_VideoCodecProfile &value) { + long int v; + FromJSON_int(iterator, v); + value = PP_VideoCodecProfile(v); +} +const string ToString_PP_VideoDecoderConfig(const PP_VideoDecoderConfig *v) { + if (!v) { + return "null"; + } + return ToString_PP_VideoDecoderConfig(*v); +} +const string ToString_PP_VideoDecoderConfig(const PP_VideoDecoderConfig &v) { + stringstream x; + BeginProps(x); + AddProp(x, "codec", ToString_PP_VideoCodec(v.codec)); + AddProp(x, "profile", ToString_PP_VideoCodecProfile(v.profile)); + AddProp(x, "format", ToString_PP_DecryptedFrameFormat(v.format)); + AddProp(x, "width", ToString_int32_t(v.width)); + AddProp(x, "height", ToString_int32_t(v.height)); + AddProp(x, "request_id", ToString_uint32_t(v.request_id)); + EndProps(x); + return x.str(); +} +void FromJSON_PP_VideoDecoderConfig(JSONIterator& iterator, PP_VideoDecoderConfig &value) { + const JSON::Token& current = iterator.getCurrentAndGotoNext(); + if (current.isPrimitive() && !current.value().compare("null")) { + return; + } + if (!current.isObject()) { + Fail("Expected object!", ""); + } + iterator.skip(); + FromJSON_PP_VideoCodec(iterator, value.codec); + iterator.skip(); + FromJSON_PP_VideoCodecProfile(iterator, value.profile); + iterator.skip(); + FromJSON_PP_DecryptedFrameFormat(iterator, value.format); + iterator.skip(); + FromJSON_int32_t(iterator, value.width); + iterator.skip(); + FromJSON_int32_t(iterator, value.height); + iterator.skip(); + FromJSON_uint32_t(iterator, value.request_id); +} +const string ToString_PP_DecryptorStreamType(const PP_DecryptorStreamType *v) { + switch (*v) { + case 0: + return "\"PP_DECRYPTORSTREAMTYPE_AUDIO\""; + case 1: + return "\"PP_DECRYPTORSTREAMTYPE_VIDEO\""; + default: + return "\"???\""; + } +} +const string ToString_PP_DecryptorStreamType(const PP_DecryptorStreamType &v) { + return ToString_PP_DecryptorStreamType(&v); +} +void FromJSON_PP_DecryptorStreamType(JSONIterator& iterator, PP_DecryptorStreamType &value) { + long int v; + FromJSON_int(iterator, v); + value = PP_DecryptorStreamType(v); +} +const string ToString_PP_SessionType(const PP_SessionType *v) { + switch (*v) { + case 0: + return "\"PP_SESSIONTYPE_TEMPORARY\""; + case 1: + return "\"PP_SESSIONTYPE_PERSISTENT_LICENSE\""; + case 2: + return "\"PP_SESSIONTYPE_PERSISTENT_RELEASE\""; + default: + return "\"???\""; + } +} +const string ToString_PP_SessionType(const PP_SessionType &v) { + return ToString_PP_SessionType(&v); +} +void FromJSON_PP_SessionType(JSONIterator& iterator, PP_SessionType &value) { + long int v; + FromJSON_int(iterator, v); + value = PP_SessionType(v); +} +const string ToString_PP_InitDataType(const PP_InitDataType *v) { + switch (*v) { + case 0: + return "\"PP_INITDATATYPE_CENC\""; + case 1: + return "\"PP_INITDATATYPE_KEYIDS\""; + case 2: + return "\"PP_INITDATATYPE_WEBM\""; + default: + return "\"???\""; + } +} +const string ToString_PP_InitDataType(const PP_InitDataType &v) { + return ToString_PP_InitDataType(&v); +} +void FromJSON_PP_InitDataType(JSONIterator& iterator, PP_InitDataType &value) { + long int v; + FromJSON_int(iterator, v); + value = PP_InitDataType(v); +} +const string ToString_PP_CdmExceptionCode(const PP_CdmExceptionCode *v) { + switch (*v) { + case 1: + return "\"PP_CDMEXCEPTIONCODE_NOTSUPPORTEDERROR\""; + case 2: + return "\"PP_CDMEXCEPTIONCODE_INVALIDSTATEERROR\""; + case 3: + return "\"PP_CDMEXCEPTIONCODE_INVALIDACCESSERROR\""; + case 4: + return "\"PP_CDMEXCEPTIONCODE_QUOTAEXCEEDEDERROR\""; + case 5: + return "\"PP_CDMEXCEPTIONCODE_UNKNOWNERROR\""; + case 6: + return "\"PP_CDMEXCEPTIONCODE_CLIENTERROR\""; + case 7: + return "\"PP_CDMEXCEPTIONCODE_OUTPUTERROR\""; + default: + return "\"???\""; + } +} +const string ToString_PP_CdmExceptionCode(const PP_CdmExceptionCode &v) { + return ToString_PP_CdmExceptionCode(&v); +} +void FromJSON_PP_CdmExceptionCode(JSONIterator& iterator, PP_CdmExceptionCode &value) { + long int v; + FromJSON_int(iterator, v); + value = PP_CdmExceptionCode(v); +} +const string ToString_PP_CdmMessageType(const PP_CdmMessageType *v) { + switch (*v) { + case 0: + return "\"PP_CDMMESSAGETYPE_LICENSE_REQUEST\""; + case 1: + return "\"PP_CDMMESSAGETYPE_LICENSE_RENEWAL\""; + case 2: + return "\"PP_CDMMESSAGETYPE_LICENSE_RELEASE\""; + default: + return "\"???\""; + } +} +const string ToString_PP_CdmMessageType(const PP_CdmMessageType &v) { + return ToString_PP_CdmMessageType(&v); +} +void FromJSON_PP_CdmMessageType(JSONIterator& iterator, PP_CdmMessageType &value) { + long int v; + FromJSON_int(iterator, v); + value = PP_CdmMessageType(v); +} +const string ToString_PP_CdmKeyStatus(const PP_CdmKeyStatus *v) { + switch (*v) { + case 0: + return "\"PP_CDMKEYSTATUS_USABLE\""; + case 1: + return "\"PP_CDMKEYSTATUS_INVALID\""; + case 2: + return "\"PP_CDMKEYSTATUS_EXPIRED\""; + case 3: + return "\"PP_CDMKEYSTATUS_OUTPUTRESTRICTED\""; + case 4: + return "\"PP_CDMKEYSTATUS_OUTPUTDOWNSCALED\""; + case 5: + return "\"PP_CDMKEYSTATUS_STATUSPENDING\""; + case 6: + return "\"PP_CDMKEYSTATUS_RELEASED\""; + default: + return "\"???\""; + } +} +const string ToString_PP_CdmKeyStatus(const PP_CdmKeyStatus &v) { + return ToString_PP_CdmKeyStatus(&v); +} +void FromJSON_PP_CdmKeyStatus(JSONIterator& iterator, PP_CdmKeyStatus &value) { + long int v; + FromJSON_int(iterator, v); + value = PP_CdmKeyStatus(v); +} +const string ToString_PP_KeyInformation(const PP_KeyInformation *v) { + if (!v) { + return "null"; + } + return ToString_PP_KeyInformation(*v); +} +const string ToString_PP_KeyInformation(const PP_KeyInformation &v) { + stringstream x; + BeginProps(x); + { + BeginProp(x, "key_id"); + BeginElements(x); + for (uint32_t _n = 0; _n < 512; ++_n) { + AddElement(x, ToString_uint8_t(v.key_id[_n])); + } + EndElements(x); + } + AddProp(x, "key_id_size", ToString_uint32_t(v.key_id_size)); + AddProp(x, "key_status", ToString_PP_CdmKeyStatus(v.key_status)); + AddProp(x, "system_code", ToString_uint32_t(v.system_code)); + EndProps(x); + return x.str(); +} +void FromJSON_PP_KeyInformation(JSONIterator& iterator, PP_KeyInformation &value) { + const JSON::Token& current = iterator.getCurrentAndGotoNext(); + if (current.isPrimitive() && !current.value().compare("null")) { + return; + } + if (!current.isObject()) { + Fail("Expected object!", ""); + } + iterator.skip(); + + { + size_t children = iterator.expectArrayAndGotoFirstItem(); + if (children > 512) { + Fail("Too many items in array\n", ""); + } + for (uint32_t _n = 0; _n < children; ++_n) { + FromJSON_uint8_t(iterator, (value.key_id)[_n]); + } + // FIXME Null out remaining items? + } + iterator.skip(); + FromJSON_uint32_t(iterator, value.key_id_size); + iterator.skip(); + FromJSON_PP_CdmKeyStatus(iterator, value.key_status); + iterator.skip(); + FromJSON_uint32_t(iterator, value.system_code); +} +const string ToString_PP_PrivateFontCharset(const PP_PrivateFontCharset *v) { + switch (*v) { + case 0: + return "\"PP_PRIVATEFONTCHARSET_ANSI\""; + case 1: + return "\"PP_PRIVATEFONTCHARSET_DEFAULT\""; + case 2: + return "\"PP_PRIVATEFONTCHARSET_SYMBOL\""; + case 77: + return "\"PP_PRIVATEFONTCHARSET_MAC\""; + case 128: + return "\"PP_PRIVATEFONTCHARSET_SHIFTJIS\""; + case 129: + return "\"PP_PRIVATEFONTCHARSET_HANGUL\""; + case 130: + return "\"PP_PRIVATEFONTCHARSET_JOHAB\""; + case 134: + return "\"PP_PRIVATEFONTCHARSET_GB2312\""; + case 136: + return "\"PP_PRIVATEFONTCHARSET_CHINESEBIG5\""; + case 161: + return "\"PP_PRIVATEFONTCHARSET_GREEK\""; + case 162: + return "\"PP_PRIVATEFONTCHARSET_TURKISH\""; + case 163: + return "\"PP_PRIVATEFONTCHARSET_VIETNAMESE\""; + case 177: + return "\"PP_PRIVATEFONTCHARSET_HEBREW\""; + case 178: + return "\"PP_PRIVATEFONTCHARSET_ARABIC\""; + case 186: + return "\"PP_PRIVATEFONTCHARSET_BALTIC\""; + case 204: + return "\"PP_PRIVATEFONTCHARSET_RUSSIAN\""; + case 222: + return "\"PP_PRIVATEFONTCHARSET_THAI\""; + case 238: + return "\"PP_PRIVATEFONTCHARSET_EASTEUROPE\""; + case 255: + return "\"PP_PRIVATEFONTCHARSET_OEM\""; + default: + return "\"???\""; + } +} +const string ToString_PP_PrivateFontCharset(const PP_PrivateFontCharset &v) { + return ToString_PP_PrivateFontCharset(&v); +} +void FromJSON_PP_PrivateFontCharset(JSONIterator& iterator, PP_PrivateFontCharset &value) { + long int v; + FromJSON_int(iterator, v); + value = PP_PrivateFontCharset(v); +} +const string ToString_PP_VideoCaptureFormat(const PP_VideoCaptureFormat *v) { + if (!v) { + return "null"; + } + return ToString_PP_VideoCaptureFormat(*v); +} +const string ToString_PP_VideoCaptureFormat(const PP_VideoCaptureFormat &v) { + stringstream x; + BeginProps(x); + AddProp(x, "frame_size", ToString_PP_Size(v.frame_size)); + AddProp(x, "frame_rate", ToString_float_t(v.frame_rate)); + EndProps(x); + return x.str(); +} +void FromJSON_PP_VideoCaptureFormat(JSONIterator& iterator, PP_VideoCaptureFormat &value) { + const JSON::Token& current = iterator.getCurrentAndGotoNext(); + if (current.isPrimitive() && !current.value().compare("null")) { + return; + } + if (!current.isObject()) { + Fail("Expected object!", ""); + } + iterator.skip(); + FromJSON_PP_Size(iterator, value.frame_size); + iterator.skip(); + FromJSON_float_t(iterator, value.frame_rate); +} +const string ToString_PP_VideoFrame_Private(const PP_VideoFrame_Private *v) { + if (!v) { + return "null"; + } + return ToString_PP_VideoFrame_Private(*v); +} +const string ToString_PP_VideoFrame_Private(const PP_VideoFrame_Private &v) { + stringstream x; + BeginProps(x); + AddProp(x, "timestamp", ToString_PP_TimeTicks(v.timestamp)); + AddProp(x, "image_data", ToString_PP_Resource(v.image_data)); + AddProp(x, "padding", ToString_int32_t(v.padding)); + EndProps(x); + return x.str(); +} +void FromJSON_PP_VideoFrame_Private(JSONIterator& iterator, PP_VideoFrame_Private &value) { + const JSON::Token& current = iterator.getCurrentAndGotoNext(); + if (current.isPrimitive() && !current.value().compare("null")) { + return; + } + if (!current.isObject()) { + Fail("Expected object!", ""); + } + iterator.skip(); + FromJSON_PP_TimeTicks(iterator, value.timestamp); + iterator.skip(); + FromJSON_PP_Resource(iterator, value.image_data); + iterator.skip(); + FromJSON_int32_t(iterator, value.padding); +} +namespace ns_PPB_CameraCapabilities_Private_0_1 { +static PP_Bool IsCameraCapabilities_0_1(PP_Resource resource) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_CameraCapabilities_Private\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"IsCameraCapabilities\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_CameraCapabilities_Private_0_1*)RealGetInterface("PPB_CameraCapabilities_Private;0.1"))->IsCameraCapabilities(resource); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static void GetSupportedVideoCaptureFormats_0_1(PP_Resource capabilities, uint32_t* array_size, struct PP_VideoCaptureFormat** formats) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_CameraCapabilities_Private\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"GetSupportedVideoCaptureFormats\""); + AddProp(ss, "capabilities", ToString_PP_Resource(capabilities)); + AddProp(ss, "array_size", PointerToString(array_size)); + AddProp(ss, "formats", PointerToString(formats)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectObjectAndGotoFirstProperty(); + iterator.skip(); + FromJSON_uint32_t(iterator, *array_size); + iterator.skip(); + + { + size_t children = iterator.expectArrayAndGotoFirstItem(); + if (children > *array_size) { + Fail("Too many items in array\n", ""); + } + *formats = new struct PP_VideoCaptureFormat[*array_size]; + for (uint32_t _n = 0; _n < children; ++_n) { + FromJSON_PP_VideoCaptureFormat(iterator, (*formats)[_n]); + } + // FIXME Null out remaining items? + } +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_CameraCapabilities_Private_0_1*)RealGetInterface("PPB_CameraCapabilities_Private;0.1"))->GetSupportedVideoCaptureFormats(capabilities, array_size, formats); + printf("RPC response: ["); + printf("["); + std::stringstream os; + BeginProps(os); + if (!!array_size) { + AddProp(os, "array_size", ToString_uint32_t(array_size)); + } + { + BeginProp(os, "formats"); + BeginElements(os); + for (uint32_t _n = 0; _n < *array_size; ++_n) { + AddElement(os, ToString_PP_VideoCaptureFormat(formats[_n])); + } + EndElements(os); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); +#endif // !INTERPOSE +} +} +static PPB_CameraCapabilities_Private_0_1 _PPB_CameraCapabilities_Private_0_1 = { + ns_PPB_CameraCapabilities_Private_0_1::IsCameraCapabilities_0_1, + ns_PPB_CameraCapabilities_Private_0_1::GetSupportedVideoCaptureFormats_0_1, +}; +const string ToString_PPB_CameraCapabilities_Private(const PPB_CameraCapabilities_Private_0_1 *v) { + stringstream s; + s << v; + return s.str(); +} +namespace ns_PPB_CameraDevice_Private_0_1 { +static PP_Resource Create_0_1(PP_Instance instance) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_CameraDevice_Private\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"Create\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Resource(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_CameraDevice_Private_0_1*)RealGetInterface("PPB_CameraDevice_Private;0.1"))->Create(instance); + printf("RPC response: ["); + printf("%s", ToString_PP_Resource(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool IsCameraDevice_0_1(PP_Resource resource) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_CameraDevice_Private\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"IsCameraDevice\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_CameraDevice_Private_0_1*)RealGetInterface("PPB_CameraDevice_Private;0.1"))->IsCameraDevice(resource); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t Open_0_1(PP_Resource camera_device, struct PP_Var device_id, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_CameraDevice_Private\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"Open\""); + AddProp(ss, "camera_device", ToString_PP_Resource(camera_device)); + AddProp(ss, "device_id", ToString_PP_Var(device_id)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_CameraDevice_Private_0_1*)RealGetInterface("PPB_CameraDevice_Private;0.1"))->Open(camera_device, device_id, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static void Close_0_1(PP_Resource camera_device) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_CameraDevice_Private\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"Close\""); + AddProp(ss, "camera_device", ToString_PP_Resource(camera_device)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_CameraDevice_Private_0_1*)RealGetInterface("PPB_CameraDevice_Private;0.1"))->Close(camera_device); +#endif // !INTERPOSE +} +static int32_t GetCameraCapabilities_0_1(PP_Resource camera_device, PP_Resource* capabilities, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_CameraDevice_Private\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"GetCameraCapabilities\""); + AddProp(ss, "camera_device", ToString_PP_Resource(camera_device)); + AddProp(ss, "capabilities", PointerToString(capabilities)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + iterator.skip(); + FromJSON_PP_Resource(iterator, *capabilities); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_CameraDevice_Private_0_1*)RealGetInterface("PPB_CameraDevice_Private;0.1"))->GetCameraCapabilities(camera_device, capabilities, logging_callback); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_int32_t(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + if (!!capabilities) { + AddProp(os, "capabilities", ToString_PP_Resource(capabilities)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +} +static PPB_CameraDevice_Private_0_1 _PPB_CameraDevice_Private_0_1 = { + ns_PPB_CameraDevice_Private_0_1::Create_0_1, + ns_PPB_CameraDevice_Private_0_1::IsCameraDevice_0_1, + ns_PPB_CameraDevice_Private_0_1::Open_0_1, + ns_PPB_CameraDevice_Private_0_1::Close_0_1, + ns_PPB_CameraDevice_Private_0_1::GetCameraCapabilities_0_1, +}; +const string ToString_PPB_CameraDevice_Private(const PPB_CameraDevice_Private_0_1 *v) { + stringstream s; + s << v; + return s.str(); +} +namespace ns_PPB_ContentDecryptor_Private_0_14 { +static void PromiseResolved_0_14(PP_Instance instance, uint32_t promise_id) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_ContentDecryptor_Private\""); + AddProp(ss, "__version", "\"0.14\""); + AddProp(ss, "__method", "\"PromiseResolved\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "promise_id", ToString_uint32_t(promise_id)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_ContentDecryptor_Private_0_14*)RealGetInterface("PPB_ContentDecryptor_Private;0.14"))->PromiseResolved(instance, promise_id); +#endif // !INTERPOSE +} +static void PromiseResolvedWithSession_0_14(PP_Instance instance, uint32_t promise_id, struct PP_Var session_id) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_ContentDecryptor_Private\""); + AddProp(ss, "__version", "\"0.14\""); + AddProp(ss, "__method", "\"PromiseResolvedWithSession\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "promise_id", ToString_uint32_t(promise_id)); + AddProp(ss, "session_id", ToString_PP_Var(session_id)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_ContentDecryptor_Private_0_14*)RealGetInterface("PPB_ContentDecryptor_Private;0.14"))->PromiseResolvedWithSession(instance, promise_id, session_id); +#endif // !INTERPOSE +} +static void PromiseRejected_0_14(PP_Instance instance, uint32_t promise_id, PP_CdmExceptionCode exception_code, uint32_t system_code, struct PP_Var error_description) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_ContentDecryptor_Private\""); + AddProp(ss, "__version", "\"0.14\""); + AddProp(ss, "__method", "\"PromiseRejected\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "promise_id", ToString_uint32_t(promise_id)); + AddProp(ss, "exception_code", ToString_PP_CdmExceptionCode(exception_code)); + AddProp(ss, "system_code", ToString_uint32_t(system_code)); + AddProp(ss, "error_description", ToString_PP_Var(error_description)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_ContentDecryptor_Private_0_14*)RealGetInterface("PPB_ContentDecryptor_Private;0.14"))->PromiseRejected(instance, promise_id, exception_code, system_code, error_description); +#endif // !INTERPOSE +} +static void SessionMessage_0_14(PP_Instance instance, struct PP_Var session_id, PP_CdmMessageType message_type, struct PP_Var message, struct PP_Var legacy_destination_url) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_ContentDecryptor_Private\""); + AddProp(ss, "__version", "\"0.14\""); + AddProp(ss, "__method", "\"SessionMessage\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "session_id", ToString_PP_Var(session_id)); + AddProp(ss, "message_type", ToString_PP_CdmMessageType(message_type)); + AddProp(ss, "message", ToString_PP_Var(message)); + AddProp(ss, "legacy_destination_url", ToString_PP_Var(legacy_destination_url)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_ContentDecryptor_Private_0_14*)RealGetInterface("PPB_ContentDecryptor_Private;0.14"))->SessionMessage(instance, session_id, message_type, message, legacy_destination_url); +#endif // !INTERPOSE +} +static void SessionKeysChange_0_14(PP_Instance instance, struct PP_Var session_id, PP_Bool has_additional_usable_key, uint32_t key_count, const struct PP_KeyInformation key_information[]) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_ContentDecryptor_Private\""); + AddProp(ss, "__version", "\"0.14\""); + AddProp(ss, "__method", "\"SessionKeysChange\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "session_id", ToString_PP_Var(session_id)); + AddProp(ss, "has_additional_usable_key", ToString_PP_Bool(has_additional_usable_key)); + AddProp(ss, "key_count", ToString_uint32_t(key_count)); + { + BeginProp(ss, "key_information"); + BeginElements(ss); + for (uint32_t _n = 0; _n < key_count; ++_n) { + AddElement(ss, ToString_PP_KeyInformation(key_information[_n])); + } + EndElements(ss); + } + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_ContentDecryptor_Private_0_14*)RealGetInterface("PPB_ContentDecryptor_Private;0.14"))->SessionKeysChange(instance, session_id, has_additional_usable_key, key_count, key_information); +#endif // !INTERPOSE +} +static void SessionExpirationChange_0_14(PP_Instance instance, struct PP_Var session_id, PP_Time new_expiry_time) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_ContentDecryptor_Private\""); + AddProp(ss, "__version", "\"0.14\""); + AddProp(ss, "__method", "\"SessionExpirationChange\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "session_id", ToString_PP_Var(session_id)); + AddProp(ss, "new_expiry_time", ToString_PP_Time(new_expiry_time)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_ContentDecryptor_Private_0_14*)RealGetInterface("PPB_ContentDecryptor_Private;0.14"))->SessionExpirationChange(instance, session_id, new_expiry_time); +#endif // !INTERPOSE +} +static void SessionClosed_0_14(PP_Instance instance, struct PP_Var session_id) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_ContentDecryptor_Private\""); + AddProp(ss, "__version", "\"0.14\""); + AddProp(ss, "__method", "\"SessionClosed\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "session_id", ToString_PP_Var(session_id)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_ContentDecryptor_Private_0_14*)RealGetInterface("PPB_ContentDecryptor_Private;0.14"))->SessionClosed(instance, session_id); +#endif // !INTERPOSE +} +static void LegacySessionError_0_14(PP_Instance instance, struct PP_Var session_id, PP_CdmExceptionCode exception_code, uint32_t system_code, struct PP_Var error_description) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_ContentDecryptor_Private\""); + AddProp(ss, "__version", "\"0.14\""); + AddProp(ss, "__method", "\"LegacySessionError\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "session_id", ToString_PP_Var(session_id)); + AddProp(ss, "exception_code", ToString_PP_CdmExceptionCode(exception_code)); + AddProp(ss, "system_code", ToString_uint32_t(system_code)); + AddProp(ss, "error_description", ToString_PP_Var(error_description)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_ContentDecryptor_Private_0_14*)RealGetInterface("PPB_ContentDecryptor_Private;0.14"))->LegacySessionError(instance, session_id, exception_code, system_code, error_description); +#endif // !INTERPOSE +} +static void DeliverBlock_0_14(PP_Instance instance, PP_Resource decrypted_block, const struct PP_DecryptedBlockInfo* decrypted_block_info) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_ContentDecryptor_Private\""); + AddProp(ss, "__version", "\"0.14\""); + AddProp(ss, "__method", "\"DeliverBlock\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "decrypted_block", ToString_PP_Resource(decrypted_block)); + AddProp(ss, "decrypted_block_info", ToString_PP_DecryptedBlockInfo(decrypted_block_info)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_ContentDecryptor_Private_0_14*)RealGetInterface("PPB_ContentDecryptor_Private;0.14"))->DeliverBlock(instance, decrypted_block, decrypted_block_info); +#endif // !INTERPOSE +} +static void DecoderInitializeDone_0_14(PP_Instance instance, PP_DecryptorStreamType decoder_type, uint32_t request_id, PP_Bool success) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_ContentDecryptor_Private\""); + AddProp(ss, "__version", "\"0.14\""); + AddProp(ss, "__method", "\"DecoderInitializeDone\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "decoder_type", ToString_PP_DecryptorStreamType(decoder_type)); + AddProp(ss, "request_id", ToString_uint32_t(request_id)); + AddProp(ss, "success", ToString_PP_Bool(success)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_ContentDecryptor_Private_0_14*)RealGetInterface("PPB_ContentDecryptor_Private;0.14"))->DecoderInitializeDone(instance, decoder_type, request_id, success); +#endif // !INTERPOSE +} +static void DecoderDeinitializeDone_0_14(PP_Instance instance, PP_DecryptorStreamType decoder_type, uint32_t request_id) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_ContentDecryptor_Private\""); + AddProp(ss, "__version", "\"0.14\""); + AddProp(ss, "__method", "\"DecoderDeinitializeDone\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "decoder_type", ToString_PP_DecryptorStreamType(decoder_type)); + AddProp(ss, "request_id", ToString_uint32_t(request_id)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_ContentDecryptor_Private_0_14*)RealGetInterface("PPB_ContentDecryptor_Private;0.14"))->DecoderDeinitializeDone(instance, decoder_type, request_id); +#endif // !INTERPOSE +} +static void DecoderResetDone_0_14(PP_Instance instance, PP_DecryptorStreamType decoder_type, uint32_t request_id) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_ContentDecryptor_Private\""); + AddProp(ss, "__version", "\"0.14\""); + AddProp(ss, "__method", "\"DecoderResetDone\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "decoder_type", ToString_PP_DecryptorStreamType(decoder_type)); + AddProp(ss, "request_id", ToString_uint32_t(request_id)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_ContentDecryptor_Private_0_14*)RealGetInterface("PPB_ContentDecryptor_Private;0.14"))->DecoderResetDone(instance, decoder_type, request_id); +#endif // !INTERPOSE +} +static void DeliverFrame_0_14(PP_Instance instance, PP_Resource decrypted_frame, const struct PP_DecryptedFrameInfo* decrypted_frame_info) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_ContentDecryptor_Private\""); + AddProp(ss, "__version", "\"0.14\""); + AddProp(ss, "__method", "\"DeliverFrame\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "decrypted_frame", ToString_PP_Resource(decrypted_frame)); + AddProp(ss, "decrypted_frame_info", ToString_PP_DecryptedFrameInfo(decrypted_frame_info)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_ContentDecryptor_Private_0_14*)RealGetInterface("PPB_ContentDecryptor_Private;0.14"))->DeliverFrame(instance, decrypted_frame, decrypted_frame_info); +#endif // !INTERPOSE +} +static void DeliverSamples_0_14(PP_Instance instance, PP_Resource audio_frames, const struct PP_DecryptedSampleInfo* decrypted_sample_info) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_ContentDecryptor_Private\""); + AddProp(ss, "__version", "\"0.14\""); + AddProp(ss, "__method", "\"DeliverSamples\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "audio_frames", ToString_PP_Resource(audio_frames)); + AddProp(ss, "decrypted_sample_info", ToString_PP_DecryptedSampleInfo(decrypted_sample_info)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_ContentDecryptor_Private_0_14*)RealGetInterface("PPB_ContentDecryptor_Private;0.14"))->DeliverSamples(instance, audio_frames, decrypted_sample_info); +#endif // !INTERPOSE +} +} +static PPB_ContentDecryptor_Private_0_14 _PPB_ContentDecryptor_Private_0_14 = { + ns_PPB_ContentDecryptor_Private_0_14::PromiseResolved_0_14, + ns_PPB_ContentDecryptor_Private_0_14::PromiseResolvedWithSession_0_14, + ns_PPB_ContentDecryptor_Private_0_14::PromiseRejected_0_14, + ns_PPB_ContentDecryptor_Private_0_14::SessionMessage_0_14, + ns_PPB_ContentDecryptor_Private_0_14::SessionKeysChange_0_14, + ns_PPB_ContentDecryptor_Private_0_14::SessionExpirationChange_0_14, + ns_PPB_ContentDecryptor_Private_0_14::SessionClosed_0_14, + ns_PPB_ContentDecryptor_Private_0_14::LegacySessionError_0_14, + ns_PPB_ContentDecryptor_Private_0_14::DeliverBlock_0_14, + ns_PPB_ContentDecryptor_Private_0_14::DecoderInitializeDone_0_14, + ns_PPB_ContentDecryptor_Private_0_14::DecoderDeinitializeDone_0_14, + ns_PPB_ContentDecryptor_Private_0_14::DecoderResetDone_0_14, + ns_PPB_ContentDecryptor_Private_0_14::DeliverFrame_0_14, + ns_PPB_ContentDecryptor_Private_0_14::DeliverSamples_0_14, +}; +const string ToString_PPB_ContentDecryptor_Private(const PPB_ContentDecryptor_Private_0_14 *v) { + stringstream s; + s << v; + return s.str(); +} +namespace ns_PPB_DisplayColorProfile_Private_0_1 { +static PP_Resource Create_0_1(PP_Instance instance) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_DisplayColorProfile_Private\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"Create\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Resource(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_DisplayColorProfile_Private_0_1*)RealGetInterface("PPB_DisplayColorProfile_Private;0.1"))->Create(instance); + printf("RPC response: ["); + printf("%s", ToString_PP_Resource(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool IsDisplayColorProfile_0_1(PP_Resource resource) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_DisplayColorProfile_Private\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"IsDisplayColorProfile\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_DisplayColorProfile_Private_0_1*)RealGetInterface("PPB_DisplayColorProfile_Private;0.1"))->IsDisplayColorProfile(resource); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t GetColorProfile_0_1(PP_Resource display_color_profile_res, struct PP_ArrayOutput color_profile, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_DisplayColorProfile_Private\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"GetColorProfile\""); + AddProp(ss, "display_color_profile_res", ToString_PP_Resource(display_color_profile_res)); + AddProp(ss, "color_profile", ToString_PP_ArrayOutput(color_profile)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_DisplayColorProfile_Private_0_1*)RealGetInterface("PPB_DisplayColorProfile_Private;0.1"))->GetColorProfile(display_color_profile_res, color_profile, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t RegisterColorProfileChangeCallback_0_1(PP_Resource display_color_profile_res, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_DisplayColorProfile_Private\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"RegisterColorProfileChangeCallback\""); + AddProp(ss, "display_color_profile_res", ToString_PP_Resource(display_color_profile_res)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_DisplayColorProfile_Private_0_1*)RealGetInterface("PPB_DisplayColorProfile_Private;0.1"))->RegisterColorProfileChangeCallback(display_color_profile_res, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +} +static PPB_DisplayColorProfile_Private_0_1 _PPB_DisplayColorProfile_Private_0_1 = { + ns_PPB_DisplayColorProfile_Private_0_1::Create_0_1, + ns_PPB_DisplayColorProfile_Private_0_1::IsDisplayColorProfile_0_1, + ns_PPB_DisplayColorProfile_Private_0_1::GetColorProfile_0_1, + ns_PPB_DisplayColorProfile_Private_0_1::RegisterColorProfileChangeCallback_0_1, +}; +const string ToString_PPB_DisplayColorProfile_Private(const PPB_DisplayColorProfile_Private_0_1 *v) { + stringstream s; + s << v; + return s.str(); +} +namespace ns_PPB_Ext_CrxFileSystem_Private_0_1 { +static int32_t Open_0_1(PP_Instance instance, PP_Resource* file_system, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Ext_CrxFileSystem_Private\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"Open\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "file_system", PointerToString(file_system)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + iterator.skip(); + FromJSON_PP_Resource(iterator, *file_system); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_Ext_CrxFileSystem_Private_0_1*)RealGetInterface("PPB_Ext_CrxFileSystem_Private;0.1"))->Open(instance, file_system, logging_callback); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_int32_t(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + if (!!file_system) { + AddProp(os, "file_system", ToString_PP_Resource(file_system)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +} +static PPB_Ext_CrxFileSystem_Private_0_1 _PPB_Ext_CrxFileSystem_Private_0_1 = { + ns_PPB_Ext_CrxFileSystem_Private_0_1::Open_0_1, +}; +const string ToString_PPB_Ext_CrxFileSystem_Private(const PPB_Ext_CrxFileSystem_Private_0_1 *v) { + stringstream s; + s << v; + return s.str(); +} +namespace ns_PPB_FileIO_Private_0_1 { +static int32_t RequestOSFileHandle_0_1(PP_Resource file_io, PP_FileHandle* handle, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_FileIO_Private\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"RequestOSFileHandle\""); + AddProp(ss, "file_io", ToString_PP_Resource(file_io)); + AddProp(ss, "handle", PointerToString(handle)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + iterator.skip(); + FromJSON_PP_FileHandle(iterator, *handle); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_FileIO_Private_0_1*)RealGetInterface("PPB_FileIO_Private;0.1"))->RequestOSFileHandle(file_io, handle, logging_callback); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_int32_t(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + if (!!handle) { + AddProp(os, "handle", ToString_PP_FileHandle(handle)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +} +static PPB_FileIO_Private_0_1 _PPB_FileIO_Private_0_1 = { + ns_PPB_FileIO_Private_0_1::RequestOSFileHandle_0_1, +}; +const string ToString_PPB_FileIO_Private(const PPB_FileIO_Private_0_1 *v) { + stringstream s; + s << v; + return s.str(); +} +namespace ns_PPB_FileRefPrivate_0_1 { +static struct PP_Var GetAbsolutePath_0_1(PP_Resource file_ref) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_FileRefPrivate\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"GetAbsolutePath\""); + AddProp(ss, "file_ref", ToString_PP_Resource(file_ref)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + struct PP_Var rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Var(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + struct PP_Var rval = ((PPB_FileRefPrivate_0_1*)RealGetInterface("PPB_FileRefPrivate;0.1"))->GetAbsolutePath(file_ref); + printf("RPC response: ["); + printf("%s", ToString_PP_Var(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +} +static PPB_FileRefPrivate_0_1 _PPB_FileRefPrivate_0_1 = { + ns_PPB_FileRefPrivate_0_1::GetAbsolutePath_0_1, +}; +const string ToString_PPB_FileRefPrivate(const PPB_FileRefPrivate_0_1 *v) { + stringstream s; + s << v; + return s.str(); +} +namespace ns_PPB_Find_Private_0_3 { +static void SetPluginToHandleFindRequests_0_3(PP_Instance instance) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Find_Private\""); + AddProp(ss, "__version", "\"0.3\""); + AddProp(ss, "__method", "\"SetPluginToHandleFindRequests\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_Find_Private_0_3*)RealGetInterface("PPB_Find_Private;0.3"))->SetPluginToHandleFindRequests(instance); +#endif // !INTERPOSE +} +static void NumberOfFindResultsChanged_0_3(PP_Instance instance, int32_t total, PP_Bool final_result) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Find_Private\""); + AddProp(ss, "__version", "\"0.3\""); + AddProp(ss, "__method", "\"NumberOfFindResultsChanged\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "total", ToString_int32_t(total)); + AddProp(ss, "final_result", ToString_PP_Bool(final_result)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_Find_Private_0_3*)RealGetInterface("PPB_Find_Private;0.3"))->NumberOfFindResultsChanged(instance, total, final_result); +#endif // !INTERPOSE +} +static void SelectedFindResultChanged_0_3(PP_Instance instance, int32_t index) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Find_Private\""); + AddProp(ss, "__version", "\"0.3\""); + AddProp(ss, "__method", "\"SelectedFindResultChanged\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "index", ToString_int32_t(index)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_Find_Private_0_3*)RealGetInterface("PPB_Find_Private;0.3"))->SelectedFindResultChanged(instance, index); +#endif // !INTERPOSE +} +static void SetTickmarks_0_3(PP_Instance instance, const struct PP_Rect tickmarks[], uint32_t count) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Find_Private\""); + AddProp(ss, "__version", "\"0.3\""); + AddProp(ss, "__method", "\"SetTickmarks\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + { + BeginProp(ss, "tickmarks"); + BeginElements(ss); + for (uint32_t _n = 0; _n < count; ++_n) { + AddElement(ss, ToString_PP_Rect(tickmarks[_n])); + } + EndElements(ss); + } + AddProp(ss, "count", ToString_uint32_t(count)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_Find_Private_0_3*)RealGetInterface("PPB_Find_Private;0.3"))->SetTickmarks(instance, tickmarks, count); +#endif // !INTERPOSE +} +} +static PPB_Find_Private_0_3 _PPB_Find_Private_0_3 = { + ns_PPB_Find_Private_0_3::SetPluginToHandleFindRequests_0_3, + ns_PPB_Find_Private_0_3::NumberOfFindResultsChanged_0_3, + ns_PPB_Find_Private_0_3::SelectedFindResultChanged_0_3, + ns_PPB_Find_Private_0_3::SetTickmarks_0_3, +}; +const string ToString_PPB_Find_Private(const PPB_Find_Private_0_3 *v) { + stringstream s; + s << v; + return s.str(); +} +const string ToString_PP_FlashLSORestrictions(const PP_FlashLSORestrictions *v) { + switch (*v) { + case 1: + return "\"PP_FLASHLSORESTRICTIONS_NONE\""; + case 2: + return "\"PP_FLASHLSORESTRICTIONS_BLOCK\""; + case 3: + return "\"PP_FLASHLSORESTRICTIONS_IN_MEMORY\""; + default: + return "\"???\""; + } +} +const string ToString_PP_FlashLSORestrictions(const PP_FlashLSORestrictions &v) { + return ToString_PP_FlashLSORestrictions(&v); +} +void FromJSON_PP_FlashLSORestrictions(JSONIterator& iterator, PP_FlashLSORestrictions &value) { + long int v; + FromJSON_int(iterator, v); + value = PP_FlashLSORestrictions(v); +} +const string ToString_PP_FlashSetting(const PP_FlashSetting *v) { + switch (*v) { + case 1: + return "\"PP_FLASHSETTING_3DENABLED\""; + case 2: + return "\"PP_FLASHSETTING_INCOGNITO\""; + case 3: + return "\"PP_FLASHSETTING_STAGE3DENABLED\""; + case 4: + return "\"PP_FLASHSETTING_LANGUAGE\""; + case 5: + return "\"PP_FLASHSETTING_NUMCORES\""; + case 6: + return "\"PP_FLASHSETTING_LSORESTRICTIONS\""; + case 7: + return "\"PP_FLASHSETTING_STAGE3DBASELINEENABLED\""; + default: + return "\"???\""; + } +} +const string ToString_PP_FlashSetting(const PP_FlashSetting &v) { + return ToString_PP_FlashSetting(&v); +} +void FromJSON_PP_FlashSetting(JSONIterator& iterator, PP_FlashSetting &value) { + long int v; + FromJSON_int(iterator, v); + value = PP_FlashSetting(v); +} +const string ToString_PP_FlashCrashKey(const PP_FlashCrashKey *v) { + switch (*v) { + case 1: + return "\"PP_FLASHCRASHKEY_URL\""; + case 2: + return "\"PP_FLASHCRASHKEY_RESOURCE_URL\""; + default: + return "\"???\""; + } +} +const string ToString_PP_FlashCrashKey(const PP_FlashCrashKey &v) { + return ToString_PP_FlashCrashKey(&v); +} +void FromJSON_PP_FlashCrashKey(JSONIterator& iterator, PP_FlashCrashKey &value) { + long int v; + FromJSON_int(iterator, v); + value = PP_FlashCrashKey(v); +} +namespace ns_PPB_Flash_12_4 { +static void SetInstanceAlwaysOnTop_12_4(PP_Instance instance, PP_Bool on_top) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Flash\""); + AddProp(ss, "__version", "\"12.4\""); + AddProp(ss, "__method", "\"SetInstanceAlwaysOnTop\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "on_top", ToString_PP_Bool(on_top)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_Flash_12_4*)RealGetInterface("PPB_Flash;12.4"))->SetInstanceAlwaysOnTop(instance, on_top); +#endif // !INTERPOSE +} +static PP_Bool DrawGlyphs_12_4(PP_Instance instance, PP_Resource pp_image_data, const struct PP_BrowserFont_Trusted_Description* font_desc, uint32_t color, const struct PP_Point* position, const struct PP_Rect* clip, const float transformation[3][3], PP_Bool allow_subpixel_aa, uint32_t glyph_count, const uint16_t glyph_indices[], const struct PP_Point glyph_advances[]) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Flash\""); + AddProp(ss, "__version", "\"12.4\""); + AddProp(ss, "__method", "\"DrawGlyphs\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "pp_image_data", ToString_PP_Resource(pp_image_data)); + AddProp(ss, "font_desc", ToString_PP_BrowserFont_Trusted_Description(font_desc)); + AddProp(ss, "color", ToString_uint32_t(color)); + AddProp(ss, "position", ToString_PP_Point(position)); + AddProp(ss, "clip", ToString_PP_Rect(clip)); + { + BeginProp(ss, "transformation"); + BeginElements(ss); + for (uint32_t _n = 0; _n < 3; ++_n) { + AddElement(ss, ToString_float_t(transformation[_n])); + } + EndElements(ss); + } + AddProp(ss, "allow_subpixel_aa", ToString_PP_Bool(allow_subpixel_aa)); + AddProp(ss, "glyph_count", ToString_uint32_t(glyph_count)); + { + BeginProp(ss, "glyph_indices"); + BeginElements(ss); + for (uint32_t _n = 0; _n < glyph_count; ++_n) { + AddElement(ss, ToString_uint16_t(glyph_indices[_n])); + } + EndElements(ss); + } + { + BeginProp(ss, "glyph_advances"); + BeginElements(ss); + for (uint32_t _n = 0; _n < glyph_count; ++_n) { + AddElement(ss, ToString_PP_Point(glyph_advances[_n])); + } + EndElements(ss); + } + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_Flash_12_4*)RealGetInterface("PPB_Flash;12.4"))->DrawGlyphs(instance, pp_image_data, font_desc, color, position, clip, transformation, allow_subpixel_aa, glyph_count, glyph_indices, glyph_advances); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static struct PP_Var GetProxyForURL_12_4(PP_Instance instance, const char* url) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Flash\""); + AddProp(ss, "__version", "\"12.4\""); + AddProp(ss, "__method", "\"GetProxyForURL\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "url", ToString_str_t(url)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + struct PP_Var rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Var(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + struct PP_Var rval = ((PPB_Flash_12_4*)RealGetInterface("PPB_Flash;12.4"))->GetProxyForURL(instance, url); + printf("RPC response: ["); + printf("%s", ToString_PP_Var(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t Navigate_12_4(PP_Resource request_info, const char* target, PP_Bool from_user_action) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Flash\""); + AddProp(ss, "__version", "\"12.4\""); + AddProp(ss, "__method", "\"Navigate\""); + AddProp(ss, "request_info", ToString_PP_Resource(request_info)); + AddProp(ss, "target", ToString_str_t(target)); + AddProp(ss, "from_user_action", ToString_PP_Bool(from_user_action)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_Flash_12_4*)RealGetInterface("PPB_Flash;12.4"))->Navigate(request_info, target, from_user_action); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static void RunMessageLoop_12_4(PP_Instance instance) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Flash\""); + AddProp(ss, "__version", "\"12.4\""); + AddProp(ss, "__method", "\"RunMessageLoop\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_Flash_12_4*)RealGetInterface("PPB_Flash;12.4"))->RunMessageLoop(instance); +#endif // !INTERPOSE +} +static void QuitMessageLoop_12_4(PP_Instance instance) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Flash\""); + AddProp(ss, "__version", "\"12.4\""); + AddProp(ss, "__method", "\"QuitMessageLoop\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_Flash_12_4*)RealGetInterface("PPB_Flash;12.4"))->QuitMessageLoop(instance); +#endif // !INTERPOSE +} +static double GetLocalTimeZoneOffset_12_4(PP_Instance instance, PP_Time t) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Flash\""); + AddProp(ss, "__version", "\"12.4\""); + AddProp(ss, "__method", "\"GetLocalTimeZoneOffset\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "t", ToString_PP_Time(t)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + double rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_double_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + double rval = ((PPB_Flash_12_4*)RealGetInterface("PPB_Flash;12.4"))->GetLocalTimeZoneOffset(instance, t); + printf("RPC response: ["); + printf("%s", ToString_double_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static struct PP_Var GetCommandLineArgs_12_4(PP_Module module) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Flash\""); + AddProp(ss, "__version", "\"12.4\""); + AddProp(ss, "__method", "\"GetCommandLineArgs\""); + AddProp(ss, "module", ToString_PP_Module(module)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + struct PP_Var rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Var(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + struct PP_Var rval = ((PPB_Flash_12_4*)RealGetInterface("PPB_Flash;12.4"))->GetCommandLineArgs(module); + printf("RPC response: ["); + printf("%s", ToString_PP_Var(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static void PreloadFontWin_12_4(const void* logfontw) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Flash\""); + AddProp(ss, "__version", "\"12.4\""); + AddProp(ss, "__method", "\"PreloadFontWin\""); + AddProp(ss, "logfontw", ToString_mem_t(logfontw)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_Flash_12_4*)RealGetInterface("PPB_Flash;12.4"))->PreloadFontWin(logfontw); +#endif // !INTERPOSE +} +static PP_Bool IsRectTopmost_12_4(PP_Instance instance, const struct PP_Rect* rect) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Flash\""); + AddProp(ss, "__version", "\"12.4\""); + AddProp(ss, "__method", "\"IsRectTopmost\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "rect", ToString_PP_Rect(rect)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_Flash_12_4*)RealGetInterface("PPB_Flash;12.4"))->IsRectTopmost(instance, rect); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t InvokePrinting_12_4(PP_Instance instance) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Flash\""); + AddProp(ss, "__version", "\"12.4\""); + AddProp(ss, "__method", "\"InvokePrinting\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_Flash_12_4*)RealGetInterface("PPB_Flash;12.4"))->InvokePrinting(instance); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static void UpdateActivity_12_4(PP_Instance instance) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Flash\""); + AddProp(ss, "__version", "\"12.4\""); + AddProp(ss, "__method", "\"UpdateActivity\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_Flash_12_4*)RealGetInterface("PPB_Flash;12.4"))->UpdateActivity(instance); +#endif // !INTERPOSE +} +static struct PP_Var GetDeviceID_12_4(PP_Instance instance) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Flash\""); + AddProp(ss, "__version", "\"12.4\""); + AddProp(ss, "__method", "\"GetDeviceID\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + struct PP_Var rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Var(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + struct PP_Var rval = ((PPB_Flash_12_4*)RealGetInterface("PPB_Flash;12.4"))->GetDeviceID(instance); + printf("RPC response: ["); + printf("%s", ToString_PP_Var(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t GetSettingInt_12_4(PP_Instance instance, PP_FlashSetting setting) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Flash\""); + AddProp(ss, "__version", "\"12.4\""); + AddProp(ss, "__method", "\"GetSettingInt\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "setting", ToString_PP_FlashSetting(setting)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_Flash_12_4*)RealGetInterface("PPB_Flash;12.4"))->GetSettingInt(instance, setting); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static struct PP_Var GetSetting_12_4(PP_Instance instance, PP_FlashSetting setting) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Flash\""); + AddProp(ss, "__version", "\"12.4\""); + AddProp(ss, "__method", "\"GetSetting\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "setting", ToString_PP_FlashSetting(setting)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + struct PP_Var rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Var(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + struct PP_Var rval = ((PPB_Flash_12_4*)RealGetInterface("PPB_Flash;12.4"))->GetSetting(instance, setting); + printf("RPC response: ["); + printf("%s", ToString_PP_Var(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +/* skipping SetCrashData */ +/* skipping EnumerateVideoCaptureDevices */ +} +static PPB_Flash_12_4 _PPB_Flash_12_4 = { + ns_PPB_Flash_12_4::SetInstanceAlwaysOnTop_12_4, + ns_PPB_Flash_12_4::DrawGlyphs_12_4, + ns_PPB_Flash_12_4::GetProxyForURL_12_4, + ns_PPB_Flash_12_4::Navigate_12_4, + ns_PPB_Flash_12_4::RunMessageLoop_12_4, + ns_PPB_Flash_12_4::QuitMessageLoop_12_4, + ns_PPB_Flash_12_4::GetLocalTimeZoneOffset_12_4, + ns_PPB_Flash_12_4::GetCommandLineArgs_12_4, + ns_PPB_Flash_12_4::PreloadFontWin_12_4, + ns_PPB_Flash_12_4::IsRectTopmost_12_4, + ns_PPB_Flash_12_4::InvokePrinting_12_4, + ns_PPB_Flash_12_4::UpdateActivity_12_4, + ns_PPB_Flash_12_4::GetDeviceID_12_4, + ns_PPB_Flash_12_4::GetSettingInt_12_4, + ns_PPB_Flash_12_4::GetSetting_12_4, +}; +const string ToString_PPB_Flash(const PPB_Flash_12_4 *v) { + stringstream s; + s << v; + return s.str(); +} +namespace ns_PPB_Flash_12_5 { +static void SetInstanceAlwaysOnTop_12_5(PP_Instance instance, PP_Bool on_top) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Flash\""); + AddProp(ss, "__version", "\"12.5\""); + AddProp(ss, "__method", "\"SetInstanceAlwaysOnTop\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "on_top", ToString_PP_Bool(on_top)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_Flash_12_5*)RealGetInterface("PPB_Flash;12.5"))->SetInstanceAlwaysOnTop(instance, on_top); +#endif // !INTERPOSE +} +static PP_Bool DrawGlyphs_12_5(PP_Instance instance, PP_Resource pp_image_data, const struct PP_BrowserFont_Trusted_Description* font_desc, uint32_t color, const struct PP_Point* position, const struct PP_Rect* clip, const float transformation[3][3], PP_Bool allow_subpixel_aa, uint32_t glyph_count, const uint16_t glyph_indices[], const struct PP_Point glyph_advances[]) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Flash\""); + AddProp(ss, "__version", "\"12.5\""); + AddProp(ss, "__method", "\"DrawGlyphs\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "pp_image_data", ToString_PP_Resource(pp_image_data)); + AddProp(ss, "font_desc", ToString_PP_BrowserFont_Trusted_Description(font_desc)); + AddProp(ss, "color", ToString_uint32_t(color)); + AddProp(ss, "position", ToString_PP_Point(position)); + AddProp(ss, "clip", ToString_PP_Rect(clip)); + { + BeginProp(ss, "transformation"); + BeginElements(ss); + for (uint32_t _n = 0; _n < 3; ++_n) { + AddElement(ss, ToString_float_t(transformation[_n])); + } + EndElements(ss); + } + AddProp(ss, "allow_subpixel_aa", ToString_PP_Bool(allow_subpixel_aa)); + AddProp(ss, "glyph_count", ToString_uint32_t(glyph_count)); + { + BeginProp(ss, "glyph_indices"); + BeginElements(ss); + for (uint32_t _n = 0; _n < glyph_count; ++_n) { + AddElement(ss, ToString_uint16_t(glyph_indices[_n])); + } + EndElements(ss); + } + { + BeginProp(ss, "glyph_advances"); + BeginElements(ss); + for (uint32_t _n = 0; _n < glyph_count; ++_n) { + AddElement(ss, ToString_PP_Point(glyph_advances[_n])); + } + EndElements(ss); + } + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_Flash_12_5*)RealGetInterface("PPB_Flash;12.5"))->DrawGlyphs(instance, pp_image_data, font_desc, color, position, clip, transformation, allow_subpixel_aa, glyph_count, glyph_indices, glyph_advances); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static struct PP_Var GetProxyForURL_12_5(PP_Instance instance, const char* url) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Flash\""); + AddProp(ss, "__version", "\"12.5\""); + AddProp(ss, "__method", "\"GetProxyForURL\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "url", ToString_str_t(url)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + struct PP_Var rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Var(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + struct PP_Var rval = ((PPB_Flash_12_5*)RealGetInterface("PPB_Flash;12.5"))->GetProxyForURL(instance, url); + printf("RPC response: ["); + printf("%s", ToString_PP_Var(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t Navigate_12_5(PP_Resource request_info, const char* target, PP_Bool from_user_action) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Flash\""); + AddProp(ss, "__version", "\"12.5\""); + AddProp(ss, "__method", "\"Navigate\""); + AddProp(ss, "request_info", ToString_PP_Resource(request_info)); + AddProp(ss, "target", ToString_str_t(target)); + AddProp(ss, "from_user_action", ToString_PP_Bool(from_user_action)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_Flash_12_5*)RealGetInterface("PPB_Flash;12.5"))->Navigate(request_info, target, from_user_action); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static void RunMessageLoop_12_5(PP_Instance instance) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Flash\""); + AddProp(ss, "__version", "\"12.5\""); + AddProp(ss, "__method", "\"RunMessageLoop\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_Flash_12_5*)RealGetInterface("PPB_Flash;12.5"))->RunMessageLoop(instance); +#endif // !INTERPOSE +} +static void QuitMessageLoop_12_5(PP_Instance instance) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Flash\""); + AddProp(ss, "__version", "\"12.5\""); + AddProp(ss, "__method", "\"QuitMessageLoop\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_Flash_12_5*)RealGetInterface("PPB_Flash;12.5"))->QuitMessageLoop(instance); +#endif // !INTERPOSE +} +static double GetLocalTimeZoneOffset_12_5(PP_Instance instance, PP_Time t) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Flash\""); + AddProp(ss, "__version", "\"12.5\""); + AddProp(ss, "__method", "\"GetLocalTimeZoneOffset\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "t", ToString_PP_Time(t)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + double rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_double_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + double rval = ((PPB_Flash_12_5*)RealGetInterface("PPB_Flash;12.5"))->GetLocalTimeZoneOffset(instance, t); + printf("RPC response: ["); + printf("%s", ToString_double_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static struct PP_Var GetCommandLineArgs_12_5(PP_Module module) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Flash\""); + AddProp(ss, "__version", "\"12.5\""); + AddProp(ss, "__method", "\"GetCommandLineArgs\""); + AddProp(ss, "module", ToString_PP_Module(module)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + struct PP_Var rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Var(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + struct PP_Var rval = ((PPB_Flash_12_5*)RealGetInterface("PPB_Flash;12.5"))->GetCommandLineArgs(module); + printf("RPC response: ["); + printf("%s", ToString_PP_Var(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static void PreloadFontWin_12_5(const void* logfontw) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Flash\""); + AddProp(ss, "__version", "\"12.5\""); + AddProp(ss, "__method", "\"PreloadFontWin\""); + AddProp(ss, "logfontw", ToString_mem_t(logfontw)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_Flash_12_5*)RealGetInterface("PPB_Flash;12.5"))->PreloadFontWin(logfontw); +#endif // !INTERPOSE +} +static PP_Bool IsRectTopmost_12_5(PP_Instance instance, const struct PP_Rect* rect) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Flash\""); + AddProp(ss, "__version", "\"12.5\""); + AddProp(ss, "__method", "\"IsRectTopmost\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "rect", ToString_PP_Rect(rect)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_Flash_12_5*)RealGetInterface("PPB_Flash;12.5"))->IsRectTopmost(instance, rect); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t InvokePrinting_12_5(PP_Instance instance) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Flash\""); + AddProp(ss, "__version", "\"12.5\""); + AddProp(ss, "__method", "\"InvokePrinting\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_Flash_12_5*)RealGetInterface("PPB_Flash;12.5"))->InvokePrinting(instance); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static void UpdateActivity_12_5(PP_Instance instance) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Flash\""); + AddProp(ss, "__version", "\"12.5\""); + AddProp(ss, "__method", "\"UpdateActivity\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_Flash_12_5*)RealGetInterface("PPB_Flash;12.5"))->UpdateActivity(instance); +#endif // !INTERPOSE +} +static struct PP_Var GetDeviceID_12_5(PP_Instance instance) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Flash\""); + AddProp(ss, "__version", "\"12.5\""); + AddProp(ss, "__method", "\"GetDeviceID\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + struct PP_Var rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Var(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + struct PP_Var rval = ((PPB_Flash_12_5*)RealGetInterface("PPB_Flash;12.5"))->GetDeviceID(instance); + printf("RPC response: ["); + printf("%s", ToString_PP_Var(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t GetSettingInt_12_5(PP_Instance instance, PP_FlashSetting setting) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Flash\""); + AddProp(ss, "__version", "\"12.5\""); + AddProp(ss, "__method", "\"GetSettingInt\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "setting", ToString_PP_FlashSetting(setting)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_Flash_12_5*)RealGetInterface("PPB_Flash;12.5"))->GetSettingInt(instance, setting); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static struct PP_Var GetSetting_12_5(PP_Instance instance, PP_FlashSetting setting) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Flash\""); + AddProp(ss, "__version", "\"12.5\""); + AddProp(ss, "__method", "\"GetSetting\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "setting", ToString_PP_FlashSetting(setting)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + struct PP_Var rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Var(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + struct PP_Var rval = ((PPB_Flash_12_5*)RealGetInterface("PPB_Flash;12.5"))->GetSetting(instance, setting); + printf("RPC response: ["); + printf("%s", ToString_PP_Var(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool SetCrashData_12_5(PP_Instance instance, PP_FlashCrashKey key, struct PP_Var value) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Flash\""); + AddProp(ss, "__version", "\"12.5\""); + AddProp(ss, "__method", "\"SetCrashData\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "key", ToString_PP_FlashCrashKey(key)); + AddProp(ss, "value", ToString_PP_Var(value)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_Flash_12_5*)RealGetInterface("PPB_Flash;12.5"))->SetCrashData(instance, key, value); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +/* skipping EnumerateVideoCaptureDevices */ +} +static PPB_Flash_12_5 _PPB_Flash_12_5 = { + ns_PPB_Flash_12_5::SetInstanceAlwaysOnTop_12_5, + ns_PPB_Flash_12_5::DrawGlyphs_12_5, + ns_PPB_Flash_12_5::GetProxyForURL_12_5, + ns_PPB_Flash_12_5::Navigate_12_5, + ns_PPB_Flash_12_5::RunMessageLoop_12_5, + ns_PPB_Flash_12_5::QuitMessageLoop_12_5, + ns_PPB_Flash_12_5::GetLocalTimeZoneOffset_12_5, + ns_PPB_Flash_12_5::GetCommandLineArgs_12_5, + ns_PPB_Flash_12_5::PreloadFontWin_12_5, + ns_PPB_Flash_12_5::IsRectTopmost_12_5, + ns_PPB_Flash_12_5::InvokePrinting_12_5, + ns_PPB_Flash_12_5::UpdateActivity_12_5, + ns_PPB_Flash_12_5::GetDeviceID_12_5, + ns_PPB_Flash_12_5::GetSettingInt_12_5, + ns_PPB_Flash_12_5::GetSetting_12_5, + ns_PPB_Flash_12_5::SetCrashData_12_5, +}; +const string ToString_PPB_Flash(const PPB_Flash_12_5 *v) { + stringstream s; + s << v; + return s.str(); +} +namespace ns_PPB_Flash_12_6 { +static void SetInstanceAlwaysOnTop_12_6(PP_Instance instance, PP_Bool on_top) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Flash\""); + AddProp(ss, "__version", "\"12.6\""); + AddProp(ss, "__method", "\"SetInstanceAlwaysOnTop\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "on_top", ToString_PP_Bool(on_top)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_Flash_12_6*)RealGetInterface("PPB_Flash;12.6"))->SetInstanceAlwaysOnTop(instance, on_top); +#endif // !INTERPOSE +} +static PP_Bool DrawGlyphs_12_6(PP_Instance instance, PP_Resource pp_image_data, const struct PP_BrowserFont_Trusted_Description* font_desc, uint32_t color, const struct PP_Point* position, const struct PP_Rect* clip, const float transformation[3][3], PP_Bool allow_subpixel_aa, uint32_t glyph_count, const uint16_t glyph_indices[], const struct PP_Point glyph_advances[]) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Flash\""); + AddProp(ss, "__version", "\"12.6\""); + AddProp(ss, "__method", "\"DrawGlyphs\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "pp_image_data", ToString_PP_Resource(pp_image_data)); + AddProp(ss, "font_desc", ToString_PP_BrowserFont_Trusted_Description(font_desc)); + AddProp(ss, "color", ToString_uint32_t(color)); + AddProp(ss, "position", ToString_PP_Point(position)); + AddProp(ss, "clip", ToString_PP_Rect(clip)); + { + BeginProp(ss, "transformation"); + BeginElements(ss); + for (uint32_t _n = 0; _n < 3; ++_n) { + AddElement(ss, ToString_float_t(transformation[_n])); + } + EndElements(ss); + } + AddProp(ss, "allow_subpixel_aa", ToString_PP_Bool(allow_subpixel_aa)); + AddProp(ss, "glyph_count", ToString_uint32_t(glyph_count)); + { + BeginProp(ss, "glyph_indices"); + BeginElements(ss); + for (uint32_t _n = 0; _n < glyph_count; ++_n) { + AddElement(ss, ToString_uint16_t(glyph_indices[_n])); + } + EndElements(ss); + } + { + BeginProp(ss, "glyph_advances"); + BeginElements(ss); + for (uint32_t _n = 0; _n < glyph_count; ++_n) { + AddElement(ss, ToString_PP_Point(glyph_advances[_n])); + } + EndElements(ss); + } + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_Flash_12_6*)RealGetInterface("PPB_Flash;12.6"))->DrawGlyphs(instance, pp_image_data, font_desc, color, position, clip, transformation, allow_subpixel_aa, glyph_count, glyph_indices, glyph_advances); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static struct PP_Var GetProxyForURL_12_6(PP_Instance instance, const char* url) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Flash\""); + AddProp(ss, "__version", "\"12.6\""); + AddProp(ss, "__method", "\"GetProxyForURL\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "url", ToString_str_t(url)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + struct PP_Var rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Var(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + struct PP_Var rval = ((PPB_Flash_12_6*)RealGetInterface("PPB_Flash;12.6"))->GetProxyForURL(instance, url); + printf("RPC response: ["); + printf("%s", ToString_PP_Var(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t Navigate_12_6(PP_Resource request_info, const char* target, PP_Bool from_user_action) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Flash\""); + AddProp(ss, "__version", "\"12.6\""); + AddProp(ss, "__method", "\"Navigate\""); + AddProp(ss, "request_info", ToString_PP_Resource(request_info)); + AddProp(ss, "target", ToString_str_t(target)); + AddProp(ss, "from_user_action", ToString_PP_Bool(from_user_action)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_Flash_12_6*)RealGetInterface("PPB_Flash;12.6"))->Navigate(request_info, target, from_user_action); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static void RunMessageLoop_12_6(PP_Instance instance) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Flash\""); + AddProp(ss, "__version", "\"12.6\""); + AddProp(ss, "__method", "\"RunMessageLoop\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_Flash_12_6*)RealGetInterface("PPB_Flash;12.6"))->RunMessageLoop(instance); +#endif // !INTERPOSE +} +static void QuitMessageLoop_12_6(PP_Instance instance) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Flash\""); + AddProp(ss, "__version", "\"12.6\""); + AddProp(ss, "__method", "\"QuitMessageLoop\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_Flash_12_6*)RealGetInterface("PPB_Flash;12.6"))->QuitMessageLoop(instance); +#endif // !INTERPOSE +} +static double GetLocalTimeZoneOffset_12_6(PP_Instance instance, PP_Time t) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Flash\""); + AddProp(ss, "__version", "\"12.6\""); + AddProp(ss, "__method", "\"GetLocalTimeZoneOffset\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "t", ToString_PP_Time(t)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + double rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_double_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + double rval = ((PPB_Flash_12_6*)RealGetInterface("PPB_Flash;12.6"))->GetLocalTimeZoneOffset(instance, t); + printf("RPC response: ["); + printf("%s", ToString_double_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static struct PP_Var GetCommandLineArgs_12_6(PP_Module module) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Flash\""); + AddProp(ss, "__version", "\"12.6\""); + AddProp(ss, "__method", "\"GetCommandLineArgs\""); + AddProp(ss, "module", ToString_PP_Module(module)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + struct PP_Var rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Var(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + struct PP_Var rval = ((PPB_Flash_12_6*)RealGetInterface("PPB_Flash;12.6"))->GetCommandLineArgs(module); + printf("RPC response: ["); + printf("%s", ToString_PP_Var(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static void PreloadFontWin_12_6(const void* logfontw) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Flash\""); + AddProp(ss, "__version", "\"12.6\""); + AddProp(ss, "__method", "\"PreloadFontWin\""); + AddProp(ss, "logfontw", ToString_mem_t(logfontw)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_Flash_12_6*)RealGetInterface("PPB_Flash;12.6"))->PreloadFontWin(logfontw); +#endif // !INTERPOSE +} +static PP_Bool IsRectTopmost_12_6(PP_Instance instance, const struct PP_Rect* rect) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Flash\""); + AddProp(ss, "__version", "\"12.6\""); + AddProp(ss, "__method", "\"IsRectTopmost\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "rect", ToString_PP_Rect(rect)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_Flash_12_6*)RealGetInterface("PPB_Flash;12.6"))->IsRectTopmost(instance, rect); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t InvokePrinting_12_6(PP_Instance instance) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Flash\""); + AddProp(ss, "__version", "\"12.6\""); + AddProp(ss, "__method", "\"InvokePrinting\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_Flash_12_6*)RealGetInterface("PPB_Flash;12.6"))->InvokePrinting(instance); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static void UpdateActivity_12_6(PP_Instance instance) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Flash\""); + AddProp(ss, "__version", "\"12.6\""); + AddProp(ss, "__method", "\"UpdateActivity\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_Flash_12_6*)RealGetInterface("PPB_Flash;12.6"))->UpdateActivity(instance); +#endif // !INTERPOSE +} +static struct PP_Var GetDeviceID_12_6(PP_Instance instance) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Flash\""); + AddProp(ss, "__version", "\"12.6\""); + AddProp(ss, "__method", "\"GetDeviceID\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + struct PP_Var rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Var(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + struct PP_Var rval = ((PPB_Flash_12_6*)RealGetInterface("PPB_Flash;12.6"))->GetDeviceID(instance); + printf("RPC response: ["); + printf("%s", ToString_PP_Var(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t GetSettingInt_12_6(PP_Instance instance, PP_FlashSetting setting) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Flash\""); + AddProp(ss, "__version", "\"12.6\""); + AddProp(ss, "__method", "\"GetSettingInt\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "setting", ToString_PP_FlashSetting(setting)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_Flash_12_6*)RealGetInterface("PPB_Flash;12.6"))->GetSettingInt(instance, setting); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static struct PP_Var GetSetting_12_6(PP_Instance instance, PP_FlashSetting setting) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Flash\""); + AddProp(ss, "__version", "\"12.6\""); + AddProp(ss, "__method", "\"GetSetting\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "setting", ToString_PP_FlashSetting(setting)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + struct PP_Var rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Var(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + struct PP_Var rval = ((PPB_Flash_12_6*)RealGetInterface("PPB_Flash;12.6"))->GetSetting(instance, setting); + printf("RPC response: ["); + printf("%s", ToString_PP_Var(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool SetCrashData_12_6(PP_Instance instance, PP_FlashCrashKey key, struct PP_Var value) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Flash\""); + AddProp(ss, "__version", "\"12.6\""); + AddProp(ss, "__method", "\"SetCrashData\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "key", ToString_PP_FlashCrashKey(key)); + AddProp(ss, "value", ToString_PP_Var(value)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_Flash_12_6*)RealGetInterface("PPB_Flash;12.6"))->SetCrashData(instance, key, value); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t EnumerateVideoCaptureDevices_12_6(PP_Instance instance, PP_Resource video_capture, struct PP_ArrayOutput devices) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Flash\""); + AddProp(ss, "__version", "\"12.6\""); + AddProp(ss, "__method", "\"EnumerateVideoCaptureDevices\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "video_capture", ToString_PP_Resource(video_capture)); + AddProp(ss, "devices", ToString_PP_ArrayOutput(devices)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_Flash_12_6*)RealGetInterface("PPB_Flash;12.6"))->EnumerateVideoCaptureDevices(instance, video_capture, devices); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +} +static PPB_Flash_12_6 _PPB_Flash_12_6 = { + ns_PPB_Flash_12_6::SetInstanceAlwaysOnTop_12_6, + ns_PPB_Flash_12_6::DrawGlyphs_12_6, + ns_PPB_Flash_12_6::GetProxyForURL_12_6, + ns_PPB_Flash_12_6::Navigate_12_6, + ns_PPB_Flash_12_6::RunMessageLoop_12_6, + ns_PPB_Flash_12_6::QuitMessageLoop_12_6, + ns_PPB_Flash_12_6::GetLocalTimeZoneOffset_12_6, + ns_PPB_Flash_12_6::GetCommandLineArgs_12_6, + ns_PPB_Flash_12_6::PreloadFontWin_12_6, + ns_PPB_Flash_12_6::IsRectTopmost_12_6, + ns_PPB_Flash_12_6::InvokePrinting_12_6, + ns_PPB_Flash_12_6::UpdateActivity_12_6, + ns_PPB_Flash_12_6::GetDeviceID_12_6, + ns_PPB_Flash_12_6::GetSettingInt_12_6, + ns_PPB_Flash_12_6::GetSetting_12_6, + ns_PPB_Flash_12_6::SetCrashData_12_6, + ns_PPB_Flash_12_6::EnumerateVideoCaptureDevices_12_6, +}; +const string ToString_PPB_Flash(const PPB_Flash_12_6 *v) { + stringstream s; + s << v; + return s.str(); +} +namespace ns_PPB_Flash_13_0 { +static void SetInstanceAlwaysOnTop_13_0(PP_Instance instance, PP_Bool on_top) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Flash\""); + AddProp(ss, "__version", "\"13.0\""); + AddProp(ss, "__method", "\"SetInstanceAlwaysOnTop\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "on_top", ToString_PP_Bool(on_top)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_Flash_13_0*)RealGetInterface("PPB_Flash;13.0"))->SetInstanceAlwaysOnTop(instance, on_top); +#endif // !INTERPOSE +} +static PP_Bool DrawGlyphs_13_0(PP_Instance instance, PP_Resource pp_image_data, const struct PP_BrowserFont_Trusted_Description* font_desc, uint32_t color, const struct PP_Point* position, const struct PP_Rect* clip, const float transformation[3][3], PP_Bool allow_subpixel_aa, uint32_t glyph_count, const uint16_t glyph_indices[], const struct PP_Point glyph_advances[]) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Flash\""); + AddProp(ss, "__version", "\"13.0\""); + AddProp(ss, "__method", "\"DrawGlyphs\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "pp_image_data", ToString_PP_Resource(pp_image_data)); + AddProp(ss, "font_desc", ToString_PP_BrowserFont_Trusted_Description(font_desc)); + AddProp(ss, "color", ToString_uint32_t(color)); + AddProp(ss, "position", ToString_PP_Point(position)); + AddProp(ss, "clip", ToString_PP_Rect(clip)); + { + BeginProp(ss, "transformation"); + BeginElements(ss); + for (uint32_t _n = 0; _n < 3; ++_n) { + AddElement(ss, ToString_float_t(transformation[_n])); + } + EndElements(ss); + } + AddProp(ss, "allow_subpixel_aa", ToString_PP_Bool(allow_subpixel_aa)); + AddProp(ss, "glyph_count", ToString_uint32_t(glyph_count)); + { + BeginProp(ss, "glyph_indices"); + BeginElements(ss); + for (uint32_t _n = 0; _n < glyph_count; ++_n) { + AddElement(ss, ToString_uint16_t(glyph_indices[_n])); + } + EndElements(ss); + } + { + BeginProp(ss, "glyph_advances"); + BeginElements(ss); + for (uint32_t _n = 0; _n < glyph_count; ++_n) { + AddElement(ss, ToString_PP_Point(glyph_advances[_n])); + } + EndElements(ss); + } + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_Flash_13_0*)RealGetInterface("PPB_Flash;13.0"))->DrawGlyphs(instance, pp_image_data, font_desc, color, position, clip, transformation, allow_subpixel_aa, glyph_count, glyph_indices, glyph_advances); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static struct PP_Var GetProxyForURL_13_0(PP_Instance instance, const char* url) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Flash\""); + AddProp(ss, "__version", "\"13.0\""); + AddProp(ss, "__method", "\"GetProxyForURL\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "url", ToString_str_t(url)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + struct PP_Var rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Var(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + struct PP_Var rval = ((PPB_Flash_13_0*)RealGetInterface("PPB_Flash;13.0"))->GetProxyForURL(instance, url); + printf("RPC response: ["); + printf("%s", ToString_PP_Var(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t Navigate_13_0(PP_Resource request_info, const char* target, PP_Bool from_user_action) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Flash\""); + AddProp(ss, "__version", "\"13.0\""); + AddProp(ss, "__method", "\"Navigate\""); + AddProp(ss, "request_info", ToString_PP_Resource(request_info)); + AddProp(ss, "target", ToString_str_t(target)); + AddProp(ss, "from_user_action", ToString_PP_Bool(from_user_action)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_Flash_13_0*)RealGetInterface("PPB_Flash;13.0"))->Navigate(request_info, target, from_user_action); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +/* skipping RunMessageLoop */ +/* skipping QuitMessageLoop */ +static double GetLocalTimeZoneOffset_13_0(PP_Instance instance, PP_Time t) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Flash\""); + AddProp(ss, "__version", "\"13.0\""); + AddProp(ss, "__method", "\"GetLocalTimeZoneOffset\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "t", ToString_PP_Time(t)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + double rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_double_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + double rval = ((PPB_Flash_13_0*)RealGetInterface("PPB_Flash;13.0"))->GetLocalTimeZoneOffset(instance, t); + printf("RPC response: ["); + printf("%s", ToString_double_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static struct PP_Var GetCommandLineArgs_13_0(PP_Module module) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Flash\""); + AddProp(ss, "__version", "\"13.0\""); + AddProp(ss, "__method", "\"GetCommandLineArgs\""); + AddProp(ss, "module", ToString_PP_Module(module)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + struct PP_Var rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Var(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + struct PP_Var rval = ((PPB_Flash_13_0*)RealGetInterface("PPB_Flash;13.0"))->GetCommandLineArgs(module); + printf("RPC response: ["); + printf("%s", ToString_PP_Var(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static void PreloadFontWin_13_0(const void* logfontw) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Flash\""); + AddProp(ss, "__version", "\"13.0\""); + AddProp(ss, "__method", "\"PreloadFontWin\""); + AddProp(ss, "logfontw", ToString_mem_t(logfontw)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_Flash_13_0*)RealGetInterface("PPB_Flash;13.0"))->PreloadFontWin(logfontw); +#endif // !INTERPOSE +} +static PP_Bool IsRectTopmost_13_0(PP_Instance instance, const struct PP_Rect* rect) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Flash\""); + AddProp(ss, "__version", "\"13.0\""); + AddProp(ss, "__method", "\"IsRectTopmost\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "rect", ToString_PP_Rect(rect)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_Flash_13_0*)RealGetInterface("PPB_Flash;13.0"))->IsRectTopmost(instance, rect); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +/* skipping InvokePrinting */ +static void UpdateActivity_13_0(PP_Instance instance) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Flash\""); + AddProp(ss, "__version", "\"13.0\""); + AddProp(ss, "__method", "\"UpdateActivity\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_Flash_13_0*)RealGetInterface("PPB_Flash;13.0"))->UpdateActivity(instance); +#endif // !INTERPOSE +} +/* skipping GetDeviceID */ +/* skipping GetSettingInt */ +static struct PP_Var GetSetting_13_0(PP_Instance instance, PP_FlashSetting setting) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Flash\""); + AddProp(ss, "__version", "\"13.0\""); + AddProp(ss, "__method", "\"GetSetting\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "setting", ToString_PP_FlashSetting(setting)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + struct PP_Var rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Var(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + struct PP_Var rval = ((PPB_Flash_13_0*)RealGetInterface("PPB_Flash;13.0"))->GetSetting(instance, setting); + printf("RPC response: ["); + printf("%s", ToString_PP_Var(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool SetCrashData_13_0(PP_Instance instance, PP_FlashCrashKey key, struct PP_Var value) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Flash\""); + AddProp(ss, "__version", "\"13.0\""); + AddProp(ss, "__method", "\"SetCrashData\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "key", ToString_PP_FlashCrashKey(key)); + AddProp(ss, "value", ToString_PP_Var(value)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_Flash_13_0*)RealGetInterface("PPB_Flash;13.0"))->SetCrashData(instance, key, value); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t EnumerateVideoCaptureDevices_13_0(PP_Instance instance, PP_Resource video_capture, struct PP_ArrayOutput devices) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Flash\""); + AddProp(ss, "__version", "\"13.0\""); + AddProp(ss, "__method", "\"EnumerateVideoCaptureDevices\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "video_capture", ToString_PP_Resource(video_capture)); + AddProp(ss, "devices", ToString_PP_ArrayOutput(devices)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_Flash_13_0*)RealGetInterface("PPB_Flash;13.0"))->EnumerateVideoCaptureDevices(instance, video_capture, devices); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +} +static PPB_Flash_13_0 _PPB_Flash_13_0 = { + ns_PPB_Flash_13_0::SetInstanceAlwaysOnTop_13_0, + ns_PPB_Flash_13_0::DrawGlyphs_13_0, + ns_PPB_Flash_13_0::GetProxyForURL_13_0, + ns_PPB_Flash_13_0::Navigate_13_0, + ns_PPB_Flash_13_0::GetLocalTimeZoneOffset_13_0, + ns_PPB_Flash_13_0::GetCommandLineArgs_13_0, + ns_PPB_Flash_13_0::PreloadFontWin_13_0, + ns_PPB_Flash_13_0::IsRectTopmost_13_0, + ns_PPB_Flash_13_0::UpdateActivity_13_0, + ns_PPB_Flash_13_0::GetSetting_13_0, + ns_PPB_Flash_13_0::SetCrashData_13_0, + ns_PPB_Flash_13_0::EnumerateVideoCaptureDevices_13_0, +}; +const string ToString_PPB_Flash(const PPB_Flash_13_0 *v) { + stringstream s; + s << v; + return s.str(); +} +const string ToString_PP_Flash_Clipboard_Type(const PP_Flash_Clipboard_Type *v) { + switch (*v) { + case 0: + return "\"PP_FLASH_CLIPBOARD_TYPE_STANDARD\""; + case 1: + return "\"PP_FLASH_CLIPBOARD_TYPE_SELECTION\""; + default: + return "\"???\""; + } +} +const string ToString_PP_Flash_Clipboard_Type(const PP_Flash_Clipboard_Type &v) { + return ToString_PP_Flash_Clipboard_Type(&v); +} +void FromJSON_PP_Flash_Clipboard_Type(JSONIterator& iterator, PP_Flash_Clipboard_Type &value) { + long int v; + FromJSON_int(iterator, v); + value = PP_Flash_Clipboard_Type(v); +} +const string ToString_PP_Flash_Clipboard_Format(const PP_Flash_Clipboard_Format *v) { + switch (*v) { + case 0: + return "\"PP_FLASH_CLIPBOARD_FORMAT_INVALID\""; + case 1: + return "\"PP_FLASH_CLIPBOARD_FORMAT_PLAINTEXT\""; + case 2: + return "\"PP_FLASH_CLIPBOARD_FORMAT_HTML\""; + case 3: + return "\"PP_FLASH_CLIPBOARD_FORMAT_RTF\""; + default: + return "\"???\""; + } +} +const string ToString_PP_Flash_Clipboard_Format(const PP_Flash_Clipboard_Format &v) { + return ToString_PP_Flash_Clipboard_Format(&v); +} +void FromJSON_PP_Flash_Clipboard_Format(JSONIterator& iterator, PP_Flash_Clipboard_Format &value) { + long int v; + FromJSON_int(iterator, v); + value = PP_Flash_Clipboard_Format(v); +} +namespace ns_PPB_Flash_Clipboard_4_0 { +static PP_Bool IsFormatAvailable_4_0(PP_Instance instance_id, PP_Flash_Clipboard_Type clipboard_type, PP_Flash_Clipboard_Format format) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Flash_Clipboard\""); + AddProp(ss, "__version", "\"4.0\""); + AddProp(ss, "__method", "\"IsFormatAvailable\""); + AddProp(ss, "instance_id", ToString_PP_Instance(instance_id)); + AddProp(ss, "clipboard_type", ToString_PP_Flash_Clipboard_Type(clipboard_type)); + AddProp(ss, "format", ToString_PP_Flash_Clipboard_Format(format)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_Flash_Clipboard_4_0*)RealGetInterface("PPB_Flash_Clipboard;4.0"))->IsFormatAvailable(instance_id, clipboard_type, format); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static struct PP_Var ReadData_4_0(PP_Instance instance_id, PP_Flash_Clipboard_Type clipboard_type, PP_Flash_Clipboard_Format format) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Flash_Clipboard\""); + AddProp(ss, "__version", "\"4.0\""); + AddProp(ss, "__method", "\"ReadData\""); + AddProp(ss, "instance_id", ToString_PP_Instance(instance_id)); + AddProp(ss, "clipboard_type", ToString_PP_Flash_Clipboard_Type(clipboard_type)); + AddProp(ss, "format", ToString_PP_Flash_Clipboard_Format(format)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + struct PP_Var rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Var(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + struct PP_Var rval = ((PPB_Flash_Clipboard_4_0*)RealGetInterface("PPB_Flash_Clipboard;4.0"))->ReadData(instance_id, clipboard_type, format); + printf("RPC response: ["); + printf("%s", ToString_PP_Var(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t WriteData_4_0(PP_Instance instance_id, PP_Flash_Clipboard_Type clipboard_type, uint32_t data_item_count, const PP_Flash_Clipboard_Format formats[], const struct PP_Var data_items[]) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Flash_Clipboard\""); + AddProp(ss, "__version", "\"4.0\""); + AddProp(ss, "__method", "\"WriteData\""); + AddProp(ss, "instance_id", ToString_PP_Instance(instance_id)); + AddProp(ss, "clipboard_type", ToString_PP_Flash_Clipboard_Type(clipboard_type)); + AddProp(ss, "data_item_count", ToString_uint32_t(data_item_count)); + { + BeginProp(ss, "formats"); + BeginElements(ss); + for (uint32_t _n = 0; _n < data_item_count; ++_n) { + AddElement(ss, ToString_PP_Flash_Clipboard_Format(formats[_n])); + } + EndElements(ss); + } + { + BeginProp(ss, "data_items"); + BeginElements(ss); + for (uint32_t _n = 0; _n < data_item_count; ++_n) { + AddElement(ss, ToString_PP_Var(data_items[_n])); + } + EndElements(ss); + } + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_Flash_Clipboard_4_0*)RealGetInterface("PPB_Flash_Clipboard;4.0"))->WriteData(instance_id, clipboard_type, data_item_count, formats, data_items); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +/* skipping RegisterCustomFormat */ +/* skipping IsFormatAvailable */ +/* skipping ReadData */ +/* skipping WriteData */ +/* skipping GetSequenceNumber */ +} +static PPB_Flash_Clipboard_4_0 _PPB_Flash_Clipboard_4_0 = { + ns_PPB_Flash_Clipboard_4_0::IsFormatAvailable_4_0, + ns_PPB_Flash_Clipboard_4_0::ReadData_4_0, + ns_PPB_Flash_Clipboard_4_0::WriteData_4_0, +}; +const string ToString_PPB_Flash_Clipboard(const PPB_Flash_Clipboard_4_0 *v) { + stringstream s; + s << v; + return s.str(); +} +namespace ns_PPB_Flash_Clipboard_5_0 { +/* skipping IsFormatAvailable */ +/* skipping ReadData */ +/* skipping WriteData */ +static uint32_t RegisterCustomFormat_5_0(PP_Instance instance_id, const char* format_name) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Flash_Clipboard\""); + AddProp(ss, "__version", "\"5.0\""); + AddProp(ss, "__method", "\"RegisterCustomFormat\""); + AddProp(ss, "instance_id", ToString_PP_Instance(instance_id)); + AddProp(ss, "format_name", ToString_str_t(format_name)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + uint32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_uint32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + uint32_t rval = ((PPB_Flash_Clipboard_5_0*)RealGetInterface("PPB_Flash_Clipboard;5.0"))->RegisterCustomFormat(instance_id, format_name); + printf("RPC response: ["); + printf("%s", ToString_uint32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool IsFormatAvailable_5_0(PP_Instance instance_id, PP_Flash_Clipboard_Type clipboard_type, uint32_t format) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Flash_Clipboard\""); + AddProp(ss, "__version", "\"5.0\""); + AddProp(ss, "__method", "\"IsFormatAvailable\""); + AddProp(ss, "instance_id", ToString_PP_Instance(instance_id)); + AddProp(ss, "clipboard_type", ToString_PP_Flash_Clipboard_Type(clipboard_type)); + AddProp(ss, "format", ToString_uint32_t(format)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_Flash_Clipboard_5_0*)RealGetInterface("PPB_Flash_Clipboard;5.0"))->IsFormatAvailable(instance_id, clipboard_type, format); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static struct PP_Var ReadData_5_0(PP_Instance instance_id, PP_Flash_Clipboard_Type clipboard_type, uint32_t format) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Flash_Clipboard\""); + AddProp(ss, "__version", "\"5.0\""); + AddProp(ss, "__method", "\"ReadData\""); + AddProp(ss, "instance_id", ToString_PP_Instance(instance_id)); + AddProp(ss, "clipboard_type", ToString_PP_Flash_Clipboard_Type(clipboard_type)); + AddProp(ss, "format", ToString_uint32_t(format)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + struct PP_Var rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Var(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + struct PP_Var rval = ((PPB_Flash_Clipboard_5_0*)RealGetInterface("PPB_Flash_Clipboard;5.0"))->ReadData(instance_id, clipboard_type, format); + printf("RPC response: ["); + printf("%s", ToString_PP_Var(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t WriteData_5_0(PP_Instance instance_id, PP_Flash_Clipboard_Type clipboard_type, uint32_t data_item_count, const uint32_t formats[], const struct PP_Var data_items[]) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Flash_Clipboard\""); + AddProp(ss, "__version", "\"5.0\""); + AddProp(ss, "__method", "\"WriteData\""); + AddProp(ss, "instance_id", ToString_PP_Instance(instance_id)); + AddProp(ss, "clipboard_type", ToString_PP_Flash_Clipboard_Type(clipboard_type)); + AddProp(ss, "data_item_count", ToString_uint32_t(data_item_count)); + { + BeginProp(ss, "formats"); + BeginElements(ss); + for (uint32_t _n = 0; _n < data_item_count; ++_n) { + AddElement(ss, ToString_uint32_t(formats[_n])); + } + EndElements(ss); + } + { + BeginProp(ss, "data_items"); + BeginElements(ss); + for (uint32_t _n = 0; _n < data_item_count; ++_n) { + AddElement(ss, ToString_PP_Var(data_items[_n])); + } + EndElements(ss); + } + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_Flash_Clipboard_5_0*)RealGetInterface("PPB_Flash_Clipboard;5.0"))->WriteData(instance_id, clipboard_type, data_item_count, formats, data_items); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +/* skipping GetSequenceNumber */ +} +static PPB_Flash_Clipboard_5_0 _PPB_Flash_Clipboard_5_0 = { + ns_PPB_Flash_Clipboard_5_0::RegisterCustomFormat_5_0, + ns_PPB_Flash_Clipboard_5_0::IsFormatAvailable_5_0, + ns_PPB_Flash_Clipboard_5_0::ReadData_5_0, + ns_PPB_Flash_Clipboard_5_0::WriteData_5_0, +}; +const string ToString_PPB_Flash_Clipboard(const PPB_Flash_Clipboard_5_0 *v) { + stringstream s; + s << v; + return s.str(); +} +namespace ns_PPB_Flash_Clipboard_5_1 { +/* skipping IsFormatAvailable */ +/* skipping ReadData */ +/* skipping WriteData */ +static uint32_t RegisterCustomFormat_5_1(PP_Instance instance_id, const char* format_name) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Flash_Clipboard\""); + AddProp(ss, "__version", "\"5.1\""); + AddProp(ss, "__method", "\"RegisterCustomFormat\""); + AddProp(ss, "instance_id", ToString_PP_Instance(instance_id)); + AddProp(ss, "format_name", ToString_str_t(format_name)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + uint32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_uint32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + uint32_t rval = ((PPB_Flash_Clipboard_5_1*)RealGetInterface("PPB_Flash_Clipboard;5.1"))->RegisterCustomFormat(instance_id, format_name); + printf("RPC response: ["); + printf("%s", ToString_uint32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool IsFormatAvailable_5_1(PP_Instance instance_id, PP_Flash_Clipboard_Type clipboard_type, uint32_t format) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Flash_Clipboard\""); + AddProp(ss, "__version", "\"5.1\""); + AddProp(ss, "__method", "\"IsFormatAvailable\""); + AddProp(ss, "instance_id", ToString_PP_Instance(instance_id)); + AddProp(ss, "clipboard_type", ToString_PP_Flash_Clipboard_Type(clipboard_type)); + AddProp(ss, "format", ToString_uint32_t(format)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_Flash_Clipboard_5_1*)RealGetInterface("PPB_Flash_Clipboard;5.1"))->IsFormatAvailable(instance_id, clipboard_type, format); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static struct PP_Var ReadData_5_1(PP_Instance instance_id, PP_Flash_Clipboard_Type clipboard_type, uint32_t format) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Flash_Clipboard\""); + AddProp(ss, "__version", "\"5.1\""); + AddProp(ss, "__method", "\"ReadData\""); + AddProp(ss, "instance_id", ToString_PP_Instance(instance_id)); + AddProp(ss, "clipboard_type", ToString_PP_Flash_Clipboard_Type(clipboard_type)); + AddProp(ss, "format", ToString_uint32_t(format)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + struct PP_Var rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Var(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + struct PP_Var rval = ((PPB_Flash_Clipboard_5_1*)RealGetInterface("PPB_Flash_Clipboard;5.1"))->ReadData(instance_id, clipboard_type, format); + printf("RPC response: ["); + printf("%s", ToString_PP_Var(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t WriteData_5_1(PP_Instance instance_id, PP_Flash_Clipboard_Type clipboard_type, uint32_t data_item_count, const uint32_t formats[], const struct PP_Var data_items[]) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Flash_Clipboard\""); + AddProp(ss, "__version", "\"5.1\""); + AddProp(ss, "__method", "\"WriteData\""); + AddProp(ss, "instance_id", ToString_PP_Instance(instance_id)); + AddProp(ss, "clipboard_type", ToString_PP_Flash_Clipboard_Type(clipboard_type)); + AddProp(ss, "data_item_count", ToString_uint32_t(data_item_count)); + { + BeginProp(ss, "formats"); + BeginElements(ss); + for (uint32_t _n = 0; _n < data_item_count; ++_n) { + AddElement(ss, ToString_uint32_t(formats[_n])); + } + EndElements(ss); + } + { + BeginProp(ss, "data_items"); + BeginElements(ss); + for (uint32_t _n = 0; _n < data_item_count; ++_n) { + AddElement(ss, ToString_PP_Var(data_items[_n])); + } + EndElements(ss); + } + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_Flash_Clipboard_5_1*)RealGetInterface("PPB_Flash_Clipboard;5.1"))->WriteData(instance_id, clipboard_type, data_item_count, formats, data_items); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool GetSequenceNumber_5_1(PP_Instance instance_id, PP_Flash_Clipboard_Type clipboard_type, uint64_t* sequence_number) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Flash_Clipboard\""); + AddProp(ss, "__version", "\"5.1\""); + AddProp(ss, "__method", "\"GetSequenceNumber\""); + AddProp(ss, "instance_id", ToString_PP_Instance(instance_id)); + AddProp(ss, "clipboard_type", ToString_PP_Flash_Clipboard_Type(clipboard_type)); + AddProp(ss, "sequence_number", PointerToString(sequence_number)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + iterator.skip(); + FromJSON_uint64_t(iterator, *sequence_number); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_Flash_Clipboard_5_1*)RealGetInterface("PPB_Flash_Clipboard;5.1"))->GetSequenceNumber(instance_id, clipboard_type, sequence_number); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + if (!!sequence_number) { + AddProp(os, "sequence_number", ToString_uint64_t(sequence_number)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +} +static PPB_Flash_Clipboard_5_1 _PPB_Flash_Clipboard_5_1 = { + ns_PPB_Flash_Clipboard_5_1::RegisterCustomFormat_5_1, + ns_PPB_Flash_Clipboard_5_1::IsFormatAvailable_5_1, + ns_PPB_Flash_Clipboard_5_1::ReadData_5_1, + ns_PPB_Flash_Clipboard_5_1::WriteData_5_1, + ns_PPB_Flash_Clipboard_5_1::GetSequenceNumber_5_1, +}; +const string ToString_PPB_Flash_Clipboard(const PPB_Flash_Clipboard_5_1 *v) { + stringstream s; + s << v; + return s.str(); +} +namespace ns_PPB_Flash_DeviceID_1_0 { +static PP_Resource Create_1_0(PP_Instance instance) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Flash_DeviceID\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"Create\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Resource(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_Flash_DeviceID_1_0*)RealGetInterface("PPB_Flash_DeviceID;1.0"))->Create(instance); + printf("RPC response: ["); + printf("%s", ToString_PP_Resource(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t GetDeviceID_1_0(PP_Resource device_id, struct PP_Var* id, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Flash_DeviceID\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"GetDeviceID\""); + AddProp(ss, "device_id", ToString_PP_Resource(device_id)); + AddProp(ss, "id", PointerToString(id)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + iterator.skip(); + FromJSON_PP_Var(iterator, *id); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_Flash_DeviceID_1_0*)RealGetInterface("PPB_Flash_DeviceID;1.0"))->GetDeviceID(device_id, id, logging_callback); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_int32_t(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + if (!!id) { + AddProp(os, "id", ToString_PP_Var(id)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +} +static PPB_Flash_DeviceID_1_0 _PPB_Flash_DeviceID_1_0 = { + ns_PPB_Flash_DeviceID_1_0::Create_1_0, + ns_PPB_Flash_DeviceID_1_0::GetDeviceID_1_0, +}; +const string ToString_PPB_Flash_DeviceID(const PPB_Flash_DeviceID_1_0 *v) { + stringstream s; + s << v; + return s.str(); +} +namespace ns_PPB_Flash_DRM_1_0 { +static PP_Resource Create_1_0(PP_Instance instance) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Flash_DRM\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"Create\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Resource(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_Flash_DRM_1_0*)RealGetInterface("PPB_Flash_DRM;1.0"))->Create(instance); + printf("RPC response: ["); + printf("%s", ToString_PP_Resource(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t GetDeviceID_1_0(PP_Resource drm, struct PP_Var* id, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Flash_DRM\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"GetDeviceID\""); + AddProp(ss, "drm", ToString_PP_Resource(drm)); + AddProp(ss, "id", PointerToString(id)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + iterator.skip(); + FromJSON_PP_Var(iterator, *id); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_Flash_DRM_1_0*)RealGetInterface("PPB_Flash_DRM;1.0"))->GetDeviceID(drm, id, logging_callback); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_int32_t(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + if (!!id) { + AddProp(os, "id", ToString_PP_Var(id)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool GetHmonitor_1_0(PP_Resource drm, int64_t* hmonitor) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Flash_DRM\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"GetHmonitor\""); + AddProp(ss, "drm", ToString_PP_Resource(drm)); + AddProp(ss, "hmonitor", PointerToString(hmonitor)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + iterator.skip(); + FromJSON_int64_t(iterator, *hmonitor); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_Flash_DRM_1_0*)RealGetInterface("PPB_Flash_DRM;1.0"))->GetHmonitor(drm, hmonitor); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + if (!!hmonitor) { + AddProp(os, "hmonitor", ToString_int64_t(hmonitor)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t GetVoucherFile_1_0(PP_Resource drm, PP_Resource* file_ref, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Flash_DRM\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"GetVoucherFile\""); + AddProp(ss, "drm", ToString_PP_Resource(drm)); + AddProp(ss, "file_ref", PointerToString(file_ref)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + iterator.skip(); + FromJSON_PP_Resource(iterator, *file_ref); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_Flash_DRM_1_0*)RealGetInterface("PPB_Flash_DRM;1.0"))->GetVoucherFile(drm, file_ref, logging_callback); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_int32_t(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + if (!!file_ref) { + AddProp(os, "file_ref", ToString_PP_Resource(file_ref)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +/* skipping MonitorIsExternal */ +} +static PPB_Flash_DRM_1_0 _PPB_Flash_DRM_1_0 = { + ns_PPB_Flash_DRM_1_0::Create_1_0, + ns_PPB_Flash_DRM_1_0::GetDeviceID_1_0, + ns_PPB_Flash_DRM_1_0::GetHmonitor_1_0, + ns_PPB_Flash_DRM_1_0::GetVoucherFile_1_0, +}; +const string ToString_PPB_Flash_DRM(const PPB_Flash_DRM_1_0 *v) { + stringstream s; + s << v; + return s.str(); +} +namespace ns_PPB_Flash_DRM_1_1 { +static PP_Resource Create_1_1(PP_Instance instance) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Flash_DRM\""); + AddProp(ss, "__version", "\"1.1\""); + AddProp(ss, "__method", "\"Create\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Resource(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_Flash_DRM_1_1*)RealGetInterface("PPB_Flash_DRM;1.1"))->Create(instance); + printf("RPC response: ["); + printf("%s", ToString_PP_Resource(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t GetDeviceID_1_1(PP_Resource drm, struct PP_Var* id, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Flash_DRM\""); + AddProp(ss, "__version", "\"1.1\""); + AddProp(ss, "__method", "\"GetDeviceID\""); + AddProp(ss, "drm", ToString_PP_Resource(drm)); + AddProp(ss, "id", PointerToString(id)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + iterator.skip(); + FromJSON_PP_Var(iterator, *id); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_Flash_DRM_1_1*)RealGetInterface("PPB_Flash_DRM;1.1"))->GetDeviceID(drm, id, logging_callback); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_int32_t(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + if (!!id) { + AddProp(os, "id", ToString_PP_Var(id)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool GetHmonitor_1_1(PP_Resource drm, int64_t* hmonitor) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Flash_DRM\""); + AddProp(ss, "__version", "\"1.1\""); + AddProp(ss, "__method", "\"GetHmonitor\""); + AddProp(ss, "drm", ToString_PP_Resource(drm)); + AddProp(ss, "hmonitor", PointerToString(hmonitor)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + iterator.skip(); + FromJSON_int64_t(iterator, *hmonitor); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_Flash_DRM_1_1*)RealGetInterface("PPB_Flash_DRM;1.1"))->GetHmonitor(drm, hmonitor); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + if (!!hmonitor) { + AddProp(os, "hmonitor", ToString_int64_t(hmonitor)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t GetVoucherFile_1_1(PP_Resource drm, PP_Resource* file_ref, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Flash_DRM\""); + AddProp(ss, "__version", "\"1.1\""); + AddProp(ss, "__method", "\"GetVoucherFile\""); + AddProp(ss, "drm", ToString_PP_Resource(drm)); + AddProp(ss, "file_ref", PointerToString(file_ref)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + iterator.skip(); + FromJSON_PP_Resource(iterator, *file_ref); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_Flash_DRM_1_1*)RealGetInterface("PPB_Flash_DRM;1.1"))->GetVoucherFile(drm, file_ref, logging_callback); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_int32_t(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + if (!!file_ref) { + AddProp(os, "file_ref", ToString_PP_Resource(file_ref)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t MonitorIsExternal_1_1(PP_Resource drm, PP_Bool* is_external, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Flash_DRM\""); + AddProp(ss, "__version", "\"1.1\""); + AddProp(ss, "__method", "\"MonitorIsExternal\""); + AddProp(ss, "drm", ToString_PP_Resource(drm)); + AddProp(ss, "is_external", PointerToString(is_external)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + iterator.skip(); + FromJSON_PP_Bool(iterator, *is_external); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_Flash_DRM_1_1*)RealGetInterface("PPB_Flash_DRM;1.1"))->MonitorIsExternal(drm, is_external, logging_callback); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_int32_t(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + AddProp(os, "is_external", ToString_PP_Bool(is_external)); + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +} +static PPB_Flash_DRM_1_1 _PPB_Flash_DRM_1_1 = { + ns_PPB_Flash_DRM_1_1::Create_1_1, + ns_PPB_Flash_DRM_1_1::GetDeviceID_1_1, + ns_PPB_Flash_DRM_1_1::GetHmonitor_1_1, + ns_PPB_Flash_DRM_1_1::GetVoucherFile_1_1, + ns_PPB_Flash_DRM_1_1::MonitorIsExternal_1_1, +}; +const string ToString_PPB_Flash_DRM(const PPB_Flash_DRM_1_1 *v) { + stringstream s; + s << v; + return s.str(); +} +const string ToString_PP_DirEntry_Dev(const PP_DirEntry_Dev *v) { + if (!v) { + return "null"; + } + return ToString_PP_DirEntry_Dev(*v); +} +const string ToString_PP_DirEntry_Dev(const PP_DirEntry_Dev &v) { + stringstream x; + BeginProps(x); + AddProp(x, "name", ToString_str_t(v.name)); + AddProp(x, "is_dir", ToString_PP_Bool(v.is_dir)); + EndProps(x); + return x.str(); +} +void FromJSON_PP_DirEntry_Dev(JSONIterator& iterator, PP_DirEntry_Dev &value) { + const JSON::Token& current = iterator.getCurrentAndGotoNext(); + if (current.isPrimitive() && !current.value().compare("null")) { + return; + } + if (!current.isObject()) { + Fail("Expected object!", ""); + } + iterator.skip(); + FromJSON_str_t(iterator, value.name); + iterator.skip(); + FromJSON_PP_Bool(iterator, value.is_dir); +} +const string ToString_PP_DirContents_Dev(const PP_DirContents_Dev *v) { + if (!v) { + return "null"; + } + return ToString_PP_DirContents_Dev(*v); +} +const string ToString_PP_DirContents_Dev(const PP_DirContents_Dev &v) { + stringstream x; + BeginProps(x); + AddProp(x, "count", ToString_int32_t(v.count)); + { + BeginProp(x, "entries"); + BeginElements(x); + for (uint32_t _n = 0; _n < v.count; ++_n) { + AddElement(x, ToString_PP_DirEntry_Dev(v.entries[_n])); + } + EndElements(x); + } + EndProps(x); + return x.str(); +} +void FromJSON_PP_DirContents_Dev(JSONIterator& iterator, PP_DirContents_Dev &value) { + const JSON::Token& current = iterator.getCurrentAndGotoNext(); + if (current.isPrimitive() && !current.value().compare("null")) { + return; + } + if (!current.isObject()) { + Fail("Expected object!", ""); + } + iterator.skip(); + FromJSON_int32_t(iterator, value.count); + iterator.skip(); + + { + size_t children = iterator.expectArrayAndGotoFirstItem(); + if (children > value.count) { + Fail("Too many items in array\n", ""); + } + for (uint32_t _n = 0; _n < children; ++_n) { + FromJSON_PP_DirEntry_Dev(iterator, (value.entries)[_n]); + } + // FIXME Null out remaining items? + } +} +namespace ns_PPB_Flash_File_ModuleLocal_3_0 { +static PP_Bool CreateThreadAdapterForInstance_3_0(PP_Instance instance) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Flash_File_ModuleLocal\""); + AddProp(ss, "__version", "\"3.0\""); + AddProp(ss, "__method", "\"CreateThreadAdapterForInstance\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_Flash_File_ModuleLocal_3_0*)RealGetInterface("PPB_Flash_File_ModuleLocal;3.0"))->CreateThreadAdapterForInstance(instance); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static void ClearThreadAdapterForInstance_3_0(PP_Instance instance) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Flash_File_ModuleLocal\""); + AddProp(ss, "__version", "\"3.0\""); + AddProp(ss, "__method", "\"ClearThreadAdapterForInstance\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_Flash_File_ModuleLocal_3_0*)RealGetInterface("PPB_Flash_File_ModuleLocal;3.0"))->ClearThreadAdapterForInstance(instance); +#endif // !INTERPOSE +} +static int32_t OpenFile_3_0(PP_Instance instance, const char* path, int32_t mode, PP_FileHandle* file) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Flash_File_ModuleLocal\""); + AddProp(ss, "__version", "\"3.0\""); + AddProp(ss, "__method", "\"OpenFile\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "path", ToString_str_t(path)); + AddProp(ss, "mode", ToString_int32_t(mode)); + AddProp(ss, "file", PointerToString(file)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + iterator.skip(); + FromJSON_PP_FileHandle(iterator, *file); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_Flash_File_ModuleLocal_3_0*)RealGetInterface("PPB_Flash_File_ModuleLocal;3.0"))->OpenFile(instance, path, mode, file); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_int32_t(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + if (!!file) { + AddProp(os, "file", ToString_PP_FileHandle(file)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t RenameFile_3_0(PP_Instance instance, const char* path_from, const char* path_to) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Flash_File_ModuleLocal\""); + AddProp(ss, "__version", "\"3.0\""); + AddProp(ss, "__method", "\"RenameFile\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "path_from", ToString_str_t(path_from)); + AddProp(ss, "path_to", ToString_str_t(path_to)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_Flash_File_ModuleLocal_3_0*)RealGetInterface("PPB_Flash_File_ModuleLocal;3.0"))->RenameFile(instance, path_from, path_to); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t DeleteFileOrDir_3_0(PP_Instance instance, const char* path, PP_Bool recursive) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Flash_File_ModuleLocal\""); + AddProp(ss, "__version", "\"3.0\""); + AddProp(ss, "__method", "\"DeleteFileOrDir\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "path", ToString_str_t(path)); + AddProp(ss, "recursive", ToString_PP_Bool(recursive)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_Flash_File_ModuleLocal_3_0*)RealGetInterface("PPB_Flash_File_ModuleLocal;3.0"))->DeleteFileOrDir(instance, path, recursive); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t CreateDir_3_0(PP_Instance instance, const char* path) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Flash_File_ModuleLocal\""); + AddProp(ss, "__version", "\"3.0\""); + AddProp(ss, "__method", "\"CreateDir\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "path", ToString_str_t(path)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_Flash_File_ModuleLocal_3_0*)RealGetInterface("PPB_Flash_File_ModuleLocal;3.0"))->CreateDir(instance, path); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t QueryFile_3_0(PP_Instance instance, const char* path, struct PP_FileInfo* info) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Flash_File_ModuleLocal\""); + AddProp(ss, "__version", "\"3.0\""); + AddProp(ss, "__method", "\"QueryFile\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "path", ToString_str_t(path)); + AddProp(ss, "info", PointerToString(info)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + if (!!info) { + iterator.skip(); + FromJSON_PP_FileInfo(iterator, *info); + } + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_Flash_File_ModuleLocal_3_0*)RealGetInterface("PPB_Flash_File_ModuleLocal;3.0"))->QueryFile(instance, path, info); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_int32_t(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + if (!!info) { + AddProp(os, "info", ToString_PP_FileInfo(info)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t GetDirContents_3_0(PP_Instance instance, const char* path, struct PP_DirContents_Dev** contents) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Flash_File_ModuleLocal\""); + AddProp(ss, "__version", "\"3.0\""); + AddProp(ss, "__method", "\"GetDirContents\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "path", ToString_str_t(path)); + AddProp(ss, "contents", PointerToString(contents)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + if (!!contents) { + iterator.skip(); + FromJSON_PP_DirContents_Dev(iterator, *contents); + } + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_Flash_File_ModuleLocal_3_0*)RealGetInterface("PPB_Flash_File_ModuleLocal;3.0"))->GetDirContents(instance, path, contents); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_int32_t(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + if (!!contents) { + AddProp(os, "contents", ToString_PP_DirContents_Dev(contents)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static void FreeDirContents_3_0(PP_Instance instance, const struct PP_DirContents_Dev* contents) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Flash_File_ModuleLocal\""); + AddProp(ss, "__version", "\"3.0\""); + AddProp(ss, "__method", "\"FreeDirContents\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "contents", ToString_PP_DirContents_Dev(contents)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_Flash_File_ModuleLocal_3_0*)RealGetInterface("PPB_Flash_File_ModuleLocal;3.0"))->FreeDirContents(instance, contents); +#endif // !INTERPOSE +} +static int32_t CreateTemporaryFile_3_0(PP_Instance instance, PP_FileHandle* file) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Flash_File_ModuleLocal\""); + AddProp(ss, "__version", "\"3.0\""); + AddProp(ss, "__method", "\"CreateTemporaryFile\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "file", PointerToString(file)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + iterator.skip(); + FromJSON_PP_FileHandle(iterator, *file); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_Flash_File_ModuleLocal_3_0*)RealGetInterface("PPB_Flash_File_ModuleLocal;3.0"))->CreateTemporaryFile(instance, file); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_int32_t(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + if (!!file) { + AddProp(os, "file", ToString_PP_FileHandle(file)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +} +static PPB_Flash_File_ModuleLocal_3_0 _PPB_Flash_File_ModuleLocal_3_0 = { + ns_PPB_Flash_File_ModuleLocal_3_0::CreateThreadAdapterForInstance_3_0, + ns_PPB_Flash_File_ModuleLocal_3_0::ClearThreadAdapterForInstance_3_0, + ns_PPB_Flash_File_ModuleLocal_3_0::OpenFile_3_0, + ns_PPB_Flash_File_ModuleLocal_3_0::RenameFile_3_0, + ns_PPB_Flash_File_ModuleLocal_3_0::DeleteFileOrDir_3_0, + ns_PPB_Flash_File_ModuleLocal_3_0::CreateDir_3_0, + ns_PPB_Flash_File_ModuleLocal_3_0::QueryFile_3_0, + ns_PPB_Flash_File_ModuleLocal_3_0::GetDirContents_3_0, + ns_PPB_Flash_File_ModuleLocal_3_0::FreeDirContents_3_0, + ns_PPB_Flash_File_ModuleLocal_3_0::CreateTemporaryFile_3_0, +}; +const string ToString_PPB_Flash_File_ModuleLocal(const PPB_Flash_File_ModuleLocal_3_0 *v) { + stringstream s; + s << v; + return s.str(); +} +namespace ns_PPB_Flash_File_FileRef_2_0 { +static int32_t OpenFile_2_0(PP_Resource file_ref_id, int32_t mode, PP_FileHandle* file) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Flash_File_FileRef\""); + AddProp(ss, "__version", "\"2.0\""); + AddProp(ss, "__method", "\"OpenFile\""); + AddProp(ss, "file_ref_id", ToString_PP_Resource(file_ref_id)); + AddProp(ss, "mode", ToString_int32_t(mode)); + AddProp(ss, "file", PointerToString(file)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + iterator.skip(); + FromJSON_PP_FileHandle(iterator, *file); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_Flash_File_FileRef_2_0*)RealGetInterface("PPB_Flash_File_FileRef;2.0"))->OpenFile(file_ref_id, mode, file); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_int32_t(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + if (!!file) { + AddProp(os, "file", ToString_PP_FileHandle(file)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t QueryFile_2_0(PP_Resource file_ref_id, struct PP_FileInfo* info) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Flash_File_FileRef\""); + AddProp(ss, "__version", "\"2.0\""); + AddProp(ss, "__method", "\"QueryFile\""); + AddProp(ss, "file_ref_id", ToString_PP_Resource(file_ref_id)); + AddProp(ss, "info", PointerToString(info)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + if (!!info) { + iterator.skip(); + FromJSON_PP_FileInfo(iterator, *info); + } + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_Flash_File_FileRef_2_0*)RealGetInterface("PPB_Flash_File_FileRef;2.0"))->QueryFile(file_ref_id, info); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_int32_t(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + if (!!info) { + AddProp(os, "info", ToString_PP_FileInfo(info)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +} +static PPB_Flash_File_FileRef_2_0 _PPB_Flash_File_FileRef_2_0 = { + ns_PPB_Flash_File_FileRef_2_0::OpenFile_2_0, + ns_PPB_Flash_File_FileRef_2_0::QueryFile_2_0, +}; +const string ToString_PPB_Flash_File_FileRef(const PPB_Flash_File_FileRef_2_0 *v) { + stringstream s; + s << v; + return s.str(); +} +namespace ns_PPB_Flash_FontFile_0_1 { +static PP_Resource Create_0_1(PP_Instance instance, const struct PP_BrowserFont_Trusted_Description* description, PP_PrivateFontCharset charset) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Flash_FontFile\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"Create\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "description", ToString_PP_BrowserFont_Trusted_Description(description)); + AddProp(ss, "charset", ToString_PP_PrivateFontCharset(charset)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Resource(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_Flash_FontFile_0_1*)RealGetInterface("PPB_Flash_FontFile;0.1"))->Create(instance, description, charset); + printf("RPC response: ["); + printf("%s", ToString_PP_Resource(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool IsFlashFontFile_0_1(PP_Resource resource) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Flash_FontFile\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"IsFlashFontFile\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_Flash_FontFile_0_1*)RealGetInterface("PPB_Flash_FontFile;0.1"))->IsFlashFontFile(resource); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool GetFontTable_0_1(PP_Resource font_file, uint32_t table, void* output, uint32_t* output_length) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Flash_FontFile\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"GetFontTable\""); + AddProp(ss, "font_file", ToString_PP_Resource(font_file)); + AddProp(ss, "table", ToString_uint32_t(table)); + AddProp(ss, "output", PointerToString(output)); + AddProp(ss, "output_length", PointerToString(output_length)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + iterator.skip(); + FromJSON_mem_t(iterator, output); + iterator.skip(); + FromJSON_uint32_t(iterator, *output_length); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_Flash_FontFile_0_1*)RealGetInterface("PPB_Flash_FontFile;0.1"))->GetFontTable(font_file, table, output, output_length); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + AddProp(os, "output", ToString_mem_t(output)); + if (!!output_length) { + AddProp(os, "output_length", ToString_uint32_t(output_length)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +/* skipping IsSupportedForWindows */ +} +static PPB_Flash_FontFile_0_1 _PPB_Flash_FontFile_0_1 = { + ns_PPB_Flash_FontFile_0_1::Create_0_1, + ns_PPB_Flash_FontFile_0_1::IsFlashFontFile_0_1, + ns_PPB_Flash_FontFile_0_1::GetFontTable_0_1, +}; +const string ToString_PPB_Flash_FontFile(const PPB_Flash_FontFile_0_1 *v) { + stringstream s; + s << v; + return s.str(); +} +namespace ns_PPB_Flash_FontFile_0_2 { +static PP_Resource Create_0_2(PP_Instance instance, const struct PP_BrowserFont_Trusted_Description* description, PP_PrivateFontCharset charset) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Flash_FontFile\""); + AddProp(ss, "__version", "\"0.2\""); + AddProp(ss, "__method", "\"Create\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "description", ToString_PP_BrowserFont_Trusted_Description(description)); + AddProp(ss, "charset", ToString_PP_PrivateFontCharset(charset)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Resource(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_Flash_FontFile_0_2*)RealGetInterface("PPB_Flash_FontFile;0.2"))->Create(instance, description, charset); + printf("RPC response: ["); + printf("%s", ToString_PP_Resource(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool IsFlashFontFile_0_2(PP_Resource resource) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Flash_FontFile\""); + AddProp(ss, "__version", "\"0.2\""); + AddProp(ss, "__method", "\"IsFlashFontFile\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_Flash_FontFile_0_2*)RealGetInterface("PPB_Flash_FontFile;0.2"))->IsFlashFontFile(resource); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool GetFontTable_0_2(PP_Resource font_file, uint32_t table, void* output, uint32_t* output_length) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Flash_FontFile\""); + AddProp(ss, "__version", "\"0.2\""); + AddProp(ss, "__method", "\"GetFontTable\""); + AddProp(ss, "font_file", ToString_PP_Resource(font_file)); + AddProp(ss, "table", ToString_uint32_t(table)); + AddProp(ss, "output", PointerToString(output)); + AddProp(ss, "output_length", PointerToString(output_length)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + iterator.skip(); + FromJSON_mem_t(iterator, output); + iterator.skip(); + FromJSON_uint32_t(iterator, *output_length); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_Flash_FontFile_0_2*)RealGetInterface("PPB_Flash_FontFile;0.2"))->GetFontTable(font_file, table, output, output_length); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + AddProp(os, "output", ToString_mem_t(output)); + if (!!output_length) { + AddProp(os, "output_length", ToString_uint32_t(output_length)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool IsSupportedForWindows_0_2(void) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Flash_FontFile\""); + AddProp(ss, "__version", "\"0.2\""); + AddProp(ss, "__method", "\"IsSupportedForWindows\""); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_Flash_FontFile_0_2*)RealGetInterface("PPB_Flash_FontFile;0.2"))->IsSupportedForWindows(); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +} +static PPB_Flash_FontFile_0_2 _PPB_Flash_FontFile_0_2 = { + ns_PPB_Flash_FontFile_0_2::Create_0_2, + ns_PPB_Flash_FontFile_0_2::IsFlashFontFile_0_2, + ns_PPB_Flash_FontFile_0_2::GetFontTable_0_2, + ns_PPB_Flash_FontFile_0_2::IsSupportedForWindows_0_2, +}; +const string ToString_PPB_Flash_FontFile(const PPB_Flash_FontFile_0_2 *v) { + stringstream s; + s << v; + return s.str(); +} +namespace ns_PPB_FlashFullscreen_0_1 { +static PP_Bool IsFullscreen_0_1(PP_Instance instance) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_FlashFullscreen\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"IsFullscreen\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_FlashFullscreen_0_1*)RealGetInterface("PPB_FlashFullscreen;0.1"))->IsFullscreen(instance); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool SetFullscreen_0_1(PP_Instance instance, PP_Bool fullscreen) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_FlashFullscreen\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"SetFullscreen\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "fullscreen", ToString_PP_Bool(fullscreen)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_FlashFullscreen_0_1*)RealGetInterface("PPB_FlashFullscreen;0.1"))->SetFullscreen(instance, fullscreen); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +/* skipping SetFullscreen */ +static PP_Bool GetScreenSize_0_1(PP_Instance instance, struct PP_Size* size) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_FlashFullscreen\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"GetScreenSize\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "size", PointerToString(size)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + if (!!size) { + iterator.skip(); + FromJSON_PP_Size(iterator, *size); + } + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_FlashFullscreen_0_1*)RealGetInterface("PPB_FlashFullscreen;0.1"))->GetScreenSize(instance, size); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + if (!!size) { + AddProp(os, "size", ToString_PP_Size(size)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +} +static PPB_FlashFullscreen_0_1 _PPB_FlashFullscreen_0_1 = { + ns_PPB_FlashFullscreen_0_1::IsFullscreen_0_1, + ns_PPB_FlashFullscreen_0_1::SetFullscreen_0_1, + ns_PPB_FlashFullscreen_0_1::GetScreenSize_0_1, +}; +const string ToString_PPB_FlashFullscreen(const PPB_FlashFullscreen_0_1 *v) { + stringstream s; + s << v; + return s.str(); +} +namespace ns_PPB_FlashFullscreen_1_0 { +static PP_Bool IsFullscreen_1_0(PP_Instance instance) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_FlashFullscreen\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"IsFullscreen\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_FlashFullscreen_1_0*)RealGetInterface("PPB_FlashFullscreen;1.0"))->IsFullscreen(instance); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +/* skipping SetFullscreen */ +static PP_Bool SetFullscreen_1_0(PP_Instance instance, PP_Bool fullscreen) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_FlashFullscreen\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"SetFullscreen\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "fullscreen", ToString_PP_Bool(fullscreen)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_FlashFullscreen_1_0*)RealGetInterface("PPB_FlashFullscreen;1.0"))->SetFullscreen(instance, fullscreen); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool GetScreenSize_1_0(PP_Instance instance, struct PP_Size* size) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_FlashFullscreen\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"GetScreenSize\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "size", PointerToString(size)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + if (!!size) { + iterator.skip(); + FromJSON_PP_Size(iterator, *size); + } + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_FlashFullscreen_1_0*)RealGetInterface("PPB_FlashFullscreen;1.0"))->GetScreenSize(instance, size); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + if (!!size) { + AddProp(os, "size", ToString_PP_Size(size)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +} +static PPB_FlashFullscreen_1_0 _PPB_FlashFullscreen_1_0 = { + ns_PPB_FlashFullscreen_1_0::IsFullscreen_1_0, + ns_PPB_FlashFullscreen_1_0::SetFullscreen_1_0, + ns_PPB_FlashFullscreen_1_0::GetScreenSize_1_0, +}; +const string ToString_PPB_FlashFullscreen(const PPB_FlashFullscreen_1_0 *v) { + stringstream s; + s << v; + return s.str(); +} +const string ToString_PP_Flash_MenuItem_Type(const PP_Flash_MenuItem_Type *v) { + switch (*v) { + case 0: + return "\"PP_FLASH_MENUITEM_TYPE_NORMAL\""; + case 1: + return "\"PP_FLASH_MENUITEM_TYPE_CHECKBOX\""; + case 2: + return "\"PP_FLASH_MENUITEM_TYPE_SEPARATOR\""; + case 3: + return "\"PP_FLASH_MENUITEM_TYPE_SUBMENU\""; + default: + return "\"???\""; + } +} +const string ToString_PP_Flash_MenuItem_Type(const PP_Flash_MenuItem_Type &v) { + return ToString_PP_Flash_MenuItem_Type(&v); +} +void FromJSON_PP_Flash_MenuItem_Type(JSONIterator& iterator, PP_Flash_MenuItem_Type &value) { + long int v; + FromJSON_int(iterator, v); + value = PP_Flash_MenuItem_Type(v); +} +const string ToString_PP_Flash_MenuItem(const PP_Flash_MenuItem *v) { + if (!v) { + return "null"; + } + return ToString_PP_Flash_MenuItem(*v); +} +const string ToString_PP_Flash_MenuItem(const PP_Flash_MenuItem &v) { + stringstream x; + BeginProps(x); + AddProp(x, "type", ToString_PP_Flash_MenuItem_Type(v.type)); + AddProp(x, "name", ToString_str_t(v.name)); + AddProp(x, "id", ToString_int32_t(v.id)); + AddProp(x, "enabled", ToString_PP_Bool(v.enabled)); + AddProp(x, "checked", ToString_PP_Bool(v.checked)); + AddProp(x, "submenu", ToString_PP_Flash_Menu(v.submenu)); + EndProps(x); + return x.str(); +} +void FromJSON_PP_Flash_MenuItem(JSONIterator& iterator, PP_Flash_MenuItem &value) { + const JSON::Token& current = iterator.getCurrentAndGotoNext(); + if (current.isPrimitive() && !current.value().compare("null")) { + return; + } + if (!current.isObject()) { + Fail("Expected object!", ""); + } + iterator.skip(); + FromJSON_PP_Flash_MenuItem_Type(iterator, value.type); + iterator.skip(); + FromJSON_str_t(iterator, value.name); + iterator.skip(); + FromJSON_int32_t(iterator, value.id); + iterator.skip(); + FromJSON_PP_Bool(iterator, value.enabled); + iterator.skip(); + FromJSON_PP_Bool(iterator, value.checked); + iterator.skip(); + FromJSON_PP_Flash_Menu(iterator, value.submenu); +} +const string ToString_PP_Flash_Menu(const PP_Flash_Menu *v) { + if (!v) { + return "null"; + } + return ToString_PP_Flash_Menu(*v); +} +const string ToString_PP_Flash_Menu(const PP_Flash_Menu &v) { + stringstream x; + BeginProps(x); + AddProp(x, "count", ToString_uint32_t(v.count)); + { + BeginProp(x, "items"); + BeginElements(x); + for (uint32_t _n = 0; _n < v.count; ++_n) { + AddElement(x, ToString_PP_Flash_MenuItem(v.items[_n])); + } + EndElements(x); + } + EndProps(x); + return x.str(); +} +void FromJSON_PP_Flash_Menu(JSONIterator& iterator, PP_Flash_Menu &value) { + const JSON::Token& current = iterator.getCurrentAndGotoNext(); + if (current.isPrimitive() && !current.value().compare("null")) { + return; + } + if (!current.isObject()) { + Fail("Expected object!", ""); + } + iterator.skip(); + FromJSON_uint32_t(iterator, value.count); + iterator.skip(); + + { + size_t children = iterator.expectArrayAndGotoFirstItem(); + if (children > value.count) { + Fail("Too many items in array\n", ""); + } + for (uint32_t _n = 0; _n < children; ++_n) { + FromJSON_PP_Flash_MenuItem(iterator, (value.items)[_n]); + } + // FIXME Null out remaining items? + } +} +namespace ns_PPB_Flash_Menu_0_2 { +static PP_Resource Create_0_2(PP_Instance instance_id, const struct PP_Flash_Menu* menu_data) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Flash_Menu\""); + AddProp(ss, "__version", "\"0.2\""); + AddProp(ss, "__method", "\"Create\""); + AddProp(ss, "instance_id", ToString_PP_Instance(instance_id)); + AddProp(ss, "menu_data", ToString_PP_Flash_Menu(menu_data)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Resource(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_Flash_Menu_0_2*)RealGetInterface("PPB_Flash_Menu;0.2"))->Create(instance_id, menu_data); + printf("RPC response: ["); + printf("%s", ToString_PP_Resource(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool IsFlashMenu_0_2(PP_Resource resource_id) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Flash_Menu\""); + AddProp(ss, "__version", "\"0.2\""); + AddProp(ss, "__method", "\"IsFlashMenu\""); + AddProp(ss, "resource_id", ToString_PP_Resource(resource_id)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_Flash_Menu_0_2*)RealGetInterface("PPB_Flash_Menu;0.2"))->IsFlashMenu(resource_id); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t Show_0_2(PP_Resource menu_id, const struct PP_Point* location, int32_t* selected_id, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Flash_Menu\""); + AddProp(ss, "__version", "\"0.2\""); + AddProp(ss, "__method", "\"Show\""); + AddProp(ss, "menu_id", ToString_PP_Resource(menu_id)); + AddProp(ss, "location", ToString_PP_Point(location)); + AddProp(ss, "selected_id", PointerToString(selected_id)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + iterator.skip(); + FromJSON_int32_t(iterator, *selected_id); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_Flash_Menu_0_2*)RealGetInterface("PPB_Flash_Menu;0.2"))->Show(menu_id, location, selected_id, logging_callback); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_int32_t(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + if (!!selected_id) { + AddProp(os, "selected_id", ToString_int32_t(selected_id)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +} +static PPB_Flash_Menu_0_2 _PPB_Flash_Menu_0_2 = { + ns_PPB_Flash_Menu_0_2::Create_0_2, + ns_PPB_Flash_Menu_0_2::IsFlashMenu_0_2, + ns_PPB_Flash_Menu_0_2::Show_0_2, +}; +const string ToString_PPB_Flash_Menu(const PPB_Flash_Menu_0_2 *v) { + stringstream s; + s << v; + return s.str(); +} +namespace ns_PPB_Flash_MessageLoop_0_1 { +static PP_Resource Create_0_1(PP_Instance instance) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Flash_MessageLoop\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"Create\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Resource(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_Flash_MessageLoop_0_1*)RealGetInterface("PPB_Flash_MessageLoop;0.1"))->Create(instance); + printf("RPC response: ["); + printf("%s", ToString_PP_Resource(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool IsFlashMessageLoop_0_1(PP_Resource resource) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Flash_MessageLoop\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"IsFlashMessageLoop\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_Flash_MessageLoop_0_1*)RealGetInterface("PPB_Flash_MessageLoop;0.1"))->IsFlashMessageLoop(resource); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t Run_0_1(PP_Resource flash_message_loop) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Flash_MessageLoop\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"Run\""); + AddProp(ss, "flash_message_loop", ToString_PP_Resource(flash_message_loop)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_Flash_MessageLoop_0_1*)RealGetInterface("PPB_Flash_MessageLoop;0.1"))->Run(flash_message_loop); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static void Quit_0_1(PP_Resource flash_message_loop) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Flash_MessageLoop\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"Quit\""); + AddProp(ss, "flash_message_loop", ToString_PP_Resource(flash_message_loop)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_Flash_MessageLoop_0_1*)RealGetInterface("PPB_Flash_MessageLoop;0.1"))->Quit(flash_message_loop); +#endif // !INTERPOSE +} +} +static PPB_Flash_MessageLoop_0_1 _PPB_Flash_MessageLoop_0_1 = { + ns_PPB_Flash_MessageLoop_0_1::Create_0_1, + ns_PPB_Flash_MessageLoop_0_1::IsFlashMessageLoop_0_1, + ns_PPB_Flash_MessageLoop_0_1::Run_0_1, + ns_PPB_Flash_MessageLoop_0_1::Quit_0_1, +}; +const string ToString_PPB_Flash_MessageLoop(const PPB_Flash_MessageLoop_0_1 *v) { + stringstream s; + s << v; + return s.str(); +} +namespace ns_PPB_Flash_Print_1_0 { +static void InvokePrinting_1_0(PP_Instance instance) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Flash_Print\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"InvokePrinting\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_Flash_Print_1_0*)RealGetInterface("PPB_Flash_Print;1.0"))->InvokePrinting(instance); +#endif // !INTERPOSE +} +} +static PPB_Flash_Print_1_0 _PPB_Flash_Print_1_0 = { + ns_PPB_Flash_Print_1_0::InvokePrinting_1_0, +}; +const string ToString_PPB_Flash_Print(const PPB_Flash_Print_1_0 *v) { + stringstream s; + s << v; + return s.str(); +} +const string ToString_PP_HostResolver_Private_Flags(const PP_HostResolver_Private_Flags *v) { + switch (*v) { + case 1 << 0: + return "\"PP_HOST_RESOLVER_PRIVATE_FLAGS_CANONNAME\""; + case 1 << 1: + return "\"PP_HOST_RESOLVER_PRIVATE_FLAGS_LOOPBACK_ONLY\""; + default: + return "\"???\""; + } +} +const string ToString_PP_HostResolver_Private_Flags(const PP_HostResolver_Private_Flags &v) { + return ToString_PP_HostResolver_Private_Flags(&v); +} +void FromJSON_PP_HostResolver_Private_Flags(JSONIterator& iterator, PP_HostResolver_Private_Flags &value) { + long int v; + FromJSON_int(iterator, v); + value = PP_HostResolver_Private_Flags(v); +} +const string ToString_PP_HostResolver_Private_Hint(const PP_HostResolver_Private_Hint *v) { + if (!v) { + return "null"; + } + return ToString_PP_HostResolver_Private_Hint(*v); +} +const string ToString_PP_HostResolver_Private_Hint(const PP_HostResolver_Private_Hint &v) { + stringstream x; + BeginProps(x); + AddProp(x, "family", ToString_PP_NetAddressFamily_Private(v.family)); + AddProp(x, "flags", ToString_int32_t(v.flags)); + EndProps(x); + return x.str(); +} +void FromJSON_PP_HostResolver_Private_Hint(JSONIterator& iterator, PP_HostResolver_Private_Hint &value) { + const JSON::Token& current = iterator.getCurrentAndGotoNext(); + if (current.isPrimitive() && !current.value().compare("null")) { + return; + } + if (!current.isObject()) { + Fail("Expected object!", ""); + } + iterator.skip(); + FromJSON_PP_NetAddressFamily_Private(iterator, value.family); + iterator.skip(); + FromJSON_int32_t(iterator, value.flags); +} +namespace ns_PPB_HostResolver_Private_0_1 { +static PP_Resource Create_0_1(PP_Instance instance) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_HostResolver_Private\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"Create\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Resource(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_HostResolver_Private_0_1*)RealGetInterface("PPB_HostResolver_Private;0.1"))->Create(instance); + printf("RPC response: ["); + printf("%s", ToString_PP_Resource(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool IsHostResolver_0_1(PP_Resource resource) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_HostResolver_Private\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"IsHostResolver\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_HostResolver_Private_0_1*)RealGetInterface("PPB_HostResolver_Private;0.1"))->IsHostResolver(resource); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t Resolve_0_1(PP_Resource host_resolver, const char* host, uint16_t port, const struct PP_HostResolver_Private_Hint* hint, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_HostResolver_Private\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"Resolve\""); + AddProp(ss, "host_resolver", ToString_PP_Resource(host_resolver)); + AddProp(ss, "host", ToString_str_t(host)); + AddProp(ss, "port", ToString_uint16_t(port)); + AddProp(ss, "hint", ToString_PP_HostResolver_Private_Hint(hint)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_HostResolver_Private_0_1*)RealGetInterface("PPB_HostResolver_Private;0.1"))->Resolve(host_resolver, host, port, hint, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static struct PP_Var GetCanonicalName_0_1(PP_Resource host_resolver) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_HostResolver_Private\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"GetCanonicalName\""); + AddProp(ss, "host_resolver", ToString_PP_Resource(host_resolver)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + struct PP_Var rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Var(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + struct PP_Var rval = ((PPB_HostResolver_Private_0_1*)RealGetInterface("PPB_HostResolver_Private;0.1"))->GetCanonicalName(host_resolver); + printf("RPC response: ["); + printf("%s", ToString_PP_Var(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static uint32_t GetSize_0_1(PP_Resource host_resolver) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_HostResolver_Private\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"GetSize\""); + AddProp(ss, "host_resolver", ToString_PP_Resource(host_resolver)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + uint32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_uint32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + uint32_t rval = ((PPB_HostResolver_Private_0_1*)RealGetInterface("PPB_HostResolver_Private;0.1"))->GetSize(host_resolver); + printf("RPC response: ["); + printf("%s", ToString_uint32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool GetNetAddress_0_1(PP_Resource host_resolver, uint32_t index, struct PP_NetAddress_Private* addr) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_HostResolver_Private\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"GetNetAddress\""); + AddProp(ss, "host_resolver", ToString_PP_Resource(host_resolver)); + AddProp(ss, "index", ToString_uint32_t(index)); + AddProp(ss, "addr", PointerToString(addr)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + if (!!addr) { + iterator.skip(); + FromJSON_PP_NetAddress_Private(iterator, *addr); + } + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_HostResolver_Private_0_1*)RealGetInterface("PPB_HostResolver_Private;0.1"))->GetNetAddress(host_resolver, index, addr); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + if (!!addr) { + AddProp(os, "addr", ToString_PP_NetAddress_Private(addr)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +} +static PPB_HostResolver_Private_0_1 _PPB_HostResolver_Private_0_1 = { + ns_PPB_HostResolver_Private_0_1::Create_0_1, + ns_PPB_HostResolver_Private_0_1::IsHostResolver_0_1, + ns_PPB_HostResolver_Private_0_1::Resolve_0_1, + ns_PPB_HostResolver_Private_0_1::GetCanonicalName_0_1, + ns_PPB_HostResolver_Private_0_1::GetSize_0_1, + ns_PPB_HostResolver_Private_0_1::GetNetAddress_0_1, +}; +const string ToString_PPB_HostResolver_Private(const PPB_HostResolver_Private_0_1 *v) { + stringstream s; + s << v; + return s.str(); +} +const string ToString_PP_ExternalPluginResult(const PP_ExternalPluginResult *v) { + switch (*v) { + case 0: + return "\"PP_EXTERNAL_PLUGIN_OK\""; + case 1: + return "\"PP_EXTERNAL_PLUGIN_FAILED\""; + case 2: + return "\"PP_EXTERNAL_PLUGIN_ERROR_MODULE\""; + case 3: + return "\"PP_EXTERNAL_PLUGIN_ERROR_INSTANCE\""; + default: + return "\"???\""; + } +} +const string ToString_PP_ExternalPluginResult(const PP_ExternalPluginResult &v) { + return ToString_PP_ExternalPluginResult(&v); +} +void FromJSON_PP_ExternalPluginResult(JSONIterator& iterator, PP_ExternalPluginResult &value) { + long int v; + FromJSON_int(iterator, v); + value = PP_ExternalPluginResult(v); +} +namespace ns_PPB_Instance_Private_0_1 { +static struct PP_Var GetWindowObject_0_1(PP_Instance instance) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Instance_Private\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"GetWindowObject\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + struct PP_Var rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Var(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + struct PP_Var rval = ((PPB_Instance_Private_0_1*)RealGetInterface("PPB_Instance_Private;0.1"))->GetWindowObject(instance); + printf("RPC response: ["); + printf("%s", ToString_PP_Var(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static struct PP_Var GetOwnerElementObject_0_1(PP_Instance instance) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Instance_Private\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"GetOwnerElementObject\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + struct PP_Var rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Var(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + struct PP_Var rval = ((PPB_Instance_Private_0_1*)RealGetInterface("PPB_Instance_Private;0.1"))->GetOwnerElementObject(instance); + printf("RPC response: ["); + printf("%s", ToString_PP_Var(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static struct PP_Var ExecuteScript_0_1(PP_Instance instance, struct PP_Var script, struct PP_Var* exception) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Instance_Private\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"ExecuteScript\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "script", ToString_PP_Var(script)); + AddProp(ss, "exception", PointerToString(exception)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + struct PP_Var rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Var(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + iterator.skip(); + FromJSON_PP_Var(iterator, *exception); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + struct PP_Var rval = ((PPB_Instance_Private_0_1*)RealGetInterface("PPB_Instance_Private;0.1"))->ExecuteScript(instance, script, exception); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_PP_Var(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + if (!!exception) { + AddProp(os, "exception", ToString_PP_Var(exception)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +} +static PPB_Instance_Private_0_1 _PPB_Instance_Private_0_1 = { + ns_PPB_Instance_Private_0_1::GetWindowObject_0_1, + ns_PPB_Instance_Private_0_1::GetOwnerElementObject_0_1, + ns_PPB_Instance_Private_0_1::ExecuteScript_0_1, +}; +const string ToString_PPB_Instance_Private(const PPB_Instance_Private_0_1 *v) { + stringstream s; + s << v; + return s.str(); +} +const string ToString_PP_IsolatedFileSystemType_Private(const PP_IsolatedFileSystemType_Private *v) { + switch (*v) { + case 0: + return "\"PP_ISOLATEDFILESYSTEMTYPE_PRIVATE_INVALID\""; + case 1: + return "\"PP_ISOLATEDFILESYSTEMTYPE_PRIVATE_CRX\""; + case 2: + return "\"PP_ISOLATEDFILESYSTEMTYPE_PRIVATE_PLUGINPRIVATE\""; + default: + return "\"???\""; + } +} +const string ToString_PP_IsolatedFileSystemType_Private(const PP_IsolatedFileSystemType_Private &v) { + return ToString_PP_IsolatedFileSystemType_Private(&v); +} +void FromJSON_PP_IsolatedFileSystemType_Private(JSONIterator& iterator, PP_IsolatedFileSystemType_Private &value) { + long int v; + FromJSON_int(iterator, v); + value = PP_IsolatedFileSystemType_Private(v); +} +namespace ns_PPB_IsolatedFileSystem_Private_0_2 { +static int32_t Open_0_2(PP_Instance instance, PP_IsolatedFileSystemType_Private type, PP_Resource* file_system, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_IsolatedFileSystem_Private\""); + AddProp(ss, "__version", "\"0.2\""); + AddProp(ss, "__method", "\"Open\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "type", ToString_PP_IsolatedFileSystemType_Private(type)); + AddProp(ss, "file_system", PointerToString(file_system)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + iterator.skip(); + FromJSON_PP_Resource(iterator, *file_system); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_IsolatedFileSystem_Private_0_2*)RealGetInterface("PPB_IsolatedFileSystem_Private;0.2"))->Open(instance, type, file_system, logging_callback); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_int32_t(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + if (!!file_system) { + AddProp(os, "file_system", ToString_PP_Resource(file_system)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +} +static PPB_IsolatedFileSystem_Private_0_2 _PPB_IsolatedFileSystem_Private_0_2 = { + ns_PPB_IsolatedFileSystem_Private_0_2::Open_0_2, +}; +const string ToString_PPB_IsolatedFileSystem_Private(const PPB_IsolatedFileSystem_Private_0_2 *v) { + stringstream s; + s << v; + return s.str(); +} +const string ToString_PP_NetAddressFamily_Private(const PP_NetAddressFamily_Private *v) { + switch (*v) { + case 0: + return "\"PP_NETADDRESSFAMILY_PRIVATE_UNSPECIFIED\""; + case 1: + return "\"PP_NETADDRESSFAMILY_PRIVATE_IPV4\""; + case 2: + return "\"PP_NETADDRESSFAMILY_PRIVATE_IPV6\""; + default: + return "\"???\""; + } +} +const string ToString_PP_NetAddressFamily_Private(const PP_NetAddressFamily_Private &v) { + return ToString_PP_NetAddressFamily_Private(&v); +} +void FromJSON_PP_NetAddressFamily_Private(JSONIterator& iterator, PP_NetAddressFamily_Private &value) { + long int v; + FromJSON_int(iterator, v); + value = PP_NetAddressFamily_Private(v); +} +const string ToString_PP_NetAddress_Private(const PP_NetAddress_Private *v) { + if (!v) { + return "null"; + } + return ToString_PP_NetAddress_Private(*v); +} +const string ToString_PP_NetAddress_Private(const PP_NetAddress_Private &v) { + stringstream x; + BeginProps(x); + AddProp(x, "size", ToString_uint32_t(v.size)); + { + BeginProp(x, "data"); + BeginElements(x); + for (uint32_t _n = 0; _n < 128; ++_n) { + AddElement(x, ToString_int8_t(v.data[_n])); + } + EndElements(x); + } + EndProps(x); + return x.str(); +} +void FromJSON_PP_NetAddress_Private(JSONIterator& iterator, PP_NetAddress_Private &value) { + const JSON::Token& current = iterator.getCurrentAndGotoNext(); + if (current.isPrimitive() && !current.value().compare("null")) { + return; + } + if (!current.isObject()) { + Fail("Expected object!", ""); + } + iterator.skip(); + FromJSON_uint32_t(iterator, value.size); + iterator.skip(); + + { + size_t children = iterator.expectArrayAndGotoFirstItem(); + if (children > 128) { + Fail("Too many items in array\n", ""); + } + for (uint32_t _n = 0; _n < children; ++_n) { + FromJSON_int8_t(iterator, (value.data)[_n]); + } + // FIXME Null out remaining items? + } +} +namespace ns_PPB_NetAddress_Private_0_1 { +static PP_Bool AreEqual_0_1(const struct PP_NetAddress_Private* addr1, const struct PP_NetAddress_Private* addr2) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_NetAddress_Private\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"AreEqual\""); + AddProp(ss, "addr1", ToString_PP_NetAddress_Private(addr1)); + AddProp(ss, "addr2", ToString_PP_NetAddress_Private(addr2)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_NetAddress_Private_0_1*)RealGetInterface("PPB_NetAddress_Private;0.1"))->AreEqual(addr1, addr2); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool AreHostsEqual_0_1(const struct PP_NetAddress_Private* addr1, const struct PP_NetAddress_Private* addr2) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_NetAddress_Private\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"AreHostsEqual\""); + AddProp(ss, "addr1", ToString_PP_NetAddress_Private(addr1)); + AddProp(ss, "addr2", ToString_PP_NetAddress_Private(addr2)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_NetAddress_Private_0_1*)RealGetInterface("PPB_NetAddress_Private;0.1"))->AreHostsEqual(addr1, addr2); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static struct PP_Var Describe_0_1(PP_Module module, const struct PP_NetAddress_Private* addr, PP_Bool include_port) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_NetAddress_Private\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"Describe\""); + AddProp(ss, "module", ToString_PP_Module(module)); + AddProp(ss, "addr", ToString_PP_NetAddress_Private(addr)); + AddProp(ss, "include_port", ToString_PP_Bool(include_port)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + struct PP_Var rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Var(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + struct PP_Var rval = ((PPB_NetAddress_Private_0_1*)RealGetInterface("PPB_NetAddress_Private;0.1"))->Describe(module, addr, include_port); + printf("RPC response: ["); + printf("%s", ToString_PP_Var(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool ReplacePort_0_1(const struct PP_NetAddress_Private* src_addr, uint16_t port, struct PP_NetAddress_Private* addr_out) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_NetAddress_Private\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"ReplacePort\""); + AddProp(ss, "src_addr", ToString_PP_NetAddress_Private(src_addr)); + AddProp(ss, "port", ToString_uint16_t(port)); + AddProp(ss, "addr_out", PointerToString(addr_out)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + if (!!addr_out) { + iterator.skip(); + FromJSON_PP_NetAddress_Private(iterator, *addr_out); + } + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_NetAddress_Private_0_1*)RealGetInterface("PPB_NetAddress_Private;0.1"))->ReplacePort(src_addr, port, addr_out); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + if (!!addr_out) { + AddProp(os, "addr_out", ToString_PP_NetAddress_Private(addr_out)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static void GetAnyAddress_0_1(PP_Bool is_ipv6, struct PP_NetAddress_Private* addr) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_NetAddress_Private\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"GetAnyAddress\""); + AddProp(ss, "is_ipv6", ToString_PP_Bool(is_ipv6)); + AddProp(ss, "addr", PointerToString(addr)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectObjectAndGotoFirstProperty(); + if (!!addr) { + iterator.skip(); + FromJSON_PP_NetAddress_Private(iterator, *addr); + } +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_NetAddress_Private_0_1*)RealGetInterface("PPB_NetAddress_Private;0.1"))->GetAnyAddress(is_ipv6, addr); + printf("RPC response: ["); + printf("["); + std::stringstream os; + BeginProps(os); + if (!!addr) { + AddProp(os, "addr", ToString_PP_NetAddress_Private(addr)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); +#endif // !INTERPOSE +} +/* skipping GetFamily */ +/* skipping GetPort */ +/* skipping GetAddress */ +/* skipping GetScopeID */ +/* skipping CreateFromIPv4Address */ +/* skipping CreateFromIPv6Address */ +} +static PPB_NetAddress_Private_0_1 _PPB_NetAddress_Private_0_1 = { + ns_PPB_NetAddress_Private_0_1::AreEqual_0_1, + ns_PPB_NetAddress_Private_0_1::AreHostsEqual_0_1, + ns_PPB_NetAddress_Private_0_1::Describe_0_1, + ns_PPB_NetAddress_Private_0_1::ReplacePort_0_1, + ns_PPB_NetAddress_Private_0_1::GetAnyAddress_0_1, +}; +const string ToString_PPB_NetAddress_Private(const PPB_NetAddress_Private_0_1 *v) { + stringstream s; + s << v; + return s.str(); +} +namespace ns_PPB_NetAddress_Private_1_0 { +static PP_Bool AreEqual_1_0(const struct PP_NetAddress_Private* addr1, const struct PP_NetAddress_Private* addr2) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_NetAddress_Private\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"AreEqual\""); + AddProp(ss, "addr1", ToString_PP_NetAddress_Private(addr1)); + AddProp(ss, "addr2", ToString_PP_NetAddress_Private(addr2)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_NetAddress_Private_1_0*)RealGetInterface("PPB_NetAddress_Private;1.0"))->AreEqual(addr1, addr2); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool AreHostsEqual_1_0(const struct PP_NetAddress_Private* addr1, const struct PP_NetAddress_Private* addr2) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_NetAddress_Private\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"AreHostsEqual\""); + AddProp(ss, "addr1", ToString_PP_NetAddress_Private(addr1)); + AddProp(ss, "addr2", ToString_PP_NetAddress_Private(addr2)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_NetAddress_Private_1_0*)RealGetInterface("PPB_NetAddress_Private;1.0"))->AreHostsEqual(addr1, addr2); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static struct PP_Var Describe_1_0(PP_Module module, const struct PP_NetAddress_Private* addr, PP_Bool include_port) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_NetAddress_Private\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"Describe\""); + AddProp(ss, "module", ToString_PP_Module(module)); + AddProp(ss, "addr", ToString_PP_NetAddress_Private(addr)); + AddProp(ss, "include_port", ToString_PP_Bool(include_port)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + struct PP_Var rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Var(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + struct PP_Var rval = ((PPB_NetAddress_Private_1_0*)RealGetInterface("PPB_NetAddress_Private;1.0"))->Describe(module, addr, include_port); + printf("RPC response: ["); + printf("%s", ToString_PP_Var(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool ReplacePort_1_0(const struct PP_NetAddress_Private* src_addr, uint16_t port, struct PP_NetAddress_Private* addr_out) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_NetAddress_Private\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"ReplacePort\""); + AddProp(ss, "src_addr", ToString_PP_NetAddress_Private(src_addr)); + AddProp(ss, "port", ToString_uint16_t(port)); + AddProp(ss, "addr_out", PointerToString(addr_out)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + if (!!addr_out) { + iterator.skip(); + FromJSON_PP_NetAddress_Private(iterator, *addr_out); + } + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_NetAddress_Private_1_0*)RealGetInterface("PPB_NetAddress_Private;1.0"))->ReplacePort(src_addr, port, addr_out); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + if (!!addr_out) { + AddProp(os, "addr_out", ToString_PP_NetAddress_Private(addr_out)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static void GetAnyAddress_1_0(PP_Bool is_ipv6, struct PP_NetAddress_Private* addr) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_NetAddress_Private\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"GetAnyAddress\""); + AddProp(ss, "is_ipv6", ToString_PP_Bool(is_ipv6)); + AddProp(ss, "addr", PointerToString(addr)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectObjectAndGotoFirstProperty(); + if (!!addr) { + iterator.skip(); + FromJSON_PP_NetAddress_Private(iterator, *addr); + } +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_NetAddress_Private_1_0*)RealGetInterface("PPB_NetAddress_Private;1.0"))->GetAnyAddress(is_ipv6, addr); + printf("RPC response: ["); + printf("["); + std::stringstream os; + BeginProps(os); + if (!!addr) { + AddProp(os, "addr", ToString_PP_NetAddress_Private(addr)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); +#endif // !INTERPOSE +} +static PP_NetAddressFamily_Private GetFamily_1_0(const struct PP_NetAddress_Private* addr) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_NetAddress_Private\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"GetFamily\""); + AddProp(ss, "addr", ToString_PP_NetAddress_Private(addr)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_NetAddressFamily_Private rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_NetAddressFamily_Private(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_NetAddressFamily_Private rval = ((PPB_NetAddress_Private_1_0*)RealGetInterface("PPB_NetAddress_Private;1.0"))->GetFamily(addr); + printf("RPC response: ["); + printf("%s", ToString_PP_NetAddressFamily_Private(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static uint16_t GetPort_1_0(const struct PP_NetAddress_Private* addr) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_NetAddress_Private\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"GetPort\""); + AddProp(ss, "addr", ToString_PP_NetAddress_Private(addr)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + uint16_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_uint16_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + uint16_t rval = ((PPB_NetAddress_Private_1_0*)RealGetInterface("PPB_NetAddress_Private;1.0"))->GetPort(addr); + printf("RPC response: ["); + printf("%s", ToString_uint16_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool GetAddress_1_0(const struct PP_NetAddress_Private* addr, void* address, uint16_t address_size) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_NetAddress_Private\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"GetAddress\""); + AddProp(ss, "addr", ToString_PP_NetAddress_Private(addr)); + AddProp(ss, "address", PointerToString(address)); + AddProp(ss, "address_size", ToString_uint16_t(address_size)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + iterator.skip(); + FromJSON_mem_t(iterator, address); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_NetAddress_Private_1_0*)RealGetInterface("PPB_NetAddress_Private;1.0"))->GetAddress(addr, address, address_size); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + AddProp(os, "address", ToString_mem_t(address)); + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +/* skipping GetScopeID */ +/* skipping CreateFromIPv4Address */ +/* skipping CreateFromIPv6Address */ +} +static PPB_NetAddress_Private_1_0 _PPB_NetAddress_Private_1_0 = { + ns_PPB_NetAddress_Private_1_0::AreEqual_1_0, + ns_PPB_NetAddress_Private_1_0::AreHostsEqual_1_0, + ns_PPB_NetAddress_Private_1_0::Describe_1_0, + ns_PPB_NetAddress_Private_1_0::ReplacePort_1_0, + ns_PPB_NetAddress_Private_1_0::GetAnyAddress_1_0, + ns_PPB_NetAddress_Private_1_0::GetFamily_1_0, + ns_PPB_NetAddress_Private_1_0::GetPort_1_0, + ns_PPB_NetAddress_Private_1_0::GetAddress_1_0, +}; +const string ToString_PPB_NetAddress_Private(const PPB_NetAddress_Private_1_0 *v) { + stringstream s; + s << v; + return s.str(); +} +namespace ns_PPB_NetAddress_Private_1_1 { +static PP_Bool AreEqual_1_1(const struct PP_NetAddress_Private* addr1, const struct PP_NetAddress_Private* addr2) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_NetAddress_Private\""); + AddProp(ss, "__version", "\"1.1\""); + AddProp(ss, "__method", "\"AreEqual\""); + AddProp(ss, "addr1", ToString_PP_NetAddress_Private(addr1)); + AddProp(ss, "addr2", ToString_PP_NetAddress_Private(addr2)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_NetAddress_Private_1_1*)RealGetInterface("PPB_NetAddress_Private;1.1"))->AreEqual(addr1, addr2); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool AreHostsEqual_1_1(const struct PP_NetAddress_Private* addr1, const struct PP_NetAddress_Private* addr2) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_NetAddress_Private\""); + AddProp(ss, "__version", "\"1.1\""); + AddProp(ss, "__method", "\"AreHostsEqual\""); + AddProp(ss, "addr1", ToString_PP_NetAddress_Private(addr1)); + AddProp(ss, "addr2", ToString_PP_NetAddress_Private(addr2)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_NetAddress_Private_1_1*)RealGetInterface("PPB_NetAddress_Private;1.1"))->AreHostsEqual(addr1, addr2); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static struct PP_Var Describe_1_1(PP_Module module, const struct PP_NetAddress_Private* addr, PP_Bool include_port) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_NetAddress_Private\""); + AddProp(ss, "__version", "\"1.1\""); + AddProp(ss, "__method", "\"Describe\""); + AddProp(ss, "module", ToString_PP_Module(module)); + AddProp(ss, "addr", ToString_PP_NetAddress_Private(addr)); + AddProp(ss, "include_port", ToString_PP_Bool(include_port)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + struct PP_Var rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Var(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + struct PP_Var rval = ((PPB_NetAddress_Private_1_1*)RealGetInterface("PPB_NetAddress_Private;1.1"))->Describe(module, addr, include_port); + printf("RPC response: ["); + printf("%s", ToString_PP_Var(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool ReplacePort_1_1(const struct PP_NetAddress_Private* src_addr, uint16_t port, struct PP_NetAddress_Private* addr_out) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_NetAddress_Private\""); + AddProp(ss, "__version", "\"1.1\""); + AddProp(ss, "__method", "\"ReplacePort\""); + AddProp(ss, "src_addr", ToString_PP_NetAddress_Private(src_addr)); + AddProp(ss, "port", ToString_uint16_t(port)); + AddProp(ss, "addr_out", PointerToString(addr_out)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + if (!!addr_out) { + iterator.skip(); + FromJSON_PP_NetAddress_Private(iterator, *addr_out); + } + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_NetAddress_Private_1_1*)RealGetInterface("PPB_NetAddress_Private;1.1"))->ReplacePort(src_addr, port, addr_out); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + if (!!addr_out) { + AddProp(os, "addr_out", ToString_PP_NetAddress_Private(addr_out)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static void GetAnyAddress_1_1(PP_Bool is_ipv6, struct PP_NetAddress_Private* addr) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_NetAddress_Private\""); + AddProp(ss, "__version", "\"1.1\""); + AddProp(ss, "__method", "\"GetAnyAddress\""); + AddProp(ss, "is_ipv6", ToString_PP_Bool(is_ipv6)); + AddProp(ss, "addr", PointerToString(addr)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectObjectAndGotoFirstProperty(); + if (!!addr) { + iterator.skip(); + FromJSON_PP_NetAddress_Private(iterator, *addr); + } +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_NetAddress_Private_1_1*)RealGetInterface("PPB_NetAddress_Private;1.1"))->GetAnyAddress(is_ipv6, addr); + printf("RPC response: ["); + printf("["); + std::stringstream os; + BeginProps(os); + if (!!addr) { + AddProp(os, "addr", ToString_PP_NetAddress_Private(addr)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); +#endif // !INTERPOSE +} +static PP_NetAddressFamily_Private GetFamily_1_1(const struct PP_NetAddress_Private* addr) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_NetAddress_Private\""); + AddProp(ss, "__version", "\"1.1\""); + AddProp(ss, "__method", "\"GetFamily\""); + AddProp(ss, "addr", ToString_PP_NetAddress_Private(addr)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_NetAddressFamily_Private rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_NetAddressFamily_Private(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_NetAddressFamily_Private rval = ((PPB_NetAddress_Private_1_1*)RealGetInterface("PPB_NetAddress_Private;1.1"))->GetFamily(addr); + printf("RPC response: ["); + printf("%s", ToString_PP_NetAddressFamily_Private(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static uint16_t GetPort_1_1(const struct PP_NetAddress_Private* addr) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_NetAddress_Private\""); + AddProp(ss, "__version", "\"1.1\""); + AddProp(ss, "__method", "\"GetPort\""); + AddProp(ss, "addr", ToString_PP_NetAddress_Private(addr)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + uint16_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_uint16_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + uint16_t rval = ((PPB_NetAddress_Private_1_1*)RealGetInterface("PPB_NetAddress_Private;1.1"))->GetPort(addr); + printf("RPC response: ["); + printf("%s", ToString_uint16_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool GetAddress_1_1(const struct PP_NetAddress_Private* addr, void* address, uint16_t address_size) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_NetAddress_Private\""); + AddProp(ss, "__version", "\"1.1\""); + AddProp(ss, "__method", "\"GetAddress\""); + AddProp(ss, "addr", ToString_PP_NetAddress_Private(addr)); + AddProp(ss, "address", PointerToString(address)); + AddProp(ss, "address_size", ToString_uint16_t(address_size)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + iterator.skip(); + FromJSON_mem_t(iterator, address); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_NetAddress_Private_1_1*)RealGetInterface("PPB_NetAddress_Private;1.1"))->GetAddress(addr, address, address_size); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + AddProp(os, "address", ToString_mem_t(address)); + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static uint32_t GetScopeID_1_1(const struct PP_NetAddress_Private* addr) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_NetAddress_Private\""); + AddProp(ss, "__version", "\"1.1\""); + AddProp(ss, "__method", "\"GetScopeID\""); + AddProp(ss, "addr", ToString_PP_NetAddress_Private(addr)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + uint32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_uint32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + uint32_t rval = ((PPB_NetAddress_Private_1_1*)RealGetInterface("PPB_NetAddress_Private;1.1"))->GetScopeID(addr); + printf("RPC response: ["); + printf("%s", ToString_uint32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static void CreateFromIPv4Address_1_1(const uint8_t ip[4], uint16_t port, struct PP_NetAddress_Private* addr_out) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_NetAddress_Private\""); + AddProp(ss, "__version", "\"1.1\""); + AddProp(ss, "__method", "\"CreateFromIPv4Address\""); + { + BeginProp(ss, "ip"); + BeginElements(ss); + for (uint32_t _n = 0; _n < 4; ++_n) { + AddElement(ss, ToString_uint8_t(ip[_n])); + } + EndElements(ss); + } + AddProp(ss, "port", ToString_uint16_t(port)); + AddProp(ss, "addr_out", PointerToString(addr_out)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectObjectAndGotoFirstProperty(); + if (!!addr_out) { + iterator.skip(); + FromJSON_PP_NetAddress_Private(iterator, *addr_out); + } +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_NetAddress_Private_1_1*)RealGetInterface("PPB_NetAddress_Private;1.1"))->CreateFromIPv4Address(ip, port, addr_out); + printf("RPC response: ["); + printf("["); + std::stringstream os; + BeginProps(os); + if (!!addr_out) { + AddProp(os, "addr_out", ToString_PP_NetAddress_Private(addr_out)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); +#endif // !INTERPOSE +} +static void CreateFromIPv6Address_1_1(const uint8_t ip[16], uint32_t scope_id, uint16_t port, struct PP_NetAddress_Private* addr_out) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_NetAddress_Private\""); + AddProp(ss, "__version", "\"1.1\""); + AddProp(ss, "__method", "\"CreateFromIPv6Address\""); + { + BeginProp(ss, "ip"); + BeginElements(ss); + for (uint32_t _n = 0; _n < 16; ++_n) { + AddElement(ss, ToString_uint8_t(ip[_n])); + } + EndElements(ss); + } + AddProp(ss, "scope_id", ToString_uint32_t(scope_id)); + AddProp(ss, "port", ToString_uint16_t(port)); + AddProp(ss, "addr_out", PointerToString(addr_out)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectObjectAndGotoFirstProperty(); + if (!!addr_out) { + iterator.skip(); + FromJSON_PP_NetAddress_Private(iterator, *addr_out); + } +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_NetAddress_Private_1_1*)RealGetInterface("PPB_NetAddress_Private;1.1"))->CreateFromIPv6Address(ip, scope_id, port, addr_out); + printf("RPC response: ["); + printf("["); + std::stringstream os; + BeginProps(os); + if (!!addr_out) { + AddProp(os, "addr_out", ToString_PP_NetAddress_Private(addr_out)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); +#endif // !INTERPOSE +} +} +static PPB_NetAddress_Private_1_1 _PPB_NetAddress_Private_1_1 = { + ns_PPB_NetAddress_Private_1_1::AreEqual_1_1, + ns_PPB_NetAddress_Private_1_1::AreHostsEqual_1_1, + ns_PPB_NetAddress_Private_1_1::Describe_1_1, + ns_PPB_NetAddress_Private_1_1::ReplacePort_1_1, + ns_PPB_NetAddress_Private_1_1::GetAnyAddress_1_1, + ns_PPB_NetAddress_Private_1_1::GetFamily_1_1, + ns_PPB_NetAddress_Private_1_1::GetPort_1_1, + ns_PPB_NetAddress_Private_1_1::GetAddress_1_1, + ns_PPB_NetAddress_Private_1_1::GetScopeID_1_1, + ns_PPB_NetAddress_Private_1_1::CreateFromIPv4Address_1_1, + ns_PPB_NetAddress_Private_1_1::CreateFromIPv6Address_1_1, +}; +const string ToString_PPB_NetAddress_Private(const PPB_NetAddress_Private_1_1 *v) { + stringstream s; + s << v; + return s.str(); +} +const string ToString_PP_OutputProtectionMethod_Private(const PP_OutputProtectionMethod_Private *v) { + switch (*v) { + case 0: + return "\"PP_OUTPUT_PROTECTION_METHOD_PRIVATE_NONE\""; + case 1 << 0: + return "\"PP_OUTPUT_PROTECTION_METHOD_PRIVATE_HDCP\""; + default: + return "\"???\""; + } +} +const string ToString_PP_OutputProtectionMethod_Private(const PP_OutputProtectionMethod_Private &v) { + return ToString_PP_OutputProtectionMethod_Private(&v); +} +void FromJSON_PP_OutputProtectionMethod_Private(JSONIterator& iterator, PP_OutputProtectionMethod_Private &value) { + long int v; + FromJSON_int(iterator, v); + value = PP_OutputProtectionMethod_Private(v); +} +const string ToString_PP_OutputProtectionLinkType_Private(const PP_OutputProtectionLinkType_Private *v) { + switch (*v) { + case 0: + return "\"PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_NONE\""; + case 1 << 0: + return "\"PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_UNKNOWN\""; + case 1 << 1: + return "\"PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_INTERNAL\""; + case 1 << 2: + return "\"PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_VGA\""; + case 1 << 3: + return "\"PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_HDMI\""; + case 1 << 4: + return "\"PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_DVI\""; + case 1 << 5: + return "\"PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_DISPLAYPORT\""; + case 1 << 6: + return "\"PP_OUTPUT_PROTECTION_LINK_TYPE_PRIVATE_NETWORK\""; + default: + return "\"???\""; + } +} +const string ToString_PP_OutputProtectionLinkType_Private(const PP_OutputProtectionLinkType_Private &v) { + return ToString_PP_OutputProtectionLinkType_Private(&v); +} +void FromJSON_PP_OutputProtectionLinkType_Private(JSONIterator& iterator, PP_OutputProtectionLinkType_Private &value) { + long int v; + FromJSON_int(iterator, v); + value = PP_OutputProtectionLinkType_Private(v); +} +namespace ns_PPB_OutputProtection_Private_0_1 { +static PP_Resource Create_0_1(PP_Instance instance) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OutputProtection_Private\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"Create\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Resource(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_OutputProtection_Private_0_1*)RealGetInterface("PPB_OutputProtection_Private;0.1"))->Create(instance); + printf("RPC response: ["); + printf("%s", ToString_PP_Resource(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool IsOutputProtection_0_1(PP_Resource resource) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OutputProtection_Private\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"IsOutputProtection\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_OutputProtection_Private_0_1*)RealGetInterface("PPB_OutputProtection_Private;0.1"))->IsOutputProtection(resource); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t QueryStatus_0_1(PP_Resource resource, uint32_t* link_mask, uint32_t* protection_mask, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OutputProtection_Private\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"QueryStatus\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + AddProp(ss, "link_mask", PointerToString(link_mask)); + AddProp(ss, "protection_mask", PointerToString(protection_mask)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + iterator.skip(); + FromJSON_uint32_t(iterator, *link_mask); + iterator.skip(); + FromJSON_uint32_t(iterator, *protection_mask); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_OutputProtection_Private_0_1*)RealGetInterface("PPB_OutputProtection_Private;0.1"))->QueryStatus(resource, link_mask, protection_mask, logging_callback); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_int32_t(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + if (!!link_mask) { + AddProp(os, "link_mask", ToString_uint32_t(link_mask)); + } + if (!!protection_mask) { + AddProp(os, "protection_mask", ToString_uint32_t(protection_mask)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t EnableProtection_0_1(PP_Resource resource, uint32_t desired_protection_mask, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_OutputProtection_Private\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"EnableProtection\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + AddProp(ss, "desired_protection_mask", ToString_uint32_t(desired_protection_mask)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_OutputProtection_Private_0_1*)RealGetInterface("PPB_OutputProtection_Private;0.1"))->EnableProtection(resource, desired_protection_mask, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +} +static PPB_OutputProtection_Private_0_1 _PPB_OutputProtection_Private_0_1 = { + ns_PPB_OutputProtection_Private_0_1::Create_0_1, + ns_PPB_OutputProtection_Private_0_1::IsOutputProtection_0_1, + ns_PPB_OutputProtection_Private_0_1::QueryStatus_0_1, + ns_PPB_OutputProtection_Private_0_1::EnableProtection_0_1, +}; +const string ToString_PPB_OutputProtection_Private(const PPB_OutputProtection_Private_0_1 *v) { + stringstream s; + s << v; + return s.str(); +} +const string ToString_PP_PDFFeature(const PP_PDFFeature *v) { + switch (*v) { + case 0: + return "\"PP_PDFFEATURE_HIDPI\""; + case 1: + return "\"PP_PDFFEATURE_PRINTING\""; + default: + return "\"???\""; + } +} +const string ToString_PP_PDFFeature(const PP_PDFFeature &v) { + return ToString_PP_PDFFeature(&v); +} +void FromJSON_PP_PDFFeature(JSONIterator& iterator, PP_PDFFeature &value) { + long int v; + FromJSON_int(iterator, v); + value = PP_PDFFeature(v); +} +const string ToString_PP_PrivateFontFileDescription(const PP_PrivateFontFileDescription *v) { + if (!v) { + return "null"; + } + return ToString_PP_PrivateFontFileDescription(*v); +} +const string ToString_PP_PrivateFontFileDescription(const PP_PrivateFontFileDescription &v) { + stringstream x; + BeginProps(x); + AddProp(x, "face", ToString_str_t(v.face)); + AddProp(x, "weight", ToString_uint32_t(v.weight)); + AddProp(x, "italic", ToString_PP_Bool(v.italic)); + EndProps(x); + return x.str(); +} +void FromJSON_PP_PrivateFontFileDescription(JSONIterator& iterator, PP_PrivateFontFileDescription &value) { + const JSON::Token& current = iterator.getCurrentAndGotoNext(); + if (current.isPrimitive() && !current.value().compare("null")) { + return; + } + if (!current.isObject()) { + Fail("Expected object!", ""); + } + iterator.skip(); + FromJSON_str_t(iterator, value.face); + iterator.skip(); + FromJSON_uint32_t(iterator, value.weight); + iterator.skip(); + FromJSON_PP_Bool(iterator, value.italic); +} +const string ToString_PP_PrivateFindResult(const PP_PrivateFindResult *v) { + if (!v) { + return "null"; + } + return ToString_PP_PrivateFindResult(*v); +} +const string ToString_PP_PrivateFindResult(const PP_PrivateFindResult &v) { + stringstream x; + BeginProps(x); + AddProp(x, "start_index", ToString_int32_t(v.start_index)); + AddProp(x, "length", ToString_int32_t(v.length)); + EndProps(x); + return x.str(); +} +void FromJSON_PP_PrivateFindResult(JSONIterator& iterator, PP_PrivateFindResult &value) { + const JSON::Token& current = iterator.getCurrentAndGotoNext(); + if (current.isPrimitive() && !current.value().compare("null")) { + return; + } + if (!current.isObject()) { + Fail("Expected object!", ""); + } + iterator.skip(); + FromJSON_int32_t(iterator, value.start_index); + iterator.skip(); + FromJSON_int32_t(iterator, value.length); +} +const string ToString_PP_PrivateAccessibilityViewportInfo(const PP_PrivateAccessibilityViewportInfo *v) { + if (!v) { + return "null"; + } + return ToString_PP_PrivateAccessibilityViewportInfo(*v); +} +const string ToString_PP_PrivateAccessibilityViewportInfo(const PP_PrivateAccessibilityViewportInfo &v) { + stringstream x; + BeginProps(x); + AddProp(x, "zoom", ToString_double_t(v.zoom)); + AddProp(x, "scroll", ToString_PP_Point(v.scroll)); + AddProp(x, "offset", ToString_PP_Point(v.offset)); + EndProps(x); + return x.str(); +} +void FromJSON_PP_PrivateAccessibilityViewportInfo(JSONIterator& iterator, PP_PrivateAccessibilityViewportInfo &value) { + const JSON::Token& current = iterator.getCurrentAndGotoNext(); + if (current.isPrimitive() && !current.value().compare("null")) { + return; + } + if (!current.isObject()) { + Fail("Expected object!", ""); + } + iterator.skip(); + FromJSON_double_t(iterator, value.zoom); + iterator.skip(); + FromJSON_PP_Point(iterator, value.scroll); + iterator.skip(); + FromJSON_PP_Point(iterator, value.offset); +} +const string ToString_PP_PrivateAccessibilityDocInfo(const PP_PrivateAccessibilityDocInfo *v) { + if (!v) { + return "null"; + } + return ToString_PP_PrivateAccessibilityDocInfo(*v); +} +const string ToString_PP_PrivateAccessibilityDocInfo(const PP_PrivateAccessibilityDocInfo &v) { + stringstream x; + BeginProps(x); + AddProp(x, "page_count", ToString_uint32_t(v.page_count)); + AddProp(x, "text_accessible", ToString_PP_Bool(v.text_accessible)); + AddProp(x, "text_copyable", ToString_PP_Bool(v.text_copyable)); + EndProps(x); + return x.str(); +} +void FromJSON_PP_PrivateAccessibilityDocInfo(JSONIterator& iterator, PP_PrivateAccessibilityDocInfo &value) { + const JSON::Token& current = iterator.getCurrentAndGotoNext(); + if (current.isPrimitive() && !current.value().compare("null")) { + return; + } + if (!current.isObject()) { + Fail("Expected object!", ""); + } + iterator.skip(); + FromJSON_uint32_t(iterator, value.page_count); + iterator.skip(); + FromJSON_PP_Bool(iterator, value.text_accessible); + iterator.skip(); + FromJSON_PP_Bool(iterator, value.text_copyable); +} +const string ToString_PP_PrivateDirection(const PP_PrivateDirection *v) { + switch (*v) { + case 0: + return "\"PP_PRIVATEDIRECTION_NONE\""; + case 1: + return "\"PP_PRIVATEDIRECTION_LTR\""; + case 2: + return "\"PP_PRIVATEDIRECTION_RTL\""; + case 3: + return "\"PP_PRIVATEDIRECTION_TTB\""; + case 4: + return "\"PP_PRIVATEDIRECTION_BTT\""; + default: + return "\"???\""; + } +} +const string ToString_PP_PrivateDirection(const PP_PrivateDirection &v) { + return ToString_PP_PrivateDirection(&v); +} +void FromJSON_PP_PrivateDirection(JSONIterator& iterator, PP_PrivateDirection &value) { + long int v; + FromJSON_int(iterator, v); + value = PP_PrivateDirection(v); +} +const string ToString_PP_PrivateAccessibilityPageInfo(const PP_PrivateAccessibilityPageInfo *v) { + if (!v) { + return "null"; + } + return ToString_PP_PrivateAccessibilityPageInfo(*v); +} +const string ToString_PP_PrivateAccessibilityPageInfo(const PP_PrivateAccessibilityPageInfo &v) { + stringstream x; + BeginProps(x); + AddProp(x, "page_index", ToString_uint32_t(v.page_index)); + AddProp(x, "bounds", ToString_PP_Rect(v.bounds)); + AddProp(x, "text_run_count", ToString_uint32_t(v.text_run_count)); + AddProp(x, "char_count", ToString_uint32_t(v.char_count)); + EndProps(x); + return x.str(); +} +void FromJSON_PP_PrivateAccessibilityPageInfo(JSONIterator& iterator, PP_PrivateAccessibilityPageInfo &value) { + const JSON::Token& current = iterator.getCurrentAndGotoNext(); + if (current.isPrimitive() && !current.value().compare("null")) { + return; + } + if (!current.isObject()) { + Fail("Expected object!", ""); + } + iterator.skip(); + FromJSON_uint32_t(iterator, value.page_index); + iterator.skip(); + FromJSON_PP_Rect(iterator, value.bounds); + iterator.skip(); + FromJSON_uint32_t(iterator, value.text_run_count); + iterator.skip(); + FromJSON_uint32_t(iterator, value.char_count); +} +const string ToString_PP_PrivateAccessibilityTextRunInfo(const PP_PrivateAccessibilityTextRunInfo *v) { + if (!v) { + return "null"; + } + return ToString_PP_PrivateAccessibilityTextRunInfo(*v); +} +const string ToString_PP_PrivateAccessibilityTextRunInfo(const PP_PrivateAccessibilityTextRunInfo &v) { + stringstream x; + BeginProps(x); + AddProp(x, "len", ToString_uint32_t(v.len)); + AddProp(x, "font_size", ToString_double_t(v.font_size)); + AddProp(x, "bounds", ToString_PP_FloatRect(v.bounds)); + AddProp(x, "direction", ToString_PP_PrivateDirection(v.direction)); + EndProps(x); + return x.str(); +} +void FromJSON_PP_PrivateAccessibilityTextRunInfo(JSONIterator& iterator, PP_PrivateAccessibilityTextRunInfo &value) { + const JSON::Token& current = iterator.getCurrentAndGotoNext(); + if (current.isPrimitive() && !current.value().compare("null")) { + return; + } + if (!current.isObject()) { + Fail("Expected object!", ""); + } + iterator.skip(); + FromJSON_uint32_t(iterator, value.len); + iterator.skip(); + FromJSON_double_t(iterator, value.font_size); + iterator.skip(); + FromJSON_PP_FloatRect(iterator, value.bounds); + iterator.skip(); + FromJSON_PP_PrivateDirection(iterator, value.direction); +} +const string ToString_PP_PrivateAccessibilityCharInfo(const PP_PrivateAccessibilityCharInfo *v) { + if (!v) { + return "null"; + } + return ToString_PP_PrivateAccessibilityCharInfo(*v); +} +const string ToString_PP_PrivateAccessibilityCharInfo(const PP_PrivateAccessibilityCharInfo &v) { + stringstream x; + BeginProps(x); + AddProp(x, "unicode_character", ToString_uint32_t(v.unicode_character)); + AddProp(x, "char_width", ToString_double_t(v.char_width)); + EndProps(x); + return x.str(); +} +void FromJSON_PP_PrivateAccessibilityCharInfo(JSONIterator& iterator, PP_PrivateAccessibilityCharInfo &value) { + const JSON::Token& current = iterator.getCurrentAndGotoNext(); + if (current.isPrimitive() && !current.value().compare("null")) { + return; + } + if (!current.isObject()) { + Fail("Expected object!", ""); + } + iterator.skip(); + FromJSON_uint32_t(iterator, value.unicode_character); + iterator.skip(); + FromJSON_double_t(iterator, value.char_width); +} +namespace ns_PPB_PDF_0_1 { +static PP_Resource GetFontFileWithFallback_0_1(PP_Instance instance, const struct PP_BrowserFont_Trusted_Description* description, PP_PrivateFontCharset charset) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_PDF\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"GetFontFileWithFallback\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "description", ToString_PP_BrowserFont_Trusted_Description(description)); + AddProp(ss, "charset", ToString_PP_PrivateFontCharset(charset)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Resource(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_PDF_0_1*)RealGetInterface("PPB_PDF;0.1"))->GetFontFileWithFallback(instance, description, charset); + printf("RPC response: ["); + printf("%s", ToString_PP_Resource(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool GetFontTableForPrivateFontFile_0_1(PP_Resource font_file, uint32_t table, void* output, uint32_t* output_length) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_PDF\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"GetFontTableForPrivateFontFile\""); + AddProp(ss, "font_file", ToString_PP_Resource(font_file)); + AddProp(ss, "table", ToString_uint32_t(table)); + AddProp(ss, "output", PointerToString(output)); + AddProp(ss, "output_length", PointerToString(output_length)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + iterator.skip(); + FromJSON_mem_t(iterator, output); + iterator.skip(); + FromJSON_uint32_t(iterator, *output_length); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_PDF_0_1*)RealGetInterface("PPB_PDF;0.1"))->GetFontTableForPrivateFontFile(font_file, table, output, output_length); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + AddProp(os, "output", ToString_mem_t(output)); + if (!!output_length) { + AddProp(os, "output_length", ToString_uint32_t(output_length)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static void SearchString_0_1(PP_Instance instance, const void* str, const void* term, PP_Bool case_sensitive, struct PP_PrivateFindResult** results, int32_t* count) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_PDF\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"SearchString\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "str", ToString_mem_t(str)); + AddProp(ss, "term", ToString_mem_t(term)); + AddProp(ss, "case_sensitive", ToString_PP_Bool(case_sensitive)); + AddProp(ss, "results", PointerToString(results)); + AddProp(ss, "count", PointerToString(count)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectObjectAndGotoFirstProperty(); + iterator.skip(); + + { + size_t children = iterator.expectArrayAndGotoFirstItem(); + *results = new struct PP_PrivateFindResult[children]; + for (uint32_t _n = 0; _n < children; ++_n) { + FromJSON_PP_PrivateFindResult(iterator, (*results)[_n]); + } + // FIXME Null out remaining items? + } + iterator.skip(); + FromJSON_int32_t(iterator, *count); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_PDF_0_1*)RealGetInterface("PPB_PDF;0.1"))->SearchString(instance, str, term, case_sensitive, results, count); + printf("RPC response: ["); + printf("["); + std::stringstream os; + BeginProps(os); + { + BeginProp(os, "results"); + BeginElements(os); + for (uint32_t _n = 0; results[_n] != 0; ++_n) { + AddElement(os, ToString_PP_PrivateFindResult(results[_n])); + } + EndElements(os); + } + if (!!count) { + AddProp(os, "count", ToString_int32_t(count)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); +#endif // !INTERPOSE +} +static void DidStartLoading_0_1(PP_Instance instance) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_PDF\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"DidStartLoading\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_PDF_0_1*)RealGetInterface("PPB_PDF;0.1"))->DidStartLoading(instance); +#endif // !INTERPOSE +} +static void DidStopLoading_0_1(PP_Instance instance) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_PDF\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"DidStopLoading\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_PDF_0_1*)RealGetInterface("PPB_PDF;0.1"))->DidStopLoading(instance); +#endif // !INTERPOSE +} +static void SetContentRestriction_0_1(PP_Instance instance, int32_t restrictions) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_PDF\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"SetContentRestriction\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "restrictions", ToString_int32_t(restrictions)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_PDF_0_1*)RealGetInterface("PPB_PDF;0.1"))->SetContentRestriction(instance, restrictions); +#endif // !INTERPOSE +} +static void UserMetricsRecordAction_0_1(PP_Instance instance, struct PP_Var action) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_PDF\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"UserMetricsRecordAction\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "action", ToString_PP_Var(action)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_PDF_0_1*)RealGetInterface("PPB_PDF;0.1"))->UserMetricsRecordAction(instance, action); +#endif // !INTERPOSE +} +static void HasUnsupportedFeature_0_1(PP_Instance instance) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_PDF\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"HasUnsupportedFeature\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_PDF_0_1*)RealGetInterface("PPB_PDF;0.1"))->HasUnsupportedFeature(instance); +#endif // !INTERPOSE +} +static void SaveAs_0_1(PP_Instance instance) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_PDF\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"SaveAs\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_PDF_0_1*)RealGetInterface("PPB_PDF;0.1"))->SaveAs(instance); +#endif // !INTERPOSE +} +static void Print_0_1(PP_Instance instance) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_PDF\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"Print\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_PDF_0_1*)RealGetInterface("PPB_PDF;0.1"))->Print(instance); +#endif // !INTERPOSE +} +static PP_Bool IsFeatureEnabled_0_1(PP_Instance instance, PP_PDFFeature feature) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_PDF\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"IsFeatureEnabled\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "feature", ToString_PP_PDFFeature(feature)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_PDF_0_1*)RealGetInterface("PPB_PDF;0.1"))->IsFeatureEnabled(instance, feature); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static void SetSelectedText_0_1(PP_Instance instance, const char* selected_text) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_PDF\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"SetSelectedText\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "selected_text", ToString_str_t(selected_text)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_PDF_0_1*)RealGetInterface("PPB_PDF;0.1"))->SetSelectedText(instance, selected_text); +#endif // !INTERPOSE +} +static void SetLinkUnderCursor_0_1(PP_Instance instance, const char* url) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_PDF\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"SetLinkUnderCursor\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "url", ToString_str_t(url)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_PDF_0_1*)RealGetInterface("PPB_PDF;0.1"))->SetLinkUnderCursor(instance, url); +#endif // !INTERPOSE +} +static void GetV8ExternalSnapshotData_0_1(PP_Instance instance, void** natives_data_out, int32_t* natives_size_out, void** snapshot_data_out, int32_t* snapshot_size_out) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_PDF\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"GetV8ExternalSnapshotData\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "natives_data_out", PointerToString(natives_data_out)); + AddProp(ss, "natives_size_out", PointerToString(natives_size_out)); + AddProp(ss, "snapshot_data_out", PointerToString(snapshot_data_out)); + AddProp(ss, "snapshot_size_out", PointerToString(snapshot_size_out)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectObjectAndGotoFirstProperty(); + iterator.skip(); + FromJSON_mem_ptr_t(iterator, natives_data_out); + iterator.skip(); + FromJSON_int32_t(iterator, *natives_size_out); + iterator.skip(); + FromJSON_mem_ptr_t(iterator, snapshot_data_out); + iterator.skip(); + FromJSON_int32_t(iterator, *snapshot_size_out); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_PDF_0_1*)RealGetInterface("PPB_PDF;0.1"))->GetV8ExternalSnapshotData(instance, natives_data_out, natives_size_out, snapshot_data_out, snapshot_size_out); + printf("RPC response: ["); + printf("["); + std::stringstream os; + BeginProps(os); + AddProp(os, "natives_data_out", ToString_mem_ptr_t(natives_data_out)); + if (!!natives_size_out) { + AddProp(os, "natives_size_out", ToString_int32_t(natives_size_out)); + } + AddProp(os, "snapshot_data_out", ToString_mem_ptr_t(snapshot_data_out)); + if (!!snapshot_size_out) { + AddProp(os, "snapshot_size_out", ToString_int32_t(snapshot_size_out)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); +#endif // !INTERPOSE +} +static void SetAccessibilityViewportInfo_0_1(PP_Instance instance, const struct PP_PrivateAccessibilityViewportInfo* viewport_info) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_PDF\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"SetAccessibilityViewportInfo\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "viewport_info", ToString_PP_PrivateAccessibilityViewportInfo(viewport_info)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_PDF_0_1*)RealGetInterface("PPB_PDF;0.1"))->SetAccessibilityViewportInfo(instance, viewport_info); +#endif // !INTERPOSE +} +static void SetAccessibilityDocInfo_0_1(PP_Instance instance, const struct PP_PrivateAccessibilityDocInfo* doc_info) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_PDF\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"SetAccessibilityDocInfo\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "doc_info", ToString_PP_PrivateAccessibilityDocInfo(doc_info)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_PDF_0_1*)RealGetInterface("PPB_PDF;0.1"))->SetAccessibilityDocInfo(instance, doc_info); +#endif // !INTERPOSE +} +static void SetAccessibilityPageInfo_0_1(PP_Instance instance, const struct PP_PrivateAccessibilityPageInfo* page_info, const struct PP_PrivateAccessibilityTextRunInfo text_runs[], const struct PP_PrivateAccessibilityCharInfo chars[]) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_PDF\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"SetAccessibilityPageInfo\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "page_info", ToString_PP_PrivateAccessibilityPageInfo(page_info)); + { + BeginProp(ss, "text_runs"); + BeginElements(ss); + for (uint32_t _n = 0; _n < page_info->text_run_count; ++_n) { + AddElement(ss, ToString_PP_PrivateAccessibilityTextRunInfo(text_runs[_n])); + } + EndElements(ss); + } + { + BeginProp(ss, "chars"); + BeginElements(ss); + for (uint32_t _n = 0; _n < page_info->char_count; ++_n) { + AddElement(ss, ToString_PP_PrivateAccessibilityCharInfo(chars[_n])); + } + EndElements(ss); + } + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_PDF_0_1*)RealGetInterface("PPB_PDF;0.1"))->SetAccessibilityPageInfo(instance, page_info, text_runs, chars); +#endif // !INTERPOSE +} +static void SetCrashData_0_1(PP_Instance instance, const char* pdf_url, const char* top_level_url) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_PDF\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"SetCrashData\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "pdf_url", ToString_str_t(pdf_url)); + AddProp(ss, "top_level_url", ToString_str_t(top_level_url)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_PDF_0_1*)RealGetInterface("PPB_PDF;0.1"))->SetCrashData(instance, pdf_url, top_level_url); +#endif // !INTERPOSE +} +} +static PPB_PDF_0_1 _PPB_PDF_0_1 = { + ns_PPB_PDF_0_1::GetFontFileWithFallback_0_1, + ns_PPB_PDF_0_1::GetFontTableForPrivateFontFile_0_1, + ns_PPB_PDF_0_1::SearchString_0_1, + ns_PPB_PDF_0_1::DidStartLoading_0_1, + ns_PPB_PDF_0_1::DidStopLoading_0_1, + ns_PPB_PDF_0_1::SetContentRestriction_0_1, + ns_PPB_PDF_0_1::UserMetricsRecordAction_0_1, + ns_PPB_PDF_0_1::HasUnsupportedFeature_0_1, + ns_PPB_PDF_0_1::SaveAs_0_1, + ns_PPB_PDF_0_1::Print_0_1, + ns_PPB_PDF_0_1::IsFeatureEnabled_0_1, + ns_PPB_PDF_0_1::SetSelectedText_0_1, + ns_PPB_PDF_0_1::SetLinkUnderCursor_0_1, + ns_PPB_PDF_0_1::GetV8ExternalSnapshotData_0_1, + ns_PPB_PDF_0_1::SetAccessibilityViewportInfo_0_1, + ns_PPB_PDF_0_1::SetAccessibilityDocInfo_0_1, + ns_PPB_PDF_0_1::SetAccessibilityPageInfo_0_1, + ns_PPB_PDF_0_1::SetCrashData_0_1, +}; +const string ToString_PPB_PDF(const PPB_PDF_0_1 *v) { + stringstream s; + s << v; + return s.str(); +} +namespace ns_PPB_PlatformVerification_Private_0_2 { +static PP_Resource Create_0_2(PP_Instance instance) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_PlatformVerification_Private\""); + AddProp(ss, "__version", "\"0.2\""); + AddProp(ss, "__method", "\"Create\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Resource(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_PlatformVerification_Private_0_2*)RealGetInterface("PPB_PlatformVerification_Private;0.2"))->Create(instance); + printf("RPC response: ["); + printf("%s", ToString_PP_Resource(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool IsPlatformVerification_0_2(PP_Resource resource) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_PlatformVerification_Private\""); + AddProp(ss, "__version", "\"0.2\""); + AddProp(ss, "__method", "\"IsPlatformVerification\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_PlatformVerification_Private_0_2*)RealGetInterface("PPB_PlatformVerification_Private;0.2"))->IsPlatformVerification(resource); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t ChallengePlatform_0_2(PP_Resource instance, struct PP_Var service_id, struct PP_Var challenge, struct PP_Var* signed_data, struct PP_Var* signed_data_signature, struct PP_Var* platform_key_certificate, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_PlatformVerification_Private\""); + AddProp(ss, "__version", "\"0.2\""); + AddProp(ss, "__method", "\"ChallengePlatform\""); + AddProp(ss, "instance", ToString_PP_Resource(instance)); + AddProp(ss, "service_id", ToString_PP_Var(service_id)); + AddProp(ss, "challenge", ToString_PP_Var(challenge)); + AddProp(ss, "signed_data", PointerToString(signed_data)); + AddProp(ss, "signed_data_signature", PointerToString(signed_data_signature)); + AddProp(ss, "platform_key_certificate", PointerToString(platform_key_certificate)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + iterator.skip(); + FromJSON_PP_Var(iterator, *signed_data); + iterator.skip(); + FromJSON_PP_Var(iterator, *signed_data_signature); + iterator.skip(); + FromJSON_PP_Var(iterator, *platform_key_certificate); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_PlatformVerification_Private_0_2*)RealGetInterface("PPB_PlatformVerification_Private;0.2"))->ChallengePlatform(instance, service_id, challenge, signed_data, signed_data_signature, platform_key_certificate, logging_callback); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_int32_t(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + if (!!signed_data) { + AddProp(os, "signed_data", ToString_PP_Var(signed_data)); + } + if (!!signed_data_signature) { + AddProp(os, "signed_data_signature", ToString_PP_Var(signed_data_signature)); + } + if (!!platform_key_certificate) { + AddProp(os, "platform_key_certificate", ToString_PP_Var(platform_key_certificate)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +} +static PPB_PlatformVerification_Private_0_2 _PPB_PlatformVerification_Private_0_2 = { + ns_PPB_PlatformVerification_Private_0_2::Create_0_2, + ns_PPB_PlatformVerification_Private_0_2::IsPlatformVerification_0_2, + ns_PPB_PlatformVerification_Private_0_2::ChallengePlatform_0_2, +}; +const string ToString_PPB_PlatformVerification_Private(const PPB_PlatformVerification_Private_0_2 *v) { + stringstream s; + s << v; + return s.str(); +} +namespace ns_PPB_TCPServerSocket_Private_0_1 { +static PP_Resource Create_0_1(PP_Instance instance) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_TCPServerSocket_Private\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"Create\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Resource(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_TCPServerSocket_Private_0_1*)RealGetInterface("PPB_TCPServerSocket_Private;0.1"))->Create(instance); + printf("RPC response: ["); + printf("%s", ToString_PP_Resource(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool IsTCPServerSocket_0_1(PP_Resource resource) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_TCPServerSocket_Private\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"IsTCPServerSocket\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_TCPServerSocket_Private_0_1*)RealGetInterface("PPB_TCPServerSocket_Private;0.1"))->IsTCPServerSocket(resource); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t Listen_0_1(PP_Resource tcp_server_socket, const struct PP_NetAddress_Private* addr, int32_t backlog, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_TCPServerSocket_Private\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"Listen\""); + AddProp(ss, "tcp_server_socket", ToString_PP_Resource(tcp_server_socket)); + AddProp(ss, "addr", ToString_PP_NetAddress_Private(addr)); + AddProp(ss, "backlog", ToString_int32_t(backlog)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_TCPServerSocket_Private_0_1*)RealGetInterface("PPB_TCPServerSocket_Private;0.1"))->Listen(tcp_server_socket, addr, backlog, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t Accept_0_1(PP_Resource tcp_server_socket, PP_Resource* tcp_socket, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_TCPServerSocket_Private\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"Accept\""); + AddProp(ss, "tcp_server_socket", ToString_PP_Resource(tcp_server_socket)); + AddProp(ss, "tcp_socket", PointerToString(tcp_socket)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + iterator.skip(); + FromJSON_PP_Resource(iterator, *tcp_socket); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_TCPServerSocket_Private_0_1*)RealGetInterface("PPB_TCPServerSocket_Private;0.1"))->Accept(tcp_server_socket, tcp_socket, logging_callback); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_int32_t(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + if (!!tcp_socket) { + AddProp(os, "tcp_socket", ToString_PP_Resource(tcp_socket)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +/* skipping GetLocalAddress */ +static void StopListening_0_1(PP_Resource tcp_server_socket) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_TCPServerSocket_Private\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"StopListening\""); + AddProp(ss, "tcp_server_socket", ToString_PP_Resource(tcp_server_socket)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_TCPServerSocket_Private_0_1*)RealGetInterface("PPB_TCPServerSocket_Private;0.1"))->StopListening(tcp_server_socket); +#endif // !INTERPOSE +} +} +static PPB_TCPServerSocket_Private_0_1 _PPB_TCPServerSocket_Private_0_1 = { + ns_PPB_TCPServerSocket_Private_0_1::Create_0_1, + ns_PPB_TCPServerSocket_Private_0_1::IsTCPServerSocket_0_1, + ns_PPB_TCPServerSocket_Private_0_1::Listen_0_1, + ns_PPB_TCPServerSocket_Private_0_1::Accept_0_1, + ns_PPB_TCPServerSocket_Private_0_1::StopListening_0_1, +}; +const string ToString_PPB_TCPServerSocket_Private(const PPB_TCPServerSocket_Private_0_1 *v) { + stringstream s; + s << v; + return s.str(); +} +namespace ns_PPB_TCPServerSocket_Private_0_2 { +static PP_Resource Create_0_2(PP_Instance instance) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_TCPServerSocket_Private\""); + AddProp(ss, "__version", "\"0.2\""); + AddProp(ss, "__method", "\"Create\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Resource(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_TCPServerSocket_Private_0_2*)RealGetInterface("PPB_TCPServerSocket_Private;0.2"))->Create(instance); + printf("RPC response: ["); + printf("%s", ToString_PP_Resource(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool IsTCPServerSocket_0_2(PP_Resource resource) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_TCPServerSocket_Private\""); + AddProp(ss, "__version", "\"0.2\""); + AddProp(ss, "__method", "\"IsTCPServerSocket\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_TCPServerSocket_Private_0_2*)RealGetInterface("PPB_TCPServerSocket_Private;0.2"))->IsTCPServerSocket(resource); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t Listen_0_2(PP_Resource tcp_server_socket, const struct PP_NetAddress_Private* addr, int32_t backlog, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_TCPServerSocket_Private\""); + AddProp(ss, "__version", "\"0.2\""); + AddProp(ss, "__method", "\"Listen\""); + AddProp(ss, "tcp_server_socket", ToString_PP_Resource(tcp_server_socket)); + AddProp(ss, "addr", ToString_PP_NetAddress_Private(addr)); + AddProp(ss, "backlog", ToString_int32_t(backlog)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_TCPServerSocket_Private_0_2*)RealGetInterface("PPB_TCPServerSocket_Private;0.2"))->Listen(tcp_server_socket, addr, backlog, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t Accept_0_2(PP_Resource tcp_server_socket, PP_Resource* tcp_socket, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_TCPServerSocket_Private\""); + AddProp(ss, "__version", "\"0.2\""); + AddProp(ss, "__method", "\"Accept\""); + AddProp(ss, "tcp_server_socket", ToString_PP_Resource(tcp_server_socket)); + AddProp(ss, "tcp_socket", PointerToString(tcp_socket)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + iterator.skip(); + FromJSON_PP_Resource(iterator, *tcp_socket); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_TCPServerSocket_Private_0_2*)RealGetInterface("PPB_TCPServerSocket_Private;0.2"))->Accept(tcp_server_socket, tcp_socket, logging_callback); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_int32_t(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + if (!!tcp_socket) { + AddProp(os, "tcp_socket", ToString_PP_Resource(tcp_socket)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t GetLocalAddress_0_2(PP_Resource tcp_server_socket, struct PP_NetAddress_Private* addr) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_TCPServerSocket_Private\""); + AddProp(ss, "__version", "\"0.2\""); + AddProp(ss, "__method", "\"GetLocalAddress\""); + AddProp(ss, "tcp_server_socket", ToString_PP_Resource(tcp_server_socket)); + AddProp(ss, "addr", PointerToString(addr)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + if (!!addr) { + iterator.skip(); + FromJSON_PP_NetAddress_Private(iterator, *addr); + } + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_TCPServerSocket_Private_0_2*)RealGetInterface("PPB_TCPServerSocket_Private;0.2"))->GetLocalAddress(tcp_server_socket, addr); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_int32_t(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + if (!!addr) { + AddProp(os, "addr", ToString_PP_NetAddress_Private(addr)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static void StopListening_0_2(PP_Resource tcp_server_socket) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_TCPServerSocket_Private\""); + AddProp(ss, "__version", "\"0.2\""); + AddProp(ss, "__method", "\"StopListening\""); + AddProp(ss, "tcp_server_socket", ToString_PP_Resource(tcp_server_socket)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_TCPServerSocket_Private_0_2*)RealGetInterface("PPB_TCPServerSocket_Private;0.2"))->StopListening(tcp_server_socket); +#endif // !INTERPOSE +} +} +static PPB_TCPServerSocket_Private_0_2 _PPB_TCPServerSocket_Private_0_2 = { + ns_PPB_TCPServerSocket_Private_0_2::Create_0_2, + ns_PPB_TCPServerSocket_Private_0_2::IsTCPServerSocket_0_2, + ns_PPB_TCPServerSocket_Private_0_2::Listen_0_2, + ns_PPB_TCPServerSocket_Private_0_2::Accept_0_2, + ns_PPB_TCPServerSocket_Private_0_2::GetLocalAddress_0_2, + ns_PPB_TCPServerSocket_Private_0_2::StopListening_0_2, +}; +const string ToString_PPB_TCPServerSocket_Private(const PPB_TCPServerSocket_Private_0_2 *v) { + stringstream s; + s << v; + return s.str(); +} +const string ToString_PP_TCPSocketOption_Private(const PP_TCPSocketOption_Private *v) { + switch (*v) { + case 0: + return "\"PP_TCPSOCKETOPTION_PRIVATE_INVALID\""; + case 1: + return "\"PP_TCPSOCKETOPTION_PRIVATE_NO_DELAY\""; + default: + return "\"???\""; + } +} +const string ToString_PP_TCPSocketOption_Private(const PP_TCPSocketOption_Private &v) { + return ToString_PP_TCPSocketOption_Private(&v); +} +void FromJSON_PP_TCPSocketOption_Private(JSONIterator& iterator, PP_TCPSocketOption_Private &value) { + long int v; + FromJSON_int(iterator, v); + value = PP_TCPSocketOption_Private(v); +} +namespace ns_PPB_TCPSocket_Private_0_3 { +static PP_Resource Create_0_3(PP_Instance instance) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_TCPSocket_Private\""); + AddProp(ss, "__version", "\"0.3\""); + AddProp(ss, "__method", "\"Create\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Resource(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_TCPSocket_Private_0_3*)RealGetInterface("PPB_TCPSocket_Private;0.3"))->Create(instance); + printf("RPC response: ["); + printf("%s", ToString_PP_Resource(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool IsTCPSocket_0_3(PP_Resource resource) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_TCPSocket_Private\""); + AddProp(ss, "__version", "\"0.3\""); + AddProp(ss, "__method", "\"IsTCPSocket\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_TCPSocket_Private_0_3*)RealGetInterface("PPB_TCPSocket_Private;0.3"))->IsTCPSocket(resource); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t Connect_0_3(PP_Resource tcp_socket, const char* host, uint16_t port, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_TCPSocket_Private\""); + AddProp(ss, "__version", "\"0.3\""); + AddProp(ss, "__method", "\"Connect\""); + AddProp(ss, "tcp_socket", ToString_PP_Resource(tcp_socket)); + AddProp(ss, "host", ToString_str_t(host)); + AddProp(ss, "port", ToString_uint16_t(port)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_TCPSocket_Private_0_3*)RealGetInterface("PPB_TCPSocket_Private;0.3"))->Connect(tcp_socket, host, port, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t ConnectWithNetAddress_0_3(PP_Resource tcp_socket, const struct PP_NetAddress_Private* addr, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_TCPSocket_Private\""); + AddProp(ss, "__version", "\"0.3\""); + AddProp(ss, "__method", "\"ConnectWithNetAddress\""); + AddProp(ss, "tcp_socket", ToString_PP_Resource(tcp_socket)); + AddProp(ss, "addr", ToString_PP_NetAddress_Private(addr)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_TCPSocket_Private_0_3*)RealGetInterface("PPB_TCPSocket_Private;0.3"))->ConnectWithNetAddress(tcp_socket, addr, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool GetLocalAddress_0_3(PP_Resource tcp_socket, struct PP_NetAddress_Private* local_addr) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_TCPSocket_Private\""); + AddProp(ss, "__version", "\"0.3\""); + AddProp(ss, "__method", "\"GetLocalAddress\""); + AddProp(ss, "tcp_socket", ToString_PP_Resource(tcp_socket)); + AddProp(ss, "local_addr", PointerToString(local_addr)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + if (!!local_addr) { + iterator.skip(); + FromJSON_PP_NetAddress_Private(iterator, *local_addr); + } + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_TCPSocket_Private_0_3*)RealGetInterface("PPB_TCPSocket_Private;0.3"))->GetLocalAddress(tcp_socket, local_addr); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + if (!!local_addr) { + AddProp(os, "local_addr", ToString_PP_NetAddress_Private(local_addr)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool GetRemoteAddress_0_3(PP_Resource tcp_socket, struct PP_NetAddress_Private* remote_addr) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_TCPSocket_Private\""); + AddProp(ss, "__version", "\"0.3\""); + AddProp(ss, "__method", "\"GetRemoteAddress\""); + AddProp(ss, "tcp_socket", ToString_PP_Resource(tcp_socket)); + AddProp(ss, "remote_addr", PointerToString(remote_addr)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + if (!!remote_addr) { + iterator.skip(); + FromJSON_PP_NetAddress_Private(iterator, *remote_addr); + } + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_TCPSocket_Private_0_3*)RealGetInterface("PPB_TCPSocket_Private;0.3"))->GetRemoteAddress(tcp_socket, remote_addr); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + if (!!remote_addr) { + AddProp(os, "remote_addr", ToString_PP_NetAddress_Private(remote_addr)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t SSLHandshake_0_3(PP_Resource tcp_socket, const char* server_name, uint16_t server_port, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_TCPSocket_Private\""); + AddProp(ss, "__version", "\"0.3\""); + AddProp(ss, "__method", "\"SSLHandshake\""); + AddProp(ss, "tcp_socket", ToString_PP_Resource(tcp_socket)); + AddProp(ss, "server_name", ToString_str_t(server_name)); + AddProp(ss, "server_port", ToString_uint16_t(server_port)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_TCPSocket_Private_0_3*)RealGetInterface("PPB_TCPSocket_Private;0.3"))->SSLHandshake(tcp_socket, server_name, server_port, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +/* skipping GetServerCertificate */ +/* skipping AddChainBuildingCertificate */ +static int32_t Read_0_3(PP_Resource tcp_socket, char* buffer, int32_t bytes_to_read, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_TCPSocket_Private\""); + AddProp(ss, "__version", "\"0.3\""); + AddProp(ss, "__method", "\"Read\""); + AddProp(ss, "tcp_socket", ToString_PP_Resource(tcp_socket)); + AddProp(ss, "buffer", PointerToString(buffer)); + AddProp(ss, "bytes_to_read", ToString_int32_t(bytes_to_read)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + iterator.skip(); + FromJSON_str_t(iterator, buffer); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_TCPSocket_Private_0_3*)RealGetInterface("PPB_TCPSocket_Private;0.3"))->Read(tcp_socket, buffer, bytes_to_read, logging_callback); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_int32_t(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + AddProp(os, "buffer", ToString_str_t(buffer)); + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t Write_0_3(PP_Resource tcp_socket, const char* buffer, int32_t bytes_to_write, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_TCPSocket_Private\""); + AddProp(ss, "__version", "\"0.3\""); + AddProp(ss, "__method", "\"Write\""); + AddProp(ss, "tcp_socket", ToString_PP_Resource(tcp_socket)); + { + BeginProp(ss, "buffer"); + BeginElements(ss); + for (uint32_t _n = 0; _n < bytes_to_write; ++_n) { + AddElement(ss, ToString_uint8_t(buffer[_n])); + } + EndElements(ss); + } + AddProp(ss, "bytes_to_write", ToString_int32_t(bytes_to_write)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_TCPSocket_Private_0_3*)RealGetInterface("PPB_TCPSocket_Private;0.3"))->Write(tcp_socket, buffer, bytes_to_write, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static void Disconnect_0_3(PP_Resource tcp_socket) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_TCPSocket_Private\""); + AddProp(ss, "__version", "\"0.3\""); + AddProp(ss, "__method", "\"Disconnect\""); + AddProp(ss, "tcp_socket", ToString_PP_Resource(tcp_socket)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_TCPSocket_Private_0_3*)RealGetInterface("PPB_TCPSocket_Private;0.3"))->Disconnect(tcp_socket); +#endif // !INTERPOSE +} +/* skipping SetOption */ +} +static PPB_TCPSocket_Private_0_3 _PPB_TCPSocket_Private_0_3 = { + ns_PPB_TCPSocket_Private_0_3::Create_0_3, + ns_PPB_TCPSocket_Private_0_3::IsTCPSocket_0_3, + ns_PPB_TCPSocket_Private_0_3::Connect_0_3, + ns_PPB_TCPSocket_Private_0_3::ConnectWithNetAddress_0_3, + ns_PPB_TCPSocket_Private_0_3::GetLocalAddress_0_3, + ns_PPB_TCPSocket_Private_0_3::GetRemoteAddress_0_3, + ns_PPB_TCPSocket_Private_0_3::SSLHandshake_0_3, + ns_PPB_TCPSocket_Private_0_3::Read_0_3, + ns_PPB_TCPSocket_Private_0_3::Write_0_3, + ns_PPB_TCPSocket_Private_0_3::Disconnect_0_3, +}; +const string ToString_PPB_TCPSocket_Private(const PPB_TCPSocket_Private_0_3 *v) { + stringstream s; + s << v; + return s.str(); +} +namespace ns_PPB_TCPSocket_Private_0_4 { +static PP_Resource Create_0_4(PP_Instance instance) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_TCPSocket_Private\""); + AddProp(ss, "__version", "\"0.4\""); + AddProp(ss, "__method", "\"Create\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Resource(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_TCPSocket_Private_0_4*)RealGetInterface("PPB_TCPSocket_Private;0.4"))->Create(instance); + printf("RPC response: ["); + printf("%s", ToString_PP_Resource(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool IsTCPSocket_0_4(PP_Resource resource) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_TCPSocket_Private\""); + AddProp(ss, "__version", "\"0.4\""); + AddProp(ss, "__method", "\"IsTCPSocket\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_TCPSocket_Private_0_4*)RealGetInterface("PPB_TCPSocket_Private;0.4"))->IsTCPSocket(resource); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t Connect_0_4(PP_Resource tcp_socket, const char* host, uint16_t port, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_TCPSocket_Private\""); + AddProp(ss, "__version", "\"0.4\""); + AddProp(ss, "__method", "\"Connect\""); + AddProp(ss, "tcp_socket", ToString_PP_Resource(tcp_socket)); + AddProp(ss, "host", ToString_str_t(host)); + AddProp(ss, "port", ToString_uint16_t(port)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_TCPSocket_Private_0_4*)RealGetInterface("PPB_TCPSocket_Private;0.4"))->Connect(tcp_socket, host, port, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t ConnectWithNetAddress_0_4(PP_Resource tcp_socket, const struct PP_NetAddress_Private* addr, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_TCPSocket_Private\""); + AddProp(ss, "__version", "\"0.4\""); + AddProp(ss, "__method", "\"ConnectWithNetAddress\""); + AddProp(ss, "tcp_socket", ToString_PP_Resource(tcp_socket)); + AddProp(ss, "addr", ToString_PP_NetAddress_Private(addr)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_TCPSocket_Private_0_4*)RealGetInterface("PPB_TCPSocket_Private;0.4"))->ConnectWithNetAddress(tcp_socket, addr, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool GetLocalAddress_0_4(PP_Resource tcp_socket, struct PP_NetAddress_Private* local_addr) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_TCPSocket_Private\""); + AddProp(ss, "__version", "\"0.4\""); + AddProp(ss, "__method", "\"GetLocalAddress\""); + AddProp(ss, "tcp_socket", ToString_PP_Resource(tcp_socket)); + AddProp(ss, "local_addr", PointerToString(local_addr)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + if (!!local_addr) { + iterator.skip(); + FromJSON_PP_NetAddress_Private(iterator, *local_addr); + } + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_TCPSocket_Private_0_4*)RealGetInterface("PPB_TCPSocket_Private;0.4"))->GetLocalAddress(tcp_socket, local_addr); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + if (!!local_addr) { + AddProp(os, "local_addr", ToString_PP_NetAddress_Private(local_addr)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool GetRemoteAddress_0_4(PP_Resource tcp_socket, struct PP_NetAddress_Private* remote_addr) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_TCPSocket_Private\""); + AddProp(ss, "__version", "\"0.4\""); + AddProp(ss, "__method", "\"GetRemoteAddress\""); + AddProp(ss, "tcp_socket", ToString_PP_Resource(tcp_socket)); + AddProp(ss, "remote_addr", PointerToString(remote_addr)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + if (!!remote_addr) { + iterator.skip(); + FromJSON_PP_NetAddress_Private(iterator, *remote_addr); + } + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_TCPSocket_Private_0_4*)RealGetInterface("PPB_TCPSocket_Private;0.4"))->GetRemoteAddress(tcp_socket, remote_addr); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + if (!!remote_addr) { + AddProp(os, "remote_addr", ToString_PP_NetAddress_Private(remote_addr)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t SSLHandshake_0_4(PP_Resource tcp_socket, const char* server_name, uint16_t server_port, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_TCPSocket_Private\""); + AddProp(ss, "__version", "\"0.4\""); + AddProp(ss, "__method", "\"SSLHandshake\""); + AddProp(ss, "tcp_socket", ToString_PP_Resource(tcp_socket)); + AddProp(ss, "server_name", ToString_str_t(server_name)); + AddProp(ss, "server_port", ToString_uint16_t(server_port)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_TCPSocket_Private_0_4*)RealGetInterface("PPB_TCPSocket_Private;0.4"))->SSLHandshake(tcp_socket, server_name, server_port, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Resource GetServerCertificate_0_4(PP_Resource tcp_socket) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_TCPSocket_Private\""); + AddProp(ss, "__version", "\"0.4\""); + AddProp(ss, "__method", "\"GetServerCertificate\""); + AddProp(ss, "tcp_socket", ToString_PP_Resource(tcp_socket)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Resource(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_TCPSocket_Private_0_4*)RealGetInterface("PPB_TCPSocket_Private;0.4"))->GetServerCertificate(tcp_socket); + printf("RPC response: ["); + printf("%s", ToString_PP_Resource(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool AddChainBuildingCertificate_0_4(PP_Resource tcp_socket, PP_Resource certificate, PP_Bool is_trusted) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_TCPSocket_Private\""); + AddProp(ss, "__version", "\"0.4\""); + AddProp(ss, "__method", "\"AddChainBuildingCertificate\""); + AddProp(ss, "tcp_socket", ToString_PP_Resource(tcp_socket)); + AddProp(ss, "certificate", ToString_PP_Resource(certificate)); + AddProp(ss, "is_trusted", ToString_PP_Bool(is_trusted)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_TCPSocket_Private_0_4*)RealGetInterface("PPB_TCPSocket_Private;0.4"))->AddChainBuildingCertificate(tcp_socket, certificate, is_trusted); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t Read_0_4(PP_Resource tcp_socket, char* buffer, int32_t bytes_to_read, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_TCPSocket_Private\""); + AddProp(ss, "__version", "\"0.4\""); + AddProp(ss, "__method", "\"Read\""); + AddProp(ss, "tcp_socket", ToString_PP_Resource(tcp_socket)); + AddProp(ss, "buffer", PointerToString(buffer)); + AddProp(ss, "bytes_to_read", ToString_int32_t(bytes_to_read)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + iterator.skip(); + FromJSON_str_t(iterator, buffer); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_TCPSocket_Private_0_4*)RealGetInterface("PPB_TCPSocket_Private;0.4"))->Read(tcp_socket, buffer, bytes_to_read, logging_callback); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_int32_t(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + AddProp(os, "buffer", ToString_str_t(buffer)); + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t Write_0_4(PP_Resource tcp_socket, const char* buffer, int32_t bytes_to_write, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_TCPSocket_Private\""); + AddProp(ss, "__version", "\"0.4\""); + AddProp(ss, "__method", "\"Write\""); + AddProp(ss, "tcp_socket", ToString_PP_Resource(tcp_socket)); + { + BeginProp(ss, "buffer"); + BeginElements(ss); + for (uint32_t _n = 0; _n < bytes_to_write; ++_n) { + AddElement(ss, ToString_uint8_t(buffer[_n])); + } + EndElements(ss); + } + AddProp(ss, "bytes_to_write", ToString_int32_t(bytes_to_write)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_TCPSocket_Private_0_4*)RealGetInterface("PPB_TCPSocket_Private;0.4"))->Write(tcp_socket, buffer, bytes_to_write, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static void Disconnect_0_4(PP_Resource tcp_socket) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_TCPSocket_Private\""); + AddProp(ss, "__version", "\"0.4\""); + AddProp(ss, "__method", "\"Disconnect\""); + AddProp(ss, "tcp_socket", ToString_PP_Resource(tcp_socket)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_TCPSocket_Private_0_4*)RealGetInterface("PPB_TCPSocket_Private;0.4"))->Disconnect(tcp_socket); +#endif // !INTERPOSE +} +/* skipping SetOption */ +} +static PPB_TCPSocket_Private_0_4 _PPB_TCPSocket_Private_0_4 = { + ns_PPB_TCPSocket_Private_0_4::Create_0_4, + ns_PPB_TCPSocket_Private_0_4::IsTCPSocket_0_4, + ns_PPB_TCPSocket_Private_0_4::Connect_0_4, + ns_PPB_TCPSocket_Private_0_4::ConnectWithNetAddress_0_4, + ns_PPB_TCPSocket_Private_0_4::GetLocalAddress_0_4, + ns_PPB_TCPSocket_Private_0_4::GetRemoteAddress_0_4, + ns_PPB_TCPSocket_Private_0_4::SSLHandshake_0_4, + ns_PPB_TCPSocket_Private_0_4::GetServerCertificate_0_4, + ns_PPB_TCPSocket_Private_0_4::AddChainBuildingCertificate_0_4, + ns_PPB_TCPSocket_Private_0_4::Read_0_4, + ns_PPB_TCPSocket_Private_0_4::Write_0_4, + ns_PPB_TCPSocket_Private_0_4::Disconnect_0_4, +}; +const string ToString_PPB_TCPSocket_Private(const PPB_TCPSocket_Private_0_4 *v) { + stringstream s; + s << v; + return s.str(); +} +namespace ns_PPB_TCPSocket_Private_0_5 { +static PP_Resource Create_0_5(PP_Instance instance) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_TCPSocket_Private\""); + AddProp(ss, "__version", "\"0.5\""); + AddProp(ss, "__method", "\"Create\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Resource(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_TCPSocket_Private_0_5*)RealGetInterface("PPB_TCPSocket_Private;0.5"))->Create(instance); + printf("RPC response: ["); + printf("%s", ToString_PP_Resource(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool IsTCPSocket_0_5(PP_Resource resource) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_TCPSocket_Private\""); + AddProp(ss, "__version", "\"0.5\""); + AddProp(ss, "__method", "\"IsTCPSocket\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_TCPSocket_Private_0_5*)RealGetInterface("PPB_TCPSocket_Private;0.5"))->IsTCPSocket(resource); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t Connect_0_5(PP_Resource tcp_socket, const char* host, uint16_t port, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_TCPSocket_Private\""); + AddProp(ss, "__version", "\"0.5\""); + AddProp(ss, "__method", "\"Connect\""); + AddProp(ss, "tcp_socket", ToString_PP_Resource(tcp_socket)); + AddProp(ss, "host", ToString_str_t(host)); + AddProp(ss, "port", ToString_uint16_t(port)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_TCPSocket_Private_0_5*)RealGetInterface("PPB_TCPSocket_Private;0.5"))->Connect(tcp_socket, host, port, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t ConnectWithNetAddress_0_5(PP_Resource tcp_socket, const struct PP_NetAddress_Private* addr, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_TCPSocket_Private\""); + AddProp(ss, "__version", "\"0.5\""); + AddProp(ss, "__method", "\"ConnectWithNetAddress\""); + AddProp(ss, "tcp_socket", ToString_PP_Resource(tcp_socket)); + AddProp(ss, "addr", ToString_PP_NetAddress_Private(addr)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_TCPSocket_Private_0_5*)RealGetInterface("PPB_TCPSocket_Private;0.5"))->ConnectWithNetAddress(tcp_socket, addr, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool GetLocalAddress_0_5(PP_Resource tcp_socket, struct PP_NetAddress_Private* local_addr) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_TCPSocket_Private\""); + AddProp(ss, "__version", "\"0.5\""); + AddProp(ss, "__method", "\"GetLocalAddress\""); + AddProp(ss, "tcp_socket", ToString_PP_Resource(tcp_socket)); + AddProp(ss, "local_addr", PointerToString(local_addr)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + if (!!local_addr) { + iterator.skip(); + FromJSON_PP_NetAddress_Private(iterator, *local_addr); + } + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_TCPSocket_Private_0_5*)RealGetInterface("PPB_TCPSocket_Private;0.5"))->GetLocalAddress(tcp_socket, local_addr); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + if (!!local_addr) { + AddProp(os, "local_addr", ToString_PP_NetAddress_Private(local_addr)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool GetRemoteAddress_0_5(PP_Resource tcp_socket, struct PP_NetAddress_Private* remote_addr) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_TCPSocket_Private\""); + AddProp(ss, "__version", "\"0.5\""); + AddProp(ss, "__method", "\"GetRemoteAddress\""); + AddProp(ss, "tcp_socket", ToString_PP_Resource(tcp_socket)); + AddProp(ss, "remote_addr", PointerToString(remote_addr)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + if (!!remote_addr) { + iterator.skip(); + FromJSON_PP_NetAddress_Private(iterator, *remote_addr); + } + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_TCPSocket_Private_0_5*)RealGetInterface("PPB_TCPSocket_Private;0.5"))->GetRemoteAddress(tcp_socket, remote_addr); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + if (!!remote_addr) { + AddProp(os, "remote_addr", ToString_PP_NetAddress_Private(remote_addr)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t SSLHandshake_0_5(PP_Resource tcp_socket, const char* server_name, uint16_t server_port, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_TCPSocket_Private\""); + AddProp(ss, "__version", "\"0.5\""); + AddProp(ss, "__method", "\"SSLHandshake\""); + AddProp(ss, "tcp_socket", ToString_PP_Resource(tcp_socket)); + AddProp(ss, "server_name", ToString_str_t(server_name)); + AddProp(ss, "server_port", ToString_uint16_t(server_port)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_TCPSocket_Private_0_5*)RealGetInterface("PPB_TCPSocket_Private;0.5"))->SSLHandshake(tcp_socket, server_name, server_port, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Resource GetServerCertificate_0_5(PP_Resource tcp_socket) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_TCPSocket_Private\""); + AddProp(ss, "__version", "\"0.5\""); + AddProp(ss, "__method", "\"GetServerCertificate\""); + AddProp(ss, "tcp_socket", ToString_PP_Resource(tcp_socket)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Resource(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_TCPSocket_Private_0_5*)RealGetInterface("PPB_TCPSocket_Private;0.5"))->GetServerCertificate(tcp_socket); + printf("RPC response: ["); + printf("%s", ToString_PP_Resource(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool AddChainBuildingCertificate_0_5(PP_Resource tcp_socket, PP_Resource certificate, PP_Bool is_trusted) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_TCPSocket_Private\""); + AddProp(ss, "__version", "\"0.5\""); + AddProp(ss, "__method", "\"AddChainBuildingCertificate\""); + AddProp(ss, "tcp_socket", ToString_PP_Resource(tcp_socket)); + AddProp(ss, "certificate", ToString_PP_Resource(certificate)); + AddProp(ss, "is_trusted", ToString_PP_Bool(is_trusted)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_TCPSocket_Private_0_5*)RealGetInterface("PPB_TCPSocket_Private;0.5"))->AddChainBuildingCertificate(tcp_socket, certificate, is_trusted); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t Read_0_5(PP_Resource tcp_socket, char* buffer, int32_t bytes_to_read, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_TCPSocket_Private\""); + AddProp(ss, "__version", "\"0.5\""); + AddProp(ss, "__method", "\"Read\""); + AddProp(ss, "tcp_socket", ToString_PP_Resource(tcp_socket)); + AddProp(ss, "buffer", PointerToString(buffer)); + AddProp(ss, "bytes_to_read", ToString_int32_t(bytes_to_read)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + iterator.skip(); + FromJSON_str_t(iterator, buffer); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_TCPSocket_Private_0_5*)RealGetInterface("PPB_TCPSocket_Private;0.5"))->Read(tcp_socket, buffer, bytes_to_read, logging_callback); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_int32_t(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + AddProp(os, "buffer", ToString_str_t(buffer)); + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t Write_0_5(PP_Resource tcp_socket, const char* buffer, int32_t bytes_to_write, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_TCPSocket_Private\""); + AddProp(ss, "__version", "\"0.5\""); + AddProp(ss, "__method", "\"Write\""); + AddProp(ss, "tcp_socket", ToString_PP_Resource(tcp_socket)); + { + BeginProp(ss, "buffer"); + BeginElements(ss); + for (uint32_t _n = 0; _n < bytes_to_write; ++_n) { + AddElement(ss, ToString_uint8_t(buffer[_n])); + } + EndElements(ss); + } + AddProp(ss, "bytes_to_write", ToString_int32_t(bytes_to_write)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_TCPSocket_Private_0_5*)RealGetInterface("PPB_TCPSocket_Private;0.5"))->Write(tcp_socket, buffer, bytes_to_write, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static void Disconnect_0_5(PP_Resource tcp_socket) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_TCPSocket_Private\""); + AddProp(ss, "__version", "\"0.5\""); + AddProp(ss, "__method", "\"Disconnect\""); + AddProp(ss, "tcp_socket", ToString_PP_Resource(tcp_socket)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_TCPSocket_Private_0_5*)RealGetInterface("PPB_TCPSocket_Private;0.5"))->Disconnect(tcp_socket); +#endif // !INTERPOSE +} +static int32_t SetOption_0_5(PP_Resource tcp_socket, PP_TCPSocketOption_Private name, struct PP_Var value, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_TCPSocket_Private\""); + AddProp(ss, "__version", "\"0.5\""); + AddProp(ss, "__method", "\"SetOption\""); + AddProp(ss, "tcp_socket", ToString_PP_Resource(tcp_socket)); + AddProp(ss, "name", ToString_PP_TCPSocketOption_Private(name)); + AddProp(ss, "value", ToString_PP_Var(value)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_TCPSocket_Private_0_5*)RealGetInterface("PPB_TCPSocket_Private;0.5"))->SetOption(tcp_socket, name, value, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +} +static PPB_TCPSocket_Private_0_5 _PPB_TCPSocket_Private_0_5 = { + ns_PPB_TCPSocket_Private_0_5::Create_0_5, + ns_PPB_TCPSocket_Private_0_5::IsTCPSocket_0_5, + ns_PPB_TCPSocket_Private_0_5::Connect_0_5, + ns_PPB_TCPSocket_Private_0_5::ConnectWithNetAddress_0_5, + ns_PPB_TCPSocket_Private_0_5::GetLocalAddress_0_5, + ns_PPB_TCPSocket_Private_0_5::GetRemoteAddress_0_5, + ns_PPB_TCPSocket_Private_0_5::SSLHandshake_0_5, + ns_PPB_TCPSocket_Private_0_5::GetServerCertificate_0_5, + ns_PPB_TCPSocket_Private_0_5::AddChainBuildingCertificate_0_5, + ns_PPB_TCPSocket_Private_0_5::Read_0_5, + ns_PPB_TCPSocket_Private_0_5::Write_0_5, + ns_PPB_TCPSocket_Private_0_5::Disconnect_0_5, + ns_PPB_TCPSocket_Private_0_5::SetOption_0_5, +}; +const string ToString_PPB_TCPSocket_Private(const PPB_TCPSocket_Private_0_5 *v) { + stringstream s; + s << v; + return s.str(); +} +namespace ns_PPB_Testing_Private_1_0 { +static PP_Bool ReadImageData_1_0(PP_Resource device_context_2d, PP_Resource image, const struct PP_Point* top_left) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Testing_Private\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"ReadImageData\""); + AddProp(ss, "device_context_2d", ToString_PP_Resource(device_context_2d)); + AddProp(ss, "image", ToString_PP_Resource(image)); + AddProp(ss, "top_left", ToString_PP_Point(top_left)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_Testing_Private_1_0*)RealGetInterface("PPB_Testing_Private;1.0"))->ReadImageData(device_context_2d, image, top_left); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static void RunMessageLoop_1_0(PP_Instance instance) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Testing_Private\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"RunMessageLoop\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_Testing_Private_1_0*)RealGetInterface("PPB_Testing_Private;1.0"))->RunMessageLoop(instance); +#endif // !INTERPOSE +} +static void QuitMessageLoop_1_0(PP_Instance instance) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Testing_Private\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"QuitMessageLoop\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_Testing_Private_1_0*)RealGetInterface("PPB_Testing_Private;1.0"))->QuitMessageLoop(instance); +#endif // !INTERPOSE +} +static uint32_t GetLiveObjectsForInstance_1_0(PP_Instance instance) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Testing_Private\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"GetLiveObjectsForInstance\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + uint32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_uint32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + uint32_t rval = ((PPB_Testing_Private_1_0*)RealGetInterface("PPB_Testing_Private;1.0"))->GetLiveObjectsForInstance(instance); + printf("RPC response: ["); + printf("%s", ToString_uint32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool IsOutOfProcess_1_0(void) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Testing_Private\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"IsOutOfProcess\""); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_Testing_Private_1_0*)RealGetInterface("PPB_Testing_Private;1.0"))->IsOutOfProcess(); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static void PostPowerSaverStatus_1_0(PP_Instance instance) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Testing_Private\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"PostPowerSaverStatus\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_Testing_Private_1_0*)RealGetInterface("PPB_Testing_Private;1.0"))->PostPowerSaverStatus(instance); +#endif // !INTERPOSE +} +static void SubscribeToPowerSaverNotifications_1_0(PP_Instance instance) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Testing_Private\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"SubscribeToPowerSaverNotifications\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_Testing_Private_1_0*)RealGetInterface("PPB_Testing_Private;1.0"))->SubscribeToPowerSaverNotifications(instance); +#endif // !INTERPOSE +} +static void SimulateInputEvent_1_0(PP_Instance instance, PP_Resource input_event) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Testing_Private\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"SimulateInputEvent\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "input_event", ToString_PP_Resource(input_event)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_Testing_Private_1_0*)RealGetInterface("PPB_Testing_Private;1.0"))->SimulateInputEvent(instance, input_event); +#endif // !INTERPOSE +} +static struct PP_Var GetDocumentURL_1_0(PP_Instance instance, struct PP_URLComponents_Dev* components) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Testing_Private\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"GetDocumentURL\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "components", PointerToString(components)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + struct PP_Var rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Var(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + if (!!components) { + iterator.skip(); + FromJSON_PP_URLComponents_Dev(iterator, *components); + } + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + struct PP_Var rval = ((PPB_Testing_Private_1_0*)RealGetInterface("PPB_Testing_Private;1.0"))->GetDocumentURL(instance, components); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_PP_Var(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + if (!!components) { + AddProp(os, "components", ToString_PP_URLComponents_Dev(components)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static uint32_t GetLiveVars_1_0(struct PP_Var live_vars[], uint32_t array_size) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Testing_Private\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"GetLiveVars\""); + { + BeginProp(ss, "live_vars"); + BeginElements(ss); + for (uint32_t _n = 0; _n < array_size; ++_n) { + AddElement(ss, ToString_PP_Var(live_vars[_n])); + } + EndElements(ss); + } + AddProp(ss, "array_size", ToString_uint32_t(array_size)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + uint32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_uint32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + uint32_t rval = ((PPB_Testing_Private_1_0*)RealGetInterface("PPB_Testing_Private;1.0"))->GetLiveVars(live_vars, array_size); + printf("RPC response: ["); + printf("%s", ToString_uint32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static void SetMinimumArrayBufferSizeForShmem_1_0(PP_Instance instance, uint32_t threshold) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Testing_Private\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"SetMinimumArrayBufferSizeForShmem\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "threshold", ToString_uint32_t(threshold)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_Testing_Private_1_0*)RealGetInterface("PPB_Testing_Private;1.0"))->SetMinimumArrayBufferSizeForShmem(instance, threshold); +#endif // !INTERPOSE +} +static void RunV8GC_1_0(PP_Instance instance) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_Testing_Private\""); + AddProp(ss, "__version", "\"1.0\""); + AddProp(ss, "__method", "\"RunV8GC\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_Testing_Private_1_0*)RealGetInterface("PPB_Testing_Private;1.0"))->RunV8GC(instance); +#endif // !INTERPOSE +} +} +static PPB_Testing_Private_1_0 _PPB_Testing_Private_1_0 = { + ns_PPB_Testing_Private_1_0::ReadImageData_1_0, + ns_PPB_Testing_Private_1_0::RunMessageLoop_1_0, + ns_PPB_Testing_Private_1_0::QuitMessageLoop_1_0, + ns_PPB_Testing_Private_1_0::GetLiveObjectsForInstance_1_0, + ns_PPB_Testing_Private_1_0::IsOutOfProcess_1_0, + ns_PPB_Testing_Private_1_0::PostPowerSaverStatus_1_0, + ns_PPB_Testing_Private_1_0::SubscribeToPowerSaverNotifications_1_0, + ns_PPB_Testing_Private_1_0::SimulateInputEvent_1_0, + ns_PPB_Testing_Private_1_0::GetDocumentURL_1_0, + ns_PPB_Testing_Private_1_0::GetLiveVars_1_0, + ns_PPB_Testing_Private_1_0::SetMinimumArrayBufferSizeForShmem_1_0, + ns_PPB_Testing_Private_1_0::RunV8GC_1_0, +}; +const string ToString_PPB_Testing_Private(const PPB_Testing_Private_1_0 *v) { + stringstream s; + s << v; + return s.str(); +} +const string ToString_PP_UDPSocketFeature_Private(const PP_UDPSocketFeature_Private *v) { + switch (*v) { + case 0: + return "\"PP_UDPSOCKETFEATURE_PRIVATE_ADDRESS_REUSE\""; + case 1: + return "\"PP_UDPSOCKETFEATURE_PRIVATE_BROADCAST\""; + case 2: + return "\"PP_UDPSOCKETFEATURE_PRIVATE_COUNT\""; + default: + return "\"???\""; + } +} +const string ToString_PP_UDPSocketFeature_Private(const PP_UDPSocketFeature_Private &v) { + return ToString_PP_UDPSocketFeature_Private(&v); +} +void FromJSON_PP_UDPSocketFeature_Private(JSONIterator& iterator, PP_UDPSocketFeature_Private &value) { + long int v; + FromJSON_int(iterator, v); + value = PP_UDPSocketFeature_Private(v); +} +namespace ns_PPB_UDPSocket_Private_0_2 { +static PP_Resource Create_0_2(PP_Instance instance_id) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_UDPSocket_Private\""); + AddProp(ss, "__version", "\"0.2\""); + AddProp(ss, "__method", "\"Create\""); + AddProp(ss, "instance_id", ToString_PP_Instance(instance_id)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Resource(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_UDPSocket_Private_0_2*)RealGetInterface("PPB_UDPSocket_Private;0.2"))->Create(instance_id); + printf("RPC response: ["); + printf("%s", ToString_PP_Resource(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool IsUDPSocket_0_2(PP_Resource resource_id) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_UDPSocket_Private\""); + AddProp(ss, "__version", "\"0.2\""); + AddProp(ss, "__method", "\"IsUDPSocket\""); + AddProp(ss, "resource_id", ToString_PP_Resource(resource_id)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_UDPSocket_Private_0_2*)RealGetInterface("PPB_UDPSocket_Private;0.2"))->IsUDPSocket(resource_id); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +/* skipping SetSocketFeature */ +static int32_t Bind_0_2(PP_Resource udp_socket, const struct PP_NetAddress_Private* addr, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_UDPSocket_Private\""); + AddProp(ss, "__version", "\"0.2\""); + AddProp(ss, "__method", "\"Bind\""); + AddProp(ss, "udp_socket", ToString_PP_Resource(udp_socket)); + AddProp(ss, "addr", ToString_PP_NetAddress_Private(addr)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_UDPSocket_Private_0_2*)RealGetInterface("PPB_UDPSocket_Private;0.2"))->Bind(udp_socket, addr, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +/* skipping GetBoundAddress */ +static int32_t RecvFrom_0_2(PP_Resource udp_socket, char* buffer, int32_t num_bytes, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_UDPSocket_Private\""); + AddProp(ss, "__version", "\"0.2\""); + AddProp(ss, "__method", "\"RecvFrom\""); + AddProp(ss, "udp_socket", ToString_PP_Resource(udp_socket)); + AddProp(ss, "buffer", PointerToString(buffer)); + AddProp(ss, "num_bytes", ToString_int32_t(num_bytes)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + iterator.skip(); + FromJSON_str_t(iterator, buffer); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_UDPSocket_Private_0_2*)RealGetInterface("PPB_UDPSocket_Private;0.2"))->RecvFrom(udp_socket, buffer, num_bytes, logging_callback); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_int32_t(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + AddProp(os, "buffer", ToString_str_t(buffer)); + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool GetRecvFromAddress_0_2(PP_Resource udp_socket, struct PP_NetAddress_Private* addr) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_UDPSocket_Private\""); + AddProp(ss, "__version", "\"0.2\""); + AddProp(ss, "__method", "\"GetRecvFromAddress\""); + AddProp(ss, "udp_socket", ToString_PP_Resource(udp_socket)); + AddProp(ss, "addr", PointerToString(addr)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + if (!!addr) { + iterator.skip(); + FromJSON_PP_NetAddress_Private(iterator, *addr); + } + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_UDPSocket_Private_0_2*)RealGetInterface("PPB_UDPSocket_Private;0.2"))->GetRecvFromAddress(udp_socket, addr); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + if (!!addr) { + AddProp(os, "addr", ToString_PP_NetAddress_Private(addr)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t SendTo_0_2(PP_Resource udp_socket, const char* buffer, int32_t num_bytes, const struct PP_NetAddress_Private* addr, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_UDPSocket_Private\""); + AddProp(ss, "__version", "\"0.2\""); + AddProp(ss, "__method", "\"SendTo\""); + AddProp(ss, "udp_socket", ToString_PP_Resource(udp_socket)); + AddProp(ss, "buffer", ToString_str_t(buffer)); + AddProp(ss, "num_bytes", ToString_int32_t(num_bytes)); + AddProp(ss, "addr", ToString_PP_NetAddress_Private(addr)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_UDPSocket_Private_0_2*)RealGetInterface("PPB_UDPSocket_Private;0.2"))->SendTo(udp_socket, buffer, num_bytes, addr, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static void Close_0_2(PP_Resource udp_socket) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_UDPSocket_Private\""); + AddProp(ss, "__version", "\"0.2\""); + AddProp(ss, "__method", "\"Close\""); + AddProp(ss, "udp_socket", ToString_PP_Resource(udp_socket)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_UDPSocket_Private_0_2*)RealGetInterface("PPB_UDPSocket_Private;0.2"))->Close(udp_socket); +#endif // !INTERPOSE +} +} +static PPB_UDPSocket_Private_0_2 _PPB_UDPSocket_Private_0_2 = { + ns_PPB_UDPSocket_Private_0_2::Create_0_2, + ns_PPB_UDPSocket_Private_0_2::IsUDPSocket_0_2, + ns_PPB_UDPSocket_Private_0_2::Bind_0_2, + ns_PPB_UDPSocket_Private_0_2::RecvFrom_0_2, + ns_PPB_UDPSocket_Private_0_2::GetRecvFromAddress_0_2, + ns_PPB_UDPSocket_Private_0_2::SendTo_0_2, + ns_PPB_UDPSocket_Private_0_2::Close_0_2, +}; +const string ToString_PPB_UDPSocket_Private(const PPB_UDPSocket_Private_0_2 *v) { + stringstream s; + s << v; + return s.str(); +} +namespace ns_PPB_UDPSocket_Private_0_3 { +static PP_Resource Create_0_3(PP_Instance instance_id) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_UDPSocket_Private\""); + AddProp(ss, "__version", "\"0.3\""); + AddProp(ss, "__method", "\"Create\""); + AddProp(ss, "instance_id", ToString_PP_Instance(instance_id)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Resource(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_UDPSocket_Private_0_3*)RealGetInterface("PPB_UDPSocket_Private;0.3"))->Create(instance_id); + printf("RPC response: ["); + printf("%s", ToString_PP_Resource(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool IsUDPSocket_0_3(PP_Resource resource_id) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_UDPSocket_Private\""); + AddProp(ss, "__version", "\"0.3\""); + AddProp(ss, "__method", "\"IsUDPSocket\""); + AddProp(ss, "resource_id", ToString_PP_Resource(resource_id)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_UDPSocket_Private_0_3*)RealGetInterface("PPB_UDPSocket_Private;0.3"))->IsUDPSocket(resource_id); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +/* skipping SetSocketFeature */ +static int32_t Bind_0_3(PP_Resource udp_socket, const struct PP_NetAddress_Private* addr, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_UDPSocket_Private\""); + AddProp(ss, "__version", "\"0.3\""); + AddProp(ss, "__method", "\"Bind\""); + AddProp(ss, "udp_socket", ToString_PP_Resource(udp_socket)); + AddProp(ss, "addr", ToString_PP_NetAddress_Private(addr)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_UDPSocket_Private_0_3*)RealGetInterface("PPB_UDPSocket_Private;0.3"))->Bind(udp_socket, addr, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool GetBoundAddress_0_3(PP_Resource udp_socket, struct PP_NetAddress_Private* addr) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_UDPSocket_Private\""); + AddProp(ss, "__version", "\"0.3\""); + AddProp(ss, "__method", "\"GetBoundAddress\""); + AddProp(ss, "udp_socket", ToString_PP_Resource(udp_socket)); + AddProp(ss, "addr", PointerToString(addr)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + if (!!addr) { + iterator.skip(); + FromJSON_PP_NetAddress_Private(iterator, *addr); + } + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_UDPSocket_Private_0_3*)RealGetInterface("PPB_UDPSocket_Private;0.3"))->GetBoundAddress(udp_socket, addr); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + if (!!addr) { + AddProp(os, "addr", ToString_PP_NetAddress_Private(addr)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t RecvFrom_0_3(PP_Resource udp_socket, char* buffer, int32_t num_bytes, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_UDPSocket_Private\""); + AddProp(ss, "__version", "\"0.3\""); + AddProp(ss, "__method", "\"RecvFrom\""); + AddProp(ss, "udp_socket", ToString_PP_Resource(udp_socket)); + AddProp(ss, "buffer", PointerToString(buffer)); + AddProp(ss, "num_bytes", ToString_int32_t(num_bytes)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + iterator.skip(); + FromJSON_str_t(iterator, buffer); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_UDPSocket_Private_0_3*)RealGetInterface("PPB_UDPSocket_Private;0.3"))->RecvFrom(udp_socket, buffer, num_bytes, logging_callback); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_int32_t(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + AddProp(os, "buffer", ToString_str_t(buffer)); + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool GetRecvFromAddress_0_3(PP_Resource udp_socket, struct PP_NetAddress_Private* addr) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_UDPSocket_Private\""); + AddProp(ss, "__version", "\"0.3\""); + AddProp(ss, "__method", "\"GetRecvFromAddress\""); + AddProp(ss, "udp_socket", ToString_PP_Resource(udp_socket)); + AddProp(ss, "addr", PointerToString(addr)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + if (!!addr) { + iterator.skip(); + FromJSON_PP_NetAddress_Private(iterator, *addr); + } + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_UDPSocket_Private_0_3*)RealGetInterface("PPB_UDPSocket_Private;0.3"))->GetRecvFromAddress(udp_socket, addr); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + if (!!addr) { + AddProp(os, "addr", ToString_PP_NetAddress_Private(addr)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t SendTo_0_3(PP_Resource udp_socket, const char* buffer, int32_t num_bytes, const struct PP_NetAddress_Private* addr, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_UDPSocket_Private\""); + AddProp(ss, "__version", "\"0.3\""); + AddProp(ss, "__method", "\"SendTo\""); + AddProp(ss, "udp_socket", ToString_PP_Resource(udp_socket)); + AddProp(ss, "buffer", ToString_str_t(buffer)); + AddProp(ss, "num_bytes", ToString_int32_t(num_bytes)); + AddProp(ss, "addr", ToString_PP_NetAddress_Private(addr)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_UDPSocket_Private_0_3*)RealGetInterface("PPB_UDPSocket_Private;0.3"))->SendTo(udp_socket, buffer, num_bytes, addr, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static void Close_0_3(PP_Resource udp_socket) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_UDPSocket_Private\""); + AddProp(ss, "__version", "\"0.3\""); + AddProp(ss, "__method", "\"Close\""); + AddProp(ss, "udp_socket", ToString_PP_Resource(udp_socket)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_UDPSocket_Private_0_3*)RealGetInterface("PPB_UDPSocket_Private;0.3"))->Close(udp_socket); +#endif // !INTERPOSE +} +} +static PPB_UDPSocket_Private_0_3 _PPB_UDPSocket_Private_0_3 = { + ns_PPB_UDPSocket_Private_0_3::Create_0_3, + ns_PPB_UDPSocket_Private_0_3::IsUDPSocket_0_3, + ns_PPB_UDPSocket_Private_0_3::Bind_0_3, + ns_PPB_UDPSocket_Private_0_3::GetBoundAddress_0_3, + ns_PPB_UDPSocket_Private_0_3::RecvFrom_0_3, + ns_PPB_UDPSocket_Private_0_3::GetRecvFromAddress_0_3, + ns_PPB_UDPSocket_Private_0_3::SendTo_0_3, + ns_PPB_UDPSocket_Private_0_3::Close_0_3, +}; +const string ToString_PPB_UDPSocket_Private(const PPB_UDPSocket_Private_0_3 *v) { + stringstream s; + s << v; + return s.str(); +} +namespace ns_PPB_UDPSocket_Private_0_4 { +static PP_Resource Create_0_4(PP_Instance instance_id) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_UDPSocket_Private\""); + AddProp(ss, "__version", "\"0.4\""); + AddProp(ss, "__method", "\"Create\""); + AddProp(ss, "instance_id", ToString_PP_Instance(instance_id)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Resource(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_UDPSocket_Private_0_4*)RealGetInterface("PPB_UDPSocket_Private;0.4"))->Create(instance_id); + printf("RPC response: ["); + printf("%s", ToString_PP_Resource(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool IsUDPSocket_0_4(PP_Resource resource_id) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_UDPSocket_Private\""); + AddProp(ss, "__version", "\"0.4\""); + AddProp(ss, "__method", "\"IsUDPSocket\""); + AddProp(ss, "resource_id", ToString_PP_Resource(resource_id)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_UDPSocket_Private_0_4*)RealGetInterface("PPB_UDPSocket_Private;0.4"))->IsUDPSocket(resource_id); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t SetSocketFeature_0_4(PP_Resource udp_socket, PP_UDPSocketFeature_Private name, struct PP_Var value) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_UDPSocket_Private\""); + AddProp(ss, "__version", "\"0.4\""); + AddProp(ss, "__method", "\"SetSocketFeature\""); + AddProp(ss, "udp_socket", ToString_PP_Resource(udp_socket)); + AddProp(ss, "name", ToString_PP_UDPSocketFeature_Private(name)); + AddProp(ss, "value", ToString_PP_Var(value)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_UDPSocket_Private_0_4*)RealGetInterface("PPB_UDPSocket_Private;0.4"))->SetSocketFeature(udp_socket, name, value); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t Bind_0_4(PP_Resource udp_socket, const struct PP_NetAddress_Private* addr, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_UDPSocket_Private\""); + AddProp(ss, "__version", "\"0.4\""); + AddProp(ss, "__method", "\"Bind\""); + AddProp(ss, "udp_socket", ToString_PP_Resource(udp_socket)); + AddProp(ss, "addr", ToString_PP_NetAddress_Private(addr)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_UDPSocket_Private_0_4*)RealGetInterface("PPB_UDPSocket_Private;0.4"))->Bind(udp_socket, addr, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool GetBoundAddress_0_4(PP_Resource udp_socket, struct PP_NetAddress_Private* addr) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_UDPSocket_Private\""); + AddProp(ss, "__version", "\"0.4\""); + AddProp(ss, "__method", "\"GetBoundAddress\""); + AddProp(ss, "udp_socket", ToString_PP_Resource(udp_socket)); + AddProp(ss, "addr", PointerToString(addr)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + if (!!addr) { + iterator.skip(); + FromJSON_PP_NetAddress_Private(iterator, *addr); + } + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_UDPSocket_Private_0_4*)RealGetInterface("PPB_UDPSocket_Private;0.4"))->GetBoundAddress(udp_socket, addr); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + if (!!addr) { + AddProp(os, "addr", ToString_PP_NetAddress_Private(addr)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t RecvFrom_0_4(PP_Resource udp_socket, char* buffer, int32_t num_bytes, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_UDPSocket_Private\""); + AddProp(ss, "__version", "\"0.4\""); + AddProp(ss, "__method", "\"RecvFrom\""); + AddProp(ss, "udp_socket", ToString_PP_Resource(udp_socket)); + AddProp(ss, "buffer", PointerToString(buffer)); + AddProp(ss, "num_bytes", ToString_int32_t(num_bytes)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + iterator.skip(); + FromJSON_str_t(iterator, buffer); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_UDPSocket_Private_0_4*)RealGetInterface("PPB_UDPSocket_Private;0.4"))->RecvFrom(udp_socket, buffer, num_bytes, logging_callback); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_int32_t(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + AddProp(os, "buffer", ToString_str_t(buffer)); + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool GetRecvFromAddress_0_4(PP_Resource udp_socket, struct PP_NetAddress_Private* addr) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_UDPSocket_Private\""); + AddProp(ss, "__version", "\"0.4\""); + AddProp(ss, "__method", "\"GetRecvFromAddress\""); + AddProp(ss, "udp_socket", ToString_PP_Resource(udp_socket)); + AddProp(ss, "addr", PointerToString(addr)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + if (!!addr) { + iterator.skip(); + FromJSON_PP_NetAddress_Private(iterator, *addr); + } + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_UDPSocket_Private_0_4*)RealGetInterface("PPB_UDPSocket_Private;0.4"))->GetRecvFromAddress(udp_socket, addr); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + if (!!addr) { + AddProp(os, "addr", ToString_PP_NetAddress_Private(addr)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t SendTo_0_4(PP_Resource udp_socket, const char* buffer, int32_t num_bytes, const struct PP_NetAddress_Private* addr, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_UDPSocket_Private\""); + AddProp(ss, "__version", "\"0.4\""); + AddProp(ss, "__method", "\"SendTo\""); + AddProp(ss, "udp_socket", ToString_PP_Resource(udp_socket)); + AddProp(ss, "buffer", ToString_str_t(buffer)); + AddProp(ss, "num_bytes", ToString_int32_t(num_bytes)); + AddProp(ss, "addr", ToString_PP_NetAddress_Private(addr)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_UDPSocket_Private_0_4*)RealGetInterface("PPB_UDPSocket_Private;0.4"))->SendTo(udp_socket, buffer, num_bytes, addr, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static void Close_0_4(PP_Resource udp_socket) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_UDPSocket_Private\""); + AddProp(ss, "__version", "\"0.4\""); + AddProp(ss, "__method", "\"Close\""); + AddProp(ss, "udp_socket", ToString_PP_Resource(udp_socket)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_UDPSocket_Private_0_4*)RealGetInterface("PPB_UDPSocket_Private;0.4"))->Close(udp_socket); +#endif // !INTERPOSE +} +} +static PPB_UDPSocket_Private_0_4 _PPB_UDPSocket_Private_0_4 = { + ns_PPB_UDPSocket_Private_0_4::Create_0_4, + ns_PPB_UDPSocket_Private_0_4::IsUDPSocket_0_4, + ns_PPB_UDPSocket_Private_0_4::SetSocketFeature_0_4, + ns_PPB_UDPSocket_Private_0_4::Bind_0_4, + ns_PPB_UDPSocket_Private_0_4::GetBoundAddress_0_4, + ns_PPB_UDPSocket_Private_0_4::RecvFrom_0_4, + ns_PPB_UDPSocket_Private_0_4::GetRecvFromAddress_0_4, + ns_PPB_UDPSocket_Private_0_4::SendTo_0_4, + ns_PPB_UDPSocket_Private_0_4::Close_0_4, +}; +const string ToString_PPB_UDPSocket_Private(const PPB_UDPSocket_Private_0_4 *v) { + stringstream s; + s << v; + return s.str(); +} +namespace ns_PPB_UMA_Private_0_3 { +static void HistogramCustomTimes_0_3(PP_Instance instance, struct PP_Var name, int64_t sample, int64_t min, int64_t max, uint32_t bucket_count) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_UMA_Private\""); + AddProp(ss, "__version", "\"0.3\""); + AddProp(ss, "__method", "\"HistogramCustomTimes\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "name", ToString_PP_Var(name)); + AddProp(ss, "sample", ToString_int64_t(sample)); + AddProp(ss, "min", ToString_int64_t(min)); + AddProp(ss, "max", ToString_int64_t(max)); + AddProp(ss, "bucket_count", ToString_uint32_t(bucket_count)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_UMA_Private_0_3*)RealGetInterface("PPB_UMA_Private;0.3"))->HistogramCustomTimes(instance, name, sample, min, max, bucket_count); +#endif // !INTERPOSE +} +static void HistogramCustomCounts_0_3(PP_Instance instance, struct PP_Var name, int32_t sample, int32_t min, int32_t max, uint32_t bucket_count) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_UMA_Private\""); + AddProp(ss, "__version", "\"0.3\""); + AddProp(ss, "__method", "\"HistogramCustomCounts\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "name", ToString_PP_Var(name)); + AddProp(ss, "sample", ToString_int32_t(sample)); + AddProp(ss, "min", ToString_int32_t(min)); + AddProp(ss, "max", ToString_int32_t(max)); + AddProp(ss, "bucket_count", ToString_uint32_t(bucket_count)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_UMA_Private_0_3*)RealGetInterface("PPB_UMA_Private;0.3"))->HistogramCustomCounts(instance, name, sample, min, max, bucket_count); +#endif // !INTERPOSE +} +static void HistogramEnumeration_0_3(PP_Instance instance, struct PP_Var name, int32_t sample, int32_t boundary_value) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_UMA_Private\""); + AddProp(ss, "__version", "\"0.3\""); + AddProp(ss, "__method", "\"HistogramEnumeration\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "name", ToString_PP_Var(name)); + AddProp(ss, "sample", ToString_int32_t(sample)); + AddProp(ss, "boundary_value", ToString_int32_t(boundary_value)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_UMA_Private_0_3*)RealGetInterface("PPB_UMA_Private;0.3"))->HistogramEnumeration(instance, name, sample, boundary_value); +#endif // !INTERPOSE +} +static int32_t IsCrashReportingEnabled_0_3(PP_Instance instance, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_UMA_Private\""); + AddProp(ss, "__version", "\"0.3\""); + AddProp(ss, "__method", "\"IsCrashReportingEnabled\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_UMA_Private_0_3*)RealGetInterface("PPB_UMA_Private;0.3"))->IsCrashReportingEnabled(instance, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +} +static PPB_UMA_Private_0_3 _PPB_UMA_Private_0_3 = { + ns_PPB_UMA_Private_0_3::HistogramCustomTimes_0_3, + ns_PPB_UMA_Private_0_3::HistogramCustomCounts_0_3, + ns_PPB_UMA_Private_0_3::HistogramEnumeration_0_3, + ns_PPB_UMA_Private_0_3::IsCrashReportingEnabled_0_3, +}; +const string ToString_PPB_UMA_Private(const PPB_UMA_Private_0_3 *v) { + stringstream s; + s << v; + return s.str(); +} +namespace ns_PPB_VideoDestination_Private_0_1 { +static PP_Resource Create_0_1(PP_Instance instance) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_VideoDestination_Private\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"Create\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Resource(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_VideoDestination_Private_0_1*)RealGetInterface("PPB_VideoDestination_Private;0.1"))->Create(instance); + printf("RPC response: ["); + printf("%s", ToString_PP_Resource(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool IsVideoDestination_0_1(PP_Resource resource) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_VideoDestination_Private\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"IsVideoDestination\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_VideoDestination_Private_0_1*)RealGetInterface("PPB_VideoDestination_Private;0.1"))->IsVideoDestination(resource); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t Open_0_1(PP_Resource destination, struct PP_Var stream_url, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_VideoDestination_Private\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"Open\""); + AddProp(ss, "destination", ToString_PP_Resource(destination)); + AddProp(ss, "stream_url", ToString_PP_Var(stream_url)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_VideoDestination_Private_0_1*)RealGetInterface("PPB_VideoDestination_Private;0.1"))->Open(destination, stream_url, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t PutFrame_0_1(PP_Resource destination, const struct PP_VideoFrame_Private* frame) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_VideoDestination_Private\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"PutFrame\""); + AddProp(ss, "destination", ToString_PP_Resource(destination)); + AddProp(ss, "frame", ToString_PP_VideoFrame_Private(frame)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_VideoDestination_Private_0_1*)RealGetInterface("PPB_VideoDestination_Private;0.1"))->PutFrame(destination, frame); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static void Close_0_1(PP_Resource destination) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_VideoDestination_Private\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"Close\""); + AddProp(ss, "destination", ToString_PP_Resource(destination)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_VideoDestination_Private_0_1*)RealGetInterface("PPB_VideoDestination_Private;0.1"))->Close(destination); +#endif // !INTERPOSE +} +} +static PPB_VideoDestination_Private_0_1 _PPB_VideoDestination_Private_0_1 = { + ns_PPB_VideoDestination_Private_0_1::Create_0_1, + ns_PPB_VideoDestination_Private_0_1::IsVideoDestination_0_1, + ns_PPB_VideoDestination_Private_0_1::Open_0_1, + ns_PPB_VideoDestination_Private_0_1::PutFrame_0_1, + ns_PPB_VideoDestination_Private_0_1::Close_0_1, +}; +const string ToString_PPB_VideoDestination_Private(const PPB_VideoDestination_Private_0_1 *v) { + stringstream s; + s << v; + return s.str(); +} +namespace ns_PPB_VideoSource_Private_0_1 { +static PP_Resource Create_0_1(PP_Instance instance) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_VideoSource_Private\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"Create\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Resource(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_VideoSource_Private_0_1*)RealGetInterface("PPB_VideoSource_Private;0.1"))->Create(instance); + printf("RPC response: ["); + printf("%s", ToString_PP_Resource(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool IsVideoSource_0_1(PP_Resource resource) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_VideoSource_Private\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"IsVideoSource\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_VideoSource_Private_0_1*)RealGetInterface("PPB_VideoSource_Private;0.1"))->IsVideoSource(resource); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t Open_0_1(PP_Resource source, struct PP_Var stream_url, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_VideoSource_Private\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"Open\""); + AddProp(ss, "source", ToString_PP_Resource(source)); + AddProp(ss, "stream_url", ToString_PP_Var(stream_url)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_VideoSource_Private_0_1*)RealGetInterface("PPB_VideoSource_Private;0.1"))->Open(source, stream_url, logging_callback); + printf("RPC response: ["); + printf("%s", ToString_int32_t(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static int32_t GetFrame_0_1(PP_Resource source, struct PP_VideoFrame_Private* frame, struct PP_CompletionCallback callback) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_VideoSource_Private\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"GetFrame\""); + AddProp(ss, "source", ToString_PP_Resource(source)); + AddProp(ss, "frame", PointerToString(frame)); + AddProp(ss, "callback", ToString_PP_CompletionCallback(callback)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_int32_t(iterator, rval); + iterator.expectObjectAndGotoFirstProperty(); + if (!!frame) { + iterator.skip(); + FromJSON_PP_VideoFrame_Private(iterator, *frame); + } + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_CompletionCallback logging_callback; + logging_callback.func = &Logging_PP_CompletionCallback; + logging_callback.user_data = new PP_CompletionCallback(callback); + logging_callback.flags = callback.flags; + int32_t rval = ((PPB_VideoSource_Private_0_1*)RealGetInterface("PPB_VideoSource_Private;0.1"))->GetFrame(source, frame, logging_callback); + printf("RPC response: ["); + printf("["); + printf("%s", ToString_int32_t(rval).c_str()); + printf(","); + std::stringstream os; + BeginProps(os); + if (!!frame) { + AddProp(os, "frame", ToString_PP_VideoFrame_Private(frame)); + } + EndProps(os); + printf("%s]", os.str().c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static void Close_0_1(PP_Resource source) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_VideoSource_Private\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"Close\""); + AddProp(ss, "source", ToString_PP_Resource(source)); + EndProps(ss); +#ifndef INTERPOSE + RPC(ss); +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + ((PPB_VideoSource_Private_0_1*)RealGetInterface("PPB_VideoSource_Private;0.1"))->Close(source); +#endif // !INTERPOSE +} +} +static PPB_VideoSource_Private_0_1 _PPB_VideoSource_Private_0_1 = { + ns_PPB_VideoSource_Private_0_1::Create_0_1, + ns_PPB_VideoSource_Private_0_1::IsVideoSource_0_1, + ns_PPB_VideoSource_Private_0_1::Open_0_1, + ns_PPB_VideoSource_Private_0_1::GetFrame_0_1, + ns_PPB_VideoSource_Private_0_1::Close_0_1, +}; +const string ToString_PPB_VideoSource_Private(const PPB_VideoSource_Private_0_1 *v) { + stringstream s; + s << v; + return s.str(); +} +const string ToString_PP_X509Certificate_Private_Field(const PP_X509Certificate_Private_Field *v) { + switch (*v) { + case 0: + return "\"PP_X509CERTIFICATE_PRIVATE_ISSUER_COMMON_NAME\""; + case 1: + return "\"PP_X509CERTIFICATE_PRIVATE_ISSUER_LOCALITY_NAME\""; + case 2: + return "\"PP_X509CERTIFICATE_PRIVATE_ISSUER_STATE_OR_PROVINCE_NAME\""; + case 3: + return "\"PP_X509CERTIFICATE_PRIVATE_ISSUER_COUNTRY_NAME\""; + case 4: + return "\"PP_X509CERTIFICATE_PRIVATE_ISSUER_ORGANIZATION_NAME\""; + case 5: + return "\"PP_X509CERTIFICATE_PRIVATE_ISSUER_ORGANIZATION_UNIT_NAME\""; + case 6: + return "\"PP_X509CERTIFICATE_PRIVATE_ISSUER_UNIQUE_ID\""; + case 7: + return "\"PP_X509CERTIFICATE_PRIVATE_SUBJECT_COMMON_NAME\""; + case 8: + return "\"PP_X509CERTIFICATE_PRIVATE_SUBJECT_LOCALITY_NAME\""; + case 9: + return "\"PP_X509CERTIFICATE_PRIVATE_SUBJECT_STATE_OR_PROVINCE_NAME\""; + case 10: + return "\"PP_X509CERTIFICATE_PRIVATE_SUBJECT_COUNTRY_NAME\""; + case 11: + return "\"PP_X509CERTIFICATE_PRIVATE_SUBJECT_ORGANIZATION_NAME\""; + case 12: + return "\"PP_X509CERTIFICATE_PRIVATE_SUBJECT_ORGANIZATION_UNIT_NAME\""; + case 13: + return "\"PP_X509CERTIFICATE_PRIVATE_SUBJECT_UNIQUE_ID\""; + case 14: + return "\"PP_X509CERTIFICATE_PRIVATE_VERSION\""; + case 15: + return "\"PP_X509CERTIFICATE_PRIVATE_SERIAL_NUMBER\""; + case 16: + return "\"PP_X509CERTIFICATE_PRIVATE_SIGNATURE_ALGORITHM_OID\""; + case 17: + return "\"PP_X509CERTIFICATE_PRIVATE_SIGNATURE_ALGORITHM_PARAMATERS_RAW\""; + case 18: + return "\"PP_X509CERTIFICATE_PRIVATE_VALIDITY_NOT_BEFORE\""; + case 19: + return "\"PP_X509CERTIFICATE_PRIVATE_VALIDITY_NOT_AFTER\""; + case 20: + return "\"PP_X509CERTIFICATE_PRIVATE_SUBJECT_PUBLIC_KEY_ALGORITHM_OID\""; + case 21: + return "\"PP_X509CERTIFICATE_PRIVATE_SUBJECT_PUBLIC_KEY\""; + case 22: + return "\"PP_X509CERTIFICATE_PRIVATE_RAW\""; + case 23: + return "\"PP_X509CERTIFICATE_PRIVATE_ISSUER_DISTINGUISHED_NAME\""; + case 24: + return "\"PP_X509CERTIFICATE_PRIVATE_SUBJECT_DISTINGUISHED_NAME\""; + default: + return "\"???\""; + } +} +const string ToString_PP_X509Certificate_Private_Field(const PP_X509Certificate_Private_Field &v) { + return ToString_PP_X509Certificate_Private_Field(&v); +} +void FromJSON_PP_X509Certificate_Private_Field(JSONIterator& iterator, PP_X509Certificate_Private_Field &value) { + long int v; + FromJSON_int(iterator, v); + value = PP_X509Certificate_Private_Field(v); +} +const string ToString_PPB_X509Certificate_Private_Version(const PPB_X509Certificate_Private_Version *v) { + switch (*v) { + case 0: + return "\"PP_X509CERTIFICATE_PRIVATE_V1\""; + case 1: + return "\"PP_X509CERTIFICATE_PRIVATE_V2\""; + case 2: + return "\"PP_X509CERTIFICATE_PRIVATE_V3\""; + default: + return "\"???\""; + } +} +const string ToString_PPB_X509Certificate_Private_Version(const PPB_X509Certificate_Private_Version &v) { + return ToString_PPB_X509Certificate_Private_Version(&v); +} +void FromJSON_PPB_X509Certificate_Private_Version(JSONIterator& iterator, PPB_X509Certificate_Private_Version &value) { + long int v; + FromJSON_int(iterator, v); + value = PPB_X509Certificate_Private_Version(v); +} +namespace ns_PPB_X509Certificate_Private_0_1 { +static PP_Resource Create_0_1(PP_Instance instance) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_X509Certificate_Private\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"Create\""); + AddProp(ss, "instance", ToString_PP_Instance(instance)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + int32_t rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Resource(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + int32_t rval = ((PPB_X509Certificate_Private_0_1*)RealGetInterface("PPB_X509Certificate_Private;0.1"))->Create(instance); + printf("RPC response: ["); + printf("%s", ToString_PP_Resource(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool IsX509CertificatePrivate_0_1(PP_Resource resource) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_X509Certificate_Private\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"IsX509CertificatePrivate\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_X509Certificate_Private_0_1*)RealGetInterface("PPB_X509Certificate_Private;0.1"))->IsX509CertificatePrivate(resource); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static PP_Bool Initialize_0_1(PP_Resource resource, const char* bytes, uint32_t length) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_X509Certificate_Private\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"Initialize\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + AddProp(ss, "bytes", ToString_str_t(bytes)); + AddProp(ss, "length", ToString_uint32_t(length)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + PP_Bool rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Bool(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + PP_Bool rval = ((PPB_X509Certificate_Private_0_1*)RealGetInterface("PPB_X509Certificate_Private;0.1"))->Initialize(resource, bytes, length); + printf("RPC response: ["); + printf("%s", ToString_PP_Bool(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +static struct PP_Var GetField_0_1(PP_Resource resource, PP_X509Certificate_Private_Field field) { + stringstream ss; + BeginProps(ss); + AddProp(ss, "__interface", "\"PPB_X509Certificate_Private\""); + AddProp(ss, "__version", "\"0.1\""); + AddProp(ss, "__method", "\"GetField\""); + AddProp(ss, "resource", ToString_PP_Resource(resource)); + AddProp(ss, "field", ToString_PP_X509Certificate_Private_Field(field)); + EndProps(ss); +#ifndef INTERPOSE + string json = RPCWithResult(ss); + struct PP_Var rval; + JSONIterator iterator(json); + iterator.expectArrayAndGotoFirstItem(); + FromJSON_PP_Var(iterator, rval); + return rval; +#else // !INTERPOSE + printf("%s\n", ss.str().c_str()); + struct PP_Var rval = ((PPB_X509Certificate_Private_0_1*)RealGetInterface("PPB_X509Certificate_Private;0.1"))->GetField(resource, field); + printf("RPC response: ["); + printf("%s", ToString_PP_Var(rval).c_str()); + printf("]\n"); + return rval; +#endif // !INTERPOSE +} +} +static PPB_X509Certificate_Private_0_1 _PPB_X509Certificate_Private_0_1 = { + ns_PPB_X509Certificate_Private_0_1::Create_0_1, + ns_PPB_X509Certificate_Private_0_1::IsX509CertificatePrivate_0_1, + ns_PPB_X509Certificate_Private_0_1::Initialize_0_1, + ns_PPB_X509Certificate_Private_0_1::GetField_0_1, +}; +const string ToString_PPB_X509Certificate_Private(const PPB_X509Certificate_Private_0_1 *v) { + stringstream s; + s << v; + return s.str(); +} +char* Call_PPP_ContentDecryptor_Private_Initialize(const PPP_ContentDecryptor_Private* _interface, JSONIterator& iterator) { + PP_Instance instance; + iterator.skip(); + FromJSON_PP_Instance(iterator, instance); + uint32_t promise_id; + iterator.skip(); + FromJSON_uint32_t(iterator, promise_id); + struct PP_Var key_system; + iterator.skip(); + FromJSON_PP_Var(iterator, key_system); + PP_Bool allow_distinctive_identifier; + iterator.skip(); + FromJSON_PP_Bool(iterator, allow_distinctive_identifier); + PP_Bool allow_persistent_state; + iterator.skip(); + FromJSON_PP_Bool(iterator, allow_persistent_state); + _interface->Initialize((PP_Instance )instance, (uint32_t )promise_id, (struct PP_Var )key_system, (PP_Bool )allow_distinctive_identifier, (PP_Bool )allow_persistent_state); + return nullptr; +} +char* Call_PPP_ContentDecryptor_Private_SetServerCertificate(const PPP_ContentDecryptor_Private* _interface, JSONIterator& iterator) { + PP_Instance instance; + iterator.skip(); + FromJSON_PP_Instance(iterator, instance); + uint32_t promise_id; + iterator.skip(); + FromJSON_uint32_t(iterator, promise_id); + struct PP_Var server_certificate; + iterator.skip(); + FromJSON_PP_Var(iterator, server_certificate); + _interface->SetServerCertificate((PP_Instance )instance, (uint32_t )promise_id, (struct PP_Var )server_certificate); + return nullptr; +} +char* Call_PPP_ContentDecryptor_Private_CreateSessionAndGenerateRequest(const PPP_ContentDecryptor_Private* _interface, JSONIterator& iterator) { + PP_Instance instance; + iterator.skip(); + FromJSON_PP_Instance(iterator, instance); + uint32_t promise_id; + iterator.skip(); + FromJSON_uint32_t(iterator, promise_id); + PP_SessionType session_type; + iterator.skip(); + FromJSON_PP_SessionType(iterator, session_type); + PP_InitDataType init_data_type; + iterator.skip(); + FromJSON_PP_InitDataType(iterator, init_data_type); + struct PP_Var init_data; + iterator.skip(); + FromJSON_PP_Var(iterator, init_data); + _interface->CreateSessionAndGenerateRequest((PP_Instance )instance, (uint32_t )promise_id, (PP_SessionType )session_type, (PP_InitDataType )init_data_type, (struct PP_Var )init_data); + return nullptr; +} +char* Call_PPP_ContentDecryptor_Private_LoadSession(const PPP_ContentDecryptor_Private* _interface, JSONIterator& iterator) { + PP_Instance instance; + iterator.skip(); + FromJSON_PP_Instance(iterator, instance); + uint32_t promise_id; + iterator.skip(); + FromJSON_uint32_t(iterator, promise_id); + PP_SessionType session_type; + iterator.skip(); + FromJSON_PP_SessionType(iterator, session_type); + struct PP_Var session_id; + iterator.skip(); + FromJSON_PP_Var(iterator, session_id); + _interface->LoadSession((PP_Instance )instance, (uint32_t )promise_id, (PP_SessionType )session_type, (struct PP_Var )session_id); + return nullptr; +} +char* Call_PPP_ContentDecryptor_Private_UpdateSession(const PPP_ContentDecryptor_Private* _interface, JSONIterator& iterator) { + PP_Instance instance; + iterator.skip(); + FromJSON_PP_Instance(iterator, instance); + uint32_t promise_id; + iterator.skip(); + FromJSON_uint32_t(iterator, promise_id); + struct PP_Var session_id; + iterator.skip(); + FromJSON_PP_Var(iterator, session_id); + struct PP_Var response; + iterator.skip(); + FromJSON_PP_Var(iterator, response); + _interface->UpdateSession((PP_Instance )instance, (uint32_t )promise_id, (struct PP_Var )session_id, (struct PP_Var )response); + return nullptr; +} +char* Call_PPP_ContentDecryptor_Private_CloseSession(const PPP_ContentDecryptor_Private* _interface, JSONIterator& iterator) { + PP_Instance instance; + iterator.skip(); + FromJSON_PP_Instance(iterator, instance); + uint32_t promise_id; + iterator.skip(); + FromJSON_uint32_t(iterator, promise_id); + struct PP_Var session_id; + iterator.skip(); + FromJSON_PP_Var(iterator, session_id); + _interface->CloseSession((PP_Instance )instance, (uint32_t )promise_id, (struct PP_Var )session_id); + return nullptr; +} +char* Call_PPP_ContentDecryptor_Private_RemoveSession(const PPP_ContentDecryptor_Private* _interface, JSONIterator& iterator) { + PP_Instance instance; + iterator.skip(); + FromJSON_PP_Instance(iterator, instance); + uint32_t promise_id; + iterator.skip(); + FromJSON_uint32_t(iterator, promise_id); + struct PP_Var session_id; + iterator.skip(); + FromJSON_PP_Var(iterator, session_id); + _interface->RemoveSession((PP_Instance )instance, (uint32_t )promise_id, (struct PP_Var )session_id); + return nullptr; +} +char* Call_PPP_ContentDecryptor_Private_Decrypt(const PPP_ContentDecryptor_Private* _interface, JSONIterator& iterator) { + PP_Instance instance; + iterator.skip(); + FromJSON_PP_Instance(iterator, instance); + PP_Resource encrypted_block; + iterator.skip(); + FromJSON_PP_Resource(iterator, encrypted_block); + struct PP_EncryptedBlockInfo encrypted_block_info; + iterator.skip(); + FromJSON_PP_EncryptedBlockInfo(iterator, encrypted_block_info); + _interface->Decrypt((PP_Instance )instance, (PP_Resource )encrypted_block, (const struct PP_EncryptedBlockInfo* )&encrypted_block_info); + return nullptr; +} +char* Call_PPP_ContentDecryptor_Private_InitializeAudioDecoder(const PPP_ContentDecryptor_Private* _interface, JSONIterator& iterator) { + PP_Instance instance; + iterator.skip(); + FromJSON_PP_Instance(iterator, instance); + struct PP_AudioDecoderConfig decoder_config; + iterator.skip(); + FromJSON_PP_AudioDecoderConfig(iterator, decoder_config); + PP_Resource codec_extra_data; + iterator.skip(); + FromJSON_PP_Resource(iterator, codec_extra_data); + _interface->InitializeAudioDecoder((PP_Instance )instance, (const struct PP_AudioDecoderConfig* )&decoder_config, (PP_Resource )codec_extra_data); + return nullptr; +} +char* Call_PPP_ContentDecryptor_Private_InitializeVideoDecoder(const PPP_ContentDecryptor_Private* _interface, JSONIterator& iterator) { + PP_Instance instance; + iterator.skip(); + FromJSON_PP_Instance(iterator, instance); + struct PP_VideoDecoderConfig decoder_config; + iterator.skip(); + FromJSON_PP_VideoDecoderConfig(iterator, decoder_config); + PP_Resource codec_extra_data; + iterator.skip(); + FromJSON_PP_Resource(iterator, codec_extra_data); + _interface->InitializeVideoDecoder((PP_Instance )instance, (const struct PP_VideoDecoderConfig* )&decoder_config, (PP_Resource )codec_extra_data); + return nullptr; +} +char* Call_PPP_ContentDecryptor_Private_DeinitializeDecoder(const PPP_ContentDecryptor_Private* _interface, JSONIterator& iterator) { + PP_Instance instance; + iterator.skip(); + FromJSON_PP_Instance(iterator, instance); + PP_DecryptorStreamType decoder_type; + iterator.skip(); + FromJSON_PP_DecryptorStreamType(iterator, decoder_type); + uint32_t request_id; + iterator.skip(); + FromJSON_uint32_t(iterator, request_id); + _interface->DeinitializeDecoder((PP_Instance )instance, (PP_DecryptorStreamType )decoder_type, (uint32_t )request_id); + return nullptr; +} +char* Call_PPP_ContentDecryptor_Private_ResetDecoder(const PPP_ContentDecryptor_Private* _interface, JSONIterator& iterator) { + PP_Instance instance; + iterator.skip(); + FromJSON_PP_Instance(iterator, instance); + PP_DecryptorStreamType decoder_type; + iterator.skip(); + FromJSON_PP_DecryptorStreamType(iterator, decoder_type); + uint32_t request_id; + iterator.skip(); + FromJSON_uint32_t(iterator, request_id); + _interface->ResetDecoder((PP_Instance )instance, (PP_DecryptorStreamType )decoder_type, (uint32_t )request_id); + return nullptr; +} +char* Call_PPP_ContentDecryptor_Private_DecryptAndDecode(const PPP_ContentDecryptor_Private* _interface, JSONIterator& iterator) { + PP_Instance instance; + iterator.skip(); + FromJSON_PP_Instance(iterator, instance); + PP_DecryptorStreamType decoder_type; + iterator.skip(); + FromJSON_PP_DecryptorStreamType(iterator, decoder_type); + PP_Resource encrypted_buffer; + iterator.skip(); + FromJSON_PP_Resource(iterator, encrypted_buffer); + struct PP_EncryptedBlockInfo encrypted_block_info; + iterator.skip(); + FromJSON_PP_EncryptedBlockInfo(iterator, encrypted_block_info); + _interface->DecryptAndDecode((PP_Instance )instance, (PP_DecryptorStreamType )decoder_type, (PP_Resource )encrypted_buffer, (const struct PP_EncryptedBlockInfo* )&encrypted_block_info); + return nullptr; +} +char* Call_PPP_ContentDecryptor_Private(const void* _interface, JSONIterator& iterator) { + iterator.skip(); + const Token& member = iterator.getCurrentStringAndGotoNext(); + string memberName = member.value(); + if (!memberName.compare("Initialize")) { + return Call_PPP_ContentDecryptor_Private_Initialize((const PPP_ContentDecryptor_Private*)_interface, iterator); + } + if (!memberName.compare("SetServerCertificate")) { + return Call_PPP_ContentDecryptor_Private_SetServerCertificate((const PPP_ContentDecryptor_Private*)_interface, iterator); + } + if (!memberName.compare("CreateSessionAndGenerateRequest")) { + return Call_PPP_ContentDecryptor_Private_CreateSessionAndGenerateRequest((const PPP_ContentDecryptor_Private*)_interface, iterator); + } + if (!memberName.compare("LoadSession")) { + return Call_PPP_ContentDecryptor_Private_LoadSession((const PPP_ContentDecryptor_Private*)_interface, iterator); + } + if (!memberName.compare("UpdateSession")) { + return Call_PPP_ContentDecryptor_Private_UpdateSession((const PPP_ContentDecryptor_Private*)_interface, iterator); + } + if (!memberName.compare("CloseSession")) { + return Call_PPP_ContentDecryptor_Private_CloseSession((const PPP_ContentDecryptor_Private*)_interface, iterator); + } + if (!memberName.compare("RemoveSession")) { + return Call_PPP_ContentDecryptor_Private_RemoveSession((const PPP_ContentDecryptor_Private*)_interface, iterator); + } + if (!memberName.compare("Decrypt")) { + return Call_PPP_ContentDecryptor_Private_Decrypt((const PPP_ContentDecryptor_Private*)_interface, iterator); + } + if (!memberName.compare("InitializeAudioDecoder")) { + return Call_PPP_ContentDecryptor_Private_InitializeAudioDecoder((const PPP_ContentDecryptor_Private*)_interface, iterator); + } + if (!memberName.compare("InitializeVideoDecoder")) { + return Call_PPP_ContentDecryptor_Private_InitializeVideoDecoder((const PPP_ContentDecryptor_Private*)_interface, iterator); + } + if (!memberName.compare("DeinitializeDecoder")) { + return Call_PPP_ContentDecryptor_Private_DeinitializeDecoder((const PPP_ContentDecryptor_Private*)_interface, iterator); + } + if (!memberName.compare("ResetDecoder")) { + return Call_PPP_ContentDecryptor_Private_ResetDecoder((const PPP_ContentDecryptor_Private*)_interface, iterator); + } + if (!memberName.compare("DecryptAndDecode")) { + return Call_PPP_ContentDecryptor_Private_DecryptAndDecode((const PPP_ContentDecryptor_Private*)_interface, iterator); + } + return nullptr; +} +char* Call_PPP_Find_Private_StartFind(const PPP_Find_Private* _interface, JSONIterator& iterator) { + PP_Instance instance; + iterator.skip(); + FromJSON_PP_Instance(iterator, instance); + char* text; + iterator.skip(); + FromJSON_str_t(iterator, text); + PP_Bool case_sensitive; + iterator.skip(); + FromJSON_PP_Bool(iterator, case_sensitive); + PP_Bool rval; + rval = _interface->StartFind((PP_Instance )instance, (const char* )text, (PP_Bool )case_sensitive); + return strdup(ToString_PP_Bool(rval).c_str()); +} +char* Call_PPP_Find_Private_SelectFindResult(const PPP_Find_Private* _interface, JSONIterator& iterator) { + PP_Instance instance; + iterator.skip(); + FromJSON_PP_Instance(iterator, instance); + PP_Bool forward; + iterator.skip(); + FromJSON_PP_Bool(iterator, forward); + _interface->SelectFindResult((PP_Instance )instance, (PP_Bool )forward); + return nullptr; +} +char* Call_PPP_Find_Private_StopFind(const PPP_Find_Private* _interface, JSONIterator& iterator) { + PP_Instance instance; + iterator.skip(); + FromJSON_PP_Instance(iterator, instance); + _interface->StopFind((PP_Instance )instance); + return nullptr; +} +char* Call_PPP_Find_Private(const void* _interface, JSONIterator& iterator) { + iterator.skip(); + const Token& member = iterator.getCurrentStringAndGotoNext(); + string memberName = member.value(); + if (!memberName.compare("StartFind")) { + return Call_PPP_Find_Private_StartFind((const PPP_Find_Private*)_interface, iterator); + } + if (!memberName.compare("SelectFindResult")) { + return Call_PPP_Find_Private_SelectFindResult((const PPP_Find_Private*)_interface, iterator); + } + if (!memberName.compare("StopFind")) { + return Call_PPP_Find_Private_StopFind((const PPP_Find_Private*)_interface, iterator); + } + return nullptr; +} +const string ToString_PP_Flash_BrowserOperations_SettingType(const PP_Flash_BrowserOperations_SettingType *v) { + switch (*v) { + case 0: + return "\"PP_FLASH_BROWSEROPERATIONS_SETTINGTYPE_CAMERAMIC\""; + case 1: + return "\"PP_FLASH_BROWSEROPERATIONS_SETTINGTYPE_PEERNETWORKING\""; + default: + return "\"???\""; + } +} +const string ToString_PP_Flash_BrowserOperations_SettingType(const PP_Flash_BrowserOperations_SettingType &v) { + return ToString_PP_Flash_BrowserOperations_SettingType(&v); +} +void FromJSON_PP_Flash_BrowserOperations_SettingType(JSONIterator& iterator, PP_Flash_BrowserOperations_SettingType &value) { + long int v; + FromJSON_int(iterator, v); + value = PP_Flash_BrowserOperations_SettingType(v); +} +const string ToString_PP_Flash_BrowserOperations_Permission(const PP_Flash_BrowserOperations_Permission *v) { + switch (*v) { + case 0: + return "\"PP_FLASH_BROWSEROPERATIONS_PERMISSION_DEFAULT\""; + case 1: + return "\"PP_FLASH_BROWSEROPERATIONS_PERMISSION_ALLOW\""; + case 2: + return "\"PP_FLASH_BROWSEROPERATIONS_PERMISSION_BLOCK\""; + case 3: + return "\"PP_FLASH_BROWSEROPERATIONS_PERMISSION_ASK\""; + default: + return "\"???\""; + } +} +const string ToString_PP_Flash_BrowserOperations_Permission(const PP_Flash_BrowserOperations_Permission &v) { + return ToString_PP_Flash_BrowserOperations_Permission(&v); +} +void FromJSON_PP_Flash_BrowserOperations_Permission(JSONIterator& iterator, PP_Flash_BrowserOperations_Permission &value) { + long int v; + FromJSON_int(iterator, v); + value = PP_Flash_BrowserOperations_Permission(v); +} +const string ToString_PP_Flash_BrowserOperations_SiteSetting(const PP_Flash_BrowserOperations_SiteSetting *v) { + if (!v) { + return "null"; + } + return ToString_PP_Flash_BrowserOperations_SiteSetting(*v); +} +const string ToString_PP_Flash_BrowserOperations_SiteSetting(const PP_Flash_BrowserOperations_SiteSetting &v) { + stringstream x; + BeginProps(x); + AddProp(x, "site", ToString_cstr_t(v.site)); + AddProp(x, "permission", ToString_PP_Flash_BrowserOperations_Permission(v.permission)); + EndProps(x); + return x.str(); +} +void FromJSON_PP_Flash_BrowserOperations_SiteSetting(JSONIterator& iterator, PP_Flash_BrowserOperations_SiteSetting &value) { + const JSON::Token& current = iterator.getCurrentAndGotoNext(); + if (current.isPrimitive() && !current.value().compare("null")) { + return; + } + if (!current.isObject()) { + Fail("Expected object!", ""); + } + iterator.skip(); + FromJSON_cstr_t(iterator, value.site); + iterator.skip(); + FromJSON_PP_Flash_BrowserOperations_Permission(iterator, value.permission); +} +const string ToString_PPB_Flash_BrowserOperations_GetSettingsCallback(const PPB_Flash_BrowserOperations_GetSettingsCallback &v) { + return PointerToString(v); +} +void FromJSON_PPB_Flash_BrowserOperations_GetSettingsCallback(JSONIterator& iterator, PPB_Flash_BrowserOperations_GetSettingsCallback &value) { + PointerValueFromJSON(iterator, value); +} +char* Call_PPP_Flash_BrowserOperations_ClearSiteData(const PPP_Flash_BrowserOperations_1_0* _interface, JSONIterator& iterator) { + char* plugin_data_path; + iterator.skip(); + FromJSON_str_t(iterator, plugin_data_path); + char* site; + iterator.skip(); + FromJSON_str_t(iterator, site); + uint64_t flags; + iterator.skip(); + FromJSON_uint64_t(iterator, flags); + uint64_t max_age; + iterator.skip(); + FromJSON_uint64_t(iterator, max_age); + PP_Bool rval; + rval = _interface->ClearSiteData((const char* )plugin_data_path, (const char* )site, (uint64_t )flags, (uint64_t )max_age); + return strdup(ToString_PP_Bool(rval).c_str()); +} +/* skipping DeauthorizeContentLicenses */ +/* skipping GetPermissionSettings */ +/* skipping SetDefaultPermission */ +/* skipping SetSitePermission */ +/* skipping GetSitesWithData */ +/* skipping FreeSiteList */ +char* Call_PPP_Flash_BrowserOperations_1_0(const void* _interface, JSONIterator& iterator) { + iterator.skip(); + const Token& member = iterator.getCurrentStringAndGotoNext(); + string memberName = member.value(); + if (!memberName.compare("ClearSiteData")) { + return Call_PPP_Flash_BrowserOperations_ClearSiteData((const PPP_Flash_BrowserOperations_1_0*)_interface, iterator); + } +/* skipping DeauthorizeContentLicenses */ +/* skipping GetPermissionSettings */ +/* skipping SetDefaultPermission */ +/* skipping SetSitePermission */ +/* skipping GetSitesWithData */ +/* skipping FreeSiteList */ + return nullptr; +} +char* Call_PPP_Flash_BrowserOperations_ClearSiteData(const PPP_Flash_BrowserOperations_1_2* _interface, JSONIterator& iterator) { + char* plugin_data_path; + iterator.skip(); + FromJSON_str_t(iterator, plugin_data_path); + char* site; + iterator.skip(); + FromJSON_str_t(iterator, site); + uint64_t flags; + iterator.skip(); + FromJSON_uint64_t(iterator, flags); + uint64_t max_age; + iterator.skip(); + FromJSON_uint64_t(iterator, max_age); + PP_Bool rval; + rval = _interface->ClearSiteData((const char* )plugin_data_path, (const char* )site, (uint64_t )flags, (uint64_t )max_age); + return strdup(ToString_PP_Bool(rval).c_str()); +} +char* Call_PPP_Flash_BrowserOperations_DeauthorizeContentLicenses(const PPP_Flash_BrowserOperations_1_2* _interface, JSONIterator& iterator) { + char* plugin_data_path; + iterator.skip(); + FromJSON_str_t(iterator, plugin_data_path); + PP_Bool rval; + rval = _interface->DeauthorizeContentLicenses((const char* )plugin_data_path); + return strdup(ToString_PP_Bool(rval).c_str()); +} +char* Call_PPP_Flash_BrowserOperations_GetPermissionSettings(const PPP_Flash_BrowserOperations_1_2* _interface, JSONIterator& iterator) { + char* plugin_data_path; + iterator.skip(); + FromJSON_str_t(iterator, plugin_data_path); + PP_Flash_BrowserOperations_SettingType setting_type; + iterator.skip(); + FromJSON_PP_Flash_BrowserOperations_SettingType(iterator, setting_type); + PPB_Flash_BrowserOperations_GetSettingsCallback callback; + iterator.skip(); + FromJSON_PPB_Flash_BrowserOperations_GetSettingsCallback(iterator, callback); + void* user_data; + iterator.skip(); + FromJSON_mem_t(iterator, user_data); + _interface->GetPermissionSettings((const char* )plugin_data_path, (PP_Flash_BrowserOperations_SettingType )setting_type, (PPB_Flash_BrowserOperations_GetSettingsCallback )callback, (void* )user_data); + stringstream os; + BeginElements(os); + BeginProps(os); + AddProp(os, "user_data", ToString_mem_t(user_data)); + EndProps(os); + EndElements(os); + return strdup(os.str().c_str()); +} +char* Call_PPP_Flash_BrowserOperations_SetDefaultPermission(const PPP_Flash_BrowserOperations_1_2* _interface, JSONIterator& iterator) { + char* plugin_data_path; + iterator.skip(); + FromJSON_str_t(iterator, plugin_data_path); + PP_Flash_BrowserOperations_SettingType setting_type; + iterator.skip(); + FromJSON_PP_Flash_BrowserOperations_SettingType(iterator, setting_type); + PP_Flash_BrowserOperations_Permission permission; + iterator.skip(); + FromJSON_PP_Flash_BrowserOperations_Permission(iterator, permission); + PP_Bool clear_site_specific; + iterator.skip(); + FromJSON_PP_Bool(iterator, clear_site_specific); + PP_Bool rval; + rval = _interface->SetDefaultPermission((const char* )plugin_data_path, (PP_Flash_BrowserOperations_SettingType )setting_type, (PP_Flash_BrowserOperations_Permission )permission, (PP_Bool )clear_site_specific); + return strdup(ToString_PP_Bool(rval).c_str()); +} +char* Call_PPP_Flash_BrowserOperations_SetSitePermission(const PPP_Flash_BrowserOperations_1_2* _interface, JSONIterator& iterator) { + char* plugin_data_path; + iterator.skip(); + FromJSON_str_t(iterator, plugin_data_path); + PP_Flash_BrowserOperations_SettingType setting_type; + iterator.skip(); + FromJSON_PP_Flash_BrowserOperations_SettingType(iterator, setting_type); + uint32_t site_count; + iterator.skip(); + FromJSON_uint32_t(iterator, site_count); + struct PP_Flash_BrowserOperations_SiteSetting *sites; + iterator.skip(); + + { + size_t children = iterator.expectArrayAndGotoFirstItem(); + if (children > site_count) { + Fail("Too many items in array\n", ""); + } + sites = new struct PP_Flash_BrowserOperations_SiteSetting[site_count]; + for (uint32_t _n = 0; _n < children; ++_n) { + FromJSON_PP_Flash_BrowserOperations_SiteSetting(iterator, (sites)[_n]); + } + // FIXME Null out remaining items? + } + PP_Bool rval; + rval = _interface->SetSitePermission((const char* )plugin_data_path, (PP_Flash_BrowserOperations_SettingType )setting_type, (uint32_t )site_count, (const struct PP_Flash_BrowserOperations_SiteSetting *)sites); + return strdup(ToString_PP_Bool(rval).c_str()); +} +/* skipping GetSitesWithData */ +/* skipping FreeSiteList */ +char* Call_PPP_Flash_BrowserOperations_1_2(const void* _interface, JSONIterator& iterator) { + iterator.skip(); + const Token& member = iterator.getCurrentStringAndGotoNext(); + string memberName = member.value(); + if (!memberName.compare("ClearSiteData")) { + return Call_PPP_Flash_BrowserOperations_ClearSiteData((const PPP_Flash_BrowserOperations_1_2*)_interface, iterator); + } + if (!memberName.compare("DeauthorizeContentLicenses")) { + return Call_PPP_Flash_BrowserOperations_DeauthorizeContentLicenses((const PPP_Flash_BrowserOperations_1_2*)_interface, iterator); + } + if (!memberName.compare("GetPermissionSettings")) { + return Call_PPP_Flash_BrowserOperations_GetPermissionSettings((const PPP_Flash_BrowserOperations_1_2*)_interface, iterator); + } + if (!memberName.compare("SetDefaultPermission")) { + return Call_PPP_Flash_BrowserOperations_SetDefaultPermission((const PPP_Flash_BrowserOperations_1_2*)_interface, iterator); + } + if (!memberName.compare("SetSitePermission")) { + return Call_PPP_Flash_BrowserOperations_SetSitePermission((const PPP_Flash_BrowserOperations_1_2*)_interface, iterator); + } +/* skipping GetSitesWithData */ +/* skipping FreeSiteList */ + return nullptr; +} +char* Call_PPP_Flash_BrowserOperations_ClearSiteData(const PPP_Flash_BrowserOperations* _interface, JSONIterator& iterator) { + char* plugin_data_path; + iterator.skip(); + FromJSON_str_t(iterator, plugin_data_path); + char* site; + iterator.skip(); + FromJSON_str_t(iterator, site); + uint64_t flags; + iterator.skip(); + FromJSON_uint64_t(iterator, flags); + uint64_t max_age; + iterator.skip(); + FromJSON_uint64_t(iterator, max_age); + PP_Bool rval; + rval = _interface->ClearSiteData((const char* )plugin_data_path, (const char* )site, (uint64_t )flags, (uint64_t )max_age); + return strdup(ToString_PP_Bool(rval).c_str()); +} +char* Call_PPP_Flash_BrowserOperations_DeauthorizeContentLicenses(const PPP_Flash_BrowserOperations* _interface, JSONIterator& iterator) { + char* plugin_data_path; + iterator.skip(); + FromJSON_str_t(iterator, plugin_data_path); + PP_Bool rval; + rval = _interface->DeauthorizeContentLicenses((const char* )plugin_data_path); + return strdup(ToString_PP_Bool(rval).c_str()); +} +char* Call_PPP_Flash_BrowserOperations_GetPermissionSettings(const PPP_Flash_BrowserOperations* _interface, JSONIterator& iterator) { + char* plugin_data_path; + iterator.skip(); + FromJSON_str_t(iterator, plugin_data_path); + PP_Flash_BrowserOperations_SettingType setting_type; + iterator.skip(); + FromJSON_PP_Flash_BrowserOperations_SettingType(iterator, setting_type); + PPB_Flash_BrowserOperations_GetSettingsCallback callback; + iterator.skip(); + FromJSON_PPB_Flash_BrowserOperations_GetSettingsCallback(iterator, callback); + void* user_data; + iterator.skip(); + FromJSON_mem_t(iterator, user_data); + _interface->GetPermissionSettings((const char* )plugin_data_path, (PP_Flash_BrowserOperations_SettingType )setting_type, (PPB_Flash_BrowserOperations_GetSettingsCallback )callback, (void* )user_data); + stringstream os; + BeginElements(os); + BeginProps(os); + AddProp(os, "user_data", ToString_mem_t(user_data)); + EndProps(os); + EndElements(os); + return strdup(os.str().c_str()); +} +char* Call_PPP_Flash_BrowserOperations_SetDefaultPermission(const PPP_Flash_BrowserOperations* _interface, JSONIterator& iterator) { + char* plugin_data_path; + iterator.skip(); + FromJSON_str_t(iterator, plugin_data_path); + PP_Flash_BrowserOperations_SettingType setting_type; + iterator.skip(); + FromJSON_PP_Flash_BrowserOperations_SettingType(iterator, setting_type); + PP_Flash_BrowserOperations_Permission permission; + iterator.skip(); + FromJSON_PP_Flash_BrowserOperations_Permission(iterator, permission); + PP_Bool clear_site_specific; + iterator.skip(); + FromJSON_PP_Bool(iterator, clear_site_specific); + PP_Bool rval; + rval = _interface->SetDefaultPermission((const char* )plugin_data_path, (PP_Flash_BrowserOperations_SettingType )setting_type, (PP_Flash_BrowserOperations_Permission )permission, (PP_Bool )clear_site_specific); + return strdup(ToString_PP_Bool(rval).c_str()); +} +char* Call_PPP_Flash_BrowserOperations_SetSitePermission(const PPP_Flash_BrowserOperations* _interface, JSONIterator& iterator) { + char* plugin_data_path; + iterator.skip(); + FromJSON_str_t(iterator, plugin_data_path); + PP_Flash_BrowserOperations_SettingType setting_type; + iterator.skip(); + FromJSON_PP_Flash_BrowserOperations_SettingType(iterator, setting_type); + uint32_t site_count; + iterator.skip(); + FromJSON_uint32_t(iterator, site_count); + struct PP_Flash_BrowserOperations_SiteSetting *sites; + iterator.skip(); + + { + size_t children = iterator.expectArrayAndGotoFirstItem(); + if (children > site_count) { + Fail("Too many items in array\n", ""); + } + sites = new struct PP_Flash_BrowserOperations_SiteSetting[site_count]; + for (uint32_t _n = 0; _n < children; ++_n) { + FromJSON_PP_Flash_BrowserOperations_SiteSetting(iterator, (sites)[_n]); + } + // FIXME Null out remaining items? + } + PP_Bool rval; + rval = _interface->SetSitePermission((const char* )plugin_data_path, (PP_Flash_BrowserOperations_SettingType )setting_type, (uint32_t )site_count, (const struct PP_Flash_BrowserOperations_SiteSetting *)sites); + return strdup(ToString_PP_Bool(rval).c_str()); +} +char* Call_PPP_Flash_BrowserOperations_GetSitesWithData(const PPP_Flash_BrowserOperations* _interface, JSONIterator& iterator) { + char* plugin_data_path; + iterator.skip(); + FromJSON_str_t(iterator, plugin_data_path); + char* *sites; + iterator.skip(); + PointerValueFromJSON(iterator, sites); + _interface->GetSitesWithData((const char* )plugin_data_path, (char*** )&sites); + stringstream os; + BeginElements(os); + BeginProps(os); + { + BeginProp(os, "sites"); + BeginElements(os); + for (uint32_t _n = 0; sites[_n] != 0; ++_n) { + AddElement(os, ToString_str_t(sites[_n])); + } + EndElements(os); + } + EndProps(os); + EndElements(os); + return strdup(os.str().c_str()); +} +char* Call_PPP_Flash_BrowserOperations_FreeSiteList(const PPP_Flash_BrowserOperations* _interface, JSONIterator& iterator) { + char* *sites; + iterator.skip(); + + { + size_t children = iterator.expectArrayAndGotoFirstItem(); + sites = new char*[children]; + for (uint32_t _n = 0; _n < children; ++_n) { + FromJSON_str_t(iterator, (sites)[_n]); + } + // FIXME Null out remaining items? + } + _interface->FreeSiteList((char* *)sites); + stringstream os; + BeginElements(os); + BeginProps(os); + { + BeginProp(os, "sites"); + BeginElements(os); + for (uint32_t _n = 0; sites[_n] != 0; ++_n) { + AddElement(os, ToString_str_t(sites[_n])); + } + EndElements(os); + } + EndProps(os); + EndElements(os); + return strdup(os.str().c_str()); +} +char* Call_PPP_Flash_BrowserOperations(const void* _interface, JSONIterator& iterator) { + iterator.skip(); + const Token& member = iterator.getCurrentStringAndGotoNext(); + string memberName = member.value(); + if (!memberName.compare("ClearSiteData")) { + return Call_PPP_Flash_BrowserOperations_ClearSiteData((const PPP_Flash_BrowserOperations*)_interface, iterator); + } + if (!memberName.compare("DeauthorizeContentLicenses")) { + return Call_PPP_Flash_BrowserOperations_DeauthorizeContentLicenses((const PPP_Flash_BrowserOperations*)_interface, iterator); + } + if (!memberName.compare("GetPermissionSettings")) { + return Call_PPP_Flash_BrowserOperations_GetPermissionSettings((const PPP_Flash_BrowserOperations*)_interface, iterator); + } + if (!memberName.compare("SetDefaultPermission")) { + return Call_PPP_Flash_BrowserOperations_SetDefaultPermission((const PPP_Flash_BrowserOperations*)_interface, iterator); + } + if (!memberName.compare("SetSitePermission")) { + return Call_PPP_Flash_BrowserOperations_SetSitePermission((const PPP_Flash_BrowserOperations*)_interface, iterator); + } + if (!memberName.compare("GetSitesWithData")) { + return Call_PPP_Flash_BrowserOperations_GetSitesWithData((const PPP_Flash_BrowserOperations*)_interface, iterator); + } + if (!memberName.compare("FreeSiteList")) { + return Call_PPP_Flash_BrowserOperations_FreeSiteList((const PPP_Flash_BrowserOperations*)_interface, iterator); + } + return nullptr; +} +char* Call_PPP_Instance_Private_GetInstanceObject(const PPP_Instance_Private* _interface, JSONIterator& iterator) { + PP_Instance instance; + iterator.skip(); + FromJSON_PP_Instance(iterator, instance); + struct PP_Var rval; + rval = _interface->GetInstanceObject((PP_Instance )instance); + return strdup(ToString_PP_Var(rval).c_str()); +} +char* Call_PPP_Instance_Private(const void* _interface, JSONIterator& iterator) { + iterator.skip(); + const Token& member = iterator.getCurrentStringAndGotoNext(); + string memberName = member.value(); + if (!memberName.compare("GetInstanceObject")) { + return Call_PPP_Instance_Private_GetInstanceObject((const PPP_Instance_Private*)_interface, iterator); + } + return nullptr; +} +char* Call_PPP_PexeStreamHandler_DidCacheHit(const PPP_PexeStreamHandler* _interface, JSONIterator& iterator) { + void* user_data; + iterator.skip(); + FromJSON_mem_t(iterator, user_data); + PP_FileHandle nexe_file_handle; + iterator.skip(); + FromJSON_PP_FileHandle(iterator, nexe_file_handle); + _interface->DidCacheHit((void* )user_data, (PP_FileHandle )nexe_file_handle); + stringstream os; + BeginElements(os); + BeginProps(os); + AddProp(os, "user_data", ToString_mem_t(user_data)); + EndProps(os); + EndElements(os); + return strdup(os.str().c_str()); +} +char* Call_PPP_PexeStreamHandler_DidCacheMiss(const PPP_PexeStreamHandler* _interface, JSONIterator& iterator) { + void* user_data; + iterator.skip(); + FromJSON_mem_t(iterator, user_data); + int64_t expected_total_length; + iterator.skip(); + FromJSON_int64_t(iterator, expected_total_length); + PP_FileHandle temp_nexe_file; + iterator.skip(); + FromJSON_PP_FileHandle(iterator, temp_nexe_file); + _interface->DidCacheMiss((void* )user_data, (int64_t )expected_total_length, (PP_FileHandle )temp_nexe_file); + stringstream os; + BeginElements(os); + BeginProps(os); + AddProp(os, "user_data", ToString_mem_t(user_data)); + EndProps(os); + EndElements(os); + return strdup(os.str().c_str()); +} +char* Call_PPP_PexeStreamHandler_DidStreamData(const PPP_PexeStreamHandler* _interface, JSONIterator& iterator) { + void* user_data; + iterator.skip(); + FromJSON_mem_t(iterator, user_data); + void* data; + iterator.skip(); + FromJSON_mem_t(iterator, data); + int32_t length; + iterator.skip(); + FromJSON_int32_t(iterator, length); + _interface->DidStreamData((void* )user_data, (const void* )data, (int32_t )length); + stringstream os; + BeginElements(os); + BeginProps(os); + AddProp(os, "user_data", ToString_mem_t(user_data)); + EndProps(os); + EndElements(os); + return strdup(os.str().c_str()); +} +char* Call_PPP_PexeStreamHandler_DidFinishStream(const PPP_PexeStreamHandler* _interface, JSONIterator& iterator) { + void* user_data; + iterator.skip(); + FromJSON_mem_t(iterator, user_data); + int32_t pp_error; + iterator.skip(); + FromJSON_int32_t(iterator, pp_error); + _interface->DidFinishStream((void* )user_data, (int32_t )pp_error); + stringstream os; + BeginElements(os); + BeginProps(os); + AddProp(os, "user_data", ToString_mem_t(user_data)); + EndProps(os); + EndElements(os); + return strdup(os.str().c_str()); +} +char* Call_PPP_PexeStreamHandler(const void* _interface, JSONIterator& iterator) { + iterator.skip(); + const Token& member = iterator.getCurrentStringAndGotoNext(); + string memberName = member.value(); + if (!memberName.compare("DidCacheHit")) { + return Call_PPP_PexeStreamHandler_DidCacheHit((const PPP_PexeStreamHandler*)_interface, iterator); + } + if (!memberName.compare("DidCacheMiss")) { + return Call_PPP_PexeStreamHandler_DidCacheMiss((const PPP_PexeStreamHandler*)_interface, iterator); + } + if (!memberName.compare("DidStreamData")) { + return Call_PPP_PexeStreamHandler_DidStreamData((const PPP_PexeStreamHandler*)_interface, iterator); + } + if (!memberName.compare("DidFinishStream")) { + return Call_PPP_PexeStreamHandler_DidFinishStream((const PPP_PexeStreamHandler*)_interface, iterator); + } + return nullptr; +} +static map gInterfaces; + +typedef char* (*InterfaceMemberCallFunc)(const void*, JSONIterator&); +static map gInterfaceMemberCallers; + +void InitializeInterfaceList() { + gInterfaces.insert(pair("PPB_Audio;1.0", &_PPB_Audio_1_0)); + gInterfaces.insert(pair("PPB_Audio;1.1", &_PPB_Audio_1_1)); + gInterfaces.insert(pair("PPB_AudioBuffer;0.1", &_PPB_AudioBuffer_0_1)); + gInterfaces.insert(pair("PPB_AudioConfig;1.0", &_PPB_AudioConfig_1_0)); + gInterfaces.insert(pair("PPB_AudioConfig;1.1", &_PPB_AudioConfig_1_1)); + gInterfaces.insert(pair("PPB_AudioEncoder;0.1", &_PPB_AudioEncoder_0_1)); + gInterfaces.insert(pair("PPB_Compositor;0.1", &_PPB_Compositor_0_1)); + gInterfaces.insert(pair("PPB_CompositorLayer;0.1", &_PPB_CompositorLayer_0_1)); + gInterfaces.insert(pair("PPB_CompositorLayer;0.2", &_PPB_CompositorLayer_0_2)); + gInterfaces.insert(pair("PPB_Console;1.0", &_PPB_Console_1_0)); + gInterfaces.insert(pair("PPB_Core;1.0", &_PPB_Core_1_0)); + gInterfaces.insert(pair("PPB_FileIO;1.0", &_PPB_FileIO_1_0)); + gInterfaces.insert(pair("PPB_FileIO;1.1", &_PPB_FileIO_1_1)); + gInterfaces.insert(pair("PPB_FileRef;1.0", &_PPB_FileRef_1_0)); + gInterfaces.insert(pair("PPB_FileRef;1.1", &_PPB_FileRef_1_1)); + gInterfaces.insert(pair("PPB_FileRef;1.2", &_PPB_FileRef_1_2)); + gInterfaces.insert(pair("PPB_FileSystem;1.0", &_PPB_FileSystem_1_0)); + gInterfaces.insert(pair("PPB_Fullscreen;1.0", &_PPB_Fullscreen_1_0)); + gInterfaces.insert(pair("PPB_Gamepad;1.0", &_PPB_Gamepad_1_0)); + gInterfaces.insert(pair("PPB_Graphics2D;1.0", &_PPB_Graphics2D_1_0)); + gInterfaces.insert(pair("PPB_Graphics2D;1.1", &_PPB_Graphics2D_1_1)); + gInterfaces.insert(pair("PPB_Graphics2D;1.2", &_PPB_Graphics2D_1_2)); + gInterfaces.insert(pair("PPB_Graphics3D;1.0", &_PPB_Graphics3D_1_0)); + gInterfaces.insert(pair("PPB_HostResolver;1.0", &_PPB_HostResolver_1_0)); + gInterfaces.insert(pair("PPB_ImageData;1.0", &_PPB_ImageData_1_0)); + gInterfaces.insert(pair("PPB_InputEvent;1.0", &_PPB_InputEvent_1_0)); + gInterfaces.insert(pair("PPB_MouseInputEvent;1.0", &_PPB_MouseInputEvent_1_0)); + gInterfaces.insert(pair("PPB_MouseInputEvent;1.1", &_PPB_MouseInputEvent_1_1)); + gInterfaces.insert(pair("PPB_WheelInputEvent;1.0", &_PPB_WheelInputEvent_1_0)); + gInterfaces.insert(pair("PPB_KeyboardInputEvent;1.0", &_PPB_KeyboardInputEvent_1_0)); + gInterfaces.insert(pair("PPB_KeyboardInputEvent;1.2", &_PPB_KeyboardInputEvent_1_2)); + gInterfaces.insert(pair("PPB_TouchInputEvent;1.0", &_PPB_TouchInputEvent_1_0)); + gInterfaces.insert(pair("PPB_IMEInputEvent;1.0", &_PPB_IMEInputEvent_1_0)); + gInterfaces.insert(pair("PPB_Instance;1.0", &_PPB_Instance_1_0)); + gInterfaces.insert(pair("PPB_MediaStreamAudioTrack;0.1", &_PPB_MediaStreamAudioTrack_0_1)); + gInterfaces.insert(pair("PPB_MediaStreamVideoTrack;0.1", &_PPB_MediaStreamVideoTrack_0_1)); + gInterfaces.insert(pair("PPB_MediaStreamVideoTrack;1.0", &_PPB_MediaStreamVideoTrack_1_0)); + gInterfaces.insert(pair("PPB_MessageLoop;1.0", &_PPB_MessageLoop_1_0)); + gInterfaces.insert(pair("PPB_Messaging;1.0", &_PPB_Messaging_1_0)); + gInterfaces.insert(pair("PPB_Messaging;1.2", &_PPB_Messaging_1_2)); + gInterfaces.insert(pair("PPB_MouseCursor;1.0", &_PPB_MouseCursor_1_0)); + gInterfaces.insert(pair("PPB_MouseLock;1.0", &_PPB_MouseLock_1_0)); + gInterfaces.insert(pair("PPB_NetAddress;1.0", &_PPB_NetAddress_1_0)); + gInterfaces.insert(pair("PPB_NetworkList;1.0", &_PPB_NetworkList_1_0)); + gInterfaces.insert(pair("PPB_NetworkMonitor;1.0", &_PPB_NetworkMonitor_1_0)); + gInterfaces.insert(pair("PPB_NetworkProxy;1.0", &_PPB_NetworkProxy_1_0)); + gInterfaces.insert(pair("PPB_OpenGLES2;1.0", &_PPB_OpenGLES2_1_0)); + gInterfaces.insert(pair("PPB_OpenGLES2InstancedArrays;1.0", &_PPB_OpenGLES2InstancedArrays_1_0)); + gInterfaces.insert(pair("PPB_OpenGLES2FramebufferBlit;1.0", &_PPB_OpenGLES2FramebufferBlit_1_0)); + gInterfaces.insert(pair("PPB_OpenGLES2FramebufferMultisample;1.0", &_PPB_OpenGLES2FramebufferMultisample_1_0)); + gInterfaces.insert(pair("PPB_OpenGLES2ChromiumEnableFeature;1.0", &_PPB_OpenGLES2ChromiumEnableFeature_1_0)); + gInterfaces.insert(pair("PPB_OpenGLES2ChromiumMapSub;1.0", &_PPB_OpenGLES2ChromiumMapSub_1_0)); + gInterfaces.insert(pair("PPB_OpenGLES2Query;1.0", &_PPB_OpenGLES2Query_1_0)); + gInterfaces.insert(pair("PPB_OpenGLES2VertexArrayObject;1.0", &_PPB_OpenGLES2VertexArrayObject_1_0)); + gInterfaces.insert(pair("PPB_TCPSocket;1.0", &_PPB_TCPSocket_1_0)); + gInterfaces.insert(pair("PPB_TCPSocket;1.1", &_PPB_TCPSocket_1_1)); + gInterfaces.insert(pair("PPB_TCPSocket;1.2", &_PPB_TCPSocket_1_2)); + gInterfaces.insert(pair("PPB_TextInputController;1.0", &_PPB_TextInputController_1_0)); + gInterfaces.insert(pair("PPB_UDPSocket;1.0", &_PPB_UDPSocket_1_0)); + gInterfaces.insert(pair("PPB_UDPSocket;1.1", &_PPB_UDPSocket_1_1)); + gInterfaces.insert(pair("PPB_UDPSocket;1.2", &_PPB_UDPSocket_1_2)); + gInterfaces.insert(pair("PPB_URLLoader;1.0", &_PPB_URLLoader_1_0)); + gInterfaces.insert(pair("PPB_URLRequestInfo;1.0", &_PPB_URLRequestInfo_1_0)); + gInterfaces.insert(pair("PPB_URLResponseInfo;1.0", &_PPB_URLResponseInfo_1_0)); + gInterfaces.insert(pair("PPB_Var;1.0", &_PPB_Var_1_0)); + gInterfaces.insert(pair("PPB_Var;1.1", &_PPB_Var_1_1)); + gInterfaces.insert(pair("PPB_Var;1.2", &_PPB_Var_1_2)); + gInterfaces.insert(pair("PPB_VarArray;1.0", &_PPB_VarArray_1_0)); + gInterfaces.insert(pair("PPB_VarArrayBuffer;1.0", &_PPB_VarArrayBuffer_1_0)); + gInterfaces.insert(pair("PPB_VarDictionary;1.0", &_PPB_VarDictionary_1_0)); + gInterfaces.insert(pair("PPB_VideoDecoder;0.1", &_PPB_VideoDecoder_0_1)); + gInterfaces.insert(pair("PPB_VideoDecoder;0.2", &_PPB_VideoDecoder_0_2)); + gInterfaces.insert(pair("PPB_VideoDecoder;1.0", &_PPB_VideoDecoder_1_0)); + gInterfaces.insert(pair("PPB_VideoDecoder;1.1", &_PPB_VideoDecoder_1_1)); + gInterfaces.insert(pair("PPB_VideoEncoder;0.1", &_PPB_VideoEncoder_0_1)); + gInterfaces.insert(pair("PPB_VideoEncoder;0.2", &_PPB_VideoEncoder_0_2)); + gInterfaces.insert(pair("PPB_VideoFrame;0.1", &_PPB_VideoFrame_0_1)); + gInterfaces.insert(pair("PPB_View;1.0", &_PPB_View_1_0)); + gInterfaces.insert(pair("PPB_View;1.1", &_PPB_View_1_1)); + gInterfaces.insert(pair("PPB_View;1.2", &_PPB_View_1_2)); + gInterfaces.insert(pair("PPB_VpnProvider;0.1", &_PPB_VpnProvider_0_1)); + gInterfaces.insert(pair("PPB_WebSocket;1.0", &_PPB_WebSocket_1_0)); + gInterfaces.insert(pair("PPB_BrokerTrusted;0.2", &_PPB_BrokerTrusted_0_2)); + gInterfaces.insert(pair("PPB_BrokerTrusted;0.3", &_PPB_BrokerTrusted_0_3)); + gInterfaces.insert(pair("PPB_BrowserFont_Trusted;1.0", &_PPB_BrowserFont_Trusted_1_0)); + gInterfaces.insert(pair("PPB_CharSet_Trusted;1.0", &_PPB_CharSet_Trusted_1_0)); + gInterfaces.insert(pair("PPB_FileChooserTrusted;0.5", &_PPB_FileChooserTrusted_0_5)); + gInterfaces.insert(pair("PPB_FileChooserTrusted;0.6", &_PPB_FileChooserTrusted_0_6)); + gInterfaces.insert(pair("PPB_URLLoaderTrusted;0.3", &_PPB_URLLoaderTrusted_0_3)); + gInterfaces.insert(pair("PPB_AudioInput(Dev);0.3", &_PPB_AudioInput_Dev_0_3)); + gInterfaces.insert(pair("PPB_AudioInput(Dev);0.4", &_PPB_AudioInput_Dev_0_4)); + gInterfaces.insert(pair("PPB_Buffer(Dev);0.4", &_PPB_Buffer_Dev_0_4)); + gInterfaces.insert(pair("PPB_CharSet(Dev);0.4", &_PPB_CharSet_Dev_0_4)); + gInterfaces.insert(pair("PPB_Crypto(Dev);0.1", &_PPB_Crypto_Dev_0_1)); + gInterfaces.insert(pair("PPB_CursorControl(Dev);0.4", &_PPB_CursorControl_Dev_0_4)); + gInterfaces.insert(pair("PPB_DeviceRef(Dev);0.1", &_PPB_DeviceRef_Dev_0_1)); + gInterfaces.insert(pair("PPB_FileChooser(Dev);0.5", &_PPB_FileChooser_Dev_0_5)); + gInterfaces.insert(pair("PPB_FileChooser(Dev);0.6", &_PPB_FileChooser_Dev_0_6)); + gInterfaces.insert(pair("PPB_Font(Dev);0.6", &_PPB_Font_Dev_0_6)); + gInterfaces.insert(pair("PPB_IMEInputEvent(Dev);0.1", &_PPB_IMEInputEvent_Dev_0_1)); + gInterfaces.insert(pair("PPB_IMEInputEvent(Dev);0.2", &_PPB_IMEInputEvent_Dev_0_2)); + gInterfaces.insert(pair("PPB_Memory(Dev);0.1", &_PPB_Memory_Dev_0_1)); + gInterfaces.insert(pair("PPB_OpenGLES2DrawBuffers(Dev);1.0", &_PPB_OpenGLES2DrawBuffers_Dev_1_0)); + gInterfaces.insert(pair("PPB_Printing(Dev);0.7", &_PPB_Printing_Dev_0_7)); + gInterfaces.insert(pair("PPB_TextInput(Dev);0.1", &_PPB_TextInput_Dev_0_1)); + gInterfaces.insert(pair("PPB_TextInput(Dev);0.2", &_PPB_TextInput_Dev_0_2)); + gInterfaces.insert(pair("PPB_Trace_Event(Dev);0.1", &_PPB_Trace_Event_Dev_0_1)); + gInterfaces.insert(pair("PPB_Trace_Event(Dev);0.2", &_PPB_Trace_Event_Dev_0_2)); + gInterfaces.insert(pair("PPB_TrueTypeFont(Dev);0.1", &_PPB_TrueTypeFont_Dev_0_1)); + gInterfaces.insert(pair("PPB_URLUtil(Dev);0.6", &_PPB_URLUtil_Dev_0_6)); + gInterfaces.insert(pair("PPB_URLUtil(Dev);0.7", &_PPB_URLUtil_Dev_0_7)); + gInterfaces.insert(pair("PPB_Var(Deprecated);0.3", &_PPB_Var_Deprecated_0_3)); + gInterfaces.insert(pair("PPB_VideoCapture(Dev);0.3", &_PPB_VideoCapture_Dev_0_3)); + gInterfaces.insert(pair("PPB_VideoDecoder(Dev);0.16", &_PPB_VideoDecoder_Dev_0_16)); + gInterfaces.insert(pair("PPB_View(Dev);0.1", &_PPB_View_Dev_0_1)); + gInterfaces.insert(pair("PPB_CameraCapabilities_Private;0.1", &_PPB_CameraCapabilities_Private_0_1)); + gInterfaces.insert(pair("PPB_CameraDevice_Private;0.1", &_PPB_CameraDevice_Private_0_1)); + gInterfaces.insert(pair("PPB_ContentDecryptor_Private;0.14", &_PPB_ContentDecryptor_Private_0_14)); + gInterfaces.insert(pair("PPB_DisplayColorProfile_Private;0.1", &_PPB_DisplayColorProfile_Private_0_1)); + gInterfaces.insert(pair("PPB_Ext_CrxFileSystem_Private;0.1", &_PPB_Ext_CrxFileSystem_Private_0_1)); + gInterfaces.insert(pair("PPB_FileIO_Private;0.1", &_PPB_FileIO_Private_0_1)); + gInterfaces.insert(pair("PPB_FileRefPrivate;0.1", &_PPB_FileRefPrivate_0_1)); + gInterfaces.insert(pair("PPB_Find_Private;0.3", &_PPB_Find_Private_0_3)); + gInterfaces.insert(pair("PPB_Flash;12.4", &_PPB_Flash_12_4)); + gInterfaces.insert(pair("PPB_Flash;12.5", &_PPB_Flash_12_5)); + gInterfaces.insert(pair("PPB_Flash;12.6", &_PPB_Flash_12_6)); + gInterfaces.insert(pair("PPB_Flash;13.0", &_PPB_Flash_13_0)); + gInterfaces.insert(pair("PPB_Flash_Clipboard;4.0", &_PPB_Flash_Clipboard_4_0)); + gInterfaces.insert(pair("PPB_Flash_Clipboard;5.0", &_PPB_Flash_Clipboard_5_0)); + gInterfaces.insert(pair("PPB_Flash_Clipboard;5.1", &_PPB_Flash_Clipboard_5_1)); + gInterfaces.insert(pair("PPB_Flash_DeviceID;1.0", &_PPB_Flash_DeviceID_1_0)); + gInterfaces.insert(pair("PPB_Flash_DRM;1.0", &_PPB_Flash_DRM_1_0)); + gInterfaces.insert(pair("PPB_Flash_DRM;1.1", &_PPB_Flash_DRM_1_1)); + gInterfaces.insert(pair("PPB_Flash_File_ModuleLocal;3", &_PPB_Flash_File_ModuleLocal_3_0)); + gInterfaces.insert(pair("PPB_Flash_File_FileRef;2", &_PPB_Flash_File_FileRef_2_0)); + gInterfaces.insert(pair("PPB_Flash_FontFile;0.1", &_PPB_Flash_FontFile_0_1)); + gInterfaces.insert(pair("PPB_Flash_FontFile;0.2", &_PPB_Flash_FontFile_0_2)); + gInterfaces.insert(pair("PPB_FlashFullscreen;0.1", &_PPB_FlashFullscreen_0_1)); + gInterfaces.insert(pair("PPB_FlashFullscreen;1.0", &_PPB_FlashFullscreen_1_0)); + gInterfaces.insert(pair("PPB_Flash_Menu;0.2", &_PPB_Flash_Menu_0_2)); + gInterfaces.insert(pair("PPB_Flash_MessageLoop;0.1", &_PPB_Flash_MessageLoop_0_1)); + gInterfaces.insert(pair("PPB_Flash_Print;1.0", &_PPB_Flash_Print_1_0)); + gInterfaces.insert(pair("PPB_HostResolver_Private;0.1", &_PPB_HostResolver_Private_0_1)); + gInterfaces.insert(pair("PPB_Instance_Private;0.1", &_PPB_Instance_Private_0_1)); + gInterfaces.insert(pair("PPB_IsolatedFileSystem_Private;0.2", &_PPB_IsolatedFileSystem_Private_0_2)); + gInterfaces.insert(pair("PPB_NetAddress_Private;0.1", &_PPB_NetAddress_Private_0_1)); + gInterfaces.insert(pair("PPB_NetAddress_Private;1.0", &_PPB_NetAddress_Private_1_0)); + gInterfaces.insert(pair("PPB_NetAddress_Private;1.1", &_PPB_NetAddress_Private_1_1)); + gInterfaces.insert(pair("PPB_OutputProtection_Private;0.1", &_PPB_OutputProtection_Private_0_1)); + gInterfaces.insert(pair("PPB_PDF;1", &_PPB_PDF_0_1)); + gInterfaces.insert(pair("PPB_PlatformVerification_Private;0.2", &_PPB_PlatformVerification_Private_0_2)); + gInterfaces.insert(pair("PPB_TCPServerSocket_Private;0.1", &_PPB_TCPServerSocket_Private_0_1)); + gInterfaces.insert(pair("PPB_TCPServerSocket_Private;0.2", &_PPB_TCPServerSocket_Private_0_2)); + gInterfaces.insert(pair("PPB_TCPSocket_Private;0.3", &_PPB_TCPSocket_Private_0_3)); + gInterfaces.insert(pair("PPB_TCPSocket_Private;0.4", &_PPB_TCPSocket_Private_0_4)); + gInterfaces.insert(pair("PPB_TCPSocket_Private;0.5", &_PPB_TCPSocket_Private_0_5)); + gInterfaces.insert(pair("PPB_Testing_Private;1.0", &_PPB_Testing_Private_1_0)); + gInterfaces.insert(pair("PPB_UDPSocket_Private;0.2", &_PPB_UDPSocket_Private_0_2)); + gInterfaces.insert(pair("PPB_UDPSocket_Private;0.3", &_PPB_UDPSocket_Private_0_3)); + gInterfaces.insert(pair("PPB_UDPSocket_Private;0.4", &_PPB_UDPSocket_Private_0_4)); + gInterfaces.insert(pair("PPB_UMA_Private;0.3", &_PPB_UMA_Private_0_3)); + gInterfaces.insert(pair("PPB_VideoDestination_Private;0.1", &_PPB_VideoDestination_Private_0_1)); + gInterfaces.insert(pair("PPB_VideoSource_Private;0.1", &_PPB_VideoSource_Private_0_1)); + gInterfaces.insert(pair("PPB_X509Certificate_Private;0.1", &_PPB_X509Certificate_Private_0_1)); + gInterfaceMemberCallers.insert(pair("PPP_Graphics_3D;1.0", Call_PPP_Graphics3D)); + gInterfaceMemberCallers.insert(pair("PPP_InputEvent;0.1", Call_PPP_InputEvent)); + gInterfaceMemberCallers.insert(pair("PPP_Instance;1.0", Call_PPP_Instance_1_0)); + gInterfaceMemberCallers.insert(pair("PPP_Instance;1.1", Call_PPP_Instance)); + gInterfaceMemberCallers.insert(pair("PPP_MessageHandler;0.2", Call_PPP_MessageHandler)); + gInterfaceMemberCallers.insert(pair("PPP_Messaging;1.0", Call_PPP_Messaging)); + gInterfaceMemberCallers.insert(pair("PPP_MouseLock;1.0", Call_PPP_MouseLock)); + gInterfaceMemberCallers.insert(pair("PPP_Class_Deprecated;1.0", Call_PPP_Class_Deprecated)); + gInterfaceMemberCallers.insert(pair("PPP_NetworkState(Dev);0.1", Call_PPP_NetworkState_Dev)); + gInterfaceMemberCallers.insert(pair("PPP_Printing(Dev);0.6", Call_PPP_Printing_Dev)); + gInterfaceMemberCallers.insert(pair("PPP_TextInput(Dev);0.1", Call_PPP_TextInput_Dev)); + gInterfaceMemberCallers.insert(pair("PPP_VideoCapture(Dev);0.1", Call_PPP_VideoCapture_Dev)); + gInterfaceMemberCallers.insert(pair("PPP_VideoDecoder(Dev);0.11", Call_PPP_VideoDecoder_Dev)); + gInterfaceMemberCallers.insert(pair("PPP_ContentDecryptor_Private;0.16", Call_PPP_ContentDecryptor_Private)); + gInterfaceMemberCallers.insert(pair("PPP_Find_Private;0.3", Call_PPP_Find_Private)); + gInterfaceMemberCallers.insert(pair("PPP_Flash_BrowserOperations;1.0", Call_PPP_Flash_BrowserOperations_1_0)); + gInterfaceMemberCallers.insert(pair("PPP_Flash_BrowserOperations;1.2", Call_PPP_Flash_BrowserOperations_1_2)); + gInterfaceMemberCallers.insert(pair("PPP_Flash_BrowserOperations;1.3", Call_PPP_Flash_BrowserOperations)); + gInterfaceMemberCallers.insert(pair("PPP_Instance_Private;0.1", Call_PPP_Instance_Private)); + gInterfaceMemberCallers.insert(pair("PPP_PexeStreamHandler;1.0", Call_PPP_PexeStreamHandler)); +}; +