├── .github ├── CONTRIBUTING.md ├── FUNDING.yml └── ISSUE_TEMPLATE.md ├── .gitignore ├── .vscode ├── c_cpp_properties.json └── settings.json ├── Authors ├── License ├── README.md ├── api ├── API-categories.md ├── API-index.md ├── AccessibilityHandler.md ├── ApplicationSettings.md ├── Browser.md ├── BrowserSettings.md ├── Callback.md ├── CommandLineSwitches.md ├── Cookie.md ├── CookieManager.md ├── CookieVisitor.md ├── DisplayHandler.md ├── DownloadHandler.md ├── DpiAware.md ├── DragData.md ├── FocusHandler.md ├── Frame.md ├── Image.md ├── JavascriptBindings.md ├── JavascriptCallback.md ├── JavascriptDialogHandler.md ├── KeyboardHandler.md ├── LifespanHandler.md ├── LoadHandler.md ├── NetworkError.md ├── PaintBuffer.md ├── RenderHandler.md ├── Request.md ├── RequestHandler.md ├── ResourceHandler.md ├── Response.md ├── StringVisitor.md ├── V8ContextHandler.md ├── VirtualKey.md ├── WebPluginInfo.md ├── WebRequest.md ├── WebRequestClient.md ├── WindowInfo.md ├── WindowUtils.md └── cefpython.md ├── docs ├── API.md ├── Build-instructions.md ├── Contributing-code.md ├── Examples.md ├── Knowledge-Base.md ├── Migration-guide.md └── Tutorial.md ├── examples ├── README-examples.md ├── gtk2.py ├── gtk3.py ├── hello_world.py ├── pyinstaller │ ├── README-pyinstaller.md │ ├── hook-cefpython3.py │ ├── pyinstaller.py │ ├── pyinstaller.spec │ └── screenshots │ │ ├── cefapp_directory.jpg │ │ └── cefapp_fatal_error.jpg ├── pysdl2.py ├── pywin32.py ├── qt.py ├── resources │ ├── back.gif │ ├── back.png │ ├── chromium.ico │ ├── forward.gif │ ├── forward.png │ ├── gtk.png │ ├── pyqt4.png │ ├── pyqt5.png │ ├── pyside.png │ ├── reload.gif │ ├── reload.png │ ├── tkinter.gif │ ├── tkinter.png │ ├── wxpython.ico │ └── wxpython.png ├── screenshot.py ├── snippets │ ├── README-snippets.md │ ├── cookies.py │ ├── javascript_bindings.py │ ├── javascript_errors.py │ ├── keyboard_handler.py │ ├── mouse_clicks.py │ ├── network_cookies.py │ ├── onbeforeclose.py │ ├── ondomready.py │ ├── onpagecomplete.py │ ├── setcookie.py │ └── window_size.py ├── tkinter_.py ├── tutorial.py └── wxpython.py ├── patches ├── include.gypi ├── issue125.patch ├── issue218_linux.patch ├── issue231.patch ├── issue73_linux └── patch.py ├── src ├── .gitignore ├── app.pyx ├── browser.pyx ├── callback.pyx ├── cef_types.pyx ├── cef_v32..v51_changes.txt ├── cef_v59..v66_changes.txt ├── cefpython.pyx ├── cefpython3.wx │ ├── README.txt │ ├── __init__.py │ ├── chromectrl.py │ ├── examples │ │ ├── back.png │ │ ├── forward.png │ │ ├── reload_page.png │ │ ├── sample1.html │ │ ├── sample1.py │ │ ├── sample2.py │ │ └── sample3.py │ ├── images │ │ ├── back.png │ │ ├── forward.png │ │ └── reload_page.png │ └── utils.py ├── client_handler │ ├── .gitignore │ ├── Makefile │ ├── accessibility_handler.cpp │ ├── accessibility_handler.h │ ├── cef_log.cpp │ ├── cef_log.h │ ├── client_handler.cpp │ ├── client_handler.h │ ├── context_menu_handler.cpp │ ├── context_menu_handler.h │ ├── cookie_visitor.cpp │ ├── cookie_visitor.h │ ├── deprecated │ │ ├── deprecated_client_handler_py27_64bit.vcproj │ │ ├── deprecated_client_handler_py27_win32.vcproj │ │ └── deprecated_client_handler_py34_32bit.vcproj │ ├── dialog_handler.cpp │ ├── dialog_handler.h │ ├── dialog_handler_gtk.cpp │ ├── dialog_handler_gtk.h │ ├── dialog_handler_gtk.patch │ ├── display_handler.cpp │ ├── display_handler.h │ ├── download_handler.cpp │ ├── download_handler.h │ ├── dpi_aware.cpp │ ├── dpi_aware.h │ ├── focus_handler.cpp │ ├── focus_handler.h │ ├── js_dialog_handler.cpp │ ├── js_dialog_handler.h │ ├── keyboard_handler.cpp │ ├── keyboard_handler.h │ ├── lifespan_handler.cpp │ ├── lifespan_handler.h │ ├── load_handler.cpp │ ├── load_handler.h │ ├── render_handler.cpp │ ├── render_handler.h │ ├── request_context_handler.cpp │ ├── request_context_handler.h │ ├── request_handler.cpp │ ├── request_handler.h │ ├── resource_handler.cpp │ ├── resource_handler.h │ ├── string_visitor.cpp │ ├── string_visitor.h │ ├── task.cpp │ ├── task.h │ ├── util_mac.h │ ├── util_mac.mm │ ├── web_request_client.cpp │ ├── web_request_client.h │ ├── x11.cpp │ └── x11.h ├── command_line.pyx ├── common │ ├── cefpython_public_api.h │ └── util.h ├── compile_time_constants.pxi ├── cookie.pyx ├── cpp_utils │ ├── .gitignore │ ├── Makefile │ ├── PaintBuffer.cpp │ ├── PaintBuffer.h │ ├── cpp_utils_win32.vcproj │ └── deprecated_cpp_utils_64bit.vcproj ├── download.pyx ├── dpi_aware_win.pyx ├── drag_data.pyx ├── extern │ ├── cef │ │ ├── cef_app.pxd │ │ ├── cef_browser.pxd │ │ ├── cef_browser_static.pxd │ │ ├── cef_callback.pxd │ │ ├── cef_client.pxd │ │ ├── cef_command_line.pxd │ │ ├── cef_cookie.pxd │ │ ├── cef_cookie_manager_namespace.pxd │ │ ├── cef_download_handler.pxd │ │ ├── cef_download_item.pxd │ │ ├── cef_drag_data.pxd │ │ ├── cef_file_util.pxd │ │ ├── cef_frame.pxd │ │ ├── cef_image.pxd │ │ ├── cef_jsdialog_handler.pxd │ │ ├── cef_linux.pxd │ │ ├── cef_mac.pxd │ │ ├── cef_path_util.pxd │ │ ├── cef_platform.pxd │ │ ├── cef_process_message.pxd │ │ ├── cef_ptr.pxd │ │ ├── cef_request.pxd │ │ ├── cef_request_context.pxd │ │ ├── cef_request_context_handler.pxd │ │ ├── cef_request_handler.pxd │ │ ├── cef_resource_handler.pxd │ │ ├── cef_response.pxd │ │ ├── cef_scoped_refptr.pxd │ │ ├── cef_string.pxd │ │ ├── cef_string_visitor.pxd │ │ ├── cef_task.pxd │ │ ├── cef_time.pxd │ │ ├── cef_types.pxd │ │ ├── cef_urlrequest.pxd │ │ ├── cef_values.pxd │ │ ├── cef_views.pxd │ │ ├── cef_web_plugin.pxd │ │ └── cef_win.pxd │ ├── cef_log.pxd │ ├── cefpython_app.pxd │ ├── client_handler.pxd │ ├── cookie_visitor.pxd │ ├── cpp_utils.pxd │ ├── ctime.pxd │ ├── dpi_aware_win.pxd │ ├── linux.pxd │ ├── mac.pxd │ ├── main_message_loop.pxd │ ├── multimap.pxd │ ├── request_context_handler.pxd │ ├── resource_handler.pxd │ ├── string_visitor.pxd │ ├── task.pxd │ ├── web_request_client.pxd │ ├── windows.pxd │ ├── wstring.pxd │ └── x11.pxd ├── frame.pyx ├── handlers │ ├── accessibility_handler.pyx │ ├── browser_process_handler.pyx │ ├── display_handler.pyx │ ├── download_handler.pyx │ ├── focus_handler.pyx │ ├── javascript_dialog_handler.pyx │ ├── keyboard_handler.pyx │ ├── lifespan_handler.pyx │ ├── load_handler.pyx │ ├── render_handler.pyx │ ├── request_handler.pyx │ ├── resource_handler.pyx │ ├── v8context_handler.pyx │ └── v8function_handler.pyx ├── helpers.pyx ├── image.pyx ├── include.old │ ├── base │ │ ├── cef_atomic_ref_count.h │ │ ├── cef_atomicops.h │ │ ├── cef_basictypes.h │ │ ├── cef_bind.h │ │ ├── cef_bind_helpers.h │ │ ├── cef_build.h │ │ ├── cef_callback.h │ │ ├── cef_callback_forward.h │ │ ├── cef_callback_helpers.h │ │ ├── cef_callback_list.h │ │ ├── cef_cancelable_callback.h │ │ ├── cef_lock.h │ │ ├── cef_logging.h │ │ ├── cef_macros.h │ │ ├── cef_move.h │ │ ├── cef_platform_thread.h │ │ ├── cef_ref_counted.h │ │ ├── cef_scoped_ptr.h │ │ ├── cef_string16.h │ │ ├── cef_template_util.h │ │ ├── cef_thread_checker.h │ │ ├── cef_thread_collision_warner.h │ │ ├── cef_trace_event.h │ │ ├── cef_tuple.h │ │ ├── cef_weak_ptr.h │ │ └── internal │ │ │ ├── cef_atomicops_arm_gcc.h │ │ │ ├── cef_atomicops_atomicword_compat.h │ │ │ ├── cef_atomicops_mac.h │ │ │ ├── cef_atomicops_x86_gcc.h │ │ │ ├── cef_atomicops_x86_msvc.h │ │ │ ├── cef_bind_internal.h │ │ │ ├── cef_bind_internal_win.h │ │ │ ├── cef_callback_internal.h │ │ │ ├── cef_lock_impl.h │ │ │ ├── cef_raw_scoped_refptr_mismatch_checker.h │ │ │ └── cef_thread_checker_impl.h │ ├── cef_accessibility_handler.h │ ├── cef_app.h │ ├── cef_application_mac.h │ ├── cef_auth_callback.h │ ├── cef_base.h │ ├── cef_browser.h │ ├── cef_browser_process_handler.h │ ├── cef_callback.h │ ├── cef_client.h │ ├── cef_command_line.h │ ├── cef_context_menu_handler.h │ ├── cef_cookie.h │ ├── cef_crash_util.h │ ├── cef_dialog_handler.h │ ├── cef_display_handler.h │ ├── cef_dom.h │ ├── cef_download_handler.h │ ├── cef_download_item.h │ ├── cef_drag_data.h │ ├── cef_drag_handler.h │ ├── cef_extension.h │ ├── cef_extension_handler.h │ ├── cef_file_util.h │ ├── cef_find_handler.h │ ├── cef_focus_handler.h │ ├── cef_frame.h │ ├── cef_image.h │ ├── cef_jsdialog_handler.h │ ├── cef_keyboard_handler.h │ ├── cef_life_span_handler.h │ ├── cef_load_handler.h │ ├── cef_menu_model.h │ ├── cef_menu_model_delegate.h │ ├── cef_navigation_entry.h │ ├── cef_origin_whitelist.h │ ├── cef_parser.h │ ├── cef_path_util.h │ ├── cef_print_handler.h │ ├── cef_print_settings.h │ ├── cef_process_message.h │ ├── cef_process_util.h │ ├── cef_render_handler.h │ ├── cef_render_process_handler.h │ ├── cef_request.h │ ├── cef_request_context.h │ ├── cef_request_context_handler.h │ ├── cef_request_handler.h │ ├── cef_resource_bundle.h │ ├── cef_resource_bundle_handler.h │ ├── cef_resource_handler.h │ ├── cef_response.h │ ├── cef_response_filter.h │ ├── cef_sandbox_win.h │ ├── cef_scheme.h │ ├── cef_server.h │ ├── cef_ssl_info.h │ ├── cef_ssl_status.h │ ├── cef_stream.h │ ├── cef_string_visitor.h │ ├── cef_task.h │ ├── cef_thread.h │ ├── cef_trace.h │ ├── cef_urlrequest.h │ ├── cef_v8.h │ ├── cef_values.h │ ├── cef_waitable_event.h │ ├── cef_web_plugin.h │ ├── cef_x509_certificate.h │ ├── cef_xml_reader.h │ ├── cef_zip_reader.h │ ├── internal │ │ ├── cef_export.h │ │ ├── cef_linux.h │ │ ├── cef_logging_internal.h │ │ ├── cef_mac.h │ │ ├── cef_ptr.h │ │ ├── cef_string.h │ │ ├── cef_string_list.h │ │ ├── cef_string_map.h │ │ ├── cef_string_multimap.h │ │ ├── cef_string_types.h │ │ ├── cef_string_wrappers.h │ │ ├── cef_thread_internal.h │ │ ├── cef_time.h │ │ ├── cef_trace_event_internal.h │ │ ├── cef_types.h │ │ ├── cef_types_linux.h │ │ ├── cef_types_mac.h │ │ ├── cef_types_win.h │ │ ├── cef_types_wrappers.h │ │ └── cef_win.h │ ├── test │ │ ├── cef_test_helpers.h │ │ └── cef_translator_test.h │ ├── views │ │ ├── cef_box_layout.h │ │ ├── cef_browser_view.h │ │ ├── cef_browser_view_delegate.h │ │ ├── cef_button.h │ │ ├── cef_button_delegate.h │ │ ├── cef_display.h │ │ ├── cef_fill_layout.h │ │ ├── cef_label_button.h │ │ ├── cef_layout.h │ │ ├── cef_menu_button.h │ │ ├── cef_menu_button_delegate.h │ │ ├── cef_panel.h │ │ ├── cef_panel_delegate.h │ │ ├── cef_scroll_view.h │ │ ├── cef_textfield.h │ │ ├── cef_textfield_delegate.h │ │ ├── cef_view.h │ │ ├── cef_view_delegate.h │ │ ├── cef_window.h │ │ └── cef_window_delegate.h │ └── wrapper │ │ ├── cef_byte_read_handler.h │ │ ├── cef_closure_task.h │ │ ├── cef_helpers.h │ │ ├── cef_message_router.h │ │ ├── cef_resource_manager.h │ │ ├── cef_scoped_temp_dir.h │ │ ├── cef_stream_resource_handler.h │ │ ├── cef_xml_object.h │ │ └── cef_zip_archive.h ├── include │ ├── base │ │ ├── cef_atomic_flag.h │ │ ├── cef_atomic_ref_count.h │ │ ├── cef_auto_reset.h │ │ ├── cef_basictypes.h │ │ ├── cef_bind.h │ │ ├── cef_build.h │ │ ├── cef_callback.h │ │ ├── cef_callback_forward.h │ │ ├── cef_callback_helpers.h │ │ ├── cef_callback_list.h │ │ ├── cef_cancelable_callback.h │ │ ├── cef_compiler_specific.h │ │ ├── cef_lock.h │ │ ├── cef_logging.h │ │ ├── cef_macros.h │ │ ├── cef_platform_thread.h │ │ ├── cef_ptr_util.h │ │ ├── cef_ref_counted.h │ │ ├── cef_scoped_refptr.h │ │ ├── cef_template_util.h │ │ ├── cef_thread_checker.h │ │ ├── cef_trace_event.h │ │ ├── cef_tuple.h │ │ ├── cef_weak_ptr.h │ │ └── internal │ │ │ ├── README-TRANSFER.txt │ │ │ ├── cef_bind_internal.h │ │ │ ├── cef_callback_internal.h │ │ │ ├── cef_lock_impl.h │ │ │ ├── cef_net_error_list.h │ │ │ ├── cef_raw_scoped_refptr_mismatch_checker.h │ │ │ ├── cef_scoped_policy.h │ │ │ └── cef_thread_checker_impl.h │ ├── capi │ │ ├── cef_accessibility_handler_capi.h │ │ ├── cef_app_capi.h │ │ ├── cef_audio_handler_capi.h │ │ ├── cef_auth_callback_capi.h │ │ ├── cef_base_capi.h │ │ ├── cef_browser_capi.h │ │ ├── cef_browser_process_handler_capi.h │ │ ├── cef_callback_capi.h │ │ ├── cef_client_capi.h │ │ ├── cef_command_handler_capi.h │ │ ├── cef_command_line_capi.h │ │ ├── cef_context_menu_handler_capi.h │ │ ├── cef_cookie_capi.h │ │ ├── cef_crash_util_capi.h │ │ ├── cef_devtools_message_observer_capi.h │ │ ├── cef_dialog_handler_capi.h │ │ ├── cef_display_handler_capi.h │ │ ├── cef_dom_capi.h │ │ ├── cef_download_handler_capi.h │ │ ├── cef_download_item_capi.h │ │ ├── cef_drag_data_capi.h │ │ ├── cef_drag_handler_capi.h │ │ ├── cef_extension_capi.h │ │ ├── cef_extension_handler_capi.h │ │ ├── cef_file_util_capi.h │ │ ├── cef_find_handler_capi.h │ │ ├── cef_focus_handler_capi.h │ │ ├── cef_frame_capi.h │ │ ├── cef_frame_handler_capi.h │ │ ├── cef_i18n_util_capi.h │ │ ├── cef_image_capi.h │ │ ├── cef_jsdialog_handler_capi.h │ │ ├── cef_keyboard_handler_capi.h │ │ ├── cef_life_span_handler_capi.h │ │ ├── cef_load_handler_capi.h │ │ ├── cef_media_router_capi.h │ │ ├── cef_menu_model_capi.h │ │ ├── cef_menu_model_delegate_capi.h │ │ ├── cef_navigation_entry_capi.h │ │ ├── cef_origin_whitelist_capi.h │ │ ├── cef_parser_capi.h │ │ ├── cef_path_util_capi.h │ │ ├── cef_permission_handler_capi.h │ │ ├── cef_preference_capi.h │ │ ├── cef_print_handler_capi.h │ │ ├── cef_print_settings_capi.h │ │ ├── cef_process_message_capi.h │ │ ├── cef_process_util_capi.h │ │ ├── cef_registration_capi.h │ │ ├── cef_render_handler_capi.h │ │ ├── cef_render_process_handler_capi.h │ │ ├── cef_request_capi.h │ │ ├── cef_request_context_capi.h │ │ ├── cef_request_context_handler_capi.h │ │ ├── cef_request_handler_capi.h │ │ ├── cef_resource_bundle_capi.h │ │ ├── cef_resource_bundle_handler_capi.h │ │ ├── cef_resource_handler_capi.h │ │ ├── cef_resource_request_handler_capi.h │ │ ├── cef_response_capi.h │ │ ├── cef_response_filter_capi.h │ │ ├── cef_scheme_capi.h │ │ ├── cef_server_capi.h │ │ ├── cef_shared_memory_region_capi.h │ │ ├── cef_shared_process_message_builder_capi.h │ │ ├── cef_ssl_info_capi.h │ │ ├── cef_ssl_status_capi.h │ │ ├── cef_stream_capi.h │ │ ├── cef_string_visitor_capi.h │ │ ├── cef_task_capi.h │ │ ├── cef_thread_capi.h │ │ ├── cef_trace_capi.h │ │ ├── cef_urlrequest_capi.h │ │ ├── cef_v8_capi.h │ │ ├── cef_values_capi.h │ │ ├── cef_waitable_event_capi.h │ │ ├── cef_x509_certificate_capi.h │ │ ├── cef_xml_reader_capi.h │ │ ├── cef_zip_reader_capi.h │ │ ├── test │ │ │ ├── cef_test_helpers_capi.h │ │ │ ├── cef_test_server_capi.h │ │ │ └── cef_translator_test_capi.h │ │ └── views │ │ │ ├── cef_box_layout_capi.h │ │ │ ├── cef_browser_view_capi.h │ │ │ ├── cef_browser_view_delegate_capi.h │ │ │ ├── cef_button_capi.h │ │ │ ├── cef_button_delegate_capi.h │ │ │ ├── cef_display_capi.h │ │ │ ├── cef_fill_layout_capi.h │ │ │ ├── cef_label_button_capi.h │ │ │ ├── cef_layout_capi.h │ │ │ ├── cef_menu_button_capi.h │ │ │ ├── cef_menu_button_delegate_capi.h │ │ │ ├── cef_overlay_controller_capi.h │ │ │ ├── cef_panel_capi.h │ │ │ ├── cef_panel_delegate_capi.h │ │ │ ├── cef_scroll_view_capi.h │ │ │ ├── cef_textfield_capi.h │ │ │ ├── cef_textfield_delegate_capi.h │ │ │ ├── cef_view_capi.h │ │ │ ├── cef_view_delegate_capi.h │ │ │ ├── cef_window_capi.h │ │ │ └── cef_window_delegate_capi.h │ ├── cef_accessibility_handler.h │ ├── cef_api_hash.h │ ├── cef_app.h │ ├── cef_audio_handler.h │ ├── cef_auth_callback.h │ ├── cef_base.h │ ├── cef_browser.h │ ├── cef_browser_process_handler.h │ ├── cef_callback.h │ ├── cef_client.h │ ├── cef_command_handler.h │ ├── cef_command_ids.h │ ├── cef_command_line.h │ ├── cef_config.h │ ├── cef_context_menu_handler.h │ ├── cef_cookie.h │ ├── cef_crash_util.h │ ├── cef_devtools_message_observer.h │ ├── cef_dialog_handler.h │ ├── cef_display_handler.h │ ├── cef_dom.h │ ├── cef_download_handler.h │ ├── cef_download_item.h │ ├── cef_drag_data.h │ ├── cef_drag_handler.h │ ├── cef_extension.h │ ├── cef_extension_handler.h │ ├── cef_file_util.h │ ├── cef_find_handler.h │ ├── cef_focus_handler.h │ ├── cef_frame.h │ ├── cef_frame_handler.h │ ├── cef_i18n_util.h │ ├── cef_image.h │ ├── cef_jsdialog_handler.h │ ├── cef_keyboard_handler.h │ ├── cef_life_span_handler.h │ ├── cef_load_handler.h │ ├── cef_media_router.h │ ├── cef_menu_model.h │ ├── cef_menu_model_delegate.h │ ├── cef_navigation_entry.h │ ├── cef_origin_whitelist.h │ ├── cef_pack_resources.h │ ├── cef_pack_strings.h │ ├── cef_parser.h │ ├── cef_path_util.h │ ├── cef_permission_handler.h │ ├── cef_preference.h │ ├── cef_print_handler.h │ ├── cef_print_settings.h │ ├── cef_process_message.h │ ├── cef_process_util.h │ ├── cef_registration.h │ ├── cef_render_handler.h │ ├── cef_render_process_handler.h │ ├── cef_request.h │ ├── cef_request_context.h │ ├── cef_request_context_handler.h │ ├── cef_request_handler.h │ ├── cef_resource_bundle.h │ ├── cef_resource_bundle_handler.h │ ├── cef_resource_handler.h │ ├── cef_resource_request_handler.h │ ├── cef_response.h │ ├── cef_response_filter.h │ ├── cef_sandbox_win.h │ ├── cef_scheme.h │ ├── cef_server.h │ ├── cef_shared_memory_region.h │ ├── cef_shared_process_message_builder.h │ ├── cef_ssl_info.h │ ├── cef_ssl_status.h │ ├── cef_stream.h │ ├── cef_string_visitor.h │ ├── cef_task.h │ ├── cef_thread.h │ ├── cef_trace.h │ ├── cef_urlrequest.h │ ├── cef_v8.h │ ├── cef_values.h │ ├── cef_version.h │ ├── cef_waitable_event.h │ ├── cef_x509_certificate.h │ ├── cef_xml_reader.h │ ├── cef_zip_reader.h │ ├── internal │ │ ├── cef_app_win.h │ │ ├── cef_export.h │ │ ├── cef_logging_internal.h │ │ ├── cef_ptr.h │ │ ├── cef_string.h │ │ ├── cef_string_list.h │ │ ├── cef_string_map.h │ │ ├── cef_string_multimap.h │ │ ├── cef_string_types.h │ │ ├── cef_string_wrappers.h │ │ ├── cef_thread_internal.h │ │ ├── cef_time.h │ │ ├── cef_time_wrappers.h │ │ ├── cef_trace_event_internal.h │ │ ├── cef_types.h │ │ ├── cef_types_geometry.h │ │ ├── cef_types_win.h │ │ ├── cef_types_wrappers.h │ │ └── cef_win.h │ ├── test │ │ ├── cef_test_helpers.h │ │ ├── cef_test_server.h │ │ └── cef_translator_test.h │ ├── views │ │ ├── cef_box_layout.h │ │ ├── cef_browser_view.h │ │ ├── cef_browser_view_delegate.h │ │ ├── cef_button.h │ │ ├── cef_button_delegate.h │ │ ├── cef_display.h │ │ ├── cef_fill_layout.h │ │ ├── cef_label_button.h │ │ ├── cef_layout.h │ │ ├── cef_menu_button.h │ │ ├── cef_menu_button_delegate.h │ │ ├── cef_overlay_controller.h │ │ ├── cef_panel.h │ │ ├── cef_panel_delegate.h │ │ ├── cef_scroll_view.h │ │ ├── cef_textfield.h │ │ ├── cef_textfield_delegate.h │ │ ├── cef_view.h │ │ ├── cef_view_delegate.h │ │ ├── cef_window.h │ │ └── cef_window_delegate.h │ └── wrapper │ │ ├── cef_byte_read_handler.h │ │ ├── cef_closure_task.h │ │ ├── cef_helpers.h │ │ ├── cef_message_router.h │ │ ├── cef_resource_manager.h │ │ ├── cef_scoped_temp_dir.h │ │ ├── cef_stream_resource_handler.h │ │ ├── cef_xml_object.h │ │ └── cef_zip_archive.h ├── javascript_bindings.pyx ├── javascript_callback.pyx ├── linux │ ├── binaries_64bit │ │ ├── kivy-select-boxes │ │ │ ├── kivy-selectBox.css │ │ │ ├── kivy-selectBox.js │ │ │ ├── kivy-test.html │ │ │ └── readme.md │ │ └── kivy_.py │ └── deb_pkg_deprecated │ │ ├── .gitignore │ │ ├── debian.postinst │ │ ├── deps.txt │ │ ├── find-deps.py │ │ ├── make-deb.py │ │ └── stdeb.cfg.template ├── mac │ └── mac64.sh ├── network_error.pyx ├── paint_buffer.pyx ├── process_message_utils.pyx ├── python_callback.pyx ├── request.pyx ├── response.pyx ├── settings.pyx ├── string_utils.pyx ├── string_utils_win.pyx ├── string_visitor.pyx ├── subprocess.old │ ├── .gitignore │ ├── Makefile │ ├── Makefile-libcefpythonapp │ ├── cefpython_app.cpp │ ├── cefpython_app.h │ ├── deprecated │ │ ├── deprecated_libcefpythonapp_py27_64bit.vcproj │ │ ├── deprecated_libcefpythonapp_py27_win32.vcproj │ │ ├── deprecated_libcefpythonapp_py34_32bit.vcproj │ │ ├── deprecated_subprocess_64bit.vcproj │ │ └── deprecated_subprocess_win32.vcproj │ ├── javascript_callback.cpp │ ├── javascript_callback.h │ ├── main.cpp │ ├── main_message_loop │ │ ├── main_message_loop.cpp │ │ ├── main_message_loop.h │ │ ├── main_message_loop_external_pump.cpp │ │ ├── main_message_loop_external_pump.h │ │ ├── main_message_loop_external_pump_linux.cpp │ │ ├── main_message_loop_external_pump_mac.mm │ │ ├── main_message_loop_external_pump_win.cpp │ │ ├── main_message_loop_std.cpp │ │ ├── main_message_loop_std.h │ │ ├── util_win.cpp │ │ └── util_win.h │ ├── print_handler_gtk.cpp │ ├── print_handler_gtk.h │ ├── print_handler_gtk.patch │ ├── v8function_handler.cpp │ ├── v8function_handler.h │ ├── v8utils.cpp │ └── v8utils.h ├── subprocess │ ├── .gitignore │ ├── Makefile │ ├── Makefile-libcefpythonapp │ ├── cefpython_app.cpp │ ├── cefpython_app.h │ ├── deprecated │ │ ├── deprecated_libcefpythonapp_py27_64bit.vcproj │ │ ├── deprecated_libcefpythonapp_py27_win32.vcproj │ │ ├── deprecated_libcefpythonapp_py34_32bit.vcproj │ │ ├── deprecated_subprocess_64bit.vcproj │ │ └── deprecated_subprocess_win32.vcproj │ ├── javascript_callback.cpp │ ├── javascript_callback.h │ ├── main.cpp │ ├── main_message_loop │ │ ├── main_message_loop.cpp │ │ ├── main_message_loop.h │ │ ├── main_message_loop_external_pump.cpp │ │ ├── main_message_loop_external_pump.h │ │ ├── main_message_loop_external_pump_linux.cpp │ │ ├── main_message_loop_external_pump_mac.mm │ │ ├── main_message_loop_external_pump_win.cpp │ │ ├── main_message_loop_std.cpp │ │ ├── main_message_loop_std.h │ │ ├── util_win.cpp │ │ └── util_win.h │ ├── print_handler_gtk.cpp │ ├── print_handler_gtk.h │ ├── print_handler_gtk.patch │ ├── v8function_handler.cpp │ ├── v8function_handler.h │ ├── v8utils.cpp │ └── v8utils.h ├── task.pyx ├── time_utils.pyx ├── utils.pyx ├── version │ ├── cef_version_linux.h │ ├── cef_version_mac.h │ ├── cef_version_win.h │ └── cef_version_win_66.h ├── virtual_keys.pyx ├── web_plugin_info.pyx ├── web_request.pyx ├── window_info.pyx ├── window_utils_linux.pyx ├── window_utils_mac.pyx ├── window_utils_win.pyx └── windows │ └── py27 │ └── stdint.h ├── tools ├── apidocs.py ├── automate-git.py ├── automate-git.py.patch ├── automate.py ├── build.py ├── build_cpp_projects.py ├── build_distrib.py ├── common.py ├── cython_setup.py ├── installer │ ├── cefpython3.README.txt │ ├── cefpython3.__init__.py │ └── cefpython3.setup.py ├── make_installer.py ├── requirements.py ├── requirements.txt ├── run_examples.py ├── run_snippets.py └── toc.py └── unittests ├── Web Data ├── Web Data-journal ├── _common.py ├── _test_runner.py ├── isolated_test.py ├── issue517.py ├── main_test.py ├── osr_test.py └── unittest_test.py /.github/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | Questions should be asked on the forum: 2 | https://groups.google.com/group/cefpython 3 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] 4 | patreon: # Replace with a single Patreon username 5 | open_collective: # Replace with a single Open Collective username 6 | ko_fi: # Replace with a single Ko-fi username 7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel 8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry 9 | liberapay: # Replace with a single Liberapay username 10 | issuehunt: # Replace with a single IssueHunt username 11 | otechie: # Replace with a single Otechie username 12 | custom: ['https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=V7LU7PD4N4GGG'] # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] 13 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | Questions should be asked on the forum: 2 | https://groups.google.com/group/cefpython 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .idea/ 2 | build/ 3 | dist/ 4 | *.log 5 | __pycache__/ 6 | *.pyc 7 | cefclient 8 | webcache/ 9 | examples/screenshot.png 10 | examples/pyinstaller/build/ 11 | examples/pyinstaller/dist/ 12 | examples/GPUCache/ 13 | examples/blob_storage/ 14 | examples/webrtc_event_logs/ 15 | unittests/GPUCache/ 16 | unittests/blob_storage/ 17 | unittests/webrtc_event_logs/ 18 | .DS_Store 19 | -------------------------------------------------------------------------------- /.vscode/c_cpp_properties.json: -------------------------------------------------------------------------------- 1 | { 2 | "configurations": [ 3 | { 4 | "name": "Win32", 5 | "includePath": [ 6 | "C:/Program Files/Python311/include/**", 7 | "${workspaceFolder}/**" 8 | ], 9 | "defines": [ 10 | "_DEBUG", 11 | "UNICODE", 12 | "_UNICODE" 13 | ], 14 | "windowsSdkVersion": "10.0.22621.0", 15 | "cStandard": "c17", 16 | "cppStandard": "c++17" 17 | } 18 | ], 19 | "version": 4 20 | } -------------------------------------------------------------------------------- /Authors: -------------------------------------------------------------------------------- 1 | Core developers: 2 | Czarek Tomczak 3 | 4 | Contributors: 5 | 老农 cjjer 6 | Richard Rodriguez 7 | Roman Plášil 8 | Rokas Stupuras 9 | Greg Kacy 10 | Thomas Dähling 11 | Dominique Burnand 12 | Greg Farrell 13 | Finn Hughes 14 | Marcelo Fernandez 15 | Simon Hatt <9hatt2@@gmail.com> 16 | Neil Munday 17 | Joseph Kogut 18 | Paweł Kierski 19 | Dónal McMullan 20 | nobodyguy 21 | Elliot Woods 22 | Bryan Koroleski 23 | -------------------------------------------------------------------------------- /License: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012 The CEF Python authors - see the Authors file. 2 | All rights reserved. Licensed under the BSD 3-clause license. 3 | See project website: https://github.com/cztomczak/cefpython 4 | 5 | This product includes the following third party libraries: 6 | * Chromium Embedded Framework licensed under the BSD 3-clause 7 | license. Website: https://bitbucket.org/chromiumembedded/cef 8 | 9 | Redistribution and use in source and binary forms, with 10 | or without modification, are permitted provided that the 11 | following conditions are met: 12 | 13 | * Redistributions of source code must retain the above 14 | copyright notice, this list of conditions and the 15 | following disclaimer. 16 | 17 | * Redistributions in binary form must reproduce the above 18 | copyright notice, this list of conditions and the 19 | following disclaimer in the documentation and/or other 20 | materials provided with the distribution. 21 | 22 | * Neither the name of Google Inc. nor the name Chromium 23 | Embedded Framework nor the name of CEF Python nor the 24 | names of its contributors may be used to endorse or 25 | promote products derived from this software without 26 | specific prior written permission. 27 | 28 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 29 | CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 30 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 31 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 32 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 33 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 34 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 35 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 36 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 37 | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 38 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 39 | OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 40 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 41 | -------------------------------------------------------------------------------- /api/AccessibilityHandler.md: -------------------------------------------------------------------------------- 1 | [API categories](API-categories.md) | [API index](API-index.md) 2 | 3 | 4 | # AccessibilityHandler (interface) 5 | 6 | This handler is for use only with off-screen rendering enabled. 7 | See [RenderHandler](RenderHandler.md) for details. 8 | 9 | Implement this interface to receive accessibility notification when 10 | accessibility events have been registered. The methods of this class will 11 | be called on the UI thread. 12 | 13 | Callbacks in this interface are not associated with any specific browser, 14 | thus you must call 15 | `cefpython`.[SetGlobalClientHandler](cefpython.md#setglobalclienthandler) 16 | or [SetGlobalClientCallback](cefpython.md#setglobalclientcallback) 17 | to use them. The callbacks names were prefixed 18 | with "`_`" to distinguish this special behavior. 19 | 20 | 21 | Table of contents: 22 | * [Callbacks](#callbacks) 23 | * [_OnAccessibilityTreeChange](#_onaccessibilitytreechange) 24 | * [_OnAccessibilityLocationChange](#_onaccessibilitylocationchange) 25 | 26 | 27 | ## Callbacks 28 | 29 | 30 | ### _OnAccessibilityTreeChange 31 | 32 | | Parameter | Type | 33 | | --- | --- | 34 | | value | list | 35 | | __Return__ | void | 36 | 37 | Called after renderer process sends accessibility tree changes to the 38 | browser process. 39 | 40 | 41 | ### _OnAccessibilityLocationChange 42 | 43 | | Parameter | Type | 44 | | --- | --- | 45 | | value | list | 46 | | __Return__ | void | 47 | 48 | Called after renderer process sends accessibility location changes to the 49 | browser process. 50 | 51 | -------------------------------------------------------------------------------- /api/Callback.md: -------------------------------------------------------------------------------- 1 | [API categories](API-categories.md) | [API index](API-index.md) 2 | 3 | 4 | # Callback (object) 5 | 6 | Generic callback interface used for asynchronous continuation. 7 | 8 | 9 | Table of contents: 10 | * [Methods](#methods) 11 | * [Continue](#continue) 12 | * [Cancel](#cancel) 13 | 14 | 15 | ## Methods 16 | 17 | 18 | ### Continue 19 | 20 | | | | 21 | | --- | --- | 22 | | __Return__ | void | 23 | 24 | Continue processing. 25 | 26 | 27 | ### Cancel 28 | 29 | | | | 30 | | --- | --- | 31 | | __Return__ | void | 32 | 33 | Cancel processing. 34 | -------------------------------------------------------------------------------- /api/CookieVisitor.md: -------------------------------------------------------------------------------- 1 | [API categories](API-categories.md) | [API index](API-index.md) 2 | 3 | 4 | # CookieVisitor (interface) 5 | 6 | See [CookieManager](CookieManager.md).VisitAllCookies() and [CookieManager](CookieManager.md).VisitUrlCookies(). 7 | 8 | You must keep a strong reference to the [CookieVisitor](CookieVisitor.md) object 9 | while visiting cookies, otherwise it gets destroyed and the 10 | [CookieVisitor](CookieVisitor.md) callbacks won't be called. 11 | 12 | 13 | Table of contents: 14 | * [Callbacks](#callbacks) 15 | * [Visit](#visit) 16 | 17 | 18 | ## Callbacks 19 | 20 | 21 | ### Visit 22 | 23 | | Parameter | Type | 24 | | --- | --- | 25 | | cookie | [Cookie](Cookie.md) | 26 | | count | int | 27 | | total | int | 28 | | delete_cookie_out | list[bool] | 29 | | __Return__ | bool | 30 | 31 | Method that will be called once for each cookie. |count| is the 0-based 32 | index for the current cookie. |total| is the total number of cookies. 33 | Set |delete_cookie_out[0]| to True to delete the cookie currently being visited. 34 | Return False to stop visiting cookies, True to continue. This method may 35 | never be called if no cookies are found. 36 | -------------------------------------------------------------------------------- /api/DownloadHandler.md: -------------------------------------------------------------------------------- 1 | [API categories](API-categories.md) | [API index](API-index.md) 2 | 3 | 4 | # DownloadHandler 5 | 6 | See also [Browser](Browser.md).StartDownload(). 7 | 8 | 9 | ## Preface 10 | 11 | In CEF 3 downloads are handled automatically if ApplicationSettings.`downloads_enabled` is set to True (default). A default `SaveAs` file dialog provided by OS is displayed. If the download is aborted by user LoadHandler.`OnLoadError` will get called with errorCode ERR_ABORTED. 12 | 13 | There is no download progress available. If you need such feature you will have to create a custom implementation of downloads. It would need to be investigated which callbacks from client handlers would allow for such implementation. Take a look at RequestHandler.`OnBeforeBrowse`, `OnBeforeResourceLoad`, and/or ResourceHandler. 14 | 15 | On Linux there is a bug and ERR_ABORTED is reported even for successful downloads. See the comments in the wxpython.py example. 16 | 17 | A download handler with callbacks like `OnBeforeDownload` and 18 | `OnDownloadUpdated` may be exposed to CEF Python in the future. 19 | -------------------------------------------------------------------------------- /api/DragData.md: -------------------------------------------------------------------------------- 1 | [API categories](API-categories.md) | [API index](API-index.md) 2 | 3 | 4 | # DragData (object) 5 | 6 | 7 | Table of contents: 8 | * [Methods](#methods) 9 | * [IsLink](#islink) 10 | * [IsFragment](#isfragment) 11 | * [GetLinkUrl](#getlinkurl) 12 | * [GetLinkTitle](#getlinktitle) 13 | * [GetFragmentText](#getfragmenttext) 14 | * [GetFragmentHtml](#getfragmenthtml) 15 | * [GetImage](#getimage) 16 | * [GetImageHotspot](#getimagehotspot) 17 | * [HasImage](#hasimage) 18 | 19 | 20 | ## Methods 21 | 22 | 23 | ### IsLink 24 | 25 | | | | 26 | | --- | --- | 27 | | __Return__ | bool | 28 | 29 | Returns true if the drag data is a link. 30 | 31 | 32 | ### IsFragment 33 | 34 | | | | 35 | | --- | --- | 36 | | __Return__ | bool | 37 | 38 | Returns true if the drag data is a text or html fragment. 39 | 40 | 41 | ### GetLinkUrl 42 | 43 | | | | 44 | | --- | --- | 45 | | __Return__ | string | 46 | 47 | 48 | Return the link URL that is being dragged. 49 | 50 | 51 | ### GetLinkTitle 52 | 53 | | | | 54 | | --- | --- | 55 | | __Return__ | string | 56 | 57 | Return the title associated with the link being dragged. 58 | 59 | 60 | ### GetFragmentText 61 | 62 | | | | 63 | | --- | --- | 64 | | __Return__ | string | 65 | 66 | Return the plain text fragment that is being dragged. 67 | 68 | 69 | ### GetFragmentHtml 70 | 71 | | | | 72 | | --- | --- | 73 | | __Return__ | string | 74 | 75 | Return the text/html fragment that is being dragged. 76 | 77 | 78 | ### GetImage 79 | 80 | | | | 81 | | --- | --- | 82 | | __Return__ | [Image](Image.md) | 83 | 84 | Description from upstream CEF: 85 | > Get the image representation of drag data. May return NULL if no image 86 | > representation is available. 87 | 88 | Check with HasImage() first, otherwise if there is no image an exception 89 | is thrown. 90 | 91 | 92 | ### GetImageHotspot 93 | 94 | | | | 95 | | --- | --- | 96 | | __Return__ | [Image](Image.md) | 97 | 98 | Get the image hotspot (drag start location relative to image dimensions). 99 | 100 | 101 | ### HasImage 102 | 103 | | | | 104 | | --- | --- | 105 | | __Return__ | bool | 106 | 107 | Returns true if an image representation of drag data is available. 108 | 109 | -------------------------------------------------------------------------------- /api/FocusHandler.md: -------------------------------------------------------------------------------- 1 | [API categories](API-categories.md) | [API index](API-index.md) 2 | 3 | 4 | # FocusHandler (interface) 5 | 6 | Implement this interface to handle events related to focus. The methods of 7 | this class will be called on the UI thread. 8 | 9 | 10 | Table of contents: 11 | * [Callbacks](#callbacks) 12 | * [OnTakeFocus](#ontakefocus) 13 | * [OnSetFocus](#onsetfocus) 14 | * [OnGotFocus](#ongotfocus) 15 | 16 | 17 | ## Callbacks 18 | 19 | 20 | ### OnTakeFocus 21 | 22 | | Parameter | Type | 23 | | --- | --- | 24 | | browser | [Browser](Browser.md) | 25 | | next_component | bool | 26 | | __Return__ | void | 27 | 28 | Description from upstream CEF: 29 | > Called when the browser component is about to loose focus. For instance, if 30 | > focus was on the last HTML element and the user pressed the TAB key. |next| 31 | > will be true if the browser is giving focus to the next component and false 32 | > if the browser is giving focus to the previous component. 33 | 34 | 35 | ### OnSetFocus 36 | 37 | | Parameter | Type | 38 | | --- | --- | 39 | | browser | [Browser](Browser.md) | 40 | | source | cef_focus_source_t | 41 | | __Return__ | bool | 42 | 43 | Description from upstream CEF: 44 | > Called when the browser component is requesting focus. |source| indicates 45 | > where the focus request is originating from. Return false to allow the 46 | > focus to be set or true to cancel setting the focus. 47 | 48 | The `cef_focus_source_t` enum constants in the cefpython module: 49 | * FOCUS_SOURCE_NAVIGATION (The source is explicit navigation 50 | via the API (LoadURL(), etc)) 51 | * FOCUS_SOURCE_SYSTEM (The source is a system-generated focus event) 52 | 53 | 54 | ### OnGotFocus 55 | 56 | | Parameter | Type | 57 | | --- | --- | 58 | | browser | [Browser](Browser.md) | 59 | | __Return__ | void | 60 | 61 | Description from upstream CEF: 62 | > Called when the browser component has received focus. 63 | -------------------------------------------------------------------------------- /api/Image.md: -------------------------------------------------------------------------------- 1 | [API categories](API-categories.md) | [API index](API-index.md) 2 | 3 | 4 | # Image (object) 5 | 6 | 7 | Table of contents: 8 | * [Methods](#methods) 9 | * [GetAsBitmap](#getasbitmap) 10 | * [GetAsPng](#getaspng) 11 | * [GetHeight](#getheight) 12 | * [GetWidth](#getwidth) 13 | 14 | 15 | ## Methods 16 | 17 | 18 | ### GetAsBitmap 19 | 20 | | Parameter | Type | 21 | | --- | --- | 22 | | scale_factor | float | 23 | | color_type | cef_color_type_t | 24 | | alpha_type | cef_alpha_type_t | 25 | | __Return__ | bytes | 26 | 27 | `cef_color_type_t` constants in the cefpython module: 28 | * CEF_COLOR_TYPE_RGBA_8888, 29 | * CEF_COLOR_TYPE_BGRA_8888, 30 | 31 | `enum cef_alpha_type_t` constants in the cefpython module: 32 | * CEF_ALPHA_TYPE_OPAQUE, 33 | * CEF_ALPHA_TYPE_PREMULTIPLIED, 34 | * CEF_ALPHA_TYPE_POSTMULTIPLIED, 35 | 36 | 37 | ### GetAsPng 38 | 39 | | Parameter | Type | 40 | | --- | --- | 41 | | scale_factor | float | 42 | | with_transparency | bool | 43 | | __Return__ | bytes | 44 | 45 | Returns image data as bytes. 46 | 47 | Description from upstream CEF: 48 | > Returns the PNG representation that most closely matches |scale_factor|. If 49 | > |with_transparency| is true any alpha transparency in the image will be 50 | > represented in the resulting PNG data. |pixel_width| and |pixel_height| are 51 | > the output representation size in pixel coordinates. Returns a 52 | > CefBinaryValue containing the PNG image data on success or NULL on failure. 53 | 54 | 55 | ### GetHeight 56 | 57 | | | | 58 | | --- | --- | 59 | | __Return__ | int | 60 | 61 | Returns the image heifght in density independent pixel (DIP) units. 62 | 63 | 64 | ### GetWidth 65 | 66 | | | | 67 | | --- | --- | 68 | | __Return__ | int | 69 | 70 | Returns the image width in density independent pixel (DIP) units. 71 | 72 | -------------------------------------------------------------------------------- /api/JavascriptCallback.md: -------------------------------------------------------------------------------- 1 | [API categories](API-categories.md) | [API index](API-index.md) 2 | 3 | 4 | # JavascriptCallback (object) 5 | 6 | You can pass a callback function from Javascript to Python, when you do that, what you get in Python is a `JavascriptCallback` object that you can use to call javascript function back. 7 | 8 | If you call the javascript callback and it fails, instead of js exception what you get is a python exception that exits the application by default (see sys.excepthook in examples). 9 | 10 | See also [JavascriptBindings](JavascriptBindings.md). 11 | 12 | See also [Issue #11](../issues/11) (Throw JS / Python exceptions according to execution context). 13 | 14 | 15 | Table of contents: 16 | * [Methods](#methods) 17 | * [Call](#call) 18 | * [GetFrame](#getframe) 19 | * [GetId](#getid) 20 | * [GetFunctionName](#getfunctionname) 21 | 22 | 23 | ## Methods 24 | 25 | 26 | ### Call 27 | 28 | | Parameter | Type | 29 | | --- | --- | 30 | | [params..] (optional) | mixed | 31 | | __Return__ | void | 32 | 33 | Call the javascript callback function. Pass arguments optionally. 34 | 35 | For a list of allowed types for `mixed` see JavascriptBindings.[IsValueAllowed()](JavascriptBindings.md#isvalueallowed). 36 | 37 | 38 | ### GetFrame 39 | 40 | | | | 41 | | --- | --- | 42 | | __Return__ | [Frame](Frame.md) | 43 | 44 | Get Frame object associated with this callback. If Browser was destroyed 45 | then Frame may be None. 46 | 47 | 48 | ### GetId 49 | 50 | | | | 51 | | --- | --- | 52 | | __Return__ | int | 53 | 54 | Get this callback's identifier. 55 | 56 | 57 | ### GetFunctionName 58 | 59 | | | | 60 | | --- | --- | 61 | | __Return__ | string | 62 | 63 | Get the javascript function's name. If that is an anonymous function you will get some random name like "É☺«". 64 | -------------------------------------------------------------------------------- /api/PaintBuffer.md: -------------------------------------------------------------------------------- 1 | [API categories](API-categories.md) | [API index](API-index.md) 2 | 3 | 4 | # PaintBuffer (object) 5 | 6 | This object used in: [RenderHandler](RenderHandler.md).OnPaint(). 7 | 8 | 9 | Table of contents: 10 | * [Methods](#methods) 11 | * [GetIntPointer](#getintpointer) 12 | * [GetBytes](#getbytes) 13 | 14 | 15 | ## Methods 16 | 17 | 18 | ### GetIntPointer 19 | 20 | | | | 21 | | --- | --- | 22 | | __Return__ | long | 23 | 24 | Get int pointer to the `void*` buffer. 25 | 26 | Description from upstream CEF: 27 | > |buffer| will be |width|*|height|*4 bytes in size and represents a BGRA 28 | > image with an upper-left origin. 29 | 30 | 31 | ### GetBytes 32 | 33 | | Parameter | Type | 34 | | --- | --- | 35 | | mode="bgra" | string | 36 | | origin="top-left" | string | 37 | | __Return__ | object | 38 | 39 | Converts the `void*` buffer to string. In Py2 returns 'str' type, in Py3 returns 'bytes' type. 40 | 41 | `origin` may be one of: "top-left", "bottom-left". 42 | 43 | `mode` may be one of: "bgra", "rgba". 44 | -------------------------------------------------------------------------------- /api/StringVisitor.md: -------------------------------------------------------------------------------- 1 | [API categories](API-categories.md) | [API index](API-index.md) 2 | 3 | 4 | # StringVisitor (interface) 5 | 6 | See [Frame](Frame.md).GetSource() and [Frame](Frame.md).GetText(). 7 | 8 | You have to keep a strong reference to the `StringVisitor` object 9 | while visiting strings, otherwise it gets destroyed and the 10 | `StringVisitor` callbacks won't be called. 11 | 12 | 13 | Table of contents: 14 | * [Callbacks](#callbacks) 15 | * [Visit](#visit) 16 | 17 | 18 | ## Callbacks 19 | 20 | 21 | ### Visit 22 | 23 | | Parameter | Type | 24 | | --- | --- | 25 | | value | string | 26 | | __Return__ | bool | 27 | 28 | Method that will be executed. 29 | -------------------------------------------------------------------------------- /api/V8ContextHandler.md: -------------------------------------------------------------------------------- 1 | [API categories](API-categories.md) | [API index](API-index.md) 2 | 3 | 4 | # V8ContextHandler (interface) 5 | 6 | Implement this interface to handle render process callbacks. 7 | Through inter-process messaging you are notified about these events 8 | in the browser process. 9 | 10 | 11 | Table of contents: 12 | * [Notes](#notes) 13 | * [Callbacks](#callbacks) 14 | * [OnContextCreated](#oncontextcreated) 15 | * [OnContextReleased](#oncontextreleased) 16 | 17 | 18 | ## Notes 19 | 20 | Callbacks available in upstream CEF, but not yet exposed in CEF Python: 21 | * OnUncaughtException 22 | 23 | 24 | ## Callbacks 25 | 26 | 27 | ### OnContextCreated 28 | 29 | | Parameter | Type | 30 | | --- | --- | 31 | | browser | [Browser](Browser.md) | 32 | | frame | [Frame](Frame.md) | 33 | | __Return__ | void | 34 | 35 | Called shortly after (process message delay) the V8 context for 36 | a frame has been created. 37 | 38 | If the page does not contain ` 31 | 32 | 33 |

Javascript Bindings

34 |
35 | 36 | 37 | """ 38 | 39 | 40 | def main(): 41 | cef.Initialize() 42 | browser = cef.CreateBrowserSync(url=cef.GetDataUrl(g_htmlcode), 43 | window_title="Javascript Bindings") 44 | browser.SetClientHandler(LoadHandler()) 45 | bindings = cef.JavascriptBindings() 46 | bindings.SetFunction("py_function", py_function) 47 | bindings.SetFunction("py_callback", py_callback) 48 | browser.SetJavascriptBindings(bindings) 49 | cef.MessageLoop() 50 | del browser 51 | cef.Shutdown() 52 | 53 | 54 | def py_function(value, js_callback): 55 | print("Value sent from Javascript: "+value) 56 | js_callback.Call("I am a Python string #2", py_callback) 57 | 58 | 59 | def py_callback(value): 60 | print("Value sent from Javascript: "+value) 61 | 62 | 63 | class LoadHandler(object): 64 | def OnLoadEnd(self, browser, **_): 65 | browser.ExecuteFunction("js_function", "I am a Python string #1") 66 | 67 | 68 | if __name__ == '__main__': 69 | main() 70 | -------------------------------------------------------------------------------- /examples/snippets/javascript_errors.py: -------------------------------------------------------------------------------- 1 | """ 2 | Two ways for intercepting Javascript errors: 3 | 1. window.onerror event in Javascript 4 | 2. DisplayHandler.OnConsoleMessage in Python 5 | """ 6 | 7 | from cefpython3 import cefpython as cef 8 | 9 | g_htmlcode = """ 10 | 11 | 12 | 13 | 19 | 33 | 34 | 35 |

Javascript Errors

36 |
37 | 38 | 39 | """ 40 | 41 | 42 | def main(): 43 | cef.Initialize() 44 | browser = cef.CreateBrowserSync(url=cef.GetDataUrl(g_htmlcode), 45 | window_title="Javascript Errors") 46 | browser.SetClientHandler(DisplayHandler()) 47 | cef.MessageLoop() 48 | cef.Shutdown() 49 | 50 | 51 | class DisplayHandler(object): 52 | def OnConsoleMessage(self, browser, message, line, **_): 53 | if "error" in message.lower() or "uncaught" in message.lower(): 54 | logmsg = "[Py:OnConsoleMessage] {message} (line {line})" \ 55 | .format(message=message, line=line) 56 | print(logmsg) 57 | browser.ExecuteFunction("print", logmsg) 58 | 59 | 60 | if __name__ == '__main__': 61 | main() 62 | -------------------------------------------------------------------------------- /examples/snippets/keyboard_handler.py: -------------------------------------------------------------------------------- 1 | from cefpython3 import cefpython as cef 2 | 3 | 4 | def main(): 5 | cef.Initialize() 6 | browser = cef.CreateBrowserSync(url="https://www.google.com/", 7 | window_title="Keyboard Handler") 8 | browser.SetClientHandler(KeyboardHandler()) 9 | cef.MessageLoop() 10 | del browser 11 | cef.Shutdown() 12 | 13 | 14 | class KeyboardHandler(object): 15 | def OnKeyEvent(self, browser, event, event_handle, **_): 16 | print("OnKeyEvent: "+str(event)) 17 | 18 | if __name__ == '__main__': 19 | main() 20 | -------------------------------------------------------------------------------- /examples/snippets/mouse_clicks.py: -------------------------------------------------------------------------------- 1 | # Perform mouse clicks and mouse movements programmatically. 2 | 3 | from cefpython3 import cefpython as cef 4 | 5 | 6 | def main(): 7 | cef.Initialize() 8 | browser = cef.CreateBrowserSync( 9 | url="data:text/html,

Mouse clicks snippet

" 10 | "This text will be selected after one second.
" 11 | "This text will be selected after two seconds.", 12 | window_title="Mouse clicks") 13 | browser.SetClientHandler(LifespanHandler()) 14 | cef.MessageLoop() 15 | del browser 16 | cef.Shutdown() 17 | 18 | 19 | def click_after_1_second(browser): 20 | print("Click after 1 second") 21 | # Mouse move to the top-left corner of the text 22 | browser.SendMouseMoveEvent(0, 70, False, 0) 23 | # Left mouse button click in the top-left corner of the text 24 | browser.SendMouseClickEvent(0, 70, cef.MOUSEBUTTON_LEFT, False, 1) 25 | # Mouse move to the bottom-right corner of the text, 26 | # while holding left mouse button. 27 | browser.SendMouseMoveEvent(400, 80, False, cef.EVENTFLAG_LEFT_MOUSE_BUTTON) 28 | # Release left mouse button 29 | browser.SendMouseClickEvent(400, 80, cef.MOUSEBUTTON_LEFT, True, 1) 30 | cef.PostDelayedTask(cef.TID_UI, 1000, click_after_2_seconds, browser) 31 | 32 | 33 | def click_after_2_seconds(browser): 34 | print("Click after 2 seconds") 35 | browser.SendMouseMoveEvent(0, 90, False, 0) 36 | browser.SendMouseClickEvent(0, 90, cef.MOUSEBUTTON_LEFT, False, 1) 37 | browser.SendMouseMoveEvent(400, 99, False, cef.EVENTFLAG_LEFT_MOUSE_BUTTON) 38 | browser.SendMouseClickEvent(400, 99, cef.MOUSEBUTTON_LEFT, True, 1) 39 | cef.PostDelayedTask(cef.TID_UI, 1000, click_after_1_second, browser) 40 | 41 | 42 | class LifespanHandler(object): 43 | def OnLoadEnd(self, browser, **_): 44 | # Execute function with a delay of 1 second after page 45 | # has completed loading. 46 | print("Page loading is complete") 47 | cef.PostDelayedTask(cef.TID_UI, 1000, click_after_1_second, browser) 48 | 49 | 50 | if __name__ == '__main__': 51 | main() 52 | -------------------------------------------------------------------------------- /examples/snippets/network_cookies.py: -------------------------------------------------------------------------------- 1 | """ 2 | Implement RequestHandler.CanGetCookies and CanSetCookie 3 | to block or allow cookies over network requests. 4 | """ 5 | 6 | from cefpython3 import cefpython as cef 7 | 8 | 9 | def main(): 10 | cef.Initialize() 11 | browser = cef.CreateBrowserSync( 12 | url="http://www.html-kit.com/tools/cookietester/", 13 | window_title="Network cookies") 14 | browser.SetClientHandler(RequestHandler()) 15 | cef.MessageLoop() 16 | del browser 17 | cef.Shutdown() 18 | 19 | 20 | class RequestHandler(object): 21 | def __init__(self): 22 | self.getcount = 0 23 | self.setcount = 0 24 | 25 | def CanGetCookies(self, frame, request, **_): 26 | # There are multiple iframes on that website, let's log 27 | # cookies only for the main frame. 28 | if frame.IsMain(): 29 | self.getcount += 1 30 | print("-- CanGetCookies #"+str(self.getcount)) 31 | print("url="+request.GetUrl()[0:80]) 32 | print("") 33 | # Return True to allow reading cookies or False to block 34 | return True 35 | 36 | def CanSetCookie(self, frame, request, cookie, **_): 37 | # There are multiple iframes on that website, let's log 38 | # cookies only for the main frame. 39 | if frame.IsMain(): 40 | self.setcount += 1 41 | print("-- CanSetCookie @"+str(self.setcount)) 42 | print("url="+request.GetUrl()[0:80]) 43 | print("Name="+cookie.GetName()) 44 | print("Value="+cookie.GetValue()) 45 | print("") 46 | # Return True to allow setting cookie or False to block 47 | return True 48 | 49 | 50 | if __name__ == '__main__': 51 | main() 52 | -------------------------------------------------------------------------------- /examples/snippets/onbeforeclose.py: -------------------------------------------------------------------------------- 1 | """ 2 | Implement LifespanHandler.OnBeforeClose to execute custom 3 | code before browser window closes. 4 | """ 5 | 6 | from cefpython3 import cefpython as cef 7 | 8 | 9 | def main(): 10 | cef.Initialize() 11 | browser = cef.CreateBrowserSync(url="https://www.google.com/", 12 | window_title="OnBeforeClose") 13 | browser.SetClientHandler(LifespanHandler()) 14 | cef.MessageLoop() 15 | del browser 16 | cef.Shutdown() 17 | 18 | 19 | class LifespanHandler(object): 20 | def OnBeforeClose(self, browser): 21 | print("Browser ID: {}".format(browser.GetIdentifier())) 22 | print("Browser will close and app will exit") 23 | 24 | 25 | if __name__ == '__main__': 26 | main() 27 | -------------------------------------------------------------------------------- /examples/snippets/ondomready.py: -------------------------------------------------------------------------------- 1 | """ 2 | Execute custom Python code on a web page as soon as DOM is ready. 3 | Implements a custom "_OnDomReady" event in the LoadHandler object. 4 | """ 5 | 6 | from cefpython3 import cefpython as cef 7 | 8 | 9 | def main(): 10 | cef.Initialize() 11 | browser = cef.CreateBrowserSync(url="https://www.google.com/", 12 | window_title="_OnDomReady event") 13 | load_handler = LoadHandler(browser) 14 | browser.SetClientHandler(load_handler) 15 | bindings = cef.JavascriptBindings() 16 | bindings.SetFunction("LoadHandler_OnDomReady", 17 | load_handler["_OnDomReady"]) 18 | browser.SetJavascriptBindings(bindings) 19 | cef.MessageLoop() 20 | del load_handler 21 | del browser 22 | cef.Shutdown() 23 | 24 | 25 | class LoadHandler(object): 26 | def __init__(self, browser): 27 | self.browser = browser 28 | 29 | def __getitem__(self, key): 30 | return getattr(self, key) 31 | 32 | def OnLoadStart(self, browser, **_): 33 | browser.ExecuteJavascript(""" 34 | if (document.readyState === "complete") { 35 | LoadHandler_OnDomReady(); 36 | } else { 37 | document.addEventListener("DOMContentLoaded", function() { 38 | LoadHandler_OnDomReady(); 39 | }); 40 | } 41 | """) 42 | 43 | def _OnDomReady(self): 44 | print("DOM is ready!") 45 | self.browser.ExecuteFunction("alert", 46 | "Message from Python: DOM is ready!") 47 | 48 | 49 | if __name__ == '__main__': 50 | main() 51 | -------------------------------------------------------------------------------- /examples/snippets/onpagecomplete.py: -------------------------------------------------------------------------------- 1 | """ 2 | Execute custom Python code on a web page when page loading is complete. 3 | Implements a custom "_OnPageComplete" event in the LoadHandler object. 4 | """ 5 | 6 | from cefpython3 import cefpython as cef 7 | 8 | 9 | def main(): 10 | cef.Initialize() 11 | browser = cef.CreateBrowserSync(url="https://www.google.com/", 12 | window_title="_OnPageComplete event") 13 | browser.SetClientHandler(LoadHandler()) 14 | cef.MessageLoop() 15 | del browser 16 | cef.Shutdown() 17 | 18 | 19 | class LoadHandler(object): 20 | def OnLoadingStateChange(self, browser, is_loading, **_): 21 | """For detecting if page loading has ended it is recommended 22 | to use OnLoadingStateChange which is most reliable. The OnLoadEnd 23 | callback also available in LoadHandler can sometimes fail in 24 | some cases e.g. when image loading hangs.""" 25 | if not is_loading: 26 | self._OnPageComplete(browser) 27 | 28 | def _OnPageComplete(self, browser): 29 | print("Page loading is complete!") 30 | browser.ExecuteFunction("alert", "Message from Python: Page loading" 31 | " is complete!") 32 | 33 | 34 | if __name__ == '__main__': 35 | main() 36 | -------------------------------------------------------------------------------- /examples/snippets/setcookie.py: -------------------------------------------------------------------------------- 1 | """ 2 | Shows how to set a cookie. 3 | """ 4 | 5 | from cefpython3 import cefpython as cef 6 | import datetime 7 | 8 | 9 | def main(): 10 | cef.Initialize() 11 | cef.CreateBrowserSync( 12 | url="http://www.html-kit.com/tools/cookietester/", 13 | window_title="Set a cookie") 14 | manager = cef.CookieManager.GetGlobalManager() 15 | cookie = cef.Cookie() 16 | cookie.Set({ 17 | "name": "my_cookie", 18 | "value": "my_value", 19 | # Make sure domain is a valid value otherwise it crashes 20 | # app (Issue #459) 21 | "domain": "www.html-kit.com", 22 | "path": "/", 23 | "secure": False, 24 | "httpOnly": False, 25 | "creation": datetime.datetime(2018, 8, 22), 26 | "lastAccess": datetime.datetime(2018, 8, 22), 27 | "hasExpires": True, 28 | "expires": datetime.datetime(2028, 12, 31, 23, 59, 59), 29 | }) 30 | manager.SetCookie("http://www.html-kit.com/", cookie) 31 | cef.MessageLoop() 32 | cef.Shutdown() 33 | 34 | 35 | if __name__ == '__main__': 36 | main() 37 | -------------------------------------------------------------------------------- /examples/snippets/window_size.py: -------------------------------------------------------------------------------- 1 | """ 2 | Set initial window size to 900/640px without use of 3 | any third party GUI framework. On Linux/Mac you can set 4 | window size by calling WindowInfo.SetAsChild. On Windows 5 | you can accomplish this by calling Windows native functions 6 | using the ctypes module. 7 | """ 8 | 9 | from cefpython3 import cefpython as cef 10 | import ctypes 11 | import platform 12 | 13 | 14 | def main(): 15 | cef.Initialize() 16 | window_info = cef.WindowInfo() 17 | parent_handle = 0 18 | # This call has effect only on Mac and Linux. 19 | # All rect coordinates are applied including X and Y parameters. 20 | window_info.SetAsChild(parent_handle, [0, 0, 900, 640]) 21 | browser = cef.CreateBrowserSync(url="https://www.google.com/", 22 | window_info=window_info, 23 | window_title="Window size") 24 | if platform.system() == "Windows": 25 | window_handle = browser.GetOuterWindowHandle() 26 | insert_after_handle = 0 27 | # X and Y parameters are ignored by setting the SWP_NOMOVE flag 28 | SWP_NOMOVE = 0x0002 29 | # noinspection PyUnresolvedReferences 30 | ctypes.windll.user32.SetWindowPos(window_handle, insert_after_handle, 31 | 0, 0, 900, 640, SWP_NOMOVE) 32 | cef.MessageLoop() 33 | del browser 34 | cef.Shutdown() 35 | 36 | 37 | if __name__ == '__main__': 38 | main() 39 | -------------------------------------------------------------------------------- /patches/include.gypi: -------------------------------------------------------------------------------- 1 | { 2 | 'variables': { 3 | 'use_allocator': 'none', 4 | }, 5 | } -------------------------------------------------------------------------------- /patches/issue125.patch: -------------------------------------------------------------------------------- 1 | diff --git http_cache_transaction.cc http_cache_transaction.cc 2 | index ede3541aa401..138977424d02 100644 3 | --- http_cache_transaction.cc 4 | +++ http_cache_transaction.cc 5 | @@ -2609,7 +2609,8 @@ int HttpCache::Transaction::WriteResponseInfoToEntry(bool truncated) { 6 | // blocking page is shown. An alternative would be to reverse-map the cert 7 | // status to a net error and replay the net error. 8 | if ((response_.headers->HasHeaderValue("cache-control", "no-store")) || 9 | - IsCertStatusError(response_.ssl_info.cert_status)) { 10 | + (!cache_->GetSession()->params().ignore_certificate_errors && 11 | + IsCertStatusError(response_.ssl_info.cert_status))) { 12 | DoneWritingToEntry(false); 13 | if (net_log_.IsCapturing()) 14 | net_log_.EndEvent(NetLogEventType::HTTP_CACHE_WRITE_INFO); 15 | -------------------------------------------------------------------------------- /patches/issue73_linux: -------------------------------------------------------------------------------- 1 | Patch to CEF. Fixes tcmalloc issue on Linux: 2 | https://github.com/cztomczak/cefpython/issues/73 3 | 4 | Copy the "include.gypi" file to the ~/.gyp/ directory. 5 | The automate.py script applies this patch by setting GYP_DEFINES env var. 6 | -------------------------------------------------------------------------------- /patches/patch.py: -------------------------------------------------------------------------------- 1 | # CEF Python patches to Chromium and CEF. 2 | # See upstream cef/patch/patch.cfg for how patching works in CEF. 3 | # Current working directory is cef_build_dir/chromium/src/ . 4 | # See also docs/Build-instructions.md and tools/automate.py . 5 | 6 | import platform 7 | 8 | OS_POSTFIX = ("win" if platform.system() == "Windows" else 9 | "linux" if platform.system() == "Linux" else 10 | "mac" if platform.system() == "Darwin" else "unknown") 11 | 12 | # ALL PLATFORMS 13 | # noinspection PyUnresolvedReferences 14 | patches.extend([ 15 | #{ 16 | # # (Disabled) Fixes HTTPS cache problems with private certificates 17 | # 'name': 'issue125', 18 | # 'path': 'net/http/' 19 | #}, 20 | ]) 21 | 22 | # LINUX 23 | if OS_POSTFIX == "linux": 24 | # noinspection PyUnresolvedReferences 25 | patches.extend([ 26 | { 27 | # Discovery of the "icudtl.dat" file fails on Linux. 28 | 'name': 'issue231', 29 | 'path': 'cef/' 30 | }, 31 | ]) 32 | -------------------------------------------------------------------------------- /src/.gitignore: -------------------------------------------------------------------------------- 1 | # If you want to ignore an already commited directory run: 2 | # git rm --cached -r .idea 3 | 4 | compile_time_constants.pxi 5 | -------------------------------------------------------------------------------- /src/app.pyx: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2014 CEF Python, see the Authors file. 2 | # All rights reserved. Licensed under BSD 3-clause license. 3 | # Project website: https://github.com/cztomczak/cefpython 4 | 5 | include "cefpython.pyx" 6 | 7 | cdef public void App_OnBeforeCommandLineProcessing_BrowserProcess( 8 | CefRefPtr[CefCommandLine] cefCommandLine 9 | ) except * with gil: 10 | try: 11 | AppendSwitchesToCommandLine(cefCommandLine, g_commandLineSwitches) 12 | Debug("App_OnBeforeCommandLineProcessing_BrowserProcess()") 13 | except: 14 | (exc_type, exc_value, exc_trace) = sys.exc_info() 15 | sys.excepthook(exc_type, exc_value, exc_trace) 16 | -------------------------------------------------------------------------------- /src/callback.pyx: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2013 CEF Python, see the Authors file. 2 | # All rights reserved. Licensed under BSD 3-clause license. 3 | # Project website: https://github.com/cztomczak/cefpython 4 | 5 | include "cefpython.pyx" 6 | 7 | cdef PyCallback CreatePyCallback( 8 | CefRefPtr[CefCallback] cefCallback): 9 | cdef PyCallback pyCallback = PyCallback() 10 | pyCallback.cefCallback = cefCallback 11 | return pyCallback 12 | 13 | cdef class PyCallback: 14 | cdef CefRefPtr[CefCallback] cefCallback 15 | 16 | cpdef py_void Continue(self): 17 | self.cefCallback.get().Continue() 18 | 19 | cpdef py_void Cancel(self): 20 | self.cefCallback.get().Cancel() 21 | -------------------------------------------------------------------------------- /src/cef_types.pyx: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2014 CEF Python, see the Authors file. 2 | # All rights reserved. Licensed under BSD 3-clause license. 3 | # Project website: https://github.com/cztomczak/cefpython 4 | 5 | cimport cef_types 6 | 7 | STATE_DEFAULT = cef_types.STATE_DEFAULT 8 | STATE_ENABLED = cef_types.STATE_ENABLED 9 | STATE_DISABLED = cef_types.STATE_DISABLED 10 | -------------------------------------------------------------------------------- /src/cefpython3.wx/README.txt: -------------------------------------------------------------------------------- 1 | This is a wxPython subpackage for the cefpython3 package 2 | that provides an easy to use API for the wxPython GUI library. 3 | 4 | Author: Greg Kacy 5 | License: BSD 3-clause 6 | 7 | -------------------------------------------------------------------------------- /src/cefpython3.wx/__init__.py: -------------------------------------------------------------------------------- 1 | # This dummy file is overwritten by "__init__.py.template", see: 2 | # cefpython/windows/installer/ 3 | # cefpython/linux/installer/ 4 | -------------------------------------------------------------------------------- /src/cefpython3.wx/examples/back.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/llcc01/cefpython/f09e3d6bf32cf3c975328cbfa08ec6a8ac7f48f5/src/cefpython3.wx/examples/back.png -------------------------------------------------------------------------------- /src/cefpython3.wx/examples/forward.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/llcc01/cefpython/f09e3d6bf32cf3c975328cbfa08ec6a8ac7f48f5/src/cefpython3.wx/examples/forward.png -------------------------------------------------------------------------------- /src/cefpython3.wx/examples/reload_page.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/llcc01/cefpython/f09e3d6bf32cf3c975328cbfa08ec6a8ac7f48f5/src/cefpython3.wx/examples/reload_page.png -------------------------------------------------------------------------------- /src/cefpython3.wx/examples/sample1.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | sample 1 6 | 10 | 11 | 12 | 13 | sample1.py - wxPython example for the CEF Python framework 14 | 15 |

Google Search

16 | 17 | http://www.google.com/ 18 | 19 |

User agent

20 | 21 | 22 | 23 |

Popup

24 | 25 | 26 | window.open('sample1.html') 27 | 28 |










29 |










30 |










31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /src/cefpython3.wx/examples/sample1.py: -------------------------------------------------------------------------------- 1 | # Simple sample ilustrating the usage of CEFWindow class. 2 | 3 | # On Mac the cefpython library must be imported the very first, 4 | # before any other libraries (Issue 155). 5 | import cefpython3.wx.chromectrl as chrome 6 | 7 | import os 8 | import wx 9 | import platform 10 | 11 | class MainFrame(wx.Frame): 12 | def __init__(self): 13 | wx.Frame.__init__(self, parent=None, id=wx.ID_ANY, 14 | title='cefwx example1', size=(800,600)) 15 | 16 | self.cefWindow = chrome.ChromeWindow(self, 17 | url=os.path.join(os.path.dirname(os.path.abspath(__file__)), 18 | "sample1.html")) 19 | 20 | sizer = wx.BoxSizer() 21 | sizer.Add(self.cefWindow, 1, wx.EXPAND, 0) 22 | self.SetSizer(sizer) 23 | 24 | self.Bind(wx.EVT_CLOSE, self.OnClose) 25 | 26 | def OnClose(self, event): 27 | # Remember to destroy all CEF browser references before calling 28 | # Destroy(), so that browser closes cleanly. In this specific 29 | # example there are no references kept, but keep this in mind 30 | # for the future. 31 | self.Destroy() 32 | # On Mac the code after app.MainLoop() never executes, so 33 | # need to call CEF shutdown here. 34 | if platform.system() == "Darwin": 35 | chrome.Shutdown() 36 | wx.GetApp().Exit() 37 | 38 | class MyApp(wx.App): 39 | def OnInit(self): 40 | frame = MainFrame() 41 | self.SetTopWindow(frame) 42 | frame.Show() 43 | return True 44 | 45 | if __name__ == '__main__': 46 | chrome.Initialize({ 47 | "debug": True, 48 | "log_file": "debug.log", 49 | "log_severity": chrome.cefpython.LOGSEVERITY_INFO, 50 | # "cache_path": "webcache/", 51 | }) 52 | print('[sample1.py] wx.version=%s' % wx.version()) 53 | app = MyApp(False) 54 | app.MainLoop() 55 | # Important: do the wx cleanup before calling Shutdown 56 | del app 57 | # On Mac Shutdown is called in OnClose 58 | if platform.system() in ["Linux", "Windows"]: 59 | chrome.Shutdown() 60 | -------------------------------------------------------------------------------- /src/cefpython3.wx/images/back.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/llcc01/cefpython/f09e3d6bf32cf3c975328cbfa08ec6a8ac7f48f5/src/cefpython3.wx/images/back.png -------------------------------------------------------------------------------- /src/cefpython3.wx/images/forward.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/llcc01/cefpython/f09e3d6bf32cf3c975328cbfa08ec6a8ac7f48f5/src/cefpython3.wx/images/forward.png -------------------------------------------------------------------------------- /src/cefpython3.wx/images/reload_page.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/llcc01/cefpython/f09e3d6bf32cf3c975328cbfa08ec6a8ac7f48f5/src/cefpython3.wx/images/reload_page.png -------------------------------------------------------------------------------- /src/cefpython3.wx/utils.py: -------------------------------------------------------------------------------- 1 | # Additional and wx specific layer of abstraction for the cefpython 2 | # __author__ = "Greg Kacy " 3 | 4 | #------------------------------------------------------------------------------- 5 | 6 | def ExceptHook(excType, excValue, traceObject): 7 | import traceback, os 8 | errorMsg = "\n".join(traceback.format_exception( 9 | excType, excValue, traceObject)) 10 | if type(errorMsg) == bytes: 11 | errorMsg = errorMsg.decode(encoding="ascii", errors="replace") 12 | else: 13 | errorMsg = errorMsg.encode("ascii", errors="replace") 14 | errorMsg = errorMsg.decode("ascii", errors="replace") 15 | print("\n"+errorMsg+"\n") 16 | #cefpython.QuitMessageLoop() 17 | #cefpython.Shutdown() 18 | # So that "finally" does not execute. 19 | #os._exit(1) 20 | -------------------------------------------------------------------------------- /src/client_handler/.gitignore: -------------------------------------------------------------------------------- 1 | *.o 2 | *.a -------------------------------------------------------------------------------- /src/client_handler/accessibility_handler.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2018 CEF Python, see the Authors file. 2 | // All rights reserved. Licensed under BSD 3-clause license. 3 | // Project website: https://github.com/cztomczak/cefpython 4 | 5 | #include "accessibility_handler.h" 6 | #include "common/cefpython_public_api.h" 7 | 8 | 9 | void AccessibilityHandler::OnAccessibilityTreeChange( 10 | CefRefPtr value) { 11 | REQUIRE_UI_THREAD(); 12 | AccessibilityHandler_OnAccessibilityTreeChange(value); 13 | } 14 | 15 | void AccessibilityHandler::OnAccessibilityLocationChange( 16 | CefRefPtr value) { 17 | REQUIRE_UI_THREAD(); 18 | AccessibilityHandler_OnAccessibilityLocationChange(value); 19 | } 20 | -------------------------------------------------------------------------------- /src/client_handler/accessibility_handler.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2018 CEF Python, see the Authors file. 2 | // All rights reserved. Licensed under BSD 3-clause license. 3 | // Project website: https://github.com/cztomczak/cefpython 4 | 5 | #include "common/cefpython_public_api.h" 6 | #include "include/cef_accessibility_handler.h" 7 | 8 | 9 | class AccessibilityHandler : public CefAccessibilityHandler 10 | { 11 | public: 12 | AccessibilityHandler(){} 13 | virtual ~AccessibilityHandler(){} 14 | 15 | virtual void OnAccessibilityTreeChange(CefRefPtr value) override; 16 | virtual void OnAccessibilityLocationChange(CefRefPtr value) override; 17 | 18 | private: 19 | IMPLEMENT_REFCOUNTING(AccessibilityHandler); 20 | }; 21 | -------------------------------------------------------------------------------- /src/client_handler/cef_log.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017 CEF Python, see the Authors file. 2 | // All rights reserved. Licensed under BSD 3-clause license. 3 | // Project website: https://github.com/cztomczak/cefpython 4 | 5 | #include "include/base/cef_logging.h" 6 | 7 | void cef_log_info(char* msg) { 8 | LOG(INFO) << msg; 9 | } 10 | 11 | void cef_log_warning(char* msg) { 12 | LOG(WARNING) << msg; 13 | } 14 | 15 | void cef_log_error(char* msg) { 16 | LOG(ERROR) << msg; 17 | } 18 | -------------------------------------------------------------------------------- /src/client_handler/cef_log.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017 CEF Python, see the Authors file. 2 | // All rights reserved. Licensed under BSD 3-clause license. 3 | // Project website: https://github.com/cztomczak/cefpython 4 | 5 | #pragma once 6 | 7 | void cef_log_info(char* msg); 8 | void cef_log_warning(char* msg); 9 | void cef_log_error(char* msg); 10 | -------------------------------------------------------------------------------- /src/client_handler/context_menu_handler.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 CEF Python, see the Authors file. 2 | // All rights reserved. Licensed under BSD 3-clause license. 3 | // Project website: https://github.com/cztomczak/cefpython 4 | 5 | #pragma once 6 | 7 | #include "common/cefpython_public_api.h" 8 | #include "include/cef_context_menu_handler.h" 9 | 10 | 11 | class ContextMenuHandler : public CefContextMenuHandler 12 | { 13 | public: 14 | ContextMenuHandler(){} 15 | virtual ~ContextMenuHandler(){} 16 | 17 | typedef cef_event_flags_t EventFlags; 18 | 19 | void OnBeforeContextMenu(CefRefPtr browser, 20 | CefRefPtr frame, 21 | CefRefPtr params, 22 | CefRefPtr model) override; 23 | 24 | bool OnContextMenuCommand(CefRefPtr browser, 25 | CefRefPtr frame, 26 | CefRefPtr params, 27 | int command_id, 28 | EventFlags event_flags) override; 29 | 30 | void OnContextMenuDismissed(CefRefPtr browser, 31 | CefRefPtr frame) override; 32 | 33 | private: 34 | IMPLEMENT_REFCOUNTING(ContextMenuHandler); 35 | }; 36 | -------------------------------------------------------------------------------- /src/client_handler/cookie_visitor.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 CEF Python, see the Authors file. 2 | // All rights reserved. Licensed under BSD 3-clause license. 3 | // Project website: https://github.com/cztomczak/cefpython 4 | 5 | #include "cookie_visitor.h" 6 | #include 7 | 8 | bool CookieVisitor::Visit( 9 | const CefCookie& cookie, 10 | int count, 11 | int total, 12 | bool& deleteCookie 13 | ) { 14 | REQUIRE_IO_THREAD(); 15 | return CookieVisitor_Visit(cookieVisitorId_, cookie, count, total, 16 | deleteCookie); 17 | } 18 | -------------------------------------------------------------------------------- /src/client_handler/cookie_visitor.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 CEF Python, see the Authors file. 2 | // All rights reserved. Licensed under BSD 3-clause license. 3 | // Project website: https://github.com/cztomczak/cefpython 4 | 5 | #pragma once 6 | 7 | #if defined(_WIN32) 8 | #include 9 | #endif 10 | 11 | #include "common/cefpython_public_api.h" 12 | 13 | class CookieVisitor : public CefCookieVisitor 14 | { 15 | public: 16 | int cookieVisitorId_; 17 | public: 18 | CookieVisitor(int cookieVisitorId) 19 | : cookieVisitorId_(cookieVisitorId) { 20 | } 21 | 22 | virtual bool Visit( 23 | const CefCookie& cookie, 24 | int count, 25 | int total, 26 | bool& deleteCookie 27 | ) override; 28 | 29 | protected: 30 | IMPLEMENT_REFCOUNTING(CookieVisitor); 31 | }; 32 | -------------------------------------------------------------------------------- /src/client_handler/dialog_handler.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017 CEF Python, see the Authors file. 2 | // All rights reserved. Licensed under BSD 3-clause license. 3 | // Project website: https://github.com/cztomczak/cefpython 4 | 5 | #include "dialog_handler.h" 6 | 7 | 8 | DialogHandler::DialogHandler() 9 | { 10 | #if defined(OS_LINUX) 11 | // Provide the GTK-based default dialog implementation on Linux. 12 | dialog_handler_ = new ClientDialogHandlerGtk(); 13 | #endif 14 | } 15 | 16 | 17 | bool DialogHandler::OnFileDialog(CefRefPtr browser, 18 | FileDialogMode mode, 19 | const CefString& title, 20 | const CefString& default_file_path, 21 | const std::vector& accept_filters, 22 | // int selected_accept_filter, 23 | CefRefPtr callback) 24 | { 25 | #if defined(OS_LINUX) 26 | return dialog_handler_->OnFileDialog(browser, 27 | mode, 28 | title, 29 | default_file_path, 30 | accept_filters, 31 | selected_accept_filter, 32 | callback); 33 | #else 34 | return false; 35 | #endif 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/client_handler/dialog_handler.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017 CEF Python, see the Authors file. 2 | // All rights reserved. Licensed under BSD 3-clause license. 3 | // Project website: https://github.com/cztomczak/cefpython 4 | 5 | #pragma once 6 | 7 | #include "common/cefpython_public_api.h" 8 | #include "include/cef_dialog_handler.h" 9 | 10 | #if defined(OS_LINUX) 11 | #include "dialog_handler_gtk.h" 12 | #endif 13 | 14 | 15 | class DialogHandler : public CefDialogHandler 16 | { 17 | public: 18 | DialogHandler(); 19 | virtual ~DialogHandler(){} 20 | 21 | bool OnFileDialog(CefRefPtr browser, 22 | FileDialogMode mode, 23 | const CefString& title, 24 | const CefString& default_file_path, 25 | const std::vector& accept_filters, 26 | // int selected_accept_filter, 27 | CefRefPtr callback) 28 | ; 29 | 30 | public: 31 | #if defined(OS_LINUX) 32 | // Default dialog handler impl for GTK. 33 | CefRefPtr dialog_handler_; 34 | #endif 35 | 36 | private: 37 | IMPLEMENT_REFCOUNTING(DialogHandler); 38 | }; 39 | -------------------------------------------------------------------------------- /src/client_handler/display_handler.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012 CEF Python, see the Authors file. 2 | // All rights reserved. Licensed under BSD 3-clause license. 3 | // Project website: https://github.com/cztomczak/cefpython 4 | 5 | #include "display_handler.h" 6 | 7 | 8 | void DisplayHandler::OnAddressChange(CefRefPtr browser, 9 | CefRefPtr frame, 10 | const CefString& url) 11 | { 12 | REQUIRE_UI_THREAD(); 13 | DisplayHandler_OnAddressChange(browser, frame, url); 14 | } 15 | 16 | 17 | void DisplayHandler::OnTitleChange(CefRefPtr browser, 18 | const CefString& title) 19 | { 20 | REQUIRE_UI_THREAD(); 21 | DisplayHandler_OnTitleChange(browser, title); 22 | } 23 | 24 | 25 | bool DisplayHandler::OnTooltip(CefRefPtr browser, 26 | CefString& text) 27 | { 28 | REQUIRE_UI_THREAD(); 29 | return DisplayHandler_OnTooltip(browser, text); 30 | } 31 | 32 | 33 | void DisplayHandler::OnStatusMessage(CefRefPtr browser, 34 | const CefString& value) 35 | { 36 | REQUIRE_UI_THREAD(); 37 | DisplayHandler_OnStatusMessage(browser, value); 38 | } 39 | 40 | 41 | bool DisplayHandler::OnConsoleMessage(CefRefPtr browser, 42 | cef_log_severity_t level, 43 | const CefString& message, 44 | const CefString& source, 45 | int line) 46 | { 47 | REQUIRE_UI_THREAD(); 48 | return DisplayHandler_OnConsoleMessage(browser, level, message, source, 49 | line); 50 | } 51 | 52 | bool DisplayHandler::OnAutoResize(CefRefPtr browser, 53 | const CefSize& new_size) { 54 | REQUIRE_UI_THREAD(); 55 | return DisplayHandler_OnAutoResize(browser, new_size); 56 | } 57 | 58 | void DisplayHandler::OnLoadingProgressChange(CefRefPtr browser, 59 | double progress) { 60 | REQUIRE_UI_THREAD(); 61 | return DisplayHandler_OnLoadingProgressChange(browser, progress); 62 | } -------------------------------------------------------------------------------- /src/client_handler/display_handler.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012 CEF Python, see the Authors file. 2 | // All rights reserved. Licensed under BSD 3-clause license. 3 | // Project website: https://github.com/cztomczak/cefpython 4 | 5 | #pragma once 6 | 7 | #include "common/cefpython_public_api.h" 8 | #include "include/cef_display_handler.h" 9 | 10 | 11 | class DisplayHandler : public CefDisplayHandler 12 | { 13 | public: 14 | DisplayHandler(){} 15 | virtual ~DisplayHandler(){} 16 | 17 | void OnAddressChange(CefRefPtr browser, 18 | CefRefPtr frame, 19 | const CefString& url) override; 20 | 21 | void OnTitleChange(CefRefPtr browser, 22 | const CefString& title) override; 23 | 24 | bool OnTooltip(CefRefPtr browser, 25 | CefString& text) override; 26 | 27 | void OnStatusMessage(CefRefPtr browser, 28 | const CefString& value) override; 29 | 30 | bool OnConsoleMessage(CefRefPtr browser, 31 | cef_log_severity_t level, 32 | const CefString& message, 33 | const CefString& source, 34 | int line) override; 35 | 36 | bool OnAutoResize(CefRefPtr browser, 37 | const CefSize& new_size) override; 38 | 39 | void OnLoadingProgressChange(CefRefPtr browser, 40 | double progress) override; 41 | 42 | private: 43 | IMPLEMENT_REFCOUNTING(DisplayHandler); 44 | }; 45 | -------------------------------------------------------------------------------- /src/client_handler/download_handler.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 CEF Python, see the Authors file. 2 | // All rights reserved. Licensed under BSD 3-clause license. 3 | // Project website: https://github.com/cztomczak/cefpython 4 | 5 | #include "download_handler.h" 6 | #include "include/base/cef_logging.h" 7 | 8 | 9 | void DownloadHandler::OnBeforeDownload( 10 | CefRefPtr browser, 11 | CefRefPtr download_item, 12 | const CefString& suggested_name, 13 | CefRefPtr callback) 14 | { 15 | REQUIRE_UI_THREAD(); 16 | // bool downloads_enabled = ApplicationSettings_GetBool("downloads_enabled"); 17 | // if (downloads_enabled) { 18 | // std::string msg = "[Browser process] About to download file: "; 19 | // msg.append(suggested_name.ToString().c_str()); 20 | // LOG(INFO) << msg.c_str(); 21 | // callback->Continue(suggested_name, true); 22 | // } else { 23 | // LOG(INFO) << "[Browser process] Tried to download file," 24 | // " but downloads are disabled"; 25 | // } 26 | DownloadHandler_OnBeforeDownload(browser, download_item, suggested_name, callback); 27 | } 28 | 29 | 30 | void DownloadHandler::OnDownloadUpdated( 31 | CefRefPtr browser, 32 | CefRefPtr download_item, 33 | CefRefPtr callback) 34 | { 35 | REQUIRE_UI_THREAD(); 36 | // if (download_item->IsComplete()) { 37 | // std::string msg = "[Browser process] Download completed, saved to: "; 38 | // msg.append(download_item->GetFullPath().ToString().c_str()); 39 | // LOG(INFO) << msg.c_str(); 40 | // } else if (download_item->IsCanceled()) { 41 | // LOG(INFO) << "[Browser process] Download was cancelled"; 42 | // } 43 | DownloadHandler_OnDownloadUpdated(browser, download_item, callback); 44 | } 45 | -------------------------------------------------------------------------------- /src/client_handler/download_handler.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 CEF Python, see the Authors file. 2 | // All rights reserved. Licensed under BSD 3-clause license. 3 | // Project website: https://github.com/cztomczak/cefpython 4 | 5 | #include "common/cefpython_public_api.h" 6 | #include "include/cef_download_handler.h" 7 | 8 | 9 | class DownloadHandler : public CefDownloadHandler 10 | { 11 | public: 12 | DownloadHandler(){} 13 | virtual ~DownloadHandler(){} 14 | 15 | void OnBeforeDownload(CefRefPtr browser, 16 | CefRefPtr download_item, 17 | const CefString& suggested_name, 18 | CefRefPtr callback 19 | ) override; 20 | 21 | void OnDownloadUpdated(CefRefPtr browser, 22 | CefRefPtr download_item, 23 | CefRefPtr callback 24 | ) override; 25 | 26 | private: 27 | IMPLEMENT_REFCOUNTING(DownloadHandler); 28 | }; 29 | -------------------------------------------------------------------------------- /src/client_handler/dpi_aware.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 CEF Python, see the Authors file. 2 | // All rights reserved. Licensed under BSD 3-clause license. 3 | // Project website: https://github.com/cztomczak/cefpython 4 | 5 | // Windows only 6 | 7 | #pragma once 8 | 9 | #include 10 | #include "include/cef_app.h" 11 | #include "util.h" 12 | 13 | // Duplicated from Win8.1 SDK ShellScalingApi.h 14 | typedef enum PROCESS_DPI_AWARENESS { 15 | PROCESS_DPI_UNAWARE = 0, 16 | PROCESS_SYSTEM_DPI_AWARE = 1, 17 | PROCESS_PER_MONITOR_DPI_AWARE = 2 18 | } PROCESS_DPI_AWARENESS; 19 | 20 | bool IsProcessDpiAware(); 21 | PROCESS_DPI_AWARENESS GetProcessDpiAwareness(); 22 | void SetProcessDpiAware(); 23 | void GetSystemDpi(int* outx, int* outy); 24 | void GetDpiAwareWindowSize(int* width, int* height); 25 | void SetBrowserDpiSettings(CefRefPtr cefBrowser, 26 | CefString autoZooming); 27 | 28 | -------------------------------------------------------------------------------- /src/client_handler/focus_handler.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 CEF Python, see the Authors file. 2 | // All rights reserved. Licensed under BSD 3-clause license. 3 | // Project website: https://github.com/cztomczak/cefpython 4 | 5 | #include "focus_handler.h" 6 | 7 | 8 | void FocusHandler::OnTakeFocus(CefRefPtr browser, 9 | bool next) 10 | { 11 | REQUIRE_UI_THREAD(); 12 | FocusHandler_OnTakeFocus(browser, next); 13 | } 14 | 15 | 16 | bool FocusHandler::OnSetFocus(CefRefPtr browser, 17 | cef_focus_source_t source) 18 | { 19 | REQUIRE_UI_THREAD(); 20 | return FocusHandler_OnSetFocus(browser, source); 21 | } 22 | 23 | 24 | void FocusHandler::OnGotFocus(CefRefPtr browser) 25 | { 26 | REQUIRE_UI_THREAD(); 27 | FocusHandler_OnGotFocus(browser); 28 | } 29 | -------------------------------------------------------------------------------- /src/client_handler/focus_handler.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 CEF Python, see the Authors file. 2 | // All rights reserved. Licensed under BSD 3-clause license. 3 | // Project website: https://github.com/cztomczak/cefpython 4 | 5 | #include "common/cefpython_public_api.h" 6 | #include "include/cef_focus_handler.h" 7 | 8 | 9 | class FocusHandler : public CefFocusHandler 10 | { 11 | public: 12 | FocusHandler(){} 13 | virtual ~FocusHandler(){} 14 | 15 | void OnTakeFocus(CefRefPtr browser, 16 | bool next) override; 17 | 18 | bool OnSetFocus(CefRefPtr browser, 19 | cef_focus_source_t source) override; 20 | 21 | void OnGotFocus(CefRefPtr browser) override; 22 | 23 | private: 24 | IMPLEMENT_REFCOUNTING(FocusHandler); 25 | }; 26 | -------------------------------------------------------------------------------- /src/client_handler/js_dialog_handler.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 CEF Python, see the Authors file. 2 | // All rights reserved. Licensed under BSD 3-clause license. 3 | // Project website: https://github.com/cztomczak/cefpython 4 | 5 | #include "common/cefpython_public_api.h" 6 | #include "include/cef_jsdialog_handler.h" 7 | 8 | #if defined(OS_LINUX) 9 | #include "dialog_handler_gtk.h" 10 | #endif 11 | 12 | 13 | class JSDialogHandler : public CefJSDialogHandler 14 | { 15 | public: 16 | JSDialogHandler(); 17 | virtual ~JSDialogHandler(){} 18 | 19 | typedef cef_jsdialog_type_t JSDialogType; 20 | 21 | bool OnJSDialog(CefRefPtr browser, 22 | const CefString& origin_url, 23 | JSDialogType dialog_type, 24 | const CefString& message_text, 25 | const CefString& default_prompt_text, 26 | CefRefPtr callback, 27 | bool& suppress_message) override; 28 | 29 | bool OnBeforeUnloadDialog(CefRefPtr browser, 30 | const CefString& message_text, 31 | bool is_reload, 32 | CefRefPtr callback 33 | ) override; 34 | 35 | void OnResetDialogState(CefRefPtr browser) override; 36 | void OnDialogClosed(CefRefPtr browser) override; 37 | 38 | public: 39 | #if defined(OS_LINUX) 40 | // Default dialog handler impl for GTK. 41 | CefRefPtr dialog_handler_; 42 | #endif 43 | 44 | private: 45 | IMPLEMENT_REFCOUNTING(JSDialogHandler); 46 | }; 47 | -------------------------------------------------------------------------------- /src/client_handler/keyboard_handler.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012 CEF Python, see the Authors file. 2 | // All rights reserved. Licensed under BSD 3-clause license. 3 | // Project website: https://github.com/cztomczak/cefpython 4 | 5 | #include "keyboard_handler.h" 6 | 7 | 8 | bool KeyboardHandler::OnPreKeyEvent(CefRefPtr browser, 9 | const CefKeyEvent& event, 10 | CefEventHandle os_event, 11 | bool* is_keyboard_shortcut) 12 | { 13 | REQUIRE_UI_THREAD(); 14 | return KeyboardHandler_OnPreKeyEvent(browser, event, os_event, 15 | is_keyboard_shortcut); 16 | } 17 | 18 | 19 | bool KeyboardHandler:: OnKeyEvent(CefRefPtr browser, 20 | const CefKeyEvent& event, 21 | CefEventHandle os_event) 22 | { 23 | REQUIRE_UI_THREAD(); 24 | return KeyboardHandler_OnKeyEvent(browser, event, os_event); 25 | } 26 | -------------------------------------------------------------------------------- /src/client_handler/keyboard_handler.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012 CEF Python, see the Authors file. 2 | // All rights reserved. Licensed under BSD 3-clause license. 3 | // Project website: https://github.com/cztomczak/cefpython 4 | 5 | #include "common/cefpython_public_api.h" 6 | #include "include/cef_keyboard_handler.h" 7 | 8 | 9 | class KeyboardHandler : public CefKeyboardHandler 10 | { 11 | public: 12 | KeyboardHandler(){} 13 | virtual ~KeyboardHandler(){} 14 | 15 | bool OnPreKeyEvent(CefRefPtr browser, 16 | const CefKeyEvent& event, 17 | CefEventHandle os_event, 18 | bool* is_keyboard_shortcut) override; 19 | 20 | bool OnKeyEvent(CefRefPtr browser, 21 | const CefKeyEvent& event, 22 | CefEventHandle os_event) override; 23 | 24 | private: 25 | IMPLEMENT_REFCOUNTING(KeyboardHandler); 26 | }; 27 | -------------------------------------------------------------------------------- /src/client_handler/lifespan_handler.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012 CEF Python, see the Authors file. 2 | // All rights reserved. Licensed under BSD 3-clause license. 3 | // Project website: https://github.com/cztomczak/cefpython 4 | 5 | #include "common/cefpython_public_api.h" 6 | #include "include/cef_life_span_handler.h" 7 | 8 | 9 | class LifespanHandler : public CefLifeSpanHandler 10 | { 11 | public: 12 | LifespanHandler(){} 13 | virtual ~LifespanHandler(){} 14 | 15 | typedef cef_window_open_disposition_t WindowOpenDisposition; 16 | 17 | bool OnBeforePopup(CefRefPtr browser, 18 | CefRefPtr frame, 19 | const CefString& target_url, 20 | const CefString& target_frame_name, 21 | WindowOpenDisposition target_disposition, 22 | bool user_gesture, 23 | const CefPopupFeatures& popupFeatures, 24 | CefWindowInfo& windowInfo, 25 | CefRefPtr& client, 26 | CefBrowserSettings& settings, 27 | CefRefPtr& extra_info, 28 | bool* no_javascript_access) override; 29 | void OnAfterCreated(CefRefPtr browser) override; 30 | bool DoClose(CefRefPtr browser) override; 31 | void OnBeforeClose(CefRefPtr browser) override; 32 | 33 | private: 34 | IMPLEMENT_REFCOUNTING(LifespanHandler); 35 | }; 36 | -------------------------------------------------------------------------------- /src/client_handler/load_handler.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012 CEF Python, see the Authors file. 2 | // All rights reserved. Licensed under BSD 3-clause license. 3 | // Project website: https://github.com/cztomczak/cefpython 4 | 5 | #include "load_handler.h" 6 | 7 | 8 | void LoadHandler::OnLoadingStateChange(CefRefPtr browser, 9 | bool isLoading, 10 | bool canGoBack, 11 | bool canGoForward) 12 | { 13 | REQUIRE_UI_THREAD(); 14 | LoadHandler_OnLoadingStateChange(browser, isLoading, canGoBack, 15 | canGoForward); 16 | } 17 | 18 | 19 | void LoadHandler::OnLoadStart(CefRefPtr browser, 20 | CefRefPtr frame, 21 | TransitionType transition_type) 22 | { 23 | REQUIRE_UI_THREAD(); 24 | LoadHandler_OnLoadStart(browser, frame); 25 | } 26 | 27 | 28 | void LoadHandler::OnLoadEnd(CefRefPtr browser, 29 | CefRefPtr frame, 30 | int httpStatusCode) 31 | { 32 | REQUIRE_UI_THREAD(); 33 | LoadHandler_OnLoadEnd(browser, frame, httpStatusCode); 34 | } 35 | 36 | 37 | void LoadHandler::OnLoadError(CefRefPtr browser, 38 | CefRefPtr frame, 39 | cef_errorcode_t errorCode, 40 | const CefString& errorText, 41 | const CefString& failedUrl) 42 | { 43 | REQUIRE_UI_THREAD(); 44 | LoadHandler_OnLoadError(browser, frame, errorCode, errorText, failedUrl); 45 | } 46 | -------------------------------------------------------------------------------- /src/client_handler/load_handler.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012 CEF Python, see the Authors file. 2 | // All rights reserved. Licensed under BSD 3-clause license. 3 | // Project website: https://github.com/cztomczak/cefpython 4 | 5 | #include "common/cefpython_public_api.h" 6 | #include "include/cef_load_handler.h" 7 | 8 | 9 | class LoadHandler : public CefLoadHandler 10 | { 11 | public: 12 | LoadHandler(){} 13 | virtual ~LoadHandler(){} 14 | 15 | typedef cef_transition_type_t TransitionType; 16 | 17 | void OnLoadingStateChange(CefRefPtr browser, 18 | bool isLoading, 19 | bool canGoBack, 20 | bool canGoForward) override; 21 | 22 | void OnLoadStart(CefRefPtr browser, 23 | CefRefPtr frame, 24 | TransitionType transition_type) override; 25 | 26 | void OnLoadEnd(CefRefPtr browser, 27 | CefRefPtr frame, 28 | int httpStatusCode) override; 29 | 30 | void OnLoadError(CefRefPtr browser, 31 | CefRefPtr frame, 32 | cef_errorcode_t errorCode, 33 | const CefString& errorText, 34 | const CefString& failedUrl) override; 35 | 36 | private: 37 | IMPLEMENT_REFCOUNTING(LoadHandler); 38 | }; 39 | -------------------------------------------------------------------------------- /src/client_handler/request_context_handler.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013 CEF Python, see the Authors file. 2 | // All rights reserved. Licensed under BSD 3-clause license. 3 | // Project website: https://github.com/cztomczak/cefpython 4 | 5 | #include "request_context_handler.h" 6 | #include "common/cefpython_public_api.h" 7 | 8 | // -------------------------------------------------------------------------- 9 | // CefRequestContextHandler 10 | // -------------------------------------------------------------------------- 11 | 12 | // CefRefPtr RequestContextHandler::GetCookieManager() { 13 | // REQUIRE_IO_THREAD(); 14 | // if (browser_.get()) { 15 | // return RequestHandler_GetCookieManager(browser_, 16 | // browser_->GetMainFrame()->GetURL()); 17 | // } else { 18 | // CefString mainUrl; 19 | // return RequestHandler_GetCookieManager(browser_, mainUrl); 20 | // } 21 | // // Default: return NULL. 22 | // } 23 | 24 | // bool RequestContextHandler::OnBeforePluginLoad( 25 | // const CefString& mime_type, 26 | // const CefString& plugin_url, 27 | // bool is_main_frame, 28 | // const CefString& top_origin_url, 29 | // CefRefPtr plugin_info, 30 | // PluginPolicy* plugin_policy) { 31 | // // Called on multiple threads 32 | // return RequestHandler_OnBeforePluginLoad(browser_, 33 | // mime_type, 34 | // plugin_url, 35 | // is_main_frame, 36 | // top_origin_url, 37 | // plugin_info, 38 | // plugin_policy); 39 | // } 40 | 41 | //LC TODO -------------------------------------------------------------------------------- /src/client_handler/request_context_handler.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013 CEF Python, see the Authors file. 2 | // All rights reserved. Licensed under BSD 3-clause license. 3 | // Project website: https://github.com/cztomczak/cefpython 4 | 5 | #pragma once 6 | 7 | #if defined(_WIN32) 8 | #include 9 | #endif 10 | 11 | #include "common/cefpython_public_api.h" 12 | 13 | #include "include/cef_request_context_handler.h" 14 | #include "include/base/cef_callback.h" 15 | 16 | class RequestContextHandler : 17 | public CefRequestContextHandler 18 | { 19 | private: 20 | CefRefPtr browser_; 21 | // typedef cef_plugin_policy_t PluginPolicy; 22 | 23 | public: 24 | // Browser may be NULL when instantiated from cefpython.CreateBrowserSync. 25 | // In such case SetBrowser will be called after browser creation. 26 | // GetCookieManager must handle a case when browser is NULL. 27 | explicit RequestContextHandler(CefRefPtr browser) 28 | : browser_(browser) { 29 | } 30 | 31 | void SetBrowser(CefRefPtr browser) { 32 | browser_ = browser; 33 | } 34 | 35 | 36 | // virtual CefRefPtr GetCookieManager() OVERRIDE; 37 | // virtual bool OnBeforePluginLoad(const CefString& mime_type, 38 | // const CefString& plugin_url, 39 | // bool is_main_frame, 40 | // const CefString& top_origin_url, 41 | // CefRefPtr plugin_info, 42 | // PluginPolicy* plugin_policy) OVERRIDE; 43 | 44 | private: 45 | IMPLEMENT_REFCOUNTING(RequestContextHandler); 46 | }; 47 | -------------------------------------------------------------------------------- /src/client_handler/resource_handler.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013 CEF Python, see the Authors file. 2 | // All rights reserved. Licensed under BSD 3-clause license. 3 | // Project website: https://github.com/cztomczak/cefpython 4 | 5 | #include "resource_handler.h" 6 | 7 | bool ResourceHandler::ProcessRequest(CefRefPtr request, 8 | CefRefPtr callback) { 9 | REQUIRE_IO_THREAD(); 10 | return ResourceHandler_ProcessRequest(resourceHandlerId_, request, 11 | callback); 12 | } 13 | 14 | void ResourceHandler::GetResponseHeaders(CefRefPtr response, 15 | int64& response_length, 16 | CefString& redirectUrl) { 17 | REQUIRE_IO_THREAD(); 18 | ResourceHandler_GetResponseHeaders(resourceHandlerId_, response, 19 | response_length, redirectUrl); 20 | } 21 | 22 | bool ResourceHandler::ReadResponse(void* data_out, 23 | int bytes_to_read, 24 | int& bytes_read, 25 | CefRefPtr callback) { 26 | REQUIRE_IO_THREAD(); 27 | return ResourceHandler_ReadResponse(resourceHandlerId_, data_out, 28 | bytes_to_read, bytes_read, callback); 29 | } 30 | 31 | // bool ResourceHandler::CanGetCookie(const CefCookie& cookie) { 32 | // REQUIRE_IO_THREAD(); 33 | // return ResourceHandler_CanGetCookie(resourceHandlerId_, cookie); 34 | // } 35 | 36 | // bool ResourceHandler::CanSetCookie(const CefCookie& cookie) { 37 | // REQUIRE_IO_THREAD(); 38 | // return ResourceHandler_CanSetCookie(resourceHandlerId_, cookie); 39 | // } 40 | 41 | void ResourceHandler::Cancel() { 42 | REQUIRE_IO_THREAD(); 43 | return ResourceHandler_Cancel(resourceHandlerId_); 44 | } 45 | -------------------------------------------------------------------------------- /src/client_handler/resource_handler.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013 CEF Python, see the Authors file. 2 | // All rights reserved. Licensed under BSD 3-clause license. 3 | // Project website: https://github.com/cztomczak/cefpython 4 | 5 | #pragma once 6 | 7 | #if defined(_WIN32) 8 | #include 9 | #endif 10 | 11 | #include "common/cefpython_public_api.h" 12 | 13 | class ResourceHandler : public CefResourceHandler 14 | { 15 | public: 16 | int resourceHandlerId_; 17 | public: 18 | ResourceHandler(int resourceHandlerId) 19 | : resourceHandlerId_(resourceHandlerId) { 20 | } 21 | 22 | virtual bool ProcessRequest(CefRefPtr request, 23 | CefRefPtr callback) override; 24 | 25 | virtual void GetResponseHeaders(CefRefPtr response, 26 | int64& response_length, 27 | CefString& redirectUrl) override; 28 | 29 | virtual bool ReadResponse(void* data_out, 30 | int bytes_to_read, 31 | int& bytes_read, 32 | CefRefPtr callback) override; 33 | 34 | // virtual bool CanGetCookie(const CefCookie& cookie) override; 35 | 36 | // virtual bool CanSetCookie(const CefCookie& cookie) override; 37 | 38 | virtual void Cancel() override; 39 | 40 | private: 41 | IMPLEMENT_REFCOUNTING(ResourceHandler); 42 | }; 43 | -------------------------------------------------------------------------------- /src/client_handler/string_visitor.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013 CEF Python, see the Authors file. 2 | // All rights reserved. Licensed under BSD 3-clause license. 3 | // Project website: https://github.com/cztomczak/cefpython 4 | 5 | #include "string_visitor.h" 6 | #include 7 | 8 | void StringVisitor::Visit( 9 | const CefString& string 10 | ) { 11 | StringVisitor_Visit(stringVisitorId_, string); 12 | } 13 | -------------------------------------------------------------------------------- /src/client_handler/string_visitor.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013 CEF Python, see the Authors file. 2 | // All rights reserved. Licensed under BSD 3-clause license. 3 | // Project website: https://github.com/cztomczak/cefpython 4 | 5 | #pragma once 6 | 7 | #if defined(_WIN32) 8 | #include 9 | #endif 10 | 11 | #include "common/cefpython_public_api.h" 12 | 13 | class StringVisitor : public CefStringVisitor 14 | { 15 | public: 16 | int stringVisitorId_; 17 | public: 18 | StringVisitor(int stringVisitorId) 19 | : stringVisitorId_(stringVisitorId) { 20 | } 21 | 22 | virtual void Visit( 23 | const CefString& string 24 | ) override; 25 | 26 | protected: 27 | IMPLEMENT_REFCOUNTING(StringVisitor); 28 | }; 29 | -------------------------------------------------------------------------------- /src/client_handler/task.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 CEF Python, see the Authors file. 2 | // All rights reserved. Licensed under BSD 3-clause license. 3 | // Project website: https://github.com/cztomczak/cefpython 4 | 5 | #include "task.h" 6 | #include "include/wrapper/cef_closure_task.h" 7 | #include "include/base/cef_bind.h" 8 | #include "include/base/cef_callback.h" 9 | 10 | void PostTaskWrapper(int threadId, int taskId) { 11 | CefPostTask( 12 | static_cast(threadId), 13 | CefCreateClosureTask(base::BindOnce( 14 | &PyTaskRunnable, 15 | taskId 16 | )) 17 | ); 18 | } 19 | 20 | void PostDelayedTaskWrapper(int threadId, int64 delay_ms, int taskId) { 21 | CefPostDelayedTask( 22 | static_cast(threadId), 23 | CefCreateClosureTask(base::BindOnce( 24 | &PyTaskRunnable, 25 | taskId 26 | )), 27 | delay_ms 28 | ); 29 | } 30 | 31 | CefRefPtr CreateTask_SetCookie( 32 | CefCookieManager* obj, 33 | const CefString& url, 34 | const CefCookie& cookie, 35 | CefRefPtr callback) 36 | { 37 | return CefCreateClosureTask(base::BindOnce( 38 | base::IgnoreResult(&CefCookieManager::SetCookie), obj, 39 | url, 40 | cookie, 41 | callback 42 | )); 43 | } 44 | 45 | CefRefPtr CreateTask_DeleteCookies( 46 | CefCookieManager* obj, 47 | const CefString& url, 48 | const CefString& cookie_name, 49 | CefRefPtr callback) 50 | { 51 | return CefCreateClosureTask(base::BindOnce( 52 | base::IgnoreResult(&CefCookieManager::DeleteCookies), obj, 53 | url, 54 | cookie_name, 55 | callback 56 | )); 57 | } 58 | -------------------------------------------------------------------------------- /src/client_handler/task.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 CEF Python, see the Authors file. 2 | // All rights reserved. Licensed under BSD 3-clause license. 3 | // Project website: https://github.com/cztomczak/cefpython 4 | 5 | #pragma once 6 | 7 | #include "common/cefpython_public_api.h" 8 | #include "include/cef_cookie.h" 9 | #include "include/cef_task.h" 10 | 11 | void PostTaskWrapper(int threadId, int taskId); 12 | void PostDelayedTaskWrapper(int threadId, int64 delay_ms, int taskId); 13 | 14 | CefRefPtr CreateTask_SetCookie( 15 | CefCookieManager* obj, 16 | const CefString& url, 17 | const CefCookie& cookie, 18 | CefRefPtr callback); 19 | 20 | CefRefPtr CreateTask_DeleteCookies( 21 | CefCookieManager* obj, 22 | const CefString& url, 23 | const CefString& cookie_name, 24 | CefRefPtr callback); 25 | -------------------------------------------------------------------------------- /src/client_handler/util_mac.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | 5 | #ifndef CEFPYTHON_UTIL_MAC_H_ 6 | #define CEFPYTHON_UTIL_MAC_H_ 7 | 8 | #include 9 | #include "include/cef_base.h" 10 | #include "include/cef_app.h" 11 | #include "include/cef_browser.h" 12 | 13 | void MacInitialize(); 14 | void MacShutdown(); 15 | void MacSetWindowTitle(CefRefPtr browser, char* title); 16 | 17 | #endif // CEFPYTHON_UTIL_MAC_H_ 18 | -------------------------------------------------------------------------------- /src/client_handler/web_request_client.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013 CEF Python, see the Authors file. 2 | // All rights reserved. Licensed under BSD 3-clause license. 3 | // Project website: https://github.com/cztomczak/cefpython 4 | 5 | #include "web_request_client.h" 6 | 7 | void WebRequestClient::OnRequestComplete(CefRefPtr request) { 8 | WebRequestClient_OnRequestComplete(webRequestId_, request); 9 | } 10 | 11 | void WebRequestClient::OnUploadProgress(CefRefPtr request, 12 | int64 current, 13 | int64 total) { 14 | WebRequestClient_OnUploadProgress(webRequestId_, request, current, total); 15 | } 16 | 17 | void WebRequestClient::OnDownloadProgress(CefRefPtr request, 18 | int64 current, 19 | int64 total) { 20 | WebRequestClient_OnDownloadProgress(webRequestId_, request, current, 21 | total); 22 | } 23 | 24 | void WebRequestClient::OnDownloadData(CefRefPtr request, 25 | const void* data, 26 | size_t data_length) { 27 | WebRequestClient_OnDownloadData(webRequestId_, request, data, data_length); 28 | } 29 | 30 | bool WebRequestClient::GetAuthCredentials(bool isProxy, 31 | const CefString& host, 32 | int port, 33 | const CefString& realm, 34 | const CefString& scheme, 35 | CefRefPtr callback) { 36 | // Not yet implemented. 37 | return false; 38 | } 39 | -------------------------------------------------------------------------------- /src/client_handler/web_request_client.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013 CEF Python, see the Authors file. 2 | // All rights reserved. Licensed under BSD 3-clause license. 3 | // Project website: https://github.com/cztomczak/cefpython 4 | 5 | #pragma once 6 | 7 | #if defined(_WIN32) 8 | #include 9 | #endif 10 | 11 | #include "common/cefpython_public_api.h" 12 | 13 | class WebRequestClient : public CefURLRequestClient 14 | { 15 | public: 16 | int webRequestId_; 17 | public: 18 | WebRequestClient(int webRequestId) : 19 | webRequestId_(webRequestId) { 20 | } 21 | virtual ~WebRequestClient(){} 22 | 23 | virtual void OnRequestComplete(CefRefPtr request) override; 24 | 25 | virtual void OnUploadProgress(CefRefPtr request, 26 | int64 current, 27 | int64 total) override; 28 | 29 | virtual void OnDownloadProgress(CefRefPtr request, 30 | int64 current, 31 | int64 total) override; 32 | 33 | virtual void OnDownloadData(CefRefPtr request, 34 | const void* data, 35 | size_t data_length) override; 36 | 37 | virtual bool GetAuthCredentials(bool isProxy, 38 | const CefString& host, 39 | int port, 40 | const CefString& realm, 41 | const CefString& scheme, 42 | CefRefPtr callback) override; 43 | 44 | protected: 45 | IMPLEMENT_REFCOUNTING(WebRequestClient); 46 | }; 47 | -------------------------------------------------------------------------------- /src/client_handler/x11.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 CEF Python, see the Authors file. 2 | // All rights reserved. Licensed under BSD 3-clause license. 3 | // Project website: https://github.com/cztomczak/cefpython 4 | 5 | #pragma once 6 | 7 | #include 8 | #include 9 | #include 10 | 11 | #include "include/cef_browser.h" 12 | 13 | void InstallX11ErrorHandlers(); 14 | void SetX11WindowBounds(CefRefPtr browser, 15 | int x, int y, int width, int height); 16 | void SetX11WindowTitle(CefRefPtr browser, char* title); 17 | 18 | GtkWindow* CefBrowser_GetGtkWindow(CefRefPtr browser); 19 | XImage* CefBrowser_GetImage(CefRefPtr browser); 20 | -------------------------------------------------------------------------------- /src/common/cefpython_public_api.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012 CEF Python, see the Authors file. 2 | // All rights reserved. Licensed under BSD 3-clause license. 3 | // Project website: https://github.com/cztomczak/cefpython 4 | 5 | /* This is a wrapper around including cefpython_fixed.h that is generated 6 | by Cython. Functions marked with the 'public' keyword are exposed 7 | to C through that header file. */ 8 | 9 | #ifndef CEFPYTHON_PUBLIC_API_H 10 | #define CEFPYTHON_PUBLIC_API_H 11 | 12 | #if defined(OS_WIN) 13 | #pragma warning(disable:4190) // cefpython API extern C-linkage warnings 14 | #endif 15 | 16 | // Python.h must be included first otherwise error on Linux: 17 | // >> error: "_POSIX_C_SOURCE" redefined 18 | #include "Python.h" 19 | 20 | 21 | // Includes required by "cefpython_fixed.h". 22 | #include "include/cef_client.h" 23 | #include "include/cef_urlrequest.h" 24 | #include "include/cef_command_line.h" 25 | #include "util.h" 26 | 27 | // cefpython_fixed.h declares public functions using DL_IMPORT and these 28 | // macros are not available in Python 3. 29 | #ifndef DL_IMPORT 30 | #define DL_IMPORT(RTYPE) RTYPE 31 | #endif 32 | #ifndef DL_EXPORT 33 | #define DL_EXPORT(RTYPE) RTYPE 34 | #endif 35 | 36 | #if PY_MAJOR_VERSION == 2 37 | #if PY_MINOR_VERSION == 7 38 | #include "../../build/build_cefpython/cefpython_py27_fixed.h" 39 | #endif // PY_MINOR_VERSION 40 | #elif PY_MAJOR_VERSION == 3 41 | #if PY_MINOR_VERSION == 4 42 | #include "../../build/build_cefpython/cefpython_py34_fixed.h" 43 | #elif PY_MINOR_VERSION == 5 44 | #include "../../build/build_cefpython/cefpython_py35_fixed.h" 45 | #elif PY_MINOR_VERSION == 6 46 | #include "../../build/build_cefpython/cefpython_py36_fixed.h" 47 | #elif PY_MINOR_VERSION == 7 48 | #include "../../build/build_cefpython/cefpython_py37_fixed.h" 49 | #elif PY_MINOR_VERSION == 8 50 | #include "../../build/build_cefpython/cefpython_py38_fixed.h" 51 | #elif PY_MINOR_VERSION == 9 52 | #include "../../build/build_cefpython/cefpython_py39_fixed.h" 53 | #elif PY_MINOR_VERSION == 10 54 | #include "../../build/build_cefpython/cefpython_py310_fixed.h" 55 | #elif PY_MINOR_VERSION == 11 56 | #include "../../build/build_cefpython/cefpython_py311_fixed.h" 57 | #else 58 | #error "Unsupported Python version, please check cefpython_public_api.h" 59 | #endif // PY_MINOR_VERSION 60 | #endif // PY_MAJOR_VERSION 61 | 62 | #endif // CEFPYTHON_PUBLIC_API_H 63 | -------------------------------------------------------------------------------- /src/common/util.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | 5 | #ifndef CEF_TESTS_CEFCLIENT_UTIL_H_ 6 | #define CEF_TESTS_CEFCLIENT_UTIL_H_ 7 | #pragma once 8 | 9 | #include "include/cef_task.h" 10 | 11 | #if defined(OS_WIN) 12 | 13 | #include // NOLINT(build/include_order) 14 | 15 | #ifndef NDEBUG 16 | #define ASSERT(condition) if (!(condition)) { DebugBreak(); } 17 | #else 18 | #define ASSERT(condition) ((void)0) 19 | #endif 20 | 21 | #else // !OS_WIN 22 | 23 | #include // NOLINT(build/include_order) 24 | 25 | #ifndef NDEBUG 26 | #define ASSERT(condition) if (!(condition)) { assert(false); } 27 | #else 28 | #define ASSERT(condition) ((void)0) 29 | #endif 30 | 31 | #endif // !OS_WIN 32 | 33 | #define REQUIRE_UI_THREAD() ASSERT(CefCurrentlyOn(TID_UI)); 34 | #define REQUIRE_IO_THREAD() ASSERT(CefCurrentlyOn(TID_IO)); 35 | #define REQUIRE_FILE_THREAD() ASSERT(CefCurrentlyOn(TID_FILE)); 36 | 37 | #endif // CEF_TESTS_CEFCLIENT_UTIL_H_ 38 | -------------------------------------------------------------------------------- /src/compile_time_constants.pxi: -------------------------------------------------------------------------------- 1 | # This file was generated by setup.py 2 | DEF UNAME_SYSNAME = "Windows" 3 | DEF PY_MAJOR_VERSION = 3 4 | cdef extern from "limits.h": 5 | cdef int INT_MIN 6 | cdef int INT_MAX 7 | -------------------------------------------------------------------------------- /src/cpp_utils/.gitignore: -------------------------------------------------------------------------------- 1 | *.o 2 | *.a -------------------------------------------------------------------------------- /src/cpp_utils/Makefile: -------------------------------------------------------------------------------- 1 | CCFLAGS = -fPIC $(CEF_CCFLAGS) 2 | 3 | SRC = PaintBuffer.cpp 4 | OBJ = $(SRC:.cpp=.o) 5 | OUT = libcpp_utils.a 6 | 7 | INC = -I./../ -I/usr/include/gtk-2.0 \ 8 | -I/usr/include/glib-2.0 -I/usr/lib/i386-linux-gnu/gtk-2.0/include \ 9 | -I/usr/lib/i386-linux-gnu/glib-2.0/include -I/usr/include/cairo \ 10 | -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/gdk-pixbuf-2.0 \ 11 | -I/usr/include/atk-1.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include \ 12 | -I/usr/lib/x86_64-linux-gnu/gtk-2.0/include \ 13 | -I/usr/lib64/glib-2.0/include -I/usr/lib64/gtk-2.0/include \ 14 | -I/usr/lib/glib-2.0/include -I/usr/lib/gtk-2.0/include 15 | 16 | .cpp.o: 17 | $(CXX) $(INC) $(CCFLAGS) -c $< -o $@ 18 | 19 | $(OUT): $(OBJ) 20 | ar rcs $(OUT) $(OBJ) 21 | -------------------------------------------------------------------------------- /src/cpp_utils/PaintBuffer.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013 CEF Python, see the Authors file. 2 | // All rights reserved. Licensed under BSD 3-clause license. 3 | // Project website: https://github.com/cztomczak/cefpython 4 | 5 | #include "PaintBuffer.h" 6 | -------------------------------------------------------------------------------- /src/cpp_utils/PaintBuffer.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013 CEF Python, see the Authors file. 2 | // All rights reserved. Licensed under BSD 3-clause license. 3 | // Project website: https://github.com/cztomczak/cefpython 4 | 5 | #pragma once 6 | 7 | // OS_WIN is not defined on Windows when CEF is not included. 8 | // _WIN32 is defined on both 32bit and 64bit. 9 | #if defined(_WIN32) 10 | #include "windows.h" 11 | #include 12 | #else 13 | #include 14 | #endif 15 | 16 | #include 17 | 18 | void FlipBufferUpsideDown(void* _dest, const void* _src, int width, int height \ 19 | ) { 20 | // In CEF the buffer passed to Browser.GetImage() & RenderHandler.OnPaint() 21 | // has upper-left origin, but some libraries like Panda3D require 22 | // bottom-left origin. 23 | int32_t* dest = (int32_t*)_dest; 24 | int32_t* src = (int32_t*)_src; 25 | unsigned int tb; 26 | int length = width*height; 27 | for (int y = 0; y < height; y++) { 28 | tb = length - ((y+1)*width); 29 | memcpy(&dest[tb], &src[y*width], width*4); 30 | } 31 | } 32 | 33 | void SwapBufferFromBgraToRgba(void* _dest, const void* _src, int width, \ 34 | int height) { 35 | int32_t* dest = (int32_t*)_dest; 36 | int32_t* src = (int32_t*)_src; 37 | int32_t rgba; 38 | int32_t bgra; 39 | int length = width*height; 40 | for (int i = 0; i < length; i++) { 41 | bgra = src[i]; 42 | // BGRA in hex = 0xAARRGGBB. 43 | rgba = (bgra & 0x00ff0000) >> 16 // Red >> Blue. 44 | | (bgra & 0xff00ff00) // Green Alpha. 45 | | (bgra & 0x000000ff) << 16; // Blue >> Red. 46 | dest[i] = rgba; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/drag_data.pyx: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2016 CEF Python, see the Authors file. 2 | # All rights reserved. Licensed under BSD 3-clause license. 3 | # Project website: https://github.com/cztomczak/cefpython 4 | 5 | include "cefpython.pyx" 6 | 7 | cdef DragData_Init(CefRefPtr[CefDragData] cef_drag_data): 8 | cdef DragData drag_data = DragData() 9 | drag_data.cef_drag_data = cef_drag_data 10 | return drag_data 11 | 12 | cdef class DragData: 13 | cdef CefRefPtr[CefDragData] cef_drag_data 14 | 15 | def __init__(self): 16 | self.cef_drag_data = CefDragData_Create() 17 | self.cef_drag_data.get().SetFragmentText(PyToCefStringValue("none")) 18 | self.cef_drag_data.get().SetFragmentHtml(PyToCefStringValue("none")) 19 | self.cef_drag_data.get().SetFragmentBaseURL(PyToCefStringValue("")) 20 | 21 | cpdef py_bool IsLink(self): 22 | return self.cef_drag_data.get().IsLink() 23 | 24 | cpdef py_bool IsFragment(self): 25 | return self.cef_drag_data.get().IsFragment() 26 | 27 | cpdef py_string GetLinkUrl(self): 28 | return CefToPyString(self.cef_drag_data.get().GetLinkURL()) 29 | 30 | cpdef py_string GetLinkTitle(self): 31 | return CefToPyString(self.cef_drag_data.get().GetLinkTitle()) 32 | 33 | cpdef py_string GetFragmentText(self): 34 | return CefToPyString(self.cef_drag_data.get().GetFragmentText()) 35 | 36 | cpdef py_string GetFragmentHtml(self): 37 | return CefToPyString(self.cef_drag_data.get().GetFragmentHtml()) 38 | 39 | cpdef PyImage GetImage(self): 40 | cdef CefRefPtr[CefImage] cef_image =\ 41 | self.cef_drag_data.get().GetImage() 42 | if not cef_image.get(): 43 | raise Exception("Image is not available") 44 | return PyImage_Init(cef_image) 45 | 46 | cpdef tuple GetImageHotspot(self): 47 | cdef CefPoint point = self.cef_drag_data.get().GetImageHotspot() 48 | return point.x, point.y 49 | 50 | cpdef py_bool HasImage(self): 51 | return self.cef_drag_data.get().HasImage() 52 | -------------------------------------------------------------------------------- /src/extern/cef/cef_app.pxd: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2012 CEF Python, see the Authors file. 2 | # All rights reserved. Licensed under BSD 3-clause license. 3 | # Project website: https://github.com/cztomczak/cefpython 4 | 5 | # Circular imports are allowed in form "cimport ...", 6 | # but won't work if you do "from ... cimport *". 7 | 8 | include "compile_time_constants.pxi" 9 | 10 | from cef_types cimport CefSettings 11 | from cef_ptr cimport CefRefPtr 12 | from libcpp cimport bool as cpp_bool 13 | 14 | IF UNAME_SYSNAME == "Windows": 15 | from cef_win cimport CefMainArgs 16 | ELIF UNAME_SYSNAME == "Linux": 17 | from cef_linux cimport CefMainArgs 18 | ELIF UNAME_SYSNAME == "Darwin": 19 | from cef_mac cimport CefMainArgs 20 | 21 | cdef extern from "include/cef_app.h": 22 | 23 | cdef cppclass CefApp: 24 | pass 25 | 26 | cdef void CefEnableHighDPISupport() nogil 27 | 28 | cdef int CefExecuteProcess(CefMainArgs& args, 29 | CefRefPtr[CefApp] application, 30 | void* windows_sandbox_info 31 | ) nogil 32 | 33 | cdef cpp_bool CefInitialize(CefMainArgs&, 34 | CefSettings&, CefRefPtr[CefApp], 35 | void* windows_sandbox_info 36 | ) nogil 37 | 38 | cdef void CefRunMessageLoop() nogil 39 | cdef void CefDoMessageLoopWork() nogil 40 | cdef void CefQuitMessageLoop() nogil 41 | cdef void CefShutdown() nogil 42 | cdef void CefSetOSModalLoop(cpp_bool osModalLoop) nogil 43 | -------------------------------------------------------------------------------- /src/extern/cef/cef_browser_static.pxd: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2012 CEF Python, see the Authors file. 2 | # All rights reserved. Licensed under BSD 3-clause license. 3 | # Project website: https://github.com/cztomczak/cefpython 4 | 5 | include "compile_time_constants.pxi" 6 | 7 | from cef_ptr cimport CefRefPtr 8 | IF UNAME_SYSNAME == "Windows": 9 | from cef_win cimport CefWindowInfo 10 | ELIF UNAME_SYSNAME == "Linux": 11 | from cef_linux cimport CefWindowInfo 12 | ELIF UNAME_SYSNAME == "Darwin": 13 | from cef_mac cimport CefWindowInfo 14 | # noinspection PyUnresolvedReferences 15 | from cef_client cimport CefClient 16 | from cef_types cimport CefBrowserSettings 17 | # noinspection PyUnresolvedReferences 18 | from cef_request_context cimport CefRequestContext 19 | # noinspection PyUnresolvedReferences 20 | from cef_browser cimport CefBrowser 21 | from cef_string cimport CefString 22 | from cef_values cimport CefDictionaryValue 23 | 24 | # Specifying namespace allows to import a static method. 25 | cdef extern from "include/cef_browser.h" namespace "CefBrowserHost": 26 | 27 | cdef CefRefPtr[CefBrowser] CreateBrowserSync( 28 | CefWindowInfo&, 29 | CefRefPtr[CefClient], 30 | CefString&, 31 | CefBrowserSettings&, 32 | CefRefPtr[CefDictionaryValue], 33 | CefRefPtr[CefRequestContext]) nogil 34 | -------------------------------------------------------------------------------- /src/extern/cef/cef_callback.pxd: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2013 CEF Python, see the Authors file. 2 | # All rights reserved. Licensed under BSD 3-clause license. 3 | # Project website: https://github.com/cztomczak/cefpython 4 | 5 | cdef extern from "include/cef_callback.h": 6 | 7 | cdef cppclass CefCallback: 8 | void Continue() 9 | void Cancel() 10 | 11 | cdef cppclass CefCompletionCallback: 12 | void OnComplete() 13 | -------------------------------------------------------------------------------- /src/extern/cef/cef_client.pxd: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2012 CEF Python, see the Authors file. 2 | # All rights reserved. Licensed under BSD 3-clause license. 3 | # Project website: https://github.com/cztomczak/cefpython 4 | 5 | cdef extern from "include/cef_client.h": 6 | 7 | cdef cppclass CefClient: 8 | pass 9 | -------------------------------------------------------------------------------- /src/extern/cef/cef_command_line.pxd: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2014 CEF Python, see the Authors file. 2 | # All rights reserved. Licensed under BSD 3-clause license. 3 | # Project website: https://github.com/cztomczak/cefpython 4 | 5 | # Circular imports are allowed in form "cimport ...", 6 | # but won't work if you do "from ... cimport *". 7 | 8 | include "compile_time_constants.pxi" 9 | 10 | from cef_string cimport CefString 11 | from libcpp cimport bool as cpp_bool 12 | 13 | cdef extern from "include/cef_command_line.h": 14 | cdef cppclass CefCommandLine: 15 | void AppendSwitch(CefString& name) 16 | void AppendSwitchWithValue(CefString& name, CefString& value) 17 | CefString GetCommandLineString() 18 | cpp_bool HasSwitch(const CefString& name) 19 | CefString GetSwitchValue(const CefString& name) 20 | -------------------------------------------------------------------------------- /src/extern/cef/cef_cookie_manager_namespace.pxd: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2013 CEF Python, see the Authors file. 2 | # All rights reserved. Licensed under BSD 3-clause license. 3 | # Project website: https://github.com/cztomczak/cefpython 4 | 5 | include "compile_time_constants.pxi" 6 | 7 | from libcpp cimport bool as cpp_bool 8 | from cef_string cimport CefString 9 | from cef_cookie cimport CefCookie 10 | # noinspection PyUnresolvedReferences 11 | from cef_cookie cimport CefSetCookieCallback, CefDeleteCookiesCallback 12 | from cef_ptr cimport CefRefPtr 13 | # noinspection PyUnresolvedReferences 14 | from cef_callback cimport CefCompletionCallback 15 | 16 | # We need to pass C++ class methods by reference to a function, 17 | # it is not possible with such syntax: 18 | # | &CefCookieManager.SetCookie 19 | # We had to create this addional pxd file so we can pass it like this: 20 | # | &cef_cookie_manager_namespace.SetCookie 21 | # In cookie.pyx > PyCookieManager.SetCookie(). 22 | # See this topic: 23 | # https://groups.google.com/d/topic/cython-users/G-vEdIkmNNY/discussion 24 | 25 | cdef extern from "include/cef_cookie.h" namespace "CefCookieManager": 26 | 27 | cpp_bool SetCookie(const CefString& url, const CefCookie& cookie, 28 | CefRefPtr[CefSetCookieCallback] callback) 29 | 30 | cpp_bool DeleteCookies(const CefString& url, 31 | const CefString& cookie_name, 32 | CefRefPtr[CefDeleteCookiesCallback] callback) 33 | 34 | cpp_bool FlushStore(CefRefPtr[CefCompletionCallback] callback) 35 | -------------------------------------------------------------------------------- /src/extern/cef/cef_download_handler.pxd: -------------------------------------------------------------------------------- 1 | include "compile_time_constants.pxi" 2 | 3 | from libcpp cimport bool as cpp_bool 4 | from cef_string cimport CefString 5 | 6 | cdef extern from "include/cef_download_handler.h": 7 | cdef cppclass CefBeforeDownloadCallback: 8 | void Continue(const CefString& download_path, cpp_bool show_dialog) 9 | 10 | cdef cppclass CefDownloadItemCallback: 11 | void Cancel() 12 | void Pause() 13 | void Resume() -------------------------------------------------------------------------------- /src/extern/cef/cef_download_item.pxd: -------------------------------------------------------------------------------- 1 | include "compile_time_constants.pxi" 2 | 3 | from libcpp cimport bool as cpp_bool 4 | from cef_string cimport CefString 5 | from cef_time cimport cef_time_t, cef_basetime_t 6 | from cef_types cimport ( 7 | int32, uint32, int64, uint64 8 | ) 9 | 10 | cdef extern from "include/cef_download_item.h": 11 | cdef cppclass CefDownloadItem: 12 | cpp_bool IsValid() 13 | 14 | cpp_bool IsInProgress() 15 | 16 | cpp_bool IsComplete() 17 | 18 | cpp_bool IsCanceled() 19 | 20 | int64 GetCurrentSpeed() 21 | 22 | int GetPercentComplete() 23 | 24 | int64 GetTotalBytes() 25 | 26 | int64 GetReceivedBytes() 27 | 28 | cef_basetime_t GetStartTime() 29 | 30 | cef_basetime_t GetEndTime() 31 | 32 | CefString GetFullPath() 33 | 34 | uint32 GetId() 35 | 36 | CefString GetURL() 37 | 38 | CefString GetOriginalUrl() 39 | 40 | CefString GetSuggestedFileName() 41 | 42 | CefString GetContentDisposition() 43 | 44 | CefString GetMimeType() -------------------------------------------------------------------------------- /src/extern/cef/cef_drag_data.pxd: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2016 CEF Python, see the Authors file. 2 | # All rights reserved. Licensed under BSD 3-clause license. 3 | # Project website: https://github.com/cztomczak/cefpython 4 | 5 | from libcpp cimport bool as cpp_bool 6 | from cef_string cimport CefString 7 | from cef_ptr cimport CefRefPtr 8 | from cef_image cimport CefImage 9 | from cef_types cimport CefPoint 10 | 11 | cdef extern from "include/cef_drag_data.h": 12 | cdef cppclass CefDragData: 13 | cpp_bool IsLink() 14 | cpp_bool IsFragment() 15 | CefString GetLinkURL() 16 | CefString GetLinkTitle() 17 | CefString GetFragmentText() 18 | CefString GetFragmentHtml() 19 | void SetFragmentText(const CefString& text) 20 | void SetFragmentHtml(const CefString& html) 21 | void SetFragmentBaseURL(const CefString& base_url) 22 | cpp_bool HasImage() 23 | CefRefPtr[CefImage] GetImage() 24 | CefPoint GetImageHotspot() 25 | 26 | 27 | cdef CefRefPtr[CefDragData] CefDragData_Create "CefDragData::Create"() 28 | -------------------------------------------------------------------------------- /src/extern/cef/cef_file_util.pxd: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2018 CEF Python, see the Authors file. 2 | # All rights reserved. Licensed under BSD 3-clause license. 3 | # Project website: https://github.com/cztomczak/cefpython 4 | 5 | from cef_string cimport CefString 6 | 7 | cdef extern from "include/cef_file_util.h": 8 | void CefLoadCRLSetsFile(const CefString& path) 9 | -------------------------------------------------------------------------------- /src/extern/cef/cef_frame.pxd: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2012 CEF Python, see the Authors file. 2 | # All rights reserved. Licensed under BSD 3-clause license. 3 | # Project website: https://github.com/cztomczak/cefpython 4 | 5 | include "compile_time_constants.pxi" 6 | 7 | from cef_types cimport int64 8 | from cef_string cimport CefString 9 | from libcpp cimport bool as cpp_bool 10 | from cef_ptr cimport CefRefPtr 11 | from cef_browser cimport CefBrowser 12 | from cef_string_visitor cimport CefStringVisitor 13 | from cef_process_message cimport CefProcessMessage, CefProcessId 14 | 15 | cdef extern from "include/cef_frame.h": 16 | 17 | cdef cppclass CefFrame: 18 | cpp_bool IsValid() 19 | void ExecuteJavaScript(CefString& jsCode, CefString& scriptUrl, int startLine) 20 | CefString GetURL() 21 | int64 GetIdentifier() 22 | cpp_bool IsMain() 23 | void LoadURL(CefString& url) 24 | void Undo() 25 | void Redo() 26 | void Cut() 27 | void Copy() 28 | void Paste() 29 | void Delete() 30 | void SelectAll() 31 | void ViewSource() 32 | void GetSource(CefRefPtr[CefStringVisitor] visitor) 33 | void GetText(CefRefPtr[CefStringVisitor] visitor) 34 | void LoadString(CefString& string_val, CefString& url) 35 | cpp_bool IsFocused() 36 | CefString GetName() 37 | CefRefPtr[CefFrame] GetParent() 38 | CefRefPtr[CefBrowser] GetBrowser() 39 | cpp_bool SendProcessMessage(CefProcessId target_process, 40 | CefRefPtr[CefProcessMessage] message) 41 | -------------------------------------------------------------------------------- /src/extern/cef/cef_image.pxd: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2016 CEF Python, see the Authors file. 2 | # All rights reserved. Licensed under BSD 3-clause license. 3 | # Project website: https://github.com/cztomczak/cefpython 4 | 5 | from cef_ptr cimport CefRefPtr 6 | from libcpp cimport bool as cpp_bool 7 | from cef_values cimport CefBinaryValue 8 | from cef_types cimport cef_color_type_t, cef_alpha_type_t 9 | 10 | cdef extern from "include/cef_image.h": 11 | 12 | cdef cppclass CefImage: 13 | size_t GetWidth() 14 | size_t GetHeight() 15 | CefRefPtr[CefBinaryValue] GetAsBitmap(float scale_factor, 16 | cef_color_type_t color_type, 17 | cef_alpha_type_t alpha_type, 18 | int& pixel_width, 19 | int& pixel_height) 20 | CefRefPtr[CefBinaryValue] GetAsPNG(float scale_factor, 21 | cpp_bool with_transparency, 22 | int& pixel_width, 23 | int& pixel_height) 24 | -------------------------------------------------------------------------------- /src/extern/cef/cef_jsdialog_handler.pxd: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2016 CEF Python, see the Authors file. 2 | # All rights reserved. Licensed under BSD 3-clause license. 3 | # Project website: https://github.com/cztomczak/cefpython 4 | 5 | from cef_string cimport CefString 6 | from libcpp cimport bool as cpp_bool 7 | 8 | cdef extern from "include/cef_jsdialog_handler.h": 9 | cdef cppclass CefJSDialogCallback: 10 | void Continue(cpp_bool success, 11 | const CefString& user_input) 12 | 13 | -------------------------------------------------------------------------------- /src/extern/cef/cef_linux.pxd: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2012 CEF Python, see the Authors file. 2 | # All rights reserved. Licensed under BSD 3-clause license. 3 | # Project website: https://github.com/cztomczak/cefpython 4 | 5 | include "compile_time_constants.pxi" 6 | 7 | from libcpp cimport bool as cpp_bool 8 | from cef_types cimport CefRect 9 | 10 | cdef extern from "include/internal/cef_linux.h": 11 | 12 | ctypedef unsigned long CefWindowHandle 13 | ctypedef unsigned long CefCursorHandle 14 | 15 | cdef cppclass CefWindowInfo: 16 | void SetAsChild(CefWindowHandle parent, 17 | const CefRect& windowRect) 18 | void SetAsWindowless(CefWindowHandle parent) 19 | 20 | cdef cppclass CefMainArgs: 21 | CefMainArgs() 22 | CefMainArgs(int argc_arg, char** argv_arg) 23 | -------------------------------------------------------------------------------- /src/extern/cef/cef_mac.pxd: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2015 CEF Python, see the Authors file. 2 | # All rights reserved. Licensed under BSD 3-clause license. 3 | # Project website: https://github.com/cztomczak/cefpython 4 | 5 | include "compile_time_constants.pxi" 6 | 7 | from libcpp cimport bool as cpp_bool 8 | 9 | cdef extern from "include/internal/cef_mac.h": 10 | 11 | ctypedef void* CefWindowHandle 12 | ctypedef void* CefCursorHandle 13 | 14 | cdef cppclass CefWindowInfo: 15 | void SetAsChild(CefWindowHandle parent, 16 | int x, int y, int width, int height) 17 | void SetAsWindowless(CefWindowHandle parent) 18 | 19 | cdef cppclass CefMainArgs: 20 | CefMainArgs() 21 | CefMainArgs(int argc_arg, char** argv_arg) 22 | -------------------------------------------------------------------------------- /src/extern/cef/cef_path_util.pxd: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2016 CEF Python, see the Authors file. 2 | # All rights reserved. Licensed under BSD 3-clause license. 3 | # Project website: https://github.com/cztomczak/cefpython 4 | 5 | from cef_types cimport PathKey 6 | from cef_string cimport CefString 7 | from libcpp cimport bool as cpp_bool 8 | 9 | cdef extern from "include/cef_path_util.h" nogil: 10 | cpp_bool CefGetPath(PathKey key, CefString& path) 11 | cpp_bool CefOverridePath(PathKey key, const CefString& path) 12 | -------------------------------------------------------------------------------- /src/extern/cef/cef_platform.pxd: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2012 CEF Python, see the Authors file. 2 | # All rights reserved. Licensed under BSD 3-clause license. 3 | # Project website: https://github.com/cztomczak/cefpython 4 | 5 | include "compile_time_constants.pxi" 6 | 7 | IF UNAME_SYSNAME == "Windows": 8 | # noinspection PyUnresolvedReferences 9 | from cef_win cimport * 10 | ELIF UNAME_SYSNAME == "Darwin": 11 | from cef_mac cimport * 12 | ELIF UNAME_SYSNAME == "Linux": 13 | from cef_linux cimport * 14 | -------------------------------------------------------------------------------- /src/extern/cef/cef_process_message.pxd: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2013 CEF Python, see the Authors file. 2 | # All rights reserved. Licensed under BSD 3-clause license. 3 | # Project website: https://github.com/cztomczak/cefpython 4 | 5 | # noinspection PyUnresolvedReferences 6 | from cef_types cimport cef_process_id_t 7 | from cef_ptr cimport CefRefPtr 8 | from cef_string cimport CefString 9 | from libcpp cimport bool as cpp_bool 10 | from cef_values cimport CefListValue 11 | 12 | cdef extern from "include/cef_process_message.h": 13 | cdef CefRefPtr[CefProcessMessage] CefProcessMessage_Create \ 14 | "CefProcessMessage::Create"(const CefString& name) 15 | cdef cppclass CefProcessMessage: 16 | cpp_bool IsValid() 17 | cpp_bool IsReadOnly() 18 | CefRefPtr[CefProcessMessage] Copy() 19 | CefString GetName() 20 | CefRefPtr[CefListValue] GetArgumentList() 21 | # noinspection PyUnresolvedReferences 22 | ctypedef cef_process_id_t CefProcessId 23 | -------------------------------------------------------------------------------- /src/extern/cef/cef_ptr.pxd: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2012 CEF Python, see the Authors file. 2 | # All rights reserved. Licensed under BSD 3-clause license. 3 | # Project website: https://github.com/cztomczak/cefpython 4 | from libcpp cimport nullptr_t, nullptr 5 | from libcpp cimport bool as cpp_bool 6 | 7 | cdef extern from "include/internal/cef_ptr.h": 8 | cdef cppclass CefRefPtr[T]: 9 | CefRefPtr() 10 | # noinspection PyUnresolvedReferences 11 | CefRefPtr(T* p) 12 | # noinspection PyUnresolvedReferences 13 | CefRefPtr(const CefRefPtr[T]& r) 14 | # noinspection PyUnresolvedReferences 15 | T* get() 16 | # noinspection PyUnresolvedReferences 17 | void swap(CefRefPtr[T]& r) 18 | # noinspection PyUnresolvedReferences 19 | CefRefPtr[T]& Assign "operator="(nullptr_t) 20 | 21 | CefRefPtr[T]& Assign "operator="(T* p) 22 | 23 | 24 | 25 | # cdef class PyCefRefPtr[T]: 26 | # cdef CefRefPtr[T]* thisptr 27 | # def __init__(self, T* p): 28 | # self.thisptr = new CefRefPtr[T](p) 29 | # def __eq__(self, other): 30 | # return self.thisptr.operator==(*other.thisptr) -------------------------------------------------------------------------------- /src/extern/cef/cef_request_context.pxd: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2013 CEF Python, see the Authors file. 2 | # All rights reserved. Licensed under BSD 3-clause license. 3 | # Project website: https://github.com/cztomczak/cefpython 4 | 5 | from cef_ptr cimport CefRefPtr 6 | # noinspection PyUnresolvedReferences 7 | from cef_request_context_handler cimport CefRequestContextHandler 8 | from cef_callback cimport CefCompletionCallback 9 | from cef_cookie cimport CefCookieManager 10 | 11 | cdef extern from "include/cef_request_context.h": 12 | cdef cppclass CefRequestContext: 13 | @staticmethod 14 | CefRefPtr[CefRequestContext] GetGlobalContext() 15 | @staticmethod 16 | CefRefPtr[CefRequestContext] CreateContext( 17 | CefRefPtr[CefRequestContext] other, 18 | CefRefPtr[CefRequestContextHandler] handler) 19 | CefRefPtr[CefCookieManager] GetCookieManager( 20 | CefRefPtr[CefCompletionCallback] callback) 21 | -------------------------------------------------------------------------------- /src/extern/cef/cef_request_context_handler.pxd: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2013 CEF Python, see the Authors file. 2 | # All rights reserved. Licensed under BSD 3-clause license. 3 | # Project website: https://github.com/cztomczak/cefpython 4 | 5 | cdef extern from "include/cef_request_context_handler.h": 6 | cdef cppclass CefRequestContextHandler: 7 | pass 8 | -------------------------------------------------------------------------------- /src/extern/cef/cef_request_handler.pxd: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2012 CEF Python, see the Authors file. 2 | # All rights reserved. Licensed under BSD 3-clause license. 3 | # Project website: https://github.com/cztomczak/cefpython 4 | 5 | from cef_string cimport CefString 6 | from libcpp cimport bool as cpp_bool 7 | 8 | cdef extern from "include/cef_auth_callback.h": 9 | cdef cppclass CefAuthCallback: 10 | void Continue(const CefString& username, 11 | const CefString& password) 12 | void Cancel() 13 | 14 | cdef extern from "include/cef_request_handler.h": 15 | cdef cppclass CefCallback: 16 | void Continue(cpp_bool allow) 17 | void Cancel() 18 | -------------------------------------------------------------------------------- /src/extern/cef/cef_resource_handler.pxd: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2013 CEF Python, see the Authors file. 2 | # All rights reserved. Licensed under BSD 3-clause license. 3 | # Project website: https://github.com/cztomczak/cefpython 4 | 5 | cdef extern from "include/cef_resource_handler.h": 6 | cdef cppclass CefResourceHandler: 7 | pass 8 | -------------------------------------------------------------------------------- /src/extern/cef/cef_response.pxd: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2013 CEF Python, see the Authors file. 2 | # All rights reserved. Licensed under BSD 3-clause license. 3 | # Project website: https://github.com/cztomczak/cefpython 4 | 5 | from cef_string cimport CefString 6 | # noinspection PyUnresolvedReferences 7 | from multimap cimport multimap as cpp_multimap 8 | from libcpp cimport bool as cpp_bool 9 | from cef_ptr cimport CefRefPtr 10 | 11 | cdef extern from "include/cef_response.h": 12 | ctypedef cpp_multimap[CefString, CefString] CefResponseHeaderMap 13 | 14 | cdef CefRefPtr[CefResponse] CefResponse_Create "CefResponse::Create"() 15 | 16 | cdef cppclass CefResponse: 17 | cpp_bool IsReadOnly() 18 | int GetStatus() 19 | void SetStatus(int status) 20 | CefString GetStatusText() 21 | void SetStatusText(CefString& statusText) 22 | CefString GetMimeType() 23 | void SetMimeType(CefString& mimeType) 24 | CefString GetHeaderByName(CefString& name) 25 | void GetHeaderMap(CefResponseHeaderMap& headerMap) 26 | void SetHeaderMap(CefResponseHeaderMap& headerMap) 27 | -------------------------------------------------------------------------------- /src/extern/cef/cef_scoped_refptr.pxd: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2016 CEF Python, see the Authors file. 2 | # All rights reserved. Licensed under BSD 3-clause license. 3 | # Project website: https://github.com/cztomczak/cefpython 4 | from libcpp cimport nullptr_t, nullptr 5 | from libcpp cimport bool as cpp_bool 6 | 7 | cdef extern from "include/base/cef_scoped_refptr.h": 8 | cdef cppclass scoped_refptr[T]: 9 | scoped_refptr() 10 | # noinspection PyUnresolvedReferences 11 | scoped_refptr(T* p) 12 | # noinspection PyUnresolvedReferences 13 | void reset() 14 | # noinspection PyUnresolvedReferences 15 | void reset(T* p) 16 | # noinspection PyUnresolvedReferences 17 | T* get() 18 | # noinspection PyUnresolvedReferences 19 | scoped_refptr[T]& Assign "operator="(nullptr_t) 20 | 21 | scoped_refptr[T]& Assign "operator="(scoped_refptr[T] p) 22 | 23 | #cpp_bool Assign "operator=="(const scoped_refptr[U]& rhs) const 24 | 25 | #cpp_bool Assign "operator!="(const scoped_refptr[U]& rhs) const 26 | -------------------------------------------------------------------------------- /src/extern/cef/cef_string.pxd: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2012 CEF Python, see the Authors file. 2 | # All rights reserved. Licensed under BSD 3-clause license. 3 | # Project website: https://github.com/cztomczak/cefpython 4 | 5 | from libcpp cimport bool as cpp_bool 6 | from libc.stddef cimport wchar_t 7 | from libcpp.string cimport string as cpp_string 8 | from wstring cimport wstring as cpp_wstring 9 | 10 | cdef extern from "include/internal/cef_string.h": 11 | ctypedef struct cef_string_t: 12 | pass 13 | cdef cppclass CefString: 14 | CefString() 15 | CefString(cef_string_t*) 16 | void Attach(cef_string_t* str, cpp_bool owner) 17 | cpp_bool empty() 18 | cpp_bool FromASCII(char*) 19 | # noinspection PyUnresolvedReferences 20 | cpp_bool FromString(wchar_t*, size_t, cpp_bool) 21 | cpp_bool FromString(cpp_string& str) 22 | cpp_string ToString() 23 | cpp_wstring ToWString() 24 | const char* c_str() 25 | size_t length() 26 | -------------------------------------------------------------------------------- /src/extern/cef/cef_string_visitor.pxd: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2013 CEF Python, see the Authors file. 2 | # All rights reserved. Licensed under BSD 3-clause license. 3 | # Project website: https://github.com/cztomczak/cefpython 4 | 5 | cdef extern from "include/cef_string_visitor.h": 6 | cdef cppclass CefStringVisitor: 7 | pass 8 | -------------------------------------------------------------------------------- /src/extern/cef/cef_task.pxd: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2014 CEF Python, see the Authors file. 2 | # All rights reserved. Licensed under BSD 3-clause license. 3 | # Project website: https://github.com/cztomczak/cefpython 4 | 5 | from libcpp cimport bool as cpp_bool 6 | # noinspection PyUnresolvedReferences 7 | cimport cef_types 8 | from cef_types cimport int64 9 | from cef_ptr cimport CefRefPtr 10 | 11 | cdef extern from "include/cef_task.h": 12 | ctypedef cef_types.cef_thread_id_t CefThreadId 13 | 14 | cdef cpp_bool CefCurrentlyOn(CefThreadId) 15 | cdef cpp_bool CefPostTask(CefThreadId threadId, 16 | CefRefPtr[CefTask] task) 17 | cdef cpp_bool CefPostDelayedTask(CefThreadId threadId, 18 | CefRefPtr[CefTask] task, 19 | int64 delay_ms) 20 | 21 | cdef cppclass CefTask: 22 | pass 23 | 24 | -------------------------------------------------------------------------------- /src/extern/cef/cef_time.pxd: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2013 CEF Python, see the Authors file. 2 | # All rights reserved. Licensed under BSD 3-clause license. 3 | # Project website: https://github.com/cztomczak/cefpython 4 | 5 | from ctime cimport time_t 6 | from cef_types cimport int64 7 | 8 | cdef extern from "include/internal/cef_time.h": 9 | ctypedef struct cef_time_t: 10 | int year 11 | int month 12 | int day_of_week 13 | int day_of_month 14 | int hour 15 | int minute 16 | int second 17 | int millisecond 18 | 19 | ctypedef struct cef_basetime_t: 20 | int64 val 21 | 22 | cdef extern from "include/internal/cef_types.h": 23 | cdef cppclass CefTime: 24 | CefTime() 25 | CefTime(cef_time_t&) 26 | void SetTimeT(time_t r) 27 | time_t GetTimeT() 28 | -------------------------------------------------------------------------------- /src/extern/cef/cef_urlrequest.pxd: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2013 CEF Python, see the Authors file. 2 | # All rights reserved. Licensed under BSD 3-clause license. 3 | # Project website: https://github.com/cztomczak/cefpython 4 | 5 | from cef_ptr cimport CefRefPtr 6 | cimport cef_types 7 | from cef_request cimport CefRequest 8 | from cef_response cimport CefResponse 9 | # noinspection PyUnresolvedReferences 10 | from cef_request_context cimport CefRequestContext 11 | 12 | cdef extern from "include/cef_urlrequest.h": 13 | cdef CefRefPtr[CefURLRequest] CefURLRequest_Create \ 14 | "CefURLRequest::Create"( 15 | CefRefPtr[CefRequest] request, 16 | CefRefPtr[CefURLRequestClient] client, 17 | CefRefPtr[CefRequestContext]) 18 | 19 | cdef cppclass CefURLRequest: 20 | CefRefPtr[CefRequest] GetRequest() 21 | CefRefPtr[CefURLRequestClient] GetClient() 22 | cef_types.cef_urlrequest_status_t GetRequestStatus() 23 | cef_types.cef_errorcode_t GetRequestError() 24 | CefRefPtr[CefResponse] GetResponse() 25 | void Cancel() 26 | 27 | cdef cppclass CefURLRequestClient: 28 | pass 29 | -------------------------------------------------------------------------------- /src/extern/cef/cef_web_plugin.pxd: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2013 CEF Python, see the Authors file. 2 | # All rights reserved. Licensed under BSD 3-clause license. 3 | # Project website: https://github.com/cztomczak/cefpython 4 | 5 | from cef_string cimport CefString 6 | 7 | # CEF 3 only. 8 | 9 | # cdef extern from "include/cef_web_plugin.h": 10 | # cdef cppclass CefWebPluginInfo: 11 | # CefString GetName() 12 | # CefString GetPath() 13 | # CefString GetVersion() 14 | # CefString GetDescription() 15 | -------------------------------------------------------------------------------- /src/extern/cef/cef_win.pxd: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2012 CEF Python, see the Authors file. 2 | # All rights reserved. Licensed under BSD 3-clause license. 3 | # Project website: https://github.com/cztomczak/cefpython 4 | 5 | include "compile_time_constants.pxi" 6 | 7 | # noinspection PyUnresolvedReferences 8 | from windows cimport HWND, RECT, HINSTANCE, HCURSOR 9 | from cef_string cimport CefString 10 | from libcpp cimport bool as cpp_bool 11 | from cef_types cimport CefRect 12 | 13 | cdef extern from "include/internal/cef_win.h": 14 | 15 | # noinspection PyUnresolvedReferences 16 | ctypedef HWND CefWindowHandle 17 | # noinspection PyUnresolvedReferences 18 | ctypedef HCURSOR CefCursorHandle 19 | 20 | cdef cppclass CefWindowInfo: 21 | void SetAsChild(CefWindowHandle parent, 22 | const CefRect windowRect) 23 | void SetAsPopup(CefWindowHandle parent, 24 | const CefString& windowName) 25 | void SetAsWindowless(CefWindowHandle parent) 26 | 27 | cdef cppclass CefMainArgs: 28 | CefMainArgs() 29 | CefMainArgs(HINSTANCE hInstance) 30 | -------------------------------------------------------------------------------- /src/extern/cef_log.pxd: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017 CEF Python, see the Authors file. 2 | # All rights reserved. Licensed under BSD 3-clause license. 3 | # Project website: https://github.com/cztomczak/cefpython 4 | 5 | cdef extern from "client_handler/cef_log.h": 6 | void cef_log_info(char* msg) 7 | void cef_log_warning(char* msg) 8 | void cef_log_error(char* msg) 9 | -------------------------------------------------------------------------------- /src/extern/cefpython_app.pxd: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2012 CEF Python, see the Authors file. 2 | # All rights reserved. Licensed under BSD 3-clause license. 3 | # Project website: https://github.com/cztomczak/cefpython 4 | 5 | cdef extern from "subprocess/cefpython_app.h": 6 | cdef cppclass CefPythonApp: 7 | pass 8 | -------------------------------------------------------------------------------- /src/extern/client_handler.pxd: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2012 CEF Python, see the Authors file. 2 | # All rights reserved. Licensed under BSD 3-clause license. 3 | # Project website: https://github.com/cztomczak/cefpython 4 | 5 | cdef extern from "client_handler/client_handler.h": 6 | 7 | cdef cppclass ClientHandler: 8 | pass 9 | 10 | -------------------------------------------------------------------------------- /src/extern/cookie_visitor.pxd: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2014 CEF Python, see the Authors file. 2 | # All rights reserved. Licensed under BSD 3-clause license. 3 | # Project website: https://github.com/cztomczak/cefpython 4 | 5 | cdef extern from "client_handler/cookie_visitor.h": 6 | 7 | cdef cppclass CookieVisitor: 8 | CookieVisitor(int cookieVisitorId) 9 | -------------------------------------------------------------------------------- /src/extern/cpp_utils.pxd: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2013 CEF Python, see the Authors file. 2 | # All rights reserved. Licensed under BSD 3-clause license. 3 | # Project website: https://github.com/cztomczak/cefpython 4 | 5 | cdef extern from "cpp_utils/PaintBuffer.h": 6 | 7 | cdef void FlipBufferUpsideDown( 8 | void* dest, void* src, int width, int height) 9 | 10 | cdef void SwapBufferFromBgraToRgba( 11 | void* dest, void* src, int width, int height) 12 | -------------------------------------------------------------------------------- /src/extern/ctime.pxd: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2013 CEF Python, see the Authors file. 2 | # All rights reserved. Licensed under BSD 3-clause license. 3 | # Project website: https://github.com/cztomczak/cefpython 4 | 5 | cdef extern from "time.h": 6 | ctypedef struct time_t: 7 | pass 8 | ctypedef struct tm: 9 | int tm_sec 10 | int tm_min 11 | int tm_hour 12 | int tm_mday 13 | int tm_mon 14 | int tm_year 15 | int tm_wday 16 | int tm_yday 17 | int tm_isdst 18 | 19 | size_t strftime (char* ptr, size_t maxsize, const char* format_, 20 | const tm* timeptr ) 21 | tm* localtime (const time_t* timer) 22 | time_t mktime (tm* timeptr) -------------------------------------------------------------------------------- /src/extern/dpi_aware_win.pxd: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2014 CEF Python, see the Authors file. 2 | # All rights reserved. Licensed under BSD 3-clause license. 3 | # Project website: https://github.com/cztomczak/cefpython 4 | 5 | from libcpp cimport bool as cpp_bool 6 | 7 | cdef extern from "client_handler/dpi_aware.h": 8 | cdef void GetSystemDpi(int* dpix, int* dpiy) 9 | cdef void GetDpiAwareWindowSize(int* width, int* height) 10 | cdef void SetProcessDpiAware() 11 | cdef cpp_bool IsProcessDpiAware() 12 | -------------------------------------------------------------------------------- /src/extern/linux.pxd: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2013 CEF Python, see the Authors file. 2 | # All rights reserved. Licensed under BSD 3-clause license. 3 | # Project website: https://github.com/cztomczak/cefpython 4 | 5 | cdef extern from "gtk/gtk.h" nogil: 6 | ctypedef void* GdkNativeWindow 7 | ctypedef void* GtkWidget 8 | cdef GtkWidget* gtk_plug_new(GdkNativeWindow socket_id) 9 | cdef void gtk_widget_show(GtkWidget* widget) 10 | 11 | ctypedef char* XPointer 12 | ctypedef struct XImage: 13 | int width 14 | int height 15 | int xoffset # number of pixels offset in X direction 16 | int format # XYBitmap, XYPixmap, ZPixmap 17 | char *data # pointer to image data 18 | int byte_order # data byte order, LSBFirst, MSBFirst 19 | int bitmap_unit # quant. of scanline 8, 16, 32 20 | int bitmap_bit_order # LSBFirst, MSBFirst 21 | int bitmap_pad # 8, 16, 32 either XY or ZPixmap 22 | int depth # depth of image 23 | int bytes_per_line # accelerator to next scanline 24 | int bits_per_pixel # bits per pixel (ZPixmap) 25 | unsigned long red_mask # bits in z arrangement 26 | unsigned long green_mask 27 | unsigned long blue_mask 28 | XPointer *obdata 29 | void *funcs 30 | void XDestroyImage(XImage *ximage) 31 | unsigned long XGetPixel(XImage* image, int x, int y) 32 | 33 | -------------------------------------------------------------------------------- /src/extern/mac.pxd: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2015 CEF Python, see the Authors file. 2 | # All rights reserved. Licensed under BSD 3-clause license. 3 | # Project website: https://github.com/cztomczak/cefpython 4 | 5 | from cef_ptr cimport CefRefPtr 6 | from cef_browser cimport CefBrowser 7 | 8 | cdef extern from "client_handler/util_mac.h": 9 | void MacInitialize() 10 | void MacShutdown() 11 | void MacSetWindowTitle(CefRefPtr[CefBrowser] browser, char* title) 12 | -------------------------------------------------------------------------------- /src/extern/main_message_loop.pxd: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2016 CEF Python, see the Authors file. 2 | # All rights reserved. Licensed under BSD 3-clause license. 3 | # Project website: https://github.com/cztomczak/cefpython 4 | 5 | from libcpp.memory cimport unique_ptr 6 | 7 | from cef_scoped_refptr cimport scoped_refptr 8 | 9 | cdef extern from \ 10 | "subprocess/main_message_loop/main_message_loop_external_pump.h": 11 | 12 | cdef cppclass MainMessageLoopExternalPump: 13 | @staticmethod 14 | unique_ptr[MainMessageLoopExternalPump] Create() 15 | -------------------------------------------------------------------------------- /src/extern/multimap.pxd: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2012 CEF Python, see the Authors file. 2 | # All rights reserved. Licensed under BSD 3-clause license. 3 | # Project website: https://github.com/cztomczak/cefpython 4 | 5 | from libcpp.utility cimport pair 6 | 7 | # Copied from: Cython/Includes/libcpp/map.pxd 8 | 9 | cdef extern from "" namespace "std": 10 | cdef cppclass multimap[T, U]: 11 | cppclass iterator: 12 | # noinspection PyUnresolvedReferences 13 | pair[T, U]& operator*() nogil 14 | iterator operator++() nogil 15 | iterator operator--() nogil 16 | bint operator==(iterator) nogil 17 | bint operator!=(iterator) nogil 18 | multimap() nogil except + 19 | # noinspection PyUnresolvedReferences 20 | U& operator[](T&) nogil 21 | # noinspection PyUnresolvedReferences 22 | iterator begin() nogil 23 | # noinspection PyUnresolvedReferences 24 | iterator end() nogil 25 | # noinspection PyUnresolvedReferences 26 | pair[iterator, bint] insert(pair[T, U]) nogil # XXX pair[T,U]& 27 | # noinspection PyUnresolvedReferences 28 | iterator find(T&) nogil 29 | -------------------------------------------------------------------------------- /src/extern/request_context_handler.pxd: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2013 CEF Python, see the Authors file. 2 | # All rights reserved. Licensed under BSD 3-clause license. 3 | # Project website: https://github.com/cztomczak/cefpython 4 | 5 | from cef_ptr cimport CefRefPtr 6 | from cef_browser cimport CefBrowser 7 | 8 | cdef extern from "client_handler/request_context_handler.h": 9 | cdef cppclass RequestContextHandler: 10 | RequestContextHandler(CefRefPtr[CefBrowser] browser) 11 | void SetBrowser(CefRefPtr[CefBrowser] browser) 12 | -------------------------------------------------------------------------------- /src/extern/resource_handler.pxd: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2013 CEF Python, see the Authors file. 2 | # All rights reserved. Licensed under BSD 3-clause license. 3 | # Project website: https://github.com/cztomczak/cefpython 4 | 5 | cdef extern from "client_handler/resource_handler.h": 6 | 7 | cdef cppclass ResourceHandler: 8 | ResourceHandler(int resourceHandlerId) 9 | -------------------------------------------------------------------------------- /src/extern/string_visitor.pxd: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2013 CEF Python, see the Authors file. 2 | # All rights reserved. Licensed under BSD 3-clause license. 3 | # Project website: https://github.com/cztomczak/cefpython 4 | 5 | cdef extern from "client_handler/string_visitor.h": 6 | 7 | cdef cppclass StringVisitor: 8 | StringVisitor(int stringVisitorId) 9 | -------------------------------------------------------------------------------- /src/extern/task.pxd: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2014 CEF Python, see the Authors file. 2 | # All rights reserved. Licensed under BSD 3-clause license. 3 | # Project website: https://github.com/cztomczak/cefpython 4 | 5 | from cef_ptr cimport CefRefPtr 6 | # noinspection PyUnresolvedReferences 7 | from cef_task cimport CefTask 8 | from cef_string cimport CefString 9 | from cef_cookie cimport CefCookie, CefCookieManager 10 | # noinspection PyUnresolvedReferences 11 | from cef_cookie cimport CefSetCookieCallback, CefDeleteCookiesCallback 12 | # noinspection PyUnresolvedReferences 13 | from libcpp cimport bool as cpp_bool 14 | from cef_types cimport int64 15 | 16 | 17 | cdef extern from "client_handler/task.h": 18 | 19 | void PostTaskWrapper(int threadId, int taskId) nogil 20 | void PostDelayedTaskWrapper(int threadId, int64 delay_ms, int taskId) nogil 21 | 22 | cdef CefRefPtr[CefTask] CreateTask_SetCookie( 23 | CefCookieManager* obj, 24 | const CefString& url, 25 | const CefCookie& cookie, 26 | CefRefPtr[CefSetCookieCallback] callback) 27 | 28 | cdef CefRefPtr[CefTask] CreateTask_DeleteCookies( 29 | CefCookieManager* obj, 30 | const CefString& url, 31 | const CefString& cookie_name, 32 | CefRefPtr[CefDeleteCookiesCallback] callback) 33 | -------------------------------------------------------------------------------- /src/extern/web_request_client.pxd: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2013 CEF Python, see the Authors file. 2 | # All rights reserved. Licensed under BSD 3-clause license. 3 | # Project website: https://github.com/cztomczak/cefpython 4 | 5 | cdef extern from "client_handler/web_request_client.h": 6 | 7 | cdef cppclass WebRequestClient: 8 | WebRequestClient(int webRequestId) 9 | -------------------------------------------------------------------------------- /src/extern/x11.pxd: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2016 CEF Python, see the Authors file. 2 | # All rights reserved. Licensed under BSD 3-clause license. 3 | # Project website: https://github.com/cztomczak/cefpython 4 | 5 | from cef_ptr cimport CefRefPtr 6 | # noinspection PyUnresolvedReferences 7 | from cef_browser cimport CefBrowser 8 | from linux cimport XImage 9 | 10 | cdef extern from "client_handler/x11.h" nogil: 11 | void InstallX11ErrorHandlers() 12 | void SetX11WindowBounds(CefRefPtr[CefBrowser] browser, 13 | int x, int y, int width, int height) 14 | void SetX11WindowTitle(CefRefPtr[CefBrowser] browser, char* title) 15 | XImage* CefBrowser_GetImage(CefRefPtr[CefBrowser] browser) 16 | -------------------------------------------------------------------------------- /src/handlers/accessibility_handler.pyx: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2018 CEF Python, see the Authors file. 2 | # All rights reserved. Licensed under BSD 3-clause license. 3 | # Project website: https://github.com/cztomczak/cefpython 4 | 5 | include "../cefpython.pyx" 6 | include "../browser.pyx" 7 | include "../frame.pyx" 8 | include "../process_message_utils.pyx" 9 | 10 | cdef public void AccessibilityHandler_OnAccessibilityTreeChange( 11 | CefRefPtr[CefValue] cefValue 12 | ) except * with gil: 13 | cdef object value = CefValueToPyValue(cefValue) 14 | cdef object callback 15 | try: 16 | callback = GetGlobalClientCallback("OnAccessibilityTreeChange") 17 | if callback: 18 | callback(value=value) 19 | except: 20 | (exc_type, exc_value, exc_trace) = sys.exc_info() 21 | sys.excepthook(exc_type, exc_value, exc_trace) 22 | 23 | cdef public void AccessibilityHandler_OnAccessibilityLocationChange( 24 | CefRefPtr[CefValue] cefValue 25 | ) except * with gil: 26 | cdef object value = CefValueToPyValue(cefValue) 27 | cdef object callback 28 | try: 29 | callback = GetGlobalClientCallback("OnAccessibilityLocationChange") 30 | if callback: 31 | callback(value=value) 32 | except: 33 | (exc_type, exc_value, exc_trace) = sys.exc_info() 34 | sys.excepthook(exc_type, exc_value, exc_trace) 35 | -------------------------------------------------------------------------------- /src/handlers/browser_process_handler.pyx: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2012 CEF Python, see the Authors file. 2 | # All rights reserved. Licensed under BSD 3-clause license. 3 | # Project website: https://github.com/cztomczak/cefpython 4 | 5 | include "../cefpython.pyx" 6 | 7 | # cdef public void BrowserProcessHandler_OnRenderProcessThreadCreated( 8 | # CefRefPtr[CefListValue] extra_info 9 | # ) except * with gil: 10 | # try: 11 | # pass 12 | # except: 13 | # (exc_type, exc_value, exc_trace) = sys.exc_info() 14 | # sys.excepthook(exc_type, exc_value, exc_trace) 15 | 16 | cdef public void BrowserProcessHandler_OnBeforeChildProcessLaunch( 17 | CefRefPtr[CefCommandLine] cefCommandLine 18 | ) except * with gil: 19 | try: 20 | AppendSwitchesToCommandLine(cefCommandLine, g_commandLineSwitches) 21 | except: 22 | (exc_type, exc_value, exc_trace) = sys.exc_info() 23 | sys.excepthook(exc_type, exc_value, exc_trace) 24 | -------------------------------------------------------------------------------- /src/handlers/download_handler.pyx: -------------------------------------------------------------------------------- 1 | 2 | 3 | cdef public void DownloadHandler_OnBeforeDownload( 4 | CefRefPtr[CefBrowser] cefBrowser, 5 | CefRefPtr[CefDownloadItem] cefDownloadItem, 6 | const CefString& cefSuggestedName, 7 | CefRefPtr[CefBeforeDownloadCallback] cefCallback 8 | ) except * with gil: 9 | cdef PyBrowser pyBrowser 10 | cdef PyDownloadItem pyDownloadItem 11 | cdef str pySuggestedName 12 | cdef PyBeforeDownloadCallback pyBeforeDownloadCallback 13 | cdef object callback 14 | try: 15 | pyBrowser = GetPyBrowser(cefBrowser, "OnBeforeDownload") 16 | callback = pyBrowser.GetClientCallback("OnBeforeDownload") 17 | pyDownloadItem = PyDownloadItem() 18 | pyDownloadItem.cefDownloadItem = cefDownloadItem 19 | pySuggestedName = CefToPyString(cefSuggestedName) 20 | pyBeforeDownloadCallback = PyBeforeDownloadCallback() 21 | pyBeforeDownloadCallback.cefBeforeDownloadCallback = cefCallback 22 | if callback: 23 | callback(browser=pyBrowser, downloadItem=pyDownloadItem, 24 | suggestedName=pySuggestedName, callback=pyBeforeDownloadCallback) 25 | except: 26 | (exc_type, exc_value, exc_trace) = sys.exc_info() 27 | sys.excepthook(exc_type, exc_value, exc_trace) 28 | 29 | cdef public void DownloadHandler_OnDownloadUpdated( 30 | CefRefPtr[CefBrowser] cefBrowser, 31 | CefRefPtr[CefDownloadItem] cefDownloadItem, 32 | CefRefPtr[CefDownloadItemCallback] cefCallback 33 | ) except * with gil: 34 | cdef PyBrowser pyBrowser 35 | cdef PyDownloadItem pyDownloadItem 36 | cdef PyDownloadItemCallback pyDownloadItemCallback 37 | cdef object callback 38 | try: 39 | pyBrowser = GetPyBrowser(cefBrowser, "OnDownloadUpdated") 40 | callback = pyBrowser.GetClientCallback("OnDownloadUpdated") 41 | pyDownloadItem = PyDownloadItem() 42 | pyDownloadItem.cefDownloadItem = cefDownloadItem 43 | pyDownloadItemCallback = PyDownloadItemCallback() 44 | pyDownloadItemCallback.cefDownloadItemCallback = cefCallback 45 | if callback: 46 | callback(browser=pyBrowser, downloadItem=pyDownloadItem, 47 | callback=pyDownloadItemCallback) 48 | except: 49 | (exc_type, exc_value, exc_trace) = sys.exc_info() 50 | sys.excepthook(exc_type, exc_value, exc_trace) -------------------------------------------------------------------------------- /src/handlers/focus_handler.pyx: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2016 CEF Python, see the Authors file. 2 | # All rights reserved. Licensed under BSD 3-clause license. 3 | # Project website: https://github.com/cztomczak/cefpython 4 | 5 | include "../cefpython.pyx" 6 | include "../browser.pyx" 7 | 8 | cimport cef_types 9 | from cef_types cimport TID_UI 10 | 11 | FOCUS_SOURCE_NAVIGATION = cef_types.FOCUS_SOURCE_NAVIGATION 12 | FOCUS_SOURCE_SYSTEM = cef_types.FOCUS_SOURCE_SYSTEM 13 | 14 | 15 | cdef public void FocusHandler_OnTakeFocus( 16 | CefRefPtr[CefBrowser] cef_browser, 17 | cpp_bool next_ 18 | ) except * with gil: 19 | cdef PyBrowser browser 20 | try: 21 | assert IsThread(TID_UI), "Must be called on the UI thread" 22 | browser = GetPyBrowser(cef_browser, "OnTakeFocus") 23 | callback = browser.GetClientCallback("OnTakeFocus") 24 | if callback: 25 | callback(browser=browser, next=next_) 26 | except: 27 | (exc_type, exc_value, exc_trace) = sys.exc_info() 28 | sys.excepthook(exc_type, exc_value, exc_trace) 29 | 30 | 31 | cdef public cpp_bool FocusHandler_OnSetFocus( 32 | CefRefPtr[CefBrowser] cef_browser, 33 | cef_types.cef_focus_source_t source 34 | ) except * with gil: 35 | cdef PyBrowser browser 36 | cdef py_bool ret 37 | try: 38 | assert IsThread(TID_UI), "Must be called on the UI thread" 39 | browser = GetPyBrowser(cef_browser, "OnSetFocus") 40 | callback = browser.GetClientCallback("OnSetFocus") 41 | if callback: 42 | ret = callback(browser=browser, source=source) 43 | return bool(ret) 44 | else: 45 | return False 46 | except: 47 | (exc_type, exc_value, exc_trace) = sys.exc_info() 48 | sys.excepthook(exc_type, exc_value, exc_trace) 49 | 50 | 51 | cdef public void FocusHandler_OnGotFocus( 52 | CefRefPtr[CefBrowser] cef_browser 53 | ) except * with gil: 54 | cdef PyBrowser browser 55 | try: 56 | assert IsThread(TID_UI), "Must be called on the UI thread" 57 | browser = GetPyBrowser(cef_browser, "OnGotFocus") 58 | callback = browser.GetClientCallback("OnGotFocus") 59 | if callback: 60 | callback(browser=browser) 61 | except: 62 | (exc_type, exc_value, exc_trace) = sys.exc_info() 63 | sys.excepthook(exc_type, exc_value, exc_trace) 64 | -------------------------------------------------------------------------------- /src/handlers/v8function_handler.pyx: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2012 CEF Python, see the Authors file. 2 | # All rights reserved. Licensed under BSD 3-clause license. 3 | # Project website: https://github.com/cztomczak/cefpython 4 | 5 | include "../cefpython.pyx" 6 | include "../browser.pyx" 7 | include "../frame.pyx" 8 | 9 | cdef public void V8FunctionHandler_Execute( 10 | CefRefPtr[CefBrowser] cefBrowser, 11 | int64 frameId, 12 | CefString& cefFuncName, 13 | CefRefPtr[CefListValue] cefFuncArgs 14 | ) except * with gil: 15 | cdef PyBrowser pyBrowser 16 | cdef CefRefPtr[CefFrame] cefFrame 17 | cdef PyFrame pyFrame # may be None 18 | cdef py_string funcName 19 | cdef object func 20 | cdef list funcArgs 21 | cdef object returnValue 22 | cdef py_string errorMessage 23 | try: 24 | pyBrowser = GetPyBrowser(cefBrowser, "V8FunctionHandler_Execute") 25 | cefFrame = cefBrowser.get().GetFrame(frameId) 26 | if cefFrame.get(): 27 | pyFrame = GetPyFrame(cefFrame) 28 | else: 29 | pyFrame = None 30 | funcName = CefToPyString(cefFuncName) 31 | Debug("V8FunctionHandler_Execute(): funcName=%s" % funcName) 32 | jsBindings = pyBrowser.GetJavascriptBindings() 33 | func = jsBindings.GetFunctionOrMethod(funcName) 34 | if not func: 35 | # The Renderer process already checks whether function 36 | # name is valid before calling V8FunctionHandler_Execute(), 37 | # but it is possible for the javascript bindings to change 38 | # during execution, so it's possible for the Browser/Renderer 39 | # bindings to be out of sync due to delay in process messaging. 40 | errorMessage = "V8FunctionHandler_Execute() FAILED: " \ 41 | "python function not found: %s" % funcName 42 | NonCriticalError(errorMessage) 43 | # Raise a javascript exception in that frame if it still exists 44 | if pyFrame: 45 | pyFrame.ExecuteJavascript("throw '%s';" % errorMessage) 46 | return 47 | funcArgs = CefListValueToPyList(cefBrowser, cefFuncArgs) 48 | func(*funcArgs) 49 | except: 50 | (exc_type, exc_value, exc_trace) = sys.exc_info() 51 | sys.excepthook(exc_type, exc_value, exc_trace) 52 | -------------------------------------------------------------------------------- /src/include/base/internal/README-TRANSFER.txt: -------------------------------------------------------------------------------- 1 | Files in this directory have been copied from other locations in the Chromium 2 | source tree. They have been modified only to the extent necessary to work in 3 | the CEF Binary Distribution directory structure. Below is a listing of the 4 | original file locations. 5 | 6 | ../net/base/net_error_list.h 7 | -------------------------------------------------------------------------------- /src/include/cef_config.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2022 Marshall A. Greenblatt. All rights reserved. 2 | // 3 | // Redistribution and use in source and binary forms, with or without 4 | // modification, are permitted provided that the following conditions are 5 | // met: 6 | // 7 | // * Redistributions of source code must retain the above copyright 8 | // notice, this list of conditions and the following disclaimer. 9 | // * Redistributions in binary form must reproduce the above 10 | // copyright notice, this list of conditions and the following disclaimer 11 | // in the documentation and/or other materials provided with the 12 | // distribution. 13 | // * Neither the name of Google Inc. nor the name Chromium Embedded 14 | // Framework nor the names of its contributors may be used to endorse 15 | // or promote products derived from this software without specific prior 16 | // written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // --------------------------------------------------------------------------- 31 | // 32 | // This file is generated by the make_config_header.py tool. 33 | // 34 | 35 | #ifndef CEF_INCLUDE_CEF_CONFIG_H_ 36 | #define CEF_INCLUDE_CEF_CONFIG_H_ 37 | 38 | 39 | 40 | #endif // CEF_INCLUDE_CEF_CONFIG_H_ 41 | -------------------------------------------------------------------------------- /src/include/cef_i18n_util.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2021 Marshall A. Greenblatt. All rights reserved. 2 | // 3 | // Redistribution and use in source and binary forms, with or without 4 | // modification, are permitted provided that the following conditions are 5 | // met: 6 | // 7 | // * Redistributions of source code must retain the above copyright 8 | // notice, this list of conditions and the following disclaimer. 9 | // * Redistributions in binary form must reproduce the above 10 | // copyright notice, this list of conditions and the following disclaimer 11 | // in the documentation and/or other materials provided with the 12 | // distribution. 13 | // * Neither the name of Google Inc. nor the name Chromium Embedded 14 | // Framework nor the names of its contributors may be used to endorse 15 | // or promote products derived from this software without specific prior 16 | // written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // --------------------------------------------------------------------------- 31 | // 32 | // The contents of this file must follow a specific format in order to 33 | // support the CEF translator tool. See the translator.README.txt file in the 34 | // tools directory for more information. 35 | // 36 | 37 | #ifndef CEF_INCLUDE_CEF_I18N_UTIL_H_ 38 | #define CEF_INCLUDE_CEF_I18N_UTIL_H_ 39 | #pragma once 40 | 41 | #include "include/cef_base.h" 42 | 43 | /// 44 | /// Returns true if the application text direction is right-to-left. 45 | /// 46 | /*--cef()--*/ 47 | bool CefIsRTL(); 48 | 49 | #endif // CEF_INCLUDE_CEF_I18N_UTIL_H_ 50 | -------------------------------------------------------------------------------- /src/linux/deb_pkg_deprecated/.gitignore: -------------------------------------------------------------------------------- 1 | /cefpython3-*/ 2 | /deb_archive/ 3 | *.tar.gz -------------------------------------------------------------------------------- /src/linux/deb_pkg_deprecated/debian.postinst: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Exit immediately if a command exits with a non-zero status 4 | set -e 5 | 6 | # Permissions for the executable files 7 | chmod 755 /usr/share/pyshared/cefpython3/cefclient 8 | chmod 755 /usr/share/pyshared/cefpython3/subprocess 9 | 10 | # Permissions for the examples - debug.log is created. 11 | # If you want to run the cefclient executable you may 12 | # also have to chmod 777 /usr/share/pyshared/cefpython3/. 13 | chmod 666 /usr/share/pyshared/cefpython3/debug.log 14 | chmod 666 /usr/share/pyshared/cefpython3/examples/debug.log 15 | chmod 666 /usr/share/pyshared/cefpython3/examples/wx/debug.log 16 | 17 | # This creates symbolic links in /usr/lib/pymodules/.../cefpython3/ 18 | # for all the files. This is no more required, as in make-deb.py 19 | # we're modify the deb archive and moving the /usr/lib/pyshared/.../ 20 | # .so files to the /usr/share/pyshared/.../ directory. Read the 21 | # comments in make-deb.py why it needs to be done so. 22 | # Let's keep the creation of symlinks for backwards compatibility. 23 | if which update-python-modules >/dev/null 2>&1; then 24 | update-python-modules python-cefpython3.public 25 | fi 26 | -------------------------------------------------------------------------------- /src/linux/deb_pkg_deprecated/deps.txt: -------------------------------------------------------------------------------- 1 | gconf-service 2 | libasound2 (>= 1.0.23) 3 | libatk1.0-0 (>= 1.12.4) 4 | libc6 (>= 2.12) 5 | libcairo2 (>= 1.6.0) 6 | libcups2 (>= 1.4.0) 7 | libdbus-1-3 (>= 1.2.14) 8 | libexpat1 (>= 1.95.8) 9 | libfontconfig1 (>= 2.8.0) 10 | libfreetype6 (>= 2.3.9) 11 | libgcc1 (>= 1:4.1.1) 12 | libgconf-2-4 (>= 2.31.1) 13 | libgdk-pixbuf2.0-0 (>= 2.22.0) 14 | libglib2.0-0 (>= 2.26.0) 15 | libgtk2.0-0 (>= 2.24.0) 16 | libnspr4 (>= 1.8.0.10) 17 | libnss3 (>= 3.12.4) 18 | libpango1.0-0 (>= 1.14.0) 19 | libstdc++6 (>= 4.6) 20 | libx11-6 (>= 2:1.4.99.1) 21 | libxcomposite1 (>= 1:0.3-1) 22 | libxcursor1 (>> 1.1.2) 23 | libxdamage1 (>= 1:1.1) 24 | libxext6 25 | libxfixes3 26 | libxi6 (>= 2:1.2.99.4) 27 | libxrandr2 (>= 2:1.2.99.2) 28 | libxrender1 29 | libxss1 30 | libxtst6 -------------------------------------------------------------------------------- /src/linux/deb_pkg_deprecated/stdeb.cfg.template: -------------------------------------------------------------------------------- 1 | [DEFAULT] 2 | XS-Python-Version: 2.7 -------------------------------------------------------------------------------- /src/mac/mac64.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | PATH=/usr/local/bin:$PATH 4 | export PATH 5 | 6 | CEF_CCFLAGS="-arch x86_64" 7 | export CEF_CCFLAGS 8 | 9 | ARCHFLAGS="-arch x86_64" 10 | export ARCHFLAGS 11 | 12 | export CC=gcc 13 | export CXX=g++ 14 | -------------------------------------------------------------------------------- /src/string_utils_win.pyx: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2012 CEF Python, see the Authors file. 2 | # All rights reserved. Licensed under BSD 3-clause license. 3 | # Project website: https://github.com/cztomczak/cefpython 4 | 5 | include "cefpython.pyx" 6 | 7 | cdef int wchar_t_size = 2 8 | 9 | cdef void CharToWidechar(char* charString, wchar_t* wideString, int wideSize 10 | ) except *: 11 | cdef int copiedCharacters = MultiByteToWideChar( 12 | CP_UTF8, 0, charString, -1, wideString, wideSize) 13 | # MultiByteToWideChar does not include the NULL character 14 | # when 0 bytes are written. 15 | if wideSize > 0 and copiedCharacters == 0: 16 | wideString[0] = 0 17 | 18 | cdef py_string WidecharToPyString( 19 | wchar_t* wcharString): 20 | cdef int charBytes = WideCharToMultiByte( 21 | CP_UTF8, 0, wcharString, -1, NULL, 0, NULL, NULL) 22 | assert charBytes > 0, "WideCharToMultiByte() returned 0" 23 | 24 | cdef char* charString = malloc(charBytes * sizeof(char)) 25 | cdef int copiedBytes = WideCharToMultiByte( 26 | CP_UTF8, 0, wcharString, -1, charString, charBytes, NULL, NULL) 27 | 28 | # WideCharToMultiByte does not include the NULL character 29 | # when 0 bytes are written. 30 | if copiedBytes == 0: 31 | charString[0] = 0 32 | 33 | cdef py_string pyString = CharToPyString(charString) 34 | free(charString) 35 | return pyString 36 | -------------------------------------------------------------------------------- /src/subprocess.old/.gitignore: -------------------------------------------------------------------------------- 1 | *.o 2 | *.a 3 | subprocess 4 | subprocess.dSYM/ 5 | -------------------------------------------------------------------------------- /src/subprocess.old/Makefile: -------------------------------------------------------------------------------- 1 | # -g - extra debug information 2 | # -O1 - more precise backtraces 3 | # -fPIC - required when using -shared option, required for use with Cython 4 | # -Wall - show important warnings 5 | # -Werror - treat warnings as errors 6 | 7 | UNAME_S = $(shell uname -s) 8 | INC = -I./../ -I./../common/ -I$(PYTHON_INCLUDE) \ 9 | -I/usr/include/gtk-2.0 \ 10 | -I/usr/include/gtk-unix-print-2.0 \ 11 | -I/usr/include/glib-2.0 \ 12 | -I/usr/include/cairo \ 13 | -I/usr/include/pango-1.0 \ 14 | -I/usr/include/harfbuzz \ 15 | -I/usr/include/gdk-pixbuf-2.0 \ 16 | -I/usr/include/atk-1.0 \ 17 | -I/usr/lib/x86_64-linux-gnu/gtk-2.0/include \ 18 | -I/usr/lib/x86_64-linux-gnu/gtk-unix-print-2.0 \ 19 | -I/usr/lib/x86_64-linux-gnu/glib-2.0/include \ 20 | -I/usr/lib/i386-linux-gnu/gtk-2.0/include \ 21 | -I/usr/lib/i386-linux-gnu/gtk-unix-print-2.0 \ 22 | -I/usr/lib/i386-linux-gnu/glib-2.0/include \ 23 | -I/usr/lib64/gtk-2.0/include \ 24 | -I/usr/lib64/gtk-unix-print-2.0 \ 25 | -I/usr/lib64/glib-2.0/include \ 26 | -I/usr/lib/gtk-2.0/include \ 27 | -I/usr/lib/gtk-2.0/gtk-unix-print-2.0 \ 28 | -I/usr/lib/glib-2.0/include 29 | 30 | ifeq ($(UNAME_S), Linux) 31 | LIB_DIRS = -L$(CEF_BIN) \ 32 | -L$(CEF_LIB) 33 | else ifeq ($(UNAME_S), Darwin) 34 | LIB_DIRS = -F$(CEF_BIN) \ 35 | -L$(CEF_LIB) 36 | endif 37 | 38 | ifeq ($(UNAME_S), Linux) 39 | CPP_FILES = print_handler_gtk.cpp ../client_handler/x11.cpp 40 | LIBS = -lcef -lX11 -lgobject-2.0 -lglib-2.0 -lgtk-x11-2.0 -lgdk-x11-2.0 41 | else ifeq ($(UNAME_S), Darwin) 42 | CPP_FILES = 43 | # Include framework before libcef_dll_wrapper 44 | LIBS = -framework "Chromium Embedded Framework" 45 | endif 46 | 47 | CCFLAGS = -DRENDERER_PROCESS $(CEF_CCFLAGS) 48 | 49 | subprocess: 50 | # -fPIC is required only for libraries included by Cython. 51 | @echo [SUBPROCESS] Building the 'subprocess' executable 52 | $(CXX) $(CCFLAGS) $(INC) $(LIB_DIRS) main.cpp cefpython_app.cpp \ 53 | v8function_handler.cpp v8utils.cpp javascript_callback.cpp \ 54 | $(CPP_FILES) \ 55 | $(CEF_LINK_FLAGS) \ 56 | $(LIBS) -lcef_dll_wrapper \ 57 | -o subprocess -Wl,-rpath,@loader_path/ 58 | -------------------------------------------------------------------------------- /src/subprocess.old/Makefile-libcefpythonapp: -------------------------------------------------------------------------------- 1 | # -g - extra debug information 2 | # -O1 - more precise backtraces 3 | # -fPIC - required when using -shared option, required for use with Cython 4 | # -Wall - show important warnings 5 | # -Werror - treat warnings as errors 6 | 7 | # Cython compiler options: 8 | # -fPIC -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions \ 9 | # -Wl,-z,relro 10 | 11 | UNAME_S = $(shell uname -s) 12 | CCFLAGS = -fPIC -DBROWSER_PROCESS $(CEF_CCFLAGS) 13 | 14 | ifeq ($(UNAME_S), Linux) 15 | SRC_MORE = print_handler_gtk.cpp ../client_handler/x11.cpp \ 16 | main_message_loop/main_message_loop_external_pump_linux.cpp 17 | else ifeq ($(UNAME_S), Darwin) 18 | SRC_MORE = main_message_loop/main_message_loop_external_pump_mac.mm 19 | endif 20 | 21 | SRC = cefpython_app.cpp v8function_handler.cpp v8utils.cpp \ 22 | javascript_callback.cpp \ 23 | main_message_loop/main_message_loop.cpp \ 24 | main_message_loop/main_message_loop_std.cpp \ 25 | main_message_loop/main_message_loop_external_pump.cpp \ 26 | $(SRC_MORE) 27 | 28 | OBJ = $(filter %.o, $(SRC:.cpp=.o) $(SRC:.mm=.o)) 29 | .SUFFIXES: .cpp .mm .o 30 | 31 | OUT = libcefpythonapp.a 32 | 33 | INC = -I./../ -I./../common/ -I$(PYTHON_INCLUDE) \ 34 | -I/usr/include/gtk-2.0 \ 35 | -I/usr/include/gtk-unix-print-2.0 \ 36 | -I/usr/include/glib-2.0 \ 37 | -I/usr/include/cairo \ 38 | -I/usr/include/pango-1.0 \ 39 | -I/usr/include/harfbuzz \ 40 | -I/usr/include/gdk-pixbuf-2.0 \ 41 | -I/usr/include/atk-1.0 \ 42 | -I/usr/lib/x86_64-linux-gnu/gtk-2.0/include \ 43 | -I/usr/lib/x86_64-linux-gnu/gtk-unix-print-2.0 \ 44 | -I/usr/lib/x86_64-linux-gnu/glib-2.0/include \ 45 | -I/usr/lib/i386-linux-gnu/gtk-2.0/include \ 46 | -I/usr/lib/i386-linux-gnu/gtk-unix-print-2.0 \ 47 | -I/usr/lib/i386-linux-gnu/glib-2.0/include \ 48 | -I/usr/lib64/gtk-2.0/include \ 49 | -I/usr/lib64/gtk-unix-print-2.0 \ 50 | -I/usr/lib64/glib-2.0/include \ 51 | -I/usr/lib/gtk-2.0/include \ 52 | -I/usr/lib/gtk-2.0/gtk-unix-print-2.0 \ 53 | -I/usr/lib/glib-2.0/include 54 | 55 | $(OUT): $(OBJ) 56 | @echo [CEFPYTHONAPP] Creating library $(OUT) from $(OBJ)... 57 | ar rcs $(OUT) $(OBJ) 58 | 59 | .cpp.o: 60 | @echo [CEFPYTHONAPP] Building $@ from $<... 61 | $(CXX) $(CCFLAGS) $(INC) -c $< -o $@ 62 | 63 | .mm.o: 64 | @echo [CEFPYTHONAPP] Building $@ from $<... 65 | $(CXX) $(CCFLAGS) $(INC) -c $< -o $@ 66 | -------------------------------------------------------------------------------- /src/subprocess.old/javascript_callback.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013 CEF Python, see the Authors file. 2 | // All rights reserved. Licensed under BSD 3-clause license. 3 | // Project website: https://github.com/cztomczak/cefpython 4 | 5 | #pragma once 6 | #include "include/cef_v8.h" 7 | 8 | CefString PutJavascriptCallback( 9 | CefRefPtr frame, CefRefPtr jsCallback); 10 | 11 | bool ExecuteJavascriptCallback(int callbackId, CefRefPtr args); 12 | 13 | void RemoveJavascriptCallbacksForFrame(CefRefPtr frame); 14 | -------------------------------------------------------------------------------- /src/subprocess.old/main.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013 CEF Python, see the Authors file. 2 | // All rights reserved. Licensed under BSD 3-clause license. 3 | // Project website: https://github.com/cztomczak/cefpython 4 | 5 | #include "cefpython_app.h" 6 | 7 | #if defined(OS_WIN) 8 | 9 | #include 10 | int APIENTRY wWinMain(HINSTANCE hInstance, 11 | HINSTANCE hPrevInstance, 12 | LPTSTR lpCmdLine, 13 | int nCmdShow) 14 | { 15 | UNREFERENCED_PARAMETER(hPrevInstance); 16 | UNREFERENCED_PARAMETER(lpCmdLine); 17 | 18 | // lpCmdLine does not include program name argument, must 19 | // use GetCommandLineW(). Cannot use CefCommandLine::GetGlobalCommandLine, 20 | // as CEF was not yet initialized. 21 | CefRefPtr command_line = \ 22 | CefCommandLine::CreateCommandLine(); 23 | command_line->InitFromString(GetCommandLineW()); 24 | if (command_line->HasSwitch("enable-high-dpi-support")) { 25 | CefEnableHighDPISupport(); 26 | } 27 | 28 | CefMainArgs mainArgs(hInstance); 29 | 30 | #else // defined(OS_WIN) 31 | 32 | int main(int argc, char **argv) 33 | { 34 | CefMainArgs mainArgs(argc, argv); 35 | 36 | #endif // Mac, Linux 37 | 38 | CefRefPtr app(new CefPythonApp); 39 | int exitCode = CefExecuteProcess(mainArgs, app.get(), NULL); 40 | return exitCode; 41 | } 42 | -------------------------------------------------------------------------------- /src/subprocess.old/main_message_loop/main_message_loop.cpp: -------------------------------------------------------------------------------- 1 | // Copied from upstream cefclient with minor modifications. 2 | 3 | // Copyright (c) 2015 The Chromium Embedded Framework Authors. All rights 4 | // reserved. Use of this source code is governed by a BSD-style license that 5 | // can be found in the LICENSE file. 6 | 7 | #include "main_message_loop.h" 8 | 9 | #include "include/cef_task.h" 10 | #include "include/wrapper/cef_closure_task.h" 11 | #include "include/base/cef_callback.h" 12 | 13 | namespace { 14 | 15 | MainMessageLoop* g_main_message_loop = NULL; 16 | 17 | } // namespace 18 | 19 | MainMessageLoop::MainMessageLoop() { 20 | DCHECK(!g_main_message_loop); 21 | g_main_message_loop = this; 22 | } 23 | 24 | MainMessageLoop::~MainMessageLoop() { 25 | g_main_message_loop = NULL; 26 | } 27 | 28 | // static 29 | MainMessageLoop* MainMessageLoop::Get() { 30 | DCHECK(g_main_message_loop); 31 | return g_main_message_loop; 32 | } 33 | 34 | void MainMessageLoop::PostClosure(base::OnceClosure closure) { 35 | PostTask(CefCreateClosureTask(std::move(closure))); 36 | } 37 | 38 | void MainMessageLoop::PostClosure(const base::RepeatingClosure& closure) { 39 | PostTask(CefCreateClosureTask(closure)); 40 | } -------------------------------------------------------------------------------- /src/subprocess.old/main_message_loop/main_message_loop_std.cpp: -------------------------------------------------------------------------------- 1 | // Copied from upstream cefclient with minor modifications. 2 | 3 | // Copyright (c) 2015 The Chromium Embedded Framework Authors. All rights 4 | // reserved. Use of this source code is governed by a BSD-style license that 5 | // can be found in the LICENSE file. 6 | 7 | #include "main_message_loop_std.h" 8 | 9 | #include "include/cef_app.h" 10 | 11 | MainMessageLoopStd::MainMessageLoopStd() { 12 | } 13 | 14 | int MainMessageLoopStd::Run() { 15 | CefRunMessageLoop(); 16 | return 0; 17 | } 18 | 19 | void MainMessageLoopStd::Quit() { 20 | CefQuitMessageLoop(); 21 | } 22 | 23 | void MainMessageLoopStd::PostTask(CefRefPtr task) { 24 | CefPostTask(TID_UI, task); 25 | } 26 | 27 | bool MainMessageLoopStd::RunsTasksOnCurrentThread() const { 28 | return CefCurrentlyOn(TID_UI); 29 | } 30 | 31 | #if defined(OS_WIN) 32 | void MainMessageLoopStd::SetCurrentModelessDialog(HWND hWndDialog) { 33 | // Nothing to do here. The Chromium message loop implementation will 34 | // internally route dialog messages. 35 | } 36 | #endif 37 | -------------------------------------------------------------------------------- /src/subprocess.old/main_message_loop/main_message_loop_std.h: -------------------------------------------------------------------------------- 1 | // Copied from upstream cefclient with minor modifications. 2 | 3 | // Copyright (c) 2015 The Chromium Embedded Framework Authors. All rights 4 | // reserved. Use of this source code is governed by a BSD-style license that 5 | // can be found in the LICENSE file. 6 | 7 | #ifndef CEF_TESTS_CEFCLIENT_BROWSER_MAIN_MESSAGE_LOOP_STD_H_ 8 | #define CEF_TESTS_CEFCLIENT_BROWSER_MAIN_MESSAGE_LOOP_STD_H_ 9 | #pragma once 10 | 11 | #include "main_message_loop.h" 12 | 13 | // Represents the main message loop in the browser process. This implementation 14 | // is a light-weight wrapper around the Chromium UI thread. 15 | class MainMessageLoopStd : public MainMessageLoop { 16 | public: 17 | MainMessageLoopStd(); 18 | 19 | // MainMessageLoop methods. 20 | int Run() override; 21 | void Quit() override; 22 | void PostTask(CefRefPtr task) override; 23 | bool RunsTasksOnCurrentThread() const override; 24 | 25 | #if defined(OS_WIN) 26 | void SetCurrentModelessDialog(HWND hWndDialog) override; 27 | #endif 28 | 29 | private: 30 | DISALLOW_COPY_AND_ASSIGN(MainMessageLoopStd); 31 | }; 32 | 33 | #endif // CEF_TESTS_CEFCLIENT_BROWSER_MAIN_MESSAGE_LOOP_STD_H_ 34 | -------------------------------------------------------------------------------- /src/subprocess.old/main_message_loop/util_win.h: -------------------------------------------------------------------------------- 1 | // Copied from upstream cefclient with minor modifications. 2 | // Windows UNICODE API calls were converted to ANSI or commented out. 3 | 4 | // Copyright (c) 2015 The Chromium Embedded Framework Authors. All rights 5 | // reserved. Use of this source code is governed by a BSD-style license that 6 | // can be found in the LICENSE file. 7 | 8 | #ifndef CEF_TESTS_CEFCLIENT_BROWSER_UTIL_WIN_H_ 9 | #define CEF_TESTS_CEFCLIENT_BROWSER_UTIL_WIN_H_ 10 | #pragma once 11 | 12 | #include 13 | #include 14 | 15 | #include "include/internal/cef_types_wrappers.h" 16 | 17 | // Set the window's user data pointer. 18 | void SetUserDataPtr(HWND hWnd, void* ptr); 19 | 20 | // Return the window's user data pointer. 21 | template 22 | T GetUserDataPtr(HWND hWnd) { 23 | return reinterpret_cast(GetWindowLongPtr(hWnd, GWLP_USERDATA)); 24 | } 25 | 26 | // Set the window's window procedure pointer and return the old value. 27 | WNDPROC SetWndProcPtr(HWND hWnd, WNDPROC wndProc); 28 | 29 | // Return the resource string with the specified id. 30 | //std::wstring GetResourceString(UINT id); 31 | 32 | int GetCefMouseModifiers(WPARAM wparam); 33 | int GetCefKeyboardModifiers(WPARAM wparam, LPARAM lparam); 34 | bool IsKeyDown(int keycode); 35 | 36 | // Returns the device scale factor. For example, 200% display scaling will 37 | // return 2.0. 38 | float GetDeviceScaleFactor(); 39 | 40 | #endif // CEF_TESTS_CEFCLIENT_BROWSER_UTIL_WIN_H_ 41 | -------------------------------------------------------------------------------- /src/subprocess.old/print_handler_gtk.h: -------------------------------------------------------------------------------- 1 | // COPIED from upstream "cef/tests/cefclient/browser/" directory 2 | // with minor modifications. See the .patch file in current directory. 3 | 4 | // Copyright (c) 2014 The Chromium Embedded Framework Authors. 5 | // Portions Copyright (c) 2012 The Chromium Authors. All rights reserved. 6 | // Use of this source code is governed by a BSD-style license that can be 7 | // found in the LICENSE file. 8 | 9 | #ifndef CEF_TESTS_CEFCLIENT_BROWSER_PRINT_HANDLER_GTK_H_ 10 | #define CEF_TESTS_CEFCLIENT_BROWSER_PRINT_HANDLER_GTK_H_ 11 | #pragma once 12 | 13 | #include 14 | 15 | #include "include/cef_print_handler.h" 16 | 17 | class ClientPrintHandlerGtk : public CefPrintHandler { 18 | public: 19 | ClientPrintHandlerGtk(); 20 | virtual ~ClientPrintHandlerGtk(); 21 | 22 | // CefPrintHandler methods. 23 | void OnPrintStart(CefRefPtr browser) OVERRIDE; 24 | void OnPrintSettings(CefRefPtr browser, 25 | CefRefPtr settings, 26 | bool get_defaults) OVERRIDE; 27 | bool OnPrintDialog(CefRefPtr browser, 28 | bool has_selection, 29 | CefRefPtr callback) OVERRIDE; 30 | bool OnPrintJob(CefRefPtr browser, 31 | const CefString& document_name, 32 | const CefString& pdf_file_path, 33 | CefRefPtr callback) OVERRIDE; 34 | void OnPrintReset(CefRefPtr browser) OVERRIDE; 35 | CefSize GetPdfPaperSize(int device_units_per_inch) OVERRIDE; 36 | 37 | private: 38 | // Print handler. 39 | struct PrintHandler; 40 | PrintHandler* GetPrintHandler(CefRefPtr browser); 41 | 42 | // Map of browser ID to print handler. 43 | typedef std::map PrintHandlerMap; 44 | PrintHandlerMap print_handler_map_; 45 | 46 | IMPLEMENT_REFCOUNTING(ClientPrintHandlerGtk); 47 | DISALLOW_COPY_AND_ASSIGN(ClientPrintHandlerGtk); 48 | }; 49 | 50 | #endif // CEF_TESTS_CEFCLIENT_BROWSER_PRINT_HANDLER_GTK_H_ 51 | -------------------------------------------------------------------------------- /src/subprocess.old/v8function_handler.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012 CEF Python, see the Authors file. 2 | // All rights reserved. Licensed under BSD 3-clause license. 3 | // Project website: https://github.com/cztomczak/cefpython 4 | 5 | #pragma once 6 | #include "include/cef_v8.h" 7 | #include "util.h" 8 | 9 | class CefPythonApp; 10 | 11 | class V8FunctionHandler 12 | : public CefV8Handler { 13 | public: 14 | V8FunctionHandler(CefRefPtr cefPythonApp, 15 | int pythonCallbackId) 16 | : cefPythonApp_(cefPythonApp), 17 | pythonCallbackId_(pythonCallbackId) { 18 | } 19 | virtual bool Execute(const CefString& name, 20 | CefRefPtr object, 21 | const CefV8ValueList& arguments, 22 | CefRefPtr& retval, 23 | CefString& exception) override; 24 | protected: 25 | CefRefPtr cefPythonApp_; 26 | int pythonCallbackId_; 27 | private: 28 | IMPLEMENT_REFCOUNTING(V8FunctionHandler); 29 | }; 30 | -------------------------------------------------------------------------------- /src/subprocess.old/v8utils.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013 CEF Python, see the Authors file. 2 | // All rights reserved. Licensed under BSD 3-clause license. 3 | // Project website: https://github.com/cztomczak/cefpython 4 | 5 | #pragma once 6 | #include "include/cef_v8.h" 7 | #include "include/cef_values.h" 8 | #include "v8function_handler.h" 9 | 10 | // ---------------------------------------------------------------------------- 11 | // V8 values to CEF values. 12 | // ---------------------------------------------------------------------------- 13 | 14 | CefRefPtr V8ValueListToCefListValue( 15 | const CefV8ValueList& v8List); 16 | 17 | void V8ValueAppendToCefListValue(const CefRefPtr v8Value, 18 | CefRefPtr listValue, 19 | int nestingLevel=0); 20 | 21 | CefRefPtr V8ObjectToCefDictionaryValue( 22 | const CefRefPtr v8Object, 23 | int nestingLevel=0); 24 | 25 | // ---------------------------------------------------------------------------- 26 | // CEF values to V8 values. 27 | // ---------------------------------------------------------------------------- 28 | 29 | CefV8ValueList CefListValueToCefV8ValueList( 30 | CefRefPtr listValue); 31 | 32 | CefRefPtr CefListValueToV8Value( 33 | CefRefPtr listValue, 34 | int nestingLevel=0); 35 | 36 | CefRefPtr CefDictionaryValueToV8Value( 37 | CefRefPtr dictValue, 38 | int nestingLevel=0); 39 | -------------------------------------------------------------------------------- /src/subprocess/.gitignore: -------------------------------------------------------------------------------- 1 | *.o 2 | *.a 3 | subprocess 4 | subprocess.dSYM/ 5 | -------------------------------------------------------------------------------- /src/subprocess/Makefile: -------------------------------------------------------------------------------- 1 | # -g - extra debug information 2 | # -O1 - more precise backtraces 3 | # -fPIC - required when using -shared option, required for use with Cython 4 | # -Wall - show important warnings 5 | # -Werror - treat warnings as errors 6 | 7 | UNAME_S = $(shell uname -s) 8 | INC = -I./../ -I./../common/ -I$(PYTHON_INCLUDE) \ 9 | -I/usr/include/gtk-2.0 \ 10 | -I/usr/include/gtk-unix-print-2.0 \ 11 | -I/usr/include/glib-2.0 \ 12 | -I/usr/include/cairo \ 13 | -I/usr/include/pango-1.0 \ 14 | -I/usr/include/harfbuzz \ 15 | -I/usr/include/gdk-pixbuf-2.0 \ 16 | -I/usr/include/atk-1.0 \ 17 | -I/usr/lib/x86_64-linux-gnu/gtk-2.0/include \ 18 | -I/usr/lib/x86_64-linux-gnu/gtk-unix-print-2.0 \ 19 | -I/usr/lib/x86_64-linux-gnu/glib-2.0/include \ 20 | -I/usr/lib/i386-linux-gnu/gtk-2.0/include \ 21 | -I/usr/lib/i386-linux-gnu/gtk-unix-print-2.0 \ 22 | -I/usr/lib/i386-linux-gnu/glib-2.0/include \ 23 | -I/usr/lib64/gtk-2.0/include \ 24 | -I/usr/lib64/gtk-unix-print-2.0 \ 25 | -I/usr/lib64/glib-2.0/include \ 26 | -I/usr/lib/gtk-2.0/include \ 27 | -I/usr/lib/gtk-2.0/gtk-unix-print-2.0 \ 28 | -I/usr/lib/glib-2.0/include 29 | 30 | ifeq ($(UNAME_S), Linux) 31 | LIB_DIRS = -L$(CEF_BIN) \ 32 | -L$(CEF_LIB) 33 | else ifeq ($(UNAME_S), Darwin) 34 | LIB_DIRS = -F$(CEF_BIN) \ 35 | -L$(CEF_LIB) 36 | endif 37 | 38 | ifeq ($(UNAME_S), Linux) 39 | CPP_FILES = print_handler_gtk.cpp ../client_handler/x11.cpp 40 | LIBS = -lcef -lX11 -lgobject-2.0 -lglib-2.0 -lgtk-x11-2.0 -lgdk-x11-2.0 41 | else ifeq ($(UNAME_S), Darwin) 42 | CPP_FILES = 43 | # Include framework before libcef_dll_wrapper 44 | LIBS = -framework "Chromium Embedded Framework" 45 | endif 46 | 47 | CCFLAGS = -DRENDERER_PROCESS $(CEF_CCFLAGS) 48 | 49 | subprocess: 50 | # -fPIC is required only for libraries included by Cython. 51 | @echo [SUBPROCESS] Building the 'subprocess' executable 52 | $(CXX) $(CCFLAGS) $(INC) $(LIB_DIRS) main.cpp cefpython_app.cpp \ 53 | v8function_handler.cpp v8utils.cpp javascript_callback.cpp \ 54 | $(CPP_FILES) \ 55 | $(CEF_LINK_FLAGS) \ 56 | $(LIBS) -lcef_dll_wrapper \ 57 | -o subprocess -Wl,-rpath,@loader_path/ 58 | -------------------------------------------------------------------------------- /src/subprocess/Makefile-libcefpythonapp: -------------------------------------------------------------------------------- 1 | # -g - extra debug information 2 | # -O1 - more precise backtraces 3 | # -fPIC - required when using -shared option, required for use with Cython 4 | # -Wall - show important warnings 5 | # -Werror - treat warnings as errors 6 | 7 | # Cython compiler options: 8 | # -fPIC -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions \ 9 | # -Wl,-z,relro 10 | 11 | UNAME_S = $(shell uname -s) 12 | CCFLAGS = -fPIC -DBROWSER_PROCESS $(CEF_CCFLAGS) 13 | 14 | ifeq ($(UNAME_S), Linux) 15 | SRC_MORE = print_handler_gtk.cpp ../client_handler/x11.cpp \ 16 | main_message_loop/main_message_loop_external_pump_linux.cpp 17 | else ifeq ($(UNAME_S), Darwin) 18 | SRC_MORE = main_message_loop/main_message_loop_external_pump_mac.mm 19 | endif 20 | 21 | SRC = cefpython_app.cpp v8function_handler.cpp v8utils.cpp \ 22 | javascript_callback.cpp \ 23 | main_message_loop/main_message_loop.cpp \ 24 | main_message_loop/main_message_loop_std.cpp \ 25 | main_message_loop/main_message_loop_external_pump.cpp \ 26 | $(SRC_MORE) 27 | 28 | OBJ = $(filter %.o, $(SRC:.cpp=.o) $(SRC:.mm=.o)) 29 | .SUFFIXES: .cpp .mm .o 30 | 31 | OUT = libcefpythonapp.a 32 | 33 | INC = -I./../ -I./../common/ -I$(PYTHON_INCLUDE) \ 34 | -I/usr/include/gtk-2.0 \ 35 | -I/usr/include/gtk-unix-print-2.0 \ 36 | -I/usr/include/glib-2.0 \ 37 | -I/usr/include/cairo \ 38 | -I/usr/include/pango-1.0 \ 39 | -I/usr/include/harfbuzz \ 40 | -I/usr/include/gdk-pixbuf-2.0 \ 41 | -I/usr/include/atk-1.0 \ 42 | -I/usr/lib/x86_64-linux-gnu/gtk-2.0/include \ 43 | -I/usr/lib/x86_64-linux-gnu/gtk-unix-print-2.0 \ 44 | -I/usr/lib/x86_64-linux-gnu/glib-2.0/include \ 45 | -I/usr/lib/i386-linux-gnu/gtk-2.0/include \ 46 | -I/usr/lib/i386-linux-gnu/gtk-unix-print-2.0 \ 47 | -I/usr/lib/i386-linux-gnu/glib-2.0/include \ 48 | -I/usr/lib64/gtk-2.0/include \ 49 | -I/usr/lib64/gtk-unix-print-2.0 \ 50 | -I/usr/lib64/glib-2.0/include \ 51 | -I/usr/lib/gtk-2.0/include \ 52 | -I/usr/lib/gtk-2.0/gtk-unix-print-2.0 \ 53 | -I/usr/lib/glib-2.0/include 54 | 55 | $(OUT): $(OBJ) 56 | @echo [CEFPYTHONAPP] Creating library $(OUT) from $(OBJ)... 57 | ar rcs $(OUT) $(OBJ) 58 | 59 | .cpp.o: 60 | @echo [CEFPYTHONAPP] Building $@ from $<... 61 | $(CXX) $(CCFLAGS) $(INC) -c $< -o $@ 62 | 63 | .mm.o: 64 | @echo [CEFPYTHONAPP] Building $@ from $<... 65 | $(CXX) $(CCFLAGS) $(INC) -c $< -o $@ 66 | -------------------------------------------------------------------------------- /src/subprocess/javascript_callback.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013 CEF Python, see the Authors file. 2 | // All rights reserved. Licensed under BSD 3-clause license. 3 | // Project website: https://github.com/cztomczak/cefpython 4 | 5 | #pragma once 6 | #include "include/cef_v8.h" 7 | 8 | CefString PutJavascriptCallback( 9 | CefRefPtr frame, CefRefPtr jsCallback); 10 | 11 | bool ExecuteJavascriptCallback(int callbackId, CefRefPtr args); 12 | 13 | void RemoveJavascriptCallbacksForFrame(CefRefPtr frame); 14 | -------------------------------------------------------------------------------- /src/subprocess/main.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013 CEF Python, see the Authors file. 2 | // All rights reserved. Licensed under BSD 3-clause license. 3 | // Project website: https://github.com/cztomczak/cefpython 4 | 5 | #include "cefpython_app.h" 6 | 7 | #if defined(OS_WIN) 8 | 9 | #include 10 | int APIENTRY wWinMain(HINSTANCE hInstance, 11 | HINSTANCE hPrevInstance, 12 | LPTSTR lpCmdLine, 13 | int nCmdShow) 14 | { 15 | UNREFERENCED_PARAMETER(hPrevInstance); 16 | UNREFERENCED_PARAMETER(lpCmdLine); 17 | 18 | // lpCmdLine does not include program name argument, must 19 | // use GetCommandLineW(). Cannot use CefCommandLine::GetGlobalCommandLine, 20 | // as CEF was not yet initialized. 21 | CefRefPtr command_line = \ 22 | CefCommandLine::CreateCommandLine(); 23 | command_line->InitFromString(GetCommandLineW()); 24 | if (command_line->HasSwitch("enable-high-dpi-support")) { 25 | CefEnableHighDPISupport(); 26 | } 27 | 28 | CefMainArgs mainArgs(hInstance); 29 | 30 | #else // defined(OS_WIN) 31 | 32 | int main(int argc, char **argv) 33 | { 34 | CefMainArgs mainArgs(argc, argv); 35 | 36 | #endif // Mac, Linux 37 | 38 | CefRefPtr app(new CefPythonApp); 39 | int exitCode = CefExecuteProcess(mainArgs, app.get(), NULL); 40 | return exitCode; 41 | } 42 | -------------------------------------------------------------------------------- /src/subprocess/main_message_loop/main_message_loop.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | 5 | #include "main_message_loop.h" 6 | 7 | #include "include/cef_task.h" 8 | #include "include/wrapper/cef_closure_task.h" 9 | 10 | namespace { 11 | 12 | MainMessageLoop* g_main_message_loop = nullptr; 13 | 14 | } // namespace 15 | 16 | MainMessageLoop::MainMessageLoop() { 17 | DCHECK(!g_main_message_loop); 18 | g_main_message_loop = this; 19 | } 20 | 21 | MainMessageLoop::~MainMessageLoop() { 22 | g_main_message_loop = nullptr; 23 | } 24 | 25 | // static 26 | MainMessageLoop* MainMessageLoop::Get() { 27 | DCHECK(g_main_message_loop); 28 | return g_main_message_loop; 29 | } 30 | 31 | void MainMessageLoop::PostClosure(base::OnceClosure closure) { 32 | PostTask(CefCreateClosureTask(std::move(closure))); 33 | } 34 | 35 | void MainMessageLoop::PostClosure(const base::RepeatingClosure& closure) { 36 | PostTask(CefCreateClosureTask(closure)); 37 | } 38 | -------------------------------------------------------------------------------- /src/subprocess/main_message_loop/main_message_loop_std.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | 5 | #include "main_message_loop_std.h" 6 | 7 | #include "include/cef_app.h" 8 | 9 | MainMessageLoopStd::MainMessageLoopStd() { 10 | } 11 | 12 | int MainMessageLoopStd::Run() { 13 | CefRunMessageLoop(); 14 | return 0; 15 | } 16 | 17 | void MainMessageLoopStd::Quit() { 18 | CefQuitMessageLoop(); 19 | } 20 | 21 | void MainMessageLoopStd::PostTask(CefRefPtr task) { 22 | CefPostTask(TID_UI, task); 23 | } 24 | 25 | bool MainMessageLoopStd::RunsTasksOnCurrentThread() const { 26 | return CefCurrentlyOn(TID_UI); 27 | } 28 | 29 | #if defined(OS_WIN) 30 | void MainMessageLoopStd::SetCurrentModelessDialog(HWND hWndDialog) { 31 | // Nothing to do here. The Chromium message loop implementation will 32 | // internally route dialog messages. 33 | } 34 | #endif 35 | -------------------------------------------------------------------------------- /src/subprocess/main_message_loop/main_message_loop_std.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | 5 | #ifndef CEF_TESTS_CEFCLIENT_BROWSER_MAIN_MESSAGE_LOOP_STD_H_ 6 | #define CEF_TESTS_CEFCLIENT_BROWSER_MAIN_MESSAGE_LOOP_STD_H_ 7 | #pragma once 8 | 9 | #include "main_message_loop.h" 10 | 11 | // Represents the main message loop in the browser process. This implementation 12 | // is a light-weight wrapper around the Chromium UI thread. 13 | class MainMessageLoopStd : public MainMessageLoop { 14 | public: 15 | MainMessageLoopStd(); 16 | 17 | // MainMessageLoop methods. 18 | int Run() override; 19 | void Quit() override; 20 | void PostTask(CefRefPtr task) override; 21 | bool RunsTasksOnCurrentThread() const override; 22 | 23 | #if defined(OS_WIN) 24 | void SetCurrentModelessDialog(HWND hWndDialog) override; 25 | #endif 26 | 27 | private: 28 | DISALLOW_COPY_AND_ASSIGN(MainMessageLoopStd); 29 | }; 30 | 31 | #endif // CEF_TESTS_CEFCLIENT_BROWSER_MAIN_MESSAGE_LOOP_STD_H_ 32 | -------------------------------------------------------------------------------- /src/subprocess/main_message_loop/util_win.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015 The Chromium Embedded Framework Authors. All rights 2 | // reserved. Use of this source code is governed by a BSD-style license that 3 | // can be found in the LICENSE file. 4 | 5 | #ifndef CEF_TESTS_CEFCLIENT_BROWSER_UTIL_WIN_H_ 6 | #define CEF_TESTS_CEFCLIENT_BROWSER_UTIL_WIN_H_ 7 | #pragma once 8 | 9 | #include 10 | #include 11 | 12 | #include "include/internal/cef_types_wrappers.h" 13 | 14 | 15 | // Returns the current time in microseconds. 16 | uint64_t GetTimeNow(); 17 | 18 | // Set the window's user data pointer. 19 | void SetUserDataPtr(HWND hWnd, void* ptr); 20 | 21 | // Return the window's user data pointer. 22 | template 23 | T GetUserDataPtr(HWND hWnd) { 24 | return reinterpret_cast(GetWindowLongPtr(hWnd, GWLP_USERDATA)); 25 | } 26 | 27 | // Set the window's window procedure pointer and return the old value. 28 | WNDPROC SetWndProcPtr(HWND hWnd, WNDPROC wndProc); 29 | 30 | // Return the resource string with the specified id. 31 | std::wstring GetResourceString(UINT id); 32 | 33 | int GetCefMouseModifiers(WPARAM wparam); 34 | int GetCefKeyboardModifiers(WPARAM wparam, LPARAM lparam); 35 | bool IsKeyDown(WPARAM wparam); 36 | 37 | // Returns the device scale factor. For example, 200% display scaling will 38 | // return 2.0. 39 | float GetDeviceScaleFactor(); 40 | 41 | #endif // CEF_TESTS_CEFCLIENT_BROWSER_UTIL_WIN_H_ 42 | -------------------------------------------------------------------------------- /src/subprocess/print_handler_gtk.h: -------------------------------------------------------------------------------- 1 | // COPIED from upstream "cef/tests/cefclient/browser/" directory 2 | // with minor modifications. See the .patch file in current directory. 3 | 4 | // Copyright (c) 2014 The Chromium Embedded Framework Authors. 5 | // Portions Copyright (c) 2012 The Chromium Authors. All rights reserved. 6 | // Use of this source code is governed by a BSD-style license that can be 7 | // found in the LICENSE file. 8 | 9 | #ifndef CEF_TESTS_CEFCLIENT_BROWSER_PRINT_HANDLER_GTK_H_ 10 | #define CEF_TESTS_CEFCLIENT_BROWSER_PRINT_HANDLER_GTK_H_ 11 | #pragma once 12 | 13 | #include 14 | 15 | #include "include/cef_print_handler.h" 16 | 17 | class ClientPrintHandlerGtk : public CefPrintHandler { 18 | public: 19 | ClientPrintHandlerGtk(); 20 | virtual ~ClientPrintHandlerGtk(); 21 | 22 | // CefPrintHandler methods. 23 | void OnPrintStart(CefRefPtr browser) OVERRIDE; 24 | void OnPrintSettings(CefRefPtr browser, 25 | CefRefPtr settings, 26 | bool get_defaults) OVERRIDE; 27 | bool OnPrintDialog(CefRefPtr browser, 28 | bool has_selection, 29 | CefRefPtr callback) OVERRIDE; 30 | bool OnPrintJob(CefRefPtr browser, 31 | const CefString& document_name, 32 | const CefString& pdf_file_path, 33 | CefRefPtr callback) OVERRIDE; 34 | void OnPrintReset(CefRefPtr browser) OVERRIDE; 35 | CefSize GetPdfPaperSize(int device_units_per_inch) OVERRIDE; 36 | 37 | private: 38 | // Print handler. 39 | struct PrintHandler; 40 | PrintHandler* GetPrintHandler(CefRefPtr browser); 41 | 42 | // Map of browser ID to print handler. 43 | typedef std::map PrintHandlerMap; 44 | PrintHandlerMap print_handler_map_; 45 | 46 | IMPLEMENT_REFCOUNTING(ClientPrintHandlerGtk); 47 | DISALLOW_COPY_AND_ASSIGN(ClientPrintHandlerGtk); 48 | }; 49 | 50 | #endif // CEF_TESTS_CEFCLIENT_BROWSER_PRINT_HANDLER_GTK_H_ 51 | -------------------------------------------------------------------------------- /src/subprocess/v8function_handler.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012 CEF Python, see the Authors file. 2 | // All rights reserved. Licensed under BSD 3-clause license. 3 | // Project website: https://github.com/cztomczak/cefpython 4 | 5 | #pragma once 6 | #include "include/cef_v8.h" 7 | #include "util.h" 8 | 9 | class CefPythonApp; 10 | 11 | class V8FunctionHandler 12 | : public CefV8Handler { 13 | public: 14 | V8FunctionHandler(CefRefPtr cefPythonApp, 15 | int pythonCallbackId) 16 | : cefPythonApp_(cefPythonApp), 17 | pythonCallbackId_(pythonCallbackId) { 18 | } 19 | virtual bool Execute(const CefString& name, 20 | CefRefPtr object, 21 | const CefV8ValueList& arguments, 22 | CefRefPtr& retval, 23 | CefString& exception) override; 24 | protected: 25 | CefRefPtr cefPythonApp_; 26 | int pythonCallbackId_; 27 | private: 28 | IMPLEMENT_REFCOUNTING(V8FunctionHandler); 29 | }; 30 | -------------------------------------------------------------------------------- /src/subprocess/v8utils.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013 CEF Python, see the Authors file. 2 | // All rights reserved. Licensed under BSD 3-clause license. 3 | // Project website: https://github.com/cztomczak/cefpython 4 | 5 | #pragma once 6 | #include "include/cef_v8.h" 7 | #include "include/cef_values.h" 8 | #include "v8function_handler.h" 9 | 10 | // ---------------------------------------------------------------------------- 11 | // V8 values to CEF values. 12 | // ---------------------------------------------------------------------------- 13 | 14 | CefRefPtr V8ValueListToCefListValue( 15 | const CefV8ValueList& v8List); 16 | 17 | void V8ValueAppendToCefListValue(const CefRefPtr v8Value, 18 | CefRefPtr listValue, 19 | int nestingLevel=0); 20 | 21 | CefRefPtr V8ObjectToCefDictionaryValue( 22 | const CefRefPtr v8Object, 23 | int nestingLevel=0); 24 | 25 | // ---------------------------------------------------------------------------- 26 | // CEF values to V8 values. 27 | // ---------------------------------------------------------------------------- 28 | 29 | CefV8ValueList CefListValueToCefV8ValueList( 30 | CefRefPtr listValue); 31 | 32 | CefRefPtr CefListValueToV8Value( 33 | CefRefPtr listValue, 34 | int nestingLevel=0); 35 | 36 | CefRefPtr CefDictionaryValueToV8Value( 37 | CefRefPtr dictValue, 38 | int nestingLevel=0); 39 | -------------------------------------------------------------------------------- /src/time_utils.pyx: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2013 CEF Python, see the Authors file. 2 | # All rights reserved. Licensed under BSD 3-clause license. 3 | # Project website: https://github.com/cztomczak/cefpython 4 | 5 | include "cefpython.pyx" 6 | 7 | cdef extern from "include/internal/cef_time.h": 8 | cdef int cef_time_to_basetime(cef_time_t* _from, cef_basetime_t* _to) 9 | cdef int cef_time_from_basetime(cef_basetime_t _from, cef_time_t* _to) 10 | 11 | cdef void DatetimeToCefTimeT(object pyDatetime, cef_time_t& timeT) except *: 12 | if not isinstance(pyDatetime, datetime.datetime): 13 | raise Exception("Expected object of type datetime.datetime") 14 | timeT.year = pyDatetime.year 15 | timeT.month = pyDatetime.month 16 | timeT.day_of_week = pyDatetime.weekday() 17 | timeT.day_of_month = pyDatetime.day 18 | timeT.hour = pyDatetime.hour 19 | timeT.minute = pyDatetime.minute 20 | timeT.second = pyDatetime.second 21 | # Milliseconds/microseconds are ignored. 22 | timeT.millisecond = 0 23 | 24 | cdef object CefTimeTToDatetime(cef_time_t timeT): 25 | cdef int year = timeT.year 26 | if year < datetime.MINYEAR: 27 | year = datetime.MINYEAR 28 | if year > datetime.MAXYEAR: 29 | year = datetime.MAXYEAR 30 | cdef int month = timeT.month 31 | if month == 0: 32 | month = 1 33 | cdef int day_of_month = timeT.day_of_month 34 | if day_of_month == 0: 35 | day_of_month = 1 36 | cdef int second = timeT.second 37 | if second > 59: 38 | # Ignore leap seconds as datetime.datetime() allows 0-59 only. 39 | second = 59 40 | # Milliseconds/microseconds are ignored. 41 | return datetime.datetime(year, month, day_of_month, 42 | timeT.hour, timeT.minute, second) 43 | 44 | cdef void DatetimeToCefBasetimeT(object pyDatetime, cef_basetime_t& timeT) except *: 45 | if not isinstance(pyDatetime, datetime.datetime): 46 | raise Exception("Expected object of type datetime.datetime") 47 | cdef cef_time_t cefTime 48 | DatetimeToCefTimeT(pyDatetime, cefTime) 49 | cef_time_to_basetime(&cefTime, &timeT) 50 | 51 | cdef object CefBasetimeTToDatetime(cef_basetime_t timeT): 52 | cdef cef_time_t cefTime 53 | cef_time_from_basetime(timeT, &cefTime) 54 | return CefTimeTToDatetime(cefTime) -------------------------------------------------------------------------------- /src/web_plugin_info.pyx: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2013 CEF Python, see the Authors file. 2 | # All rights reserved. Licensed under BSD 3-clause license. 3 | # Project website: https://github.com/cztomczak/cefpython 4 | 5 | include "cefpython.pyx" 6 | 7 | # cdef PyWebPluginInfo CreatePyWebPluginInfo( 8 | # CefRefPtr[CefWebPluginInfo] cefPlugin): 9 | # cdef PyWebPluginInfo pyPlugin = PyWebPluginInfo() 10 | # pyPlugin.cefPlugin = cefPlugin 11 | # return pyPlugin 12 | 13 | # cdef class PyWebPluginInfo: 14 | # cdef CefRefPtr[CefWebPluginInfo] cefPlugin 15 | 16 | # cpdef py_string GetName(self): 17 | # return CefToPyString(self.cefPlugin.get().GetName()) 18 | 19 | # cpdef py_string GetPath(self): 20 | # return CefToPyString(self.cefPlugin.get().GetPath()) 21 | 22 | # cpdef py_string GetVersion(self): 23 | # return CefToPyString(self.cefPlugin.get().GetVersion()) 24 | 25 | # cpdef py_string GetDescription(self): 26 | # return CefToPyString(self.cefPlugin.get().GetDescription()) 27 | -------------------------------------------------------------------------------- /src/window_utils_linux.pyx: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2013 CEF Python, see the Authors file. 2 | # All rights reserved. Licensed under BSD 3-clause license. 3 | # Project website: https://github.com/cztomczak/cefpython 4 | 5 | include "cefpython.pyx" 6 | 7 | class WindowUtils: 8 | # You have to overwrite this class and provide implementations 9 | # for these methods. 10 | 11 | @classmethod 12 | def OnSetFocus(cls, WindowHandle windowHandle, long msg, long wparam, 13 | long lparam): 14 | # Available only on Windows, but have it available on other 15 | # platforms so that PyCharm doesn't warn about unresolved reference. 16 | pass 17 | 18 | @classmethod 19 | def OnSize(cls, WindowHandle windowHandle, long msg, long wparam, 20 | long lparam): 21 | # Available only on Windows, but have it available on other 22 | # platforms so that PyCharm doesn't warn about unresolved reference. 23 | pass 24 | 25 | @classmethod 26 | def OnEraseBackground(cls, WindowHandle windowHandle, long msg, 27 | long wparam, long lparam): 28 | # Available only on Windows, but have it available on other 29 | # platforms so that PyCharm doesn't warn about unresolved reference. 30 | pass 31 | 32 | @classmethod 33 | def GetParentHandle(cls, WindowHandle windowHandle): 34 | Debug("WindowUtils::GetParentHandle() not implemented (returns 0)") 35 | return 0 36 | 37 | @classmethod 38 | def IsWindowHandle(cls, WindowHandle windowHandle): 39 | Debug("WindowUtils::IsWindowHandle() not implemented (always True)") 40 | return True 41 | 42 | @classmethod 43 | def gtk_plug_new(cls, WindowHandle gdkNativeWindow): 44 | return gtk_plug_new(gdkNativeWindow) 45 | 46 | @classmethod 47 | def gtk_widget_show(cls, WindowHandle gtkWidgetPtr): 48 | with nogil: 49 | gtk_widget_show(gtkWidgetPtr) 50 | 51 | @classmethod 52 | def InstallX11ErrorHandlers(cls): 53 | with nogil: 54 | x11.InstallX11ErrorHandlers() 55 | -------------------------------------------------------------------------------- /src/window_utils_mac.pyx: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2015 CEF Python, see the Authors file. 2 | # All rights reserved. Licensed under BSD 3-clause license. 3 | # Project website: https://github.com/cztomczak/cefpython 4 | 5 | include "cefpython.pyx" 6 | 7 | class WindowUtils: 8 | # You have to overwrite this class and provide implementations 9 | # for these methods. 10 | 11 | @classmethod 12 | def OnSetFocus(cls, WindowHandle windowHandle, long msg, long wparam, 13 | long lparam): 14 | # Available only on Windows, but have it available on other 15 | # platforms so that PyCharm doesn't warn about unresolved reference. 16 | pass 17 | 18 | @classmethod 19 | def OnSize(cls, WindowHandle windowHandle, long msg, long wparam, 20 | long lparam): 21 | # Available only on Windows, but have it available on other 22 | # platforms so that PyCharm doesn't warn about unresolved reference. 23 | pass 24 | 25 | @classmethod 26 | def OnEraseBackground(cls, WindowHandle windowHandle, long msg, 27 | long wparam, long lparam): 28 | # Available only on Windows, but have it available on other 29 | # platforms so that PyCharm doesn't warn about unresolved reference. 30 | pass 31 | 32 | @classmethod 33 | def GetParentHandle(cls, WindowHandle windowHandle): 34 | Debug("WindowUtils::GetParentHandle() not implemented (returns 0)") 35 | return 0 36 | 37 | @classmethod 38 | def IsWindowHandle(cls, WindowHandle windowHandle): 39 | Debug("WindowUtils::IsWindowHandle() not implemented (always True)") 40 | return True 41 | 42 | @classmethod 43 | def InstallX11ErrorHandlers(cls): 44 | pass 45 | -------------------------------------------------------------------------------- /tools/installer/cefpython3.README.txt: -------------------------------------------------------------------------------- 1 | 1. To install CEF Python 3 package type: 2 | 3 | python setup.py install 4 | 5 | On Linux/Mac if using system Python then you need to add sudo: 6 | 7 | sudo python setup.py install 8 | 9 | 2. To run examples enter the examples/ directory, 10 | start with the hello_world.py example: 11 | 12 | cd examples/ 13 | python hello_world.py 14 | -------------------------------------------------------------------------------- /tools/requirements.py: -------------------------------------------------------------------------------- 1 | """ 2 | Installs Python dependencies using the pip tool. 3 | See the requirements.txt file. 4 | python -m pip install --upgrade -r ../tools/requirements.txt 5 | """ 6 | 7 | from common import * 8 | import subprocess 9 | 10 | 11 | def main(): 12 | args = [] 13 | if sys.executable.startswith("/usr/"): 14 | args.append("sudo") 15 | requirements = os.path.join(TOOLS_DIR, "requirements.txt") 16 | args.extend([sys.executable, "-m", "pip", "install", "--upgrade", 17 | "-r", requirements]) 18 | retcode = subprocess.call(args) 19 | sys.exit(retcode) 20 | 21 | 22 | if __name__ == "__main__": 23 | main() 24 | -------------------------------------------------------------------------------- /tools/requirements.txt: -------------------------------------------------------------------------------- 1 | Cython == 0.29.21 2 | docopt >= 0.6.2 3 | setuptools 4 | wheel 5 | Pillow 6 | -------------------------------------------------------------------------------- /tools/run_snippets.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2018 CEF Python, see the Authors file. 2 | # All rights reserved. Licensed under BSD 3-clause license. 3 | # Project website: https://github.com/cztomczak/cefpython 4 | 5 | """ 6 | Run all snippets from the examples/snippets/ directory 7 | and display a summary at the end. 8 | """ 9 | 10 | from common import * 11 | 12 | import glob 13 | import os 14 | import subprocess 15 | import sys 16 | 17 | 18 | def main(): 19 | # Iterate over all snippets 20 | snippets_iter = glob.glob(os.path.join(SNIPPETS_DIR, "*.py")) 21 | succeeded = [] 22 | failed = [] 23 | for snippet in snippets_iter: 24 | print("[run_snippets.py] Running '{snippet}'..." 25 | .format(snippet=os.path.basename(snippet))) 26 | retcode = subprocess.call([sys.executable, snippet]) 27 | if retcode == 0: 28 | succeeded.append(os.path.basename(snippet)) 29 | else: 30 | print("[run_snippets.py] ERROR while running snippet: {snippet}" 31 | .format(snippet=snippet)) 32 | failed.append(os.path.basename(snippet)) 33 | 34 | # Print summary 35 | summary = "" 36 | for snippet in succeeded: 37 | summary += " OK {snippet}{nl}"\ 38 | .format(snippet=snippet, nl=os.linesep) 39 | for snippet in failed: 40 | summary += " ERROR {snippet}{nl}"\ 41 | .format(snippet=snippet, nl=os.linesep) 42 | summary = summary[:-(len(os.linesep))] 43 | print("[run_snippets.py] SUMMARY:") 44 | print(summary.format()) 45 | if len(failed): 46 | print("[run_snippets.py] ERRORS ({failed}) while running snippets" 47 | .format(failed=len(failed))) 48 | sys.exit(1) 49 | else: 50 | print("[run_snippets.py] OK ({succeeded})" 51 | .format(succeeded=len(succeeded))) 52 | 53 | 54 | if __name__ == "__main__": 55 | main() 56 | -------------------------------------------------------------------------------- /unittests/Web Data: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/llcc01/cefpython/f09e3d6bf32cf3c975328cbfa08ec6a8ac7f48f5/unittests/Web Data -------------------------------------------------------------------------------- /unittests/Web Data-journal: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/llcc01/cefpython/f09e3d6bf32cf3c975328cbfa08ec6a8ac7f48f5/unittests/Web Data-journal -------------------------------------------------------------------------------- /unittests/isolated_test.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2016 CEF Python, see the Authors file. 2 | # All rights reserved. Licensed under BSD 3-clause license. 3 | # Project website: https://github.com/cztomczak/cefpython 4 | 5 | """ 6 | Test isolated test. Isolated tests are run each using a new instance 7 | of Python interpreter. They also implement some unique features for 8 | our use case. See main_test.py for some real tests. 9 | """ 10 | 11 | import unittest 12 | # noinspection PyUnresolvedReferences 13 | import _test_runner 14 | from os.path import basename 15 | 16 | # Globals 17 | g_count = 0 18 | 19 | 20 | class IsolatedTest1(unittest.TestCase): 21 | 22 | def test_isolated1(self): 23 | global g_count 24 | g_count += 1 25 | self.assertEqual(g_count, 1) 26 | 27 | def test_isolated2(self): 28 | global g_count 29 | g_count += 1 30 | self.assertEqual(g_count, 2) 31 | 32 | 33 | class IsolatedTest2(unittest.TestCase): 34 | 35 | def test_isolated3(self): 36 | global g_count 37 | g_count += 1 38 | self.assertEqual(g_count, 1) 39 | 40 | 41 | if __name__ == "__main__": 42 | _test_runner.main(basename(__file__)) 43 | -------------------------------------------------------------------------------- /unittests/issue517.py: -------------------------------------------------------------------------------- 1 | # coding=utf8 2 | from cefpython3 import cefpython as cef 3 | import sys 4 | 5 | html = """ 6 | 7 | 8 | 9 | 10 | Title 11 | 12 | 13 | 22 | 23 | 24 | """ 25 | 26 | 27 | class RequestHandler: 28 | def GetResourceHandler(self, browser, frame, request): 29 | print(request.GetPostData()) 30 | return None 31 | 32 | def main(): 33 | sys.excepthook = cef.ExceptHook 34 | cef.Initialize() 35 | browser = cef.CreateBrowserSync(url=cef.GetDataUrl(html)) 36 | browser.SetClientHandler(RequestHandler()) 37 | cef.MessageLoop() 38 | del browser 39 | cef.Shutdown() 40 | 41 | 42 | if __name__ == '__main__': 43 | main() 44 | -------------------------------------------------------------------------------- /unittests/unittest_test.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2016 CEF Python, see the Authors file. 2 | # All rights reserved. Licensed under BSD 3-clause license. 3 | # Project website: https://github.com/cztomczak/cefpython 4 | 5 | """Test the unittest itself.""" 6 | 7 | import unittest 8 | 9 | # Globals 10 | g_count = 0 11 | g_setUpClass_count = 0 12 | g_tearDownClass_count = 0 13 | g_setUp_count = 0 14 | g_tearDown_count = 0 15 | 16 | 17 | class Test(unittest.TestCase): 18 | count = 0 19 | 20 | @classmethod 21 | def setUpClass(cls): 22 | global g_setUpClass_count 23 | g_setUpClass_count += 1 24 | 25 | @classmethod 26 | def tearDownClass(cls): 27 | global g_tearDownClass_count 28 | g_tearDownClass_count += 1 29 | 30 | def setUp(self): 31 | global g_setUp_count 32 | g_setUp_count += 1 33 | 34 | def tearDown(self): 35 | global g_tearDown_count 36 | g_tearDown_count += 1 37 | 38 | def test_unittest1(self): 39 | global g_count 40 | g_count += 1 41 | self.count += 1 42 | self.assertEqual(g_count, 1) 43 | self.assertEqual(self.count, 1) 44 | self.assertEqual(g_setUpClass_count, 1) 45 | self.assertEqual(g_tearDownClass_count, 0) 46 | 47 | def test_unittest2(self): 48 | global g_count 49 | g_count += 1 50 | self.count += 1 51 | self.assertEqual(g_count, 2) 52 | self.assertEqual(self.count, 1) 53 | self.assertEqual(g_setUpClass_count, 1) 54 | self.assertEqual(g_tearDownClass_count, 0) 55 | 56 | def test_unittest3(self): 57 | self.assertEqual(g_setUp_count, 3) 58 | self.assertEqual(g_tearDown_count, 2) 59 | self.assertEqual(g_setUpClass_count, 1) 60 | self.assertEqual(g_tearDownClass_count, 0) 61 | 62 | 63 | if __name__ == "__main__": 64 | unittest.main() 65 | --------------------------------------------------------------------------------